import e from"@babel/runtime/helpers/typeof";import t from"@babel/runtime/helpers/defineProperty";import{shape as r,oneOfType as i,number as a,string as o,func as p,bool as n}from"prop-types";import{Map as s,List as m}from"immutable";import c from"moment";import{makeStyles as d,Typography as u}from"@material-ui/core";import{normalizeAssetForApp as l}from"./helpers.js";import b from"./styles.css.js";import{isNativeDetected as f}from"../../../../utils/mobileDetect.js";import g from"../../../EmbeddedApp/DevCenterEmbeddedApp.js";import y from"../../../EmbeddedApp/EmbeddedApp.js";import A from"../../../Attachment/index.js";import{formatMentionText as h}from"../../../UserMention/utils/index.js";import{jsx as w,jsxs as j,Fragment as v}from"react/jsx-runtime";function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function R(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?O(Object(i),!0).forEach((function(r){t(e,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):O(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var _=d((function(e){return{attachmentLable:{fontSize:"12px",color:e.palette.primary.text6}}})),q=function(e){var t=e.feedItem,r=t.id,i=t.well,a=t.rig,o=t.app,p=t.package,n=t.company_id,d=t.context.app_annotation,O=d.body,q=d.app_category,D=d.app_key,E=d.created_at,P=d.settings,S=void 0===P?{}:P,x=d.attachment,C=d.data_timestamp,F=t.mentioned_users,I=e.appContext,N=e.appRegistry,L=e.subscribeAppForAsset,U=e.unsubscribeAppFromAsset,k=e.currentUser,z=e.appData,B=e.isSubDataLoading,K=e.getSubErrors,M=e.isSubDataEmpty,T=_(),G=!!o,H=G&&"dev_center"===o.platform;if(!G||H&&!p)return w(u,{variant:"body2",children:"App not found"});var J=l(i||a,n),Q=c(C||E).unix();return[J,q,D,E].every(Boolean)&&J.id?j("div",{className:b.appAnnotationFeedItem,children:[w(u,{variant:"body2","data-testid":"".concat("FeedActivityPo_appAnnotation","_message"),children:h(O,F,f)}),e.showAppPreview&&j(v,{children:[w("br",{}),p&&p.url?w(g,{appContainerClassName:b.appAnnotationFeedItemApp,appId:r,assetId:J.id,asset:J,app:{app:R(R({},o),{},{settings:S}),package:p},coordinates:{},timestamp:Q,time:C,currentUser:k}):w(y,{appContainerClassName:b.appAnnotationFeedItemApp,appId:r,assetId:J.id,asset:s(J),appComponentKey:D,appComponentCategory:q,requiresSubscription:!0,appContext:s(I),assetDashboards:m(),timestamp:Q,time:C,onSettingChange:function(){},settings:S,internalSelectors:{isSubDataLoading:B,getSubErrors:K,isSubDataEmpty:M},appRegistry:N,appData:z,subscribeAppForAsset:L,unsubscribeAppFromAsset:U})]}),x&&x.signed_url&&j("div",{className:b.appAnnotationFeedItemAttachment,children:[w(u,{variant:"subtitle1",className:T.attachmentLable,children:"Attachments"}),w(A,{small:!0,attachmentUrl:x.signed_url,fileName:x.file_name,displayName:x.file_name})]})]}):w(u,{variant:"body2",children:"No Data"})};q.propTypes={feedItem:r({id:i([a,o]).isRequired,well:function(t,r,i){return t.well||t.rig?t.well&&"object"!==e(t.well)?new Error("Prop '".concat(r,"' should be an object")):null:new Error("One of props 'well' or 'rig' was not specified in '".concat(i,"'."))},rig:function(t,r,i){return t.well||t.rig?t.rig&&"object"!==e(t.rig)?new Error("Prop '".concat(r,"' should be an object")):null:new Error("One of props 'well' or 'rig' was not specified in '".concat(i,"'."))},context:r({app_annotation:r({body:o,app_category:o.isRequired,app_name:o.isRequired,created_at:o.isRequired,settings:r()}).isRequired}).isRequired}).isRequired,appContext:r().isRequired,currentUser:r().isRequired,appData:r().isRequired,appRegistry:r().isRequired,subscribeAppForAsset:p.isRequired,unsubscribeAppFromAsset:p.isRequired,isSubDataLoading:p.isRequired,getSubErrors:p.isRequired,isSubDataEmpty:p.isRequired,showAppPreview:n},q.defaultProps={showAppPreview:!0};export{q as default};
//# sourceMappingURL=index.js.map
