/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/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{notAvailableString as o}from"../constants.js";import{DrawHeaderActions as n}from"../components/DrawHeaderActions.js";import{TooltipEditableField as r}from"../components/TooltipEditableField.js";import{TooltipField as s}from"../components/TooltipField.js";import{ValueByValue as l}from"../components/ValueByValue.js";import{TooltipContent as d}from"./TooltipContent.js";import{tsx as f,tsxFragment as m}from"../../../../widgets/support/widget.js";let c=class extends d{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,n=e.fieldsGroupedForDisplay;return n.length?f(m,null,n.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 f(s,{title:i,value:f(l,{left:e.left.getFormattedValue(t)??o,right:e.right.getFormattedValue(t)??o})})}return"left"in e?f(m,null,f(r,{context:t,field:e.left,key:e.left.id,mode:i}),f(r,{context:t,field:e.right,key:e.right.id,mode:i})):f(r,{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 f(n,{sketchOptions:e,visibleElements:{direction:"direction-distance"===t&&i}})}};c=t([i("esri.views.interactive.tooltip.content.TooltipContentDynamic")],c);export{c as TooltipContentDynamic};
