/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../../core/BidiText","../../../../core/maybe","../../../../core/screenUtils","../../../../geometry/Polygon","../../../../geometry/support/aaBoundingRect","../../../../geometry/support/spatialReferenceUtils","../../engine/webgl/alignmentUtils","../../engine/webgl/definitions","../../engine/webgl/mesh/templates/shapingUtils"],(function(e,t,n,i,r,o,l,a,s,c){"use strict";const g=512,u=50;function p(e,t){const n=l.getInfo(t);if(!n)return null;const[i,r]=n.valid;return e[2]>r?[o.create([e[0],e[1],r,e[3]]),o.create([i,e[1],i+e[2]-r,e[3]])]:e[0]<i?[o.create([i,e[1],e[2],e[3]]),o.create([r-(i-e[0]),e[1],r,e[3]])]:null}function m(e){return"text"===e||"esriTS"===e}function f(e){return"simple-marker"===e||"picture-marker"===e||"esriSMS"===e||"esriPMS"===e}function h(e){switch(n.unwrap(e.geometry).type){case"point":case"multipoint":return 0;case"polyline":return 1;case"polygon":case"extent":return 2}return 0}function x(e,n,r){var o,l,g;if(!r||0===r.glyphMosaicItems.length)return e;const u=t.bidiText(n.text)[1],p=r.glyphMosaicItems,m=c.shapeGlyphs(p,u,{scale:i.pt2px(n.font.size)/s.GLYPH_SIZE,angle:null!=(o=n.angle)?o:0,xOffset:null!=(l=n.xoffset)?l:0,yOffset:null!=(g=n.yoffset)?g:0,hAlign:a.getXAnchorDirection(n.horizontalAlignment||"center"),vAlign:a.getYAnchorDirection(n.verticalAlignment||"baseline"),maxLineWidth:Math.max(32,Math.min(n.lineWidth||512,512)),lineHeight:s.MAGIC_LABEL_LINE_HEIGHT*Math.max(.25,Math.min(n.lineHeight||1,4)),decoration:n.font.decoration||"none",isCIM:!1}).bounds;return e[0]=i.pt2px(m.x-m.halfWidth),e[1]=i.pt2px(m.y-m.halfHeight),e[2]=i.pt2px(m.width),e[3]=i.pt2px(m.height),e}function y(e){if(!e)return null;const{xmin:t,ymin:n,xmax:i,ymax:o,spatialReference:l}=e;return new r({rings:[[[t,n],[t,o],[i,o],[i,n],[t,n]]],spatialReference:l})}e.PIXEL_BUFFER=u,e.TILE_SIZE=g,e.getTextSymbolSize=x,e.graphicGeometryToNumber=h,e.intersectingInternationalDateline=p,e.isMarkerSymbol=f,e.isTextSymbol=m,e.polygonFromExtent=y,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
