"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray"),r=require("@babel/runtime/helpers/asyncToGenerator"),t=require("@babel/runtime/regenerator"),n=require("../shared/constants.js"),a=require("../shared/fetchers/fetchByIdChunks.js"),u=require("./fetchMetricsAggregate.js"),s=require("./fetchMudAggregate.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=c(e),f=c(r),o=c(t),l=function(){var e=f.default(o.default.mark((function e(r,t,c,l){var p,d=arguments;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return p=d.length>4&&void 0!==d[4]?d[4]:"corva/metrics",e.abrupt("return",a.fetchByIdChunks({ids:t,chunkSize:n.MAX_WELL_NUMBER,signal:l,fetcher:function(){var e=f.default(o.default.mark((function e(t,n){var a,f,l,d,h,b;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=[],!((f=c.filter((function(e){return"mud_type"!==e}))).length>0)){e.next=14;break}return e.prev=3,l=u.buildMetricsQueryParams(r,t,f),e.next=7,u.fetchMetricsAggregate(l,n,p);case 7:d=e.sent,a.push.apply(a,i.default(d)),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(3),console.error(e.t0);case 14:if(!c.includes("mud_type")){e.next=26;break}return e.prev=15,h=s.buildMudQueryParams(r,t),e.next=19,s.fetchMudAggregate(h,n);case 19:b=e.sent,a.push.apply(a,i.default(b)),e.next=26;break;case 23:e.prev=23,e.t1=e.catch(15),console.error(e.t1);case 26:return e.abrupt("return",a);case 27:case"end":return e.stop()}}),e,null,[[3,11],[15,23]])})));return function(r,t){return e.apply(this,arguments)}}()}));case 2:case"end":return e.stop()}}),e)})));return function(r,t,n,a){return e.apply(this,arguments)}}();exports.fetchMetricsData=l;
//# sourceMappingURL=fetchMetricsData.js.map
