/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as t}from"tslib";import{when as e}from"../../../../core/reactiveUtils.js";import{subclass as i}from"../../../../core/accessorSupport/decorators.js";import{DrawHeaderActions as o}from"../components/DrawHeaderActions.js";import{TooltipEditableField as n}from"../components/TooltipEditableField.js";import{TooltipField as r}from"../components/TooltipField.js";import{ValueByValue as s}from"../components/ValueByValue.js";import{TooltipContent as l}from"./TooltipContent.js";import{tsx as d,tsxFragment as f}from"../../../../widgets/support/widget.js";let m=class extends l{initialize(){this.addHandles(e(()=>this.info&&this._messagesUnits&&this._messagesTooltip&&this.fieldContext,()=>this.info.renderContext=this.fieldContext),{once:!0})}destroy(){this.info&&(this.info.renderContext=null)}_renderContent(){const{fieldContext:t,info:e,mode:i}=this,o=e.fieldsGroupedForDisplay;return o.length?d(f,null,o.map(e=>{if("left"in e&&(e.left.readOnly&&e.right.readOnly||"feedback"===i)){const i="string"==typeof e.left.title?e.left.title:e.left.title(t);return d(r,{title:i,value:d(s,{left:e.left.format(e.left.actual,t),right:e.right.format(e.right.actual,t)})})}return"left"in e?d(f,null,d(n,{context:t,field:e.left,key:e.left.id,mode:i}),d(n,{context:t,field:e.right,key:e.right.id,mode:i})):d(n,{context:t,field:e,key:e.id,mode:i})})):null}_renderActions(){const{xyMode:t,sketchOptions:e}=this.info,i=this.info.allFields.some(t=>"direction"===t.name);return d(o,{sketchOptions:e,visibleElements:{direction:"direction-distance"===t&&i}})}};m=t([i("esri.views.interactive.tooltip.content.TooltipContentDynamic")],m);export{m as TooltipContentDynamic};
