/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{convertFromFeatures as e,convertFromFeatureSet as t}from"../../../../../layers/graphics/featureConversionUtils.js";import r from"../../../../../layers/support/FieldsIndex.js";import{FeatureSetReaderJSON as a}from"./FeatureSetReaderJSON.js";import{loadAnnotationFeatures as i}from"../../support/annodime/annotationUtils.js";class o extends a{static fromFeatures(t,r){const{geometryType:a}=r,i=e([],t,a,!1,!1,r.featureIdInfo);for(let e=0;e<i.length;e++)i[e].displayId=t[e].displayId;return o.fromOptimizedFeatures(i,r,null)}static fromFeatureSet(e,r){const a=t(e,r.featureIdInfo);return o.fromOptimizedFeatureSet(a,r)}static fromOptimizedFeatureSet(e,t){const a=o.fromOptimizedFeatures(e.features,t,e.transform);return a._exceededTransferLimit=e.exceededTransferLimit,a._fieldsIndex=new r(e.fields),a}static fromOptimizedFeatures(e,t,r){const a=new o(e,t);a._fieldsIndex=t.fieldsIndex;const{layerType:s}=t;if(!s)throw new Error("Layer type is required in metadata to read annotation features.");if(!r)throw new Error("Quantization transform is required to read annotation features.");return i(a._features,r,t),a}}export{o as FeatureSetReaderAnnotationJSON};
