import r from"@babel/runtime/helpers/defineProperty";import e from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/regenerator";import{useQuery as n}from"@tanstack/react-query";import o from"moment";import{useMemo as a}from"react";import{getQueryKey as i,PADS_URL as c,baseQuery as s,removeViewerAndPDAssets as u,deserializePads as p}from"../constants.js";import{corvaAPI as m}from"../../../clients/index.js";import{mapPad as f}from"./mapPad.js";function l(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),t.push.apply(t,n)}return t}function b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}var d=function(r){var l,d=r.companyId,y=a((function(){return i("padsActive",d)}),[d]),O=n({queryKey:y,queryFn:(l=e(t.mark((function r(e){var n,o;return t.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=e.signal,r.next=3,m.get(c,b(b({},s),{},{company:Number(d),current:!0}),{signal:n});case 3:return o=r.sent,r.abrupt("return",o);case 5:case"end":return r.stop()}}),r)}))),function(r){return l.apply(this,arguments)}),initialData:{data:[],included:[]},select:function(r){var e=u(r.data);return p(e,r.included).map((function(r){return f(r)}))},refetchInterval:o.duration(10,"minutes").asMilliseconds(),enabled:!!d});return{activePads:O.data,isActivePadsLoading:O.isFetching}};export{d as useActivePads};
//# sourceMappingURL=useActivePads.js.map
