Custom Gis Application with Arcgis Javascript API with modern layouting
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

50 lines
23 KiB

// All material copyright Esri, All Rights Reserved, unless otherwise specified.
// See https://js.arcgis.com/4.30/esri/copyright.txt for details.
//>>built
define("exports ../../core/BidiText ../../core/has ../../core/lang ../../core/Logger ../../core/RandomLCG ../../core/screenUtils ../../geometry/support/aaBoundingRect ../../geometry/support/boundsUtils ../Font ./CIMPlacements ./CIMSymbolDrawHelper ./defaultCIMValues ./enums ./utils ../support/defaults ../../views/2d/engine/vectorTiles/GeometryUtils ../../views/2d/engine/webgl/definitions ../../views/2d/engine/webgl/mesh/templates/shapingUtils ../../views/2d/layers/graphics/graphicsUtils".split(" "),
function(x,aa,ba,J,ca,da,P,A,ea,fa,Q,E,R,m,n,ha,F,K,ia,S){function G(a,b,c){switch(b.type){case "CIMSymbolReference":return G(a,b.symbol,c);case "CIMPointSymbol":null==c&&(c={x:0,y:0});a.drawSymbol(b,c);break;case "CIMLineSymbol":null==c&&(c={paths:[[[0,0],[10,0]]]});a.drawSymbol(b,c);break;case "CIMPolygonSymbol":null==c&&(c={rings:[[[0,0],[0,10],[10,10],[10,0],[0,0]]]});a.drawSymbol(b,c);break;case "CIMTextSymbol":a.drawSymbol(b,{x:0,y:0});break;case "CIMVectorMarker":c=new Q.Placement,a.drawMarker(b,
c)}return a.envelope()}function ja(a){if(!a)return 0;switch(a.type){case "CIMMarkerPlacementAlongLineSameSize":return Math.abs(a.offset);case "CIMMarkerPlacementAlongLineRandomSize":return Math.abs(a.offset);case "CIMMarkerPlacementAtExtremities":return Math.abs(a.offset);case "CIMMarkerPlacementAtMeasuredUnits":return Math.abs(a.offset);case "CIMMarkerPlacementAtRatioPositions":return Math.abs(a.offset);case "CIMMarkerPlacementInsidePolygon":return 0;case "CIMMarkerPlacementOnLine":return Math.abs(a.offset);
case "CIMMarkerPlacementOnVertices":return Math.abs(a.offset);case "CIMMarkerPlacementPolygonCenter":return 0;default:return 0}}function ka(a){if(!a)return 0;switch(a.type){case "CIMGeometricEffectArrow":return Math.abs(.5*a.width);case "CIMGeometricEffectBuffer":return Math.abs(a.size);case "CIMGeometricEffectControlMeasureLine":return 500;case "CIMGeometricEffectExtension":return Math.abs(a.length);case "CIMGeometricEffectJog":return Math.abs(.5*a.length);case "CIMGeometricEffectMove":return Math.max(Math.abs(n.getNumericValue(a.offsetX)),
Math.abs(n.getNumericValue(a.offsetY)));case "CIMGeometricEffectOffset":return Math.abs(a.offset);case "CIMGeometricEffectOffsetTangent":return Math.abs(a.offset);case "CIMGeometricEffectRadial":return Math.abs(a.length);case "CIMGeometricEffectRegularPolygon":return Math.abs(a.radius);case "CIMGeometricEffectRotate":return 0;case "CIMGeometricEffectScale":return 0;case "CIMGeometricEffectTaperedPolygon":return.5*Math.max(Math.abs(a.fromWidth),Math.abs(a.toWidth));case "CIMGeometricEffectWave":return Math.abs(a.amplitude);
case "CIMGeometricEffectDonut":return Math.abs(a.width);default:return 0}}function L(a){if(!a)return 0;let b=0;for(const c of a)b+=ka(c);return b}function T(a,b){if(a)switch(a.type){case "CIMPointSymbol":case "CIMLineSymbol":case "CIMPolygonSymbol":if(a=a.symbolLayers)for(const c of a)switch(b(c),c.type){case "CIMVectorMarker":if(a=c.markerGraphics)for(const d of a)d&&(a=d.symbol)&&T(a,b)}}}function la(a,b,c){a.effects&&null==b.geometryEngine&&(b.geometryEnginePromise?c.push(b.geometryEnginePromise):
n.isGeometryEngineRequired(a.effects)&&(b.geometryEnginePromise=n.importGeometryEngine(),c.push(b.geometryEnginePromise),b.geometryEnginePromise.then(d=>b.geometryEngine=d)))}function U(a){if(!a)return null;let b=null;const {cap:c,color:d,join:h,miterLimit:f,style:g,width:e}=a;"solid"!==g&&"none"!==g&&"esriSLSSolid"!==g&&"esriSLSNull"!==g&&(b=[{type:"CIMGeometricEffectDashes",dashTemplate:H(g,c),lineDashEnding:"NoConstraint",scaleDash:!0,offsetAlongLine:null}]);return{type:"CIMSolidStroke",color:"esriSLSNull"!==
g&&"none"!==g?r(d):[0,0,0,0],capStyle:M(c),joinStyle:V(h),miterLimit:f,width:e,effects:b}}const W=Math.PI,ma=W/2,X=Math.PI/180,u=96/72,I=()=>ca.getLogger("esri.symbols.cim.CIMSymbolHelper");class na{static getSymbolInflateSize(a,b,c,d,h){a||=[0,0,0,0];return b?this._getInflateSize(a,b,c,d,h):a}static safeSize(a){const b=Math.max(Math.abs(a[0]),Math.abs(a[2]));a=Math.max(Math.abs(a[1]),Math.abs(a[3]));return Math.sqrt(b*b+a*a)}static _vectorMarkerBounds(a,b,c,d){let h=!0;const f=A.create();if(b?.markerGraphics)for(const g of b.markerGraphics)b=
[0,0,0,0],g.geometry&&(ea.getBoundsXY(f,g.geometry),b[0]=0,b[1]=0,b[2]=0,b[3]=0,this.getSymbolInflateSize(b,g.symbol,c,0,d),f[0]+=b[0],f[1]+=b[1],f[2]+=b[2],f[3]+=b[3],h?(a[0]=f[0],a[1]=f[1],a[2]=f[2],a[3]=f[3],h=!1):(a[0]=Math.min(a[0],f[0]),a[1]=Math.min(a[1],f[1]),a[2]=Math.max(a[2],f[2]),a[3]=Math.max(a[3],f[3])));return a}static _getInflateSize(a,b,c,d,h){return void 0!==b.symbolLayers?(a=this._getLayersInflateSize(a,b.symbolLayers,c,d,h),b=L(b.effects),0<b&&(a[0]-=b,a[1]-=b,a[2]+=b,a[3]+=b),
a):this._getTextInflatedSize(a,b,h)}static _getLayersInflateSize(a,b,c,d,h){let f=!0;if(!b)return a;for(const q of b)if(q){b=[0,0,0,0];switch(q.type){case "CIMSolidStroke":case "CIMPictureStroke":case "CIMGradientStroke":var g=q,e=g.width;null!=e&&(e=g.capStyle===m.LineCapStyle.Square||g.joinStyle===m.LineJoinStyle.Miter?e/1.4142135623730951:e/2,b[0]=-e,b[1]=-e,b[2]=e,b[3]=e);break;case "CIMCharacterMarker":case "CIMVectorMarker":case "CIMPictureMarker":g=q;if("CIMVectorMarker"===q.type){if(e=q,b=
this._vectorMarkerBounds(b,e,c,h),e.frame){var k=(e.frame.xmin+e.frame.xmax)/2,l=(e.frame.ymin+e.frame.ymax)/2;b[0]-=k;b[1]-=l;b[2]-=k;b[3]-=l;null!=e.size&&(e=e.size/(e.frame.ymax-e.frame.ymin),b[0]*=e,b[1]*=e,b[2]*=e,b[3]*=e)}}else"CIMPictureMarker"===q.type?(e=q,l=c.getResource(e.url),k=1,null!=l&&l.height&&(k=l.width/l.height),null!=g.size&&(b=g.size/2,e=g.size*k*e.scaleX/2,b=[-e,-b,e,b])):null!=g.size&&(b=g.size/2,b=[-b,-b,b,b]);g.anchorPoint&&("Absolute"===g.anchorPointUnits?(e=g.anchorPoint.x,
k=g.anchorPoint.y):(e=g.anchorPoint.x*(b[2]-b[0]),k=g.anchorPoint.y*(b[3]-b[1])),e=1.25*Math.sqrt(e*e+k*k),b[0]-=e,b[1]-=e,b[2]+=e,b[3]+=e);e=n.getNumericValue(g.rotation);g.rotateClockwise&&(e=-e);d&&(e-=d);e&&(k=X*e,e=Math.cos(k),k=Math.sin(k),l=A.create([F.cInfinity,F.cInfinity,-F.cInfinity,-F.cInfinity]),A.expandPointInPlace(l,[b[0]*e-b[1]*k,b[0]*k+b[1]*e]),A.expandPointInPlace(l,[b[0]*e-b[3]*k,b[0]*k+b[3]*e]),A.expandPointInPlace(l,[b[2]*e-b[1]*k,b[2]*k+b[1]*e]),A.expandPointInPlace(l,[b[2]*
e-b[3]*k,b[2]*k+b[3]*e]),b=l);e=n.getNumericValue(g.offsetX);k=n.getNumericValue(g.offsetY);if(d){var p=X*d;l=Math.cos(p);p=Math.sin(p);const t=e*p+k*l;e=e*l-k*p;k=t}b[0]+=e;b[1]+=k;b[2]+=e;b[3]+=k;g=ja(g.markerPlacement);0<g&&(b[0]-=g,b[1]-=g,b[2]+=g,b[3]+=g)}g=L(q.effects);0<g&&(b[0]-=g,b[1]-=g,b[2]+=g,b[3]+=g);f?(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],f=!1):(a[0]=Math.min(a[0],b[0]),a[1]=Math.min(a[1],b[1]),a[2]=Math.max(a[2],b[2]),a[3]=Math.max(a[3],b[3]))}return a}static _getTextInflatedSize(a,
b,c){var d=S.roundPtToWholePixel(b.height??R.defaultCIMValues.CIMTextSymbol.height);a[0]=-d/2;a[1]=-d/2;a[2]=d/2;a[3]=d/2;if(!c)return a;c=c.get(b);if(!c||!c.glyphMosaicItems.glyphs.length)return a;const {lineGapType:h,lineGap:f}=b,g=h?E.lineGapType2LineHeight(h,f??0,d):0,e="CIMBackgroundCallout"===b.callout?.type;b=ia.shapeGlyphs(c.glyphMosaicItems,{scale:d/K.glyphSize,angle:n.getNumericValue(b.angle),xOffset:n.getNumericValue(b.offsetX),yOffset:n.getNumericValue(b.offsetY),horizontalAlignment:b.horizontalAlignment,
verticalAlignment:b.verticalAlignment,maxLineWidth:S.getLineWidth(b.lineWidth),lineHeight:K.magicLabelLineHeight*Math.max(.25,Math.min(g||1,4)),decoration:b.font.decoration||"none",useCIMAngleBehavior:!0,hasBackground:e}).boundsT;d=Math.sqrt(b.width*b.width+b.height*b.height);a[0]-=b.x+d;a[1]-=b.y-d;a[2]+=b.x+d;a[3]+=-b.y+d;return a}}class v{static getEnvelope(a,b,c){if(!a)return null;c=new E.EnvDrawHelper(c);if(Array.isArray(a)){let d;for(const h of a)d?d.union(G(c,h,b)):d=G(c,h,b);return d}return G(c,
a,b)}static getTextureAnchor(a,b){a=this.getEnvelope(a,null,b);if(!a)return[0,0,0];b=a.height*u+2;return[-((a.x+.5*a.width)*u)/(a.width*u+2),-((a.y+.5*a.height)*u)/b,b]}static rasterize(a,b,c,d,h=!0){var f=c||this.getEnvelope(b,null,d);if(!f)return[null,0,0,0,0];const g=(f.x+.5*f.width)*u,e=(f.y+.5*f.height)*u;a.width=f.width*u;a.height=f.height*u;c||(a.width+=2,a.height+=2);c=a.getContext("2d",{willReadFrequently:!0});f=E.Transformation.createScale(u,-u);f.translate(.5*a.width-g,.5*a.height+e);d=
new E.CanvasDrawHelper(c,d,f);switch(b.type){case "CIMPointSymbol":d.drawSymbol(b,{type:"point",x:0,y:0});break;case "CIMVectorMarker":f=new Q.Placement,d.drawMarker(b,f)}b=c.getImageData(0,0,a.width,a.height);b=new Uint8Array(b.data);if(h)for(d=0;d<b.length;d+=4)h=b[d+3]/255,b[d]*=h,b[d+1]*=h,b[d+2]*=h;return[b,a.width,a.height,-g/a.width,-e/a.height]}static fromTextSymbol(a){const {text:b}=a;return{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,anchorPointUnits:"Relative",
dominantSizeAxis3D:"Y",size:10,billboardMode3D:"FaceNearPlane",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:v.createCIMTextSymbolfromTextSymbol(a),textString:b}],scaleSymbolsProportionally:!0,respectFrame:!0}],scaleX:1,angleAlignment:"Display"}}static fromPictureFillSymbol(a){const {height:b,outline:c,width:d,xoffset:h,xscale:f,yoffset:g,yscale:e}=a,k=[],l={type:"CIMPolygonSymbol",symbolLayers:k};if(c){var p=U(c);p&&k.push(p)}p=a.url;"esriPFS"===
a.type&&a.imageData&&(p=a.imageData);a="angle"in a?a.angle??0:0;k.push({type:"CIMPictureFill",invertBackfaceTexture:!1,scaleX:1,textureFilter:m.TextureFilter.Picture,tintColor:null,url:p,height:(b??0)*(e||1),width:(d??0)*(f||1),offsetX:n.getNumericValue(h),offsetY:n.getNumericValue(g),rotation:n.getNumericValue(-a),colorSubstitutions:null});return l}static fromSimpleFillSymbol(a){const {color:b,style:c,outline:d}=a;a=[];const h={type:"CIMPolygonSymbol",symbolLayers:a};if(d){var f=U(d);f&&a.push(f)}if(c&&
"solid"!==c&&"none"!==c&&"esriSFSSolid"!==c&&"esriSFSNull"!==c){f={type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",color:r(b),capStyle:m.LineCapStyle.Butt,joinStyle:m.LineJoinStyle.Miter,width:.75}]};let g=0;const e=P.px2pt("vertical"===c||"horizontal"===c||"cross"===c||"esriSFSCross"===c||"esriSFSVertical"===c||"esriSFSHorizontal"===c?8:10);switch(c){case "vertical":case "esriSFSVertical":g=90;break;case "forward-diagonal":case "esriSFSForwardDiagonal":g=-45;break;case "backward-diagonal":case "esriSFSBackwardDiagonal":g=
45;break;case "cross":case "esriSFSCross":g=0;break;case "diagonal-cross":case "esriSFSDiagonalCross":g=-45}a.push({type:"CIMHatchFill",lineSymbol:f,offsetX:0,offsetY:0,rotation:g,separation:e});"cross"===c||"esriSFSCross"===c?a.push({type:"CIMHatchFill",lineSymbol:J.clone(f),offsetX:0,offsetY:0,rotation:90,separation:e}):("diagonal-cross"===c||"esriSFSDiagonalCross"===c)&&a.push({type:"CIMHatchFill",lineSymbol:J.clone(f),offsetX:0,offsetY:0,rotation:45,separation:e})}else!c||"solid"!==c&&"esriSFSSolid"!==
c||a.push({type:"CIMSolidFill",enable:!0,color:r(b)});return h}static fromSimpleLineSymbol(a){const {cap:b,color:c,join:d,marker:h,miterLimit:f,style:g,width:e}=a;a=null;"solid"!==g&&"none"!==g&&"esriSLSSolid"!==g&&"esriSLSNull"!==g&&(a=[{type:"CIMGeometricEffectDashes",dashTemplate:H(g,b),lineDashEnding:"NoConstraint",scaleDash:!0,offsetAlongLine:null}]);const k=[];if(h){let l;switch(h.placement){case "begin-end":l=m.ExtremityPlacement.Both;break;case "begin":l=m.ExtremityPlacement.JustBegin;break;
case "end":l=m.ExtremityPlacement.JustEnd;break;default:l=m.ExtremityPlacement.None}const p=v.fromSimpleMarker(h,e,c).symbolLayers[0];p.markerPlacement={type:"CIMMarkerPlacementAtExtremities",placePerPart:!1,angleToLine:!0,offset:0,extremityPlacement:l,offsetAlongLine:0};k.push(p)}k.push({type:"CIMSolidStroke",color:"none"!==g&&"esriSLSNull"!==g?r(c):[0,0,0,0],capStyle:M(b),joinStyle:V(d),miterLimit:f,width:e,effects:a});return{type:"CIMLineSymbol",symbolLayers:k}}static fromPictureMarker(a){const {angle:b,
height:c,width:d,xoffset:h,yoffset:f}=a;let g=a.url;"esriPMS"===a.type&&a.imageData&&(g=a.imageData);return{type:"CIMPointSymbol",symbolLayers:[{type:"CIMPictureMarker",invertBackfaceTexture:!1,scaleX:1,textureFilter:m.TextureFilter.Picture,tintColor:null,url:g,size:c,width:d,offsetX:n.getNumericValue(h),offsetY:n.getNumericValue(f),rotation:n.getNumericValue(-b)}]}}static createCIMTextSymbolfromTextSymbol(a){const {angle:b,color:c,font:d,haloColor:h,haloSize:f,horizontalAlignment:g,kerning:e,lineWidth:k,
text:l,verticalAlignment:p,xoffset:q,yoffset:t,backgroundColor:y,borderLineColor:C,borderLineSize:B}=a;let Y,N,Z;if(d){var O=d.family;var z=d.style;var w=d.weight;Y=d.size;N=d.decoration}a=!1;l&&(a=aa.bidiText(l)[1]);if(y||B)Z={type:"CIMBackgroundCallout",margin:null,backgroundSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",color:r(y)},{type:"CIMSolidStroke",color:r(C),width:B}]},accentBarSymbol:null,gap:null,leaderLineSymbol:null,lineStyle:null};var oa=m.BlockProgression.BTT,pa=
m.FontEffects.Normal,qa=m.FontEncoding.Unicode;O=O||"Arial";b:{if(w)switch(w.toLowerCase()){case "bold":case "bolder":w="bold";break b}w=""}b:{if(z)switch(z.toLowerCase()){case "italic":case "oblique":z="italic";break b}z=""}w=w&&z?`${w}-${z}`:`${w}${z}`;return{type:"CIMTextSymbol",angle:b,blockProgression:oa,depth3D:1,extrapolateBaselines:!0,fontEffects:pa,fontEncoding:qa,fontFamilyName:O,fontStyleName:w,fontType:m.FontType.Unspecified,haloSize:f,height:Y,hinting:m.GlyphHinting.Default,horizontalAlignment:ra(g??
"center"),kerning:e,letterWidth:100,ligatures:!0,lineGapType:"Multiple",lineWidth:k,offsetX:n.getNumericValue(q),offsetY:n.getNumericValue(t),strikethrough:"line-through"===N,underline:"underline"===N,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:r(c)}]},haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:r(h)}]},shadowColor:[0,0,0,255],shadowOffsetX:1,shadowOffsetY:1,textCase:"Normal",textDirection:a?m.TextReadingDirection.RTL:
m.TextReadingDirection.LTR,verticalAlignment:sa(p??"baseline"),verticalGlyphOrientation:m.VerticalGlyphOrientation.Right,wordSpacing:100,billboardMode3D:m.BillBoardMode.FaceNearPlane,callout:Z}}static createPictureMarkerRasterizationParam(a){const {angle:b,height:c,width:d,xoffset:h,yoffset:f}=a;return(a=a.url??a.source?.url??a.source?.imageData)?{type:"sprite-rasterization-param",overrides:[],resource:{type:"CIMPictureMarker",invertBackfaceTexture:!1,scaleX:1,textureFilter:m.TextureFilter.Picture,
tintColor:null,url:a,size:c,width:d,offsetX:n.getNumericValue(h),offsetY:n.getNumericValue(f),rotation:n.getNumericValue(-b)}}:null}static createPictureFillRasterizationParam(a){const {width:b,height:c,xoffset:d,yoffset:h,url:f}=a;return f?{type:"sprite-rasterization-param",overrides:[],resource:{type:"CIMPictureFill",scaleX:1,textureFilter:m.TextureFilter.Picture,tintColor:null,url:f,width:b,height:c,offsetX:n.getNumericValue(d),offsetY:n.getNumericValue(h),rotation:0}}:null}static fromSimpleMarker(a,
b,c){var {style:d}=a;c=a.color??c;if("path"===d||"esriSMSPath"===d){b=[];if("outline"in a&&a.outline){var h=a.outline;b.push({type:"CIMSolidStroke",enable:!0,width:h.width,color:r(h.color),path:a.path})}b.push({type:"CIMSolidFill",enable:!0,color:r(c),path:a.path});const [l,p]=D("square");return{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,rotation:-n.getNumericValue(a.angle),size:n.getNumericValue(a.size||6),offsetX:n.getNumericValue(a.xoffset),offsetY:n.getNumericValue(a.yoffset),
scaleSymbolsProportionally:!1,frame:l,markerGraphics:[{type:"CIMMarkerGraphic",geometry:p,symbol:{type:"CIMPolygonSymbol",symbolLayers:b}}]}]}}const f=[];h=a.size;let g;if("outline"in a&&a.outline&&"none"!==a.outline.style&&"esriSLSNull"!==a.outline.style){const l=a.outline,p="solid"!==l.style&&"esriSLSSolid"!==l.style;[d,g]=p?D(d,a.size):D(d);const q=l.width??ha.defaultPolylineSymbol2D.width;if(p){var e=q/a.size,k=(d.xmax-d.xmin)*e/2;e=(d.ymax-d.ymin)*e/2;d.xmin-=k;d.xmax+=k;d.ymin-=e;d.ymax+=e;
h&&(h+=q)}k="cross"!==a.style&&"x"!==a.style||"dot"===a?.outline.style||"short-dot"===a?.outline.style?m.LineDashEnding.HalfGap:m.LineDashEnding.FullPattern;k=p?[{type:"CIMGeometricEffectAddControlPoints"},{type:"CIMGeometricEffectDashes",dashTemplate:H(l.style,null).map(t=>l.width&&0<l.width?t*l.width:t),lineDashEnding:k,controlPointEnding:m.LineDashEnding.FullPattern}]:void 0;f.push({type:"CIMSolidStroke",capStyle:p?m.LineCapStyle.Round:m.LineCapStyle.Butt,enable:!0,width:q,color:r(l.color),effects:k})}else!b||
"line-marker"!==a.type||"cross"!==a.style&&"x"!==a.style?[d,g]=D(d):([d,g]=D(d),f.push({type:"CIMSolidStroke",enable:!0,width:b,color:r(c)}));f.push({type:"CIMSolidFill",enable:!0,color:r(c)});c={type:"CIMPolygonSymbol",symbolLayers:f};return{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,rotation:n.getNumericValue(-a.angle),size:n.getNumericValue(h||6*b),offsetX:n.getNumericValue(a.xoffset),offsetY:n.getNumericValue(a.yoffset),scaleSymbolsProportionally:!1,frame:d,markerGraphics:[{type:"CIMMarkerGraphic",
geometry:g,symbol:c}]}]}}static fromCIMHatchFill(a,b){const c=b*(a.separation??R.defaultCIMValues.CIMHatchFill.separation),d=c/2;a=J.clone(a.lineSymbol);a.symbolLayers?.forEach(f=>{switch(f.type){case "CIMSolidStroke":null!=f.width&&(f.width*=b);f.effects?.forEach(g=>{"CIMGeometricEffectDashes"===g.type&&(g.dashTemplate=g.dashTemplate?.map(e=>e*b))});break;case "CIMVectorMarker":null!=f.size&&(f.size*=b),f=f.markerPlacement,null!=f&&"placementTemplate"in f&&(f.placementTemplate=f.placementTemplate.map(g=>
g*b))}});for(var h=this._getLineSymbolPeriod(a)||4;4>h;)h*=2;h/=2;return{type:"CIMVectorMarker",frame:{xmin:-h,xmax:h,ymin:-d,ymax:d},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{paths:[[[-h,0],[h,0]]]},symbol:a}],size:c}}static fetchResources(a,b,c,d=null){if(!a||!b)return c;T(a,h=>{la(h,b,c);"url"in h&&h.url&&c.push(b.fetchResource(h.url,{signal:d}))});return c}static fetchFonts(a,b,c){if(a&&b)if("symbolLayers"in a&&a.symbolLayers)for(const f of a.symbolLayers){if("CIMVectorMarker"===f.type&&
f.markerGraphics)for(const g of f.markerGraphics)g?.symbol&&v.fetchFonts(g.symbol,b,c)}else if("CIMTextSymbol"===a.type){const {fontFamilyName:f,fontStyleName:g}=a;if(f&&"calcitewebcoreicons"!==f.toLowerCase()){var {style:d,weight:h}=n.fromCIMFontStyle(g);a=n.fromCIMFontDecoration(a);a=new fa({family:f,style:d,weight:h,decoration:a});c.push(b.loadFont(a).catch(()=>{I().error(`Unsupported font ${f} in CIM symbol`)}))}}}static _getLineSymbolPeriod(a){if(a){const b=this._getEffectsRepeat(a.effects);
if(b)return b;if(a.symbolLayers)for(const c of a.symbolLayers)if(c){if(a=this._getEffectsRepeat(c.effects))return a;switch(c.type){case "CIMCharacterMarker":case "CIMPictureMarker":case "CIMVectorMarker":case "CIMObjectMarker3D":case "CIMglTFMarker3D":if(a=this._getPlacementRepeat(c.markerPlacement))return a}}}return 0}static _getEffectsRepeat(a){if(a)for(var b of a)if(b)switch(b.type){case "CIMGeometricEffectDashes":if((a=b.dashTemplate)&&a.length){b=0;for(const c of a)b+=c;a.length&1&&(b*=2);return b}break;
case "CIMGeometricEffectWave":return b.period;default:I().error(`unsupported geometric effect type ${b.type}`)}return 0}static _getPlacementRepeat(a){if(a)switch(a.type){case "CIMMarkerPlacementAlongLineSameSize":case "CIMMarkerPlacementAlongLineRandomSize":case "CIMMarkerPlacementAlongLineVariableSize":if((a=a.placementTemplate)&&a.length){let b=0;for(const c of a)b+=+c;a.length&1&&(b*=2);return b}}return 0}static fromCIMInsidePolygon(a){var b=a.markerPlacement;const c={...a,markerPlacement:null,
anchorPoint:null};a=Math.abs(b.stepX);const d=Math.abs(b.stepY);var h=(b.randomness??100)/100;let f,g;if("Random"===b.gridType){var e=P.px2pt(K.randomInsidePolygonTextureSize);const k=Math.max(Math.floor(e/a),1),l=Math.max(Math.floor(e/d),1);e=k*a/2;f=l*d/2;g=2*f;b=new da(b.seed);const p=h*a/1.5,q=h*d/1.5;h=[];for(let t=0;t<k;t++)for(let y=0;y<l;y++){const C=t*a-e+p*(.5-b.getFloat()),B=y*d-f+q*(.5-b.getFloat());h.push({x:C,y:B});0===t&&h.push({x:C+2*e,y:B});0===y&&h.push({x:C,y:B+2*f})}}else!0===
b.shiftOddRows?(e=a/2,f=d,g=2*d,h=[{x:-e,y:0},{x:e,y:0},{x:0,y:f},{x:0,y:-f}]):(e=a/2,f=d/2,g=d,h=[{x:-a,y:0},{x:0,y:-d},{x:-a,y:-d},{x:0,y:0},{x:a,y:0},{x:0,y:d},{x:a,y:d},{x:-a,y:d},{x:a,y:-d}]);a=h.map(k=>({type:"CIMMarkerGraphic",geometry:k,symbol:{type:"CIMPointSymbol",symbolLayers:[c]}}));return{type:"CIMVectorMarker",frame:{xmin:-e,xmax:e,ymin:-f,ymax:f},markerGraphics:a,size:g}}}const M=a=>{if(!a)return m.LineCapStyle.Butt;switch(a){case "butt":return m.LineCapStyle.Butt;case "square":return m.LineCapStyle.Square;
case "round":return m.LineCapStyle.Round}},V=a=>{if(!a)return m.LineJoinStyle.Miter;switch(a){case "miter":return m.LineJoinStyle.Miter;case "round":return m.LineJoinStyle.Round;case "bevel":return m.LineJoinStyle.Bevel}},ra=a=>{if(null==a)return"Center";switch(a){case "left":return"Left";case "right":return"Right";case "center":return"Center"}},sa=a=>{if(null==a)return"Center";switch(a){case "baseline":return"Baseline";case "top":return"Top";case "middle":return"Center";case "bottom":return"Bottom"}},
r=a=>{if(!a)return[0,0,0,0];const {r:b,g:c,b:d,a:h}=a;return[b,c,d,255*h]},H=(a,b)=>{const c=ba("safari")?.001:0;b="butt"===b;switch(a){case "dash":case "esriSLSDash":return b?[4,3]:[3,4];case "dash-dot":case "esriSLSDashDot":return b?[4,3,1,3]:[3,4,c,4];case "dot":case "esriSLSDot":return b?[1,3]:[c,4];case "long-dash":case "esriSLSLongDash":return b?[8,3]:[7,4];case "long-dash-dot":case "esriSLSLongDashDot":return b?[8,3,1,3]:[7,4,c,4];case "long-dash-dot-dot":case "esriSLSDashDotDot":return b?
[8,3,1,3,1,3]:[7,4,c,4,c,4];case "short-dash":case "esriSLSShortDash":return b?[4,1]:[3,2];case "short-dash-dot":case "esriSLSShortDashDot":return b?[4,1,1,1]:[3,2,c,2];case "short-dash-dot-dot":case "esriSLSShortDashDotDot":return b?[4,1,1,1,1,1]:[3,2,c,2,c,2];case "short-dot":case "esriSLSShortDot":return b?[1,1]:[c,2];case "solid":case "esriSLSSolid":case "none":return I().error("Unexpected: style does not require rasterization"),[0,0];default:return I().error(`Tried to rasterize SLS, but found an unexpected style: ${a}!`),
[0,0]}},D=(a,b=100)=>{var c=b/2,d;if("circle"===a||"esriSMSCircle"===a){var h=Math.acos(1-.25/c);b=Math.ceil(W/h/4);0===b&&(b=1);h=ma/b;b*=4;a=[];a.push([c,0]);for(d=1;d<b;d++)a.push([c*Math.cos(d*h),-c*Math.sin(d*h)]);a.push([c,0]);h={rings:[a]};d={xmin:-c,ymin:-c,xmax:c,ymax:c}}else"cross"===a||"esriSMSCross"===a?(h={paths:[[[0,c],[0,-c]],[[c,0],[-c,0]]]},d={xmin:-c,ymin:-c,xmax:c,ymax:c}):"diamond"===a||"esriSMSDiamond"===a?(h={rings:[[[-c,0],[0,c],[c,0],[0,-c],[-c,0]]]},d={xmin:-c,ymin:-c,xmax:c,
ymax:c}):"square"===a||"esriSMSSquare"===a?(h={rings:[[[-c,-c],[-c,c],[c,c],[c,-c],[-c,-c]]]},d={xmin:-c,ymin:-c,xmax:c,ymax:c}):"x"===a||"esriSMSX"===a?(h={paths:[[[c,c],[-c,-c]],[[c,-c],[-c,c]]]},d={xmin:-c,ymin:-c,xmax:c,ymax:c}):"triangle"===a||"esriSMSTriangle"===a?(c=.5773502691896257*b,a=-c,d=2/3*b,b=d-b,h={rings:[[[a,b],[0,d],[c,b],[a,b]]]},d={xmin:a,ymin:b,xmax:c,ymax:d}):"arrow"===a&&(h={rings:[[[-50,50],[50,0],[-50,-50],[-33,-20],[-33,20],[-50,50]]]},d={xmin:-c,ymin:-c,xmax:c,ymax:c});
return[d,h]};x.CIMSymbolHelper=v;x.CIMSymbolInflatedSizeHelper=na;x.capTypeToEnum=M;x.getEffectsInflateSize=L;x.slsDashToTemplateArray=H;x.symbolToCIM=function(a){let b;switch(a.type){case "cim":return a.data;case "web-style":return a;case "simple-marker":a=v.fromSimpleMarker(a);if(!a)throw Error("InternalError: Cannot convert symbol to CIM");b=a;break;case "picture-marker":b=v.fromPictureMarker(a);break;case "simple-line":b=v.fromSimpleLineSymbol(a);break;case "simple-fill":b=v.fromSimpleFillSymbol(a);
break;case "picture-fill":b=v.fromPictureFillSymbol(a);break;case "text":b=v.fromTextSymbol(a)}return{type:"CIMSymbolReference",symbol:b}};Object.defineProperty(x,Symbol.toStringTag,{value:"Module"})});