2014 lines
65 KiB
JavaScript
2014 lines
65 KiB
JavaScript
//////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// This is a generated file. You can view the original //
|
|
// source in your browser if your browser supports source maps. //
|
|
// Source maps are supported by all recent versions of Chrome, Safari, //
|
|
// and Firefox, and by Internet Explorer 11. //
|
|
// //
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
(function () {
|
|
|
|
/* Imports */
|
|
var Meteor = Package.meteor.Meteor;
|
|
var global = Package.meteor.global;
|
|
var meteorEnv = Package.meteor.meteorEnv;
|
|
var meteorInstall = Package.modules.meteorInstall;
|
|
var meteorBabelHelpers = Package['babel-runtime'].meteorBabelHelpers;
|
|
var Promise = Package.promise.Promise;
|
|
var Symbol = Package['ecmascript-runtime-client'].Symbol;
|
|
var Map = Package['ecmascript-runtime-client'].Map;
|
|
var Set = Package['ecmascript-runtime-client'].Set;
|
|
|
|
/* Package-scope variables */
|
|
var DICOMWeb;
|
|
|
|
var require = meteorInstall({"node_modules":{"meteor":{"ohif:dicomweb-client":{"src":{"index.js":function(require,exports,module){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// packages/ohif_dicomweb-client/src/index.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
module.export({
|
|
DICOMWeb: function () {
|
|
return DICOMWeb;
|
|
}
|
|
});
|
|
var get;
|
|
module.watch(require("./get.js"), {
|
|
"default": function (v) {
|
|
get = v;
|
|
}
|
|
}, 0);
|
|
var getAttribute;
|
|
module.watch(require("./getAttribute.js"), {
|
|
"default": function (v) {
|
|
getAttribute = v;
|
|
}
|
|
}, 1);
|
|
var getBulkData;
|
|
module.watch(require("./getBulkData.js"), {
|
|
"default": function (v) {
|
|
getBulkData = v;
|
|
}
|
|
}, 2);
|
|
var getJSON;
|
|
module.watch(require("./getJSON.js"), {
|
|
"default": function (v) {
|
|
getJSON = v;
|
|
}
|
|
}, 3);
|
|
var getModalities;
|
|
module.watch(require("./getModalities.js"), {
|
|
"default": function (v) {
|
|
getModalities = v;
|
|
}
|
|
}, 4);
|
|
var getName;
|
|
module.watch(require("./getName.js"), {
|
|
"default": function (v) {
|
|
getName = v;
|
|
}
|
|
}, 5);
|
|
var getNumber;
|
|
module.watch(require("./getNumber.js"), {
|
|
"default": function (v) {
|
|
getNumber = v;
|
|
}
|
|
}, 6);
|
|
var getString;
|
|
module.watch(require("./getString.js"), {
|
|
"default": function (v) {
|
|
getString = v;
|
|
}
|
|
}, 7);
|
|
var getAccessToken;
|
|
module.watch(require("./getAccessToken.js"), {
|
|
"default": function (v) {
|
|
getAccessToken = v;
|
|
}
|
|
}, 8);
|
|
var makeRequest;
|
|
module.watch(require("./makeRequest.js"), {
|
|
"default": function (v) {
|
|
makeRequest = v;
|
|
}
|
|
}, 9);
|
|
var DICOMWeb = {
|
|
get: get,
|
|
getAttribute: getAttribute,
|
|
getBulkData: getBulkData,
|
|
getJSON: getJSON,
|
|
getModalities: getModalities,
|
|
getName: getName,
|
|
getNumber: getNumber,
|
|
getString: getString,
|
|
getAccessToken: getAccessToken,
|
|
makeRequest: makeRequest
|
|
};
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
},"get.js":function(require,exports,module){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// packages/ohif_dicomweb-client/src/get.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
|
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
|
|
var makeRequest;
|
|
module.watch(require("./makeRequest"), {
|
|
"default": function (v) {
|
|
makeRequest = v;
|
|
}
|
|
}, 0);
|
|
|
|
/**
|
|
* Make a request to the URL given a set of options.
|
|
* This function will add optional timing, request, and respone logging.
|
|
*
|
|
* @param {String} url
|
|
* @param {Object} options
|
|
* @return {Promise<*>}
|
|
*/
|
|
var get = function () {
|
|
function get(url, options) {
|
|
var result;
|
|
return _regenerator.default.async(function () {
|
|
function get$(_context) {
|
|
while (1) {
|
|
switch (_context.prev = _context.next) {
|
|
case 0:
|
|
if (options.logRequests) {
|
|
console.log(url);
|
|
}
|
|
|
|
if (options.logTiming) {
|
|
console.time(url);
|
|
}
|
|
|
|
_context.next = 4;
|
|
return _regenerator.default.awrap(makeRequest(url, options));
|
|
|
|
case 4:
|
|
result = _context.sent;
|
|
|
|
if (options.logTiming) {
|
|
console.timeEnd(url);
|
|
}
|
|
|
|
if (options.logResponses) {
|
|
console.info(result);
|
|
}
|
|
|
|
return _context.abrupt("return", result);
|
|
|
|
case 8:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}
|
|
}
|
|
|
|
return get$;
|
|
}(), null, this);
|
|
}
|
|
|
|
return get;
|
|
}();
|
|
|
|
module.exportDefault(get);
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
},"getAccessToken.js":function(require,exports,module){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// packages/ohif_dicomweb-client/src/getAccessToken.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
module.export({
|
|
"default": function () {
|
|
return getAccessToken;
|
|
}
|
|
});
|
|
|
|
function getAccessToken() {
|
|
if (!global.window || !window.sessionStorage || !sessionStorage) {
|
|
return;
|
|
}
|
|
|
|
return sessionStorage.token;
|
|
}
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
},"getAttribute.js":function(require,exports,module){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// packages/ohif_dicomweb-client/src/getAttribute.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
/**
|
|
* Returns the specified element as a dicom attribute group/element.
|
|
*
|
|
* @param element - The group/element of the element (e.g. '00280009')
|
|
* @param [defaultValue] - The value to return if the element is not present
|
|
* @returns {*}
|
|
*/
|
|
var getAttribute = function (element, defaultValue) {
|
|
if (!element) {
|
|
return defaultValue;
|
|
} // Value is not present if the attribute has a zero length value
|
|
|
|
|
|
if (!element.Value) {
|
|
return defaultValue;
|
|
} // Sanity check to make sure we have at least one entry in the array.
|
|
|
|
|
|
if (!element.Value.length) {
|
|
return defaultValue;
|
|
}
|
|
|
|
return convertToInt(element.Value);
|
|
};
|
|
|
|
function convertToInt(input) {
|
|
function padFour(input) {
|
|
var l = input.length;
|
|
if (l == 0) return '0000';
|
|
if (l == 1) return '000' + input;
|
|
if (l == 2) return '00' + input;
|
|
if (l == 3) return '0' + input;
|
|
return input;
|
|
}
|
|
|
|
var output = '';
|
|
|
|
for (var i = 0; i < input.length; i++) {
|
|
for (var j = 0; j < input[i].length; j++) {
|
|
output += padFour(input[i].charCodeAt(j).toString(16));
|
|
}
|
|
}
|
|
|
|
return parseInt(output, 16);
|
|
}
|
|
|
|
module.exportDefault(getAttribute);
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
},"getBulkData.js":function(require,exports,module){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// packages/ohif_dicomweb-client/src/getBulkData.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
|
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
|
|
var get;
|
|
module.watch(require("./get.js"), {
|
|
"default": function (v) {
|
|
get = v;
|
|
}
|
|
}, 0);
|
|
var ASCII = 'ascii';
|
|
|
|
function getMultipartContentInfo(headers) {
|
|
var multipartRegex = /^\s*multipart\/[^;]+/g;
|
|
var contentType = headers.get('content-type');
|
|
var dict = null;
|
|
|
|
if (typeof contentType === 'string' && multipartRegex.test(contentType)) {
|
|
var _match;
|
|
|
|
var pairRegex = /;\s*([^=]+)=([^;\r\n]+)/g;
|
|
pairRegex.lastIndex = multipartRegex.lastIndex;
|
|
|
|
while ((_match = pairRegex.exec(contentType)) !== null) {
|
|
var key = _match[1];
|
|
var value = _match[2];
|
|
|
|
if (dict === null) {
|
|
dict = {};
|
|
}
|
|
|
|
dict[key] = value;
|
|
}
|
|
}
|
|
|
|
return dict;
|
|
}
|
|
|
|
function parseContentHeader(data, offset) {
|
|
var endOfHeader = data.indexOf('\r\n\r\n', offset);
|
|
|
|
if (endOfHeader < 0 || endOfHeader <= offset || endOfHeader > data.length) {
|
|
throw new Error('End of content header cannot be determined...');
|
|
}
|
|
|
|
var header = {
|
|
start: offset,
|
|
end: endOfHeader + 4,
|
|
fields: {}
|
|
};
|
|
var headerRegex = /([\w\-]+):\s*([^\r\n]+)(?:\r\n)?/g;
|
|
var headerContentRegex = /\t([^\r\n]+)(?:\r\n)?/g;
|
|
var headerString = data.slice(offset, endOfHeader);
|
|
var match;
|
|
|
|
while ((match = headerRegex.exec(headerString)) !== null) {
|
|
var key = match[1].toLowerCase(),
|
|
value = match[2];
|
|
|
|
while (headerString.charAt(headerRegex.lastIndex) === '\t') {
|
|
headerContentRegex.lastIndex = headerRegex.lastIndex;
|
|
|
|
if ((match = headerContentRegex.exec(headerString)) !== null) {
|
|
headerRegex.lastIndex = headerContentRegex.lastIndex;
|
|
value += ' ' + match[1];
|
|
continue;
|
|
}
|
|
|
|
break;
|
|
}
|
|
|
|
header.fields[key] = value;
|
|
}
|
|
|
|
return header;
|
|
}
|
|
|
|
function toBytes(input) {
|
|
var data = [];
|
|
|
|
for (var i = 0; i < input.length; i++) {
|
|
data.push(input.charCodeAt(i));
|
|
}
|
|
|
|
return data;
|
|
}
|
|
|
|
function parseResponse(headers, data) {
|
|
var contentInfo = getMultipartContentInfo(headers);
|
|
|
|
if (!contentInfo || !contentInfo.boundary) {
|
|
throw new Error('Content boundary not specified...');
|
|
}
|
|
|
|
var boundary = contentInfo.boundary;
|
|
var delimiter = '--' + boundary + '\r\n';
|
|
var index = data.indexOf(delimiter, 0, ASCII);
|
|
|
|
if (index < 0) {
|
|
throw new Error('DICOMWeb: The specified boundary could not be found...');
|
|
}
|
|
|
|
var closingIndex;
|
|
var closingDelimiter = '\r\n--' + boundary + '--';
|
|
index += delimiter.length;
|
|
|
|
if (data[index] !== 0x0D || data[index + 1] !== 0x0A) {
|
|
// multipart content headers are present, so let's parse them...
|
|
var contentHeader = parseContentHeader(data, index);
|
|
|
|
if (contentHeader && contentHeader.end > index) {
|
|
if (contentHeader.fields['content-length'] > 0) {
|
|
var endOfData = contentHeader.end + parseInt(contentHeader.fields['content-length'], 10);
|
|
|
|
if (endOfData === data.indexOf(closingDelimiter, endOfData)) {
|
|
// content-length is valid...
|
|
return data.slice(contentHeader.end, endOfData);
|
|
}
|
|
}
|
|
|
|
index = contentHeader.end;
|
|
}
|
|
} else {
|
|
// no headers, the content comes right after...
|
|
index += 2;
|
|
}
|
|
|
|
closingIndex = data.indexOf(closingDelimiter, index);
|
|
|
|
if (closingIndex < 0 || closingIndex < index) {
|
|
throw new Error('DICOMWeb: The end of the content could not be determined...');
|
|
}
|
|
|
|
return toBytes(data.slice(index, closingIndex));
|
|
}
|
|
|
|
var getBulkData = function () {
|
|
function _callee(url) {
|
|
var options,
|
|
response,
|
|
data,
|
|
_args = arguments;
|
|
return _regenerator.default.async(function () {
|
|
function _callee$(_context) {
|
|
while (1) {
|
|
switch (_context.prev = _context.next) {
|
|
case 0:
|
|
options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
options.headers = options.headers || {};
|
|
options.headers.Accept = 'multipart/related; type=application/octet-stream';
|
|
_context.next = 5;
|
|
return _regenerator.default.awrap(get(url, options));
|
|
|
|
case 5:
|
|
response = _context.sent;
|
|
_context.next = 8;
|
|
return _regenerator.default.awrap(response.text());
|
|
|
|
case 8:
|
|
data = _context.sent;
|
|
return _context.abrupt("return", parseResponse(response.headers, data));
|
|
|
|
case 10:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}
|
|
}
|
|
|
|
return _callee$;
|
|
}(), null, this);
|
|
}
|
|
|
|
return _callee;
|
|
}();
|
|
|
|
module.exportDefault(getBulkData);
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
},"getJSON.js":function(require,exports,module){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// packages/ohif_dicomweb-client/src/getJSON.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
|
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
|
|
var get;
|
|
module.watch(require("./get.js"), {
|
|
"default": function (v) {
|
|
get = v;
|
|
}
|
|
}, 0);
|
|
var getAttribute;
|
|
module.watch(require("./getAttribute"), {
|
|
"default": function (v) {
|
|
getAttribute = v;
|
|
}
|
|
}, 1);
|
|
|
|
var getJSON = function () {
|
|
function _callee(url, options) {
|
|
return _regenerator.default.async(function () {
|
|
function _callee$(_context) {
|
|
while (1) {
|
|
switch (_context.prev = _context.next) {
|
|
case 0:
|
|
options.headers = options.headers || {};
|
|
options.headers.Accept = 'application/json';
|
|
return _context.abrupt("return", get(url, options).then(function (response) {
|
|
if (!(response instanceof Response)) {
|
|
return '';
|
|
}
|
|
|
|
return response.json();
|
|
}));
|
|
|
|
case 3:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}
|
|
}
|
|
|
|
return _callee$;
|
|
}(), null, this);
|
|
}
|
|
|
|
return _callee;
|
|
}();
|
|
|
|
module.exportDefault(getJSON);
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
},"getModalities.js":function(require,exports,module){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// packages/ohif_dicomweb-client/src/getModalities.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
var getModalities = function (modality, modalitiesInStudy) {
|
|
var modalities = {};
|
|
|
|
if (modality) {
|
|
modalities = modality;
|
|
}
|
|
|
|
if (modalitiesInStudy) {
|
|
// Find vr in modalities
|
|
if (modalities.vr && modalities.vr === modalitiesInStudy.vr) {
|
|
for (var i = 0; i < modalitiesInStudy.Value.length; i++) {
|
|
var value = modalitiesInStudy.Value[i];
|
|
|
|
if (modalities.Value.indexOf(value) === -1) {
|
|
modalities.Value.push(value);
|
|
}
|
|
}
|
|
} else {
|
|
modalities = modalitiesInStudy;
|
|
}
|
|
}
|
|
|
|
return modalities;
|
|
};
|
|
|
|
module.exportDefault(getModalities);
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
},"getName.js":function(require,exports,module){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// packages/ohif_dicomweb-client/src/getName.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
module.export({
|
|
"default": function () {
|
|
return getName;
|
|
}
|
|
});
|
|
|
|
function getName(element, defaultValue) {
|
|
if (!element) {
|
|
return defaultValue;
|
|
} // Value is not present if the attribute has a zero length value
|
|
|
|
|
|
if (!element.Value) {
|
|
return defaultValue;
|
|
} // Sanity check to make sure we have at least one entry in the array.
|
|
|
|
|
|
if (!element.Value.length) {
|
|
return defaultValue;
|
|
} // Return the Alphabetic component group
|
|
|
|
|
|
if (element.Value[0].Alphabetic) {
|
|
return element.Value[0].Alphabetic;
|
|
} // Orthanc does not return PN properly so this is a temporary workaround
|
|
|
|
|
|
return element.Value[0];
|
|
}
|
|
|
|
;
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
},"getNumber.js":function(require,exports,module){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// packages/ohif_dicomweb-client/src/getNumber.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
module.export({
|
|
"default": function () {
|
|
return getNumber;
|
|
}
|
|
});
|
|
|
|
function getNumber(element, defaultValue) {
|
|
if (!element) {
|
|
return defaultValue;
|
|
} // Value is not present if the attribute has a zero length value
|
|
|
|
|
|
if (!element.Value) {
|
|
return defaultValue;
|
|
} // Sanity check to make sure we have at least one entry in the array.
|
|
|
|
|
|
if (!element.Value.length) {
|
|
return defaultValue;
|
|
}
|
|
|
|
return parseFloat(element.Value[0]);
|
|
}
|
|
|
|
;
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
},"getString.js":function(require,exports,module){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// packages/ohif_dicomweb-client/src/getString.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
module.export({
|
|
"default": function () {
|
|
return getString;
|
|
}
|
|
});
|
|
|
|
function getString(element, defaultValue) {
|
|
if (!element) {
|
|
return defaultValue;
|
|
} // Value is not present if the attribute has a zero length value
|
|
|
|
|
|
if (!element.Value) {
|
|
return defaultValue;
|
|
} // Sanity check to make sure we have at least one entry in the array.
|
|
|
|
|
|
if (!element.Value.length) {
|
|
return defaultValue;
|
|
} // Join the array together separated by backslash
|
|
// NOTE: Orthanc does not correctly split values into an array so the join is a no-op
|
|
|
|
|
|
return element.Value.join('\\');
|
|
}
|
|
|
|
;
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
},"makeRequest.js":function(require,exports,module){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// packages/ohif_dicomweb-client/src/makeRequest.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
|
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
|
|
var Meteor;
|
|
module.watch(require("meteor/meteor"), {
|
|
Meteor: function (v) {
|
|
Meteor = v;
|
|
}
|
|
}, 0);
|
|
var URL;
|
|
module.watch(require("url-parse"), {
|
|
"default": function (v) {
|
|
URL = v;
|
|
}
|
|
}, 1);
|
|
module.watch(require("isomorphic-fetch"));
|
|
var btoa;
|
|
module.watch(require("isomorphic-base64"), {
|
|
btoa: function (v) {
|
|
btoa = v;
|
|
}
|
|
}, 2);
|
|
var getAccessToken;
|
|
module.watch(require("./getAccessToken.js"), {
|
|
"default": function (v) {
|
|
getAccessToken = v;
|
|
}
|
|
}, 3);
|
|
|
|
function makeRequest(url, options) {
|
|
var parsed, requestOpt, accessToken;
|
|
return _regenerator.default.async(function () {
|
|
function makeRequest$(_context) {
|
|
while (1) {
|
|
switch (_context.prev = _context.next) {
|
|
case 0:
|
|
parsed = new URL(url);
|
|
requestOpt = {
|
|
method: 'GET',
|
|
headers: {}
|
|
};
|
|
accessToken = getAccessToken();
|
|
|
|
if (accessToken) {
|
|
requestOpt.headers = {
|
|
Authorization: "Bearer " + accessToken
|
|
};
|
|
} else if (options.auth) {
|
|
requestOpt.headers = {
|
|
Authorization: "Basic " + btoa(options.auth)
|
|
};
|
|
}
|
|
|
|
if (options.headers) {
|
|
Object.keys(options.headers).forEach(function (key) {
|
|
requestOpt.headers[key] = options.headers[key];
|
|
});
|
|
}
|
|
|
|
if (options.method) {
|
|
requestOpt.method = options.method;
|
|
}
|
|
|
|
if (options.method === 'POST' && options.body) {
|
|
requestOpt.body = options.body;
|
|
}
|
|
|
|
return _context.abrupt("return", new Promise(function (resolve, reject) {
|
|
// TODO: Kept getting weird build errors from RegExp
|
|
var isAbsolute = parsed.href.indexOf('http://') === 0 || parsed.href.indexOf('https://') === 0;
|
|
var url = parsed.href;
|
|
|
|
if (isAbsolute === false) {
|
|
url = Meteor.absoluteUrl(parsed.href);
|
|
}
|
|
|
|
fetch(url, requestOpt).then(function (response) {
|
|
if (response.status >= 400) {
|
|
reject(new Error(response.status));
|
|
}
|
|
|
|
if (response.status === 204) {
|
|
resolve([]);
|
|
} else {
|
|
// TODO: Handle 204 no content
|
|
resolve(response);
|
|
}
|
|
}, function (error) {
|
|
console.error('There was an error in the DICOMWeb Server');
|
|
reject(new Error(error));
|
|
});
|
|
}));
|
|
|
|
case 8:
|
|
case "end":
|
|
return _context.stop();
|
|
}
|
|
}
|
|
}
|
|
|
|
return makeRequest$;
|
|
}(), null, this);
|
|
}
|
|
|
|
module.exportDefault(makeRequest);
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
}},"node_modules":{"url-parse":{"package.json":function(require,exports){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// node_modules/meteor/ohif_dicomweb-client/node_modules/url-parse/package.json //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
exports.name = "url-parse";
|
|
exports.version = "1.4.1";
|
|
exports.main = "index.js";
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
},"index.js":function(require,exports,module){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// node_modules/meteor/ohif_dicomweb-client/node_modules/url-parse/index.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
'use strict';
|
|
|
|
var required = require('requires-port')
|
|
, qs = require('querystringify')
|
|
, protocolre = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i
|
|
, slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//;
|
|
|
|
/**
|
|
* These are the parse rules for the URL parser, it informs the parser
|
|
* about:
|
|
*
|
|
* 0. The char it Needs to parse, if it's a string it should be done using
|
|
* indexOf, RegExp using exec and NaN means set as current value.
|
|
* 1. The property we should set when parsing this value.
|
|
* 2. Indication if it's backwards or forward parsing, when set as number it's
|
|
* the value of extra chars that should be split off.
|
|
* 3. Inherit from location if non existing in the parser.
|
|
* 4. `toLowerCase` the resulting value.
|
|
*/
|
|
var rules = [
|
|
['#', 'hash'], // Extract from the back.
|
|
['?', 'query'], // Extract from the back.
|
|
['/', 'pathname'], // Extract from the back.
|
|
['@', 'auth', 1], // Extract from the front.
|
|
[NaN, 'host', undefined, 1, 1], // Set left over value.
|
|
[/:(\d+)$/, 'port', undefined, 1], // RegExp the back.
|
|
[NaN, 'hostname', undefined, 1, 1] // Set left over.
|
|
];
|
|
|
|
/**
|
|
* These properties should not be copied or inherited from. This is only needed
|
|
* for all non blob URL's as a blob URL does not include a hash, only the
|
|
* origin.
|
|
*
|
|
* @type {Object}
|
|
* @private
|
|
*/
|
|
var ignore = { hash: 1, query: 1 };
|
|
|
|
/**
|
|
* The location object differs when your code is loaded through a normal page,
|
|
* Worker or through a worker using a blob. And with the blobble begins the
|
|
* trouble as the location object will contain the URL of the blob, not the
|
|
* location of the page where our code is loaded in. The actual origin is
|
|
* encoded in the `pathname` so we can thankfully generate a good "default"
|
|
* location from it so we can generate proper relative URL's again.
|
|
*
|
|
* @param {Object|String} loc Optional default location object.
|
|
* @returns {Object} lolcation object.
|
|
* @api public
|
|
*/
|
|
function lolcation(loc) {
|
|
var location = global && global.location || {};
|
|
loc = loc || location;
|
|
|
|
var finaldestination = {}
|
|
, type = typeof loc
|
|
, key;
|
|
|
|
if ('blob:' === loc.protocol) {
|
|
finaldestination = new URL(unescape(loc.pathname), {});
|
|
} else if ('string' === type) {
|
|
finaldestination = new URL(loc, {});
|
|
for (key in ignore) delete finaldestination[key];
|
|
} else if ('object' === type) {
|
|
for (key in loc) {
|
|
if (key in ignore) continue;
|
|
finaldestination[key] = loc[key];
|
|
}
|
|
|
|
if (finaldestination.slashes === undefined) {
|
|
finaldestination.slashes = slashes.test(loc.href);
|
|
}
|
|
}
|
|
|
|
return finaldestination;
|
|
}
|
|
|
|
/**
|
|
* @typedef ProtocolExtract
|
|
* @type Object
|
|
* @property {String} protocol Protocol matched in the URL, in lowercase.
|
|
* @property {Boolean} slashes `true` if protocol is followed by "//", else `false`.
|
|
* @property {String} rest Rest of the URL that is not part of the protocol.
|
|
*/
|
|
|
|
/**
|
|
* Extract protocol information from a URL with/without double slash ("//").
|
|
*
|
|
* @param {String} address URL we want to extract from.
|
|
* @return {ProtocolExtract} Extracted information.
|
|
* @api private
|
|
*/
|
|
function extractProtocol(address) {
|
|
var match = protocolre.exec(address);
|
|
|
|
return {
|
|
protocol: match[1] ? match[1].toLowerCase() : '',
|
|
slashes: !!match[2],
|
|
rest: match[3]
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Resolve a relative URL pathname against a base URL pathname.
|
|
*
|
|
* @param {String} relative Pathname of the relative URL.
|
|
* @param {String} base Pathname of the base URL.
|
|
* @return {String} Resolved pathname.
|
|
* @api private
|
|
*/
|
|
function resolve(relative, base) {
|
|
var path = (base || '/').split('/').slice(0, -1).concat(relative.split('/'))
|
|
, i = path.length
|
|
, last = path[i - 1]
|
|
, unshift = false
|
|
, up = 0;
|
|
|
|
while (i--) {
|
|
if (path[i] === '.') {
|
|
path.splice(i, 1);
|
|
} else if (path[i] === '..') {
|
|
path.splice(i, 1);
|
|
up++;
|
|
} else if (up) {
|
|
if (i === 0) unshift = true;
|
|
path.splice(i, 1);
|
|
up--;
|
|
}
|
|
}
|
|
|
|
if (unshift) path.unshift('');
|
|
if (last === '.' || last === '..') path.push('');
|
|
|
|
return path.join('/');
|
|
}
|
|
|
|
/**
|
|
* The actual URL instance. Instead of returning an object we've opted-in to
|
|
* create an actual constructor as it's much more memory efficient and
|
|
* faster and it pleases my OCD.
|
|
*
|
|
* @constructor
|
|
* @param {String} address URL we want to parse.
|
|
* @param {Object|String} location Location defaults for relative paths.
|
|
* @param {Boolean|Function} parser Parser for the query string.
|
|
* @api public
|
|
*/
|
|
function URL(address, location, parser) {
|
|
if (!(this instanceof URL)) {
|
|
return new URL(address, location, parser);
|
|
}
|
|
|
|
var relative, extracted, parse, instruction, index, key
|
|
, instructions = rules.slice()
|
|
, type = typeof location
|
|
, url = this
|
|
, i = 0;
|
|
|
|
//
|
|
// The following if statements allows this module two have compatibility with
|
|
// 2 different API:
|
|
//
|
|
// 1. Node.js's `url.parse` api which accepts a URL, boolean as arguments
|
|
// where the boolean indicates that the query string should also be parsed.
|
|
//
|
|
// 2. The `URL` interface of the browser which accepts a URL, object as
|
|
// arguments. The supplied object will be used as default values / fall-back
|
|
// for relative paths.
|
|
//
|
|
if ('object' !== type && 'string' !== type) {
|
|
parser = location;
|
|
location = null;
|
|
}
|
|
|
|
if (parser && 'function' !== typeof parser) parser = qs.parse;
|
|
|
|
location = lolcation(location);
|
|
|
|
//
|
|
// Extract protocol information before running the instructions.
|
|
//
|
|
extracted = extractProtocol(address || '');
|
|
relative = !extracted.protocol && !extracted.slashes;
|
|
url.slashes = extracted.slashes || relative && location.slashes;
|
|
url.protocol = extracted.protocol || location.protocol || '';
|
|
address = extracted.rest;
|
|
|
|
//
|
|
// When the authority component is absent the URL starts with a path
|
|
// component.
|
|
//
|
|
if (!extracted.slashes) instructions[2] = [/(.*)/, 'pathname'];
|
|
|
|
for (; i < instructions.length; i++) {
|
|
instruction = instructions[i];
|
|
parse = instruction[0];
|
|
key = instruction[1];
|
|
|
|
if (parse !== parse) {
|
|
url[key] = address;
|
|
} else if ('string' === typeof parse) {
|
|
if (~(index = address.indexOf(parse))) {
|
|
if ('number' === typeof instruction[2]) {
|
|
url[key] = address.slice(0, index);
|
|
address = address.slice(index + instruction[2]);
|
|
} else {
|
|
url[key] = address.slice(index);
|
|
address = address.slice(0, index);
|
|
}
|
|
}
|
|
} else if ((index = parse.exec(address))) {
|
|
url[key] = index[1];
|
|
address = address.slice(0, index.index);
|
|
}
|
|
|
|
url[key] = url[key] || (
|
|
relative && instruction[3] ? location[key] || '' : ''
|
|
);
|
|
|
|
//
|
|
// Hostname, host and protocol should be lowercased so they can be used to
|
|
// create a proper `origin`.
|
|
//
|
|
if (instruction[4]) url[key] = url[key].toLowerCase();
|
|
}
|
|
|
|
//
|
|
// Also parse the supplied query string in to an object. If we're supplied
|
|
// with a custom parser as function use that instead of the default build-in
|
|
// parser.
|
|
//
|
|
if (parser) url.query = parser(url.query);
|
|
|
|
//
|
|
// If the URL is relative, resolve the pathname against the base URL.
|
|
//
|
|
if (
|
|
relative
|
|
&& location.slashes
|
|
&& url.pathname.charAt(0) !== '/'
|
|
&& (url.pathname !== '' || location.pathname !== '')
|
|
) {
|
|
url.pathname = resolve(url.pathname, location.pathname);
|
|
}
|
|
|
|
//
|
|
// We should not add port numbers if they are already the default port number
|
|
// for a given protocol. As the host also contains the port number we're going
|
|
// override it with the hostname which contains no port number.
|
|
//
|
|
if (!required(url.port, url.protocol)) {
|
|
url.host = url.hostname;
|
|
url.port = '';
|
|
}
|
|
|
|
//
|
|
// Parse down the `auth` for the username and password.
|
|
//
|
|
url.username = url.password = '';
|
|
if (url.auth) {
|
|
instruction = url.auth.split(':');
|
|
url.username = instruction[0] || '';
|
|
url.password = instruction[1] || '';
|
|
}
|
|
|
|
url.origin = url.protocol && url.host && url.protocol !== 'file:'
|
|
? url.protocol +'//'+ url.host
|
|
: 'null';
|
|
|
|
//
|
|
// The href is just the compiled result.
|
|
//
|
|
url.href = url.toString();
|
|
}
|
|
|
|
/**
|
|
* This is convenience method for changing properties in the URL instance to
|
|
* insure that they all propagate correctly.
|
|
*
|
|
* @param {String} part Property we need to adjust.
|
|
* @param {Mixed} value The newly assigned value.
|
|
* @param {Boolean|Function} fn When setting the query, it will be the function
|
|
* used to parse the query.
|
|
* When setting the protocol, double slash will be
|
|
* removed from the final url if it is true.
|
|
* @returns {URL}
|
|
* @api public
|
|
*/
|
|
function set(part, value, fn) {
|
|
var url = this;
|
|
|
|
switch (part) {
|
|
case 'query':
|
|
if ('string' === typeof value && value.length) {
|
|
value = (fn || qs.parse)(value);
|
|
}
|
|
|
|
url[part] = value;
|
|
break;
|
|
|
|
case 'port':
|
|
url[part] = value;
|
|
|
|
if (!required(value, url.protocol)) {
|
|
url.host = url.hostname;
|
|
url[part] = '';
|
|
} else if (value) {
|
|
url.host = url.hostname +':'+ value;
|
|
}
|
|
|
|
break;
|
|
|
|
case 'hostname':
|
|
url[part] = value;
|
|
|
|
if (url.port) value += ':'+ url.port;
|
|
url.host = value;
|
|
break;
|
|
|
|
case 'host':
|
|
url[part] = value;
|
|
|
|
if (/:\d+$/.test(value)) {
|
|
value = value.split(':');
|
|
url.port = value.pop();
|
|
url.hostname = value.join(':');
|
|
} else {
|
|
url.hostname = value;
|
|
url.port = '';
|
|
}
|
|
|
|
break;
|
|
|
|
case 'protocol':
|
|
url.protocol = value.toLowerCase();
|
|
url.slashes = !fn;
|
|
break;
|
|
|
|
case 'pathname':
|
|
case 'hash':
|
|
if (value) {
|
|
var char = part === 'pathname' ? '/' : '#';
|
|
url[part] = value.charAt(0) !== char ? char + value : value;
|
|
} else {
|
|
url[part] = value;
|
|
}
|
|
break;
|
|
|
|
default:
|
|
url[part] = value;
|
|
}
|
|
|
|
for (var i = 0; i < rules.length; i++) {
|
|
var ins = rules[i];
|
|
|
|
if (ins[4]) url[ins[1]] = url[ins[1]].toLowerCase();
|
|
}
|
|
|
|
url.origin = url.protocol && url.host && url.protocol !== 'file:'
|
|
? url.protocol +'//'+ url.host
|
|
: 'null';
|
|
|
|
url.href = url.toString();
|
|
|
|
return url;
|
|
}
|
|
|
|
/**
|
|
* Transform the properties back in to a valid and full URL string.
|
|
*
|
|
* @param {Function} stringify Optional query stringify function.
|
|
* @returns {String}
|
|
* @api public
|
|
*/
|
|
function toString(stringify) {
|
|
if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify;
|
|
|
|
var query
|
|
, url = this
|
|
, protocol = url.protocol;
|
|
|
|
if (protocol && protocol.charAt(protocol.length - 1) !== ':') protocol += ':';
|
|
|
|
var result = protocol + (url.slashes ? '//' : '');
|
|
|
|
if (url.username) {
|
|
result += url.username;
|
|
if (url.password) result += ':'+ url.password;
|
|
result += '@';
|
|
}
|
|
|
|
result += url.host + url.pathname;
|
|
|
|
query = 'object' === typeof url.query ? stringify(url.query) : url.query;
|
|
if (query) result += '?' !== query.charAt(0) ? '?'+ query : query;
|
|
|
|
if (url.hash) result += url.hash;
|
|
|
|
return result;
|
|
}
|
|
|
|
URL.prototype = { set: set, toString: toString };
|
|
|
|
//
|
|
// Expose the URL parser and some additional properties that might be useful for
|
|
// others or testing.
|
|
//
|
|
URL.extractProtocol = extractProtocol;
|
|
URL.location = lolcation;
|
|
URL.qs = qs;
|
|
|
|
module.exports = URL;
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
}},"requires-port":{"package.json":function(require,exports){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// node_modules/meteor/ohif_dicomweb-client/node_modules/requires-port/package.json //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
exports.name = "requires-port";
|
|
exports.version = "1.0.0";
|
|
exports.main = "index.js";
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
},"index.js":function(require,exports,module){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// node_modules/meteor/ohif_dicomweb-client/node_modules/requires-port/index.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
'use strict';
|
|
|
|
/**
|
|
* Check if we're required to add a port number.
|
|
*
|
|
* @see https://url.spec.whatwg.org/#default-port
|
|
* @param {Number|String} port Port number we need to check
|
|
* @param {String} protocol Protocol we need to check against.
|
|
* @returns {Boolean} Is it a default port for the given protocol
|
|
* @api private
|
|
*/
|
|
module.exports = function required(port, protocol) {
|
|
protocol = protocol.split(':')[0];
|
|
port = +port;
|
|
|
|
if (!port) return false;
|
|
|
|
switch (protocol) {
|
|
case 'http':
|
|
case 'ws':
|
|
return port !== 80;
|
|
|
|
case 'https':
|
|
case 'wss':
|
|
return port !== 443;
|
|
|
|
case 'ftp':
|
|
return port !== 21;
|
|
|
|
case 'gopher':
|
|
return port !== 70;
|
|
|
|
case 'file':
|
|
return false;
|
|
}
|
|
|
|
return port !== 0;
|
|
};
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
}},"querystringify":{"package.json":function(require,exports){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// node_modules/meteor/ohif_dicomweb-client/node_modules/querystringify/package.json //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
exports.name = "querystringify";
|
|
exports.version = "2.0.0";
|
|
exports.main = "index.js";
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
},"index.js":function(require,exports,module){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// node_modules/meteor/ohif_dicomweb-client/node_modules/querystringify/index.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
'use strict';
|
|
|
|
var has = Object.prototype.hasOwnProperty;
|
|
|
|
/**
|
|
* Decode a URI encoded string.
|
|
*
|
|
* @param {String} input The URI encoded string.
|
|
* @returns {String} The decoded string.
|
|
* @api private
|
|
*/
|
|
function decode(input) {
|
|
return decodeURIComponent(input.replace(/\+/g, ' '));
|
|
}
|
|
|
|
/**
|
|
* Simple query string parser.
|
|
*
|
|
* @param {String} query The query string that needs to be parsed.
|
|
* @returns {Object}
|
|
* @api public
|
|
*/
|
|
function querystring(query) {
|
|
var parser = /([^=?&]+)=?([^&]*)/g
|
|
, result = {}
|
|
, part;
|
|
|
|
while (part = parser.exec(query)) {
|
|
var key = decode(part[1])
|
|
, value = decode(part[2]);
|
|
|
|
//
|
|
// Prevent overriding of existing properties. This ensures that build-in
|
|
// methods like `toString` or __proto__ are not overriden by malicious
|
|
// querystrings.
|
|
//
|
|
if (key in result) continue;
|
|
result[key] = value;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* Transform a query string to an object.
|
|
*
|
|
* @param {Object} obj Object that should be transformed.
|
|
* @param {String} prefix Optional prefix.
|
|
* @returns {String}
|
|
* @api public
|
|
*/
|
|
function querystringify(obj, prefix) {
|
|
prefix = prefix || '';
|
|
|
|
var pairs = [];
|
|
|
|
//
|
|
// Optionally prefix with a '?' if needed
|
|
//
|
|
if ('string' !== typeof prefix) prefix = '?';
|
|
|
|
for (var key in obj) {
|
|
if (has.call(obj, key)) {
|
|
pairs.push(encodeURIComponent(key) +'='+ encodeURIComponent(obj[key]));
|
|
}
|
|
}
|
|
|
|
return pairs.length ? prefix + pairs.join('&') : '';
|
|
}
|
|
|
|
//
|
|
// Expose the module.
|
|
//
|
|
exports.stringify = querystringify;
|
|
exports.parse = querystring;
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
}},"isomorphic-fetch":{"package.json":function(require,exports){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// node_modules/meteor/ohif_dicomweb-client/node_modules/isomorphic-fetch/package.json //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
exports.name = "isomorphic-fetch";
|
|
exports.version = "2.2.1";
|
|
exports.browser = "fetch-npm-browserify.js";
|
|
exports.main = "fetch-npm-node.js";
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
},"fetch-npm-browserify.js":function(require,exports,module){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// node_modules/meteor/ohif_dicomweb-client/node_modules/isomorphic-fetch/fetch-npm-browserify.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// the whatwg-fetch polyfill installs the fetch() function
|
|
// on the global object (window or self)
|
|
//
|
|
// Return that as the export for use in Webpack, Browserify etc.
|
|
require('whatwg-fetch');
|
|
module.exports = self.fetch.bind(self);
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
}},"whatwg-fetch":{"package.json":function(require,exports){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// node_modules/meteor/ohif_dicomweb-client/node_modules/whatwg-fetch/package.json //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
exports.name = "whatwg-fetch";
|
|
exports.version = "3.0.0";
|
|
exports.main = "./dist/fetch.umd.js";
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
},"dist":{"fetch.umd.js":function(require,exports,module){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// node_modules/meteor/ohif_dicomweb-client/node_modules/whatwg-fetch/dist/fetch.umd.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
(function (global, factory) {
|
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
(factory((global.WHATWGFetch = {})));
|
|
}(this, (function (exports) { 'use strict';
|
|
|
|
var support = {
|
|
searchParams: 'URLSearchParams' in self,
|
|
iterable: 'Symbol' in self && 'iterator' in Symbol,
|
|
blob:
|
|
'FileReader' in self &&
|
|
'Blob' in self &&
|
|
(function() {
|
|
try {
|
|
new Blob();
|
|
return true
|
|
} catch (e) {
|
|
return false
|
|
}
|
|
})(),
|
|
formData: 'FormData' in self,
|
|
arrayBuffer: 'ArrayBuffer' in self
|
|
};
|
|
|
|
function isDataView(obj) {
|
|
return obj && DataView.prototype.isPrototypeOf(obj)
|
|
}
|
|
|
|
if (support.arrayBuffer) {
|
|
var viewClasses = [
|
|
'[object Int8Array]',
|
|
'[object Uint8Array]',
|
|
'[object Uint8ClampedArray]',
|
|
'[object Int16Array]',
|
|
'[object Uint16Array]',
|
|
'[object Int32Array]',
|
|
'[object Uint32Array]',
|
|
'[object Float32Array]',
|
|
'[object Float64Array]'
|
|
];
|
|
|
|
var isArrayBufferView =
|
|
ArrayBuffer.isView ||
|
|
function(obj) {
|
|
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
|
|
};
|
|
}
|
|
|
|
function normalizeName(name) {
|
|
if (typeof name !== 'string') {
|
|
name = String(name);
|
|
}
|
|
if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) {
|
|
throw new TypeError('Invalid character in header field name')
|
|
}
|
|
return name.toLowerCase()
|
|
}
|
|
|
|
function normalizeValue(value) {
|
|
if (typeof value !== 'string') {
|
|
value = String(value);
|
|
}
|
|
return value
|
|
}
|
|
|
|
// Build a destructive iterator for the value list
|
|
function iteratorFor(items) {
|
|
var iterator = {
|
|
next: function() {
|
|
var value = items.shift();
|
|
return {done: value === undefined, value: value}
|
|
}
|
|
};
|
|
|
|
if (support.iterable) {
|
|
iterator[Symbol.iterator] = function() {
|
|
return iterator
|
|
};
|
|
}
|
|
|
|
return iterator
|
|
}
|
|
|
|
function Headers(headers) {
|
|
this.map = {};
|
|
|
|
if (headers instanceof Headers) {
|
|
headers.forEach(function(value, name) {
|
|
this.append(name, value);
|
|
}, this);
|
|
} else if (Array.isArray(headers)) {
|
|
headers.forEach(function(header) {
|
|
this.append(header[0], header[1]);
|
|
}, this);
|
|
} else if (headers) {
|
|
Object.getOwnPropertyNames(headers).forEach(function(name) {
|
|
this.append(name, headers[name]);
|
|
}, this);
|
|
}
|
|
}
|
|
|
|
Headers.prototype.append = function(name, value) {
|
|
name = normalizeName(name);
|
|
value = normalizeValue(value);
|
|
var oldValue = this.map[name];
|
|
this.map[name] = oldValue ? oldValue + ', ' + value : value;
|
|
};
|
|
|
|
Headers.prototype['delete'] = function(name) {
|
|
delete this.map[normalizeName(name)];
|
|
};
|
|
|
|
Headers.prototype.get = function(name) {
|
|
name = normalizeName(name);
|
|
return this.has(name) ? this.map[name] : null
|
|
};
|
|
|
|
Headers.prototype.has = function(name) {
|
|
return this.map.hasOwnProperty(normalizeName(name))
|
|
};
|
|
|
|
Headers.prototype.set = function(name, value) {
|
|
this.map[normalizeName(name)] = normalizeValue(value);
|
|
};
|
|
|
|
Headers.prototype.forEach = function(callback, thisArg) {
|
|
for (var name in this.map) {
|
|
if (this.map.hasOwnProperty(name)) {
|
|
callback.call(thisArg, this.map[name], name, this);
|
|
}
|
|
}
|
|
};
|
|
|
|
Headers.prototype.keys = function() {
|
|
var items = [];
|
|
this.forEach(function(value, name) {
|
|
items.push(name);
|
|
});
|
|
return iteratorFor(items)
|
|
};
|
|
|
|
Headers.prototype.values = function() {
|
|
var items = [];
|
|
this.forEach(function(value) {
|
|
items.push(value);
|
|
});
|
|
return iteratorFor(items)
|
|
};
|
|
|
|
Headers.prototype.entries = function() {
|
|
var items = [];
|
|
this.forEach(function(value, name) {
|
|
items.push([name, value]);
|
|
});
|
|
return iteratorFor(items)
|
|
};
|
|
|
|
if (support.iterable) {
|
|
Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
|
|
}
|
|
|
|
function consumed(body) {
|
|
if (body.bodyUsed) {
|
|
return Promise.reject(new TypeError('Already read'))
|
|
}
|
|
body.bodyUsed = true;
|
|
}
|
|
|
|
function fileReaderReady(reader) {
|
|
return new Promise(function(resolve, reject) {
|
|
reader.onload = function() {
|
|
resolve(reader.result);
|
|
};
|
|
reader.onerror = function() {
|
|
reject(reader.error);
|
|
};
|
|
})
|
|
}
|
|
|
|
function readBlobAsArrayBuffer(blob) {
|
|
var reader = new FileReader();
|
|
var promise = fileReaderReady(reader);
|
|
reader.readAsArrayBuffer(blob);
|
|
return promise
|
|
}
|
|
|
|
function readBlobAsText(blob) {
|
|
var reader = new FileReader();
|
|
var promise = fileReaderReady(reader);
|
|
reader.readAsText(blob);
|
|
return promise
|
|
}
|
|
|
|
function readArrayBufferAsText(buf) {
|
|
var view = new Uint8Array(buf);
|
|
var chars = new Array(view.length);
|
|
|
|
for (var i = 0; i < view.length; i++) {
|
|
chars[i] = String.fromCharCode(view[i]);
|
|
}
|
|
return chars.join('')
|
|
}
|
|
|
|
function bufferClone(buf) {
|
|
if (buf.slice) {
|
|
return buf.slice(0)
|
|
} else {
|
|
var view = new Uint8Array(buf.byteLength);
|
|
view.set(new Uint8Array(buf));
|
|
return view.buffer
|
|
}
|
|
}
|
|
|
|
function Body() {
|
|
this.bodyUsed = false;
|
|
|
|
this._initBody = function(body) {
|
|
this._bodyInit = body;
|
|
if (!body) {
|
|
this._bodyText = '';
|
|
} else if (typeof body === 'string') {
|
|
this._bodyText = body;
|
|
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
|
|
this._bodyBlob = body;
|
|
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
|
|
this._bodyFormData = body;
|
|
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
|
this._bodyText = body.toString();
|
|
} else if (support.arrayBuffer && support.blob && isDataView(body)) {
|
|
this._bodyArrayBuffer = bufferClone(body.buffer);
|
|
// IE 10-11 can't handle a DataView body.
|
|
this._bodyInit = new Blob([this._bodyArrayBuffer]);
|
|
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
|
|
this._bodyArrayBuffer = bufferClone(body);
|
|
} else {
|
|
this._bodyText = body = Object.prototype.toString.call(body);
|
|
}
|
|
|
|
if (!this.headers.get('content-type')) {
|
|
if (typeof body === 'string') {
|
|
this.headers.set('content-type', 'text/plain;charset=UTF-8');
|
|
} else if (this._bodyBlob && this._bodyBlob.type) {
|
|
this.headers.set('content-type', this._bodyBlob.type);
|
|
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
|
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
|
|
}
|
|
}
|
|
};
|
|
|
|
if (support.blob) {
|
|
this.blob = function() {
|
|
var rejected = consumed(this);
|
|
if (rejected) {
|
|
return rejected
|
|
}
|
|
|
|
if (this._bodyBlob) {
|
|
return Promise.resolve(this._bodyBlob)
|
|
} else if (this._bodyArrayBuffer) {
|
|
return Promise.resolve(new Blob([this._bodyArrayBuffer]))
|
|
} else if (this._bodyFormData) {
|
|
throw new Error('could not read FormData body as blob')
|
|
} else {
|
|
return Promise.resolve(new Blob([this._bodyText]))
|
|
}
|
|
};
|
|
|
|
this.arrayBuffer = function() {
|
|
if (this._bodyArrayBuffer) {
|
|
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
|
|
} else {
|
|
return this.blob().then(readBlobAsArrayBuffer)
|
|
}
|
|
};
|
|
}
|
|
|
|
this.text = function() {
|
|
var rejected = consumed(this);
|
|
if (rejected) {
|
|
return rejected
|
|
}
|
|
|
|
if (this._bodyBlob) {
|
|
return readBlobAsText(this._bodyBlob)
|
|
} else if (this._bodyArrayBuffer) {
|
|
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
|
|
} else if (this._bodyFormData) {
|
|
throw new Error('could not read FormData body as text')
|
|
} else {
|
|
return Promise.resolve(this._bodyText)
|
|
}
|
|
};
|
|
|
|
if (support.formData) {
|
|
this.formData = function() {
|
|
return this.text().then(decode)
|
|
};
|
|
}
|
|
|
|
this.json = function() {
|
|
return this.text().then(JSON.parse)
|
|
};
|
|
|
|
return this
|
|
}
|
|
|
|
// HTTP methods whose capitalization should be normalized
|
|
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
|
|
|
|
function normalizeMethod(method) {
|
|
var upcased = method.toUpperCase();
|
|
return methods.indexOf(upcased) > -1 ? upcased : method
|
|
}
|
|
|
|
function Request(input, options) {
|
|
options = options || {};
|
|
var body = options.body;
|
|
|
|
if (input instanceof Request) {
|
|
if (input.bodyUsed) {
|
|
throw new TypeError('Already read')
|
|
}
|
|
this.url = input.url;
|
|
this.credentials = input.credentials;
|
|
if (!options.headers) {
|
|
this.headers = new Headers(input.headers);
|
|
}
|
|
this.method = input.method;
|
|
this.mode = input.mode;
|
|
this.signal = input.signal;
|
|
if (!body && input._bodyInit != null) {
|
|
body = input._bodyInit;
|
|
input.bodyUsed = true;
|
|
}
|
|
} else {
|
|
this.url = String(input);
|
|
}
|
|
|
|
this.credentials = options.credentials || this.credentials || 'same-origin';
|
|
if (options.headers || !this.headers) {
|
|
this.headers = new Headers(options.headers);
|
|
}
|
|
this.method = normalizeMethod(options.method || this.method || 'GET');
|
|
this.mode = options.mode || this.mode || null;
|
|
this.signal = options.signal || this.signal;
|
|
this.referrer = null;
|
|
|
|
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
|
|
throw new TypeError('Body not allowed for GET or HEAD requests')
|
|
}
|
|
this._initBody(body);
|
|
}
|
|
|
|
Request.prototype.clone = function() {
|
|
return new Request(this, {body: this._bodyInit})
|
|
};
|
|
|
|
function decode(body) {
|
|
var form = new FormData();
|
|
body
|
|
.trim()
|
|
.split('&')
|
|
.forEach(function(bytes) {
|
|
if (bytes) {
|
|
var split = bytes.split('=');
|
|
var name = split.shift().replace(/\+/g, ' ');
|
|
var value = split.join('=').replace(/\+/g, ' ');
|
|
form.append(decodeURIComponent(name), decodeURIComponent(value));
|
|
}
|
|
});
|
|
return form
|
|
}
|
|
|
|
function parseHeaders(rawHeaders) {
|
|
var headers = new Headers();
|
|
// Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
|
|
// https://tools.ietf.org/html/rfc7230#section-3.2
|
|
var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
|
|
preProcessedHeaders.split(/\r?\n/).forEach(function(line) {
|
|
var parts = line.split(':');
|
|
var key = parts.shift().trim();
|
|
if (key) {
|
|
var value = parts.join(':').trim();
|
|
headers.append(key, value);
|
|
}
|
|
});
|
|
return headers
|
|
}
|
|
|
|
Body.call(Request.prototype);
|
|
|
|
function Response(bodyInit, options) {
|
|
if (!options) {
|
|
options = {};
|
|
}
|
|
|
|
this.type = 'default';
|
|
this.status = options.status === undefined ? 200 : options.status;
|
|
this.ok = this.status >= 200 && this.status < 300;
|
|
this.statusText = 'statusText' in options ? options.statusText : 'OK';
|
|
this.headers = new Headers(options.headers);
|
|
this.url = options.url || '';
|
|
this._initBody(bodyInit);
|
|
}
|
|
|
|
Body.call(Response.prototype);
|
|
|
|
Response.prototype.clone = function() {
|
|
return new Response(this._bodyInit, {
|
|
status: this.status,
|
|
statusText: this.statusText,
|
|
headers: new Headers(this.headers),
|
|
url: this.url
|
|
})
|
|
};
|
|
|
|
Response.error = function() {
|
|
var response = new Response(null, {status: 0, statusText: ''});
|
|
response.type = 'error';
|
|
return response
|
|
};
|
|
|
|
var redirectStatuses = [301, 302, 303, 307, 308];
|
|
|
|
Response.redirect = function(url, status) {
|
|
if (redirectStatuses.indexOf(status) === -1) {
|
|
throw new RangeError('Invalid status code')
|
|
}
|
|
|
|
return new Response(null, {status: status, headers: {location: url}})
|
|
};
|
|
|
|
exports.DOMException = self.DOMException;
|
|
try {
|
|
new exports.DOMException();
|
|
} catch (err) {
|
|
exports.DOMException = function(message, name) {
|
|
this.message = message;
|
|
this.name = name;
|
|
var error = Error(message);
|
|
this.stack = error.stack;
|
|
};
|
|
exports.DOMException.prototype = Object.create(Error.prototype);
|
|
exports.DOMException.prototype.constructor = exports.DOMException;
|
|
}
|
|
|
|
function fetch(input, init) {
|
|
return new Promise(function(resolve, reject) {
|
|
var request = new Request(input, init);
|
|
|
|
if (request.signal && request.signal.aborted) {
|
|
return reject(new exports.DOMException('Aborted', 'AbortError'))
|
|
}
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
function abortXhr() {
|
|
xhr.abort();
|
|
}
|
|
|
|
xhr.onload = function() {
|
|
var options = {
|
|
status: xhr.status,
|
|
statusText: xhr.statusText,
|
|
headers: parseHeaders(xhr.getAllResponseHeaders() || '')
|
|
};
|
|
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
|
|
var body = 'response' in xhr ? xhr.response : xhr.responseText;
|
|
resolve(new Response(body, options));
|
|
};
|
|
|
|
xhr.onerror = function() {
|
|
reject(new TypeError('Network request failed'));
|
|
};
|
|
|
|
xhr.ontimeout = function() {
|
|
reject(new TypeError('Network request failed'));
|
|
};
|
|
|
|
xhr.onabort = function() {
|
|
reject(new exports.DOMException('Aborted', 'AbortError'));
|
|
};
|
|
|
|
xhr.open(request.method, request.url, true);
|
|
|
|
if (request.credentials === 'include') {
|
|
xhr.withCredentials = true;
|
|
} else if (request.credentials === 'omit') {
|
|
xhr.withCredentials = false;
|
|
}
|
|
|
|
if ('responseType' in xhr && support.blob) {
|
|
xhr.responseType = 'blob';
|
|
}
|
|
|
|
request.headers.forEach(function(value, name) {
|
|
xhr.setRequestHeader(name, value);
|
|
});
|
|
|
|
if (request.signal) {
|
|
request.signal.addEventListener('abort', abortXhr);
|
|
|
|
xhr.onreadystatechange = function() {
|
|
// DONE (success or failure)
|
|
if (xhr.readyState === 4) {
|
|
request.signal.removeEventListener('abort', abortXhr);
|
|
}
|
|
};
|
|
}
|
|
|
|
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
|
|
})
|
|
}
|
|
|
|
fetch.polyfill = true;
|
|
|
|
if (!self.fetch) {
|
|
self.fetch = fetch;
|
|
self.Headers = Headers;
|
|
self.Request = Request;
|
|
self.Response = Response;
|
|
}
|
|
|
|
exports.Headers = Headers;
|
|
exports.Request = Request;
|
|
exports.Response = Response;
|
|
exports.fetch = fetch;
|
|
|
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
|
})));
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
}}},"isomorphic-base64":{"package.json":function(require,exports){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// node_modules/meteor/ohif_dicomweb-client/node_modules/isomorphic-base64/package.json //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
exports.name = "isomorphic-base64";
|
|
exports.version = "1.0.2";
|
|
exports.browser = "browser.js";
|
|
exports.main = "index.js";
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
},"browser.js":function(require,exports){
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// //
|
|
// node_modules/meteor/ohif_dicomweb-client/node_modules/isomorphic-base64/browser.js //
|
|
// //
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
'use strict';
|
|
|
|
exports.atob = self.atob.bind(self);
|
|
exports.btoa = self.btoa.bind(self);
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
}}}}}}},{
|
|
"extensions": [
|
|
".js",
|
|
".json"
|
|
]
|
|
});
|
|
var exports = require("/node_modules/meteor/ohif:dicomweb-client/src/index.js");
|
|
|
|
/* Exports */
|
|
Package._define("ohif:dicomweb-client", exports, {
|
|
DICOMWeb: DICOMWeb
|
|
});
|
|
|
|
})();
|