/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{fixCIMColors as e}from"./unsupported.js";let r=0;class t{}class s extends t{constructor(e,r){super(),this.kind="feature";const t=`__virtual_fi_${e}`;this.realField={name:t,alias:t,type:r,editable:!1,nullable:!0}}addToFeature(e,r){const t=this.getValue(r);e.attributes[this.realField.name]=t}addToSymbol(e){const t=this.findTargetNode(e);let{primitiveName:s}=t;s||(r++,s=`primitive_${r}`,t.primitiveName=s);const i={type:"CIMPrimitiveOverride",primitiveName:s,propertyName:this.cimPropertyName,valueExpressionInfo:{type:"CIMExpressionInfo",expression:`return $feature.${this.realField.name};`}};e.primitiveOverrides=e.primitiveOverrides||[],e.primitiveOverrides.push(i)}}class i extends s{constructor(){super("text","esriFieldTypeString"),this.cimPropertyName="TextString"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0]}getValue(e){return e.graphic?e.graphic.text:e.text}}class o extends s{constructor(){super("color","esriFieldTypeString"),this.cimPropertyName="Color"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol.symbol.symbolLayers.find(e=>"CIMSolidFill"===e.type)}getValue(r){const t=r.color||"#000000";if(t.startsWith("#"))return t;if(t.startsWith("rgb"))return t;const s=JSON.parse(t),i=e(s);return`rgba(${i[0]}, ${i[1]}, ${i[2]}, ${i[3]/255})`}}class n extends s{constructor(){super("rotation","esriFieldTypeDouble"),this.cimPropertyName="Rotation"}findTargetNode(e){return e.symbol.symbolLayers[0]}getValue(e){return null!=e.textAngle?-e.textAngle:void 0}}class a extends s{constructor(){super("offsetX","esriFieldTypeDouble"),this.cimPropertyName="OffsetX"}findTargetNode(e){return e.symbol.symbolLayers[0]}getValue(e){return e.xOffset}}class l extends s{constructor(){super("offsetY","esriFieldTypeDouble"),this.cimPropertyName="OffsetY"}findTargetNode(e){return e.symbol.symbolLayers[0]}getValue(e){return e.yOffset}}class m extends t{constructor(){super(...arguments),this.kind="symbol"}addToSymbol(e,r){const t=this.getValue(r);if(null==t)return;this.findTargetNode(e)[this._fixCase(this.cimPropertyName)]=t}_fixCase(e){return this.cimPropertyName[0].toLocaleLowerCase()+e.slice(1)}}class u extends m{constructor(){super(...arguments),this.cimPropertyName="VerticalAlignment"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return null==e.verticalAlignment?null:["Top","Center","Baseline","Bottom"][e.verticalAlignment]}}class c extends m{constructor(){super(...arguments),this.cimPropertyName="HorizontalAlignment"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return null==e.horizontalAlignment?null:["Left","Right","Center","Justify"][e.horizontalAlignment]}}class y extends m{constructor(){super(...arguments),this.cimPropertyName="FontFamilyName"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return e.fontFamilyName}}class d extends m{constructor(){super(...arguments),this.cimPropertyName="FontStyleName"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return e.fontStyleName}}class p extends m{constructor(){super(...arguments),this.cimPropertyName="Height"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return e.size}}class g extends m{constructor(){super(...arguments),this.cimPropertyName="Underline"}findTargetNode(e){return e.symbol.symbolLayers[0].markerGraphics[0].symbol}getValue(e){return e.underline}}const b=new i,f=new o,h=new n,N=new a,x=new l,T=new p,v=new g,L=[b,f,h,N,x],P=[new c,new u,new y,new d,T,v];export{L as featureFields,P as symbolFields};
