@arcgis/core 4.32.0-next.20250106 → 4.32.0-next.20250107

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/AttributeBinsGraphic.js +5 -0
  2. package/README.md +1 -1
  3. package/applications/MapViewer/templateUtils.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/000771f8eefcd6af0fda.js +1 -0
  6. package/assets/esri/core/workers/chunks/{9372d08ba8bf3342c48f.js → 011ccfd3acee83e7dc68.js} +1 -1
  7. package/assets/esri/core/workers/chunks/03af4a51043677ffcd0f.js +1 -0
  8. package/assets/esri/core/workers/chunks/{d07da8b63d83af179a2c.js → 05943caacfd28c383810.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{9f495ad57cdbfa90c5b8.js → 095aeb19e2207c8361ca.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{67c7bdc0c91a8f803ea8.js → 11cb25dfab7c8467897a.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{42aa697b4718b75b8cb2.js → 1abeba63bf623a746d5c.js} +2 -2
  12. package/assets/esri/core/workers/chunks/{42aa697b4718b75b8cb2.js.LICENSE.txt → 1abeba63bf623a746d5c.js.LICENSE.txt} +1 -1
  13. package/assets/esri/core/workers/chunks/{a57cead317eb2fc9afd8.js → 206194cf069ad4bcc3ad.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{0673d811c496143fc3d4.js → 2779cf112299b612a73a.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{bd37c9cc720587665fd3.js → 304b88ade7551130ad3a.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{aedff36d3fec86abb9fb.js → 30a84ddf0384bb52fdbe.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{367af4aa7e170c8553e3.js → 33a13544b9e5f4f20bce.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{dce55e7f76adecc055c3.js → 35d9457109d0631a1ca8.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{3a90163b76b0bc7f21d2.js → 3767defbd9c4b2e86886.js} +1 -1
  20. package/assets/esri/core/workers/chunks/3a3e9701e5d7b05f41b7.js +1 -0
  21. package/assets/esri/core/workers/chunks/{9a498f2c007f4d78d4dd.js → 4234539a9721104acafb.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{76fa5c7c87831ad25cde.js → 435c037ccba71f1e22d3.js} +1 -1
  23. package/assets/esri/core/workers/chunks/4387c47ae1b36d770f1d.js +1 -0
  24. package/assets/esri/core/workers/chunks/{88c68881cbdf4e911832.js → 4423aac6e44c3dbf184e.js} +1 -1
  25. package/assets/esri/core/workers/chunks/44ec3c77339b9765aaa4.js +1 -0
  26. package/assets/esri/core/workers/chunks/4b77c8d994498899631a.js +1 -0
  27. package/assets/esri/core/workers/chunks/62f8949a2d9076f3c1ea.js +2 -0
  28. package/assets/esri/core/workers/chunks/{c8cd6ba5600d8ff8db0b.js.LICENSE.txt → 62f8949a2d9076f3c1ea.js.LICENSE.txt} +1 -1
  29. package/assets/esri/core/workers/chunks/{664aa401887b59abd7b7.js → 6400f39a965900f66ce7.js} +1 -1
  30. package/assets/esri/core/workers/chunks/{ddce265c46e4dfeb6c6d.js → 66d40a486aa3caa76106.js} +1 -1
  31. package/assets/esri/core/workers/chunks/6b3ee691646fbc39445c.js +1 -0
  32. package/assets/esri/core/workers/chunks/{533a7fd64b17bb294545.js → 6c58f792e2ae3736f662.js} +1 -1
  33. package/assets/esri/core/workers/chunks/{370b230fd2d7703d0698.js → 6efb36bc2205203ff44d.js} +2 -2
  34. package/assets/esri/core/workers/chunks/{370b230fd2d7703d0698.js.LICENSE.txt → 6efb36bc2205203ff44d.js.LICENSE.txt} +1 -1
  35. package/assets/esri/core/workers/chunks/{a90611cdc86190799560.js → 7a43fda8984549a084b8.js} +1 -1
  36. package/assets/esri/core/workers/chunks/7b753da3b8a6d75abf20.js +1 -0
  37. package/assets/esri/core/workers/chunks/{9b020c47ca9ff5de9bb8.js → 7db356976198c4df76c1.js} +1 -1
  38. package/assets/esri/core/workers/chunks/{4c56698cf1c669371865.js → 81816410cb1453938593.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{4ffaa2c5ab47a599ee9f.js → 82266ca8002554198208.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{f19d3c855f6e93544918.js → 8be0151a24c9af76a976.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{d9e396adf3354ee68339.js → 8f2b2d2dc9935b0d2039.js} +1 -1
  42. package/assets/esri/core/workers/chunks/907a91266e25cc4b9d42.js +1 -0
  43. package/assets/esri/core/workers/chunks/{a77aa86896bbb0e088df.js → 9857491cafa0278d9ae6.js} +1 -1
  44. package/assets/esri/core/workers/chunks/{993db7646a8fc60179eb.js → 98da074899c82f0ded0b.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{3bb94da29dac3367ecc6.js → a1edd3f68e691ea39594.js} +1 -1
  46. package/assets/esri/core/workers/chunks/b07710e01494a6cda097.js +1 -0
  47. package/assets/esri/core/workers/chunks/{6a4305eb1e52b80ecb5c.js → b8ea84adff5619040494.js} +3 -3
  48. package/assets/esri/core/workers/chunks/{005727711cca0614c2ab.js → c05e0bd145a1c27d6857.js} +2 -2
  49. package/assets/esri/core/workers/chunks/{005727711cca0614c2ab.js.LICENSE.txt → c05e0bd145a1c27d6857.js.LICENSE.txt} +1 -1
  50. package/assets/esri/core/workers/chunks/c4374b6bc5c8dc6435c7.js +1 -0
  51. package/assets/esri/core/workers/chunks/c49707b577f3805f0142.js +1 -0
  52. package/assets/esri/core/workers/chunks/c5a928dcff7dc8a8cc9f.js +2 -0
  53. package/assets/esri/core/workers/chunks/{f4e3db71d1adae717535.js.LICENSE.txt → c5a928dcff7dc8a8cc9f.js.LICENSE.txt} +1 -1
  54. package/assets/esri/core/workers/chunks/cac79b64a7dade8bf486.js +2 -0
  55. package/assets/esri/core/workers/chunks/{bf0a0ca7fdac98f06a89.js.LICENSE.txt → cac79b64a7dade8bf486.js.LICENSE.txt} +1 -1
  56. package/assets/esri/core/workers/chunks/{2cccaf50134c65944e0a.js → d0876eed5249b029f9f0.js} +1 -1
  57. package/assets/esri/core/workers/chunks/{178f606c8896ae5f39de.js → d1dbbab4a4c6072c182f.js} +1 -1
  58. package/assets/esri/core/workers/chunks/{8e42fb623f56942958d8.js → d74b5dc60f02892d03e7.js} +1 -1
  59. package/assets/esri/core/workers/chunks/{9ad7d095e614e7e8d7f5.js → dca0eb66116e4b5403fc.js} +1 -1
  60. package/assets/esri/core/workers/chunks/e27b8674a3492db51f2e.js +1 -0
  61. package/assets/esri/core/workers/chunks/{756c2f7c8659deab6c96.js → e2d987c39a6ef318511c.js} +2 -2
  62. package/assets/esri/core/workers/chunks/{756c2f7c8659deab6c96.js.LICENSE.txt → e2d987c39a6ef318511c.js.LICENSE.txt} +1 -1
  63. package/assets/esri/core/workers/chunks/{943428cf643e87ccfaad.js → e7e26b71f9eb28421936.js} +1 -1
  64. package/assets/esri/core/workers/chunks/{f0adabf6d71a27f3183b.js → e80b0646a7e0e466ea65.js} +1 -1
  65. package/assets/esri/core/workers/chunks/e9c21907fabcedbd32ae.js +1 -0
  66. package/assets/esri/core/workers/chunks/{f9af0473878d960a02f2.js → f6d6bc43ac1c13892d44.js} +1 -1
  67. package/assets/esri/core/workers/chunks/{3ed7c8138231de3a3b96.js → f8c960df1dabab120c70.js} +1 -1
  68. package/assets/esri/core/workers/chunks/{fdd8a5eb07466541f1f9.js → fd95b19f02d8dfef2baf.js} +1 -1
  69. package/assets/esri/widgets/support/GridControls/t9n/GridControls_ja.json +1 -1
  70. package/chunks/bufferOperator.js +1 -1
  71. package/chunks/geodesicBufferOperator.js +1 -1
  72. package/chunks/terrainUtilsPlanar.js +1 -1
  73. package/chunks/terrainUtilsSpherical.js +1 -1
  74. package/geometry/operators/graphicBufferOperator.js +1 -1
  75. package/geometry/support/meshVertexSpaceUtils.js +1 -1
  76. package/interfaces.d.ts +11 -5
  77. package/layers/graphics/data/QueryEngineResult.js +1 -1
  78. package/layers/graphics/data/queryUtils.js +1 -1
  79. package/layers/graphics/data/queryValidationUtils.js +1 -1
  80. package/layers/graphics/sources/WFSSource.js +1 -1
  81. package/layers/support/capabilities.js +1 -1
  82. package/layers/support/featureLayerUtils.js +1 -1
  83. package/layers/support/serviceCapabilitiesUtils.js +1 -1
  84. package/package.json +2 -2
  85. package/renderers/RasterStretchRenderer.js +1 -1
  86. package/rest/query/executeAttributeBinsQuery.js +1 -1
  87. package/rest/support/AttributeBinsFeatureSet.js +5 -0
  88. package/rest/support/AttributeBinsQuery.js +1 -1
  89. package/rest/support/BinParametersAttributes.js +1 -1
  90. package/rest/support/BinParametersBase.js +1 -1
  91. package/rest/support/DateBinParameters.js +1 -1
  92. package/rest/support/FeatureSet.js +1 -1
  93. package/rest/support/NormalizationBinParametersMixin.js +1 -1
  94. package/rest/support/Query.js +1 -1
  95. package/rest/support/TopFeaturesQuery.js +1 -1
  96. package/smartMapping/renderers/dotDensity.js +1 -1
  97. package/smartMapping/renderers/pieChart.js +1 -1
  98. package/smartMapping/statistics/summaryStatisticsForAttributes.js +1 -1
  99. package/support/revision.js +1 -1
  100. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  101. package/symbols/cim/cimAnalyzer.js +1 -1
  102. package/views/2d/engine/Bitmap.js +1 -1
  103. package/views/2d/engine/BitmapContainer.js +1 -1
  104. package/views/2d/engine/BitmapTileContainer.js +1 -1
  105. package/views/2d/engine/webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js +1 -1
  106. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  107. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  108. package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
  109. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  110. package/views/3d/state/NearFarHeuristic.js +1 -1
  111. package/views/3d/terrain/TerrainRenderer.js +1 -1
  112. package/views/3d/terrain/TerrainSurface.js +1 -1
  113. package/views/3d/terrain/terrainUtilsPlanar.js +1 -1
  114. package/views/3d/terrain/terrainUtilsSpherical.js +1 -1
  115. package/views/3d/webgl-engine/collections/Component/SourceGeometry.js +1 -1
  116. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  117. package/views/3d/webgl-engine/shaders/OutputColorHighlightOID.glsl.js +4 -4
  118. package/views/draw/support/HighlightHelper.js +1 -1
  119. package/views/layers/DimensionLayerView.js +1 -1
  120. package/views/webgl/Texture.js +1 -1
  121. package/views/webgl/textureUtils.js +5 -0
  122. package/widgets/Editor/UpdateRecordWorkflow.js +1 -1
  123. package/widgets/Editor/UpdateWorkflow.js +1 -1
  124. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  125. package/widgets/FeatureTable/Grid/Grid.js +1 -1
  126. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  127. package/widgets/support/ColorPicker.js +1 -1
  128. package/assets/esri/core/workers/chunks/0a3bf1b74cce1b6b7ed8.js +0 -1
  129. package/assets/esri/core/workers/chunks/0d2411a941c42acb8cc2.js +0 -1
  130. package/assets/esri/core/workers/chunks/13720b1d97fb7d80e972.js +0 -1
  131. package/assets/esri/core/workers/chunks/14b87f3dd9942e6b19d0.js +0 -1
  132. package/assets/esri/core/workers/chunks/16530347bd78dc6c2fcd.js +0 -1
  133. package/assets/esri/core/workers/chunks/1a713cc601c6fcd97d2f.js +0 -1
  134. package/assets/esri/core/workers/chunks/3029354194f1a3030c5c.js +0 -1
  135. package/assets/esri/core/workers/chunks/318a39b56851e707edad.js +0 -1
  136. package/assets/esri/core/workers/chunks/53cd990b2c988518de6d.js +0 -1
  137. package/assets/esri/core/workers/chunks/5a0eb9dfe668cf290462.js +0 -1
  138. package/assets/esri/core/workers/chunks/9f0ebeae8a3ba360284b.js +0 -1
  139. package/assets/esri/core/workers/chunks/a3cef3837f4df9ab022e.js +0 -1
  140. package/assets/esri/core/workers/chunks/bf0a0ca7fdac98f06a89.js +0 -2
  141. package/assets/esri/core/workers/chunks/c8cd6ba5600d8ff8db0b.js +0 -2
  142. package/assets/esri/core/workers/chunks/ea250d66089967976c05.js +0 -1
  143. package/assets/esri/core/workers/chunks/ecf317c6c790b3cc83bf.js +0 -1
  144. package/assets/esri/core/workers/chunks/f4e3db71d1adae717535.js +0 -2
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as r}from"../../core/fontUtils.js";import{clone as t}from"../../core/lang.js";import i from"../../core/Logger.js";import{pt2px as o,px2pt as a}from"../../core/screenUtils.js";import{numericHash as s}from"../../core/string.js";import{checkForAnimations as l,getAnimationParams as n,handleAbsoluteAnchor as p,handleMarker as c,handleRelativeAnchor as m,getFrameTranslation as y,translate as d,getStaticParam as h,shouldUseAnimatedPath as f}from"./animationUtils.js";import{CIMSymbolHelper as u}from"./CIMSymbolHelper.js";import{defaultCIMValues as v}from"./defaultCIMValues.js";import{Alignment as O,SymbolUnits as g}from"./enums.js";import{OverrideHelper as _}from"./OverrideHelper.js";import{getExtent as S,getSDFMetrics as M,getSDFDimensions as k}from"./SDFHelper.js";import{colorToArray as C,normalizeAlpha as b,getSize as P,isCIMMarkerStrokePlacement as z,getTintColor as x,getNumericValue as E,normalizePrimitiveOverrideProps as L,getDefaultCIMValue as I,getEnum as V,getStrokeWidth as R,getFillColor as N,getStrokeColor as A,fromCIMFontDecoration as w,fromCIMFontStyle as G,fromCIMHorizontalAlignment as F,fromCIMVerticalAlignment as T,isValidCIMValue as X,uncapitalize as Y}from"./utils.js";import{CIMEffectHelper as j}from"./effects/CIMEffectHelper.js";import{randomInsidePolygonTextureSize as W}from"../../views/2d/engine/webgl/definitions.js";const D=()=>i.getLogger("esri.symbols.cim.cimAnalyzer");function U(e){const r=e.markerPlacement;return r&&r.angleToLine?O.MAP:O.SCREEN}class H{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],e&&(this._resourceManager=e)}analyzeSymbolReference(r,t,i){if(this._cimLayers=i??[],!r)return this._cimLayers;if(this._reset(),r.primitiveOverrides){this._primitiveOverrides=r.primitiveOverrides;for(const r of this._primitiveOverrides){const t=r.valueExpressionInfo;if(t)this._setPoMap(r.primitiveName,r.propertyName,t);else if(null!=r.value){let t=r.value;r.propertyName.includes("Color")&&(e(t)&&(t=C(t)),t=b(t)),this._setPoMap(r.primitiveName,r.propertyName,t)}}}return this._analyzeSymbol(r.symbol,t),this._cimLayers}_reset(){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[]}_analyzeSymbol(e,r){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,r)}}_analyzeMultiLayerSymbol(e,r){const t=e?.symbolLayers;if(!t)return;const i=e.effects;let o=O.SCREEN;const a=P(e)??0;"CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(o=O.MAP);let s={transform:[0,0,0,1],fromColor:[1,1,1,1],toColor:[1,1,1,1],colorMix:[0,0,0,0],toOpacity:[1,1,1,1],opacityMix:[0,0,0,0],hasAnimations:l(e)};s=n(this._poMap,e,s);const p="CIMPolygonSymbol"===e.type;let c=t.length;for(;c--;){const l=t[c];if(!l||!1===l.enable)continue;let n;i?.length&&(n=[...i]);const m=l.effects;m?.length&&(i?n.push(...m):n=[...m]);let y=null;if(n){y=[];for(const e of n){const r=_.findEffectOverrides(e,this._primitiveOverrides);r&&y.push(r)}}const d=[];switch(_.findApplicableOverrides(l,this._primitiveOverrides,d),l.type){case"CIMSolidFill":this._analyzeSolidFill(l,y);break;case"CIMPictureFill":this._analyzePictureFill(l,y);break;case"CIMHatchFill":this._analyzeHatchFill(l,y);break;case"CIMGradientFill":this._analyzeGradientFill(l,y);break;case"CIMSolidStroke":this._analyzeSolidStroke(l,y,p,a);break;case"CIMPictureStroke":this._analyzePictureStroke(l,y,p,a);break;case"CIMGradientStroke":this._analyzeGradientStroke(l,y,p,a);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"!==e.type&&"CIMPolygonSymbol"!==e.type||(o=U(l));const t=[],i=l.primitiveName;i&&t.push(i);const n=p&&z(l.markerPlacement);this._analyzeMarker(l,y,null,t,o,a,r,[],s,!1,n);break}default:D().error("Cannot analyze CIM layer",l.type)}}}_analyzeSolidFill(e,r){const{primitiveName:t,type:i}=e,o=b(e.color);this._cimLayers.push({type:"fill",spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(i,t,"Color",o),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:r,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1})}_analyzePictureFill(e,r){const{primitiveName:t,type:i}=e,o=x(e),a=E(e.height,v.CIMPictureFill.height);let s=E(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height),s/=t*(a/r)}const l={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(t,i)};this._cimLayers.push({type:"fill",spriteRasterizationParam:l,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(i,t,"TintColor",o),height:this._getValueOrOverrideExpression(i,t,"Height",a),scaleX:this._getValueOrOverrideExpression(i,t,"ScaleX",s),angle:this._getValueOrOverrideExpression(i,t,"Rotation",E(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",E(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",E(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1})}_analyzeHatchFill(e,r){const{primitiveName:t,type:i}=e,o=this._analyzeMaterialOverrides(t,["Rotation","OffsetX","OffsetY"]),a=L(o);let s=[255,255,255,1],l=!1;if(e.lineSymbol?.symbolLayers)for(const p of e.lineSymbol.symbolLayers){if("CIMSolidStroke"!==p.type)continue;const e=p.primitiveName??t;l||!e||p.colorLocked||null==this._poMap[e]?.Color&&null==this._poMap[e]?.StrokeColor||(s=b(p.color),s=this._maybeGetValueOrOverrideExpression(e,"StrokeColor")??this._getValueOrOverrideExpression(i,e,"Color",s),l=!0);const r=this._maybeGetValueOrOverrideExpression(e,"StrokeWidth");if(r){let t=null,o=null;"number"==typeof r?t=r:o=r.valueExpressionInfo;let s=a.find((e=>"strokeWidth"===e.propertyName));s?s.propertyName="width":(s={type:"CIMPrimitiveOverride",primitiveName:e,propertyName:"width",valueExpressionInfo:o,value:t,defaultValue:I(i,"width")},a.push(s))}}const n={type:"sprite-rasterization-param",resource:e,overrides:a};this._cimLayers.push({type:"fill",spriteRasterizationParam:n,colorLocked:!!e.colorLocked,effects:r,color:s,height:this._getValueOrOverrideExpression(i,t,"Separation",E(e.separation,v.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(i,t,"Rotation",E(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",E(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",E(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!l})}_analyzeGradientFill(e,r){const{angle:t,gradientMethod:i,gradientSize:o,gradientSizeUnits:a,gradientType:s,interval:l,primitiveName:n,type:p}=e,c=v.CIMGradientFill,m=e.colorRamp;this._cimLayers.push({type:"gradientFill",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(n,p)},colorLocked:!1,effects:r,color:[255,255,255,1],gradientMethod:this._getValueOrOverrideExpression(p,n,"GradientMethod",i??"Linear"),angle:this._getValueOrOverrideExpression(p,n,"Angle",E(t,c.angle)),gradientType:"CIMFixedColorRamp"===m.type?"Discrete":this._getValueOrOverrideExpression(p,n,"GradientType",s??c.gradientType),interval:this._getValueOrOverrideExpression(p,n,"Interval",E(l,"CIMFixedColorRamp"===m.type?m.colors.length:c.interval)),gradientSize:this._getValueOrOverrideExpression(p,n,"GradientSize",E(o,c.gradientSize)),gradientSizeUnits:"Absolute"===a?g.Absolute:"Relative"===a?g.Relative:c.gradientSizeUnits})}_analyzeSolidStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=b(e.color),l=E(e.width,v.CIMSolidStroke.width),n=V(e.capStyle,v.CIMSolidStroke.capstyle),p=V(e.joinStyle,v.CIMSolidStroke.joinstyle),c=e.miterLimit;let m,y,d,h,f=[];if(this._analyzePrimitiveOverrides(o,r,null,null)&&(f=this._getPrimitiveMaterialOverrides(o,a)),r&&Array.isArray(r)&&r.length>0){const e=r[r.length-1].effect;e&&"CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&(m=e.dashTemplate,y=e.scaleDash,d=e.offsetAlongLine,h=e.primitiveName,(r=[...r]).pop())}null!=h&&f.push(...this._getPrimitiveMaterialOverrides(h,a).filter((e=>"dashTemplate"===e.propertyName)));const u=void 0!==m?{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:m,primitiveName:h},overrides:f}:null;this._cimLayers.push({type:"line",spriteRasterizationParam:u,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"Color",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",n),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(a,o,"MiterLimit",c),referenceWidth:i,zOrder:B(e.name),dashTemplate:this._maybeGetValueOrOverrideExpression(h,"DashTemplate")??m,offsetAlongLine:this._getValueOrOverrideExpression(a,h,"OffsetAlongLine",d??0),scaleDash:y,sampleAlphaOnly:!0})}_analyzePictureStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=x(e),l=E(e.width,v.CIMPictureStroke.width),n=V(e.capStyle,v.CIMPictureStroke.capstyle),p=V(e.joinStyle,v.CIMPictureStroke.joinstyle),c=e.miterLimit,m={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(o,a)};this._cimLayers.push({type:"line",spriteRasterizationParam:m,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"TintColor",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",n),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(a,o,"MiterLimit",c),referenceWidth:i,zOrder:B(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeGradientStroke(e,r,t,i){const{gradientMethod:o,gradientSize:a,gradientSizeUnits:s,gradientType:l,interval:n,primitiveName:p,type:c}=e,m=v.CIMGradientStroke,y=E(e.width,m.width),d=V(e.capStyle,m.capstyle),h=V(e.joinStyle,m.joinstyle),f=e.miterLimit,u=e.colorRamp;this._cimLayers.push({type:"gradientStroke",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(p,c)},colorLocked:!!e.colorLocked,effects:r,color:[255,255,255,1],width:this._getValueOrOverrideExpression(c,p,"Width",y),cap:this._getValueOrOverrideExpression(c,p,"CapStyle",d),join:this._getValueOrOverrideExpression(c,p,"JoinStyle",h),miterLimit:f&&this._getValueOrOverrideExpression(c,p,"MiterLimit",f),referenceWidth:i,isOutline:t,gradientMethod:this._getValueOrOverrideExpression(c,p,"GradientMethod",o??m.gradientMethod),gradientType:"CIMFixedColorRamp"===u.type?"Discrete":this._getValueOrOverrideExpression(c,p,"GradientType",l??m.gradientType),interval:this._getValueOrOverrideExpression(c,p,"Interval",E(n,"CIMFixedColorRamp"===u.type?u.colors.length:m.interval)),gradientSize:this._getValueOrOverrideExpression(c,p,"GradientSize",E(a,m.gradientSize)),gradientSizeUnits:"Absolute"===s?g.Absolute:"Relative"===s?g.Relative:m.gradientSizeUnits})}_analyzeMarker(e,r,t,i,o,a,s,l,y,d=!1,h=!1){if(d||=!!e.colorLocked,this._analyzeMarkerInsidePolygon(e,r,d))return;const f=E(e.size,v.CIMVectorMarker.size),u=E(e.rotation),O=E(e.offsetX),g=E(e.offsetY),{primitiveName:_,type:S}=e,M=this._getValueOrOverrideExpression(S,_,"Size",f),k=this._getValueOrOverrideExpression(S,_,"Rotation",u),C=this._getValueOrOverrideExpression(S,_,"OffsetX",O),b=this._getValueOrOverrideExpression(S,_,"OffsetY",g);let P=y;switch(P=p(e,P),P=c(this._poMap,e,P),P=m(e,P),P=n(this._poMap,e,P),e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,r,t,i,o,a,M,k,C,b,l,P,d,h);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,r,t,i,o,a,M,k,C,b,l,P,s,d,h)}}_analyzeMarkerInsidePolygon(e,r,t){const{markerPlacement:i,type:o}=e;if(!i||"CIMMarkerPlacementInsidePolygon"!==i.type)return!1;if("CIMVectorMarker"===o||"CIMPictureMarker"===o){const t=e.primitiveName;if(t&&this._analyzePrimitiveOverrides([t],r,null,null))return!1;const a=i.primitiveName;if(a&&this._analyzePrimitiveOverrides([a],r,null,null))return!1;if("CIMVectorMarker"===o){const{markerGraphics:r}=e;if(r)for(const e of r){const{symbol:r}=e;if("CIMPolygonSymbol"===r?.type&&r.symbolLayers){const{symbolLayers:e}=r;for(const r of e)if("CIMSolidStroke"===r.type)return!1}}}else{const{animatedSymbolProperties:r}=e;if(r)return!1}}const s=Math.abs(i.stepX),l=Math.abs(i.stepY);if(0===s||0===l)return!0;let n,p;if("Random"===i.gridType){const e=a(W),r=Math.max(Math.floor(e/s),1);n=l*Math.max(Math.floor(e/l),1);p=r*s/n}else i.shiftOddRows?(n=2*l,p=s/l*.5):(n=l,p=s/l);const c=x(e),m="CIMCharacterMarker"===e.type?null:{type:"sprite-rasterization-param",resource:e,overrides:[]};return this._cimLayers.push({type:"fill",spriteRasterizationParam:m,colorLocked:t,effects:r,color:c,height:n,scaleX:p,angle:i.gridAngle,offsetX:E(i.offsetX),offsetY:E(i.offsetY),applyRandomOffset:"Random"===i.gridType,sampleAlphaOnly:"CIMPictureMarker"!==e.type,hasUnresolvedReplacementColor:!0}),!0}_analyzePictureMarker(e,r,i,o,a,l,n,p,c,m,y,d,h,f){const{animatedSymbolProperties:u,primitiveName:v,type:O}=e;let g=E(e.scaleX,1);const _=x(e);i||(i=this._createMarkerPlacementOverrideExpression(e.markerPlacement));const S=this._createGIFAnimatedSymbolPropertiesOverrideExpression(u),M=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height);g/=t*(E(e.size)/r)}const k=[...o];let C;e.primitiveName&&k.push(e.primitiveName),u||S?C={type:"animated",url:e.url,urlHash:"H"+s(e.url),playAnimation:e.animatedSymbolProperties?.playAnimation,reverseAnimation:e.animatedSymbolProperties?.reverseAnimation,randomizeStartTime:e.animatedSymbolProperties?.randomizeStartTime,randomizeStartSeed:e.animatedSymbolProperties?.randomizeStartSeed,startTimeOffset:e.animatedSymbolProperties?.startTimeOffset,duration:e.animatedSymbolProperties?.duration,repeatType:e.animatedSymbolProperties?.repeatType,repeatDelay:e.animatedSymbolProperties?.repeatDelay}:(C=t(e),C.markerPlacement=null);const b={type:"sprite-rasterization-param",resource:C,overrides:this._getMaterialOverrides(k,O)};S&&b.overrides.push(...S.overrides);const P=n;this._cimLayers.push({type:"marker",spriteRasterizationParam:b,colorLocked:h,effects:r,scaleSymbolsProportionally:!1,alignment:a,size:n,scaleX:this._getValueOrOverrideExpression(O,v,"ScaleX",g),rotation:p,offsetX:c,offsetY:m,transform:{type:"cim-marker-transform-param",params:y},color:this._getValueOrOverrideExpression(O,v,"TintColor",_),anchorPoint:{x:M.x,y:M.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:1,isOutline:f,markerPlacement:i,animationParams:$(d),baseSize:P})}_analyzeVectorMarker(e,r,t,i,o,a,s,l,p,c,m,f,u,v,O){const g=e.markerGraphics;if(!g)return;const _=e.frame;let S=0;S=_?_.ymax-_.ymin:a;const M=!!e.scaleSymbolsProportionally;if(S){const r={offsetX:p,offsetY:c,rotation:l,size:s,frameHeight:S,rotateClockWise:!!e.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:M};m=[...m,r]}t||(t=this._createMarkerPlacementOverrideExpression(e.markerPlacement));for(const k of g)if(k){const s=k.symbol;if(!s)continue;const l=k.primitiveName;l&&i.push(l);let p,c=f;if(("CIMPointSymbol"===s.type||"CIMTextSymbol"===s.type)&&_){let r=0,t=0;const i=k.geometry;"x"in i&&"y"in i&&(r+=i.x-.5*(_.xmin+_.xmax),t+=i.y-.5*(_.ymin+_.ymax));const o=e.anchorPoint;let a=!1;o&&("Absolute"===e.anchorPointUnits?(r-=o.x,t-=o.y,a=!0):_&&(r-=(_.xmax-_.xmin)*o.x,t-=(_.ymax-_.ymin)*o.y));const s={offsetX:r,offsetY:t,rotation:0,size:0,frameHeight:0,rotateClockWise:!1,absoluteAnchorPoint:a,scaleSymbolsProportionally:M};p=[...m,s]}const g=k.geometry,[C,b]=y(g,_);switch(0===C&&0===b||(c=d(c,C,b)),"CIMPointSymbol"===s.type&&(c=n(this._poMap,s,c)),s.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":u||Q(s)?(c={...c,transform:{type:"AnimatedTransform",relativeTranslation:!1,absoluteScale:!0,translation:h([0,0]),rotation:h(0),scale:h(S),parent:f.transform}},this._analyzeMultiLayerGraphicNonSDF(e,r,t,k,i,o,a,p??m,c,S,v,O)):this._analyzeMultiLayerGraphic(e,r,t,k,i,o,a,p??m,c,S,v,O);break;case"CIMTextSymbol":this._analyzeTextGraphic(r,t,k,i,o,a,p??m,v)}l&&i.pop()}}_analyzeMultiLayerGraphic(e,r,t,i,o,a,s,l,p,c,m,y){const d=i.symbol,h=d.symbolLayers;if(!h)return;let u=h.length;if(K(h)&&!f(p))return void this._analyzeCompositeMarkerGraphic(e,r,t,i,h,a,s,l,c,m,y);const O=this._resourceManager.geometryEngine,g=j.applyEffects(d.effects,i.geometry,O);if(g)for(;u--;){const d=h[u];if(!d||!1===d.enable)continue;const f=d.primitiveName;switch(f&&o.push(f),d.type){case"CIMSolidFill":case"CIMSolidStroke":{const o=j.applyEffects(d.effects,g,O),h=S(o);if(!h)continue;const u="Relative"!==e.anchorPointUnits,_=R(d)??0,{frameSizeRatio:C,anchorX:P,anchorY:z,widthRatio:x,sdfPaddingRatio:L}=M(h,e.frame,e.size,e.anchorPoint,u,_,e.scaleSymbolsProportionally),I="CIMSolidFill"===d.type,V={type:"sdf",geom:o,sdfPaddingRatio:L,asFill:I},{path:w}=d,G=I?b(N(d)):null==w?b(A(d)):[0,0,0,0],F=I?[0,0,0,0]:b(A(d));if(!I&&!_)break;const T=i.primitiveName;let X=null;I&&!d.colorLocked&&(X=this._maybeGetValueOrOverrideExpression(T,"FillColor"));let Y=null;I||d.colorLocked||(Y=this._maybeGetValueOrOverrideExpression(T,"StrokeColor"));const W=X??this._getValueOrOverrideExpression(d.type,f,"Color",G),D=Y??this._getValueOrOverrideExpression(d.type,f,"Color",F),U=this._maybeGetValueOrOverrideExpression(T,"StrokeWidth")??this._getValueOrOverrideExpression(d.type,f,"Width",_),H=w?{type:"sprite-rasterization-param",resource:{type:"path",path:w,asFill:I},overrides:[]}:{type:"sprite-rasterization-param",resource:V,overrides:[]},J=n(this._poMap,d,p),B=E(e.size,v.CIMVectorMarker.size),q=this._getValueOrOverrideExpression(e.type,e.primitiveName,"Size",B);this._cimLayers.push({type:"marker",spriteRasterizationParam:H,colorLocked:!!d.colorLocked||!!m,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:P,y:z},isAbsoluteAnchorPoint:u,size:c,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:c,widthRatio:x,rotateClockwise:!1,referenceSize:s,sizeRatio:C,color:W,outlineColor:D,outlineWidth:U,isOutline:y,markerPlacement:t,animationParams:$(J),isStroke:"CIMSolidFill"!==d.type,baseSize:q,...k(o,L)});break}case"CIMPictureMarker":case"CIMVectorMarker":d.markerPlacement?this._analyzeMultiLayerGraphicNonSDF(e,r,t,i,o,a,s,l,p,c,!!d.colorLocked||!!m,y):this._analyzeMarker(d,r,t,o,a,s,!1,l,p,m,y);break;default:this._analyzeMultiLayerGraphicNonSDF(e,r,t,i,o,a,s,l,p,c,!!d.colorLocked||!!m,y)}f&&o.pop()}}_analyzeTextGraphic(e,t,i,o,a,s,l,n){const p=[];_.findApplicableOverrides(i,this._primitiveOverrides,p);const c=i.geometry;if(!("x"in c)||!("y"in c))return;const m=i.symbol,y=w(m),d=G(m.fontStyleName),h=r(m.fontFamilyName);m.font={family:h,decoration:y,...d};const f=E(m.height,v.CIMTextSymbol.height),u=E(m.angle),O=E(m.offsetX),g=E(m.offsetY),{haloSymbol:S}=m,M=E(m.haloSize,0);let k=[0,0,0,0];if(S?.symbolLayers?.length){const e=S.symbolLayers;for(const r of e)if(r.color){k=this._getValueOrOverrideExpression(m?.haloSymbol?.type??"CIMPolygonSymbol",r.primitiveName,"Color",b(r.color));break}}const C=i.primitiveName;let P=[0,0,0,1],z=[0,0,0,0],x=0,L=!1;if(m.symbol?.symbolLayers)for(const r of m.symbol.symbolLayers){const e=r.primitiveName;if("CIMSolidStroke"===r.type)z=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Color",b(r.color)),x=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Width",R(r)??0);else if("CIMSolidFill"===r.type){const t=b(r.color);L=L??!!r.colorLocked,P=this._getValueOrOverrideExpression("CIMSolidFill",e??C,"Color",t)}}let I=null,V=null,N=null,A=null,X=null;C&&(I=this._maybeGetValueOrOverrideExpression(C,"TextSize"),V=this._maybeGetValueOrOverrideExpression(C,"TextAngle"),N=this._maybeGetValueOrOverrideExpression(C,"TextOffsetX"),A=this._maybeGetValueOrOverrideExpression(C,"TextOffsetY"),L||(X=this._maybeGetValueOrOverrideExpression(C,"FillColor")));const Y=X??P;let j=null,W=null,D=0;if(m.callout&&"CIMBackgroundCallout"===m.callout.type){const e=m.callout;if(e.backgroundSymbol){const r=e.backgroundSymbol.symbolLayers;if(r)for(const e of r)"CIMSolidFill"===e.type?j=b(e.color):"CIMSolidStroke"===e.type&&(W=b(e.color),D=E(e.width,v.CIMSolidStroke.width))}}const U=this._getValueOrOverrideExpression(m.type,i.primitiveName,"TextString",i.textString??"");if(null==U)return;const{fontStyleName:H}=m,J=h+(H?"-"+H.toLowerCase():"-regular"),B=this._getMaterialOverrides(o,m.type);B.push(...this._getPrimitiveMaterialOverrides(i.primitiveName,m.type));const q={type:"text-rasterization-param",resource:{type:"text",textString:i.textString??"",font:m.font,symbol:m,primitiveName:i.primitiveName},overrides:B};this._cimLayers.push({type:"text",lineWidth:m.lineWidth,textRasterizationParam:q,colorLocked:!!n||!!L,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:J,decoration:y,haloSize:M,haloColor:k,weight:d.weight,style:d.style,size:I??f,angle:V??u,offsetX:N??O,offsetY:A??g,transform:{type:"cim-marker-transform-param",params:l},horizontalAlignment:F(m.horizontalAlignment),verticalAlignment:T(m.verticalAlignment),text:U,color:Y,outlineColor:z,outlineSize:x,backgroundColor:j,borderLineColor:W,borderLineWidth:D,referenceSize:s,sizeRatio:1,markerPlacement:t})}_analyzeMultiLayerGraphicNonSDF(e,r,t,i,a,s,l,n,p,c,m,y){const d=J(e,i),h=e.primitiveName,f=this._analyzeMaterialOverrides(h,["Rotation","OffsetX","OffsetY"]),O=L(f),[g,_,S]=u.getTextureAnchor(d,this._resourceManager),M=this._getMaterialOverrides(a,e.type);M.push(...O);const k={type:"sprite-rasterization-param",resource:{...d,avoidSDFRasterization:!0},overrides:M},C=E(e.size,v.CIMVectorMarker.size),b=this._getValueOrOverrideExpression(e.type,h,"Size",C);this._cimLayers.push({type:"marker",spriteRasterizationParam:k,colorLocked:m,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:g,y:_},isAbsoluteAnchorPoint:!1,size:c,rotation:0,offsetX:0,offsetY:0,transform:{type:"cim-marker-transform-param",params:n},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:c,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:S/o(e.size),isOutline:y,markerPlacement:t,animationParams:$(p),baseSize:b})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;const r=[];return _.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-marker-placement-param",placement:e,overrides:Z(r)}}_createGIFAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;const r=[];return _.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-gif-animation-params",animation:e,overrides:Z(r)}}_analyzeCompositeMarkerGraphic(e,r,t,i,o,a,s,l,n,p,c){const m=i.geometry,y=o[0],d=o[1],h=S(m);if(!h)return;const f="Relative"!==e.anchorPointUnits,u=E(y.width,v.CIMSolidStroke.width),{frameSizeRatio:O,anchorX:g,anchorY:_,widthRatio:k,sdfPaddingRatio:C}=M(h,e.frame,e.size,e.anchorPoint,f,u,e.scaleSymbolsProportionally),{path:P}=d,z=d.primitiveName,x=y.primitiveName,L=i.primitiveName;let I=null;d.colorLocked||p||(I=this._maybeGetValueOrOverrideExpression(L,"FillColor"));const V=I??this._getValueOrOverrideExpression(d.type,z,"Color",b(d.color));let R=null;y.colorLocked||p||(R=this._maybeGetValueOrOverrideExpression(L,"StrokeColor"));const N=R??this._getValueOrOverrideExpression(y.type,x,"Color",b(y.color)),A=this._maybeGetValueOrOverrideExpression(L,"StrokeWidth")??this._getValueOrOverrideExpression(y.type,x,"Width",u),w={type:"sprite-rasterization-param",resource:P?{type:"path",path:P,asFill:!0}:{type:"sdf",geom:m,sdfPaddingRatio:C,asFill:!0},overrides:[]};this._cimLayers.push({type:"marker",spriteRasterizationParam:w,colorLocked:p,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:g,y:_},isAbsoluteAnchorPoint:f,size:n,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:n,widthRatio:k,rotateClockwise:!1,referenceSize:s,sizeRatio:O,color:V,outlineColor:N,outlineWidth:A,isOutline:c,markerPlacement:t})}_setPoMap(e,r,t){let i;this._poMap[e]?i=this._poMap[e]:(i={},this._poMap[e]=i),i[r]=t}_maybeGetValueOrOverrideExpression(e,r,t){return this._getValueOrOverrideExpression("",e,r,t,!1)}_getValueOrOverrideExpression(e,r,t,i,o=!0){if(o&&!X(i)&&(i=I(e,t.toLowerCase())),null==r)return i;const a=this._poMap[r];if(null==a)return i;const s=a[t];return"string"==typeof s||"number"==typeof s||Array.isArray(s)?s:s?{valueExpressionInfo:s,defaultValue:i}:i}_analyzePrimitiveOverrides(e,r,t,i){if(null==e)return!1;"string"==typeof e&&(e=[e]);for(const o of this._primitiveOverrides)if(e.includes(o.primitiveName)&&o.valueExpressionInfo)return!0;if(null!=r)for(const o of r)if(o?.overrides.length>0)return!0;if(null!=t)for(const o of t)if(o?.overrides.length>0)return!0;if(null!=i)for(const o of i)if(o?.overrides.length>0)return!0;return!1}_getMaterialOverrides(e,r){if(!e)return[];const t=[];for(const i of e)t.push(...this._getPrimitiveMaterialOverrides(i,r));return t}_getPrimitiveMaterialOverrides(e,r){if(!e)return[];const t=L(this._primitiveOverrides.filter((r=>r.primitiveName===e)));return t.forEach((e=>e.defaultValue=I(r,e.propertyName.toLowerCase()))),t}_analyzeMaterialOverrides(e,r){return this._primitiveOverrides.filter((t=>t.primitiveName!==e||!r.includes(t.propertyName)))}}function J(e,r){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[r],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}function B(e){if(e&&0===e.indexOf("Level_")){const r=parseInt(e.slice(6),10);if(!isNaN(r))return r}return 0}function q(e,r){if(!r||0===r.length)return e;const i=t(e);return _.applyOverrides(i,r),i}const K=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&null==e[0].path&&null==e[1].path&&!e[0].effects&&!e[1].effects&&!e[0].animations&&!e[1].animations;function Q(e){const r=e.symbolLayers;if(!r)return!1;const t=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectDashes"===e.type&&null!=e.dashTemplate)))),i=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectAddControlPoints"===e.type))));return!!t||!!i}function Z(e){return t(e).map((e=>({...e,propertyName:Y(e.propertyName)})))}function $(e){return f(e)?{type:"animation-params",params:e}:null}export{H as CIMAnalyzer,q as analyzeCIMResource};
5
+ import{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as r}from"../../core/fontUtils.js";import{clone as t}from"../../core/lang.js";import i from"../../core/Logger.js";import{pt2px as o,px2pt as a}from"../../core/screenUtils.js";import{numericHash as s}from"../../core/string.js";import{checkForAnimations as l,getAnimationParams as n,handleAbsoluteAnchor as p,handleMarker as c,handleRelativeAnchor as m,getFrameTranslation as y,translate as d,getStaticParam as h,shouldUseAnimatedPath as f}from"./animationUtils.js";import{CIMSymbolHelper as u}from"./CIMSymbolHelper.js";import{defaultCIMValues as v}from"./defaultCIMValues.js";import{Alignment as O,SymbolUnits as g}from"./enums.js";import{OverrideHelper as _}from"./OverrideHelper.js";import{getExtent as S,getSDFMetrics as M,getSDFDimensions as k}from"./SDFHelper.js";import{colorToArray as b,normalizeAlpha as C,getSize as P,isCIMMarkerStrokePlacement as z,getTintColor as x,getNumericValue as E,normalizePrimitiveOverrideProps as L,getDefaultCIMValue as I,getEnum as V,getStrokeWidth as N,getFillColor as R,getStrokeColor as A,fromCIMFontDecoration as w,fromCIMFontStyle as G,fromCIMHorizontalAlignment as F,fromCIMVerticalAlignment as T,isValidCIMValue as X,uncapitalize as Y}from"./utils.js";import{CIMEffectHelper as j}from"./effects/CIMEffectHelper.js";import{randomInsidePolygonTextureSize as W}from"../../views/2d/engine/webgl/definitions.js";const U=()=>i.getLogger("esri.symbols.cim.cimAnalyzer");function D(e){const r=e.markerPlacement;return r&&r.angleToLine?O.MAP:O.SCREEN}class H{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],e&&(this._resourceManager=e)}analyzeSymbolReference(r,t,i){if(this._cimLayers=i??[],!r)return this._cimLayers;if(this._reset(),r.primitiveOverrides){this._primitiveOverrides=r.primitiveOverrides;for(const r of this._primitiveOverrides){const t=r.valueExpressionInfo;if(t)this._setPoMap(r.primitiveName,r.propertyName,t);else if(null!=r.value){let t=r.value;r.propertyName.includes("Color")&&(e(t)&&(t=b(t)),t=C(t)),this._setPoMap(r.primitiveName,r.propertyName,t)}}}return this._analyzeSymbol(r.symbol,t),this._cimLayers}_reset(){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[]}_analyzeSymbol(e,r){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,r)}}_analyzeMultiLayerSymbol(e,r){const t=e?.symbolLayers;if(!t)return;const i=e.effects;let o=O.SCREEN;const a=P(e)??0;"CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(o=O.MAP);let s={transform:[0,0,0,1],fromColor:[1,1,1,1],toColor:[1,1,1,1],colorMix:[0,0,0,0],toOpacity:[1,1,1,1],opacityMix:[0,0,0,0],hasAnimations:l(e)};s=n(this._poMap,e,s);const p="CIMPolygonSymbol"===e.type;let c=t.length;for(;c--;){const l=t[c];if(!l||!1===l.enable)continue;let n;i?.length&&(n=[...i]);const m=l.effects;m?.length&&(i?n.push(...m):n=[...m]);let y=null;if(n){y=[];for(const e of n){const r=_.findEffectOverrides(e,this._primitiveOverrides);r&&y.push(r)}}const d=[];switch(_.findApplicableOverrides(l,this._primitiveOverrides,d),l.type){case"CIMSolidFill":this._analyzeSolidFill(l,y);break;case"CIMPictureFill":this._analyzePictureFill(l,y);break;case"CIMHatchFill":this._analyzeHatchFill(l,y);break;case"CIMGradientFill":this._analyzeGradientFill(l,y);break;case"CIMSolidStroke":this._analyzeSolidStroke(l,y,p,a);break;case"CIMPictureStroke":this._analyzePictureStroke(l,y,p,a);break;case"CIMGradientStroke":this._analyzeGradientStroke(l,y,p,a);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"!==e.type&&"CIMPolygonSymbol"!==e.type||(o=D(l));const t=[],i=l.primitiveName;i&&t.push(i);const n=p&&z(l.markerPlacement);this._analyzeMarker(l,y,null,t,o,a,r,[],s,!1,n);break}default:U().error("Cannot analyze CIM layer",l.type)}}}_analyzeSolidFill(e,r){const{primitiveName:t,type:i}=e,o=C(e.color);this._cimLayers.push({type:"fill",spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(i,t,"Color",o),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:r,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1})}_analyzePictureFill(e,r){const{primitiveName:t,type:i}=e,o=x(e),a=E(e.height,v.CIMPictureFill.height);let s=E(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height),s/=t*(a/r)}const l={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(t,i)};this._cimLayers.push({type:"fill",spriteRasterizationParam:l,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(i,t,"TintColor",o),height:this._getValueOrOverrideExpression(i,t,"Height",a),scaleX:this._getValueOrOverrideExpression(i,t,"ScaleX",s),angle:this._getValueOrOverrideExpression(i,t,"Rotation",E(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",E(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",E(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1})}_analyzeHatchFill(e,r){const{primitiveName:t,type:i}=e,o=this._analyzeMaterialOverrides(t,["Rotation","OffsetX","OffsetY"]),a=L(o);let s=[255,255,255,1],l=!1;if(e.lineSymbol?.symbolLayers)for(const p of e.lineSymbol.symbolLayers){if("CIMSolidStroke"!==p.type)continue;const e=p.primitiveName??t;l||!e||p.colorLocked||null==this._poMap[e]?.Color&&null==this._poMap[e]?.StrokeColor||(s=C(p.color),s=this._maybeGetValueOrOverrideExpression(e,"StrokeColor")??this._getValueOrOverrideExpression(i,e,"Color",s),l=!0);const r=this._maybeGetValueOrOverrideExpression(e,"StrokeWidth");if(r){let t=null,o=null;"number"==typeof r?t=r:o=r.valueExpressionInfo;let s=a.find((e=>"strokeWidth"===e.propertyName));s?s.propertyName="width":(s={type:"CIMPrimitiveOverride",primitiveName:e,propertyName:"width",valueExpressionInfo:o,value:t,defaultValue:I(i,"width")},a.push(s))}}const n={type:"sprite-rasterization-param",resource:e,overrides:a};this._cimLayers.push({type:"fill",spriteRasterizationParam:n,colorLocked:!!e.colorLocked,effects:r,color:s,height:this._getValueOrOverrideExpression(i,t,"Separation",E(e.separation,v.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(i,t,"Rotation",E(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",E(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",E(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!l})}_analyzeGradientFill(e,r){const{angle:t,gradientMethod:i,gradientSize:o,gradientSizeUnits:a,gradientType:s,interval:l,primitiveName:n,type:p}=e,c=v.CIMGradientFill,m=e.colorRamp;this._cimLayers.push({type:"gradientFill",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(n,p)},colorLocked:!1,effects:r,color:[255,255,255,1],gradientMethod:this._getValueOrOverrideExpression(p,n,"GradientMethod",i??"Linear"),angle:this._getValueOrOverrideExpression(p,n,"Angle",E(t,c.angle)),gradientType:this._getValueOrOverrideExpression(p,n,"GradientType",s??c.gradientType),interval:this._getValueOrOverrideExpression(p,n,"Interval",E(l,"CIMFixedColorRamp"===m.type?m.colors.length:c.interval)),gradientSize:this._getValueOrOverrideExpression(p,n,"GradientSize",E(o,c.gradientSize)),gradientSizeUnits:"Absolute"===a?g.Absolute:"Relative"===a?g.Relative:c.gradientSizeUnits})}_analyzeSolidStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=C(e.color),l=E(e.width,v.CIMSolidStroke.width),n=V(e.capStyle,v.CIMSolidStroke.capstyle),p=V(e.joinStyle,v.CIMSolidStroke.joinstyle),c=e.miterLimit;let m,y,d,h,f=[];if(this._analyzePrimitiveOverrides(o,r,null,null)&&(f=this._getPrimitiveMaterialOverrides(o,a)),r&&Array.isArray(r)&&r.length>0){const e=r[r.length-1].effect;e&&"CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&(m=e.dashTemplate,y=e.scaleDash,d=e.offsetAlongLine,h=e.primitiveName,(r=[...r]).pop())}null!=h&&f.push(...this._getPrimitiveMaterialOverrides(h,a).filter((e=>"dashTemplate"===e.propertyName)));const u=void 0!==m?{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:m,primitiveName:h},overrides:f}:null;this._cimLayers.push({type:"line",spriteRasterizationParam:u,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"Color",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",n),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(a,o,"MiterLimit",c),referenceWidth:i,zOrder:B(e.name),dashTemplate:this._maybeGetValueOrOverrideExpression(h,"DashTemplate")??m,offsetAlongLine:this._getValueOrOverrideExpression(a,h,"OffsetAlongLine",d??0),scaleDash:y,sampleAlphaOnly:!0})}_analyzePictureStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=x(e),l=E(e.width,v.CIMPictureStroke.width),n=V(e.capStyle,v.CIMPictureStroke.capstyle),p=V(e.joinStyle,v.CIMPictureStroke.joinstyle),c=e.miterLimit,m={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(o,a)};this._cimLayers.push({type:"line",spriteRasterizationParam:m,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"TintColor",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",n),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(a,o,"MiterLimit",c),referenceWidth:i,zOrder:B(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeGradientStroke(e,r,t,i){const{gradientMethod:o,gradientSize:a,gradientSizeUnits:s,gradientType:l,interval:n,primitiveName:p,type:c}=e,m=v.CIMGradientStroke,y=E(e.width,m.width),d=V(e.capStyle,m.capstyle),h=V(e.joinStyle,m.joinstyle),f=e.miterLimit,u=e.colorRamp;this._cimLayers.push({type:"gradientStroke",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(p,c)},colorLocked:!!e.colorLocked,effects:r,color:[255,255,255,1],width:this._getValueOrOverrideExpression(c,p,"Width",y),cap:this._getValueOrOverrideExpression(c,p,"CapStyle",d),join:this._getValueOrOverrideExpression(c,p,"JoinStyle",h),miterLimit:f&&this._getValueOrOverrideExpression(c,p,"MiterLimit",f),referenceWidth:i,isOutline:t,gradientMethod:this._getValueOrOverrideExpression(c,p,"GradientMethod",o??m.gradientMethod),gradientType:this._getValueOrOverrideExpression(c,p,"GradientType",l??m.gradientType),interval:this._getValueOrOverrideExpression(c,p,"Interval",E(n,"CIMFixedColorRamp"===u.type?u.colors.length:m.interval)),gradientSize:this._getValueOrOverrideExpression(c,p,"GradientSize",E(a,m.gradientSize)),gradientSizeUnits:"Absolute"===s?g.Absolute:"Relative"===s?g.Relative:m.gradientSizeUnits})}_analyzeMarker(e,r,t,i,o,a,s,l,y,d=!1,h=!1){if(d||=!!e.colorLocked,this._analyzeMarkerInsidePolygon(e,r,d))return;const f=E(e.size,v.CIMVectorMarker.size),u=E(e.rotation),O=E(e.offsetX),g=E(e.offsetY),{primitiveName:_,type:S}=e,M=this._getValueOrOverrideExpression(S,_,"Size",f),k=this._getValueOrOverrideExpression(S,_,"Rotation",u),b=this._getValueOrOverrideExpression(S,_,"OffsetX",O),C=this._getValueOrOverrideExpression(S,_,"OffsetY",g);let P=y;switch(P=p(e,P),P=c(this._poMap,e,P),P=m(e,P),P=n(this._poMap,e,P),e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,r,t,i,o,a,M,k,b,C,l,P,d,h);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,r,t,i,o,a,M,k,b,C,l,P,s,d,h)}}_analyzeMarkerInsidePolygon(e,r,t){const{markerPlacement:i,type:o}=e;if(!i||"CIMMarkerPlacementInsidePolygon"!==i.type)return!1;if("CIMVectorMarker"===o||"CIMPictureMarker"===o){const t=e.primitiveName;if(t&&this._analyzePrimitiveOverrides([t],r,null,null))return!1;const a=i.primitiveName;if(a&&this._analyzePrimitiveOverrides([a],r,null,null))return!1;if("CIMVectorMarker"===o){const{markerGraphics:r}=e;if(r)for(const e of r){const{symbol:r}=e;if("CIMPolygonSymbol"===r?.type&&r.symbolLayers){const{symbolLayers:e}=r;for(const r of e)if("CIMSolidStroke"===r.type)return!1}}}else{const{animatedSymbolProperties:r}=e;if(r)return!1}}const s=Math.abs(i.stepX),l=Math.abs(i.stepY);if(0===s||0===l)return!0;let n,p;if("Random"===i.gridType){const e=a(W),r=Math.max(Math.floor(e/s),1);n=l*Math.max(Math.floor(e/l),1);p=r*s/n}else i.shiftOddRows?(n=2*l,p=s/l*.5):(n=l,p=s/l);const c=x(e),m="CIMCharacterMarker"===e.type?null:{type:"sprite-rasterization-param",resource:e,overrides:[]};return this._cimLayers.push({type:"fill",spriteRasterizationParam:m,colorLocked:t,effects:r,color:c,height:n,scaleX:p,angle:i.gridAngle,offsetX:E(i.offsetX),offsetY:E(i.offsetY),applyRandomOffset:"Random"===i.gridType,sampleAlphaOnly:"CIMPictureMarker"!==e.type,hasUnresolvedReplacementColor:!0}),!0}_analyzePictureMarker(e,r,i,o,a,l,n,p,c,m,y,d,h,f){const{animatedSymbolProperties:u,primitiveName:v,type:O}=e;let g=E(e.scaleX,1);const _=x(e);i||(i=this._createMarkerPlacementOverrideExpression(e.markerPlacement));const S=this._createGIFAnimatedSymbolPropertiesOverrideExpression(u),M=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height);g/=t*(E(e.size)/r)}const k=[...o];let b;e.primitiveName&&k.push(e.primitiveName),u||S?b={type:"animated",url:e.url,urlHash:"H"+s(e.url),playAnimation:e.animatedSymbolProperties?.playAnimation,reverseAnimation:e.animatedSymbolProperties?.reverseAnimation,randomizeStartTime:e.animatedSymbolProperties?.randomizeStartTime,randomizeStartSeed:e.animatedSymbolProperties?.randomizeStartSeed,startTimeOffset:e.animatedSymbolProperties?.startTimeOffset,duration:e.animatedSymbolProperties?.duration,repeatType:e.animatedSymbolProperties?.repeatType,repeatDelay:e.animatedSymbolProperties?.repeatDelay}:(b=t(e),b.markerPlacement=null);const C={type:"sprite-rasterization-param",resource:b,overrides:this._getMaterialOverrides(k,O)};S&&C.overrides.push(...S.overrides);const P=n;this._cimLayers.push({type:"marker",spriteRasterizationParam:C,colorLocked:h,effects:r,scaleSymbolsProportionally:!1,alignment:a,size:n,scaleX:this._getValueOrOverrideExpression(O,v,"ScaleX",g),rotation:p,offsetX:c,offsetY:m,transform:{type:"cim-marker-transform-param",params:y},color:this._getValueOrOverrideExpression(O,v,"TintColor",_),anchorPoint:{x:M.x,y:M.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:1,isOutline:f,markerPlacement:i,animationParams:$(d),baseSize:P})}_analyzeVectorMarker(e,r,t,i,o,a,s,l,p,c,m,f,u,v,O){const g=e.markerGraphics;if(!g)return;const _=e.frame;let S=0;S=_?_.ymax-_.ymin:a;const M=!!e.scaleSymbolsProportionally;if(S){const r={offsetX:p,offsetY:c,rotation:l,size:s,frameHeight:S,rotateClockWise:!!e.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:M};m=[...m,r]}t||(t=this._createMarkerPlacementOverrideExpression(e.markerPlacement));for(const k of g)if(k){const s=k.symbol;if(!s)continue;const l=k.primitiveName;l&&i.push(l);let p,c=f;if(("CIMPointSymbol"===s.type||"CIMTextSymbol"===s.type)&&_){let r=0,t=0;const i=k.geometry;"x"in i&&"y"in i&&(r+=i.x-.5*(_.xmin+_.xmax),t+=i.y-.5*(_.ymin+_.ymax));const o=e.anchorPoint;let a=!1;o&&("Absolute"===e.anchorPointUnits?(r-=o.x,t-=o.y,a=!0):_&&(r-=(_.xmax-_.xmin)*o.x,t-=(_.ymax-_.ymin)*o.y));const s={offsetX:r,offsetY:t,rotation:0,size:0,frameHeight:0,rotateClockWise:!1,absoluteAnchorPoint:a,scaleSymbolsProportionally:M};p=[...m,s]}const g=k.geometry,[b,C]=y(g,_);switch(0===b&&0===C||(c=d(c,b,C)),"CIMPointSymbol"===s.type&&(c=n(this._poMap,s,c)),s.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":u||Q(s)?(c={...c,transform:{type:"AnimatedTransform",relativeTranslation:!1,absoluteScale:!0,translation:h([0,0]),rotation:h(0),scale:h(S),parent:f.transform}},this._analyzeMultiLayerGraphicNonSDF(e,r,t,k,i,o,a,p??m,c,S,v,O)):this._analyzeMultiLayerGraphic(e,r,t,k,i,o,a,p??m,c,S,v,O);break;case"CIMTextSymbol":this._analyzeTextGraphic(r,t,k,i,o,a,p??m,v)}l&&i.pop()}}_analyzeMultiLayerGraphic(e,r,t,i,o,a,s,l,p,c,m,y){const d=i.symbol,h=d.symbolLayers;if(!h)return;let u=h.length;if(K(h)&&!f(p))return void this._analyzeCompositeMarkerGraphic(e,r,t,i,h,a,s,l,c,m,y);const O=this._resourceManager.geometryEngine,g=j.applyEffects(d.effects,i.geometry,O);if(g)for(;u--;){const d=h[u];if(!d||!1===d.enable)continue;const f=d.primitiveName;switch(f&&o.push(f),d.type){case"CIMSolidFill":case"CIMSolidStroke":{const o=j.applyEffects(d.effects,g,O),h=S(o);if(!h)continue;const u="Relative"!==e.anchorPointUnits,_=N(d)??0,{frameSizeRatio:b,anchorX:P,anchorY:z,widthRatio:x,sdfPaddingRatio:L}=M(h,e.frame,e.size,e.anchorPoint,u,_,e.scaleSymbolsProportionally),I="CIMSolidFill"===d.type,V={type:"sdf",geom:o,sdfPaddingRatio:L,asFill:I},{path:w}=d,G=I?C(R(d)):null==w?C(A(d)):[0,0,0,0],F=I?[0,0,0,0]:C(A(d));if(!I&&!_)break;const T=i.primitiveName;let X=null;I&&!d.colorLocked&&(X=this._maybeGetValueOrOverrideExpression(T,"FillColor"));let Y=null;I||d.colorLocked||(Y=this._maybeGetValueOrOverrideExpression(T,"StrokeColor"));const W=X??this._getValueOrOverrideExpression(d.type,f,"Color",G),U=Y??this._getValueOrOverrideExpression(d.type,f,"Color",F),D=this._maybeGetValueOrOverrideExpression(T,"StrokeWidth")??this._getValueOrOverrideExpression(d.type,f,"Width",_),H=w?{type:"sprite-rasterization-param",resource:{type:"path",path:w,asFill:I},overrides:[]}:{type:"sprite-rasterization-param",resource:V,overrides:[]},J=n(this._poMap,d,p),B=E(e.size,v.CIMVectorMarker.size),q=this._getValueOrOverrideExpression(e.type,e.primitiveName,"Size",B);this._cimLayers.push({type:"marker",spriteRasterizationParam:H,colorLocked:!!d.colorLocked||!!m,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:P,y:z},isAbsoluteAnchorPoint:u,size:c,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:c,widthRatio:x,rotateClockwise:!1,referenceSize:s,sizeRatio:b,color:W,outlineColor:U,outlineWidth:D,isOutline:y,markerPlacement:t,animationParams:$(J),isStroke:"CIMSolidFill"!==d.type,baseSize:q,...k(o,L)});break}case"CIMPictureMarker":case"CIMVectorMarker":d.markerPlacement?this._analyzeMultiLayerGraphicNonSDF(e,r,t,i,o,a,s,l,p,c,!!d.colorLocked||!!m,y):this._analyzeMarker(d,r,t,o,a,s,!1,l,p,m,y);break;default:this._analyzeMultiLayerGraphicNonSDF(e,r,t,i,o,a,s,l,p,c,!!d.colorLocked||!!m,y)}f&&o.pop()}}_analyzeTextGraphic(e,t,i,o,a,s,l,n){const p=[];_.findApplicableOverrides(i,this._primitiveOverrides,p);const c=i.geometry;if(!("x"in c)||!("y"in c))return;const m=i.symbol,y=w(m),d=G(m.fontStyleName),h=r(m.fontFamilyName);m.font={family:h,decoration:y,...d};const f=E(m.height,v.CIMTextSymbol.height),u=E(m.angle),O=E(m.offsetX),g=E(m.offsetY),{haloSymbol:S}=m,M=E(m.haloSize,0);let k=[0,0,0,0];if(S?.symbolLayers?.length){const e=S.symbolLayers;for(const r of e)if(r.color){k=this._getValueOrOverrideExpression(m?.haloSymbol?.type??"CIMPolygonSymbol",r.primitiveName,"Color",C(r.color));break}}const b=i.primitiveName;let P=[0,0,0,1],z=[0,0,0,0],x=0,L=!1;if(m.symbol?.symbolLayers)for(const r of m.symbol.symbolLayers){const e=r.primitiveName;if("CIMSolidStroke"===r.type)z=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Color",C(r.color)),x=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Width",N(r)??0);else if("CIMSolidFill"===r.type){const t=C(r.color);L=L??!!r.colorLocked,P=this._getValueOrOverrideExpression("CIMSolidFill",e??b,"Color",t)}}let I=null,V=null,R=null,A=null,X=null;b&&(I=this._maybeGetValueOrOverrideExpression(b,"TextSize"),V=this._maybeGetValueOrOverrideExpression(b,"TextAngle"),R=this._maybeGetValueOrOverrideExpression(b,"TextOffsetX"),A=this._maybeGetValueOrOverrideExpression(b,"TextOffsetY"),L||(X=this._maybeGetValueOrOverrideExpression(b,"FillColor")));const Y=X??P;let j=null,W=null,U=0;if(m.callout&&"CIMBackgroundCallout"===m.callout.type){const e=m.callout;if(e.backgroundSymbol){const r=e.backgroundSymbol.symbolLayers;if(r)for(const e of r)"CIMSolidFill"===e.type?j=C(e.color):"CIMSolidStroke"===e.type&&(W=C(e.color),U=E(e.width,v.CIMSolidStroke.width))}}const D=this._getValueOrOverrideExpression(m.type,i.primitiveName,"TextString",i.textString??"");if(null==D)return;const{fontStyleName:H}=m,J=h+(H?"-"+H.toLowerCase():"-regular"),B=this._getMaterialOverrides(o,m.type);B.push(...this._getPrimitiveMaterialOverrides(i.primitiveName,m.type));const q={type:"text-rasterization-param",resource:{type:"text",textString:i.textString??"",font:m.font,symbol:m,primitiveName:i.primitiveName},overrides:B};this._cimLayers.push({type:"text",lineWidth:m.lineWidth,textRasterizationParam:q,colorLocked:!!n||!!L,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:J,decoration:y,haloSize:M,haloColor:k,weight:d.weight,style:d.style,size:I??f,angle:V??u,offsetX:R??O,offsetY:A??g,transform:{type:"cim-marker-transform-param",params:l},horizontalAlignment:F(m.horizontalAlignment),verticalAlignment:T(m.verticalAlignment),text:D,color:Y,outlineColor:z,outlineSize:x,backgroundColor:j,borderLineColor:W,borderLineWidth:U,referenceSize:s,sizeRatio:1,markerPlacement:t})}_analyzeMultiLayerGraphicNonSDF(e,r,t,i,a,s,l,n,p,c,m,y){const d=J(e,i),h=e.primitiveName,f=this._analyzeMaterialOverrides(h,["Rotation","OffsetX","OffsetY"]),O=L(f),[g,_,S]=u.getTextureAnchor(d,this._resourceManager),M=this._getMaterialOverrides(a,e.type);M.push(...O);const k={type:"sprite-rasterization-param",resource:{...d,avoidSDFRasterization:!0},overrides:M},b=E(e.size,v.CIMVectorMarker.size),C=this._getValueOrOverrideExpression(e.type,h,"Size",b);this._cimLayers.push({type:"marker",spriteRasterizationParam:k,colorLocked:m,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:g,y:_},isAbsoluteAnchorPoint:!1,size:c,rotation:0,offsetX:0,offsetY:0,transform:{type:"cim-marker-transform-param",params:n},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:c,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:S/o(e.size),isOutline:y,markerPlacement:t,animationParams:$(p),baseSize:C})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;const r=[];return _.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-marker-placement-param",placement:e,overrides:Z(r)}}_createGIFAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;const r=[];return _.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-gif-animation-params",animation:e,overrides:Z(r)}}_analyzeCompositeMarkerGraphic(e,r,t,i,o,a,s,l,n,p,c){const m=i.geometry,y=o[0],d=o[1],h=S(m);if(!h)return;const f="Relative"!==e.anchorPointUnits,u=E(y.width,v.CIMSolidStroke.width),{frameSizeRatio:O,anchorX:g,anchorY:_,widthRatio:k,sdfPaddingRatio:b}=M(h,e.frame,e.size,e.anchorPoint,f,u,e.scaleSymbolsProportionally),{path:P}=d,z=d.primitiveName,x=y.primitiveName,L=i.primitiveName;let I=null;d.colorLocked||p||(I=this._maybeGetValueOrOverrideExpression(L,"FillColor"));const V=I??this._getValueOrOverrideExpression(d.type,z,"Color",C(d.color));let N=null;y.colorLocked||p||(N=this._maybeGetValueOrOverrideExpression(L,"StrokeColor"));const R=N??this._getValueOrOverrideExpression(y.type,x,"Color",C(y.color)),A=this._maybeGetValueOrOverrideExpression(L,"StrokeWidth")??this._getValueOrOverrideExpression(y.type,x,"Width",u),w={type:"sprite-rasterization-param",resource:P?{type:"path",path:P,asFill:!0}:{type:"sdf",geom:m,sdfPaddingRatio:b,asFill:!0},overrides:[]};this._cimLayers.push({type:"marker",spriteRasterizationParam:w,colorLocked:p,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:g,y:_},isAbsoluteAnchorPoint:f,size:n,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:n,widthRatio:k,rotateClockwise:!1,referenceSize:s,sizeRatio:O,color:V,outlineColor:R,outlineWidth:A,isOutline:c,markerPlacement:t})}_setPoMap(e,r,t){let i;this._poMap[e]?i=this._poMap[e]:(i={},this._poMap[e]=i),i[r]=t}_maybeGetValueOrOverrideExpression(e,r,t){return this._getValueOrOverrideExpression("",e,r,t,!1)}_getValueOrOverrideExpression(e,r,t,i,o=!0){if(o&&!X(i)&&(i=I(e,t.toLowerCase())),null==r)return i;const a=this._poMap[r];if(null==a)return i;const s=a[t];return"string"==typeof s||"number"==typeof s||Array.isArray(s)?s:s?{valueExpressionInfo:s,defaultValue:i}:i}_analyzePrimitiveOverrides(e,r,t,i){if(null==e)return!1;"string"==typeof e&&(e=[e]);for(const o of this._primitiveOverrides)if(e.includes(o.primitiveName)&&o.valueExpressionInfo)return!0;if(null!=r)for(const o of r)if(o?.overrides.length>0)return!0;if(null!=t)for(const o of t)if(o?.overrides.length>0)return!0;if(null!=i)for(const o of i)if(o?.overrides.length>0)return!0;return!1}_getMaterialOverrides(e,r){if(!e)return[];const t=[];for(const i of e)t.push(...this._getPrimitiveMaterialOverrides(i,r));return t}_getPrimitiveMaterialOverrides(e,r){if(!e)return[];const t=L(this._primitiveOverrides.filter((r=>r.primitiveName===e)));return t.forEach((e=>e.defaultValue=I(r,e.propertyName.toLowerCase()))),t}_analyzeMaterialOverrides(e,r){return this._primitiveOverrides.filter((t=>t.primitiveName!==e||!r.includes(t.propertyName)))}}function J(e,r){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[r],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}function B(e){if(e&&0===e.indexOf("Level_")){const r=parseInt(e.slice(6),10);if(!isNaN(r))return r}return 0}function q(e,r){if(!r||0===r.length)return e;const i=t(e);return _.applyOverrides(i,r),i}const K=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&null==e[0].path&&null==e[1].path&&!e[0].effects&&!e[1].effects&&!e[0].animations&&!e[1].animations;function Q(e){const r=e.symbolLayers;if(!r)return!1;const t=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectDashes"===e.type&&null!=e.dashTemplate)))),i=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectAddControlPoints"===e.type))));return!!t||!!i}function Z(e){return t(e).map((e=>({...e,propertyName:Y(e.propertyName)})))}function $(e){return f(e)?{type:"animation-params",params:e}:null}export{H as CIMAnalyzer,q as analyzeCIMResource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{createResolver as t,onAbortOrThrow as e,throwIfNotAbortError as i}from"../../../core/promiseUtils.js";import{identity as s,translate as r,rotate as h,scaleByVec2 as u,multiply as o}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as a}from"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{DisplayObject as l}from"./DisplayObject.js";import d from"./ImageryBitmapSource.js";import{SizedPixelFormat as c,PixelFormat as _,TextureWrapMode as x}from"../../webgl/enums.js";import{Texture as m}from"../../webgl/Texture.js";import{TextureDescriptor as p}from"../../webgl/TextureDescriptor.js";function g(t){return t&&"render"in t}function f(t){const e=document.createElement("canvas");return e.width=t.width,e.height=t.height,t.render(e.getContext("2d")),e}function w(t){return g(t)?t instanceof d?t.getRenderedRasterPixels()?.renderedRasterPixels:f(t):t}class S extends l{constructor(t=null,e=!1){super(),this.blendFunction="standard",this._sourceWidth=0,this._sourceHeight=0,this._texture=null,this.stencilRef=0,this.coordScale=[1,1],this._height=void 0,this.pixelRatio=1,this.resolution=0,this.rotation=0,this._source=null,this._width=void 0,this.x=0,this.y=0,this.immutable=e,this.source=t,this.requestRender=this.requestRender.bind(this)}destroy(){this._texture&&(this._texture.texture.dispose(),this._texture=null),null!=this._uploadStatus&&(this._uploadStatus.controller.abort(),this._uploadStatus=null)}get isSourceScaled(){return this.width!==this._sourceWidth||this.height!==this._sourceHeight}get height(){return void 0!==this._height?this._height:this._sourceHeight}set height(t){this._height=t}get source(){return this._source}set source(t){null==t&&null==this._source||(this._source=t,this.invalidateTexture(),this.requestRender())}get width(){return void 0!==this._width?this._width:this._sourceWidth}set width(t){this._width=t}beforeRender(t){super.beforeRender(t),this.getTexture(t)}async setSourceAsync(i,s){null!=this._uploadStatus&&this._uploadStatus.controller.abort();const r=new AbortController,h=t();return e(s,(()=>r.abort())),e(r,(t=>h.reject(t))),this._uploadStatus={controller:r,resolver:h},this.source=i,h.promise}invalidateTexture(){this._texture&&this._texture.invalidated||this._texture&&(this._texture.invalidated=!0),this._source instanceof HTMLImageElement?(this._sourceHeight=this._source.naturalHeight,this._sourceWidth=this._source.naturalWidth):this._source&&(this._sourceHeight=this._source.height,this._sourceWidth=this._source.width)}transitionStep(t,e){t>=64&&(this.fadeTransitionEnabled=!1),super.transitionStep(t,e)}setTransform(t){const e=s(this.transforms.displayViewScreenMat3),[i,n]=t.toScreenNoRotation([0,0],[this.x,this.y]),l=this.resolution/this.pixelRatio/t.resolution,d=l*this.width,c=l*this.height,_=Math.PI*this.rotation/180;r(e,e,a(i,n)),r(e,e,a(d/2,c/2)),h(e,e,-_),r(e,e,a(-d/2,-c/2)),u(e,e,a(d,c)),o(this.transforms.displayViewScreenMat3,t.displayViewMat3,e)}setSamplingProfile(t){this._texture&&(t.mips&&!this._texture.texture.descriptor.hasMipmap&&this._texture.texture.generateMipmap(),this._texture.texture.setSamplingMode(t.samplingMode))}bind(t,e){this._texture&&t.bindTexture(this._texture.texture,e)}getTexture({context:t,painter:e}){if(this._texture&&!this._texture.invalidated)return this._texture.texture;if(this._texture||(this._texture={texture:this._createTexture(t),invalidated:!1}),!this.source)return this._texture.texture.setData(null),this._texture.texture;this._texture.texture.resize(this._sourceWidth,this._sourceHeight);const s=w(this.source);try{if(null!=this._uploadStatus){const{controller:t,resolver:i}=this._uploadStatus,r={signal:t.signal},{width:h,height:u}=this,{texture:o}=this._texture;e.textureUploadManager.enqueueTextureUpdate({data:s,texture:o,width:h,height:u},r),i.resolve(),this._uploadStatus=null}else this._texture?.texture.setData(s);this.ready()}catch(r){i(r)}return this._texture.texture}onDetach(){this.destroy()}_createTransforms(){return{displayViewScreenMat3:n()}}_createTexture(t){const e=this.immutable,i=new p;return i.internalFormat=e?c.RGBA8:_.RGBA,i.wrapMode=x.CLAMP_TO_EDGE,i.isImmutable=e,i.width=this._sourceWidth,i.height=this._sourceHeight,new m(t,i)}}export{S as Bitmap,g as isImageSource,f as rasterize};
5
+ import{createResolver as t,onAbortOrThrow as e,throwIfNotAbortError as i}from"../../../core/promiseUtils.js";import{identity as s,translate as r,rotate as h,scaleByVec2 as o,multiply as u}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as n}from"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{DisplayObject as l}from"./DisplayObject.js";import d from"./ImageryBitmapSource.js";import{SizedPixelFormat as c,PixelFormat as _,TextureWrapMode as p}from"../../webgl/enums.js";import{Texture as m}from"../../webgl/Texture.js";import{TextureDescriptor as x}from"../../webgl/TextureDescriptor.js";function g(t){return t&&"render"in t}function f(t){const e=document.createElement("canvas");return e.width=t.width,e.height=t.height,t.render(e.getContext("2d")),e}function w(t){return g(t)?t instanceof d?t.getRenderedRasterPixels()?.renderedRasterPixels:f(t):t}class S extends l{constructor(t=null,e=!1){super(),this.blendFunction="standard",this._sourceWidth=0,this._sourceHeight=0,this._textureInvalidated=!1,this.stencilRef=0,this.coordScale=[1,1],this._height=void 0,this.pixelRatio=1,this.resolution=0,this.rotation=0,this._source=null,this._texture=null,this._width=void 0,this.x=0,this.y=0,this.immutable=e,this.source=t,this.requestRender=this.requestRender.bind(this)}destroy(){this._texture&&(this._texture.dispose(),this._texture=null),null!=this._uploadStatus&&(this._uploadStatus.controller.abort(),this._uploadStatus=null)}get isSourceScaled(){return this.width!==this._sourceWidth||this.height!==this._sourceHeight}get height(){return void 0!==this._height?this._height:this._sourceHeight}set height(t){this._height=t}get source(){return this._source}set source(t){null==t&&null==this._source||(this._source=t,this.invalidateTexture(),this.requestRender())}get texture(){return this._texture}get width(){return void 0!==this._width?this._width:this._sourceWidth}set width(t){this._width=t}beforeRender(t){super.beforeRender(t),this.updateTexture(t)}async setSourceAsync(i,s){null!=this._uploadStatus&&this._uploadStatus.controller.abort();const r=new AbortController,h=t();return e(s,(()=>r.abort())),e(r,(t=>h.reject(t))),this._uploadStatus={controller:r,resolver:h},this.source=i,h.promise}invalidateTexture(){this._textureInvalidated||(this._textureInvalidated=!0,this._source instanceof HTMLImageElement?(this._sourceHeight=this._source.naturalHeight,this._sourceWidth=this._source.naturalWidth):this._source&&(this._sourceHeight=this._source.height,this._sourceWidth=this._source.width))}transitionStep(t,e){t>=64&&(this.fadeTransitionEnabled=!1),super.transitionStep(t,e)}setTransform(t){const e=s(this.transforms.displayViewScreenMat3),[i,a]=t.toScreenNoRotation([0,0],[this.x,this.y]),l=this.resolution/this.pixelRatio/t.resolution,d=l*this.width,c=l*this.height,_=Math.PI*this.rotation/180;r(e,e,n(i,a)),r(e,e,n(d/2,c/2)),h(e,e,-_),r(e,e,n(-d/2,-c/2)),o(e,e,n(d,c)),u(this.transforms.displayViewScreenMat3,t.displayViewMat3,e)}setSamplingProfile(t){this._texture&&(t.mips&&!this._texture.descriptor.hasMipmap&&this._texture.generateMipmap(),this._texture.setSamplingMode(t.samplingMode))}bind(t,e){this._texture&&t.bindTexture(this._texture,e)}async updateTexture({context:t,painter:e}){if(!this._textureInvalidated)return;if(this._textureInvalidated=!1,this._texture||(this._texture=this._createTexture(t)),!this.source)return void this._texture.setData(null);this._texture.resize(this._sourceWidth,this._sourceHeight);const s=w(this.source);try{if(null!=this._uploadStatus){const{controller:t,resolver:i}=this._uploadStatus,r={signal:t.signal},{width:h,height:o}=this,u=this._texture,a=e.textureUploadManager;await a.enqueueTextureUpdate({data:s,texture:u,width:h,height:o},r),i.resolve(),this._uploadStatus=null}else this._texture.setData(s);this.ready()}catch(r){i(r)}}onDetach(){this.destroy()}_createTransforms(){return{displayViewScreenMat3:a()}}_createTexture(t){const e=this.immutable,i=new x;return i.internalFormat=e?c.RGBA8:_.RGBA,i.wrapMode=p.CLAMP_TO_EDGE,i.isImmutable=e,i.width=this._sourceWidth,i.height=this._sourceHeight,new m(t,i)}}export{S as Bitmap,g as isImageSource,f as rasterize};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{WGLDrawPhase as e}from"./webgl/enums.js";import i from"./webgl/WGLContainer.js";import{BitmapTechnique as s}from"./webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js";class t extends i{constructor(){super(...arguments),this._hasCrossfade=!1,this._bitmapTechnique=null}get requiresDedicatedFBO(){return super.requiresDedicatedFBO||this._hasCrossfade}beforeRender(e){super.beforeRender(e),this._manageFade()}onAttach(){super.onAttach(),this._bitmapTechnique=new s}onDetach(){super.onDetach(),this._bitmapTechnique?.shutdown(),this._bitmapTechnique=null}doRender(i){if(!this.visible||i.drawPhase!==e.MAP)return;if(!this._bitmapTechnique)return;super.doRender(i);const s=this.children;this._bitmapTechnique.render(i,{bitmaps:s})}_manageFade(){this.children.reduce(((e,i)=>e+(i.inFadeTransition?1:0)),0)>=2?(this.children.forEach((e=>e.blendFunction="additive")),this._hasCrossfade=!0):(this.children.forEach((e=>e.blendFunction="standard")),this._hasCrossfade=!1)}}export{t as BitmapContainer};
5
+ import{WGLDrawPhase as e}from"./webgl/enums.js";import i from"./webgl/WGLContainer.js";import{BitmapTechnique as s}from"./webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js";class r extends i{constructor(){super(...arguments),this._hasCrossfade=!1,this._bitmapTechnique=null}get requiresDedicatedFBO(){return super.requiresDedicatedFBO||this._hasCrossfade}beforeRender(e){super.beforeRender(e),this._manageFade()}onAttach(){super.onAttach(),this._bitmapTechnique=new s}onDetach(){super.onDetach(),this._bitmapTechnique?.shutdown(),this._bitmapTechnique=null}renderChildren(i){super.renderChildren(i),this.visible&&i.drawPhase===e.MAP&&null!=this._bitmapTechnique&&this._bitmapTechnique.render(i,{bitmaps:this.children})}_manageFade(){this.children.reduce(((e,i)=>e+(i.inFadeTransition?1:0)),0)>=2?(this.children.forEach((e=>e.blendFunction="additive")),this._hasCrossfade=!0):(this.children.forEach((e=>e.blendFunction="standard")),this._hasCrossfade=!1)}}export{r as BitmapContainer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{create as e}from"../../../geometry/support/aaBoundingRect.js";import{BitmapTile as i}from"./BitmapTile.js";import{WGLDrawPhase as t}from"./webgl/enums.js";import n from"./webgl/TileContainer.js";import{BitmapTechnique as r}from"./webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js";class s extends n{constructor(){super(...arguments),this._bitmapTechnique=null}get requiresDedicatedFBO(){return this.children.some((e=>"additive"===e.bitmap.blendFunction))}createTile(t){const n=this.tileInfoView.getTileBounds(e(),t),r=this.tileInfoView.getTileResolution(t.level),[s,o]=this.tileInfoView.tileInfo.size;return new i(t,r,n[0],n[3],s,o)}onAttach(){super.onAttach(),this._bitmapTechnique=new r}onDetach(){super.onDetach(),this._bitmapTechnique?.shutdown(),this._bitmapTechnique=null}doRender(e){if(!this.visible||e.drawPhase!==t.MAP)return;if(!this._bitmapTechnique)return;super.doRender(e);const i=this.children.map((e=>e.bitmap));this._bitmapTechnique.render(e,{bitmaps:i})}}export{s as BitmapTileContainer};
5
+ import{create as e}from"../../../geometry/support/aaBoundingRect.js";import{BitmapTile as i}from"./BitmapTile.js";import{WGLDrawPhase as t}from"./webgl/enums.js";import n from"./webgl/TileContainer.js";import{BitmapTechnique as r}from"./webgl/shaderGraph/techniques/bitmap/BitmapTechnique.js";class s extends n{constructor(){super(...arguments),this._bitmapTechnique=null}get requiresDedicatedFBO(){return this.children.some((e=>"additive"===e.bitmap.blendFunction))}createTile(t){const n=this.tileInfoView.getTileBounds(e(),t),r=this.tileInfoView.getTileResolution(t.level),[s,o]=this.tileInfoView.tileInfo.size;return new i(t,r,n[0],n[3],s,o)}onAttach(){super.onAttach(),this._bitmapTechnique=new r}onDetach(){super.onDetach(),this._bitmapTechnique?.shutdown(),this._bitmapTechnique=null}renderChildren(e){if(super.renderChildren(e),!this.visible||e.drawPhase!==t.MAP||null==this._bitmapTechnique)return;const i=this.children.map((e=>e.bitmap));this._bitmapTechnique.render(e,{bitmaps:i})}}export{s as BitmapTileContainer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{textureBindingBitmap as e}from"../../../definitions.js";import{Technique as i}from"../Technique.js";import{TechniqueType as t}from"../TechniqueType.js";import{BitmapShader as s}from"../shaders/BitmapShader.js";import{TextureSamplingMode as o,CompareFunction as n,StencilOperation as r}from"../../../../../../webgl/enums.js";const a={nearest:{samplingMode:o.NEAREST,mips:!1},bilinear:{samplingMode:o.LINEAR,mips:!1},bicubic:{samplingMode:o.LINEAR,mips:!1},trilinear:{samplingMode:o.LINEAR_MIPMAP_LINEAR,mips:!0}},m=(e,i,t)=>{if("dynamic"===t.samplingMode){const{state:t}=e,s=i.resolution/i.pixelRatio/t.resolution,o=Math.round(e.pixelRatio)!==e.pixelRatio,n=s>1.05||s<.95;return t.rotation||n||o||i.isSourceScaled||i.rotation?a.bilinear:a.nearest}return a[t.samplingMode]};class p extends i{constructor(){super(...arguments),this.name="BrushBitmap",this.type=t.Bitmap,this.shaders={bitmap:new s}}render(i,t){const{context:s,renderingOptions:o,painter:p}=i;for(const c of t.bitmaps){if(!c.source||!c.isReady)continue;const t=m(i,c,o);i.timeline.begin(this.name),p.setPipelineState({depth:!1,stencil:{test:{mask:255,ref:c.stencilRef,compare:n.EQUAL,op:{fail:r.KEEP,zFail:r.KEEP,zPass:r.KEEP}},write:!1},color:{write:[!0,!0,!0,!0],blendMode:"additive"===c.blendFunction?"additive":"composite"}});const d=c.getTexture(i);c.setSamplingProfile(t);const{coordScale:l,computedOpacity:u,transforms:f}=c,h={texture:{texture:d,unit:e},dvsMat3:f.displayViewScreenMat3,coordScale:l,opacity:u};p.submitDrawMesh(s,{shader:this.shaders.bitmap,uniforms:{config:h},defines:{bicubic:t===a.bicubic},optionalAttributes:null,useComputeBuffer:!1},p.quadMesh),i.timeline.end(this.name)}}}export{p as BitmapTechnique};
5
+ import{textureBindingBitmap as e}from"../../../definitions.js";import{Technique as i}from"../Technique.js";import{TechniqueType as t}from"../TechniqueType.js";import{BitmapShader as s}from"../shaders/BitmapShader.js";import{TextureSamplingMode as o,CompareFunction as n,StencilOperation as r}from"../../../../../../webgl/enums.js";const a={nearest:{samplingMode:o.NEAREST,mips:!1},bilinear:{samplingMode:o.LINEAR,mips:!1},bicubic:{samplingMode:o.LINEAR,mips:!1},trilinear:{samplingMode:o.LINEAR_MIPMAP_LINEAR,mips:!0}},m=(e,i,t)=>{if("dynamic"===t.samplingMode){const{state:t}=e,s=i.resolution/i.pixelRatio/t.resolution,o=Math.round(e.pixelRatio)!==e.pixelRatio,n=s>1.05||s<.95;return t.rotation||n||o||i.isSourceScaled||i.rotation?a.bilinear:a.nearest}return a[t.samplingMode]};class p extends i{constructor(){super(...arguments),this.name="BrushBitmap",this.type=t.Bitmap,this.shaders={bitmap:new s}}render(i,t){const{context:s,renderingOptions:o,painter:p}=i;for(const c of t.bitmaps){const t=c.texture;if(!c.source||!c.isReady||null==t)continue;const l=m(i,c,o);i.timeline.begin(this.name),p.setPipelineState({depth:!1,stencil:{test:{mask:255,ref:c.stencilRef,compare:n.EQUAL,op:{fail:r.KEEP,zFail:r.KEEP,zPass:r.KEEP}},write:!1},color:{write:[!0,!0,!0,!0],blendMode:"additive"===c.blendFunction?"additive":"composite"}}),c.setSamplingProfile(l);const{coordScale:d,computedOpacity:u,transforms:f}=c,h={texture:{texture:t,unit:e},dvsMat3:f.displayViewScreenMat3,coordScale:d,opacity:u};p.submitDrawMesh(s,{shader:this.shaders.bitmap,uniforms:{config:h},defines:{bicubic:l===a.bicubic},optionalAttributes:null,useComputeBuffer:!1},p.quadMesh),i.timeline.end(this.name)}}}export{p as BitmapTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{notDeepEqual as h}from"../../../core/object.js";import{createAbortError as c,createResolver as d,ignoreAbortErrors as p,throwIfNotAbortError as y,isAbortError as g}from"../../../core/promiseUtils.js";import{watch as f,initial as m}from"../../../core/reactiveUtils.js";import{property as w}from"../../../core/accessorSupport/decorators/property.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as v}from"../../../core/support/UpdatingHandles.js";import b from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as F}from"../../../layers/graphics/featureConversionUtils.js";import A from"../../../layers/support/FeatureFilter.js";import{checkCurrentUserSupport as S}from"../../../layers/support/featureLayerUtils.js";import{packFields as j}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as x}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as E}from"../../../layers/support/timeSupport.js";import I from"../../../rest/support/AggregateFeatureSet.js";import U from"../../../rest/support/FeatureSet.js";import k from"../../../rest/support/Query.js";import{LayerView2DMixin as C}from"./LayerView2D.js";import{FeatureContainer as V}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as q}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as R}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as O}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as Q}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as L}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as W}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as H}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as P}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as T}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as M}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as D}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as N}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import G from"./support/FeatureCommandQueue.js";import{handleNoEngineError as J}from"./support/handleNoEngineError.js";import{HighlightCounter as $}from"./support/HighlightCounter.js";import{toJSONGeometryType as z}from"./support/util.js";import{FeatureTileSubscriptionManager as B}from"../tiling/FeatureTileSubscriptionManager.js";import Z from"../../layers/FeatureLayerView.js";import K from"../../layers/LayerView.js";import X from"../../layers/RefreshableLayerView.js";import Y from"../../../geometry/Extent.js";function ee(e,t){const r=new Set;return e&&e.forEach((e=>r.add(e))),t&&t.forEach((e=>r.add(e))),r.has("*")?["*"]:Array.from(r)}const te=4294967294;let re=class extends(Z(X(C(K)))){constructor(){super(...arguments),this._commandsQueue=new G({process:e=>{switch(e.type){case"override":return this._doOverride(e.message);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new $,this._lastAvailableFields=[],this._lastTargetState=null,this.eventLog=new R,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new v,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new b}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(c()),this._commandsQueue.destroy()}initialize(){this._workerAttached=d(),p(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===x(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await q(t)}async _attachProxy(){const e={service:await this.layerAdapter.createServiceOptions(this.view),tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON()};let t=[];Array.isArray(e.service.source)&&(t=e.service.source);try{await this._workerProxy.pipeline.onAttach(e,{transferList:t}),this._workerAttached.resolve()}catch(r){this._workerAttached.reject(c()),y(r)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:i})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:i,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new L(this.layer):new Q(this.layer);case"geojson":case"csv":case"wfs":return new L(this.layer);case"parquet":return new T(this.layer);case"subtype-group":return new D(this.layer);case"ogc-feature":return new H(this.layer);case"stream":return new M(this.layer);case"oriented-imagery":return new P(this.layer);case"knowledge-graph-sublayer":return new W(this.layer);case"catalog-footprint":return new O(this.layer);default:a(this.layer)}return null}get timeExtent(){return E(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}highlight(e,t="default"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:s.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(i);return o?.length?(this._addHighlights(o,t),n((()=>this._removeHighlights(o,t)))):n()}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,i){const s=await this.featureContainer.hitTest(i);if(0===s.length)return null;const a=await this.getWorker(),{features:o,aggregates:n}=await a.pipeline.getDisplayFeatures(s),u=this.featureContainer.getSortKeys(s),l=({displayId:e},{displayId:t})=>u.has(e)&&u.has(t)?u.get(e)-u.get(t):e-t;return o.sort(l).reverse(),n.sort(l).reverse(),[...n.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...o.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}async queryStatistics(){const e=await this.getWorker();return J(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r);return J(a,{})}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale},s=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),i,r);return J(s,{})}async queryUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r);return J(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r);return J(a,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r);return J(a,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r);return J(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r);return J(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r);return J(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=U.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),i=await J(r,{features:[]}),s=U.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),i=await J(r,{features:[]}),s=I.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return J(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return J(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return J(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return J(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return J(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return J(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await J(r,{count:0,extent:null});return{count:i.count,extent:Y.fromJSON(i.extent)}}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(e.toJSON(),t),i=await J(r,{features:[]});return U.fromJSON(i)}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this._subscriptionManager.update(e.targetState,this._lastTargetState);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),p(this._updatingHandles.addPromise(this._workerAttached.promise)),p(this._attachProxy()),this.featureContainer=new V(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new B({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),p(this._updatingHandles.addPromise(this.getWorker().then((t=>t.pipeline.updateSubscriptions(e)))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([f((()=>JSON.stringify({displayRefreshVersion:this._displayRefreshVersion,timeExtent:this.timeExtent,clips:this.clips,filter:this.filter,featureEffect:this.featureEffect,sourceRefreshVersion:this._sourceRefreshVersion,timeZone:this.view.timeZone,viewTimeExtent:this.view.timeExtent,effect:this.featureEffect,...this.layerAdapter.getUpdateHashProperties(this.view)})),(()=>this._update()),m),f((()=>this.updateSuspended),(e=>{e||(this._subscriptionManager.resume(),this.view.labelManager.requestUpdate())})),f((()=>this.visible),(e=>{this.view.labelManager.requestUpdate()}))]),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._editUpdatingHandles.addPromise(this._edit(e)))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=l(this._subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=d(),p(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,i=this.featureContainer.updatingHandles.updating,s=this.updateRequested||e&&(t||r)||i||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${s}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${i}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return s}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const i of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(i));return r}return Promise.all(t.map((t=>e.view.stage.painter.textureManager.rasterizeItem(t))))},fetchDictionary:e=>Promise.all(e.map((e=>this._fetchDictionaryRequest(e))))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const i={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map((e=>e.toJSON())));const s=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await N(a.data,{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=k.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=k.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const i of t.aggregateIds??[])r.push(i);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();const t=this.layer,r=e.historicMoment?.getTime()??null,i="layerId"in t&&e.editedFeatures?.find((e=>e.layerId===t.layerId));if(i&&this._canEditByFeature(i)){const{adds:e,deletes:t,updates:s}=i.editedFeatures,a=this.layer.objectIdField,o=s.map((e=>e.current)),n=t.map((e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e)),u=await this._resolveIdenifiers(n);return this.addOverrides({added:e,updated:o,removed:u,historicMoment:r,isWeak:!0})}const[s,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]),n=[...s,...a];return this._commandsQueue.push({type:"override-by-id",updates:n,removed:o,historicMoment:r,isWeak:!0}).catch(y)}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%te+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%te+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?u.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const i="globalIdField"in this.layer&&this.layer.globalIdField,s=i&&this.availableFields.includes(i);if(r.length&&!s)return u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${i} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}async addOverrides(e){const t=!1,r=!1,i=z(this.layer.geometryType),s=this.layer.objectIdField,a=[];for(const n of e.added){const e=F(n,i,t,r,s);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.updated){const e=F(n,i,t,r,s);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.removed)if(null==n)throw new o("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:n});return this._commandsQueue.push({type:"override",updates:a,removed:e.removed,release:[],isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null})}async removeOverrides(e){for(const t of e)if(null==t)throw new o("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:t});return this._commandsQueue.push({type:"override",updates:[],removed:[],release:e,isWeak:!1,historicMoment:null})}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every((e=>this.view.spatialReference.equals(e.geometry?.spatialReference)))&&r.every((e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference)))}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await Promise.allSettled([this._updateRequiredFields(),S(this.layer)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},i=this._createViewSchemaConfig(),s={source:this.layerAdapter.createSourceSchema(i,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,i,this._displayRefreshVersion)},a=h(this._lastSchema?.source.mutable,s.source.mutable)||h(this._lastSchema?.processor,s.processor);if(!a)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=s,this._fields=null;const o=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${o}] FeatureLayerView2D._doUpdate`,{changes:a});const n=await this.getWorker();await n.pipeline.updateSchema(s,o),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransition(),this.featureContainer.restartAllAnimations(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${o}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doOverride(e){const t=await this.getWorker();try{this.featureContainer.editStart(),await t.pipeline.onOverride(e),this.featureContainer.editEnd()}catch(r){g(r),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=ee(this._lastAvailableFields,e);return this._lastAvailableFields=t,j(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[ie(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent}}_addHighlights(e,t){this._highlightCounter.addGroup(e,t),this._commandsQueue.push({type:"highlight"})}_removeHighlights(e,t){this._highlightCounter.deleteGroup(e,t),this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=[];for(const i of this._highlightCounter.ids()){const t=this._highlightCounter.getHighlightGroups(i),r=this._getHighlightBits(t);e.push({objectId:i,highlightFlags:r})}const t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch((e=>{g(e)||u.getLogger(this).error(e)}));this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function ie(e,t,r,i,s){s&&(s=s.clone());const a=null!=s?s.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(s??=new A,s.timeExtent=o),s=t.addFilters?.(s,e)??s;let n=s?.toJSON()??null;return i.size&&(n??=(new A).toJSON(),n.hiddenIds=Array.from(i)),n}e([w()],re.prototype,"_commandsQueue",void 0),e([w()],re.prototype,"_sourceRefreshVersion",void 0),e([w()],re.prototype,"_displayRefreshVersion",void 0),e([w({readOnly:!0})],re.prototype,"_pipelineUpdating",void 0),e([w()],re.prototype,"_sourceUpdating",void 0),e([w({readOnly:!0})],re.prototype,"dataUpdating",null),e([w({readOnly:!0})],re.prototype,"hasAllFeatures",null),e([w({readOnly:!0})],re.prototype,"hasAllFeaturesInView",null),e([w({readOnly:!0})],re.prototype,"hasFullGeometries",null),e([w()],re.prototype,"featureEffectView",void 0),e([w()],re.prototype,"labelingCollisionInfos",null),e([w()],re.prototype,"layerAdapter",null),e([w({readOnly:!0})],re.prototype,"timeExtent",null),e([w()],re.prototype,"updating",void 0),re=e([_("esri.views.2d.layers.FeatureLayerView2D")],re);const se=re;export{se as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../AggregateGraphic.js";import"../../../geometry.js";import r from"../../../Graphic.js";import{isSome as i}from"../../../core/arrayUtils.js";import s from"../../../core/Collection.js";import{neverReached as a}from"../../../core/compilerUtils.js";import o from"../../../core/Error.js";import{makeHandle as n}from"../../../core/handleUtils.js";import has from"../../../core/has.js";import u from"../../../core/Logger.js";import{destroyMaybe as l}from"../../../core/maybe.js";import{notDeepEqual as h}from"../../../core/object.js";import{createAbortError as c,createResolver as d,ignoreAbortErrors as p,throwIfNotAbortError as y,isAbortError as g}from"../../../core/promiseUtils.js";import{watch as f,initial as m}from"../../../core/reactiveUtils.js";import{property as w}from"../../../core/accessorSupport/decorators/property.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as v}from"../../../core/support/UpdatingHandles.js";import b from"../../../layers/effects/FeatureEffectView.js";import{convertFromFeature as A}from"../../../layers/graphics/featureConversionUtils.js";import F from"../../../layers/support/FeatureFilter.js";import{checkCurrentUserSupport as S}from"../../../layers/support/featureLayerUtils.js";import{packFields as j}from"../../../layers/support/fieldUtils.js";import{getEffectiveLayerCapabilities as x}from"../../../layers/support/layerUtils.js";import{combineTimeExtent as E}from"../../../layers/support/timeSupport.js";import I from"../../../rest/support/AggregateFeatureSet.js";import U from"../../../rest/support/AttributeBinsFeatureSet.js";import k from"../../../rest/support/AttributeBinsQuery.js";import C from"../../../rest/support/FeatureSet.js";import V from"../../../rest/support/Query.js";import{LayerView2DMixin as R}from"./LayerView2D.js";import{FeatureContainer as q}from"./features/FeatureContainer.js";import{createFeaturePipelineWorkerProxy as Q}from"./features/FeaturePipelineWorkerProxy.js";import{FeatureSourceEventLog as O}from"./features/FeatureSourceEventLog.js";import{CatalogFootprintLayerAdapter as L}from"./features/layerAdapters/CatalogFootprintLayerAdapter.js";import{FeatureLayerAdapter as W}from"./features/layerAdapters/FeatureLayerAdapter.js";import{InMemoryLayerAdapter as H}from"./features/layerAdapters/InMemoryLayerAdapter.js";import{KnowledgeGraphSublayerAdapter as P}from"./features/layerAdapters/KnowledgeGraphSublayerAdapter.js";import{OGCFeatureLayerAdapter as T}from"./features/layerAdapters/OGCFeatureLayerAdapter.js";import{OrientedImageryLayerAdapter as M}from"./features/layerAdapters/OrientedImageryLayerAdapter.js";import{ParquetLayerAdapter as D}from"./features/layerAdapters/ParquetLayerAdapter.js";import{StreamLayerAdapter as N}from"./features/layerAdapters/StreamLayerAdapter.js";import{SubtypeGroupLayerAdapter as G}from"./features/layerAdapters/SubtypeGroupLayerAdapter.js";import{createComplexSymbolInstances as J}from"./features/schema/processor/symbols/ComplexSymbolSchema.js";import $ from"./support/FeatureCommandQueue.js";import{handleNoEngineError as B}from"./support/handleNoEngineError.js";import{HighlightCounter as z}from"./support/HighlightCounter.js";import{toJSONGeometryType as Z}from"./support/util.js";import{FeatureTileSubscriptionManager as K}from"../tiling/FeatureTileSubscriptionManager.js";import X from"../../layers/FeatureLayerView.js";import Y from"../../layers/LayerView.js";import ee from"../../layers/RefreshableLayerView.js";import te from"../../../geometry/Extent.js";function re(e,t){const r=new Set;return e&&e.forEach((e=>r.add(e))),t&&t.forEach((e=>r.add(e))),r.has("*")?["*"]:Array.from(r)}const ie=4294967294;let se=class extends(X(ee(R(Y)))){constructor(){super(...arguments),this._commandsQueue=new $({process:e=>{switch(e.type){case"override":return this._doOverride(e.message);case"update":return this._doUpdate();case"highlight":return this._updateHighlights()}}}),this._visibilityOverrides=new Set,this._highlightCounter=new z,this._lastAvailableFields=[],this._lastTargetState=null,this.eventLog=new O,this._sourceRefreshVersion=1,this._displayRefreshVersion=1,this._pipelineUpdating=!1,this._editUpdatingHandles=new v,this._fields=null,this._sourceUpdating=!1,this.featureEffectView=new b}destroy(){this._workerProxy?.destroy(),this._workerAttached.reject(c()),this._commandsQueue.destroy()}initialize(){this._workerAttached=d(),p(this._workerAttached.promise),this.addResolvingPromise(this._initProxy()),this.featureEffectView.featureEffect=this.featureEffect,this.featureEffectView.endTransition()}async _initProxy(){const e=this.layer;if("isTable"in e&&e.isTable)throw new o("featurelayerview:table-not-supported","table feature layer can't be displayed",{layer:e});if("mesh"===e.geometryType)throw new o("featurelayerview:geometry-type-not-supported",`Geometry type of ${e.geometryType} is not supported`,{layer:e});if(("feature"===e.type||"subtype-group"===e.type)&&!1===x(e)?.operations.supportsQuery)throw new o("featurelayerview:query-not-supported","layer view requires a layer with query capability",{layer:e});this._workerProxy&&this._workerProxy.destroy();const t=this._createClientOptions();this._workerProxy=await Q(t)}async _attachProxy(){const e={service:await this.layerAdapter.createServiceOptions(this.view),tileInfoJSON:this.view?.featuresTilingScheme?.tileInfo?.toJSON()};let t=[];Array.isArray(e.service.source)&&(t=e.service.source);try{await this._workerProxy.pipeline.onAttach(e,{transferList:t}),this._workerAttached.resolve()}catch(r){this._workerAttached.reject(c()),y(r)}}async _detachProxy(){return this._workerProxy.pipeline.onDetach()}async getWorker(){return await this._workerAttached.promise,this._workerProxy}get dataUpdating(){return this._sourceUpdating||this._editUpdatingHandles.updating}get hasAllFeatures(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllFeatures}get hasAllFeaturesInView(){return this.layer.visible&&!this.suspended&&this.eventLog.hasAllFeaturesInView}get hasFullGeometries(){return this.layer.visible&&!this.suspended&&this.eventLog.hasFullGeometries}get labelingCollisionInfos(){const e=this.layerAdapter.getLabelingDeconflictionInfo(this.view),t=this.layer.geometryType,r=!this.suspended;return e.map((({vvEvaluators:e,deconflictionEnabled:i})=>({container:this.featureContainer,vvEvaluators:e,deconflictionEnabled:i,geometryType:t,visible:r})))}get layerAdapter(){switch(this.layer.type){case"feature":return"memory"===this.layer.source.type?new H(this.layer):new W(this.layer);case"geojson":case"csv":case"wfs":return new H(this.layer);case"parquet":return new D(this.layer);case"subtype-group":return new G(this.layer);case"ogc-feature":return new T(this.layer);case"stream":return new N(this.layer);case"oriented-imagery":return new M(this.layer);case"knowledge-graph-sublayer":return new P(this.layer);case"catalog-footprint":return new L(this.layer);default:a(this.layer)}return null}get timeExtent(){return E(this.layerAdapter.timeOptions,this.view?.timeExtent,this._get("timeExtent"))}getDisplayStatistics(e,t){return this.featureContainer?.getDisplayStatistics(e,t)}async queryHeatmapStatistics(e){return(await this.getWorker()).pipeline.queryHeatmapStatistics(e)}highlight(e,t="default"){let a;e instanceof r?a=[e.getObjectId()]:"number"==typeof e||"string"==typeof e?a=[e]:s.isCollection(e)&&e.length>0?a=e.map((e=>e?.getObjectId())).toArray():Array.isArray(e)&&e.length>0&&(a="number"==typeof e[0]||"string"==typeof e[0]?e:e.map((e=>e?.getObjectId())));const o=a?.filter(i);return o?.length?(this._addHighlights(o,t),n((()=>this._removeHighlights(o,t)))):n()}getHighlightIds(){return Array.from(this._highlightCounter.ids())}hasHighlight(){return!this._highlightCounter.empty}async hitTest(e,i){const s=await this.featureContainer.hitTest(i);if(0===s.length)return null;const a=await this.getWorker(),{features:o,aggregates:n}=await a.pipeline.getDisplayFeatures(s),u=this.featureContainer.getSortKeys(s),l=({displayId:e},{displayId:t})=>u.has(e)&&u.has(t)?u.get(e)-u.get(t):e-t;return o.sort(l).reverse(),n.sort(l).reverse(),[...n.map((r=>this._createGraphicHit(e,t.fromJSON(r)))),...o.map((t=>this._createGraphicHit(e,r.fromJSON(t))))]}async queryStatistics(){const e=await this.getWorker();return B(e.pipeline.queryStatistics(),{featureCount:0,ringCount:0,vertexCount:0})}async querySummaryStatistics(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForSummaryStatistics(this._cleanUpQuery(e),s,r);return B(a,{})}async queryAggregateSummaryStatistics(e,t,r){const i={...t,scale:this.view.scale},s=(await this.getWorker()).aggregates.executeQueryForSummaryStatistics(this._cleanUpAggregateQuery(e),i,r);return B(s,{})}async queryUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForUniqueValues(this._cleanUpQuery(e),s,r);return B(a,{uniqueValueInfos:[]})}async queryAggregateUniqueValues(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForUniqueValues(this._cleanUpAggregateQuery(e),s,r);return B(a,{uniqueValueInfos:[]})}async queryClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForClassBreaks(this._cleanUpQuery(e),s,r);return B(a,{classBreakInfos:[]})}async queryAggregateClassBreaks(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForClassBreaks(this._cleanUpAggregateQuery(e),s,r);return B(a,{classBreakInfos:[]})}async queryHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.features.executeQueryForHistogram(this._cleanUpQuery(e),s,r);return B(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}async queryAggregateHistogram(e,t,r){const i=await this.getWorker(),s={...t,scale:this.view.scale},a=i.aggregates.executeQueryForHistogram(this._cleanUpAggregateQuery(e),s,r);return B(a,{bins:[],maxValue:null,minValue:null,normalizationTotal:null})}queryFeatures(e,t){return this.queryFeaturesJSON(e,t).then((e=>{const t=C.fromJSON(e);return t.features.forEach((e=>this._setLayersForFeature(e))),t}))}async queryVisibleFeatures(e,t){const r=(await this.getWorker()).pipeline.queryVisibleFeatures(this._cleanUpQuery(e),t),i=await B(r,{features:[]}),s=C.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregates(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t),i=await B(r,{features:[]}),s=I.fromJSON(i);return s.features.forEach((e=>this._setLayersForFeature(e))),s}async queryAggregateIds(e,t){const r=(await this.getWorker()).aggregates.executeQueryForIds(this._cleanUpAggregateQuery(e),t);return B(r,[])}async queryAggregateCount(e,t){const r=(await this.getWorker()).aggregates.executeQueryForCount(this._cleanUpAggregateQuery(e),t);return B(r,0)}async queryAggregateJSON(e,t){const r=(await this.getWorker()).aggregates.executeQuery(this._cleanUpAggregateQuery(e),t);return B(r,{features:[]})}async queryFeaturesJSON(e,t){const r=(await this.getWorker()).features.executeQuery(this._cleanUpQuery(e),t);return B(r,{features:[]})}async queryObjectIds(e,t){const r=(await this.getWorker()).features.executeQueryForIds(this._cleanUpQuery(e),t);return B(r,[])}async queryFeatureCount(e,t){const r=(await this.getWorker()).features.executeQueryForCount(this._cleanUpQuery(e),t);return B(r,0)}async queryExtent(e,t){const r=(await this.getWorker()).features.executeQueryForExtent(this._cleanUpQuery(e),t),i=await B(r,{count:0,extent:null});return{count:i.count,extent:te.fromJSON(i.extent)}}async queryAttributeBins(e,t){const r=(await this.getWorker()).features.executeAttributeBinsQuery(this._cleanUpAttributeBinsQuery(e),t),i=await B(r,{features:[]});return U.fromJSON(i)}async getSampleFeatures(e){return(await this.getWorker()).pipeline.getSampleFeatures(e)}setVisibility(e,t){t?this._visibilityOverrides.delete(e):this._visibilityOverrides.add(e),this._update()}update(e){if(!this._subscriptionManager)return;this.view.animation&&!this._lastTargetState&&(this._lastTargetState=e.state.clone()),!this.view.animation&&this._lastTargetState&&(this._lastTargetState=null);const t=this._subscriptionManager.update(e.targetState,this._lastTargetState);this.featureContainer.setVisibleTiles(t)}attach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.attach"),p(this._updatingHandles.addPromise(this._workerAttached.promise)),p(this._attachProxy()),this.featureContainer=new q(this),this.container.addChild(this.featureContainer),this.view.timeline.record(`${this.layer.title} (FeatureLayer) Attach`),this._subscriptionManager=new K({tileInfoView:this.view.featuresTilingScheme,updateSubscriptions:e=>{this.featureContainer.updateSubscriptions(e),p(this._updatingHandles.addPromise(this.getWorker().then((t=>t.pipeline.updateSubscriptions(e)))))},isDone:e=>this.featureContainer.isDone(e)}),this.requestUpdate(),this.addAttachHandles([f((()=>JSON.stringify({displayRefreshVersion:this._displayRefreshVersion,timeExtent:this.timeExtent,clips:this.clips,filter:this.filter,featureEffect:this.featureEffect,sourceRefreshVersion:this._sourceRefreshVersion,timeZone:this.view.timeZone,viewTimeExtent:this.view.timeExtent,effect:this.featureEffect,...this.layerAdapter.getUpdateHashProperties(this.view)})),(()=>this._update()),m),f((()=>this.updateSuspended),(e=>{e||(this._subscriptionManager.resume(),this.view.labelManager.requestUpdate())})),f((()=>this.visible),(e=>{this.view.labelManager.requestUpdate()}))]),"stream"!==this.layer.type&&"parquet"!==this.layer.type&&"catalog-footprint"!==this.layer.type&&this.addAttachHandles(this.layer.on("edits",(e=>this._editUpdatingHandles.addPromise(this._edit(e)))))}detach(){has("esri-2d-update-debug")&&console.debug("FeatureLayerView2D.detach"),this._detachProxy(),this._fields=null,this.featureContainer.destroy(),this.featureContainer=null,this._commandsQueue.clear(),this.container.removeAllChildren(),this._subscriptionManager=l(this._subscriptionManager),this._workerProxy.pipeline.onDetach(),this._workerAttached=d(),p(this._workerAttached.promise),this._lastAvailableFields=[],this._lastSchema=null}viewChange(){this.requestUpdate()}moveEnd(){this.requestUpdate()}isUpdating(){const e="renderer"in this.layer&&null!=this.layer.renderer,t=this._commandsQueue.updateTracking.updating,r=null!=this._updatingRequiredFieldsPromise,i=this.featureContainer.updatingHandles.updating,s=this.updateRequested||e&&(t||r)||i||this._pipelineUpdating||this.dataUpdating;if(has("esri-2d-log-updating")){console.log(`Updating FLV2D (${this.layer.id}): ${s}\n -> updateRequested ${this.updateRequested}\n -> hasRenderer ${e}\n -> updatingRequiredFields ${r}\n -> hasPendingCommand ${t}\n -> dataUpdating ${this.dataUpdating}\n -> processing ${this._pipelineUpdating}\n -> updatingContainer ${i}\n`);for(const e of this.featureContainer.subscriptions())console.log(` -> Tile[${e.id}] Done: ${e.done}`)}return s}_createClientOptions(){const e=this;return{get container(){return e.featureContainer},setUpdating:e=>{this._set("_pipelineUpdating",e.pipeline),this._set("_sourceUpdating",e.source)},emitEvent:e=>{this.emit(e.name,e.event)},get eventLog(){return e.eventLog},fetch:async t=>{if(has("esri-2d-stabilize-glyphs")){const r=[];for(const i of t)r.push(await e.view.stage.painter.textureManager.rasterizeItem(i));return r}return Promise.all(t.map((t=>e.view.stage.painter.textureManager.rasterizeItem(t))))},fetchDictionary:e=>Promise.all(e.map((e=>this._fetchDictionaryRequest(e))))}}async _fetchDictionaryRequest(e){try{if("subtype-group"===this.layer.type)throw new Error("InternalError: SubtypeGroupLayer does not support dictionary renderer");const t=this.layer.renderer;if(!t||"dictionary"!==t.type)throw new Error("InternalError: Expected layer to have a DictionaryRenderer");const r=this._lastSchema.processor.mesh.factory.symbology;if("dictionary"!==r.type)throw new Error("InternalError: Expected schema to be of type 'dictionary'");const i={cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,store:this.featureContainer.instanceStore,scaleExpression:r.scaleExpression};this._fields||(this._fields=this.layer.fields.map((e=>e.toJSON())));const s=r.visualVariableUniforms,a=await t.getSymbolAsync(e.feature,{fields:this._fields});if(!a||!a.data)return{type:"dictionary-response",meshes:[]};return{type:"dictionary-response",meshes:await J(a.data,{uniforms:s,path:"renderer",schemaOptions:i})}}catch(t){return{type:"dictionary-response",meshes:[]}}}_cleanUpQuery(e){const t=V.from(e)||this.createQuery();return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAttributeBinsQuery(e){const t=k.from(e);return t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference),t.toJSON()}_cleanUpAggregateQuery(e){const t=V.from(e)||this.createAggregateQuery();t.outSpatialReference||(t.outSpatialReference=this.view.spatialReference);const r=t.objectIds??[];for(const i of t.aggregateIds??[])r.push(i);return t.objectIds=r,t.aggregateIds=[],t.toJSON()}async _update(){return this._commandsQueue.push({type:"update"})}async _edit(e){if(this.updateSuspended)return void this._subscriptionManager.suspend();const t=this.layer,r=e.historicMoment?.getTime()??null,i="layerId"in t&&e.editedFeatures?.find((e=>e.layerId===t.layerId));if(i&&this._canEditByFeature(i)){const{adds:e,deletes:t,updates:s}=i.editedFeatures,a=this.layer.objectIdField,o=s.map((e=>e.current)),n=t.map((e=>"attributes"in e?{objectId:a?e.attributes[a]:null}:e)),u=await this._resolveIdenifiers(n);return this.addOverrides({added:e,updated:o,removed:u,historicMoment:r,isWeak:!0})}const[s,a,o]=await Promise.all([this._resolveIdenifiers(e.addedFeatures),this._resolveIdenifiers(e.updatedFeatures),this._resolveIdenifiers(e.deletedFeatures)]),n=[...s,...a];return this._commandsQueue.push({type:"override-by-id",updates:n,removed:o,historicMoment:r,isWeak:!0}).catch(y)}async doRefresh(e){this.attached&&(this.updateSuspended&&e||(e?this.incrementSourceRefreshVersion():this.incrementDisplayRefreshVersion()))}incrementSourceRefreshVersion(){this._sourceRefreshVersion=(this._sourceRefreshVersion+1)%ie+1}incrementDisplayRefreshVersion(){this._displayRefreshVersion=(this._displayRefreshVersion+1)%ie+1}async _resolveIdenifiers(e){const t=[],r=[];for(const a of e)null==a.objectId||-1===a.objectId?null==a.globalId?u.getLogger(this).warn("mapview-apply-edits","A feature identifier must contain either a GlobalId or ObjectId. Ignoring",{identifier:a}):r.push(a.globalId):t.push(a.objectId);const i="globalIdField"in this.layer&&this.layer.globalIdField,s=i&&this.availableFields.includes(i);if(r.length&&!s)return u.getLogger(this).error(new o("mapview-apply-edits",`Editing the specified service requires the layer's globalIdField, ${i} to be included the layer's outFields for updates to be reflected on the map`)),t;if(r.length){const e=await this._workerProxy.pipeline.getObjectIdsFromGlobalIds(r);for(const r of e)t.push(r)}return t}async addOverrides(e){const t=!1,r=!1,i=Z(this.layer.geometryType),s=this.layer.objectIdField,a=[];for(const n of e.added){const e=A(n,i,t,r,s);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.updated){const e=A(n,i,t,r,s);if(null==e.objectId)throw new o("featurelayerview:bad-override","Feature does not have an objectId",{feature:n});a.push(e)}for(const n of e.removed)if(null==n)throw new o("featurelayerview:bad-override","Tried to remove an invalid objectId",{objectId:n});return this._commandsQueue.push({type:"override",updates:a,removed:e.removed,release:[],isWeak:e.isWeak??!1,historicMoment:e.historicMoment??null})}async removeOverrides(e){for(const t of e)if(null==t)throw new o("featurelayerview:bad-override","Tried to remove an override for an invalid objectId",{objectId:t});return this._commandsQueue.push({type:"override",updates:[],removed:[],release:e,isWeak:!1,historicMoment:null})}_canEditByFeature(e){const{adds:t,updates:r}=e.editedFeatures;return t.every((e=>this.view.spatialReference.equals(e.geometry?.spatialReference)))&&r.every((e=>this.view.spatialReference.equals(e.current.geometry?.spatialReference)))}async _doUpdate(){"featureReduction"in this.layer&&this.layer.featureReduction&&this.layer.featureReduction!==this._lastFeatureReduction&&(this.layer.featureReduction=this.layer.featureReduction?.clone(),this._lastFeatureReduction=this.layer.featureReduction);try{if(await Promise.allSettled([this._updateRequiredFields(),S(this.layer)]),this.destroyed||!this.layerAdapter?.hasRequiredSupport||!this._subscriptionManager)return;const e=this.featureContainer.instanceStore;this.featureContainer.attributeView.lockTextureUploads(),e.updateStart();const t=this.featureEffect,r={store:e,cimAnalyzer:this.view.stage.cimAnalyzer,cimResourceManager:this.view.stage.painter.textureManager.resourceManager,scaleExpression:void 0},i=this._createViewSchemaConfig(),s={source:this.layerAdapter.createSourceSchema(i,this._sourceRefreshVersion),processor:await this.layerAdapter.createProcessorSchema(r,i,this._displayRefreshVersion)},a=h(this._lastSchema?.source.mutable,s.source.mutable)||h(this._lastSchema?.processor,s.processor);if(!a)return this.featureContainer.requestRender(),this.featureContainer.attributeView.unlockTextureUploads(),e.updateEnd(),void(this.featureEffectView.featureEffect=t);this._lastSchema=s,this._fields=null;const o=Math.round(performance.now());has("esri-2d-update-debug")&&console.debug(`Id[${this.layer.uid}] Version[${o}] FeatureLayerView2D._doUpdate`,{changes:a});const n=await this.getWorker();await n.pipeline.updateSchema(s,o),e.updateEnd(),this.featureEffectView.featureEffect=t,this.featureEffectView.endTransition(),this.featureContainer.restartAllAnimations(),this.featureContainer.attributeView.unlockTextureUploads(),this.featureContainer.swapRenderState(),this.featureContainer.requestRender(),has("esri-2d-update-debug")&&console.debug(`Version[${o}] FeatureLayerView2D.updateEnd`),this.requestUpdate()}catch(e){has("esri-2d-update-debug")&&console.error("Encountered an error during update",e)}}async _doOverride(e){const t=await this.getWorker();try{this.featureContainer.editStart(),await t.pipeline.onOverride(e),this.featureContainer.editEnd()}catch(r){g(r),0}}get hasFilter(){const e=this.layerAdapter.hasFilters?.(this.view)??!1;return null!=this.filter||null!=this.timeExtent||this._visibilityOverrides.size>0||e}_getEffectiveAvailableFields(e){const t=re(this._lastAvailableFields,e);return this._lastAvailableFields=t,j(this.layer.fieldsIndex,t)}_createViewSchemaConfig(){const e=[ae(this.view,this.layerAdapter,this.timeExtent,this._visibilityOverrides,this.filter),this.featureEffect?.filter?.toJSON()??null];return{availableFields:this._getEffectiveAvailableFields(this.availableFields),filters:e,scale:this.view.scale,timeZone:this.view.timeZone,timeExtent:this.view.timeExtent}}_addHighlights(e,t){this._highlightCounter.addGroup(e,t),this._commandsQueue.push({type:"highlight"})}_removeHighlights(e,t){this._highlightCounter.deleteGroup(e,t),this._commandsQueue.push({type:"highlight"})}async _updateHighlights(){const e=[];for(const i of this._highlightCounter.ids()){const t=this._highlightCounter.getHighlightGroups(i),r=this._getHighlightBits(t);e.push({objectId:i,highlightFlags:r})}const t=await this.getWorker();if(this.destroyed)return;const r=t.pipeline.updateHighlight({highlights:e}).catch((e=>{g(e)||u.getLogger(this).error(e)}));this._updatingHandles.addPromise(r)}_setLayersForFeature(e){e.layer=e.sourceLayer=this.layer,this.layerAdapter.setGraphicOrigin&&this.layerAdapter.setGraphicOrigin(e)}_createGraphicHit(e,t){return this._setLayersForFeature(t),null!=t.geometry&&(t.geometry.spatialReference=this.view.spatialReference),{type:"graphic",graphic:t,layer:this.layer,mapPoint:e}}};function ae(e,t,r,i,s){s&&(s=s.clone());const a=null!=s?s.timeExtent:null,o=null!=r&&null!=a?r.intersection(a):r||a;o&&(s??=new F,s.timeExtent=o),s=t.addFilters?.(s,e)??s;let n=s?.toJSON()??null;return i.size&&(n??=(new F).toJSON(),n.hiddenIds=Array.from(i)),n}e([w()],se.prototype,"_commandsQueue",void 0),e([w()],se.prototype,"_sourceRefreshVersion",void 0),e([w()],se.prototype,"_displayRefreshVersion",void 0),e([w({readOnly:!0})],se.prototype,"_pipelineUpdating",void 0),e([w()],se.prototype,"_sourceUpdating",void 0),e([w({readOnly:!0})],se.prototype,"dataUpdating",null),e([w({readOnly:!0})],se.prototype,"hasAllFeatures",null),e([w({readOnly:!0})],se.prototype,"hasAllFeaturesInView",null),e([w({readOnly:!0})],se.prototype,"hasFullGeometries",null),e([w()],se.prototype,"featureEffectView",void 0),e([w()],se.prototype,"labelingCollisionInfos",null),e([w()],se.prototype,"layerAdapter",null),e([w({readOnly:!0})],se.prototype,"timeExtent",null),e([w()],se.prototype,"updating",void 0),se=e([_("esri.views.2d.layers.FeatureLayerView2D")],se);const oe=se;export{oe as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{toUnit as n}from"../../../../core/quantityUtils.js";import{adaptiveVerticalLengthUnit as r,adaptiveLengthUnit as i}from"../../../../core/unitUtils.js";import{fromRotation as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{c as s,b as d,a as l,I as c,f as u,y as m,t as p,e as S,n as g,k as f}from"../../../../chunks/vec32.js";import{create as v,ZEROS as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Axis as A}from"../../../../geometry/support/Axis.js";import{sv3d as P}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{clonePoint as E}from"../../../../layers/graphics/hydratedFeatures.js";import{EuclideanSegment as j}from"../../interactive/visualElements/support/Segment.js";import{autoDistanceBetweenPoints2D as x}from"../../../support/automaticLengthMeasurementUtils.js";import{euclideanDirectDistance as h,euclideanDirectDistanceBetweenPoints as H}from"../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistanceThreshold as T}from"../../../support/geodesicMeasurementUtils.js";function C(t,o,a){if(null==t)return null;let s;if(o===e.Horizontal)s=x(t.elevationAlignedStartPoint,t.elevationAlignedEndPoint);else{const{startRenderSpace:e,endRenderSpace:n}=t.dimensionSegment;s=h(e,n,t.spatialReference)}if(null==s)return null;const d=o===e.Vertical?r(s.value,s.unit,a):i(s.value,s.unit,a);return n(s,d)}function U(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,dimension:{offset:r,measureType:i,orientation:o}}=e;return{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o}}function w({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o},a,d=null){if(null==t||null==n)return null;const l=V(d?.directSegment??new j,{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n},a),c=d?.primaryOffsetAxis??v();B(c,{measureType:i,elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,directSegment:l,orientation:o,renderCoordsHelper:a});const u=d?.dimensionSegment??new j;return Y({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n})&&i===e.Vertical?(s(u.startRenderSpace,l.startRenderSpace),s(u.endRenderSpace,l.endRenderSpace)):G(u,{offsetAxis:c,offset:r,relativeToSegment:l,renderCoordsHelper:a}),{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,directSegment:l,dimensionSegment:u,primaryOffsetAxis:c,spatialReference:a.spatialReference}}function z(e,t,n,r){return t===b.Start?(s(e.startRenderSpace,n.startRenderSpace),s(e.endRenderSpace,r.startRenderSpace)):(s(e.startRenderSpace,n.endRenderSpace),s(e.endRenderSpace,r.endRenderSpace)),e}var b;function k(e,t,n,r){d(e.startRenderSpace,t.startRenderSpace,n,r),d(e.endRenderSpace,t.endRenderSpace,n,r)}function M(t,n,r,i){switch(n){case e.Direct:return V(t,r,i);case e.Horizontal:case e.Vertical:{const{elevationAlignedStartPoint:o,elevationAlignedEndPoint:a,dimension:s,geometry:d}=r;let l;if(s.measureType===e.Direct){l=D(d,i)===o.z>a.z,n===e.Horizontal&&(l=!l)}else l=!I(d);const[c,u]=l?[o,a]:[a,o],m=E(u,O);return n===e.Horizontal?m.z=c.z:(m.x=c.x,m.y=c.y),i.toRenderCoords(c,t.startRenderSpace),i.toRenderCoords(m,t.endRenderSpace),t}}}function V(e,t,n){return n.toRenderCoords(t.elevationAlignedStartPoint,e.startRenderSpace),n.toRenderCoords(t.elevationAlignedEndPoint,e.endRenderSpace),e}function D(e,t){const n=e.directSegment.eval(.5,P.get()),r=t.worldUpAtPosition(n,P.get()),i=e.dimensionSegment.eval(.5,P.get()),o=l(P.get(),i,n);return!c(o,R)&&u(o,r)>0}function I(e){const{startRenderSpace:t,endRenderSpace:n}=e.dimensionSegment,{startRenderSpace:r,endRenderSpace:i}=e.directSegment;return m(r,t)<m(i,n)}!function(e){e[e.Start=0]="Start",e[e.End=1]="End"}(b||(b={}));const O=y(0,0,0,null);function L(e,t,n,r){const{directSegment:i}=n,o=B(P.get(),{measureType:t,directSegment:i,renderCoordsHelper:r}),a=G(q,{offsetAxis:o,offset:0,relativeToSegment:i,renderCoordsHelper:r}).eval(.5,P.get()),s=l(P.get(),e,a);return u(s,o)*r.unitInMeters}const q=new j;function B(n,r){const{measureType:i,elevationAlignedStartPoint:a,elevationAlignedEndPoint:d,directSegment:{startRenderSpace:m,endRenderSpace:f},directSegment:v,renderCoordsHelper:y}=r,E=v.eval(.5,P.get()),j=y.worldUpAtPosition(E,P.get()),x=y.worldBasisAtPosition(E,A.Y,P.get());switch(i){case e.Horizontal:s(n,j);break;case e.Vertical:u(m,j)<u(f,j)?l(n,f,m):l(n,m,f),S(n,n,j),S(n,n,j);break;case e.Direct:{const e=r.orientation??0;if(Y({elevationAlignedStartPoint:a,elevationAlignedEndPoint:d}))o(F,-t(e),j),p(n,x,F);else{const r=l(P.get(),f,m),i=S(P.get(),r,j);S(i,i,r),o(F,t(e),r),p(n,i,F)}break}}return c(n,R)?s(n,x):g(n,n)}const F=a();function Y({elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}){return null!=e&&null!=t&&e.x===t.x&&e.y===t.y}function G(e,t){const{offsetAxis:n,offset:r,relativeToSegment:{startRenderSpace:i,endRenderSpace:o},relativeToSegment:a,renderCoordsHelper:s}=t,l=r/s.unitInMeters,[c,u]=J(i,o,n,l);return d(e.startRenderSpace,a.startRenderSpace,n,c),d(e.endRenderSpace,a.endRenderSpace,n,u),e}function J(e,t,n,r=0){const i=u(t,n),o=u(e,n),a=Math.abs(i-o)+r;return i>o?[a,r]:[r,a]}function K(e,t,n){const r=t.directSegment.eval(.5,P.get());return n.worldUpAtPosition(r,e)}function N(e,t){const{startRenderSpace:n,endRenderSpace:r}=t.directSegment;return l(e,r,n)}function Q(e,t,n={invert:!1}){const{startRenderSpace:r,endRenderSpace:i}=t.dimensionSegment;return n.invert?l(e,r,i):l(e,i,r)}function W(e,t){const n=e.directSegment.eval(.5,P.get());return t.headingAtPosition(n,e.primaryOffsetAxis)}function X(e,t){return f(Q(Z,e))/t**2}const Z=v();function $(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:r}=e;if(null==t||null==r)return!1;const i=H(t,r);return null!=i&&n(i,"meters").value>T}function _(e){return null!=e.geometry}export{b as OffsetSegmentLocation,Y as arePointsVerticallyAligned,U as computationToGeometryDependencies,w as computeGeometryFromDimension,C as computeLength,B as computeOffsetAxis,L as computeOffsetForPoint,M as computeSegmentForMeasureType,z as computeSpanningSegment,Q as dimensionStartToEnd,N as directStartToEnd,K as directUp,W as headingFromGeometry,$ as isGeodesicDimension,_ as isValidComputation,X as maxScreenLengthSquaredFromGeometry,k as offsetSegment};
5
+ import{LengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{toUnit as n}from"../../../../core/quantityUtils.js";import{adaptiveVerticalLengthUnit as r,adaptiveLengthUnit as i}from"../../../../core/unitUtils.js";import{fromRotation as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{c as s,b as d,a as c,I as l,f as u,y as p,t as m,e as S,n as g,k as f}from"../../../../chunks/vec32.js";import{create as v,ZEROS as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Axis as A}from"../../../../geometry/support/Axis.js";import{sv3d as P}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{clonePoint as h}from"../../../../layers/graphics/hydratedFeatures.js";import{EuclideanSegment as E}from"../../interactive/visualElements/support/Segment.js";import{autoDistanceBetweenPoints2D as j}from"../../../support/automaticLengthMeasurementUtils.js";import{euclideanDirectDistance as x,euclideanDirectDistanceBetweenPoints as w}from"../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistanceThreshold as U}from"../../../support/geodesicMeasurementUtils.js";class z{constructor(e,t,n,r,i,o){this.elevationAlignedStartPoint=e,this.elevationAlignedEndPoint=t,this.directSegment=n,this.dimensionSegment=r,this.primaryOffsetAxis=i,this.spatialReference=o}}function b(t,o,a){if(null==t)return null;let s;if(o===e.Horizontal)s=j(t.elevationAlignedStartPoint,t.elevationAlignedEndPoint);else{const{startRenderSpace:e,endRenderSpace:n}=t.dimensionSegment;s=x(e,n,t.spatialReference)}if(null==s)return null;const d=o===e.Vertical?r(s.value,s.unit,a):i(s.value,s.unit,a);return n(s,d)}function H(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,dimension:{offset:r,measureType:i,orientation:o}}=e;return{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o}}function C({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,offset:r,measureType:i,orientation:o},a,d=null){if(null==t||null==n)return null;const c=D(d?.directSegment??new E,{elevationAlignedStartPoint:t,elevationAlignedEndPoint:n},a),l=d?.primaryOffsetAxis??v();F(l,{measureType:i,elevationAlignedStartPoint:t,elevationAlignedEndPoint:n,directSegment:c,orientation:o,renderCoordsHelper:a});const u=d?.dimensionSegment??new E;return G({elevationAlignedStartPoint:t,elevationAlignedEndPoint:n})&&i===e.Vertical?(s(u.startRenderSpace,c.startRenderSpace),s(u.endRenderSpace,c.endRenderSpace)):J(u,l,r,c,a),new z(t,n,c,u,l,a.spatialReference)}function T(e,t,n,r){return t===k.Start?(s(e.startRenderSpace,n.startRenderSpace),s(e.endRenderSpace,r.startRenderSpace)):(s(e.startRenderSpace,n.endRenderSpace),s(e.endRenderSpace,r.endRenderSpace)),e}var k;function M(e,t,n,r){d(e.startRenderSpace,t.startRenderSpace,n,r),d(e.endRenderSpace,t.endRenderSpace,n,r)}function V(t,n,r,i){switch(n){case e.Direct:return D(t,r,i);case e.Horizontal:case e.Vertical:{const{elevationAlignedStartPoint:o,elevationAlignedEndPoint:a,dimension:s,geometry:d}=r;let c;if(s.measureType===e.Direct){c=I(d,i)===o.z>a.z,n===e.Horizontal&&(c=!c)}else c=!O(d);const[l,u]=c?[o,a]:[a,o],p=h(u,L);return n===e.Horizontal?p.z=l.z:(p.x=l.x,p.y=l.y),i.toRenderCoords(l,t.startRenderSpace),i.toRenderCoords(p,t.endRenderSpace),t}}}function D(e,t,n){return n.toRenderCoords(t.elevationAlignedStartPoint,e.startRenderSpace),n.toRenderCoords(t.elevationAlignedEndPoint,e.endRenderSpace),e}function I(e,t){const n=e.directSegment.eval(.5,P.get()),r=t.worldUpAtPosition(n,P.get()),i=e.dimensionSegment.eval(.5,P.get()),o=c(P.get(),i,n);return!l(o,R)&&u(o,r)>0}function O(e){const{startRenderSpace:t,endRenderSpace:n}=e.dimensionSegment,{startRenderSpace:r,endRenderSpace:i}=e.directSegment;return p(r,t)<p(i,n)}!function(e){e[e.Start=0]="Start",e[e.End=1]="End"}(k||(k={}));const L=y(0,0,0,null);function q(e,t,n,r){const{directSegment:i}=n,o=F(P.get(),{measureType:t,directSegment:i,renderCoordsHelper:r}),a=J(B,o,0,i,r).eval(.5,P.get()),s=c(P.get(),e,a);return u(s,o)*r.unitInMeters}const B=new E;function F(n,r){const{measureType:i,elevationAlignedStartPoint:a,elevationAlignedEndPoint:d,directSegment:{startRenderSpace:p,endRenderSpace:f},directSegment:v,renderCoordsHelper:y}=r,h=v.eval(.5,P.get()),E=y.worldUpAtPosition(h,P.get()),j=y.worldBasisAtPosition(h,A.Y,P.get());switch(i){case e.Horizontal:s(n,E);break;case e.Vertical:u(p,E)<u(f,E)?c(n,f,p):c(n,p,f),S(n,n,E),S(n,n,E);break;case e.Direct:{const e=r.orientation??0;if(G({elevationAlignedStartPoint:a,elevationAlignedEndPoint:d}))o(Y,-t(e),E),m(n,j,Y);else{const r=c(P.get(),f,p),i=S(P.get(),r,E);S(i,i,r),o(Y,t(e),r),m(n,i,Y)}break}}return l(n,R)?s(n,j):g(n,n)}const Y=a();function G({elevationAlignedStartPoint:e,elevationAlignedEndPoint:t}){return null!=e&&null!=t&&e.x===t.x&&e.y===t.y}function J(e,t,n,r,i){const{startRenderSpace:o,endRenderSpace:a}=r,s=n/i.unitInMeters,[c,l]=K(o,a,t,s);return d(e.startRenderSpace,r.startRenderSpace,t,c),d(e.endRenderSpace,r.endRenderSpace,t,l),e}function K(e,t,n,r=0){const i=u(t,n),o=u(e,n),a=Math.abs(i-o)+r;return i>o?[a,r]:[r,a]}function N(e,t,n){const r=t.directSegment.eval(.5,P.get());return n.worldUpAtPosition(r,e)}function Q(e,t){const{startRenderSpace:n,endRenderSpace:r}=t.directSegment;return c(e,r,n)}function W(e,t,n={invert:!1}){const{startRenderSpace:r,endRenderSpace:i}=t.dimensionSegment;return n.invert?c(e,r,i):c(e,i,r)}function X(e,t){const n=e.directSegment.eval(.5,P.get());return t.headingAtPosition(n,e.primaryOffsetAxis)}function Z(e,t){return f(W($,e))/t**2}const $=v();function _(e){const{elevationAlignedStartPoint:t,elevationAlignedEndPoint:r}=e;if(null==t||null==r)return!1;const i=w(t,r);return null!=i&&n(i,"meters").value>U}function ee(e){return null!=e.geometry}export{z as LengthDimensionGeometry,k as OffsetSegmentLocation,G as arePointsVerticallyAligned,H as computationToGeometryDependencies,C as computeGeometryFromDimension,b as computeLength,F as computeOffsetAxis,q as computeOffsetForPoint,V as computeSegmentForMeasureType,T as computeSpanningSegment,W as dimensionStartToEnd,Q as directStartToEnd,N as directUp,X as headingFromGeometry,_ as isGeodesicDimension,ee as isValidComputation,Z as maxScreenLengthSquaredFromGeometry,M as offsetSegment};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.32/esri/copyright.txt for details.
4
4
  */
5
- import{_ as i}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{createTask as a}from"../../../../core/asyncUtils.js";import{cyclicalDegrees as o,Cyclical as n}from"../../../../core/Cyclical.js";import{handlesGroup as s}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{deg2rad as r}from"../../../../core/mathUtils.js";import{abortMaybe as l,destroyMaybe as p}from"../../../../core/maybe.js";import{after as h,throwIfAborted as u}from"../../../../core/promiseUtils.js";import{watch as c,syncAndInitial as d,initial as v}from"../../../../core/reactiveUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as g,H as M,f as _}from"../../../../chunks/vec32.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProjectWithZConversion as w}from"../../../../geometry/projection.js";import{viewingModeFromString as O}from"../../../ViewingMode.js";import{FieldOfViewManipulation as V,isSideHorizontal as y,flipSide as D}from"./FieldOfViewManipulation.js";import{ScaleOrientManipulation as T}from"./ScaleOrientManipulation.js";import{viewshedToolManipulatorConfiguration as H}from"./ViewshedConfiguration.js";import{ViewshedObserverManipulator as j}from"./viewshedToolManipulatorUtils.js";import{discRadiusSmall as C}from"../../interactive/editingTools/manipulations/config.js";import{MoveManipulation as F}from"../../interactive/editingTools/manipulations/MoveManipulation.js";import{resetProperties as S,dragManipulatedObject as P}from"../../../interactive/dragEventPipeline.js";import{EditGeometryOperations as k}from"../../../interactive/editGeometry/EditGeometryOperations.js";const E=Symbol("dragHandles"),x=Symbol("hideManipulators"),A=Symbol("hideFoVManipulators"),z=Symbol("hideObserverManipulator");let U=class extends e{constructor(i){super(i),this._moveManipulation=null,this._observerManipulator=null,this._fieldOfViewManipulation=null,this._scaleOrientManipulation=null,this._forceHoveringTask=null,this._forceHoveringTestPromise=null,this._grabbing=!1,this.viewshedComputedData=null}initialize(){this._moveManipulation=this._createMoveManipulation(),this._fieldOfViewManipulation=new V({view:this.view,tool:this.parentTool}),this._scaleOrientManipulation=new T({view:this.view,tool:this.parentTool}),this._observerManipulator=new j(this.view,this.parentTool),this.addHandles([c((()=>this.viewshedComputedData?.observerRenderSpace),(i=>{null!=i&&(this._moveManipulation.renderLocation=i,this._observerManipulator.renderLocation=i)}),d),c((()=>this.viewshedComputedData?.heading),(i=>{i&&(this._moveManipulation.angle=r(90-i))}),v),c((()=>{const{viewshedComputedData:i}=this;return{viewshedComputedData:i,observer:i?.observer}}),(({viewshedComputedData:i,observer:e},a)=>{this._grabbing&&e!==a?.observer||(this.removeHandles(E),i?.isValid()&&this.addHandles([this._buildObserverDragPipeline(i),this._buildFOVDragPipeline(i),this._buildScaleOrientDragPipeline(i)].filter(t),E))}),v),c((()=>{const i=this.viewshedComputedData;return i?.isValid()?{viewshedCompData:i,target:i.targetRenderSpace,hFOV:i.horizontalFieldOfView,vFOV:i.verticalFieldOfView}:null}),(i=>{null!=i&&this._fieldOfViewManipulation.updateManipulatorsTransform(i.viewshedCompData)}),v),c((()=>{const i=this.viewshedComputedData;return i?.isValid()?{viewshedCompData:i,hFOV:i.horizontalFieldOfView,vFOV:i.verticalFieldOfView,tilt:i.tilt}:null}),(i=>{null!=i&&this._fieldOfViewManipulation.updateManipulatorVisuals(i.viewshedCompData)}),v),c((()=>{const i=this.analysisViewData.visible&&(this.viewshedComputedData?.isValid()??!1),e=this.parentTool.selectedViewshedComputedData===this.viewshedComputedData;return{fovManipulationAvailable:i&&!this.parentTool.isPlacingTarget,nonFOVManipulationAvailable:i&&(!this.parentTool.creating||e)}}),(({fovManipulationAvailable:i,nonFOVManipulationAvailable:e})=>{this._moveManipulation.available=e,this._scaleOrientManipulation.available=e,this._observerManipulator.available=e,this._fieldOfViewManipulation.available=i}),v),c((()=>{const i=this.viewshedComputedData;if(!i?.isValid())return null;const{observer:e,target:t,verticalFieldOfView:a,horizontalFieldOfView:o}=i;return{viewshedCompData:i,observer:e,target:t,verticalFieldOfView:a,horizontalFieldOfView:o}}),(i=>{null!=i&&this._scaleOrientManipulation.updateManipulators(i.viewshedCompData)}),v)]);const i=i=>{const e=this.analysisViewData;this.addHandles([i.events.on("focus-changed",(()=>{const i=this._someManipulatorHovering();i&&this.parentTool.subToolHandles.forEach((({subTool:i})=>{i._resetHoveringTask()})),this._someManipulatorSelected()||i||(this._forceHoveringTask=a((async i=>{await(this._forceHoveringTestPromise??h(H.hoverTimeoutMilliseconds,i)),u(i),this._forceHoveringTask=null,this._updateManipulatorVisibility()})))})),i.events.on("grab-changed",(t=>{this._grabbing="start"===t.action,"end"===t.action&&e.tool?.updateInteractionVisualsVisibility(),this.parentTool.subToolHandles.forEach((({subTool:i})=>{i!==this&&i._setInteractive(!this._grabbing)})),this._setInteractive((e=>e.hasManipulator(i)||!this._grabbing))})),i.events.on("drag",(i=>{"start"===i.action&&e.tool?.updateInteractionVisualsVisibility()}))])};this._forEachManipulator(i)}destroy(){this._forceHoveringTask=l(this._forceHoveringTask),this._moveManipulation=p(this._moveManipulation),this._fieldOfViewManipulation=p(this._fieldOfViewManipulation),this._scaleOrientManipulation=p(this._scaleOrientManipulation),this.parentTool.manipulators.remove(this._observerManipulator),this._observerManipulator=p(this._observerManipulator)}get viewshed(){return this.viewshedComputedData?.viewshed}get grabbing(){return this._grabbing}get observer(){return this.viewshed?.observer}set observer(i){const e=this.viewshed;null!=e&&(e.observer=i)}get discManipulator(){return this._moveManipulation.xyManipulation.discManipulator}get moveInteractionState(){const{dragging:i,grabbing:e}=this._moveManipulation;return{dragging:i,grabbing:e}}get scaleOrientInteractionState(){const{dragging:i,grabbing:e}=this._scaleOrientManipulation;return{dragging:i,grabbing:e}}_setInteractive(i){const e="boolean"==typeof i;this._forEachManipulation((t=>t.interactive=e?i:i(t)))}onManipulatorSelectionChanged(){if(this._updateManipulatorVisibility(),!this._someManipulatorSelected()){this.analysisViewData.selectedViewshed===this.viewshed&&(this.analysisViewData.selectedViewshed=null),this._resetHoveringTask()}}hasManipulator(i){let e=!1;return this._forEachManipulator((t=>{e=e||t===i})),e}_someManipulatorSelected(){return this._moveManipulation.selected||this._fieldOfViewManipulation.selected||this._scaleOrientManipulation.selected}_someManipulatorHovering(){return this._moveManipulation.hovering||this._fieldOfViewManipulation.hovering||this._scaleOrientManipulation.hovering}_createMoveManipulation(){return new F({view:this.view,tool:this.parentTool,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:C})}_buildObserverDragPipeline(i){const e={mode:"absolute-height",offset:0},t=i.observer;if(null==t)return null;const a=this.view.spatialReference;return this._moveManipulation.createDragPipeline(((i,e,o,n,s)=>{n=n.next(S(this,["observer"]));const r=w(t,a);if(null==r)return{steps:o,cancel:n};const l=k.fromGeometry(r,O(this.view.viewingMode));return{steps:o.next(P({operations:l})).next((i=>(this.observer=l.data.geometry,i))),cancel:n}}),e,a,void 0)}_buildFOVDragPipeline(i){let e=0,t=0;return this._fieldOfViewManipulation.createDragPipeline(((a,n,s)=>{if(null==i)return{steps:n,cancel:s};const r=i.viewshed;let l=null;s=s.next(S(i,["horizontalFieldOfView","verticalFieldOfView"]));return{steps:n.next((a=>{if("start"===a.action)return l=null,e=i.horizontalFieldOfView,t=i.verticalFieldOfView,a;const n=a.deltaAngle;if(null==l&&0!==n){const i="bottom"===a.side||"left"===a.side?n>0:n<0;l=y(a.side)?0===e&&i||360===e&&!i:0===t&&i}const s=l?D(a.side):a.side;let p=0;switch(s){case"left":p=e/2-n;break;case"right":p=e/2+n;break;case"top":p=t+2*n;break;case"bottom":p=t-2*n}return y(s)?(p=o.normalize(p),p=p>270?0:p>180?180:p,r.horizontalFieldOfView=2*p):r.verticalFieldOfView=p,a})),cancel:s}}),i)}_buildScaleOrientDragPipeline(i){let e=0,t=0;const a=(e,t)=>(a,o,n)=>{if(null==i)return{steps:o,cancel:n};const s=i.viewshed;return n=n.next(S(s,[e])),{steps:o=o.next(t(s,i)),cancel:n}};return s([this._scaleOrientManipulation.createHeadingDragPipeline(a("heading",((e,a)=>a=>("start"===a.action&&(t=i.heading),e.heading=o.normalize(t+a.deltaAngle),a))),i),this._scaleOrientManipulation.createTiltDragPipeline(a("tilt",((t,a)=>a=>{"start"===a.action&&(e=i.tilt);let o=e+a.deltaAngle;return o<-90?o=180:o>270&&(o=0),t.tilt=R.clamp(o),a})),i),this._scaleOrientManipulation.createDistanceDragPipeline(a("farDistance",((i,e)=>t=>{const a=g(I,t.renderEnd,e.observerRenderSpace),o=M(a)*e.metersPerUnit,n=_(a,e.targetDirection)<0?H.scaleOrientMinDistance:o;return i.farDistance=n,t})),i)])}_updateManipulatorVisibility(){const i=this._someManipulatorSelected(),e=null!=this._forceHoveringTask||this._someManipulatorHovering(),t=this._fieldOfViewManipulation.hovering,a=this.parentTool.creating;let o=[];const n=i=>{o.push(i.disableDisplay())};i||!a&&e?this.removeHandles(x):(this._scaleOrientManipulation.forEachManipulator(n),this._moveManipulation.forEachManipulator(n),this.addHandles(o,x),o=[]),i||!a&&e||a&&t?this.removeHandles(A):(this._fieldOfViewManipulation.forEachManipulator(n),this.addHandles(o,A)),i||!a?this.removeHandles(z):this.addHandles(this._observerManipulator.disableDisplay(),z)}_resetHoveringTask(){this._forceHoveringTask=l(this._forceHoveringTask),this._updateManipulatorVisibility()}_forEachManipulator(i){this._forEachManipulation((e=>{e.forEachManipulator(i)})),i(this._observerManipulator)}_forEachManipulation(i){i(this._moveManipulation),i(this._fieldOfViewManipulation),i(this._scaleOrientManipulation)}get test(){return{moveManipulation:this._moveManipulation,fieldOfViewManipulation:this._fieldOfViewManipulation,scaleOrientManipulation:this._scaleOrientManipulation,viewshedComputedData:this.viewshedComputedData,setHoveringTimeoutPromise:i=>{this._forceHoveringTestPromise=i}}}};i([m({constructOnly:!0})],U.prototype,"analysis",void 0),i([m({constructOnly:!0})],U.prototype,"analysisViewData",void 0),i([m({constructOnly:!0})],U.prototype,"parentTool",void 0),i([m({constructOnly:!0,nonNullable:!0})],U.prototype,"view",void 0),i([m()],U.prototype,"viewshed",null),i([m()],U.prototype,"_grabbing",void 0),i([m()],U.prototype,"grabbing",null),i([m()],U.prototype,"viewshedComputedData",void 0),i([m()],U.prototype,"observer",null),U=i([f("esri.views.3d.analysis.Viewshed.ViewshedSubTool")],U);const I=b(),R=new n(0,180);export{U as ViewshedSubTool};
5
+ import{_ as i}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{createTask as a}from"../../../../core/asyncUtils.js";import{cyclicalDegrees as o,Cyclical as n}from"../../../../core/Cyclical.js";import{handlesGroup as s}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{deg2rad as r}from"../../../../core/mathUtils.js";import{abortMaybe as l,destroyMaybe as p}from"../../../../core/maybe.js";import{after as h,throwIfAborted as u}from"../../../../core/promiseUtils.js";import{watch as c,syncAndInitial as d,initial as v}from"../../../../core/reactiveUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import{subclass as f}from"../../../../core/accessorSupport/decorators/subclass.js";import{a as g,H as M,f as b}from"../../../../chunks/vec32.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProjectWithZConversion as w}from"../../../../geometry/projection.js";import{viewingModeFromString as O}from"../../../ViewingMode.js";import{FieldOfViewManipulation as V,isSideHorizontal as y,flipSide as D}from"./FieldOfViewManipulation.js";import{ScaleOrientManipulation as T}from"./ScaleOrientManipulation.js";import{viewshedToolManipulatorConfiguration as H}from"./ViewshedConfiguration.js";import{ViewshedObserverManipulator as j}from"./viewshedToolManipulatorUtils.js";import{discRadiusSmall as C}from"../../interactive/editingTools/manipulations/config.js";import{MoveManipulation as F}from"../../interactive/editingTools/manipulations/MoveManipulation.js";import{resetProperties as S,dragManipulatedObject as P}from"../../../interactive/dragEventPipeline.js";import{EditGeometryOperations as k}from"../../../interactive/editGeometry/EditGeometryOperations.js";const E=Symbol("dragHandles"),x=Symbol("hideManipulators"),A=Symbol("hideFoVManipulators"),z=Symbol("hideObserverManipulator");let U=class extends e{constructor(i){super(i),this._moveManipulation=null,this._observerManipulator=null,this._fieldOfViewManipulation=null,this._scaleOrientManipulation=null,this._forceHoveringTask=null,this._forceHoveringTestPromise=null,this._grabbing=!1,this.viewshedComputedData=null}initialize(){this._moveManipulation=this._createMoveManipulation(),this._fieldOfViewManipulation=new V({view:this.view,tool:this.parentTool}),this._scaleOrientManipulation=new T({view:this.view,tool:this.parentTool}),this._observerManipulator=new j(this.view,this.parentTool),this.addHandles([c((()=>this.viewshedComputedData?.observerRenderSpace),(i=>{null!=i&&(this._moveManipulation.renderLocation=i,this._observerManipulator.renderLocation=i)}),d),c((()=>this.viewshedComputedData?.heading),(i=>{i&&(this._moveManipulation.angle=r(90-i))}),v),c((()=>{const{viewshedComputedData:i}=this;return{viewshedComputedData:i,observer:i?.observer}}),(({viewshedComputedData:i,observer:e},a)=>{this._grabbing&&e!==a?.observer||(this.removeHandles(E),i?.isValid()&&this.addHandles([this._buildObserverDragPipeline(i),this._buildFOVDragPipeline(i),this._buildScaleOrientDragPipeline(i)].filter(t),E))}),v),c((()=>{const i=this.viewshedComputedData;return i?.isValid()?{viewshedCompData:i,target:i.targetRenderSpace,hFOV:i.horizontalFieldOfView,vFOV:i.verticalFieldOfView}:null}),(i=>{null!=i&&this._fieldOfViewManipulation.updateManipulatorsTransform(i.viewshedCompData)}),v),c((()=>{const i=this.viewshedComputedData;return i?.isValid()?{viewshedCompData:i,hFOV:i.horizontalFieldOfView,vFOV:i.verticalFieldOfView,tilt:i.tilt}:null}),(i=>{null!=i&&this._fieldOfViewManipulation.updateManipulatorVisuals(i.viewshedCompData)}),v),c((()=>{const i=this.analysisViewData.visible&&(this.viewshedComputedData?.isValid()??!1),e=this.parentTool.selectedViewshedComputedData===this.viewshedComputedData;return{fovManipulationAvailable:i&&!this.parentTool.isPlacingTarget,nonFOVManipulationAvailable:i&&(!this.parentTool.creating||e)}}),(({fovManipulationAvailable:i,nonFOVManipulationAvailable:e})=>{this._moveManipulation.available=e,this._scaleOrientManipulation.available=e,this._observerManipulator.available=e,this._fieldOfViewManipulation.available=i}),v),c((()=>{const i=this.viewshedComputedData;if(!i?.isValid())return null;const{observer:e,target:t,verticalFieldOfView:a,horizontalFieldOfView:o}=i;return{viewshedCompData:i,observer:e,target:t,verticalFieldOfView:a,horizontalFieldOfView:o}}),(i=>{null!=i&&this._scaleOrientManipulation.updateManipulators(i.viewshedCompData)}),v)]);const i=i=>{const e=this.analysisViewData;this.addHandles([i.events.on("focus-changed",(()=>{const i=this._someManipulatorHovering();i&&this.parentTool.subToolHandles.forEach((({subTool:i})=>{i._resetHoveringTask()})),this._someManipulatorSelected()||i||(this._forceHoveringTask=a((async i=>{await(this._forceHoveringTestPromise??h(H.hoverTimeoutMilliseconds,i)),u(i),this._forceHoveringTask=null,this._updateManipulatorVisibility()})))})),i.events.on("grab-changed",(t=>{this._grabbing="start"===t.action,"end"===t.action&&e.tool?.updateInteractionVisualsVisibility(),this.parentTool.subToolHandles.forEach((({subTool:i})=>{i!==this&&i._setInteractive(!this._grabbing)})),this._setInteractive((e=>e.hasManipulator(i)||!this._grabbing))})),i.events.on("drag",(i=>{"start"===i.action&&e.tool?.updateInteractionVisualsVisibility()}))])};this._forEachManipulator(i)}destroy(){this._forceHoveringTask=l(this._forceHoveringTask),this._moveManipulation=p(this._moveManipulation),this._fieldOfViewManipulation=p(this._fieldOfViewManipulation),this._scaleOrientManipulation=p(this._scaleOrientManipulation),this.parentTool.manipulators.remove(this._observerManipulator),this._observerManipulator=p(this._observerManipulator)}get viewshed(){return this.viewshedComputedData?.viewshed}get grabbing(){return this._grabbing}get observer(){return this.viewshed?.observer}set observer(i){const e=this.viewshed;null!=e&&(e.observer=i)}get discManipulator(){return this._moveManipulation.xyManipulation.discManipulator}get moveInteractionState(){const{dragging:i,grabbing:e}=this._moveManipulation;return{dragging:i,grabbing:e}}get scaleOrientInteractionState(){const{dragging:i,grabbing:e}=this._scaleOrientManipulation;return{dragging:i,grabbing:e}}_setInteractive(i){const e="boolean"==typeof i;this._forEachManipulation((t=>t.interactive=e?i:i(t)))}onManipulatorSelectionChanged(){if(this._updateManipulatorVisibility(),!this._someManipulatorSelected()){this.analysisViewData.selectedViewshed===this.viewshed&&(this.analysisViewData.selectedViewshed=null),this._resetHoveringTask()}}hasManipulator(i){let e=!1;return this._forEachManipulator((t=>{e=e||t===i})),e}_someManipulatorSelected(){return this._moveManipulation.selected||this._fieldOfViewManipulation.selected||this._scaleOrientManipulation.selected}_someManipulatorHovering(){return this._moveManipulation.hovering||this._fieldOfViewManipulation.hovering||this._scaleOrientManipulation.hovering}_createMoveManipulation(){return new F({view:this.view,tool:this.parentTool,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:C})}_buildObserverDragPipeline(i){const e={mode:"absolute-height",offset:0},t=i.observer;if(null==t)return null;const a=this.view.spatialReference;return this._moveManipulation.createDragPipeline(((i,e,o,n,s)=>{n=n.next(S(this,["observer"]));const r=w(t,a);if(null==r)return{steps:o,cancel:n};const l=k.fromGeometry(r,O(this.view.viewingMode));return{steps:o.next(P({operations:l})).next((i=>(this.observer=l.data.geometry,i))),cancel:n}}),e,a,void 0)}_buildFOVDragPipeline(i){let e=0,t=0;return this._fieldOfViewManipulation.createDragPipeline(((a,n,s)=>{if(null==i)return{steps:n,cancel:s};const r=i.viewshed;let l=null;s=s.next(S(r,["horizontalFieldOfView","verticalFieldOfView"]));return{steps:n.next((a=>{"start"===a.action&&(l=null,e=i.horizontalFieldOfView,t=i.verticalFieldOfView);const n=a.deltaAngle;if(Math.abs(n)<1)return a;if(null==l){const i="bottom"===a.side||"left"===a.side?n>0:n<0;l=y(a.side)?0===e&&i||360===e&&!i:0===t&&i}const s=l?D(a.side):a.side;let p=0;switch(s){case"left":p=e/2-n;break;case"right":p=e/2+n;break;case"top":p=t+2*n;break;case"bottom":p=t-2*n}return y(s)?(p=o.normalize(p),p=p>270?0:p>180?180:p,r.horizontalFieldOfView=2*p):r.verticalFieldOfView=p,a})),cancel:s}}),i)}_buildScaleOrientDragPipeline(i){let e=0,t=0;const a=(e,t)=>(a,o,n)=>{if(null==i)return{steps:o,cancel:n};const s=i.viewshed;return n=n.next(S(s,[e])),{steps:o=o.next(t(s,i)),cancel:n}};return s([this._scaleOrientManipulation.createHeadingDragPipeline(a("heading",((e,a)=>a=>("start"===a.action&&(t=i.heading),e.heading=o.normalize(t+a.deltaAngle),a))),i),this._scaleOrientManipulation.createTiltDragPipeline(a("tilt",((t,a)=>a=>{"start"===a.action&&(e=i.tilt);let o=e+a.deltaAngle;return o<-90?o=180:o>270&&(o=0),t.tilt=R.clamp(o),a})),i),this._scaleOrientManipulation.createDistanceDragPipeline(a("farDistance",((i,e)=>t=>{const a=g(I,t.renderEnd,e.observerRenderSpace),o=M(a)*e.metersPerUnit,n=b(a,e.targetDirection)<0?H.scaleOrientMinDistance:o;return i.farDistance=n,t})),i)])}_updateManipulatorVisibility(){const i=this._someManipulatorSelected(),e=null!=this._forceHoveringTask||this._someManipulatorHovering(),t=this._fieldOfViewManipulation.hovering,a=this.parentTool.creating;let o=[];const n=i=>{o.push(i.disableDisplay())};i||!a&&e?this.removeHandles(x):(this._scaleOrientManipulation.forEachManipulator(n),this._moveManipulation.forEachManipulator(n),this.addHandles(o,x),o=[]),i||!a&&e||a&&t?this.removeHandles(A):(this._fieldOfViewManipulation.forEachManipulator(n),this.addHandles(o,A)),i||!a?this.removeHandles(z):this.addHandles(this._observerManipulator.disableDisplay(),z)}_resetHoveringTask(){this._forceHoveringTask=l(this._forceHoveringTask),this._updateManipulatorVisibility()}_forEachManipulator(i){this._forEachManipulation((e=>{e.forEachManipulator(i)})),i(this._observerManipulator)}_forEachManipulation(i){i(this._moveManipulation),i(this._fieldOfViewManipulation),i(this._scaleOrientManipulation)}get test(){return{moveManipulation:this._moveManipulation,fieldOfViewManipulation:this._fieldOfViewManipulation,scaleOrientManipulation:this._scaleOrientManipulation,viewshedComputedData:this.viewshedComputedData,setHoveringTimeoutPromise:i=>{this._forceHoveringTestPromise=i}}}};i([m({constructOnly:!0})],U.prototype,"analysis",void 0),i([m({constructOnly:!0})],U.prototype,"analysisViewData",void 0),i([m({constructOnly:!0})],U.prototype,"parentTool",void 0),i([m({constructOnly:!0,nonNullable:!0})],U.prototype,"view",void 0),i([m()],U.prototype,"viewshed",null),i([m()],U.prototype,"_grabbing",void 0),i([m()],U.prototype,"grabbing",null),i([m()],U.prototype,"viewshedComputedData",void 0),i([m()],U.prototype,"observer",null),U=i([f("esri.views.3d.analysis.Viewshed.ViewshedSubTool")],U);const I=_(),R=new n(0,180);export{U as ViewshedSubTool};