-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudyListRouting.bundle.ff927011e19fe3e41406.js
2 lines (2 loc) · 62.2 KB
/
StudyListRouting.bundle.ff927011e19fe3e41406.js
1
2
(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{1016:function(e,t,n){},1017:function(e,t,n){"use strict";function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(n,!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function c(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function c(e){i(a,r,o,c,u,"next",e)}function u(e){i(a,r,o,c,u,"throw",e)}c(void 0)}))}}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r,a,i,s,l,f;return t=e,(n=[{key:"setAccessToken",value:function(e){e||console.error("Access token is empty"),this.accessToken=e}},{key:"getUrlBaseDicomWeb",value:function(e,t,n,r){return this.urlBase+"/projects/".concat(e,"/locations/").concat(t,"/datasets/").concat(n,"/dicomStores/").concat(r,"/dicomWeb")}},{key:"getUrlPath",value:function(e,t,n,r){"/projects/".concat(e,"/locations/").concat(t,"/datasets/").concat(n,"/dicomStores/").concat(r)}},{key:"doRequest",value:(f=c(regeneratorRuntime.mark((function e(t){var n,r,a,i,c,u,s,l=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=l.length>1&&void 0!==l[1]?l[1]:{},r=l.length>2&&void 0!==l[2]?l[2]:{},a=new URL(t),i=null,a.search=new URLSearchParams(r),e.prev=5,e.next=8,fetch(a,o({},this.fetchConfig,{config:n}));case 8:return c=e.sent,e.prev=9,e.next=12,c.json();case 12:i=e.sent,e.next=17;break;case 15:e.prev=15,e.t0=e.catch(9);case 17:if(!(c.status>=200&&c.status<300&&null!=i)){e.next=27;break}if(null==i.nextPageToken){e.next=24;break}return r.pageToken=i.nextPageToken,e.next=22,this.doRequest(t,n,r);case 22:for(s in u=e.sent,i)i.hasOwnProperty(s)&&(i[s]=i[s].concat(u.data[s]));case 24:return e.abrupt("return",{isError:!1,status:c.status,data:i});case 27:return e.abrupt("return",{isError:!0,status:c.status,message:i&&i.error&&i.error.message||"Unknown error"});case 28:e.next=35;break;case 30:if(e.prev=30,e.t1=e.catch(5),!i||!i.error){e.next=34;break}return e.abrupt("return",{isError:!0,status:e.t1.status,message:e.t1.response.data.error.message||"Unspecified error"});case 34:return e.abrupt("return",{isError:!0,message:e.t1&&e.t1.message||"Oops! Something went wrong"});case 35:case"end":return e.stop()}}),e,this,[[5,30],[9,15]])}))),function(e){return f.apply(this,arguments)})},{key:"loadProjects",value:(l=c(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.doRequest("https://cloudresourcemanager.googleapis.com/v1/projects"));case 1:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"loadLocations",value:(s=c(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.doRequest("".concat(this.urlBaseProject,"/").concat(t,"/locations")));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"loadDatasets",value:(i=c(regeneratorRuntime.mark((function e(t,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.doRequest("".concat(this.urlBaseProject,"/").concat(t,"/locations/").concat(n,"/datasets")));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"loadDicomStores",value:(a=c(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.doRequest("".concat(this.urlBase,"/").concat(t,"/dicomStores")));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"fetchConfig",get:function(){if(!this.accessToken)throw new Error("OIDC access_token is not set");return{method:"GET",headers:{Authorization:"Bearer "+this.accessToken}}}},{key:"urlBase",get:function(){return this.healthcareApiEndpoint||"https://healthcare.googleapis.com/v1beta1"},set:function(e){this.healthcareApiEndpoint=e}},{key:"urlBaseProject",get:function(){return this.urlBase+"/projects"}}])&&u(t.prototype,n),r&&u(t,r),e}();t.a=new s},1032:function(e,t,n){"use strict";var r=n(54),o=n.n(r);function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var i=function(){function e(){var t,n,r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),r=void 0,(n="fileType")in(t=this)?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r}var t,n,r;return t=e,(n=[{key:"loadFile",value:function(e,t){}},{key:"getDataset",value:function(e,t){}},{key:"getStudies",value:function(e,t){}}])&&a(t.prototype,n),r&&a(t,r),e}();function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function s(e){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var p=new(function(e){function t(){var e,n,r,o,a,i,u;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var f=arguments.length,p=new Array(f),d=0;d<f;d++)p[d]=arguments[d];return r=this,n=!(o=(e=s(t)).call.apply(e,[this].concat(p)))||"object"!==c(o)&&"function"!=typeof o?l(r):o,a=l(n),u="application/pdf",(i="fileType")in a?Object.defineProperty(a,i,{value:u,enumerable:!0,configurable:!0,writable:!0}):a[i]=u,n}var n,r,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&f(e,t)}(t,e),n=t,(r=[{key:"loadFile",value:function(e,t){return o.a.wadouri.loadFileRequest(t)}},{key:"getDataset",value:function(e,t){var n={};return n.imageId=e.imageId||t,n}},{key:"getStudies",value:function(e,t){return this.getDefaultStudy(t)}},{key:"getDefaultStudy",value:function(e){return{StudyInstanceUID:"",StudyDate:"",StudyTime:"",AccessionNumber:"",ReferringPhysicianName:"",PatientName:"",PatientID:"",PatientBirthdate:"",PatientSex:"",StudyId:"",StudyDescription:"",series:[{SeriesInstanceUID:"",SeriesDescription:"",SeriesNumber:"",instances:[{metadata:{SOPInstanceUID:"",SOPClassUID:"1.2.840.10008.5.1.4.1.1.104.1",Rows:"",Columns:"",NumberOfFrames:0,InstanceNumber:1},getImageId:function(){return e},isLocalFile:!0}]}]}}}])&&u(n.prototype,r),a&&u(n,a),t}(i)),d=n(28);function y(e){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function b(e){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var g=n(16).a.cornerstone.metadataProvider,S=new(function(e){function t(){var e,n,r,o,a,i,c;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var u=arguments.length,s=new Array(u),l=0;l<u;l++)s[l]=arguments[l];return r=this,n=!(o=(e=b(t)).call.apply(e,[this].concat(s)))||"object"!==y(o)&&"function"!=typeof o?h(r):o,a=h(n),c="application/dicom",(i="fileType")in a?Object.defineProperty(a,i,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[i]=c,n}var n,r,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}(t,e),n=t,(r=[{key:"loadFile",value:function(e,t){return o.a.wadouri.loadFileRequest(t)}},{key:"getDataset",value:function(e,t){var n={};try{var r=d.a.data.DicomMessage.readFile(e);n=d.a.data.DicomMetaDictionary.naturalizeDataset(r.dict),g.addInstance(n),n._meta=d.a.data.DicomMetaDictionary.namifyDataset(r.meta)}catch(e){console.error("Error reading dicom file",e)}return n.imageId=t,n}},{key:"getStudies",value:function(e,t){return this.getStudyFromDataset(e)}},{key:"getStudyFromDataset",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.StudyInstanceUID,n=e.StudyDate,r=e.StudyTime,o=e.AccessionNumber,a=e.ReferringPhysicianName,i=e.PatientName,c=e.PatientID,u=e.PatientBirthDate,s=e.PatientSex,l=e.StudyID,f=e.StudyDescription,p=e.SeriesInstanceUID,d=e.SeriesDescription,y=e.SeriesNumber,m=e.imageId,b={metadata:e,url:m},h={SeriesInstanceUID:p,SeriesDescription:d,SeriesNumber:y,instances:[b]},v={StudyInstanceUID:t,StudyDate:n,StudyTime:r,AccessionNumber:o,ReferringPhysicianName:a,PatientName:i,PatientID:c,PatientBirthDate:u,PatientSex:s,StudyID:l,StudyDescription:f,series:[h]};return v}}])&&m(n.prototype,r),a&&m(n,a),t}(i));function w(e){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function O(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function P(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function E(e){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function k(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function D(e,t){return(D=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var I=function(e){function t(e){var n,r,o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r=this,n=!(o=E(t).call(this))||"object"!==w(o)&&"function"!=typeof o?k(r):o,C(k(n),"fileType",void 0),C(k(n),"loader",void 0);var a=e&&e.type;return n.loader=n.getLoader(a),n.fileType=n.loader.fileType,n}var n,r,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&D(e,t)}(t,e),n=t,a=[{key:"groupSeries",value:function(e){var t=function(e,t,n){var r=1;return e.reduce((function(e,o){var a,i=o[t],c=o[n];return e[i=i||""+r++]||(e[i]=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(n,!0).forEach((function(t){C(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},o),e[i][n]=[]),(a=e[i][n]).push.apply(a,O(c)),e}),{})};return Object.values(t(e,"StudyInstanceUID","series")).map((function(e){var n=t(e.series,"SeriesInstanceUID","instances");return e.series=Object.values(n),e}))}}],(r=[{key:"addFile",value:function(e){return o.a.wadouri.fileManager.add(e)}},{key:"loadFile",value:function(e,t){return this.loader.loadFile(e,t)}},{key:"getDataset",value:function(e,t){return this.loader.getDataset(e,t)}},{key:"getStudies",value:function(e,t){return this.loader.getStudies(e,t)}},{key:"getLoader",value:function(e){return"application/pdf"===e?p:S}}])&&P(n.prototype,r),a&&P(n,a),t}(i);function R(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function _(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){R(a,r,o,i,c,"next",e)}function c(e){R(a,r,o,i,c,"throw",e)}i(void 0)}))}}n.d(t,"a",(function(){return T}));var x=function(){var e=_(regeneratorRuntime.mark((function e(t){var n,r,o,a,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=new I(t),r=n.addFile(t),e.next=5,n.loadFile(t,r);case 5:return o=e.sent,e.next=8,n.getDataset(o,r);case 8:return a=e.sent,e.next=11,n.getStudies(a,r);case 11:return i=e.sent,e.abrupt("return",i);case 15:e.prev=15,e.t0=e.catch(0),console.log(e.t0.name,":Error when trying to load and process local files:",e.t0.message);case 18:case"end":return e.stop()}}),e,null,[[0,15]])})));return function(t){return e.apply(this,arguments)}}();function T(e){return N.apply(this,arguments)}function N(){return(N=_(regeneratorRuntime.mark((function e(t){var n,r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.map(x),e.next=3,Promise.all(n);case 3:return r=e.sent,e.abrupt("return",I.groupSeries(r.flat()));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},1033:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0);function o(e){var t=Object(r.useRef)();return Object(r.useEffect)((function(){t.current=e}),[e]),t.current}},1036:function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"c",(function(){return o})),n.d(t,"b",(function(){return a}));var r=function(e,t){var n=e.wadoUriRoot,r=e.qidoRoot,o=e.wadoRoot,a=e.dataset,i=void 0===a?"":a,c=e.dicomStore,u=void 0===c?"":c,s=e.location,l=void 0===s?"":s,f=e.project;return[{name:t,dataset:i,dicomStore:u,location:l,project:void 0===f?"":f,imageRendering:"wadors",thumbnailRendering:"wadors",type:"dicomWeb",active:!0,wadoUriRoot:n,qidoRoot:r,wadoRoot:o,supportsFuzzyMatching:!1,qidoSupportsIncludeField:!1}]},o=function(e){return e&&!!e.dataset&&!!e.dicomStore&&!!e.location&&!!e.project},a=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Object.keys(e).length,r=Object.keys(t).length;return!(!n||!r)&&(e.dataset===t.dataset&&e.dataset===t.dataset&&e.dicomStore===t.dicomStore&&e.location===t.location&&e.project===t.project)}},1049:function(e,t,n){"use strict";n.d(t,"a",(function(){return y}));var r=n(0),o=n(1017),a=n(1033),i=n(1036),c=n(58),u=(n(229),n(76)),s=function(e){return e&&e.servers&&e.servers.find((function(e){return!0===e.active}))},l=function(e,t,n,r,a){var c=[];if(e.enableGoogleCloudAdapter){o.a.urlBase=e.healthcareApiEndpoint;var u=o.a.getUrlBaseDicomWeb(t,n,r,a),s={project:t,location:n,dataset:r,dicomStore:a,wadoUriRoot:u,qidoRoot:u,wadoRoot:u};if(c=i.a(s,a),!f(c[0],e))return}return c},f=function(e,t){return t.enableGoogleCloudAdapter?i.c(e):!!e},p=function(e,t){e({type:"SET_SERVERS",servers:t})},d=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;arguments.length>5&&arguments[5],arguments.length>6&&arguments[6],arguments.length>7&&arguments[7],arguments.length>8&&arguments[8];if(!o.enableGoogleCloudAdapter)return!1;var a=t!==e&&t;if(a)return!1;if(!r||!r.length)return!1;if(!e.length||!n)return!0;var c=r[0],u=e.some(i.b.bind(void 0,c));return!u};function y(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.project,n=e.location,o=e.dataset,i=e.dicomStore,y=Object(c.d)((function(e){return e&&e.servers})),m=Object(a.a)(y),b=Object(c.c)(),h=Object(r.useContext)(u.c).appConfig,v=void 0===h?{}:h,g=s(y),S=l(v,t,n,o,i)||[];if(d(y.servers,m,g,S,v,t,n,o,i))p(b,S);else if(f(g,v))return g}},1078:function(e,t,n){},999:function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),a=n(1),i=n.n(a),c=n(75),u=n(58),s=n(16),l=n(33),f=n(13),p=n(1031),d=n(169),y=n(6),m=n.n(y);function b(e){if(0===e)return"0 B";var t=Math.floor(Math.log(e)/Math.log(1024));return 1*(e/Math.pow(1024,t)).toFixed(2)+" "+["B","kB","MB","GB","TB"][t]}function h(e){if(!e)return"Unknown error";if(e.response)try{var t=JSON.parse(e.response);if(t.error&&t.error.code&&t.error.message)return t.error.code+" - "+t.error.message}catch(t){return e.response}return e.message||"Unknown error."}function v(e){if(e.length<=132)return!1;var t=new Uint8Array(e.slice(128,132));return Array.from("DICM").every((function(e,n){return e.charCodeAt(0)===t[n]}))}function g(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var S=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.cancelled=!1}var t,n,r;return t=e,(n=[{key:"get",value:function(){return this.cancelled}},{key:"set",value:function(e){this.cancelled=e}}])&&g(t.prototype,n),r&&g(t,r),e}(),w=n(43),O=n(36);function j(e){return(j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function P(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function E(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){P(a,r,o,i,c,"next",e)}function c(e){P(a,r,o,i,c,"throw",e)}i(void 0)}))}}function k(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var D=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,n,r,o,a;return t=e,(n=[{key:"smartUpload",value:(a=E(regeneratorRuntime.mark((function e(t,n,r,o){var a,i,c,u,s,l,f=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=1,i=50,0!==(c=Array.from(t)).length){e.next=5;break}throw new Error("No files were provided.");case 5:return u=Math.min(c.length,i),s=!1,l=function(){var e=E(regeneratorRuntime.mark((function e(t,i){var u,l;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u=regeneratorRuntime.mark((function e(){var i,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!o.get()){e.next=2;break}return e.abrupt("return",{v:void 0});case 2:if(i=c.slice(0,a),c=c.slice(a),u=null,e.prev=5,!(i.length>1)){e.next=8;break}throw new Error("Not implemented");case 8:if(1!==i.length){e.next=11;break}return e.next=11,f.simpleUpload(i[0],n);case 11:e.next=16;break;case 13:e.prev=13,e.t0=e.catch(5),u=h(e.t0);case 16:if(i.forEach((function(e){return r(e.fileId,u)})),s||0!==c.length){e.next=21;break}return s=!0,t(),e.abrupt("return",{v:void 0});case 21:case"end":return e.stop()}}),e,null,[[5,13]])}));case 1:if(!(c.length>0)){e.next=8;break}return e.delegateYield(u(),"t0",3);case 3:if("object"!==j(l=e.t0)){e.next=6;break}return e.abrupt("return",l.v);case 6:e.next=1;break;case 8:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),e.next=10,new Promise((function(e){for(var t=0;t<u;t++)l(e)}));case 10:case"end":return e.stop()}}),e)}))),function(e,t,n,r){return a.apply(this,arguments)})},{key:"simpleUpload",value:(o=E(regeneratorRuntime.mark((function e(t,n){var r,o,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.getClient(n),e.next=3,this.readFile(t);case 3:if(o=e.sent,v(a=o.content)){e.next=7;break}throw new Error("This is not a valid DICOM file.");case 7:return e.next=9,r.storeInstances({datasets:[a]});case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"readFile",value:function(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(){t({name:e.name,size:e.size,type:e.type,content:r.result})},r.onerror=function(e){return n(e)},r.readAsArrayBuffer(e)}))}},{key:"setRetrieveAuthHeaderFunction",value:function(e){this.retrieveAuthHeaderFunc=e}},{key:"getClient",value:function(e){var t=this.retrieveAuthHeaderFunc();return O.a.getHTTPErrorHandler(),new w.a.DICOMwebClient({url:e,headers:t})}}])&&k(t.prototype,n),r&&k(t,r),e}());n(1078);function C(e){return(C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function I(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function R(e){return(R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var N=function(e){function t(){var e,n,r,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,c=new Array(i),u=0;u<i;u++)c[u]=arguments[u];return r=this,a=(e=R(t)).call.apply(e,[this].concat(c)),n=!a||"object"!==C(a)&&"function"!=typeof a?_(r):a,T(_(n),"state",{status:"Upload",isCancelled:!1,errorsCount:0,files:null,uploadedVolume:null,wholeVolumeStr:null,isFilesListHidden:!0,timeLeft:null,uploadedList:null,totalCount:0,successfullyUploadedCount:0,lastFile:"",uploadContext:null}),T(_(n),"uploadFiles",(function(e){var t=Array.from(e.target.files),r={};t.forEach((function(e,t){var n={id:t,name:e.name,path:e.webkitRelativePath||e.name,size:e.size,error:null,processed:!1,processedInUI:!1};r[t]=n,e.fileId=t}));var o=t.map((function(e){return e.size})).reduce((function(e,t){return e+t})),a=Math.random();n.setState({status:"Uploading...",files:r,uploadedList:[],uploadedVolume:0,lastFile:t[0].name,totalCount:t.length,wholeVolumeStr:b(o),uploadContext:a,cancellationToken:new S});var i=new S;D.setRetrieveAuthHeaderFunction(n.props.retrieveAuthHeaderFunction),D.smartUpload(e.target.files,n.props.url,(function(e,t){return a===n.state.uploadContext&&n.uploadCallback.call(_(n),e,t)}),i)})),T(_(n),"renderTableRow",(function(e){var t=null;return null!==e.error&&(t=o.a.createElement("p",{style:{color:"red"}},e.error)),o.a.createElement("tr",{key:e.id},o.a.createElement("td",{className:"project"},e.name," ",t))})),n}var n,r,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&x(e,t)}(t,e),n=t,(r=[{key:"filesLeft",value:function(){return this.state.uploadedList.length+" of "+this.state.totalCount+" files"}},{key:"volumeLeft",value:function(){return b(this.state.uploadedVolume)+" of "+this.state.wholeVolumeStr}},{key:"percents",value:function(){return parseInt(100*this.state.uploadedList.length/Object.keys(this.state.files).length)}},{key:"isFinished",value:function(){return this.state.isCancelled||Object.keys(this.state.files).length===this.state.uploadedList.length}},{key:"errorsMessage",value:function(){var e=1===this.state.errorsCount?" error":" errors";return this.state.errorsCount+e+" while uploading, click for more info"}},{key:"uploadCallback",value:function(e,t){var n=this.state.files[e];if(n.processed=!0,t)n.error=t,this.setState({errorsCount:this.state.errorsCount+1});else{var r=this.state.uploadedVolume+n.size;this.setState({uploadedVolume:r})}this.setState({lastFile:n.name});var o=this.state.uploadedList;o.push(n),this.setState({uploadedList:o})}},{key:"render",value:function(){return null===this.state.files?o.a.createElement("div",{className:"dicom-uploader"},o.a.createElement("div",{className:"button"},o.a.createElement("label",{htmlFor:"file"},o.a.createElement("img",{src:"./assets/Button_File.svg",alt:"upload file"})),o.a.createElement("input",{className:"invisible-input",onChange:this.uploadFiles,type:"file",id:"file",multiple:!0})),o.a.createElement("div",{className:"button"},o.a.createElement("label",{htmlFor:"folder"},o.a.createElement("img",{src:"./assets/Button_Folder.svg",alt:"upload folder"})),o.a.createElement("input",{className:"invisible-input",type:"file",onChange:this.uploadFiles,id:"folder",webkitdirectory:"true",mozdirectory:"true",multiple:!0}))):o.a.createElement("table",{id:"tblProjectList",className:"table noselect"},o.a.createElement("thead",null,o.a.createElement("tr",null,o.a.createElement("th",{className:"table-header"},this.percents(),"% ",this.filesLeft()))),o.a.createElement("tbody",{id:"ProjectList"},this.state.uploadedList.map(this.renderTableRow)))}}])&&I(n.prototype,r),a&&I(n,a),t}(r.Component);T(N,"propTypes",{id:i.a.string,event:i.a.string,url:i.a.string,retrieveAuthHeaderFunction:i.a.func});var F=n(256);function A(e){var t=e.isOpen,n=void 0!==t&&t,r=e.onClose,a=e.url,i=e.retrieveAuthHeaderFunction,c=e.t,u=F.e.services.UIModalService;return o.a.createElement(o.a.Fragment,null,n&&void(u&&u.show({content:N,title:c("Upload DICOM Files"),contentProps:{url:a,retrieveAuthHeaderFunction:i},onClose:r})))}A.propTypes={isOpen:i.a.bool.isRequired,retrieveAuthHeaderFunction:i.a.func.isRequired,onClose:i.a.func,url:i.a.string};var L=Object(l.d)("Common")(A),M=function(e){return!0===e.active},U=Object(u.b)((function(e){var t=e.servers.servers.find(M);return{retrieveAuthHeaderFunction:function(){return s.a.DICOMWeb.getAuthorizationHeader(t)},url:t&&t.qidoRoot}}),null)(L),q=n(1017);n(1016);function B(e){return(B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function H(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function z(e){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function V(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Y(e,t){return(Y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function W(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var G=function(e){function t(){var e,n,r,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,c=new Array(i),u=0;u<i;u++)c[u]=arguments[u];return r=this,a=(e=z(t)).call.apply(e,[this].concat(c)),n=!a||"object"!==B(a)&&"function"!=typeof a?V(r):a,W(V(n),"state",{search:""}),W(V(n),"renderTableRow",(function(e){return o.a.createElement("tr",{key:e.name,className:n.state.highlightedItem===e.name?"noselect active":"noselect",onMouseEnter:function(){n.onHighlightItem(e.name)},onClick:function(){n.props.onSelect(e)}},o.a.createElement("td",{className:"project"},e.name.split("/")[7]))})),n}var n,r,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Y(e,t)}(t,e),n=t,(r=[{key:"onHighlightItem",value:function(e){this.setState({highlightedItem:e})}},{key:"render",value:function(){var e=this.props,t=e.loading,n=e.stores,r=e.filter,a=e.error;if(a)return o.a.createElement("p",null,a);var i=o.a.createElement(f.k,{name:"circle-notch",className:"loading-icon-spin loading-icon"});if(t)return i;var c=o.a.createElement("tbody",{id:"StoreList"},n.filter((function(e){return e.name.split("/")[7].toLowerCase().includes(r.toLowerCase())||""==r})).map(this.renderTableRow));return o.a.createElement("table",{id:"tblStoreList",className:"gcp-table table noselect"},o.a.createElement("thead",null,o.a.createElement("tr",null,o.a.createElement("th",null,this.props.t("DICOM Store")))),n&&c)}}])&&H(n.prototype,r),a&&H(n,a),t}(r.Component);W(G,"propTypes",{stores:i.a.array,loading:i.a.bool.isRequired,error:i.a.string,onSelect:i.a.func}),W(G,"defaultProps",{loading:!0});var J=Object(l.d)("Common")(G);function Q(e){return(Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function K(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function X(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function $(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ee(e,t){return(ee=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function te(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ne=function(e){function t(){var e,n,r,o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var a=arguments.length,i=new Array(a),c=0;c<a;c++)i[c]=arguments[c];return r=this,n=!(o=(e=Z(t)).call.apply(e,[this].concat(i)))||"object"!==Q(o)&&"function"!=typeof o?$(r):o,te($(n),"state",{error:null,loading:!0,stores:[],locations:[],filterStr:""}),n}var n,r,a,i,c;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ee(e,t)}(t,e),n=t,(r=[{key:"componentDidMount",value:(i=regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return q.a.setAccessToken(this.props.accessToken),e.next=3,q.a.loadDicomStores(this.props.dataset.name);case 3:if(!(t=e.sent).isError){e.next=7;break}return this.setState({error:t.message}),e.abrupt("return");case 7:this.setState({stores:t.data.dicomStores||[],loading:!1});case 8:case"end":return e.stop()}}),e,this)})),c=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=i.apply(e,t);function a(e){K(o,n,r,a,c,"next",e)}function c(e){K(o,n,r,a,c,"throw",e)}a(void 0)}))},function(){return c.apply(this,arguments)})},{key:"render",value:function(){var e=this,t=this.state,n=t.stores,r=t.loading,a=t.error,i=t.filterStr,c=this.props.onSelect;return o.a.createElement("div",null,o.a.createElement("input",{className:"form-control gcp-input",type:"text",value:i,onChange:function(t){return e.setState({filterStr:t.target.value})}}),o.a.createElement(J,{stores:n,loading:r,error:a,filter:i,onSelect:c}))}}])&&X(n.prototype,r),a&&X(n,a),t}(r.Component);function re(e){return(re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function oe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ae(e){return(ae=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ie(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ce(e,t){return(ce=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ue(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}te(ne,"propTypes",{dataset:i.a.object,onSelect:i.a.func,accessToken:i.a.string.isRequired});var se=function(e){function t(){var e,n,r,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,c=new Array(i),u=0;u<i;u++)c[u]=arguments[u];return r=this,a=(e=ae(t)).call.apply(e,[this].concat(c)),n=!a||"object"!==re(a)&&"function"!=typeof a?ie(r):a,ue(ie(n),"state",{search:""}),ue(ie(n),"renderTableRow",(function(e){return o.a.createElement("tr",{key:e.name,className:n.state.highlightedItem===e.name?"noselect active":"noselect",onMouseEnter:function(){n.onHighlightItem(e.name)},onClick:function(){n.props.onSelect(e)}},o.a.createElement("td",null,e.name.split("/")[5]))})),n}var n,r,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ce(e,t)}(t,e),n=t,(r=[{key:"onHighlightItem",value:function(e){this.setState({highlightedItem:e})}},{key:"render",value:function(){var e=this.props,t=e.loading,n=e.datasets,r=e.filter,a=e.error;if(a)return o.a.createElement("p",null,a);var i=o.a.createElement(f.k,{name:"circle-notch",className:"loading-icon-spin loading-icon"});if(t)return i;var c=o.a.createElement("tbody",{id:"DatasetList"},n.filter((function(e){return e.name.split("/")[5].toLowerCase().includes(r.toLowerCase())||""==r})).map(this.renderTableRow));return o.a.createElement("table",{id:"tblDatasetList",className:"gcp-table table noselect"},o.a.createElement("thead",null,o.a.createElement("tr",null,o.a.createElement("th",null,this.props.t("Dataset")))),n&&c)}}])&&oe(n.prototype,r),a&&oe(n,a),t}(r.Component);ue(se,"propTypes",{datasets:i.a.array,loading:i.a.bool,error:i.a.string,onSelect:i.a.func}),ue(se,"defaultProps",{loading:!0});var le=Object(l.d)("Common")(se);function fe(e){return(fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function pe(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function de(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ye(e){return(ye=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function me(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function be(e,t){return(be=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function he(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ve=function(e){function t(){var e,n,r,o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var a=arguments.length,i=new Array(a),c=0;c<a;c++)i[c]=arguments[c];return r=this,n=!(o=(e=ye(t)).call.apply(e,[this].concat(i)))||"object"!==fe(o)&&"function"!=typeof o?me(r):o,he(me(n),"state",{error:null,loading:!0,datasets:[],filterStr:""}),n}var n,r,a,i,c;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&be(e,t)}(t,e),n=t,(r=[{key:"componentDidMount",value:(i=regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return q.a.setAccessToken(this.props.accessToken),e.next=3,q.a.loadDatasets(this.props.project.projectId,this.props.location.locationId);case 3:if(!(t=e.sent).isError){e.next=7;break}return this.setState({error:t.message}),e.abrupt("return");case 7:this.setState({datasets:t.data.datasets||[],loading:!1});case 8:case"end":return e.stop()}}),e,this)})),c=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=i.apply(e,t);function a(e){pe(o,n,r,a,c,"next",e)}function c(e){pe(o,n,r,a,c,"throw",e)}a(void 0)}))},function(){return c.apply(this,arguments)})},{key:"render",value:function(){var e=this,t=this.state,n=t.datasets,r=t.loading,a=t.error,i=t.filterStr,c=this.props.onSelect;return o.a.createElement("div",null,o.a.createElement("input",{className:"form-control gcp-input",type:"text",value:i,onChange:function(t){return e.setState({filterStr:t.target.value})}}),o.a.createElement(le,{datasets:n,loading:r,error:a,filter:i,onSelect:c}))}}])&&de(n.prototype,r),a&&de(n,a),t}(r.Component);function ge(e){return(ge="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Se(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function we(e){return(we=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Oe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function je(e,t){return(je=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Pe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}he(ve,"propTypes",{project:i.a.object,location:i.a.object,onSelect:i.a.func,accessToken:i.a.string});var Ee=function(e){function t(){var e,n,r,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,c=new Array(i),u=0;u<i;u++)c[u]=arguments[u];return r=this,a=(e=we(t)).call.apply(e,[this].concat(c)),n=!a||"object"!==ge(a)&&"function"!=typeof a?Oe(r):a,Pe(Oe(n),"state",{search:"",highlightedItem:null}),Pe(Oe(n),"renderTableRow",(function(e){return o.a.createElement("tr",{key:e.projectId,className:n.state.highlightedItem===e.projectId?"noselect active":"noselect",onMouseEnter:function(){n.onHighlightItem(e.projectId)},onClick:function(){n.onHighlightItem(e.projectId),n.props.onSelect(e)}},o.a.createElement("td",null,e.name),o.a.createElement("td",null,e.projectId))})),n}var n,r,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&je(e,t)}(t,e),n=t,(r=[{key:"onHighlightItem",value:function(e){this.setState({highlightedItem:e})}},{key:"render",value:function(){var e=this.props,t=e.loading,n=e.projects,r=e.filter,a=e.error;if(a)return o.a.createElement("p",null,a);var i=o.a.createElement(f.k,{name:"circle-notch",className:"loading-icon-spin loading-icon"});if(t)return i;var c=r.toLowerCase(),u=n.filter((function(e){return"string"==typeof e.name&&(""===r||e.name.toLowerCase().includes(c))})),s=o.a.createElement("tbody",{id:"ProjectList"},u.map(this.renderTableRow));return o.a.createElement("table",{id:"tblProjectList",className:"gcp-table table noselect"},o.a.createElement("thead",null,o.a.createElement("tr",null,o.a.createElement("th",null,this.props.t("Project")),o.a.createElement("th",null,this.props.t("ID")))),n&&s)}}])&&Se(n.prototype,r),a&&Se(n,a),t}(r.Component);Pe(Ee,"propTypes",{projects:i.a.array,loading:i.a.bool.isRequired,error:i.a.string,onSelect:i.a.func.isRequired,t:i.a.func}),Pe(Ee,"defaultProps",{loading:!0});var ke=Object(l.d)("Common")(Ee);function De(e){return(De="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ce(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function Ie(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Re(e){return(Re=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _e(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function xe(e,t){return(xe=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Te(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ne=function(e){function t(){var e,n,r,o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var a=arguments.length,i=new Array(a),c=0;c<a;c++)i[c]=arguments[c];return r=this,n=!(o=(e=Re(t)).call.apply(e,[this].concat(i)))||"object"!==De(o)&&"function"!=typeof o?_e(r):o,Te(_e(n),"state",{error:null,loading:!0,projects:[]}),n}var n,r,a,i,c;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&xe(e,t)}(t,e),n=t,(r=[{key:"componentDidMount",value:(i=regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return q.a.setAccessToken(this.props.accessToken),e.next=3,q.a.loadProjects();case 3:if(!(t=e.sent).isError){e.next=7;break}return this.setState({error:t.message}),e.abrupt("return");case 7:this.setState({projects:t.data.projects||[],filterStr:"",loading:!1});case 8:case"end":return e.stop()}}),e,this)})),c=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=i.apply(e,t);function a(e){Ce(o,n,r,a,c,"next",e)}function c(e){Ce(o,n,r,a,c,"throw",e)}a(void 0)}))},function(){return c.apply(this,arguments)})},{key:"render",value:function(){var e=this,t=this.state,n=t.projects,r=t.loading,a=t.filterStr,i=t.error,c=this.props.onSelect;return o.a.createElement("div",null,o.a.createElement("input",{className:"form-control gcp-input",type:"text",value:a,onChange:function(t){return e.setState({filterStr:t.target.value})}}),o.a.createElement(ke,{projects:n,loading:r,filter:a,error:i,onSelect:c}))}}])&&Ie(n.prototype,r),a&&Ie(n,a),t}(r.Component);function Fe(e){return(Fe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ae(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Le(e){return(Le=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Me(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ue(e,t){return(Ue=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function qe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Te(Ne,"propTypes",{onSelect:i.a.func,accessToken:i.a.string});var Be=function(e){function t(){var e,n,r,a;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var i=arguments.length,c=new Array(i),u=0;u<i;u++)c[u]=arguments[u];return r=this,a=(e=Le(t)).call.apply(e,[this].concat(c)),n=!a||"object"!==Fe(a)&&"function"!=typeof a?Me(r):a,qe(Me(n),"state",{search:""}),qe(Me(n),"renderTableRow",(function(e){return o.a.createElement("tr",{key:e.locationId,className:n.state.highlightedItem===e.locationId?"noselect active":"noselect",onMouseEnter:function(){n.onHighlightItem(e.locationId)},onClick:function(){n.props.onSelect(e)}},o.a.createElement("td",null,e.name.split("/")[3]))})),n}var n,r,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ue(e,t)}(t,e),n=t,(r=[{key:"onHighlightItem",value:function(e){this.setState({highlightedItem:e})}},{key:"render",value:function(){var e=this.props,t=e.loading,n=e.locations,r=e.filter,a=e.error;if(a)return o.a.createElement("p",null,a);var i=o.a.createElement(f.k,{name:"circle-notch",className:"loading-icon-spin loading-icon"});if(t)return i;var c=o.a.createElement("tbody",{id:"LocationList"},n.filter((function(e){return e.name.split("/")[3].toLowerCase().includes(r.toLowerCase())||""==r})).map(this.renderTableRow));return o.a.createElement("table",{id:"tblLocationList",className:"gcp-table table noselect"},o.a.createElement("thead",null,o.a.createElement("tr",null,o.a.createElement("th",null,this.props.t("Location")))),n&&c)}}])&&Ae(n.prototype,r),a&&Ae(n,a),t}(r.Component);qe(Be,"propTypes",{locations:i.a.array,loading:i.a.bool.isRequired,error:i.a.string,onSelect:i.a.func}),qe(Be,"defaultProps",{loading:!0});var He=Object(l.d)("Common")(Be);function ze(e){return(ze="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ve(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function Ye(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function We(e){return(We=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ge(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Je(e,t){return(Je=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Qe(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ke=function(e){function t(){var e,n,r,o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var a=arguments.length,i=new Array(a),c=0;c<a;c++)i[c]=arguments[c];return r=this,n=!(o=(e=We(t)).call.apply(e,[this].concat(i)))||"object"!==ze(o)&&"function"!=typeof o?Ge(r):o,Qe(Ge(n),"state",{error:null,loading:!0,locations:[],filterStr:""}),n}var n,r,a,i,c;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Je(e,t)}(t,e),n=t,(r=[{key:"componentDidMount",value:(i=regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return q.a.setAccessToken(this.props.accessToken),e.next=3,q.a.loadLocations(this.props.project.projectId);case 3:if(!(t=e.sent).isError){e.next=7;break}return this.setState({error:t.message}),e.abrupt("return");case 7:this.setState({locations:t.data.locations||[],loading:!1});case 8:case"end":return e.stop()}}),e,this)})),c=function(){var e=this,t=arguments;return new Promise((function(n,r){var o=i.apply(e,t);function a(e){Ve(o,n,r,a,c,"next",e)}function c(e){Ve(o,n,r,a,c,"throw",e)}a(void 0)}))},function(){return c.apply(this,arguments)})},{key:"render",value:function(){var e=this,t=this.state,n=t.locations,r=t.loading,a=t.error,i=t.filterStr,c=this.props.onSelect;return o.a.createElement("div",null,o.a.createElement("input",{className:"form-control gcp-input",type:"text",value:i,onChange:function(t){return e.setState({filterStr:t.target.value})}}),o.a.createElement(He,{locations:n,loading:r,error:a,filter:i,onSelect:c}))}}])&&Ye(n.prototype,r),a&&Ye(n,a),t}(r.Component);function Xe(e){return(Xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ze(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function $e(e){return($e=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function et(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function tt(e,t){return(tt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function nt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Qe(Ke,"propTypes",{project:i.a.object,onSelect:i.a.func,accessToken:i.a.string});var rt=function(e){function t(){var e,n,r,o;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var a=arguments.length,i=new Array(a),c=0;c<a;c++)i[c]=arguments[c];return r=this,o=(e=$e(t)).call.apply(e,[this].concat(i)),n=!o||"object"!==Xe(o)&&"function"!=typeof o?et(r):o,nt(et(n),"state",{project:null,location:null,dataset:null,unloading:!1}),nt(et(n),"onProjectSelect",(function(e){n.setState({project:e})})),nt(et(n),"onLocationSelect",(function(e){n.setState({location:e})})),nt(et(n),"onDatasetSelect",(function(e){n.setState({dataset:e})})),nt(et(n),"onProjectClick",(function(){n.setState({dataset:null,location:null,project:null})})),nt(et(n),"onLocationClick",(function(){n.setState({dataset:null,location:null})})),nt(et(n),"onDatasetClick",(function(){n.setState({dataset:null})})),nt(et(n),"onDicomStoreSelect",(function(e){var t=e.name,r=t.split("/"),o={wadoUriRoot:q.a.urlBase+"/".concat(t,"/dicomWeb"),qidoRoot:q.a.urlBase+"/".concat(t,"/dicomWeb"),wadoRoot:q.a.urlBase+"/".concat(t,"/dicomWeb"),project:r[1],location:r[3],dataset:r[5],dicomStore:r[7]};n.props.setServers(o)})),n}var n,r,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&tt(e,t)}(t,e),n=t,(r=[{key:"render",value:function(){var e=this.props.user.access_token,t=this.state,n=t.project,r=t.location,a=t.dataset,i=this.onProjectClick,c=this.onLocationClick,u=this.onDatasetClick,s=this.onProjectSelect,l=this.onLocationSelect,f=this.onDatasetSelect,p=this.onDicomStoreSelect,d=o.a.createElement("div",{className:"gcp-picker--path"},o.a.createElement("span",null,this.props.t("Select a Project")));return n&&(d=o.a.createElement("div",{className:"gcp-picker--path"},o.a.createElement("span",{onClick:i},n.name),n&&r&&o.a.createElement("span",{onClick:c}," ","-> ",r.name.split("/")[3]),n&&r&&a&&o.a.createElement("span",{onClick:u}," ","-> ",a.name.split("/")[5]))),o.a.createElement(o.a.Fragment,null,d,!n&&o.a.createElement(Ne,{accessToken:e,onSelect:s}),n&&!r&&o.a.createElement(Ke,{accessToken:e,project:n,onSelect:l}),n&&r&&!a&&o.a.createElement(ve,{accessToken:e,project:n,location:r,onSelect:f}),n&&r&&a&&o.a.createElement(ne,{accessToken:e,dataset:a,onSelect:p}))}}])&&Ze(n.prototype,r),a&&Ze(n,a),t}(r.Component);nt(rt,"propTypes",{id:i.a.string,event:i.a.string,user:i.a.object,canClose:i.a.string,setServers:i.a.func.isRequired});var ot=Object(l.d)("Common")(rt),at=n(1036);function it(e){var t=e.isOpen,n=void 0!==t&&t,r=e.setServers,a=e.onClose,i=e.user,c=e.url,u=e.t,s=F.e.services.UIModalService;return o.a.createElement(o.a.Fragment,null,n&&void(s&&s.show({content:ot,title:u("Google Cloud Healthcare API"),contentProps:{setServers:function(e){var t=at.a(e,e.dicomstore);r(t),s.hide(),a()},user:i,url:c},onClose:a})))}it.propTypes={isOpen:i.a.bool.isRequired,setServers:i.a.func.isRequired,onClose:i.a.func,user:i.a.object.isRequired,url:i.a.string};var ct=Object(l.d)("Common")(it),ut=function(e){return!0===e.active},st=Object(u.b)((function(e){var t=e.servers.servers.find(ut);return{user:e.oidc&&e.oidc.user,url:t&&t.qidoRoot}}),(function(e){return{setServers:function(t){e({type:"SET_SERVERS",servers:t})}}}))(ct),lt=(n(1032),n(257)),ft=n(210),pt=n(76);function dt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function yt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function mt(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void n(e)}c.done?t(u):Promise.resolve(u).then(r,o)}function bt(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var a=e.apply(t,n);function i(e){mt(a,r,o,i,c,"next",e)}function c(e){mt(a,r,o,i,c,"throw",e)}i(void 0)}))}}function ht(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,o=!1,a=void 0;try{for(var i,c=e[Symbol.iterator]();!(r=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);r=!0);}catch(e){o=!0,a=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var vt=s.a.utils.urlUtil;function gt(e){var t=e.history,n=e.server,a=e.user,i=e.studyListFunctionsEnabled,c=ht(Object(l.c)("Common"),1)[0],u=ht(Object(r.useState)({fieldName:"PatientName",direction:"desc"}),2),s=u[0],y=u[1],m=ht(Object(r.useState)({studyDateTo:null,studyDateFrom:null,PatientName:"",PatientID:"",AccessionNumber:"",StudyDate:"",modalities:"",StudyDescription:"",patientNameOrId:"",accessionOrModalityOrDescription:"",allFields:""}),2),b=m[0],h=m[1],v=ht(Object(r.useState)([]),2),g=v[0],S=v[1],w=ht(Object(r.useState)({isSearchingForStudies:!1,error:null}),2),O=w[0],j=w[1],P=ht(Object(r.useState)(null),2),E=P[0],k=P[1],D=ht(Object(r.useState)(25),2),C=D[0],I=D[1],R=ht(Object(r.useState)(0),2),_=R[0],x=R[1],T=Object(r.useContext)(pt.c),N=Object(f.R)(["(min-width: 1750px)","(min-width: 1000px) and (max-width: 1749px)","(max-width: 999px)"],["large","medium","small"],"small"),F=Object(f.P)(s,200),A=Object(f.P)(b,250),L=T.appConfig,M=void 0===L?{}:L;!n&&M.enableGoogleCloudAdapter&&"DicomStorePicker"!==E&&k("DicomStorePicker"),Object(r.useEffect)((function(){n&&function(){var e=bt(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,j({error:null,isSearchingForStudies:!0}),e.next=4,St(n,A,F,C,_,N);case 4:t=e.sent,S(t),j({error:null,isSearchingForStudies:!1}),e.next=13;break;case 9:e.prev=9,e.t0=e.catch(0),console.warn(e.t0),j({error:!0,isFetching:!1});case 13:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(){return e.apply(this,arguments)}}()()}),[A,F,C,_,N,n]);if(O.error)return o.a.createElement("div",null,"Error: ",JSON.stringify(O.error));if(g===[]&&!E)return o.a.createElement("div",null,"Loading...");var q=null,B=null;M.enableGoogleCloudAdapter&&(!function(e,t,n,r){if(e)return;var o=d.b(t,n);if(vt.paramString.isValidPath(o)){var a=r.location;(void 0===a?{}:a).pathname!==o&&r.replace(o)}}("DicomStorePicker"===E,M,n,t),B=o.a.createElement(st,{isOpen:"DicomStorePicker"===E,onClose:function(){return k(null)}}),q=o.a.createElement("div",{className:"form-inline btn-group pull-right",style:{padding:"20px"}},o.a.createElement("button",{className:"btn btn-primary",onClick:function(){return k("DicomStorePicker")}},c("Change DICOM Store"))));return o.a.createElement(o.a.Fragment,null,i?o.a.createElement(U,{isOpen:"DicomFilesUploader"===E,onClose:function(){return k(null)}}):null,B,o.a.createElement(ft.a.Consumer,null,(function(e){return o.a.createElement(lt.a.Consumer,null,(function(t){return o.a.createElement(p.a,{useLargeLogo:!0,user:a,userManager:t},e&&e.createLogoComponentFn&&e.createLogoComponentFn(o.a))}))})),o.a.createElement("div",{className:"study-list-header"},o.a.createElement("div",{className:"header"},o.a.createElement("h1",{style:{fontWeight:300,fontSize:"22px"}},c("StudyList"))),o.a.createElement("div",{className:"actions"},i&&q,i&&o.a.createElement(f.t,{onImport:function(){return k("DicomFilesUploader")}}),o.a.createElement("span",{className:"study-count"},g.length))),o.a.createElement("div",{className:"table-head-background"}),o.a.createElement("div",{className:"study-list-container"},o.a.createElement(f.C,{isLoading:O.isSearchingForStudies,hasError:!0===O.error,studies:g,onSelectItem:function(e){var r=d.c(M,n,{studyInstanceUIDs:e});t.push(r)},sort:s,onSort:function(e){var t=e,n="asc";e===s.fieldName&&("asc"===s.direction?n="desc":(t=null,n=null)),y({fieldName:t,direction:n})},filterValues:b,onFilterChange:function(e,t){h((function(n){return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dt(n,!0).forEach((function(t){yt(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dt(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},n,yt({},e,t))}))},studyListDateFilterNumDays:M.studyListDateFilterNumDays,displaySize:N}),o.a.createElement(f.H,{currentPage:_,nextPageFunc:function(){return x(_+1)},prevPageFunc:function(){return x(_-1)},onRowsPerPageChange:function(e){return I(e)},rowsPerPage:C,recordCount:g.length})))}function St(e,t,n,r,o,a){return wt.apply(this,arguments)}function wt(){return(wt=bt(regeneratorRuntime.mark((function e(t,n,r,o,a,i){var c,u,s,l,f,p,d,y,m,b,h;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return c=n.allFields,u=n.patientNameOrId,s=n.accessionOrModalityOrDescription,l=r.fieldName||"PatientName",f=r.direction||"desc",p={PatientID:n.PatientID,PatientName:n.PatientName,AccessionNumber:n.AccessionNumber,StudyDescription:n.StudyDescription,ModalitiesInStudy:n.modalities,studyDateFrom:n.studyDateFrom,studyDateTo:n.studyDateTo,limit:o,offset:a*o,fuzzymatching:!0===t.supportsFuzzyMatching},e.next=6,jt(t,p,i,{allFields:c,patientNameOrId:u,accessionOrModalityOrDescription:s});case 6:return d=e.sent,y=d.map((function(e){var t="string"==typeof e.PatientName?e.PatientName:void 0;return{AccessionNumber:e.AccessionNumber,modalities:e.modalities,PatientID:e.PatientID,PatientName:t,StudyDate:e.StudyDate,StudyDescription:e.StudyDescription,StudyInstanceUID:e.StudyInstanceUID}})),m=Ot(y,{allFields:"PatientName",patientNameOrId:"PatientName",accessionOrModalityOrDescription:"modalities"}[l]||l,f),b=m.length<o?m.length:o,h=m.slice(0,b),e.abrupt("return",h);case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ot(e,t,n){var r=e.map((function(e){return m()(e.StudyDate,"MMM DD, YYYY",!0).isValid()||(e.StudyDate=m()(e.StudyDate,"YYYYMMDD").format("MMM DD, YYYY")),e}));return r.sort((function(e,r){var o=e[t],a=r[t];return"StudyDate"===t&&(o=m()(o).toISOString(),a=m()(a).toISOString()),"desc"===n?o<a?-1:o>a?1:0:o>a?-1:o<a?1:0})),r}function jt(e,t,n,r){return Pt.apply(this,arguments)}function Pt(){return(Pt=bt(regeneratorRuntime.mark((function e(t,n,r,o){var a,i,c,u,l,f,p,d,y,m;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=o.allFields,i=o.patientNameOrId,c=o.accessionOrModalityOrDescription,u=[n],"small"===r?(l=Et(n,["PatientID","PatientName","AccessionNumber","StudyDescription","ModalitiesInStudy"],a)).length&&(u=l):"medium"===r&&(f=Et(n,["PatientID","PatientName"],i),p=Et(n,["AccessionNumber","StudyDescription","ModalitiesInStudy"],c),(f.length||p.length)&&(u=f.concat(p))),d=[],u.forEach((function(e){var n=s.a.studies.searchStudies(t,e);d.push(n)})),e.next=7,Promise.all(d);case 7:return y=e.sent,m=[],y.forEach((function(e){e&&e.forEach((function(e){m.some((function(t){return t.StudyInstanceUID===e.StudyInstanceUID}))||m.push(e)}))})),e.abrupt("return",m);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Et(e,t,n){var r=[];return""!==n&&n?(t.forEach((function(t){var o=Object.assign({PatientID:"",PatientName:"",AccessionNumber:"",StudyDescription:"",ModalitiesInStudy:""},e);o[t]=n,r.push(o)})),r):r}gt.propTypes={filters:i.a.object,PatientID:i.a.string,server:i.a.object,user:i.a.object,history:i.a.object,studyListFunctionsEnabled:i.a.bool},gt.defaultProps={studyListFunctionsEnabled:!0};var kt=Object(c.g)(gt),Dt=function(e){return!0===e.active},Ct=Object(u.b)((function(e){return{server:e.servers.servers.find(Dt),user:e.oidc.user}}),null)(kt),It=n(1049),Rt=s.a.utils.urlUtil;function _t(e){var t=e.match,n=e.location,a=t.params,i=a.project,c=a.location,u=a.dataset,s=a.dicomStore,l=(a.studyInstanceUIDs,a.seriesInstanceUIDs,Object(It.a)({project:i,location:c,dataset:u,dicomStore:s}),Object(r.useContext)(pt.c).appConfig),f=void 0===l?{}:l,p=Rt.queryString.getQueryFilters(n),d=!1;return f.studyListFunctionsEnabled&&(d=f.studyListFunctionsEnabled),o.a.createElement(Ct,{filters:p,studyListFunctionsEnabled:d})}_t.propTypes={location:i.a.shape({search:i.a.string}).isRequired};t.default=Object(c.g)(_t)}}]);
//# sourceMappingURL=StudyListRouting.bundle.ff927011e19fe3e41406.js.map