/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{formatField as r}from"../../../../../layers/support/labelFormatUtils.js";import{sqlToTemplateString as e}from"../../../../../layers/support/labelUtils.js";import{isBadArcadeResult as t}from"../../../arcade/callExpressionWithCursor.js";import{AComputedField as s}from"./AComputedField.js";class a extends s{static async create(t,s){const l=e(t);return new a(e=>l.replaceAll(/{[^}]*}/g,t=>{const s=t.slice(1,-1),a=e.metadata.fieldsIndex.get(s);if(null==a)return t;const l=e.readAttribute(s);return null==l?"":r(l,a)}))}constructor(r){super(),this._evaluator=r}resize(r){}read(r,e){return this._evaluator(r)}readWithDefault(r,e,s){const a=this._evaluator(r);return t(a)?s:a}hasArcadeDependency(r){return!1}}export{a as ComputedLegacyLabelExpression};
