import e from"@babel/runtime/helpers/defineProperty";import{useEffect as t}from"react";import{shape as r,number as s,func as i,string as a}from"prop-types";import{Map as p,List as o}from"immutable";import n from"./components/TargetChanges.js";import u from"./components/VerticalSectionAzimuth.js";import{SUBSCRIPTIONS as c}from"./constants.js";import m from"./styles.css.js";import{DEFAULT_SUBSCRIPTION_META as d}from"../../../../constants/subscriptions.js";import"../../../EmbeddedApp/DevCenterEmbeddedApp.js";import l from"../../../EmbeddedApp/EmbeddedApp.js";import{jsxs as b,Fragment as g,jsx as f}from"react/jsx-runtime";function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,s)}return r}function A(t){for(var r=1;r<arguments.length;r++){var s=null!=arguments[r]?arguments[r]:{};r%2?y(Object(s),!0).forEach((function(r){e(t,r,s[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):y(Object(s)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(s,e))}))}return t}var h=function(e){var r=e.feedItem,s=r.id,i=r.well,a=r.context.well_plan,y=a.data,h=y.vertical_section_azimuth,D=y.target_changes,j=a.timestamp,R=e.subscribeAppForAsset,S=e.unsubscribeAppFromAsset,q=e.appContext,O=e.isSubDataLoading,C=e.getSubErrors,w=e.isSubDataEmpty,v=e.appRegistry,E=e.appData,P=c.map((function(e){return A(A({},e),{},{meta:A(A({},d),{},{subscribeOnlyForInitialData:!0})})}));return t((function(){i&&j&&R(s,P,i.id,{query:"{timestamp#lte#".concat(j,"}")})}),[]),i?b(g,{children:[b("div",{className:m.wellPlanFeedItemInfo,children:[f(u,{vsa:h}),D&&f(n,{targetChanges:D})]}),f(l,{asset:p(i),appContainerClassName:m.wellPlanFeedItemApp,appId:s,assetId:i.id,appComponentKey:"directional-wellPlan",appComponentCategory:"directional",subscriptions:P,requiresSubscription:!1,appContext:p(q),assetDashboards:o(),graphType:1,internalSelectors:{isSubDataLoading:O,getSubErrors:C,isSubDataEmpty:w},appRegistry:v,appData:E,subscribeAppForAsset:R,unsubscribeAppFromAsset:S}),f(l,{asset:p(i),appContainerClassName:m.wellPlanFeedItemApp,appId:s,assetId:i.id,appComponentKey:"directional-wellPlan",appComponentCategory:"directional",subscriptions:P,requiresSubscription:!1,appContext:p(q),assetDashboards:o(),graphType:2,internalSelectors:{isSubDataLoading:O,getSubErrors:C,isSubDataEmpty:w},appRegistry:v,appData:E,subscribeAppForAsset:R,unsubscribeAppFromAsset:S})]}):"No Well in data"};h.propTypes={feedItem:r({id:s,context:r({well_plan:r({timestamp:s.isRequired,data:r({vertical_section_azimuth:s,target_changes:r({measured_depth:s,tvd_change:s,vertical_section:s})})}).isRequired}).isRequired,well:r({id:s.isRequired}).isRequired}).isRequired,subscribeAppForAsset:i.isRequired,unsubscribeAppFromAsset:i.isRequired,appContext:r({view:a.isRequired}).isRequired,appData:r().isRequired,appRegistry:r().isRequired,isSubDataLoading:i.isRequired,getSubErrors:i.isRequired,isSubDataEmpty:i.isRequired};export{h as default};
//# sourceMappingURL=index.js.map
