1 |
|
2 | (function webpackUniversalModuleDefinition(root, factory) {
|
3 | if(typeof exports === 'object' && typeof module === 'object')
|
4 | module.exports = factory();
|
5 | else if(typeof define === 'function' && define.amd)
|
6 | define("cornerstoneWebImageLoader", [], factory);
|
7 | else if(typeof exports === 'object')
|
8 | exports["cornerstoneWebImageLoader"] = factory();
|
9 | else
|
10 | root["cornerstoneWebImageLoader"] = factory();
|
11 | })(window, function() {
|
12 | return (function(modules) {
|
13 | function hotDisposeChunk(chunkId) {
|
14 | delete installedChunks[chunkId];
|
15 | }
|
16 | var parentHotUpdateCallback = window["webpackHotUpdate_name_"];
|
17 | window["webpackHotUpdate_name_"] =
|
18 | function webpackHotUpdateCallback(chunkId, moreModules) {
|
19 | hotAddUpdateChunk(chunkId, moreModules);
|
20 | if (parentHotUpdateCallback) parentHotUpdateCallback(chunkId, moreModules);
|
21 | } ;
|
22 |
|
23 |
|
24 | function hotDownloadUpdateChunk(chunkId) {
|
25 | var head = document.getElementsByTagName("head")[0];
|
26 | var script = document.createElement("script");
|
27 | script.charset = "utf-8";
|
28 | script.src = __webpack_require__.p + "" + chunkId + "." + hotCurrentHash + ".hot-update.js";
|
29 | ;
|
30 | head.appendChild(script);
|
31 | }
|
32 |
|
33 |
|
34 | function hotDownloadManifest(requestTimeout) {
|
35 | requestTimeout = requestTimeout || 10000;
|
36 | return new Promise(function(resolve, reject) {
|
37 | if (typeof XMLHttpRequest === "undefined")
|
38 | return reject(new Error("No browser support"));
|
39 | try {
|
40 | var request = new XMLHttpRequest();
|
41 | var requestPath = __webpack_require__.p + "" + hotCurrentHash + ".hot-update.json";
|
42 | request.open("GET", requestPath, true);
|
43 | request.timeout = requestTimeout;
|
44 | request.send(null);
|
45 | } catch (err) {
|
46 | return reject(err);
|
47 | }
|
48 | request.onreadystatechange = function() {
|
49 | if (request.readyState !== 4) return;
|
50 | if (request.status === 0) {
|
51 |
|
52 | reject(
|
53 | new Error("Manifest request to " + requestPath + " timed out.")
|
54 | );
|
55 | } else if (request.status === 404) {
|
56 |
|
57 | resolve();
|
58 | } else if (request.status !== 200 && request.status !== 304) {
|
59 |
|
60 | reject(new Error("Manifest request to " + requestPath + " failed."));
|
61 | } else {
|
62 |
|
63 | try {
|
64 | var update = JSON.parse(request.responseText);
|
65 | } catch (e) {
|
66 | reject(e);
|
67 | return;
|
68 | }
|
69 | resolve(update);
|
70 | }
|
71 | };
|
72 | });
|
73 | }
|
74 |
|
75 | var hotApplyOnUpdate = true;
|
76 | var hotCurrentHash = "65302f76cb834101100f";
|
77 | var hotRequestTimeout = 10000;
|
78 | var hotCurrentModuleData = {};
|
79 | var hotCurrentChildModule;
|
80 | var hotCurrentParents = [];
|
81 | var hotCurrentParentsTemp = [];
|
82 |
|
83 |
|
84 | function hotCreateRequire(moduleId) {
|
85 | var me = installedModules[moduleId];
|
86 | if (!me) return __webpack_require__;
|
87 | var fn = function(request) {
|
88 | if (me.hot.active) {
|
89 | if (installedModules[request]) {
|
90 | if (installedModules[request].parents.indexOf(moduleId) === -1)
|
91 | installedModules[request].parents.push(moduleId);
|
92 | } else {
|
93 | hotCurrentParents = [moduleId];
|
94 | hotCurrentChildModule = request;
|
95 | }
|
96 | if (me.children.indexOf(request) === -1) me.children.push(request);
|
97 | } else {
|
98 | console.warn(
|
99 | "[HMR] unexpected require(" +
|
100 | request +
|
101 | ") from disposed module " +
|
102 | moduleId
|
103 | );
|
104 | hotCurrentParents = [];
|
105 | }
|
106 | return __webpack_require__(request);
|
107 | };
|
108 | var ObjectFactory = function ObjectFactory(name) {
|
109 | return {
|
110 | configurable: true,
|
111 | enumerable: true,
|
112 | get: function() {
|
113 | return __webpack_require__[name];
|
114 | },
|
115 | set: function(value) {
|
116 | __webpack_require__[name] = value;
|
117 | }
|
118 | };
|
119 | };
|
120 | for (var name in __webpack_require__) {
|
121 | if (
|
122 | Object.prototype.hasOwnProperty.call(__webpack_require__, name) &&
|
123 | name !== "e"
|
124 | ) {
|
125 | Object.defineProperty(fn, name, ObjectFactory(name));
|
126 | }
|
127 | }
|
128 | fn.e = function(chunkId) {
|
129 | if (hotStatus === "ready") hotSetStatus("prepare");
|
130 | hotChunksLoading++;
|
131 | return __webpack_require__.e(chunkId).then(finishChunkLoading, function(err) {
|
132 | finishChunkLoading();
|
133 | throw err;
|
134 | });
|
135 |
|
136 | function finishChunkLoading() {
|
137 | hotChunksLoading--;
|
138 | if (hotStatus === "prepare") {
|
139 | if (!hotWaitingFilesMap[chunkId]) {
|
140 | hotEnsureUpdateChunk(chunkId);
|
141 | }
|
142 | if (hotChunksLoading === 0 && hotWaitingFiles === 0) {
|
143 | hotUpdateDownloaded();
|
144 | }
|
145 | }
|
146 | }
|
147 | };
|
148 | return fn;
|
149 | }
|
150 |
|
151 |
|
152 | function hotCreateModule(moduleId) {
|
153 | var hot = {
|
154 |
|
155 | _acceptedDependencies: {},
|
156 | _declinedDependencies: {},
|
157 | _selfAccepted: false,
|
158 | _selfDeclined: false,
|
159 | _disposeHandlers: [],
|
160 | _main: hotCurrentChildModule !== moduleId,
|
161 |
|
162 |
|
163 | active: true,
|
164 | accept: function(dep, callback) {
|
165 | if (typeof dep === "undefined") hot._selfAccepted = true;
|
166 | else if (typeof dep === "function") hot._selfAccepted = dep;
|
167 | else if (typeof dep === "object")
|
168 | for (var i = 0; i < dep.length; i++)
|
169 | hot._acceptedDependencies[dep[i]] = callback || function() {};
|
170 | else hot._acceptedDependencies[dep] = callback || function() {};
|
171 | },
|
172 | decline: function(dep) {
|
173 | if (typeof dep === "undefined") hot._selfDeclined = true;
|
174 | else if (typeof dep === "object")
|
175 | for (var i = 0; i < dep.length; i++)
|
176 | hot._declinedDependencies[dep[i]] = true;
|
177 | else hot._declinedDependencies[dep] = true;
|
178 | },
|
179 | dispose: function(callback) {
|
180 | hot._disposeHandlers.push(callback);
|
181 | },
|
182 | addDisposeHandler: function(callback) {
|
183 | hot._disposeHandlers.push(callback);
|
184 | },
|
185 | removeDisposeHandler: function(callback) {
|
186 | var idx = hot._disposeHandlers.indexOf(callback);
|
187 | if (idx >= 0) hot._disposeHandlers.splice(idx, 1);
|
188 | },
|
189 |
|
190 |
|
191 | check: hotCheck,
|
192 | apply: hotApply,
|
193 | status: function(l) {
|
194 | if (!l) return hotStatus;
|
195 | hotStatusHandlers.push(l);
|
196 | },
|
197 | addStatusHandler: function(l) {
|
198 | hotStatusHandlers.push(l);
|
199 | },
|
200 | removeStatusHandler: function(l) {
|
201 | var idx = hotStatusHandlers.indexOf(l);
|
202 | if (idx >= 0) hotStatusHandlers.splice(idx, 1);
|
203 | },
|
204 |
|
205 |
|
206 | data: hotCurrentModuleData[moduleId]
|
207 | };
|
208 | hotCurrentChildModule = undefined;
|
209 | return hot;
|
210 | }
|
211 |
|
212 | var hotStatusHandlers = [];
|
213 | var hotStatus = "idle";
|
214 |
|
215 | function hotSetStatus(newStatus) {
|
216 | hotStatus = newStatus;
|
217 | for (var i = 0; i < hotStatusHandlers.length; i++)
|
218 | hotStatusHandlers[i].call(null, newStatus);
|
219 | }
|
220 |
|
221 |
|
222 | var hotWaitingFiles = 0;
|
223 | var hotChunksLoading = 0;
|
224 | var hotWaitingFilesMap = {};
|
225 | var hotRequestedFilesMap = {};
|
226 | var hotAvailableFilesMap = {};
|
227 | var hotDeferred;
|
228 |
|
229 |
|
230 | var hotUpdate, hotUpdateNewHash;
|
231 |
|
232 | function toModuleId(id) {
|
233 | var isNumber = +id + "" === id;
|
234 | return isNumber ? +id : id;
|
235 | }
|
236 |
|
237 | function hotCheck(apply) {
|
238 | if (hotStatus !== "idle")
|
239 | throw new Error("check() is only allowed in idle status");
|
240 | hotApplyOnUpdate = apply;
|
241 | hotSetStatus("check");
|
242 | return hotDownloadManifest(hotRequestTimeout).then(function(update) {
|
243 | if (!update) {
|
244 | hotSetStatus("idle");
|
245 | return null;
|
246 | }
|
247 | hotRequestedFilesMap = {};
|
248 | hotWaitingFilesMap = {};
|
249 | hotAvailableFilesMap = update.c;
|
250 | hotUpdateNewHash = update.h;
|
251 |
|
252 | hotSetStatus("prepare");
|
253 | var promise = new Promise(function(resolve, reject) {
|
254 | hotDeferred = {
|
255 | resolve: resolve,
|
256 | reject: reject
|
257 | };
|
258 | });
|
259 | hotUpdate = {};
|
260 | var chunkId = "cornerstoneWebImageLoader";
|
261 | {
|
262 |
|
263 |
|
264 | hotEnsureUpdateChunk(chunkId);
|
265 | }
|
266 | if (
|
267 | hotStatus === "prepare" &&
|
268 | hotChunksLoading === 0 &&
|
269 | hotWaitingFiles === 0
|
270 | ) {
|
271 | hotUpdateDownloaded();
|
272 | }
|
273 | return promise;
|
274 | });
|
275 | }
|
276 |
|
277 |
|
278 | function hotAddUpdateChunk(chunkId, moreModules) {
|
279 | if (!hotAvailableFilesMap[chunkId] || !hotRequestedFilesMap[chunkId])
|
280 | return;
|
281 | hotRequestedFilesMap[chunkId] = false;
|
282 | for (var moduleId in moreModules) {
|
283 | if (Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {
|
284 | hotUpdate[moduleId] = moreModules[moduleId];
|
285 | }
|
286 | }
|
287 | if (--hotWaitingFiles === 0 && hotChunksLoading === 0) {
|
288 | hotUpdateDownloaded();
|
289 | }
|
290 | }
|
291 |
|
292 | function hotEnsureUpdateChunk(chunkId) {
|
293 | if (!hotAvailableFilesMap[chunkId]) {
|
294 | hotWaitingFilesMap[chunkId] = true;
|
295 | } else {
|
296 | hotRequestedFilesMap[chunkId] = true;
|
297 | hotWaitingFiles++;
|
298 | hotDownloadUpdateChunk(chunkId);
|
299 | }
|
300 | }
|
301 |
|
302 | function hotUpdateDownloaded() {
|
303 | hotSetStatus("ready");
|
304 | var deferred = hotDeferred;
|
305 | hotDeferred = null;
|
306 | if (!deferred) return;
|
307 | if (hotApplyOnUpdate) {
|
308 |
|
309 |
|
310 |
|
311 | Promise.resolve()
|
312 | .then(function() {
|
313 | return hotApply(hotApplyOnUpdate);
|
314 | })
|
315 | .then(
|
316 | function(result) {
|
317 | deferred.resolve(result);
|
318 | },
|
319 | function(err) {
|
320 | deferred.reject(err);
|
321 | }
|
322 | );
|
323 | } else {
|
324 | var outdatedModules = [];
|
325 | for (var id in hotUpdate) {
|
326 | if (Object.prototype.hasOwnProperty.call(hotUpdate, id)) {
|
327 | outdatedModules.push(toModuleId(id));
|
328 | }
|
329 | }
|
330 | deferred.resolve(outdatedModules);
|
331 | }
|
332 | }
|
333 |
|
334 | function hotApply(options) {
|
335 | if (hotStatus !== "ready")
|
336 | throw new Error("apply() is only allowed in ready status");
|
337 | options = options || {};
|
338 |
|
339 | var cb;
|
340 | var i;
|
341 | var j;
|
342 | var module;
|
343 | var moduleId;
|
344 |
|
345 | function getAffectedStuff(updateModuleId) {
|
346 | var outdatedModules = [updateModuleId];
|
347 | var outdatedDependencies = {};
|
348 |
|
349 | var queue = outdatedModules.slice().map(function(id) {
|
350 | return {
|
351 | chain: [id],
|
352 | id: id
|
353 | };
|
354 | });
|
355 | while (queue.length > 0) {
|
356 | var queueItem = queue.pop();
|
357 | var moduleId = queueItem.id;
|
358 | var chain = queueItem.chain;
|
359 | module = installedModules[moduleId];
|
360 | if (!module || module.hot._selfAccepted) continue;
|
361 | if (module.hot._selfDeclined) {
|
362 | return {
|
363 | type: "self-declined",
|
364 | chain: chain,
|
365 | moduleId: moduleId
|
366 | };
|
367 | }
|
368 | if (module.hot._main) {
|
369 | return {
|
370 | type: "unaccepted",
|
371 | chain: chain,
|
372 | moduleId: moduleId
|
373 | };
|
374 | }
|
375 | for (var i = 0; i < module.parents.length; i++) {
|
376 | var parentId = module.parents[i];
|
377 | var parent = installedModules[parentId];
|
378 | if (!parent) continue;
|
379 | if (parent.hot._declinedDependencies[moduleId]) {
|
380 | return {
|
381 | type: "declined",
|
382 | chain: chain.concat([parentId]),
|
383 | moduleId: moduleId,
|
384 | parentId: parentId
|
385 | };
|
386 | }
|
387 | if (outdatedModules.indexOf(parentId) !== -1) continue;
|
388 | if (parent.hot._acceptedDependencies[moduleId]) {
|
389 | if (!outdatedDependencies[parentId])
|
390 | outdatedDependencies[parentId] = [];
|
391 | addAllToSet(outdatedDependencies[parentId], [moduleId]);
|
392 | continue;
|
393 | }
|
394 | delete outdatedDependencies[parentId];
|
395 | outdatedModules.push(parentId);
|
396 | queue.push({
|
397 | chain: chain.concat([parentId]),
|
398 | id: parentId
|
399 | });
|
400 | }
|
401 | }
|
402 |
|
403 | return {
|
404 | type: "accepted",
|
405 | moduleId: updateModuleId,
|
406 | outdatedModules: outdatedModules,
|
407 | outdatedDependencies: outdatedDependencies
|
408 | };
|
409 | }
|
410 |
|
411 | function addAllToSet(a, b) {
|
412 | for (var i = 0; i < b.length; i++) {
|
413 | var item = b[i];
|
414 | if (a.indexOf(item) === -1) a.push(item);
|
415 | }
|
416 | }
|
417 |
|
418 |
|
419 |
|
420 | var outdatedDependencies = {};
|
421 | var outdatedModules = [];
|
422 | var appliedUpdate = {};
|
423 |
|
424 | var warnUnexpectedRequire = function warnUnexpectedRequire() {
|
425 | console.warn(
|
426 | "[HMR] unexpected require(" + result.moduleId + ") to disposed module"
|
427 | );
|
428 | };
|
429 |
|
430 | for (var id in hotUpdate) {
|
431 | if (Object.prototype.hasOwnProperty.call(hotUpdate, id)) {
|
432 | moduleId = toModuleId(id);
|
433 | var result;
|
434 | if (hotUpdate[id]) {
|
435 | result = getAffectedStuff(moduleId);
|
436 | } else {
|
437 | result = {
|
438 | type: "disposed",
|
439 | moduleId: id
|
440 | };
|
441 | }
|
442 | var abortError = false;
|
443 | var doApply = false;
|
444 | var doDispose = false;
|
445 | var chainInfo = "";
|
446 | if (result.chain) {
|
447 | chainInfo = "\nUpdate propagation: " + result.chain.join(" -> ");
|
448 | }
|
449 | switch (result.type) {
|
450 | case "self-declined":
|
451 | if (options.onDeclined) options.onDeclined(result);
|
452 | if (!options.ignoreDeclined)
|
453 | abortError = new Error(
|
454 | "Aborted because of self decline: " +
|
455 | result.moduleId +
|
456 | chainInfo
|
457 | );
|
458 | break;
|
459 | case "declined":
|
460 | if (options.onDeclined) options.onDeclined(result);
|
461 | if (!options.ignoreDeclined)
|
462 | abortError = new Error(
|
463 | "Aborted because of declined dependency: " +
|
464 | result.moduleId +
|
465 | " in " +
|
466 | result.parentId +
|
467 | chainInfo
|
468 | );
|
469 | break;
|
470 | case "unaccepted":
|
471 | if (options.onUnaccepted) options.onUnaccepted(result);
|
472 | if (!options.ignoreUnaccepted)
|
473 | abortError = new Error(
|
474 | "Aborted because " + moduleId + " is not accepted" + chainInfo
|
475 | );
|
476 | break;
|
477 | case "accepted":
|
478 | if (options.onAccepted) options.onAccepted(result);
|
479 | doApply = true;
|
480 | break;
|
481 | case "disposed":
|
482 | if (options.onDisposed) options.onDisposed(result);
|
483 | doDispose = true;
|
484 | break;
|
485 | default:
|
486 | throw new Error("Unexception type " + result.type);
|
487 | }
|
488 | if (abortError) {
|
489 | hotSetStatus("abort");
|
490 | return Promise.reject(abortError);
|
491 | }
|
492 | if (doApply) {
|
493 | appliedUpdate[moduleId] = hotUpdate[moduleId];
|
494 | addAllToSet(outdatedModules, result.outdatedModules);
|
495 | for (moduleId in result.outdatedDependencies) {
|
496 | if (
|
497 | Object.prototype.hasOwnProperty.call(
|
498 | result.outdatedDependencies,
|
499 | moduleId
|
500 | )
|
501 | ) {
|
502 | if (!outdatedDependencies[moduleId])
|
503 | outdatedDependencies[moduleId] = [];
|
504 | addAllToSet(
|
505 | outdatedDependencies[moduleId],
|
506 | result.outdatedDependencies[moduleId]
|
507 | );
|
508 | }
|
509 | }
|
510 | }
|
511 | if (doDispose) {
|
512 | addAllToSet(outdatedModules, [result.moduleId]);
|
513 | appliedUpdate[moduleId] = warnUnexpectedRequire;
|
514 | }
|
515 | }
|
516 | }
|
517 |
|
518 |
|
519 | var outdatedSelfAcceptedModules = [];
|
520 | for (i = 0; i < outdatedModules.length; i++) {
|
521 | moduleId = outdatedModules[i];
|
522 | if (
|
523 | installedModules[moduleId] &&
|
524 | installedModules[moduleId].hot._selfAccepted
|
525 | )
|
526 | outdatedSelfAcceptedModules.push({
|
527 | module: moduleId,
|
528 | errorHandler: installedModules[moduleId].hot._selfAccepted
|
529 | });
|
530 | }
|
531 |
|
532 |
|
533 | hotSetStatus("dispose");
|
534 | Object.keys(hotAvailableFilesMap).forEach(function(chunkId) {
|
535 | if (hotAvailableFilesMap[chunkId] === false) {
|
536 | hotDisposeChunk(chunkId);
|
537 | }
|
538 | });
|
539 |
|
540 | var idx;
|
541 | var queue = outdatedModules.slice();
|
542 | while (queue.length > 0) {
|
543 | moduleId = queue.pop();
|
544 | module = installedModules[moduleId];
|
545 | if (!module) continue;
|
546 |
|
547 | var data = {};
|
548 |
|
549 |
|
550 | var disposeHandlers = module.hot._disposeHandlers;
|
551 | for (j = 0; j < disposeHandlers.length; j++) {
|
552 | cb = disposeHandlers[j];
|
553 | cb(data);
|
554 | }
|
555 | hotCurrentModuleData[moduleId] = data;
|
556 |
|
557 |
|
558 | module.hot.active = false;
|
559 |
|
560 |
|
561 | delete installedModules[moduleId];
|
562 |
|
563 |
|
564 | delete outdatedDependencies[moduleId];
|
565 |
|
566 |
|
567 | for (j = 0; j < module.children.length; j++) {
|
568 | var child = installedModules[module.children[j]];
|
569 | if (!child) continue;
|
570 | idx = child.parents.indexOf(moduleId);
|
571 | if (idx >= 0) {
|
572 | child.parents.splice(idx, 1);
|
573 | }
|
574 | }
|
575 | }
|
576 |
|
577 |
|
578 | var dependency;
|
579 | var moduleOutdatedDependencies;
|
580 | for (moduleId in outdatedDependencies) {
|
581 | if (
|
582 | Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)
|
583 | ) {
|
584 | module = installedModules[moduleId];
|
585 | if (module) {
|
586 | moduleOutdatedDependencies = outdatedDependencies[moduleId];
|
587 | for (j = 0; j < moduleOutdatedDependencies.length; j++) {
|
588 | dependency = moduleOutdatedDependencies[j];
|
589 | idx = module.children.indexOf(dependency);
|
590 | if (idx >= 0) module.children.splice(idx, 1);
|
591 | }
|
592 | }
|
593 | }
|
594 | }
|
595 |
|
596 |
|
597 | hotSetStatus("apply");
|
598 |
|
599 | hotCurrentHash = hotUpdateNewHash;
|
600 |
|
601 |
|
602 | for (moduleId in appliedUpdate) {
|
603 | if (Object.prototype.hasOwnProperty.call(appliedUpdate, moduleId)) {
|
604 | modules[moduleId] = appliedUpdate[moduleId];
|
605 | }
|
606 | }
|
607 |
|
608 |
|
609 | var error = null;
|
610 | for (moduleId in outdatedDependencies) {
|
611 | if (
|
612 | Object.prototype.hasOwnProperty.call(outdatedDependencies, moduleId)
|
613 | ) {
|
614 | module = installedModules[moduleId];
|
615 | if (module) {
|
616 | moduleOutdatedDependencies = outdatedDependencies[moduleId];
|
617 | var callbacks = [];
|
618 | for (i = 0; i < moduleOutdatedDependencies.length; i++) {
|
619 | dependency = moduleOutdatedDependencies[i];
|
620 | cb = module.hot._acceptedDependencies[dependency];
|
621 | if (cb) {
|
622 | if (callbacks.indexOf(cb) !== -1) continue;
|
623 | callbacks.push(cb);
|
624 | }
|
625 | }
|
626 | for (i = 0; i < callbacks.length; i++) {
|
627 | cb = callbacks[i];
|
628 | try {
|
629 | cb(moduleOutdatedDependencies);
|
630 | } catch (err) {
|
631 | if (options.onErrored) {
|
632 | options.onErrored({
|
633 | type: "accept-errored",
|
634 | moduleId: moduleId,
|
635 | dependencyId: moduleOutdatedDependencies[i],
|
636 | error: err
|
637 | });
|
638 | }
|
639 | if (!options.ignoreErrored) {
|
640 | if (!error) error = err;
|
641 | }
|
642 | }
|
643 | }
|
644 | }
|
645 | }
|
646 | }
|
647 |
|
648 |
|
649 | for (i = 0; i < outdatedSelfAcceptedModules.length; i++) {
|
650 | var item = outdatedSelfAcceptedModules[i];
|
651 | moduleId = item.module;
|
652 | hotCurrentParents = [moduleId];
|
653 | try {
|
654 | __webpack_require__(moduleId);
|
655 | } catch (err) {
|
656 | if (typeof item.errorHandler === "function") {
|
657 | try {
|
658 | item.errorHandler(err);
|
659 | } catch (err2) {
|
660 | if (options.onErrored) {
|
661 | options.onErrored({
|
662 | type: "self-accept-error-handler-errored",
|
663 | moduleId: moduleId,
|
664 | error: err2,
|
665 | originalError: err
|
666 | });
|
667 | }
|
668 | if (!options.ignoreErrored) {
|
669 | if (!error) error = err2;
|
670 | }
|
671 | if (!error) error = err;
|
672 | }
|
673 | } else {
|
674 | if (options.onErrored) {
|
675 | options.onErrored({
|
676 | type: "self-accept-errored",
|
677 | moduleId: moduleId,
|
678 | error: err
|
679 | });
|
680 | }
|
681 | if (!options.ignoreErrored) {
|
682 | if (!error) error = err;
|
683 | }
|
684 | }
|
685 | }
|
686 | }
|
687 |
|
688 |
|
689 | if (error) {
|
690 | hotSetStatus("fail");
|
691 | return Promise.reject(error);
|
692 | }
|
693 |
|
694 | hotSetStatus("idle");
|
695 | return new Promise(function(resolve) {
|
696 | resolve(outdatedModules);
|
697 | });
|
698 | }
|
699 |
|
700 |
|
701 | var installedModules = {};
|
702 |
|
703 |
|
704 | function __webpack_require__(moduleId) {
|
705 |
|
706 |
|
707 | if(installedModules[moduleId]) {
|
708 | return installedModules[moduleId].exports;
|
709 | }
|
710 |
|
711 | var module = installedModules[moduleId] = {
|
712 | i: moduleId,
|
713 | l: false,
|
714 | exports: {},
|
715 | hot: hotCreateModule(moduleId),
|
716 | parents: (hotCurrentParentsTemp = hotCurrentParents, hotCurrentParents = [], hotCurrentParentsTemp),
|
717 | children: []
|
718 | };
|
719 |
|
720 |
|
721 | modules[moduleId].call(module.exports, module, module.exports, hotCreateRequire(moduleId));
|
722 |
|
723 |
|
724 | module.l = true;
|
725 |
|
726 |
|
727 | return module.exports;
|
728 | }
|
729 |
|
730 |
|
731 |
|
732 | __webpack_require__.m = modules;
|
733 |
|
734 |
|
735 | __webpack_require__.c = installedModules;
|
736 |
|
737 |
|
738 | __webpack_require__.d = function(exports, name, getter) {
|
739 | if(!__webpack_require__.o(exports, name)) {
|
740 | Object.defineProperty(exports, name, {
|
741 | configurable: false,
|
742 | enumerable: true,
|
743 | get: getter
|
744 | /******/ });
|
745 | /******/ }
|
746 | /******/ };
|
747 | /******/
|
748 | /******/ // define __esModule on exports
|
749 | /******/ __webpack_require__.r = function(exports) {
|
750 | Object.defineProperty(exports, '__esModule', { value: true });
|
751 | };
|
752 |
|
753 |
|
754 | __webpack_require__.n = function(module) {
|
755 | var getter = module && module.__esModule ?
|
756 | function getDefault() { return module['default']; } :
|
757 | function getModuleExports() { return module; };
|
758 | __webpack_require__.d(getter, 'a', getter);
|
759 | return getter;
|
760 | };
|
761 |
|
762 |
|
763 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
764 |
|
765 |
|
766 | __webpack_require__.p = "";
|
767 |
|
768 |
|
769 | __webpack_require__.h = function() { return hotCurrentHash; };
|
770 |
|
771 |
|
772 |
|
773 | return hotCreateRequire("./index.js")(__webpack_require__.s = "./index.js");
|
774 | })
|
775 |
|
776 | ({
|
777 |
|
778 | "./arrayBufferToImage.js":
|
779 |
|
780 |
|
781 |
|
782 |
|
783 | (function(module, exports, __webpack_require__) {
|
784 |
|
785 | "use strict";
|
786 |
|
787 |
|
788 | Object.defineProperty(exports, "__esModule", {
|
789 | value: true
|
790 | });
|
791 |
|
792 | exports.default = function (arrayBuffer) {
|
793 | return new Promise(function (resolve, reject) {
|
794 | var image = new Image();
|
795 | var arrayBufferView = new Uint8Array(arrayBuffer);
|
796 | var blob = new Blob([arrayBufferView]);
|
797 | var urlCreator = window.URL || window.webkitURL;
|
798 | var imageUrl = urlCreator.createObjectURL(blob);
|
799 |
|
800 | image.src = imageUrl;
|
801 | image.onload = function () {
|
802 | resolve(image);
|
803 | urlCreator.revokeObjectURL(imageUrl);
|
804 | };
|
805 |
|
806 | image.onerror = function (error) {
|
807 | urlCreator.revokeObjectURL(imageUrl);
|
808 | reject(error);
|
809 | };
|
810 | });
|
811 | };
|
812 |
|
813 | }),
|
814 |
|
815 | "./createImage.js":
|
816 |
|
817 |
|
818 |
|
819 |
|
820 | (function(module, exports, __webpack_require__) {
|
821 |
|
822 | "use strict";
|
823 |
|
824 |
|
825 | Object.defineProperty(exports, "__esModule", {
|
826 | value: true
|
827 | });
|
828 |
|
829 | exports.default = function (image, imageId) {
|
830 |
|
831 | var rows = image.naturalHeight;
|
832 | var columns = image.naturalWidth;
|
833 |
|
834 | function getPixelData() {
|
835 | var imageData = getImageData();
|
836 |
|
837 | return imageData.data;
|
838 | }
|
839 |
|
840 | function getImageData() {
|
841 | var context = void 0;
|
842 |
|
843 | if (lastImageIdDrawn === imageId) {
|
844 | context = canvas.getContext('2d');
|
845 | } else {
|
846 | canvas.height = image.naturalHeight;
|
847 | canvas.width = image.naturalWidth;
|
848 | context = canvas.getContext('2d');
|
849 | context.drawImage(image, 0, 0);
|
850 | lastImageIdDrawn = imageId;
|
851 | }
|
852 |
|
853 | return context.getImageData(0, 0, image.naturalWidth, image.naturalHeight);
|
854 | }
|
855 |
|
856 | function getCanvas() {
|
857 | if (lastImageIdDrawn === imageId) {
|
858 | return canvas;
|
859 | }
|
860 |
|
861 | canvas.height = image.naturalHeight;
|
862 | canvas.width = image.naturalWidth;
|
863 | var context = canvas.getContext('2d');
|
864 |
|
865 | context.drawImage(image, 0, 0);
|
866 | lastImageIdDrawn = imageId;
|
867 |
|
868 | return canvas;
|
869 | }
|
870 |
|
871 |
|
872 | return {
|
873 | imageId: imageId,
|
874 | minPixelValue: 0,
|
875 | maxPixelValue: 255,
|
876 | slope: 1,
|
877 | intercept: 0,
|
878 | windowCenter: 128,
|
879 | windowWidth: 255,
|
880 | render: _externalModules.external.cornerstone.renderWebImage,
|
881 | getPixelData: getPixelData,
|
882 | getCanvas: getCanvas,
|
883 | getImage: function getImage() {
|
884 | return image;
|
885 | },
|
886 | rows: rows,
|
887 | columns: columns,
|
888 | height: rows,
|
889 | width: columns,
|
890 | color: true,
|
891 | rgba: false,
|
892 | columnPixelSpacing: undefined,
|
893 | rowPixelSpacing: undefined,
|
894 | invert: false,
|
895 | sizeInBytes: rows * columns * 4
|
896 | };
|
897 | };
|
898 |
|
899 | var _externalModules = __webpack_require__( "./externalModules.js");
|
900 |
|
901 | var canvas = document.createElement('canvas');
|
902 | var lastImageIdDrawn = void 0;
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 |
|
912 | }),
|
913 |
|
914 | "./externalModules.js":
|
915 |
|
916 |
|
917 |
|
918 |
|
919 | (function(module, exports, __webpack_require__) {
|
920 |
|
921 | "use strict";
|
922 |
|
923 |
|
924 | Object.defineProperty(exports, "__esModule", {
|
925 | value: true
|
926 | });
|
927 | exports.external = undefined;
|
928 |
|
929 | var _registerLoaders = __webpack_require__( "./registerLoaders.js");
|
930 |
|
931 | var _registerLoaders2 = _interopRequireDefault(_registerLoaders);
|
932 |
|
933 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
934 |
|
935 | var cornerstone = void 0;
|
936 |
|
937 | var external = {
|
938 | set cornerstone(cs) {
|
939 | cornerstone = cs;
|
940 |
|
941 | (0, _registerLoaders2.default)(cornerstone);
|
942 | },
|
943 | get cornerstone() {
|
944 | return cornerstone;
|
945 | }
|
946 | };
|
947 |
|
948 | exports.external = external;
|
949 |
|
950 | }),
|
951 |
|
952 | "./index.js":
|
953 |
|
954 |
|
955 |
|
956 |
|
957 | (function(module, exports, __webpack_require__) {
|
958 |
|
959 | "use strict";
|
960 |
|
961 |
|
962 | Object.defineProperty(exports, "__esModule", {
|
963 | value: true
|
964 | });
|
965 | exports.external = exports.configure = exports.loadImage = exports.createImage = exports.arrayBufferToImage = undefined;
|
966 |
|
967 | var _arrayBufferToImage = __webpack_require__( "./arrayBufferToImage.js");
|
968 |
|
969 | var _arrayBufferToImage2 = _interopRequireDefault(_arrayBufferToImage);
|
970 |
|
971 | var _createImage = __webpack_require__( "./createImage.js");
|
972 |
|
973 | var _createImage2 = _interopRequireDefault(_createImage);
|
974 |
|
975 | var _loadImage = __webpack_require__( "./loadImage.js");
|
976 |
|
977 | var _externalModules = __webpack_require__( "./externalModules.js");
|
978 |
|
979 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
980 |
|
981 | var cornerstoneWebImageLoader = {
|
982 | arrayBufferToImage: _arrayBufferToImage2.default,
|
983 | createImage: _createImage2.default,
|
984 | loadImage: _loadImage.loadImage,
|
985 | configure: _loadImage.configure,
|
986 | external: _externalModules.external
|
987 | };
|
988 |
|
989 | exports.arrayBufferToImage = _arrayBufferToImage2.default;
|
990 | exports.createImage = _createImage2.default;
|
991 | exports.loadImage = _loadImage.loadImage;
|
992 | exports.configure = _loadImage.configure;
|
993 | exports.external = _externalModules.external;
|
994 | exports.default = cornerstoneWebImageLoader;
|
995 |
|
996 | }),
|
997 |
|
998 | "./loadImage.js":
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 | (function(module, exports, __webpack_require__) {
|
1004 |
|
1005 | "use strict";
|
1006 |
|
1007 |
|
1008 | Object.defineProperty(exports, "__esModule", {
|
1009 | value: true
|
1010 | });
|
1011 | exports.loadImage = loadImage;
|
1012 | exports.configure = configure;
|
1013 |
|
1014 | var _externalModules = __webpack_require__( "./externalModules.js");
|
1015 |
|
1016 | var _arrayBufferToImage = __webpack_require__( "./arrayBufferToImage.js");
|
1017 |
|
1018 | var _arrayBufferToImage2 = _interopRequireDefault(_arrayBufferToImage);
|
1019 |
|
1020 | var _createImage = __webpack_require__( "./createImage.js");
|
1021 |
|
1022 | var _createImage2 = _interopRequireDefault(_createImage);
|
1023 |
|
1024 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 | var options = {
|
1030 |
|
1031 | beforeSend: function beforeSend() /* xhr */{}
|
1032 | };
|
1033 |
|
1034 |
|
1035 | function loadImage(imageId) {
|
1036 | var cornerstone = _externalModules.external.cornerstone;
|
1037 |
|
1038 | var xhr = new XMLHttpRequest();
|
1039 |
|
1040 | xhr.open('GET', imageId, true);
|
1041 | xhr.responseType = 'arraybuffer';
|
1042 | options.beforeSend(xhr);
|
1043 |
|
1044 | xhr.onprogress = function (oProgress) {
|
1045 | if (oProgress.lengthComputable) {
|
1046 |
|
1047 |
|
1048 | var loaded = oProgress.loaded;
|
1049 | var total = oProgress.total;
|
1050 | var percentComplete = Math.round(loaded / total * 100);
|
1051 |
|
1052 | var eventData = {
|
1053 | imageId: imageId,
|
1054 | loaded: loaded,
|
1055 | total: total,
|
1056 | percentComplete: percentComplete
|
1057 | };
|
1058 |
|
1059 | cornerstone.triggerEvent(cornerstone.events, 'cornerstoneimageloadprogress', eventData);
|
1060 | }
|
1061 | };
|
1062 |
|
1063 | var promise = new Promise(function (resolve, reject) {
|
1064 | xhr.onload = function () {
|
1065 | var imagePromise = (0, _arrayBufferToImage2.default)(this.response);
|
1066 |
|
1067 | imagePromise.then(function (image) {
|
1068 | var imageObject = (0, _createImage2.default)(image, imageId);
|
1069 |
|
1070 | resolve(imageObject);
|
1071 | }, reject);
|
1072 | };
|
1073 |
|
1074 | xhr.send();
|
1075 | });
|
1076 |
|
1077 | var cancelFn = function cancelFn() {
|
1078 | xhr.abort();
|
1079 | };
|
1080 |
|
1081 | return {
|
1082 | promise: promise,
|
1083 | cancelFn: cancelFn
|
1084 | };
|
1085 | }
|
1086 |
|
1087 | function configure(opts) {
|
1088 | options = opts;
|
1089 | }
|
1090 |
|
1091 | }),
|
1092 |
|
1093 | "./registerLoaders.js":
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 | (function(module, exports, __webpack_require__) {
|
1099 |
|
1100 | "use strict";
|
1101 |
|
1102 |
|
1103 | Object.defineProperty(exports, "__esModule", {
|
1104 | value: true
|
1105 | });
|
1106 |
|
1107 | exports.default = function (cornerstone) {
|
1108 |
|
1109 | cornerstone.registerImageLoader('http', _loadImage.loadImage);
|
1110 | cornerstone.registerImageLoader('https', _loadImage.loadImage);
|
1111 | };
|
1112 |
|
1113 | var _loadImage = __webpack_require__( "./loadImage.js");
|
1114 |
|
1115 | })
|
1116 |
|
1117 | });
|
1118 | });
|
1119 |
|
\ | No newline at end of file |