/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{__decorate as t}from"tslib";import e from"../Color.js";import{clone as o}from"../core/lang.js";import{toPt as i}from"../core/screenUtils.js";import{property as r,cast as s,subclass as n}from"../core/accessorSupport/decorators.js";import h from"./Font.js";import l from"./Symbol.js";import{horizontalAlignmentProperty as p,verticalAlignmentProperty as a,lineHeightProperty as d}from"./support/textUtils.js";import{enumeration as f}from"../core/accessorSupport/decorators/enumeration.js";import{writer as g}from"../core/accessorSupport/decorators/writer.js";var y;let u=y=class extends l{constructor(...t){super(...t),this.backgroundColor=null,this.borderLineColor=null,this.borderLineSize=null,this.font=new h,this.horizontalAlignment="center",this.kerning=!0,this.haloColor=null,this.rightToLeft=null,this.rotated=!1,this.text="",this.type="text",this.verticalAlignment="baseline",this.angle=0,this.width=null,this.lineHeight=1}normalizeCtorArgs(t,e,o){if(t&&"string"!=typeof t)return t;const i={};return t&&(i.text=t),e&&(i.font=e),o&&(i.color=o),i}get haloSize(){return this._get("haloSize")??null}set haloSize(t){this._set("haloSize",t)}get xoffset(){return this._get("xoffset")??0}set xoffset(t){this._set("xoffset",t)}get yoffset(){return this._get("yoffset")??0}set yoffset(t){this._set("yoffset",t)}get lineWidth(){return this._get("lineWidth")??192}set lineWidth(t){this._set("lineWidth",t)}writeLineWidth(t,e,o,i){i&&"string"!=typeof i?i.origin:e[o]=t}castLineWidth(t){return i(t)}writeLineHeight(t,e,o,i){i&&"string"!=typeof i?i.origin:e[o]=t}clone(){return new y({angle:this.angle,backgroundColor:o(this.backgroundColor),borderLineColor:o(this.borderLineColor),borderLineSize:this.borderLineSize,color:o(this.color),font:this.font&&this.font.clone(),haloColor:o(this.haloColor),haloSize:this.haloSize,horizontalAlignment:this.horizontalAlignment,kerning:this.kerning,lineHeight:this.lineHeight,lineWidth:this.lineWidth,rightToLeft:this.rightToLeft,rotated:this.rotated,text:this.text,verticalAlignment:this.verticalAlignment,width:this.width,xoffset:this.xoffset,yoffset:this.yoffset})}hash(){return`${this.backgroundColor?.hash()}.${this.borderLineColor}.${this.borderLineSize}.${this.color?.hash()}.${this.font&&this.font.hash()}.${this.haloColor?.hash()}.${this.haloSize}.${this.horizontalAlignment}.${this.kerning}.${this.rightToLeft}.${this.rotated}.${this.text}.${this.verticalAlignment}.${this.width}.${this.xoffset}.${this.yoffset}.${this.lineHeight}.${this.lineWidth}.${this.angle}`}};t([r({type:e,json:{write:!0}})],u.prototype,"backgroundColor",void 0),t([r({type:e,json:{write:!0}})],u.prototype,"borderLineColor",void 0),t([r({type:Number,json:{write:!0},cast:i})],u.prototype,"borderLineSize",void 0),t([r({type:h,json:{write:!0}})],u.prototype,"font",void 0),t([r({...p,json:{write:!0}})],u.prototype,"horizontalAlignment",void 0),t([r({type:Boolean,json:{write:!0}})],u.prototype,"kerning",void 0),t([r({type:e,json:{write:!0}})],u.prototype,"haloColor",void 0),t([r({type:Number,cast:i,json:{write:!0}})],u.prototype,"haloSize",null),t([r({type:Boolean,json:{write:!0}})],u.prototype,"rightToLeft",void 0),t([r({type:Boolean,json:{write:!0}})],u.prototype,"rotated",void 0),t([r({type:String,json:{write:!0}})],u.prototype,"text",void 0),t([f({esriTS:"text"},{readOnly:!0})],u.prototype,"type",void 0),t([r({...a,json:{write:!0}})],u.prototype,"verticalAlignment",void 0),t([r({type:Number,cast:i,json:{write:!0}})],u.prototype,"xoffset",null),t([r({type:Number,cast:i,json:{write:!0}})],u.prototype,"yoffset",null),t([r({type:Number,json:{read:t=>t&&-1*t,write:(t,e)=>e.angle=t&&-1*t}})],u.prototype,"angle",void 0),t([r({type:Number,json:{write:!0}})],u.prototype,"width",void 0),t([r({type:Number})],u.prototype,"lineWidth",null),t([g("lineWidth")],u.prototype,"writeLineWidth",null),t([s("lineWidth")],u.prototype,"castLineWidth",null),t([r(d)],u.prototype,"lineHeight",void 0),t([g("lineHeight")],u.prototype,"writeLineHeight",null),u=y=t([n("esri.symbols.TextSymbol")],u);export{u as default};
