@arcgis/core 5.1.0-next.57 → 5.1.0-next.59

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 (199) hide show
  1. package/applications/Components/SelectionOperation.d.ts +2 -2
  2. package/applications/Components/SelectionOperation.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/04ea806b933d4dd41609.js +1 -0
  5. package/assets/esri/core/workers/chunks/{278eecd729bed2832702.js → 0622e238693c257abacb.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{05bc675c029ed311427f.js → 155c741a9839d24f04a2.js} +1 -1
  7. package/assets/esri/core/workers/chunks/1ae4e43a399e1974f106.js +1 -0
  8. package/assets/esri/core/workers/chunks/1f8e22df08c2f5fbb8c8.js +1 -0
  9. package/assets/esri/core/workers/chunks/{2327b368673a974dee8b.js → 2339465190c9d5ede25f.js} +1 -1
  10. package/assets/esri/core/workers/chunks/23f6d24bf850bc3280ec.js +1 -0
  11. package/assets/esri/core/workers/chunks/2541ac6e0ed1184edc9b.js +1 -0
  12. package/assets/esri/core/workers/chunks/34207774bc371e95ba3c.js +1 -0
  13. package/assets/esri/core/workers/chunks/{01777e91cd4e0bf04fd0.js → 35217befc8f9882d139e.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{40bcfc4f8efe7de7ec9d.js → 3de17e89973160b42923.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{992e74570b76f3f9e52e.js → 48d289db3145ce6c02bb.js} +1 -1
  16. package/assets/esri/core/workers/chunks/4c73c2f4331351e2a50c.js +1 -0
  17. package/assets/esri/core/workers/chunks/{2757cf54656b5d318b11.js → 55a0b69cf034ac32fc25.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{4d54beab8ae5ff31e7b0.js → 5a9f5a49dc68b42762bb.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{7cec3252e3ee56424b9e.js → 5c6e5f22450dd0583074.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{b39b4db86a1049f0b901.js → 6be9d00839002f24fafd.js} +1 -1
  21. package/assets/esri/core/workers/chunks/6c886f19875291d02407.js +1 -0
  22. package/assets/esri/core/workers/chunks/75e28458e08b0738b35a.js +2 -0
  23. package/assets/esri/core/workers/chunks/{c460ca93ed8e20d8b53a.js → 86a6dd19903fa5023cc7.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{4afddb66242438b38df0.js → 8ccf2f65d8ed3c48ffff.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{fcfaaced184f8da3e28d.js → 9b53aa2429573f1b977f.js} +1 -1
  26. package/assets/esri/core/workers/chunks/9d580b5bcd59857a5702.js +1405 -0
  27. package/assets/esri/core/workers/chunks/a37697ef360e2425768a.js +1 -0
  28. package/assets/esri/core/workers/chunks/{a787fe09d3df9d4254ba.js → ab3183f2327ff26e2b45.js} +1 -1
  29. package/assets/esri/core/workers/chunks/b0f2ce61d3cad413898e.js +1 -0
  30. package/assets/esri/core/workers/chunks/{53c149bca42595b7dd1e.js → bbdf27bc34fadbe8e6fe.js} +1 -1
  31. package/assets/esri/core/workers/chunks/be42fe0b7ba0e27030b2.js +1 -0
  32. package/assets/esri/core/workers/chunks/d0c3ab70f390cd579fed.js +1 -0
  33. package/assets/esri/core/workers/chunks/{5a573fa1012092328b88.js → d816d1a4220d827faf63.js} +1 -1
  34. package/assets/esri/core/workers/chunks/e26894655823849947f4.js +1 -0
  35. package/assets/esri/core/workers/chunks/e59f5dc8c85bcea66e98.js +1 -0
  36. package/assets/esri/core/workers/chunks/{ccf845ac0ac354507a25.js → ec1b2eb05410848081c9.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{851dd71d28681d4eccfd.js → f7af90c5f9d371eb7009.js} +1 -1
  38. package/assets/esri/core/workers/chunks/fa6e1ad099b43a6f5501.js +1 -0
  39. package/assets/esri/core/workers/chunks/{4a6186001323b47c23a4.js → fee1d873127dca02459f.js} +1 -1
  40. package/chunks/GlobalIllumination.glsl.js +101 -0
  41. package/chunks/GlobalIlluminationBlur.glsl.js +68 -0
  42. package/chunks/ScreenSpaceShadowHighlight.glsl.js +6 -0
  43. package/chunks/ShadowCastAccumulate.glsl.js +1 -1
  44. package/chunks/ShadowHighlight.glsl.js +15 -8
  45. package/config.js +1 -1
  46. package/geometry/Mesh.js +1 -1
  47. package/geometry/support/polygonUtils.js +1 -1
  48. package/geometry/support/{triangulationUtils.js → triangulationUtilsDeprecated.js} +1 -1
  49. package/kernel.js +1 -1
  50. package/layers/support/SceneModification.js +1 -1
  51. package/networks/support/jsonTypes.d.ts +6 -0
  52. package/package.json +2 -2
  53. package/renderers/ClassBreaksRenderer.js +1 -1
  54. package/renderers/DictionaryRenderer.js +1 -1
  55. package/renderers/DotDensityRenderer.js +1 -1
  56. package/renderers/HeatmapRenderer.js +1 -1
  57. package/renderers/PieChartRenderer.js +1 -1
  58. package/renderers/Renderer.js +1 -1
  59. package/renderers/SimpleRenderer.js +1 -1
  60. package/renderers/UniqueValueRenderer.js +1 -1
  61. package/renderers/support/AttributeColorInfo.js +1 -1
  62. package/renderers/support/ClassBreakInfo.d.ts +6 -0
  63. package/renderers/support/ClassBreakInfo.js +1 -1
  64. package/renderers/support/UniqueValueClass.d.ts +12 -0
  65. package/renderers/support/UniqueValueClass.js +1 -1
  66. package/renderers/support/UniqueValueInfo.d.ts +12 -0
  67. package/renderers/support/UniqueValueInfo.js +1 -1
  68. package/renderers/visualVariables/ColorVariable.js +1 -1
  69. package/renderers/visualVariables/OpacityVariable.js +1 -1
  70. package/renderers/visualVariables/SizeVariable.js +1 -1
  71. package/renderers/visualVariables/VisualVariable.js +1 -1
  72. package/rest/networks/support/FunctionResult.d.ts +6 -0
  73. package/rest/networks/support/FunctionResult.js +1 -1
  74. package/support/revision.js +1 -1
  75. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  76. package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
  77. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  78. package/views/2d/engine/webgl/GlyphSource.js +1 -1
  79. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  80. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  81. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  82. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  83. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
  84. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  85. package/views/2d/engine/webgl/util/IntervalMatcher.js +1 -1
  86. package/views/2d/engine/webgl/util/MapMatcher.js +1 -1
  87. package/views/2d/layers/features/schema/processor/MatcherSchema.js +1 -1
  88. package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
  89. package/views/3d/FocusAreasView.js +1 -1
  90. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  91. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  92. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  93. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  94. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  95. package/views/3d/layers/Lyr3DWorker.js +1 -1
  96. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  97. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  98. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  99. package/views/3d/layers/graphics/extrudeUtils.js +1 -1
  100. package/views/3d/layers/graphics/extrudeUtilsDeprecated.js +2 -0
  101. package/views/3d/layers/graphics/tessellationUtils.js +2 -0
  102. package/views/3d/layers/i3s/PointCloudHighlights.js +1 -1
  103. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  104. package/views/3d/layers/i3s/PointCloudRendererNode.js +1 -1
  105. package/views/3d/layers/support/Tiles3DBVH.js +1 -1
  106. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  107. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  108. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  109. package/views/3d/support/renderInfoUtils/line.js +1 -1
  110. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  111. package/views/3d/support/renderInfoUtils/polygonDeprecated.js +2 -0
  112. package/views/3d/terrain/OverlayRenderer.js +1 -1
  113. package/views/3d/terrain/TerrainRenderer.js +1 -1
  114. package/views/3d/terrain/TerrainSurface.js +1 -1
  115. package/views/3d/webgl/RenderNode.js +1 -1
  116. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  117. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  118. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  119. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  120. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  121. package/views/3d/webgl-engine/collections/Component/RenderGeometry.js +1 -1
  122. package/views/3d/webgl-engine/collections/Component/RenderSubmitSystem.js +1 -1
  123. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  124. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  125. package/views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js +6 -5
  126. package/views/3d/webgl-engine/core/shaderLibrary/output/ReadDepthLastFrame.glsl.js +4 -0
  127. package/views/3d/webgl-engine/core/shaderLibrary/shading/EncodingColor.glsl.js +7 -0
  128. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js +6 -6
  129. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +93 -72
  130. package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +46 -22
  131. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadGlobalIllumination.glsl.js +20 -0
  132. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +18 -13
  133. package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +23 -9
  134. package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterColor.glsl.js +1 -1
  135. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +1 -1
  136. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  137. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  138. package/views/3d/webgl-engine/effects/emissive/emissions.js +2 -0
  139. package/views/3d/webgl-engine/effects/globalIllumination/BlueNoise.js +2 -0
  140. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +2 -0
  141. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlurTechnique.js +2 -0
  142. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechnique.js +2 -0
  143. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +2 -0
  144. package/views/3d/webgl-engine/effects/highlight/ScreenSpaceShadowHighlight.glsl.js +2 -0
  145. package/views/3d/webgl-engine/effects/highlight/ScreenSpaceShadowHighlightRenderNode.js +2 -0
  146. package/views/3d/webgl-engine/effects/highlight/ScreenSpaceShadowHighlightTechnique.js +2 -0
  147. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  148. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  149. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  150. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  151. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  152. package/views/3d/webgl-engine/lib/Material.js +1 -1
  153. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  154. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  155. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  156. package/views/3d/webgl-engine/lib/ReprojectionUniforms.js +1 -1
  157. package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
  158. package/views/3d/webgl-engine/lib/lodRendering/LodLevel.js +1 -1
  159. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  160. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  161. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  162. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  163. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  164. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  165. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  166. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  167. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  168. package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
  169. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  170. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  171. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  172. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  173. package/views/3d/webgl-engine/shaders/GlobalIllumination.glsl.js +2 -0
  174. package/views/3d/webgl-engine/shaders/GlobalIlluminationBlur.glsl.js +2 -0
  175. package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
  176. package/views/3d/webgl-engine/shaders/MeasurementArrowTechniqueConfiguration.js +1 -1
  177. package/views/3d/webgl-engine/shaders/ReceiveShadowsConfiguration.js +1 -1
  178. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  179. package/views/3d/webgl.js +1 -1
  180. package/views/selection/SelectionOperation.d.ts +190 -0
  181. package/views/selection/SelectionOperation.js +2 -0
  182. package/views/selection/types.d.ts +146 -1
  183. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  184. package/assets/esri/core/workers/chunks/009db7b459b18f6a668b.js +0 -1
  185. package/assets/esri/core/workers/chunks/0fc60b4c44c4e865b699.js +0 -2
  186. package/assets/esri/core/workers/chunks/34484afe767d60f85982.js +0 -1
  187. package/assets/esri/core/workers/chunks/55bb5b7817c2963c8bfa.js +0 -1
  188. package/assets/esri/core/workers/chunks/572fcd33ae3648ed4f9c.js +0 -1
  189. package/assets/esri/core/workers/chunks/66a4d764937918a2779f.js +0 -1
  190. package/assets/esri/core/workers/chunks/6b56c8ba978ec6edd6b8.js +0 -1
  191. package/assets/esri/core/workers/chunks/9806cc96414065ae0afe.js +0 -1
  192. package/assets/esri/core/workers/chunks/9b365a6242b0287f8727.js +0 -1
  193. package/assets/esri/core/workers/chunks/a029db48079af4b5cccd.js +0 -1
  194. package/assets/esri/core/workers/chunks/ea068f75397c3b3337ec.js +0 -1034
  195. package/assets/esri/core/workers/chunks/ec91d5081f423755cb07.js +0 -1
  196. package/assets/esri/core/workers/chunks/f9fe89ced41b49608667.js +0 -1
  197. package/assets/esri/core/workers/chunks/fce30184f354fb7d11af.js +0 -1
  198. package/widgets/support/Selector2D/SelectionOperation.js +0 -2
  199. /package/assets/esri/core/workers/chunks/{0fc60b4c44c4e865b699.js.LICENSE.txt → 75e28458e08b0738b35a.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{clone as t}from"../core/lang.js";import s from"../core/Logger.js";import{deepMerge as i}from"../core/object.js";import{watch as o}from"../core/reactiveUtils.js";import{property as l,cast as r,subclass as u}from"../core/accessorSupport/decorators.js";import{diff as n}from"../core/accessorSupport/diffUtils.js";import{ensureString as a,ensureType as p}from"../core/accessorSupport/ensureType.js";import{collectArcadeFieldNames as f,collectField as d}from"../layers/support/fieldUtils.js";import h from"../portal/Portal.js";import c from"./Renderer.js";import{VisualVariablesMixin as m}from"./mixins/VisualVariablesMixin.js";import{rendererBackgroundFillSymbolProperty as y,rendererSymbolProperty as b}from"./support/commonProperties.js";import g from"./support/RendererLegendOptions.js";import v from"./support/UniqueValue.js";import _ from"./support/UniqueValueClass.js";import V from"./support/UniqueValueGroup.js";import q from"./support/UniqueValueInfo.js";import{loadArcade as I}from"../support/loadArcade.js";import{f as S,t as w}from"../chunks/persistableUrlUtils.js";import U from"../symbols/WebStyleSymbol.js";import{fetchStyle as j}from"../symbols/support/styleUtils.js";import{ensureType as F}from"../symbols/support/typeUtils.js";import{addPropertyUnsupportedError as O}from"../webdoc/support/unsupportedErrors.js";import{enumeration as G}from"../core/accessorSupport/decorators/enumeration.js";import{writer as D}from"../core/accessorSupport/decorators/writer.js";import{reader as x}from"../core/accessorSupport/decorators/reader.js";var E;const M="uvInfos-watcher",R="uvGroups-watcher",N=",",L=p(q);function P(e){const{field1:t,field2:s,field3:i,fieldDelimiter:o,uniqueValueInfos:l,valueExpression:r}=e,u=!(!t||!s);return[{classes:(l??[]).map(e=>{const{symbol:l,label:n,value:a,description:p}=e,[f,d,h]=u?a?.toString()?.split(o||"")||[]:[a],c=[];return(t||r)&&c.push(f),s&&c.push(d),i&&c.push(h),{symbol:l,label:n,values:[c],description:p}})}]}function C(e){return null!=e&&""!==e&&("string"!=typeof e||""!==e.trim()&&"<null>"!==e.toLowerCase())||(e=null),e+""}let $=E=class extends(m(c)){constructor(e){super(e),this._valueInfoMap={},this._isDefaultSymbolDerived=!1,this._isInfosSource=null,this.type="unique-value",this.backgroundFillSymbol=null,this.orderByClassesEnabled=!1,this.valueExpressionTitle=null,this.legendOptions=null,this.defaultLabel=null,this.portal=null,this.styleOrigin=null,this.diff={uniqueValueInfos(e,t){if(!e&&!t)return;if(!e||!t)return{type:"complete",oldValue:e,newValue:t};let s=!1;const i={type:"collection",added:[],removed:[],changed:[],unchanged:[]};for(let o=0;o<t.length;o++){const l=e.find(e=>e.value===t[o].value);l?n(l,t[o])?(i.changed.push({type:"complete",oldValue:l,newValue:t[o]}),s=!0):i.unchanged.push({oldValue:l,newValue:t[o]}):(i.added.push(t[o]),s=!0)}for(let o=0;o<e.length;o++){t.find(t=>t.value===e[o].value)||(i.removed.push(e[o]),s=!0)}return s?i:void 0}},this._set("uniqueValueInfos",[]),this._set("uniqueValueGroups",[])}get _cache(){return{compiledFunc:null}}set field(e){this._set("field",e),this._updateFieldDelimiter(),this._updateUniqueValues()}castField(e){return null==e||"function"==typeof e?e:a(e)}writeField(e,t,i,o){"string"==typeof e?t[i]=e:o?.messages?O(o,"UniqueValueRenderer.field","set to a function cannot be written to JSON"):s.getLogger(this).error(".field: cannot write field to JSON since it's not a string value")}set field2(e){this._set("field2",e),this._updateFieldDelimiter(),this._updateUniqueValues()}set field3(e){this._set("field3",e),this._updateUniqueValues()}set valueExpression(e){this._set("valueExpression",e),this._updateUniqueValues()}set defaultSymbol(e){this._isDefaultSymbolDerived=!1,this._set("defaultSymbol",e)}set fieldDelimiter(e){this._set("fieldDelimiter",e),this._updateUniqueValues()}readPortal(e,t,s){return s.portal||h.getDefault()}readStyleOrigin(e,t,s){if(t.styleName)return Object.freeze({styleName:t.styleName});if(t.styleUrl){const e=S(t.styleUrl,s);return Object.freeze({styleUrl:e})}}writeStyleOrigin(e,t,s,i){e.styleName?t.styleName=e.styleName:e.styleUrl&&(t.styleUrl=w(e.styleUrl,i))}set uniqueValueGroups(e){this.styleOrigin?s.getLogger(this).error("#uniqueValueGroups=","Cannot modify unique value groups of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueGroups",e),this._updateInfosFromGroups(),this._isInfosSource=!1,this._watchUniqueValueGroups())}set uniqueValueInfos(e){this.styleOrigin?s.getLogger(this).error("#uniqueValueInfos=","Cannot modify unique value infos of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueInfos",e),this._updateValueInfoMap(),this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos())}addUniqueValueInfo(e,t){if(this.styleOrigin)return void s.getLogger(this).error("#addUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");let i;i="object"==typeof e?L(e):new q({value:e,symbol:F(t)}),this.uniqueValueInfos?.push(i),this._valueInfoMap[C(i.value)]=i,this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos()}removeUniqueValueInfo(e){if(this.styleOrigin)return void s.getLogger(this).error("#removeUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");const t=this.uniqueValueInfos;if(t)for(let s=0;s<t.length;s++){const i=t[s];if(String(i.value)===String(e)){delete this._valueInfoMap[C(e)],t.splice(s,1);break}}this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos()}async getUniqueValueInfo(e,t){let s=t;return this.valueExpression&&null==t?.arcade&&(s={...s,arcade:await I()}),this._getUniqueValueInfo(e,s)}getSymbol(e,t){if(this.valueExpression&&null==t?.arcade)return void s.getLogger(this).error("#getSymbol()","Please use getSymbolAsync if valueExpression is used");const i=this._getUniqueValueInfo(e,t);return i?.symbol||this.defaultSymbol}async getSymbolAsync(e,t){let s=t;if(this.valueExpression&&null==s?.arcade){const e=await I(),{arcadeUtils:t}=e;t.hasGeometryOperations(this.valueExpression)&&await t.enableGeometryOperations(),s={...s,arcade:e}}const i=this._getUniqueValueInfo(e,s);return i?.symbol||this.defaultSymbol}get symbols(){const e=[];if(this._isInfosSource)for(const t of this.uniqueValueInfos??[])t.symbol&&e.push(t.symbol);else for(const t of this.uniqueValueGroups??[])for(const s of t.classes??[])s.symbol&&e.push(s.symbol);return this.defaultSymbol&&e.push(this.defaultSymbol),e}getAttributeHash(){return this.visualVariables?.reduce((e,t)=>e+t.getAttributeHash(),"")??""}getMeshHash(){const e=JSON.stringify(this.backgroundFillSymbol),t=JSON.stringify(this.defaultSymbol),s=this.uniqueValueInfos?.reduce((e,t)=>e+t.getMeshHash(),"");return`${e}.${t}.${s}.${`${this.field}.${this.field2}.${this.field3}.${this.fieldDelimiter}`}.${this.valueExpression}`}clone(){const e=new E({field:this.field,field2:this.field2,field3:this.field3,defaultLabel:this.defaultLabel,defaultSymbol:t(this.defaultSymbol),orderByClassesEnabled:this.orderByClassesEnabled,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,fieldDelimiter:this.fieldDelimiter,visualVariables:t(this.visualVariables),legendOptions:t(this.legendOptions),authoringInfo:t(this.authoringInfo),backgroundFillSymbol:t(this.backgroundFillSymbol)});this._isDefaultSymbolDerived&&(e._isDefaultSymbolDerived=!0),e._set("portal",this.portal);const s=t(this.uniqueValueInfos),i=t(this.uniqueValueGroups);return this.styleOrigin&&(e._set("styleOrigin",Object.freeze(t(this.styleOrigin))),Object.freeze(s),Object.freeze(i)),e._set("uniqueValueInfos",s),e._updateValueInfoMap(),e._set("uniqueValueGroups",i),e._isInfosSource=this._isInfosSource,e._watchUniqueValueInfosAndGroups(),e}get arcadeRequired(){return this.arcadeRequiredForVisualVariables||!!this.valueExpression}async collectRequiredFields(e,t){const s=[this.collectVVRequiredFields(e,t),this.collectSymbolFields(e,t)];await Promise.all(s)}async collectSymbolFields(e,t){const s=[...this.symbols.map(s=>s.collectRequiredFields(e,t)),f(e,t,null,this.valueExpression)];d(e,t,this.field),d(e,t,this.field2),d(e,t,this.field3),await Promise.all(s)}populateFromStyle(){return j(this.styleOrigin,{portal:this.portal}).then(e=>{const t=[];return this._valueInfoMap={},e?.data&&Array.isArray(e.data.items)&&e.data.items.forEach(s=>{const i=new U({styleUrl:e.styleUrl,styleName:e.styleName,portal:this.portal,name:s.name});this.defaultSymbol||s.name!==e.data.defaultItem||(this.defaultSymbol=i,this._isDefaultSymbolDerived=!0);const o=new q({value:s.name,symbol:i});t.push(o),this._valueInfoMap[C(s.name)]=o}),this._set("uniqueValueInfos",Object.freeze(t)),this._updateGroupsFromInfos(!0),this._isInfosSource=null,this._watchUniqueValueInfos(),!this.defaultSymbol&&this.uniqueValueInfos?.length&&(this.defaultSymbol=this.uniqueValueInfos[0].symbol,this._isDefaultSymbolDerived=!0),this})}_updateFieldDelimiter(){this.field&&this.field2&&!this.fieldDelimiter&&this._set("fieldDelimiter",N)}_updateUniqueValues(){null!=this._isInfosSource&&(this._isInfosSource?this._updateGroupsFromInfos():this._updateInfosFromGroups())}_updateValueInfoMap(){this._valueInfoMap={};const{uniqueValueInfos:e}=this;if(e)for(const t of e)this._valueInfoMap[C(t.value)]=t}_watchUniqueValueInfosAndGroups(){this._watchUniqueValueInfos(),this._watchUniqueValueGroups()}_watchUniqueValueInfos(){this.removeHandles(M);const{uniqueValueInfos:e}=this;if(e){const t=[];for(const s of e)t.push(o(()=>({symbol:s.symbol,value:s.value,label:s.label,description:s.description}),(e,t)=>{e!==t&&(this._updateGroupsFromInfos(),this._isInfosSource=!0)},{sync:!0}));this.addHandles(t,M)}}_watchUniqueValueGroups(){this.removeHandles(R);const{uniqueValueGroups:e}=this;if(e){const t=[];for(const s of e){t.push(o(()=>({classes:s.classes}),(e,t)=>{e!==t&&(this._updateInfosFromGroups(),this._isInfosSource=!1)},{sync:!0}));for(const e of s.classes??[])t.push(o(()=>({symbol:e.symbol,values:e.values,label:e.label,description:e.description}),(e,t)=>{e!==t&&(this._updateInfosFromGroups(),this._isInfosSource=!1)},{sync:!0}))}this.addHandles(t,R)}}_updateInfosFromGroups(){if(!this.uniqueValueGroups)return this._set("uniqueValueInfos",null),this._updateValueInfoMap(),void this._watchUniqueValueInfos();const e=[],{field:t,field2:s,field3:i,fieldDelimiter:o,uniqueValueGroups:l,valueExpression:r}=this;if(!t&&!r)return this._set("uniqueValueInfos",e),this._updateValueInfoMap(),void this._watchUniqueValueInfos();const u=!(!t||!s);for(const n of l)for(const t of n.classes??[]){const{symbol:l,label:r,values:n,description:a}=t;for(const t of n??[]){const{value:n,value2:p,value3:f}=t,d=[n];s&&d.push(p),i&&d.push(f);const h=u?d.join(o||""):d[0]??void 0;e.push(new q({symbol:l,label:r,value:h,description:a}))}}this._set("uniqueValueInfos",e),this._updateValueInfoMap(),this._watchUniqueValueInfos()}_updateGroupsFromInfos(e=!1){if(!this.uniqueValueInfos)return this._set("uniqueValueGroups",null),void this._watchUniqueValueGroups();const{field:t,field2:s,valueExpression:i,fieldDelimiter:o,uniqueValueInfos:l}=this;if(!t&&!i||!l.length)return this._set("uniqueValueGroups",[]),void this._watchUniqueValueGroups();const r=!(!t||!s),u=l.map(e=>{const{symbol:t,label:s,value:i,description:l}=e,[u,n,a]=r?i?.toString()?.split(o||"")||[]:[i];return new _({symbol:t,label:s,description:l,values:[new v({value:u,value2:n,value3:a})]})}),n=[new V({classes:u})];e&&Object.freeze(n),this._set("uniqueValueGroups",n),this._watchUniqueValueGroups()}_getUniqueValueInfo(e,t){return this.valueExpression?this._getUnqiueValueInfoForExpression(e,t):this._getUnqiueValueInfoForFields(e)}_getUnqiueValueInfoForExpression(e,t){const{viewingMode:s,scale:i,spatialReference:o,arcade:l,timeZone:r}=t??{};let u=this._cache.compiledFunc;const n=l.arcadeUtils;if(!u){const e=n.createSyntaxTree(this.valueExpression);u=n.createFunction(e),this._cache.compiledFunc=u}const a=n.executeFunction(u,n.createExecContext(e,n.getViewInfo({viewingMode:s,scale:i,spatialReference:o}),r));return this._valueInfoMap[C(a)]}_getUnqiueValueInfoForFields(e){const t=this.field,s=e.attributes;let i;if(this.field2){const e=this.field2,o=this.field3,l=[];t&&l.push(s[t]),e&&l.push(s[e]),o&&l.push(s[o]),i=l.join(this.fieldDelimiter||"")}else t&&(i=s[t]);return this._valueInfoMap[C(i)]}static fromPortalStyle(e,t){const i=new E(t?.properties);i._set("styleOrigin",Object.freeze({styleName:e})),i._set("portal",t?.portal||h.getDefault());const o=i.populateFromStyle();return o.catch(t=>{s.getLogger(this.prototype).error(`#fromPortalStyle('${e}'[, ...])`,"Failed to create unique value renderer from style name",t)}),o}static fromStyleUrl(e,t){const i=new E(t?.properties);i._set("styleOrigin",Object.freeze({styleUrl:e}));const o=i.populateFromStyle();return o.catch(t=>{s.getLogger(this.prototype).error(`#fromStyleUrl('${e}'[, ...])`,"Failed to create unique value renderer from style URL",t)}),o}};e([l({readOnly:!0})],$.prototype,"_cache",null),e([G({uniqueValue:"unique-value"})],$.prototype,"type",void 0),e([l(y)],$.prototype,"backgroundFillSymbol",void 0),e([l({value:null,json:{type:String,read:{source:"field1"},write:{target:"field1"}}})],$.prototype,"field",null),e([r("field")],$.prototype,"castField",null),e([D("field")],$.prototype,"writeField",null),e([l({type:String,value:null,json:{write:!0}})],$.prototype,"field2",null),e([l({type:String,value:null,json:{write:!0}})],$.prototype,"field3",null),e([l({type:Boolean,json:{name:"drawInClassOrder",default:!1,write:!0,origins:{"web-scene":{write:!1}}}})],$.prototype,"orderByClassesEnabled",void 0),e([l({type:String,value:null,json:{write:!0}})],$.prototype,"valueExpression",null),e([l({type:String,json:{write:!0}})],$.prototype,"valueExpressionTitle",void 0),e([l({type:g,json:{write:!0}})],$.prototype,"legendOptions",void 0),e([l({type:String,json:{write:!0}})],$.prototype,"defaultLabel",void 0),e([l(i({...b},{json:{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}},origins:{"web-scene":{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}}}}}}))],$.prototype,"defaultSymbol",null),e([l({type:String,value:null,json:{write:!0}})],$.prototype,"fieldDelimiter",null),e([l({type:h,readOnly:!0})],$.prototype,"portal",void 0),e([x("portal",["styleName"])],$.prototype,"readPortal",null),e([l({readOnly:!0,json:{write:{enabled:!1,overridePolicy:()=>({enabled:!0})}}})],$.prototype,"styleOrigin",void 0),e([x("styleOrigin",["styleName","styleUrl"])],$.prototype,"readStyleOrigin",null),e([D("styleOrigin",{styleName:{type:String},styleUrl:{type:String}})],$.prototype,"writeStyleOrigin",null),e([l({type:[V],json:{read:{source:["uniqueValueGroups","uniqueValueInfos"],reader:(e,t,s)=>(t.uniqueValueGroups||P(t)).map(e=>V.fromJSON(e,s))},write:{overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0}}}}})],$.prototype,"uniqueValueGroups",null),e([l({type:[q],json:{read:!1,write:{isRequired:!0,overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0,isRequired:!0}}}}})],$.prototype,"uniqueValueInfos",null),$=E=e([u("esri.renderers.UniqueValueRenderer")],$);export{$ as default};
2
+ import{__decorate as e}from"tslib";import{clone as t}from"../core/lang.js";import s from"../core/Logger.js";import{deepMerge as i}from"../core/object.js";import{watch as o}from"../core/reactiveUtils.js";import{property as l,cast as r,subclass as u}from"../core/accessorSupport/decorators.js";import{diff as n}from"../core/accessorSupport/diffUtils.js";import{ensureString as a,ensureType as p}from"../core/accessorSupport/ensureType.js";import{collectArcadeFieldNames as f,collectField as d}from"../layers/support/fieldUtils.js";import c from"../portal/Portal.js";import h from"./Renderer.js";import{VisualVariablesMixin as m}from"./mixins/VisualVariablesMixin.js";import{rendererBackgroundFillSymbolProperty as y,rendererSymbolProperty as b}from"./support/commonProperties.js";import v from"./support/RendererLegendOptions.js";import _ from"./support/UniqueValue.js";import g from"./support/UniqueValueClass.js";import V from"./support/UniqueValueGroup.js";import q from"./support/UniqueValueInfo.js";import{loadArcade as I}from"../support/loadArcade.js";import{f as S,t as w}from"../chunks/persistableUrlUtils.js";import U from"../symbols/WebStyleSymbol.js";import{fetchStyle as j}from"../symbols/support/styleUtils.js";import{ensureType as F}from"../symbols/support/typeUtils.js";import{addPropertyUnsupportedError as O}from"../webdoc/support/unsupportedErrors.js";import{enumeration as G}from"../core/accessorSupport/decorators/enumeration.js";import{writer as D}from"../core/accessorSupport/decorators/writer.js";import{reader as x}from"../core/accessorSupport/decorators/reader.js";var E;const M="uvInfos-watcher",R="uvGroups-watcher",L=",",N=p(q);function P(e){const{field1:t,field2:s,field3:i,fieldDelimiter:o,uniqueValueInfos:l,valueExpression:r}=e,u=!(!t||!s);return[{classes:(l??[]).map(e=>{const{alternateSymbols:l,symbol:n,label:a,value:p,description:f}=e,[d,c,h]=u?p?.toString()?.split(o||"")||[]:[p],m=[];return(t||r)&&m.push(d),s&&m.push(c),i&&m.push(h),{alternateSymbols:l,symbol:n,label:a,values:[m],description:f}})}]}function C(e){return null!=e&&""!==e&&("string"!=typeof e||""!==e.trim()&&"<null>"!==e.toLowerCase())||(e=null),e+""}let z=E=class extends(m(h)){constructor(e){super(e),this._valueInfoMap={},this._isDefaultSymbolDerived=!1,this._isInfosSource=null,this.type="unique-value",this.backgroundFillSymbol=null,this.orderByClassesEnabled=!1,this.valueExpressionTitle=null,this.legendOptions=null,this.defaultLabel=null,this.portal=null,this.styleOrigin=null,this.diff={uniqueValueInfos(e,t){if(!e&&!t)return;if(!e||!t)return{type:"complete",oldValue:e,newValue:t};let s=!1;const i={type:"collection",added:[],removed:[],changed:[],unchanged:[]};for(let o=0;o<t.length;o++){const l=e.find(e=>e.value===t[o].value);l?n(l,t[o])?(i.changed.push({type:"complete",oldValue:l,newValue:t[o]}),s=!0):i.unchanged.push({oldValue:l,newValue:t[o]}):(i.added.push(t[o]),s=!0)}for(let o=0;o<e.length;o++){t.find(t=>t.value===e[o].value)||(i.removed.push(e[o]),s=!0)}return s?i:void 0}},this._set("uniqueValueInfos",[]),this._set("uniqueValueGroups",[])}get _cache(){return{compiledFunc:null}}set field(e){this._set("field",e),this._updateFieldDelimiter(),this._updateUniqueValues()}castField(e){return null==e||"function"==typeof e?e:a(e)}writeField(e,t,i,o){"string"==typeof e?t[i]=e:o?.messages?O(o,"UniqueValueRenderer.field","set to a function cannot be written to JSON"):s.getLogger(this).error(".field: cannot write field to JSON since it's not a string value")}set field2(e){this._set("field2",e),this._updateFieldDelimiter(),this._updateUniqueValues()}set field3(e){this._set("field3",e),this._updateUniqueValues()}set valueExpression(e){this._set("valueExpression",e),this._updateUniqueValues()}set defaultSymbol(e){this._isDefaultSymbolDerived=!1,this._set("defaultSymbol",e)}set fieldDelimiter(e){this._set("fieldDelimiter",e),this._updateUniqueValues()}readPortal(e,t,s){return s.portal||c.getDefault()}readStyleOrigin(e,t,s){if(t.styleName)return Object.freeze({styleName:t.styleName});if(t.styleUrl){const e=S(t.styleUrl,s);return Object.freeze({styleUrl:e})}}writeStyleOrigin(e,t,s,i){e.styleName?t.styleName=e.styleName:e.styleUrl&&(t.styleUrl=w(e.styleUrl,i))}set uniqueValueGroups(e){this.styleOrigin?s.getLogger(this).error("#uniqueValueGroups=","Cannot modify unique value groups of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueGroups",e),this._updateInfosFromGroups(),this._isInfosSource=!1,this._watchUniqueValueGroups())}set uniqueValueInfos(e){this.styleOrigin?s.getLogger(this).error("#uniqueValueInfos=","Cannot modify unique value infos of a UniqueValueRenderer created from a web style"):(this._set("uniqueValueInfos",e),this._updateValueInfoMap(),this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos())}addUniqueValueInfo(e,t){if(this.styleOrigin)return void s.getLogger(this).error("#addUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");let i;i="object"==typeof e?N(e):new q({value:e,symbol:F(t)}),this.uniqueValueInfos?.push(i),this._valueInfoMap[C(i.value)]=i,this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos()}removeUniqueValueInfo(e){if(this.styleOrigin)return void s.getLogger(this).error("#removeUniqueValueInfo()","Cannot modify unique value infos of a UniqueValueRenderer created from a web style");const t=this.uniqueValueInfos;if(t)for(let s=0;s<t.length;s++){const i=t[s];if(String(i.value)===String(e)){delete this._valueInfoMap[C(e)],t.splice(s,1);break}}this._updateGroupsFromInfos(),this._isInfosSource=!0,this._watchUniqueValueInfos()}async getUniqueValueInfo(e,t){let s=t;return this.valueExpression&&null==t?.arcade&&(s={...s,arcade:await I()}),this._getUniqueValueInfo(e,s)}getSymbol(e,t){if(this.valueExpression&&null==t?.arcade)return void s.getLogger(this).error("#getSymbol()","Please use getSymbolAsync if valueExpression is used");const i=this._getUniqueValueInfo(e,t);return i?.symbol||this.defaultSymbol}async getSymbolAsync(e,t){let s=t;if(this.valueExpression&&null==s?.arcade){const e=await I(),{arcadeUtils:t}=e;t.hasGeometryOperations(this.valueExpression)&&await t.enableGeometryOperations(),s={...s,arcade:e}}const i=this._getUniqueValueInfo(e,s);return i?.symbol||this.defaultSymbol}get symbols(){const e=[];if(this._isInfosSource)for(const t of this.uniqueValueInfos??[])t.symbol&&e.push(t.symbol),e.push(...t.alternateSymbols??[]);else for(const t of this.uniqueValueGroups??[])for(const s of t.classes??[])s.symbol&&e.push(s.symbol),e.push(...s.alternateSymbols??[]);return this.defaultSymbol&&e.push(this.defaultSymbol),e}clone(){const e=new E({field:this.field,field2:this.field2,field3:this.field3,defaultLabel:this.defaultLabel,defaultSymbol:t(this.defaultSymbol),orderByClassesEnabled:this.orderByClassesEnabled,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,fieldDelimiter:this.fieldDelimiter,visualVariables:t(this.visualVariables),legendOptions:t(this.legendOptions),authoringInfo:t(this.authoringInfo),backgroundFillSymbol:t(this.backgroundFillSymbol)});this._isDefaultSymbolDerived&&(e._isDefaultSymbolDerived=!0),e._set("portal",this.portal);const s=t(this.uniqueValueInfos),i=t(this.uniqueValueGroups);return this.styleOrigin&&(e._set("styleOrigin",Object.freeze(t(this.styleOrigin))),Object.freeze(s),Object.freeze(i)),e._set("uniqueValueInfos",s),e._updateValueInfoMap(),e._set("uniqueValueGroups",i),e._isInfosSource=this._isInfosSource,e._watchUniqueValueInfosAndGroups(),e}get arcadeRequired(){return this.arcadeRequiredForVisualVariables||!!this.valueExpression}async collectRequiredFields(e,t){const s=[this.collectVVRequiredFields(e,t),this.collectSymbolFields(e,t)];await Promise.all(s)}async collectSymbolFields(e,t){const s=[...this.symbols.map(s=>s.collectRequiredFields(e,t)),f(e,t,null,this.valueExpression)];d(e,t,this.field),d(e,t,this.field2),d(e,t,this.field3),await Promise.all(s)}populateFromStyle(){return j(this.styleOrigin,{portal:this.portal}).then(e=>{const t=[];return this._valueInfoMap={},e?.data&&Array.isArray(e.data.items)&&e.data.items.forEach(s=>{const i=new U({styleUrl:e.styleUrl,styleName:e.styleName,portal:this.portal,name:s.name});this.defaultSymbol||s.name!==e.data.defaultItem||(this.defaultSymbol=i,this._isDefaultSymbolDerived=!0);const o=new q({value:s.name,symbol:i});t.push(o),this._valueInfoMap[C(s.name)]=o}),this._set("uniqueValueInfos",Object.freeze(t)),this._updateGroupsFromInfos(!0),this._isInfosSource=null,this._watchUniqueValueInfos(),!this.defaultSymbol&&this.uniqueValueInfos?.length&&(this.defaultSymbol=this.uniqueValueInfos[0].symbol,this._isDefaultSymbolDerived=!0),this})}_updateFieldDelimiter(){this.field&&this.field2&&!this.fieldDelimiter&&this._set("fieldDelimiter",L)}_updateUniqueValues(){null!=this._isInfosSource&&(this._isInfosSource?this._updateGroupsFromInfos():this._updateInfosFromGroups())}_updateValueInfoMap(){this._valueInfoMap={};const{uniqueValueInfos:e}=this;if(e)for(const t of e)this._valueInfoMap[C(t.value)]=t}_watchUniqueValueInfosAndGroups(){this._watchUniqueValueInfos(),this._watchUniqueValueGroups()}_watchUniqueValueInfos(){this.removeHandles(M);const{uniqueValueInfos:e}=this;if(e){const t=[];for(const s of e)t.push(o(()=>({symbol:s.symbol,alternateSymbols:s.alternateSymbols,value:s.value,label:s.label,description:s.description}),(e,t)=>{e!==t&&(this._updateGroupsFromInfos(),this._isInfosSource=!0)},{sync:!0}));this.addHandles(t,M)}}_watchUniqueValueGroups(){this.removeHandles(R);const{uniqueValueGroups:e}=this;if(e){const t=[];for(const s of e){t.push(o(()=>({classes:s.classes}),(e,t)=>{e!==t&&(this._updateInfosFromGroups(),this._isInfosSource=!1)},{sync:!0}));for(const e of s.classes??[])t.push(o(()=>({symbol:e.symbol,alternateSymbols:e.alternateSymbols,values:e.values,label:e.label,description:e.description}),(e,t)=>{e!==t&&(this._updateInfosFromGroups(),this._isInfosSource=!1)},{sync:!0}))}this.addHandles(t,R)}}_updateInfosFromGroups(){if(!this.uniqueValueGroups)return this._set("uniqueValueInfos",null),this._updateValueInfoMap(),void this._watchUniqueValueInfos();const e=[],{field:t,field2:s,field3:i,fieldDelimiter:o,uniqueValueGroups:l,valueExpression:r}=this;if(!t&&!r)return this._set("uniqueValueInfos",e),this._updateValueInfoMap(),void this._watchUniqueValueInfos();const u=!(!t||!s);for(const n of l)for(const t of n.classes??[]){const{alternateSymbols:l,symbol:r,label:n,values:a,description:p}=t;for(const t of a??[]){const{value:a,value2:f,value3:d}=t,c=[a];s&&c.push(f),i&&c.push(d);const h=u?c.join(o||""):c[0]??void 0;e.push(new q({alternateSymbols:l,symbol:r,label:n,value:h,description:p}))}}this._set("uniqueValueInfos",e),this._updateValueInfoMap(),this._watchUniqueValueInfos()}_updateGroupsFromInfos(e=!1){if(!this.uniqueValueInfos)return this._set("uniqueValueGroups",null),void this._watchUniqueValueGroups();const{field:t,field2:s,valueExpression:i,fieldDelimiter:o,uniqueValueInfos:l}=this;if(!t&&!i||!l.length)return this._set("uniqueValueGroups",[]),void this._watchUniqueValueGroups();const r=!(!t||!s),u=l.map(e=>{const{alternateSymbols:t,symbol:s,label:i,value:l,description:u}=e,[n,a,p]=r?l?.toString()?.split(o||"")||[]:[l];return new g({alternateSymbols:t,symbol:s,label:i,description:u,values:[new _({value:n,value2:a,value3:p})]})}),n=[new V({classes:u})];e&&Object.freeze(n),this._set("uniqueValueGroups",n),this._watchUniqueValueGroups()}_getUniqueValueInfo(e,t){return this.valueExpression?this._getUnqiueValueInfoForExpression(e,t):this._getUnqiueValueInfoForFields(e)}_getUnqiueValueInfoForExpression(e,t){const{viewingMode:s,scale:i,spatialReference:o,arcade:l,timeZone:r}=t??{};let u=this._cache.compiledFunc;const n=l.arcadeUtils;if(!u){const e=n.createSyntaxTree(this.valueExpression);u=n.createFunction(e),this._cache.compiledFunc=u}const a=n.executeFunction(u,n.createExecContext(e,n.getViewInfo({viewingMode:s,scale:i,spatialReference:o}),r));return this._valueInfoMap[C(a)]}_getUnqiueValueInfoForFields(e){const t=this.field,s=e.attributes;let i;if(this.field2){const e=this.field2,o=this.field3,l=[];t&&l.push(s[t]),e&&l.push(s[e]),o&&l.push(s[o]),i=l.join(this.fieldDelimiter||"")}else t&&(i=s[t]);return this._valueInfoMap[C(i)]}static fromPortalStyle(e,t){const i=new E(t?.properties);i._set("styleOrigin",Object.freeze({styleName:e})),i._set("portal",t?.portal||c.getDefault());const o=i.populateFromStyle();return o.catch(t=>{s.getLogger(this.prototype).error(`#fromPortalStyle('${e}'[, ...])`,"Failed to create unique value renderer from style name",t)}),o}static fromStyleUrl(e,t){const i=new E(t?.properties);i._set("styleOrigin",Object.freeze({styleUrl:e}));const o=i.populateFromStyle();return o.catch(t=>{s.getLogger(this.prototype).error(`#fromStyleUrl('${e}'[, ...])`,"Failed to create unique value renderer from style URL",t)}),o}};e([l({readOnly:!0})],z.prototype,"_cache",null),e([G({uniqueValue:"unique-value"})],z.prototype,"type",void 0),e([l(y)],z.prototype,"backgroundFillSymbol",void 0),e([l({value:null,json:{type:String,read:{source:"field1"},write:{target:"field1"}}})],z.prototype,"field",null),e([r("field")],z.prototype,"castField",null),e([D("field")],z.prototype,"writeField",null),e([l({type:String,value:null,json:{write:!0}})],z.prototype,"field2",null),e([l({type:String,value:null,json:{write:!0}})],z.prototype,"field3",null),e([l({type:Boolean,json:{name:"drawInClassOrder",default:!1,write:!0,origins:{"web-scene":{write:!1}}}})],z.prototype,"orderByClassesEnabled",void 0),e([l({type:String,value:null,json:{write:!0}})],z.prototype,"valueExpression",null),e([l({type:String,json:{write:!0}})],z.prototype,"valueExpressionTitle",void 0),e([l({type:v,json:{write:!0}})],z.prototype,"legendOptions",void 0),e([l({type:String,json:{write:!0}})],z.prototype,"defaultLabel",void 0),e([l(i({...b},{json:{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}},origins:{"web-scene":{write:{overridePolicy(){return{enabled:!this._isDefaultSymbolDerived}}}}}}}))],z.prototype,"defaultSymbol",null),e([l({type:String,value:null,json:{write:!0}})],z.prototype,"fieldDelimiter",null),e([l({type:c,readOnly:!0})],z.prototype,"portal",void 0),e([x("portal",["styleName"])],z.prototype,"readPortal",null),e([l({readOnly:!0,json:{write:{enabled:!1,overridePolicy:()=>({enabled:!0})}}})],z.prototype,"styleOrigin",void 0),e([x("styleOrigin",["styleName","styleUrl"])],z.prototype,"readStyleOrigin",null),e([D("styleOrigin",{styleName:{type:String},styleUrl:{type:String}})],z.prototype,"writeStyleOrigin",null),e([l({type:[V],json:{read:{source:["uniqueValueGroups","uniqueValueInfos"],reader:(e,t,s)=>(t.uniqueValueGroups||P(t)).map(e=>V.fromJSON(e,s))},write:{overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0}}}}})],z.prototype,"uniqueValueGroups",null),e([l({type:[q],json:{read:!1,write:{isRequired:!0,overridePolicy(){return this.styleOrigin?{enabled:!1}:{enabled:!0,isRequired:!0}}}}})],z.prototype,"uniqueValueInfos",null),z=E=e([u("esri.renderers.UniqueValueRenderer")],z);export{z as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../Color.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import r from"../../core/Logger.js";import{property as s,cast as i,subclass as l}from"../../core/accessorSupport/decorators.js";import{ensureString as p}from"../../core/accessorSupport/ensureType.js";var n;let u=n=class extends o{constructor(e){super(e),this.color=null,this.field=null,this.label=null,this.valueExpression=null,this.valueExpressionTitle=null}castField(e){return null==e?e:"function"==typeof e?(r.getLogger(this).error(".field: field must be a string value"),null):p(e)}getAttributeHash(){return`${this.field}-${this.valueExpression}`}clone(){return new n({color:this.color?.clone(),field:this.field,label:this.label,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle})}};e([s({type:t,json:{type:[Number],write:!0}})],u.prototype,"color",void 0),e([s({type:String,json:{write:!0}})],u.prototype,"field",void 0),e([i("field")],u.prototype,"castField",null),e([s({type:String,json:{write:!0}})],u.prototype,"label",void 0),e([s({type:String,json:{write:!0}})],u.prototype,"valueExpression",void 0),e([s({type:String,json:{write:!0}})],u.prototype,"valueExpressionTitle",void 0),u=n=e([l("esri.renderers.support.AttributeColorInfo")],u);const a=u;export{a as default};
2
+ import{__decorate as e}from"tslib";import o from"../../Color.js";import{JSONSupport as r}from"../../core/JSONSupport.js";import t from"../../core/Logger.js";import{property as l,cast as s,subclass as i}from"../../core/accessorSupport/decorators.js";import{ensureString as p}from"../../core/accessorSupport/ensureType.js";var n;let u=n=class extends r{constructor(e){super(e),this.color=null,this.field=null,this.label=null,this.valueExpression=null,this.valueExpressionTitle=null}castField(e){return null==e?e:"function"==typeof e?(t.getLogger(this).error(".field: field must be a string value"),null):p(e)}clone(){return new n({color:this.color?.clone(),field:this.field,label:this.label,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle})}};e([l({type:o,json:{type:[Number],write:!0}})],u.prototype,"color",void 0),e([l({type:String,json:{write:!0}})],u.prototype,"field",void 0),e([s("field")],u.prototype,"castField",null),e([l({type:String,json:{write:!0}})],u.prototype,"label",void 0),e([l({type:String,json:{write:!0}})],u.prototype,"valueExpression",void 0),e([l({type:String,json:{write:!0}})],u.prototype,"valueExpressionTitle",void 0),u=n=e([i("esri.renderers.support.AttributeColorInfo")],u);const a=u;export{a as default};
@@ -1,3 +1,4 @@
1
+ import type CIMSymbol from "../../symbols/CIMSymbol.js";
1
2
  import type { JSONSupport } from "../../core/JSONSupport.js";
2
3
  import type { SymbolUnion } from "../../symbols/types.js";
3
4
  import type { WebStyleSymbolProperties } from "../../symbols/WebStyleSymbol.js";
@@ -15,6 +16,8 @@ import type { PictureMarkerSymbolProperties } from "../../symbols/PictureMarkerS
15
16
  import type { PictureFillSymbolProperties } from "../../symbols/PictureFillSymbol.js";
16
17
 
17
18
  export interface ClassBreakInfoProperties extends Partial<Pick<ClassBreakInfo, "label" | "maxValue" | "minValue">> {
19
+ /** Defines alternate CIM symbols used to render features in this class break at different scales. */
20
+ alternateSymbols?: CIMSymbolProperties[] | null;
18
21
  /**
19
22
  * Defines the symbol used to render features with data values that are within the bounds
20
23
  * defined for the class break. This value may be autocast by specifying the symbol `type`.
@@ -39,6 +42,9 @@ export interface ClassBreakInfoProperties extends Partial<Pick<ClassBreakInfo, "
39
42
  */
40
43
  export default class ClassBreakInfo extends JSONSupport {
41
44
  constructor(properties?: ClassBreakInfoProperties);
45
+ /** Defines alternate CIM symbols used to render features in this class break at different scales. */
46
+ get alternateSymbols(): CIMSymbol[] | null | undefined;
47
+ set alternateSymbols(value: CIMSymbolProperties[] | null | undefined);
42
48
  /**
43
49
  * Describes the data represented by the class break. This label will appear in the
44
50
  * [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/) next to the symbol representing the break.
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{JSONSupport as t}from"../../core/JSONSupport.js";import{property as s,subclass as o}from"../../core/accessorSupport/decorators.js";import{requiredRendererSymbolProperty as r}from"./commonProperties.js";var i;let l=i=class extends t{constructor(e){super(e),this.description=null,this.label=null,this.minValue=null,this.maxValue=0,this.symbol=null}clone(){return new i({description:this.description,label:this.label,minValue:this.minValue,maxValue:this.maxValue,symbol:this.symbol?.clone()??null})}getMeshHash(){const e=JSON.stringify(this.symbol);return`${this.minValue}.${this.maxValue}.${e}`}};e([s({type:String,json:{write:!0}})],l.prototype,"description",void 0),e([s({type:String,json:{write:!0}})],l.prototype,"label",void 0),e([s({type:Number,json:{read:{source:"classMinValue"},write:{target:"classMinValue"}}})],l.prototype,"minValue",void 0),e([s({type:Number,json:{read:{source:"classMaxValue"},write:{target:"classMaxValue"}}})],l.prototype,"maxValue",void 0),e([s(r)],l.prototype,"symbol",void 0),l=i=e([o("esri.renderers.support.ClassBreakInfo")],l);export{l as default};
2
+ import{__decorate as e}from"tslib";import{JSONSupport as t}from"../../core/JSONSupport.js";import{property as o,subclass as r}from"../../core/accessorSupport/decorators.js";import{requiredRendererSymbolProperty as s}from"./commonProperties.js";import l from"../../symbols/CIMSymbol.js";var i;let a=i=class extends t{constructor(e){super(e),this.description=null,this.label=null,this.minValue=null,this.maxValue=0,this.symbol=null,this.alternateSymbols=null}clone(){return new i({alternateSymbols:this.alternateSymbols?.map(e=>e.clone()),description:this.description,label:this.label,minValue:this.minValue,maxValue:this.maxValue,symbol:this.symbol?.clone()??null})}};e([o({type:String,json:{write:!0}})],a.prototype,"description",void 0),e([o({type:String,json:{write:!0}})],a.prototype,"label",void 0),e([o({type:Number,json:{read:{source:"classMinValue"},write:{target:"classMinValue"}}})],a.prototype,"minValue",void 0),e([o({type:Number,json:{read:{source:"classMaxValue"},write:{target:"classMaxValue"}}})],a.prototype,"maxValue",void 0),e([o(s)],a.prototype,"symbol",void 0),e([o({type:[l],json:{write:!0,origins:{"web-scene":{write:!1}}}})],a.prototype,"alternateSymbols",void 0),a=i=e([r("esri.renderers.support.ClassBreakInfo")],a);export{a as default};
@@ -1,4 +1,5 @@
1
1
  import type UniqueValue from "./UniqueValue.js";
2
+ import type CIMSymbol from "../../symbols/CIMSymbol.js";
2
3
  import type { ClonableMixin } from "../../core/Clonable.js";
3
4
  import type { JSONSupport } from "../../core/JSONSupport.js";
4
5
  import type { UniqueValueProperties } from "./UniqueValue.js";
@@ -18,6 +19,11 @@ import type { PictureMarkerSymbolProperties } from "../../symbols/PictureMarkerS
18
19
  import type { PictureFillSymbolProperties } from "../../symbols/PictureFillSymbol.js";
19
20
 
20
21
  export interface UniqueValueClassProperties extends Partial<Pick<UniqueValueClass, "label">> {
22
+ /**
23
+ * Defines alternate CIM symbols used to represent features containing the given
24
+ * [values](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueClass/#values) at different scales.
25
+ */
26
+ alternateSymbols?: CIMSymbolProperties[] | null;
21
27
  /**
22
28
  * Defines the symbol used to represent features containing the given [values](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueClass/#values).
23
29
  *
@@ -96,6 +102,12 @@ export interface UniqueValueClassProperties extends Partial<Pick<UniqueValueClas
96
102
  */
97
103
  export default class UniqueValueClass extends UniqueValueClassSuperclass {
98
104
  constructor(properties?: UniqueValueClassProperties);
105
+ /**
106
+ * Defines alternate CIM symbols used to represent features containing the given
107
+ * [values](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueClass/#values) at different scales.
108
+ */
109
+ get alternateSymbols(): CIMSymbol[] | null | undefined;
110
+ set alternateSymbols(value: CIMSymbolProperties[] | null | undefined);
99
111
  /**
100
112
  * Describes the [values](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueClass/#values) represented by the [symbol](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueClass/#symbol) in the
101
113
  * [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/).
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as r}from"../../core/arrayUtils.js";import{ClonableMixin as t}from"../../core/Clonable.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{property as s,subclass as l}from"../../core/accessorSupport/decorators.js";import{rendererSymbolProperty as i}from"./commonProperties.js";import a from"./UniqueValue.js";let n=class extends(t(o)){constructor(e){super(e),this.description=null,this.label=null,this.symbol=null}get values(){return this._get("values")}set values(e){if(null!=e){const r=typeof(e=Array.isArray(e)?e:[e])[0];e="string"===r||"number"===r?e.map(e=>new a({value:e})):"object"===r?e[0]instanceof a?e:e.map(e=>new a(e)):null}this._set("values",e)}};e([s({type:String,json:{write:!0}})],n.prototype,"description",void 0),e([s({type:String,json:{write:!0}})],n.prototype,"label",void 0),e([s(i)],n.prototype,"symbol",void 0),e([s({json:{type:[[String]],read:{reader:e=>e?e.map(e=>new a({value:e[0],value2:e[1],value3:e[2]})):null},write:{writer:(e,t)=>{const o=[];for(const s of e){const e=[s.value,s.value2,s.value3].filter(r).map(e=>e.toString());o.push(e)}t.values=o}}}})],n.prototype,"values",null),n=e([l("esri.renderers.support.UniqueValueClass")],n);export{n as default};
2
+ import{__decorate as e}from"tslib";import{isSome as r}from"../../core/arrayUtils.js";import{ClonableMixin as t}from"../../core/Clonable.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import{property as s,subclass as l}from"../../core/accessorSupport/decorators.js";import{rendererSymbolProperty as i}from"./commonProperties.js";import n from"./UniqueValue.js";import a from"../../symbols/CIMSymbol.js";let p=class extends(t(o)){constructor(e){super(e),this.description=null,this.label=null,this.symbol=null,this.alternateSymbols=null}get values(){return this._get("values")}set values(e){if(null!=e){const r=typeof(e=Array.isArray(e)?e:[e])[0];e="string"===r||"number"===r?e.map(e=>new n({value:e})):"object"===r?e[0]instanceof n?e:e.map(e=>new n(e)):null}this._set("values",e)}};e([s({type:String,json:{write:!0}})],p.prototype,"description",void 0),e([s({type:String,json:{write:!0}})],p.prototype,"label",void 0),e([s(i)],p.prototype,"symbol",void 0),e([s({type:[a],json:{write:!0,origins:{"web-scene":{write:!1}}}})],p.prototype,"alternateSymbols",void 0),e([s({json:{type:[[String]],read:{reader:e=>e?e.map(e=>new n({value:e[0],value2:e[1],value3:e[2]})):null},write:{writer:(e,t)=>{const o=[];for(const s of e){const e=[s.value,s.value2,s.value3].filter(r).map(e=>e.toString());o.push(e)}t.values=o}}}})],p.prototype,"values",null),p=e([l("esri.renderers.support.UniqueValueClass")],p);export{p as default};
@@ -1,3 +1,4 @@
1
+ import type CIMSymbol from "../../symbols/CIMSymbol.js";
1
2
  import type { JSONSupport } from "../../core/JSONSupport.js";
2
3
  import type { SymbolUnion } from "../../symbols/types.js";
3
4
  import type { WebStyleSymbolProperties } from "../../symbols/WebStyleSymbol.js";
@@ -15,6 +16,11 @@ import type { PictureMarkerSymbolProperties } from "../../symbols/PictureMarkerS
15
16
  import type { PictureFillSymbolProperties } from "../../symbols/PictureFillSymbol.js";
16
17
 
17
18
  export interface UniqueValueInfoProperties extends Partial<Pick<UniqueValueInfo, "label" | "value">> {
19
+ /**
20
+ * Defines alternate CIM symbols used to represent features with the provided [value](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueInfo/#value)
21
+ * at different scales.
22
+ */
23
+ alternateSymbols?: CIMSymbolProperties[] | null;
18
24
  /**
19
25
  * Defines the symbol used to render features with the provided [value](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueInfo/#value).
20
26
  *
@@ -41,6 +47,12 @@ export interface UniqueValueInfoProperties extends Partial<Pick<UniqueValueInfo,
41
47
  */
42
48
  export default class UniqueValueInfo extends JSONSupport {
43
49
  constructor(properties?: UniqueValueInfoProperties);
50
+ /**
51
+ * Defines alternate CIM symbols used to represent features with the provided [value](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueInfo/#value)
52
+ * at different scales.
53
+ */
54
+ get alternateSymbols(): CIMSymbol[] | null | undefined;
55
+ set alternateSymbols(value: CIMSymbolProperties[] | null | undefined);
44
56
  /**
45
57
  * Describes the [value](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueInfo/#value) represented by the [symbol](https://developers.arcgis.com/javascript/latest/references/core/renderers/support/UniqueValueInfo/#symbol). This label will appear in the
46
58
  * [Legend](https://developers.arcgis.com/javascript/latest/references/map-components/components/arcgis-legend/) next to the symbol representing the value.
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import{JSONSupport as t}from"../../core/JSONSupport.js";import{property as e,subclass as r}from"../../core/accessorSupport/decorators.js";import{requiredRendererSymbolProperty as s,uniqueValueProperty as i}from"./commonProperties.js";var l;let p=l=class extends t{constructor(o){super(o),this.description=null,this.label=null,this.symbol=null,this.value=null}clone(){return new l({value:this.value,description:this.description,label:this.label,symbol:this.symbol?this.symbol.clone():null})}getMeshHash(){const o=JSON.stringify(this.symbol?.toJSON());return`${this.value}.${o}`}};o([e({type:String,json:{write:!0}})],p.prototype,"description",void 0),o([e({type:String,json:{write:!0}})],p.prototype,"label",void 0),o([e(s)],p.prototype,"symbol",void 0),o([e(i)],p.prototype,"value",void 0),p=l=o([r("esri.renderers.support.UniqueValueInfo")],p);export{p as default};
2
+ import{__decorate as o}from"tslib";import{JSONSupport as t}from"../../core/JSONSupport.js";import{property as e,subclass as r}from"../../core/accessorSupport/decorators.js";import{requiredRendererSymbolProperty as s,uniqueValueProperty as l}from"./commonProperties.js";import i from"../../symbols/CIMSymbol.js";var n;let p=n=class extends t{constructor(o){super(o),this.description=null,this.label=null,this.symbol=null,this.alternateSymbols=null,this.value=null}clone(){return new n({alternateSymbols:this.alternateSymbols?.map(o=>o.clone()),value:this.value,description:this.description,label:this.label,symbol:this.symbol?this.symbol.clone():null})}};o([e({type:String,json:{write:!0}})],p.prototype,"description",void 0),o([e({type:String,json:{write:!0}})],p.prototype,"label",void 0),o([e(s)],p.prototype,"symbol",void 0),o([e({type:[i],json:{write:!0,origins:{"web-scene":{write:!1}}}})],p.prototype,"alternateSymbols",void 0),o([e(l)],p.prototype,"value",void 0),p=n=o([r("esri.renderers.support.UniqueValueInfo")],p);export{p as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{property as e,subclass as o}from"../../core/accessorSupport/decorators.js";import s from"./VisualVariable.js";import r from"./support/ColorStop.js";var i;let l=i=class extends s{constructor(t){super(t),this.type="color",this.normalizationField=null}get cache(){return{ipData:this._interpolateData(),hasExpression:!!this.valueExpression,compiledFunc:null}}set stops(t){t&&Array.isArray(t)&&(t=t.filter(t=>!!t)).sort((t,e)=>t.value-e.value),this._set("stops",t)}clone(){return new i({field:this.field,normalizationField:this.normalizationField,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,stops:this.stops&&this.stops.map(t=>t.clone()),legendOptions:this.legendOptions?.clone()})}getAttributeHash(){return`${super.getAttributeHash()}-${this.normalizationField}`}_interpolateData(){return this.stops&&this.stops.map(t=>t.value||0)}};t([e({readOnly:!0})],l.prototype,"cache",null),t([e({type:["color"],json:{type:["colorInfo"]}})],l.prototype,"type",void 0),t([e({type:String,json:{write:!0}})],l.prototype,"normalizationField",void 0),t([e({type:[r],json:{write:!0}})],l.prototype,"stops",null),l=i=t([o("esri.renderers.visualVariables.ColorVariable")],l);export{l as default};
2
+ import{__decorate as t}from"tslib";import{property as e,subclass as o}from"../../core/accessorSupport/decorators.js";import s from"./VisualVariable.js";import r from"./support/ColorStop.js";var i;let l=i=class extends s{constructor(t){super(t),this.type="color",this.normalizationField=null}get cache(){return{ipData:this._interpolateData(),hasExpression:!!this.valueExpression,compiledFunc:null}}set stops(t){t&&Array.isArray(t)&&(t=t.filter(t=>!!t)).sort((t,e)=>t.value-e.value),this._set("stops",t)}clone(){return new i({field:this.field,normalizationField:this.normalizationField,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,stops:this.stops&&this.stops.map(t=>t.clone()),legendOptions:this.legendOptions?.clone()})}_interpolateData(){return this.stops&&this.stops.map(t=>t.value||0)}};t([e({readOnly:!0})],l.prototype,"cache",null),t([e({type:["color"],json:{type:["colorInfo"]}})],l.prototype,"type",void 0),t([e({type:String,json:{write:!0}})],l.prototype,"normalizationField",void 0),t([e({type:[r],json:{write:!0}})],l.prototype,"stops",null),l=i=t([o("esri.renderers.visualVariables.ColorVariable")],l);export{l as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{property as e,subclass as s}from"../../core/accessorSupport/decorators.js";import i from"./VisualVariable.js";import o from"./support/OpacityStop.js";var r;let a=r=class extends i{constructor(t){super(t),this.type="opacity",this.normalizationField=null}get cache(){return{ipData:this._interpolateData(),hasExpression:!!this.valueExpression,compiledFunc:null}}set stops(t){t&&Array.isArray(t)&&(t=t.filter(t=>!!t)).sort((t,e)=>t.value-e.value),this._set("stops",t)}clone(){return new r({field:this.field,normalizationField:this.normalizationField,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,stops:this.stops&&this.stops.map(t=>t.clone()),legendOptions:this.legendOptions?.clone()})}getAttributeHash(){return`${super.getAttributeHash()}-${this.normalizationField}`}_interpolateData(){return this.stops&&this.stops.map(t=>t.value||0)}};t([e({readOnly:!0})],a.prototype,"cache",null),t([e({type:["opacity"],json:{type:["transparencyInfo"]}})],a.prototype,"type",void 0),t([e({type:String,json:{write:!0}})],a.prototype,"normalizationField",void 0),t([e({type:[o],json:{write:!0}})],a.prototype,"stops",null),a=r=t([s("esri.renderers.visualVariables.OpacityVariable")],a);export{a as default};
2
+ import{__decorate as t}from"tslib";import{property as e,subclass as s}from"../../core/accessorSupport/decorators.js";import o from"./VisualVariable.js";import i from"./support/OpacityStop.js";var r;let a=r=class extends o{constructor(t){super(t),this.type="opacity",this.normalizationField=null}get cache(){return{ipData:this._interpolateData(),hasExpression:!!this.valueExpression,compiledFunc:null}}set stops(t){t&&Array.isArray(t)&&(t=t.filter(t=>!!t)).sort((t,e)=>t.value-e.value),this._set("stops",t)}clone(){return new r({field:this.field,normalizationField:this.normalizationField,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,stops:this.stops&&this.stops.map(t=>t.clone()),legendOptions:this.legendOptions?.clone()})}_interpolateData(){return this.stops&&this.stops.map(t=>t.value||0)}};t([e({readOnly:!0})],a.prototype,"cache",null),t([e({type:["opacity"],json:{type:["transparencyInfo"]}})],a.prototype,"type",void 0),t([e({type:String,json:{write:!0}})],a.prototype,"normalizationField",void 0),t([e({type:[i],json:{write:!0}})],a.prototype,"stops",null),a=r=t([s("esri.renderers.visualVariables.OpacityVariable")],a);export{a as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{JSONMap as t}from"../../core/jsonMap.js";import i from"../../core/Logger.js";import{property as s,subclass as r}from"../../core/accessorSupport/decorators.js";import n from"./VisualVariable.js";import{castSizeFromStringOrNumber as a}from"./support/castSizeVariable.js";import o from"./support/SizeStop.js";import l from"./support/SizeVariableLegendOptions.js";import{isSizeVariable as p,getInputValueType as u,getTransformationType as m}from"./support/sizeVariableUtils.js";import{viewScaleRE as h}from"./support/visualVariableUtils.js";import{addPropertyUnsupportedError as d,addUnsupportedMessage as y}from"../../webdoc/support/unsupportedErrors.js";import{reader as c}from"../../core/accessorSupport/decorators/reader.js";import{writer as S}from"../../core/accessorSupport/decorators/writer.js";var z;const x=new t({width:"width",depth:"depth",height:"height",widthAndDepth:"width-and-depth",all:"all"}),w=new t({unknown:"unknown",inch:"inches",foot:"feet",yard:"yards",mile:"miles","nautical-mile":"nautical-miles",millimeter:"millimeters",centimeter:"centimeters",decimeter:"decimeters",meter:"meters",kilometer:"kilometers"});function v(e){if(null!=e)return"string"==typeof e||"number"==typeof e?a(e):"size"===e.type?p(e)?e:(delete(e={...e}).type,new V(e)):void 0}function g(e,t,i){if("object"!=typeof e)return e;if("web-scene"===i.origin)return;const s=new V;return s.read(e,i),s}function f(e,t,i,s){"number"!=typeof e?"web-scene"!==s?.origin?t[i]=e.toJSON(s):y(s,"error","property",`Size variable '${i}' can only be a number in web scenes.`):t[i]=e}let V=z=class extends n{constructor(e){super(e),this.axis=null,this.legendOptions=null,this.normalizationField=null,this.scaleBy=null,this.target=null,this.type="size",this.useSymbolValue=null,this.valueExpression=null,this.valueRepresentation=null,this.valueUnit=null}get cache(){return{ipData:this._interpolateData(),hasExpression:!!this.valueExpression,compiledFunc:null,isScaleDriven:null!=this.valueExpression&&h.test(this.valueExpression)}}set index(e){p(this.maxSize)&&(this.maxSize.index=`visualVariables[${e}].maxSize`),p(this.minSize)&&(this.minSize.index=`visualVariables[${e}].minSize`),this._set("index",e)}get inputValueType(){return u(this)}set maxDataValue(e){e&&this.stops&&(i.getLogger(this).warn("cannot set maxDataValue when stops is not null."),e=null),this._set("maxDataValue",e)}get maxSize(){return this._get("maxSize")}set maxSize(e){e&&this.stops&&(i.getLogger(this).warn("cannot set maxSize when stops is not null."),e=null),this._set("maxSize",v(e))}readMaxSize(e,t,i){return g(e,t,i)}writeMaxSize(e,t,i,s){return f(e,t,i,s)}set minDataValue(e){e&&this.stops&&(i.getLogger(this).warn("cannot set minDataValue when stops is not null."),e=null),this._set("minDataValue",e)}get minSize(){return this._get("minSize")}set minSize(e){e&&this.stops&&(i.getLogger(this).warn("cannot set minSize when stops is not null."),e=null),this._set("minSize",v(e))}readMinSize(e,t,i){return g(e,t,i)}writeMinSize(e,t,i,s){return f(e,t,i,s)}get arcadeRequired(){return!!this.valueExpression||(null!=this.minSize&&"object"==typeof this.minSize&&this.minSize.arcadeRequired||null!=this.maxSize&&"object"==typeof this.maxSize&&this.maxSize.arcadeRequired)}set stops(e){null==this.minDataValue&&null==this.maxDataValue&&null==this.minSize&&null==this.maxSize?e&&Array.isArray(e)&&(e=e.filter(e=>!!e)).sort((e,t)=>e.value-t.value):e&&(i.getLogger(this).warn("cannot set stops when one of minDataValue, maxDataValue, minSize or maxSize is not null."),e=null),this._set("stops",e)}get transformationType(){return m(this,this.inputValueType)}readValueExpression(e,t){return e||t.expression&&"$view.scale"}writeValueExpressionWebScene(e,t,i,s){if(h.test(e)){if(s?.messages){const e=this.index;d(s,`visualVariables[${"string"==typeof e?e:`visualVariables[${e}]`}].valueExpression`,"SizeVariable with '$view.scale' valueExpression is not supported in Web Scene. Please remove this property to save the Web Scene.")}}else t[i]=e}readValueUnit(e){return e?w.read(e):null}clone(){return new z({axis:this.axis,field:this.field,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,maxDataValue:this.maxDataValue,maxSize:p(this.maxSize)?this.maxSize.clone():this.maxSize,minDataValue:this.minDataValue,minSize:p(this.minSize)?this.minSize.clone():this.minSize,normalizationField:this.normalizationField,stops:this.stops?.map(e=>e.clone()),target:this.target,useSymbolValue:this.useSymbolValue,valueRepresentation:this.valueRepresentation,valueUnit:this.valueUnit,legendOptions:this.legendOptions?.clone()})}flipSizes(){if("clamped-linear"===this.transformationType){const{minSize:e,maxSize:t}=this;return this.minSize=t,this.maxSize=e,this}if("stops"===this.transformationType){const e=this.stops;if(!e)return this;const t=e.map(e=>e.size).reverse(),i=e.length;for(let s=0;s<i;s++)e[s].size=t[s];return this}return this}getAttributeHash(){return`${super.getAttributeHash()}-${this.target}-${this.normalizationField}`}_interpolateData(){return this.stops?.map(e=>e.value||0)}};e([s({readOnly:!0})],V.prototype,"cache",null),e([s({type:x.apiValues,json:{type:x.jsonValues,origins:{"web-map":{read:!1}},read:x.read,write:x.write}})],V.prototype,"axis",void 0),e([s()],V.prototype,"index",null),e([s({type:String,readOnly:!0})],V.prototype,"inputValueType",null),e([s({type:l,json:{write:!0}})],V.prototype,"legendOptions",void 0),e([s({type:Number,value:null,json:{write:!0}})],V.prototype,"maxDataValue",null),e([s({type:Number,useTypeForAutocast:!1,value:null,json:{write:!0}})],V.prototype,"maxSize",null),e([c("maxSize")],V.prototype,"readMaxSize",null),e([S("maxSize")],V.prototype,"writeMaxSize",null),e([s({type:Number,value:null,json:{write:!0}})],V.prototype,"minDataValue",null),e([s({type:Number,useTypeForAutocast:!1,value:null,json:{write:!0}})],V.prototype,"minSize",null),e([c("minSize")],V.prototype,"readMinSize",null),e([S("minSize")],V.prototype,"writeMinSize",null),e([s({type:String,json:{write:!0}})],V.prototype,"normalizationField",void 0),e([s({readOnly:!0})],V.prototype,"arcadeRequired",null),e([s({type:String})],V.prototype,"scaleBy",void 0),e([s({type:[o],value:null,json:{write:!0}})],V.prototype,"stops",null),e([s({type:["outline"],json:{write:!0}})],V.prototype,"target",void 0),e([s({type:String,readOnly:!0})],V.prototype,"transformationType",null),e([s({type:["size"],json:{type:["sizeInfo"]}})],V.prototype,"type",void 0),e([s({type:Boolean,json:{write:!0,origins:{"web-map":{read:!1}}}})],V.prototype,"useSymbolValue",void 0),e([s({type:String,json:{write:!0}})],V.prototype,"valueExpression",void 0),e([c("valueExpression",["valueExpression","expression"])],V.prototype,"readValueExpression",null),e([S("web-scene","valueExpression")],V.prototype,"writeValueExpressionWebScene",null),e([s({type:["radius","diameter","area","width","distance"],json:{write:!0}})],V.prototype,"valueRepresentation",void 0),e([s({type:w.apiValues,json:{write:w.write,origins:{"web-map":{read:!1},"web-scene":{write:!0},"portal-item":{write:!0}}}})],V.prototype,"valueUnit",void 0),e([c("valueUnit")],V.prototype,"readValueUnit",null),V=z=e([r("esri.renderers.visualVariables.SizeVariable")],V);export{V as default};
2
+ import{__decorate as e}from"tslib";import{JSONMap as t}from"../../core/jsonMap.js";import i from"../../core/Logger.js";import{property as s,subclass as r}from"../../core/accessorSupport/decorators.js";import n from"./VisualVariable.js";import{castSizeFromStringOrNumber as a}from"./support/castSizeVariable.js";import o from"./support/SizeStop.js";import l from"./support/SizeVariableLegendOptions.js";import{isSizeVariable as p,getInputValueType as u,getTransformationType as m}from"./support/sizeVariableUtils.js";import{viewScaleRE as h}from"./support/visualVariableUtils.js";import{addPropertyUnsupportedError as d,addUnsupportedMessage as y}from"../../webdoc/support/unsupportedErrors.js";import{reader as c}from"../../core/accessorSupport/decorators/reader.js";import{writer as S}from"../../core/accessorSupport/decorators/writer.js";var z;const x=new t({width:"width",depth:"depth",height:"height",widthAndDepth:"width-and-depth",all:"all"}),w=new t({unknown:"unknown",inch:"inches",foot:"feet",yard:"yards",mile:"miles","nautical-mile":"nautical-miles",millimeter:"millimeters",centimeter:"centimeters",decimeter:"decimeters",meter:"meters",kilometer:"kilometers"});function v(e){if(null!=e)return"string"==typeof e||"number"==typeof e?a(e):"size"===e.type?p(e)?e:(delete(e={...e}).type,new V(e)):void 0}function g(e,t,i){if("object"!=typeof e)return e;if("web-scene"===i.origin)return;const s=new V;return s.read(e,i),s}function f(e,t,i,s){"number"!=typeof e?"web-scene"!==s?.origin?t[i]=e.toJSON(s):y(s,"error","property",`Size variable '${i}' can only be a number in web scenes.`):t[i]=e}let V=z=class extends n{constructor(e){super(e),this.axis=null,this.legendOptions=null,this.normalizationField=null,this.scaleBy=null,this.target=null,this.type="size",this.useSymbolValue=null,this.valueExpression=null,this.valueRepresentation=null,this.valueUnit=null}get cache(){return{ipData:this._interpolateData(),hasExpression:!!this.valueExpression,compiledFunc:null,isScaleDriven:null!=this.valueExpression&&h.test(this.valueExpression)}}set index(e){p(this.maxSize)&&(this.maxSize.index=`visualVariables[${e}].maxSize`),p(this.minSize)&&(this.minSize.index=`visualVariables[${e}].minSize`),this._set("index",e)}get inputValueType(){return u(this)}set maxDataValue(e){e&&this.stops&&(i.getLogger(this).warn("cannot set maxDataValue when stops is not null."),e=null),this._set("maxDataValue",e)}get maxSize(){return this._get("maxSize")}set maxSize(e){e&&this.stops&&(i.getLogger(this).warn("cannot set maxSize when stops is not null."),e=null),this._set("maxSize",v(e))}readMaxSize(e,t,i){return g(e,t,i)}writeMaxSize(e,t,i,s){return f(e,t,i,s)}set minDataValue(e){e&&this.stops&&(i.getLogger(this).warn("cannot set minDataValue when stops is not null."),e=null),this._set("minDataValue",e)}get minSize(){return this._get("minSize")}set minSize(e){e&&this.stops&&(i.getLogger(this).warn("cannot set minSize when stops is not null."),e=null),this._set("minSize",v(e))}readMinSize(e,t,i){return g(e,t,i)}writeMinSize(e,t,i,s){return f(e,t,i,s)}get arcadeRequired(){return!!this.valueExpression||(null!=this.minSize&&"object"==typeof this.minSize&&this.minSize.arcadeRequired||null!=this.maxSize&&"object"==typeof this.maxSize&&this.maxSize.arcadeRequired)}set stops(e){null==this.minDataValue&&null==this.maxDataValue&&null==this.minSize&&null==this.maxSize?e&&Array.isArray(e)&&(e=e.filter(e=>!!e)).sort((e,t)=>e.value-t.value):e&&(i.getLogger(this).warn("cannot set stops when one of minDataValue, maxDataValue, minSize or maxSize is not null."),e=null),this._set("stops",e)}get transformationType(){return m(this,this.inputValueType)}readValueExpression(e,t){return e||t.expression&&"$view.scale"}writeValueExpressionWebScene(e,t,i,s){if(h.test(e)){if(s?.messages){const e=this.index;d(s,`visualVariables[${"string"==typeof e?e:`visualVariables[${e}]`}].valueExpression`,"SizeVariable with '$view.scale' valueExpression is not supported in Web Scene. Please remove this property to save the Web Scene.")}}else t[i]=e}readValueUnit(e){return e?w.read(e):null}clone(){return new z({axis:this.axis,field:this.field,valueExpression:this.valueExpression,valueExpressionTitle:this.valueExpressionTitle,maxDataValue:this.maxDataValue,maxSize:p(this.maxSize)?this.maxSize.clone():this.maxSize,minDataValue:this.minDataValue,minSize:p(this.minSize)?this.minSize.clone():this.minSize,normalizationField:this.normalizationField,stops:this.stops?.map(e=>e.clone()),target:this.target,useSymbolValue:this.useSymbolValue,valueRepresentation:this.valueRepresentation,valueUnit:this.valueUnit,legendOptions:this.legendOptions?.clone()})}flipSizes(){if("clamped-linear"===this.transformationType){const{minSize:e,maxSize:t}=this;return this.minSize=t,this.maxSize=e,this}if("stops"===this.transformationType){const e=this.stops;if(!e)return this;const t=e.map(e=>e.size).reverse(),i=e.length;for(let s=0;s<i;s++)e[s].size=t[s];return this}return this}_interpolateData(){return this.stops?.map(e=>e.value||0)}};e([s({readOnly:!0})],V.prototype,"cache",null),e([s({type:x.apiValues,json:{type:x.jsonValues,origins:{"web-map":{read:!1}},read:x.read,write:x.write}})],V.prototype,"axis",void 0),e([s()],V.prototype,"index",null),e([s({type:String,readOnly:!0})],V.prototype,"inputValueType",null),e([s({type:l,json:{write:!0}})],V.prototype,"legendOptions",void 0),e([s({type:Number,value:null,json:{write:!0}})],V.prototype,"maxDataValue",null),e([s({type:Number,useTypeForAutocast:!1,value:null,json:{write:!0}})],V.prototype,"maxSize",null),e([c("maxSize")],V.prototype,"readMaxSize",null),e([S("maxSize")],V.prototype,"writeMaxSize",null),e([s({type:Number,value:null,json:{write:!0}})],V.prototype,"minDataValue",null),e([s({type:Number,useTypeForAutocast:!1,value:null,json:{write:!0}})],V.prototype,"minSize",null),e([c("minSize")],V.prototype,"readMinSize",null),e([S("minSize")],V.prototype,"writeMinSize",null),e([s({type:String,json:{write:!0}})],V.prototype,"normalizationField",void 0),e([s({readOnly:!0})],V.prototype,"arcadeRequired",null),e([s({type:String})],V.prototype,"scaleBy",void 0),e([s({type:[o],value:null,json:{write:!0}})],V.prototype,"stops",null),e([s({type:["outline"],json:{write:!0}})],V.prototype,"target",void 0),e([s({type:String,readOnly:!0})],V.prototype,"transformationType",null),e([s({type:["size"],json:{type:["sizeInfo"]}})],V.prototype,"type",void 0),e([s({type:Boolean,json:{write:!0,origins:{"web-map":{read:!1}}}})],V.prototype,"useSymbolValue",void 0),e([s({type:String,json:{write:!0}})],V.prototype,"valueExpression",void 0),e([c("valueExpression",["valueExpression","expression"])],V.prototype,"readValueExpression",null),e([S("web-scene","valueExpression")],V.prototype,"writeValueExpressionWebScene",null),e([s({type:["radius","diameter","area","width","distance"],json:{write:!0}})],V.prototype,"valueRepresentation",void 0),e([s({type:w.apiValues,json:{write:w.write,origins:{"web-map":{read:!1},"web-scene":{write:!0},"portal-item":{write:!0}}}})],V.prototype,"valueUnit",void 0),e([c("valueUnit")],V.prototype,"readValueUnit",null),V=z=e([r("esri.renderers.visualVariables.SizeVariable")],V);export{V as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{JSONMap as r}from"../../core/jsonMap.js";import{JSONSupport as t}from"../../core/JSONSupport.js";import o from"../../core/Logger.js";import{property as i,cast as s,subclass as n}from"../../core/accessorSupport/decorators.js";import{ensureString as p}from"../../core/accessorSupport/ensureType.js";import l from"./support/VisualVariableLegendOptions.js";const a=new r({colorInfo:"color",transparencyInfo:"opacity",rotationInfo:"rotation",sizeInfo:"size"});let u=class extends t{constructor(e){super(e),this.index=null,this.type=null,this.field=null,this.valueExpression=null,this.valueExpressionTitle=null,this.legendOptions=null}castField(e){return null==e?e:"function"==typeof e?(o.getLogger(this).error(".field: field must be a string value"),null):p(e)}get arcadeRequired(){return!!this.valueExpression}clone(){}getAttributeHash(){return`${this.type}-${this.field}-${this.valueExpression}`}};e([i()],u.prototype,"index",void 0),e([i({type:a.apiValues,readOnly:!0,json:{read:a.read,write:{writer:a.write,isRequired:!0}}})],u.prototype,"type",void 0),e([i({type:String,json:{write:!0}})],u.prototype,"field",void 0),e([s("field")],u.prototype,"castField",null),e([i({type:String,json:{write:!0}})],u.prototype,"valueExpression",void 0),e([i({type:String,json:{write:!0}})],u.prototype,"valueExpressionTitle",void 0),e([i({readOnly:!0})],u.prototype,"arcadeRequired",null),e([i({type:l,json:{write:!0}})],u.prototype,"legendOptions",void 0),u=e([n("esri.renderers.visualVariables.VisualVariable")],u);export{u as default};
2
+ import{__decorate as e}from"tslib";import{JSONMap as r}from"../../core/jsonMap.js";import{JSONSupport as o}from"../../core/JSONSupport.js";import t from"../../core/Logger.js";import{property as i,cast as s,subclass as n}from"../../core/accessorSupport/decorators.js";import{ensureString as p}from"../../core/accessorSupport/ensureType.js";import l from"./support/VisualVariableLegendOptions.js";const a=new r({colorInfo:"color",transparencyInfo:"opacity",rotationInfo:"rotation",sizeInfo:"size"});let u=class extends o{constructor(e){super(e),this.index=null,this.type=null,this.field=null,this.valueExpression=null,this.valueExpressionTitle=null,this.legendOptions=null}castField(e){return null==e?e:"function"==typeof e?(t.getLogger(this).error(".field: field must be a string value"),null):p(e)}get arcadeRequired(){return!!this.valueExpression}clone(){}};e([i()],u.prototype,"index",void 0),e([i({type:a.apiValues,readOnly:!0,json:{read:a.read,write:{writer:a.write,isRequired:!0}}})],u.prototype,"type",void 0),e([i({type:String,json:{write:!0}})],u.prototype,"field",void 0),e([s("field")],u.prototype,"castField",null),e([i({type:String,json:{write:!0}})],u.prototype,"valueExpression",void 0),e([i({type:String,json:{write:!0}})],u.prototype,"valueExpressionTitle",void 0),e([i({readOnly:!0})],u.prototype,"arcadeRequired",null),e([i({type:l,json:{write:!0}})],u.prototype,"legendOptions",void 0),u=e([n("esri.renderers.visualVariables.VisualVariable")],u);export{u as default};
@@ -10,6 +10,12 @@ export interface FunctionResultProperties {}
10
10
  */
11
11
  export default class FunctionResult extends JSONSupport {
12
12
  constructor(properties?: FunctionResultProperties);
13
+ /**
14
+ * An alias to describe and provide context for the function output.
15
+ *
16
+ * @since 5.1
17
+ */
18
+ get functionName(): string | null | undefined;
13
19
  /** The aggregate function type used in the supplied trace configuration. */
14
20
  get functionType(): "add" | "subtract" | "average" | "count" | "min" | "max" | null | undefined;
15
21
  /** The name of the function result. */
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{JSONSupport as r}from"../../../core/JSONSupport.js";import{property as e,subclass as o}from"../../../core/accessorSupport/decorators.js";let s=class extends r{constructor(t){super(t),this.functionType=null,this.networkAttributeName=null,this.result=null}};t([e({type:["add","subtract","average","count","min","max"],json:{write:!0},readOnly:!0})],s.prototype,"functionType",void 0),t([e({type:String,json:{write:!0},readOnly:!0})],s.prototype,"networkAttributeName",void 0),t([e({type:Number,json:{write:!0},readOnly:!0})],s.prototype,"result",void 0),s=t([o("esri.rest.networks.support.FunctionResult")],s);const n=s;export{n as default};
2
+ import{__decorate as t}from"tslib";import{JSONSupport as e}from"../../../core/JSONSupport.js";import{property as r,subclass as o}from"../../../core/accessorSupport/decorators.js";let n=class extends e{constructor(t){super(t),this.functionName=null,this.functionType=null,this.networkAttributeName=null,this.result=null}};t([r({type:String,json:{write:!0},readOnly:!0})],n.prototype,"functionName",void 0),t([r({type:["add","subtract","average","count","min","max"],json:{write:!0},readOnly:!0})],n.prototype,"functionType",void 0),t([r({type:String,json:{write:!0},readOnly:!0})],n.prototype,"networkAttributeName",void 0),t([r({type:Number,json:{write:!0},readOnly:!0})],n.prototype,"result",void 0),n=t([o("esri.rest.networks.support.FunctionResult")],n);const s=n;export{s as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- const b="20260330",a="15e57448d129ae8382f3ab2bf7bbd130b7a1a48e";export{b as buildDate,a as commitHash};
2
+ const f="20260401",c="5c0bf29a9b919987019fc938829b00cf4effd24e";export{f as buildDate,c as commitHash};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{defaultFontFamily as t}from"../../core/fontUtils.js";import has from"../../core/has.js";import{clone as e}from"../../core/lang.js";import r from"../../core/Logger.js";import{deg2rad as i}from"../../core/mathUtils.js";import s from"../../core/ObjectPool.js";import{pt2px as o,px2pt as n}from"../../core/screenUtils.js";import{GeometryCursor as a}from"../../geometry/GeometryCursor.js";import{create as l,fromValues as h,empty as c,expandPointInPlace as m,center as f,width as u,height as d,diagonal as p}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as g}from"../../geometry/support/boundsUtils.js";import{polygonCentroid as _}from"../../geometry/support/centroid.js";import{isExtent as y,isPolygon as P,isPolyline as S,isPoint as w,isMultipoint as x}from"../../geometry/support/jsonTypeUtils.js";import{SimpleEffectCursor as M}from"./CIMEffects.js";import b from"./CIMImageColorSubstitutionHelper.js";import{getEffectOperator as k,getPlacementOperator as C}from"./CIMOperators.js";import{Placement as v}from"./CIMPlacements.js";import{defaultCIMValues as I}from"./defaultCIMValues.js";import{getFirstFrame as T}from"./imageUtils.js";import{rotate as R}from"./mathUtils.js";import{addColorStops as z}from"./rasterizingUtils.js";import L from"./Rect.js";import F from"./TextRasterizer.js";import{isMarkerScreenAligned as U,isCIMFill as A,getSize as j,getNumericValue as G,isSVGImage as D,getRelativeGradientSize as H,fromCIMFontDecoration as B,fromCIMFontStyle as E,fromCIMHorizontalAlignment as X,fromCIMVerticalAlignment as J,getFillColor as N,getStrokeColor as O,getStrokeWidth as q,getFontWeight as V,getFontStyle as W}from"./utils.js";import{destroyHiddenSvg as Y,createHiddenSvg as $,createSvgElement as K}from"../../views/2d/engine/svgUtils.js";import{magicLabelLineHeight as Q,glyphSize as Z,hittestToleranceSmallSymbol as tt,hittestSmallSymbolThreshold as et}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as rt}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as it,getLineWidth as st}from"../../views/2d/layers/graphics/graphicsUtils.js";const ot=Math.PI/180,nt=.5,at=()=>r.getLogger("esri.symbols.cim.CIMSymbolDrawHelper");class lt{constructor(t){this._t=t}static createIdentity(){return new lt([1,0,0,0,1,0])}clone(){const t=this._t;return new lt(t.slice())}transform(t){const e=this._t;return[e[0]*t[0]+e[1]*t[1]+e[2],e[3]*t[0]+e[4]*t[1]+e[5]]}static createScale(t,e){return new lt([t,0,0,0,e,0])}scale(t,e){const r=this._t;return r[0]*=t,r[1]*=t,r[2]*=t,r[3]*=e,r[4]*=e,r[5]*=e,this}scaleRatio(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])}static createTranslate(t,e){return new lt([0,0,t,0,0,e])}translate(t,e){const r=this._t;return r[2]+=t,r[5]+=e,this}static createRotate(t){const e=Math.cos(t),r=Math.sin(t);return new lt([e,-r,0,r,e,0])}rotate(t){return lt.multiply(this,lt.createRotate(t),this)}angle(){const t=this._t[0],e=this._t[3],r=Math.sqrt(t*t+e*e);return[t/r,e/r]}static multiply(t,e,r){const i=t._t,s=e._t,o=i[0]*s[0]+i[3]*s[1],n=i[1]*s[0]+i[4]*s[1],a=i[2]*s[0]+i[5]*s[1]+s[2],l=i[0]*s[3]+i[3]*s[4],h=i[1]*s[3]+i[4]*s[4],c=i[2]*s[3]+i[5]*s[4]+s[5],m=r._t;return m[0]=o,m[1]=n,m[2]=a,m[3]=l,m[4]=h,m[5]=c,r}invert(){const t=this._t;let e=t[0]*t[4]-t[1]*t[3];if(0===e)return new lt([0,0,0,0,0,0]);e=1/e;const r=(t[1]*t[5]-t[2]*t[4])*e,i=(t[2]*t[3]-t[0]*t[5])*e,s=t[4]*e,o=-t[1]*e,n=-t[3]*e,a=t[0]*e;return new lt([s,o,r,n,a,i])}}class ht{constructor(t,e){this._resourceManager=t,this._transfos=[],this._sizeTransfos=[],this._geomUnitsPerPoint=1,this._placementPool=new s(()=>new v,void 0,void 0,100),this._earlyReturn=!1,this._mapRotation=0,this._transfos.push(e||lt.createIdentity()),this._sizeTransfos.push(e?e.scaleRatio():1)}setTransform(t,e){this._transfos=[t||lt.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():1)]}setGeomUnitsPerPoint(t){this._geomUnitsPerPoint=t}transformPt(t){return this._transfos[this._transfos.length-1].transform(t)}transformSize(t){return t*this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformPt(t){return this._transfos[this._transfos.length-1].invert().transform(t)}reverseTransformSize(t){return t/this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformScalar(t){return t/this._transfos[this._transfos.length-1].scaleRatio()}getTransformAngle(){return this._transfos[this._transfos.length-1].angle()}geomUnitsPerPoint(){return this.isEmbedded()?1:this._geomUnitsPerPoint}prevGeomUnitsPerPoint(){return this._transfos.length>2?1:this._geomUnitsPerPoint}isEmbedded(){return this._transfos.length>1}back(){return this._transfos[this._transfos.length-1]}push(t,e){const r=e?t.scaleRatio():1;lt.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*r)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.splice(-1,1)}drawSymbol(t,e,r){if(t)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this.drawMultiLayerSymbol(t,e);break;case"CIMTextSymbol":this.drawTextSymbol(t,e,r)}}drawMultiLayerSymbol(t,e){if(!t||!e)return;const r=t.symbolLayers;if(!r)return;const i=t.effects;if(i&&i.length>0){const t=this.executeEffects(i,e);if(t){let e=t.next();for(;e;)this.drawSymbolLayers(r,e.asJSON()),e=t.next()}}else this.drawSymbolLayers(r,e)}executeEffects(t,e){let r=new M(a.fromJSONCIM(e));for(const i of t){const t=k(i);t&&(r=t.execute(r,i,this.geomUnitsPerPoint(),null))}return r}drawSymbolLayers(t,e){let r=t.length;for(;r--;){const i=t[r];if(!i||!1===i.enable)continue;const s=i.effects;if(s&&s.length>0){const t=this.executeEffects(s,e);if(t){let e=null;for(;(e=t.next())&&(this.drawSymbolLayer(i,e.asJSON()),!this._earlyReturn););}}else this.drawSymbolLayer(i,e);if(this._earlyReturn)return}}drawSymbolLayer(t,e){switch(t.type){case"CIMSolidFill":this.drawSolidFill(e,t.color,t.path);break;case"CIMHatchFill":this.drawHatchFill(e,t);break;case"CIMPictureFill":this.drawPictureFill(e,t);break;case"CIMGradientFill":this.drawGradientFill(e,t);break;case"CIMSolidStroke":this.drawSolidStroke(e,t.color,t.width,t.capStyle,t.joinStyle,t.miterLimit,t.path);break;case"CIMPictureStroke":this.drawPictureStroke(e,t);break;case"CIMGradientStroke":this.drawGradientStroke(e,t);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":this.drawMarkerLayer(t,e)}}drawHatchFill(t,e){const r=ut(e,t,this.geomUnitsPerPoint());r&&(this.pushClipPath(t),this.drawMultiLayerSymbol(e.lineSymbol,r),this.popClipPath())}drawPictureFill(t,e){}drawGradientFill(t,e){}drawPictureStroke(t,e){}drawGradientStroke(t,e){}drawMarkerLayer(t,e){const r=t.markerPlacement;if(r){const i=C(r);if(i){const s="CIMMarkerPlacementInsidePolygon"===r.type||"CIMMarkerPlacementPolygonCenter"===r.type&&r.clipAtBoundary;s&&this.pushClipPath(e);const o=i.execute(a.fromJSONCIM(e),r,this.geomUnitsPerPoint(),null);if(o){let e=null;for(;(e=o.next())&&(this.drawMarker(t,e),!this._earlyReturn););}s&&this.popClipPath()}}else{const r=this._placementPool.acquire();if(w(e))r.tx=e.x,r.ty=e.y,this.drawMarker(t,r);else if(P(e)){const i=_(e);i&&([r.tx,r.ty]=i,this.drawMarker(t,r))}else if(S(e)){for(const i of e.paths)for(const e of i)if(r.tx=e[0],r.ty=e[1],this.drawMarker(t,r),this._earlyReturn)break}else for(const i of e.points)if(r.tx=i[0],r.ty=i[1],this.drawMarker(t,r),this._earlyReturn)break;this._placementPool.release(r)}}drawMarker(t,e){switch(t.type){case"CIMCharacterMarker":case"CIMPictureMarker":this.drawPictureMarker(t,e);break;case"CIMVectorMarker":this.drawVectorMarker(t,e)}}drawPictureMarker(t,e){if(!t)return;const r=this._resourceManager.getResource(t.url),i=G(t.size,I.CIMPictureMarker.size);if(null==r||i<=0)return;const s=r.width,o=r.height;if(!s||!o)return;const n=s/o,a=G(t.scaleX,1),l=lt.createIdentity(),h=t.anchorPoint;if(h){let e=h.x,r=h.y;"Absolute"!==t.anchorPointUnits&&(e*=i*n*a,r*=i),l.translate(-e,-r)}let c=G(t.rotation);t.rotateClockwise&&(c=-c),this._mapRotation&&(c+=this._mapRotation),c&&l.rotate(c*ot);let m=G(t.offsetX),f=G(t.offsetY);if(m||f){if(this._mapRotation){const t=ot*this._mapRotation,e=Math.cos(t),r=Math.sin(t),i=m*r+f*e;m=m*e-f*r,f=i}l.translate(m,f)}const u=this.geomUnitsPerPoint();1!==u&&l.scale(u,u);const d=e.getAngle();d&&l.rotate(d),l.translate(e.tx,e.ty),this.push(l,!1),this.drawImage(t,i),this.pop()}drawVectorMarker(t,e){if(!t)return;const r=t.markerGraphics;if(!r)return;const i=G(t.size,I.CIMVectorMarker.size),s=t.frame,o=s?s.ymax-s.ymin:0,n=i&&o?i/o:1,a=lt.createIdentity();s&&a.translate(.5*-(s.xmax+s.xmin),.5*-(s.ymax+s.ymin));const l=t.anchorPoint;if(l){let e=l.x,r=l.y;"Absolute"!==t.anchorPointUnits?s&&(e*=s.xmax-s.xmin,r*=s.ymax-s.ymin):(e/=n,r/=n),a.translate(-e,-r)}1!==n&&a.scale(n,n);let h=G(t.rotation);t.rotateClockwise&&(h=-h),this._mapRotation&&(h+=this._mapRotation),h&&a.rotate(h*ot);let c=G(t.offsetX),m=G(t.offsetY);if(c||m){if(this._mapRotation){const t=ot*this._mapRotation,e=Math.cos(t),r=Math.sin(t),i=c*r+m*e;c=c*e-m*r,m=i}a.translate(c,m)}const f=this.geomUnitsPerPoint();1!==f&&a.scale(f,f);const u=e.getAngle();u&&a.rotate(u),a.translate(e.tx,e.ty),this.push(a,t.scaleSymbolsProportionally);for(const d of r){d?.symbol&&d.geometry||at().error("Invalid marker graphic",d);let t=d.textString;if("number"==typeof t&&(t=t.toString()),this.drawSymbol(d.symbol,d.geometry,t),this._earlyReturn)break}this.pop()}drawTextSymbol(t,e,r){if(!t)return;if(!w(e))return;if(G(t.height,I.CIMTextSymbol.height)<=0)return;const i=lt.createIdentity();let s=G(t.angle);s=-s,s&&i.rotate(s*ot);const o=G(t.offsetX),n=G(t.offsetY);(o||n)&&i.translate(o,n);const a=this.geomUnitsPerPoint();1!==a&&i.scale(a,a),i.translate(e.x,e.y),this.push(i,!1),this.drawText(t,r),this.pop()}}class ct extends ht{constructor(t,e){super(t,e),this.reset()}reset(){this._xmin=this._ymin=1/0,this._xmax=this._ymax=-1/0,this._clipCount=0}envelope(){return new L(this._xmin,this._ymin,this._xmax-this._xmin,this._ymax-this._ymin)}bounds(){return h(this._xmin,this._ymin,this._xmax,this._ymax)}drawSolidFill(t){if(t&&!(this._clipCount>0))if(P(t))this._processPath(t.rings,0);else if(S(t))this._processPath(t.paths,0);else if(y(t)){const e=_t(t);e&&this._processPath(e.rings,0)}else console.error("drawSolidFill Unexpected geometry type!")}drawSolidStroke(t,e,r){if(!t||this._clipCount>0||null==r||r<=0)return;const i=Math.max(.5*this.transformSize(G(r,I.CIMSolidStroke.width)),.5*nt);if(P(t))this._processPath(t.rings,i);else if(S(t))this._processPath(t.paths,i);else if(y(t)){const e=_t(t);e&&this._processPath(e.rings,i)}else console.error("drawSolidStroke unexpected geometry type!")}drawMarkerLayer(t,e){P(e)&&t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._processPath(e.rings,0):super.drawMarkerLayer(t,e)}drawHatchFill(t,e){this.drawSolidFill(t)}drawPictureFill(t,e){this.drawSolidFill(t)}drawGradientFill(t,e){this.drawSolidFill(t)}drawPictureStroke(t,e){this.drawSolidStroke(t,null,e.width)}drawGradientStroke(t,e){this.drawSolidStroke(t,null,e.width)}pushClipPath(t){this.drawSolidFill(t),this._clipCount++}popClipPath(){this._clipCount--}drawImage(t,e){const{url:r}=t,i=G(t.scaleX,1);let s=i*e,o=e;const n=this._resourceManager.getResource(r);if(null!=n){const t=n.height/n.width;s=i*(e?t>1?e:e/t:n.width),o=e?t>1?e*t:e:n.height}this._merge(this.transformPt([-s/2,-o/2]),0),this._merge(this.transformPt([-s/2,o/2]),0),this._merge(this.transformPt([s/2,-o/2]),0),this._merge(this.transformPt([s/2,o/2]),0)}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new F);const r=Pt(t);let[i,s]=this._textRasterizer.computeTextSize(e,r);i=n(i),s=n(s);const o=this.transformSize(1)*this.reverseTransformScalar(1);i*=o,s*=o;let a=0;switch(t.horizontalAlignment){case"Left":a=i/2;break;case"Right":a=-i/2}let l=0;switch(t.verticalAlignment){case"Bottom":l=s/2;break;case"Top":l=-s/2;break;case"Baseline":l=s/6}this._merge(this.transformPt([-i/2+a,-s/2+l]),0),this._merge(this.transformPt([-i/2+a,s/2+l]),0),this._merge(this.transformPt([i/2+a,-s/2+l]),0),this._merge(this.transformPt([i/2+a,s/2+l]),0)}_processPath(t,e){if(t)for(const r of t){const t=r?r.length:0;if(t>1){this._merge(this.transformPt(r[0]),e);for(let i=1;i<t;i++)this._merge(this.transformPt(r[i]),e)}}}_merge(t,e){t[0]-e<this._xmin&&(this._xmin=t[0]-e),t[0]+e>this._xmax&&(this._xmax=t[0]+e),t[1]-e<this._ymin&&(this._ymin=t[1]-e),t[1]+e>this._ymax&&(this._ymax=t[1]+e)}}class mt extends ht{constructor(){super(...arguments),this._searchPoint=[0,0],this._searchDistPoint=0,this._textInfo=null,this._svg=null,this._path=null,this._canvas=null}destroy(){this._svg=Y(this._svg),this._path=null,this._canvas=null}hitTest(t,e,r,i,s,a){const l=a*o(1);this.setTransform(),this.setGeomUnitsPerPoint(l),this._searchPoint=[(t[0]+t[2])/2,(t[1]+t[3])/2],this._searchDistPoint=(t[2]-t[0])/2/l,this._textInfo=i;const h=e&&("CIMPointSymbol"===e.type&&"Map"!==e.angleAlignment||"CIMTextSymbol"===e.type||e.symbolLayers?.some(t=>U(t)));if(this._mapRotation=h?s:0,!has("esri-mobile")){const t=n(tt*window.devicePixelRatio),r=n(et);!(("CIMLineSymbol"===e?.type||"CIMPolygonSymbol"===e?.type)&&e.symbolLayers?.some(A))&&"CIMMeshSymbol"!==e?.type&&(j(e)??0)<r&&(this._searchDistPoint=t)}return this._earlyReturn=!1,this.drawSymbol(e,r),this._earlyReturn}executeEffects(t,e){return"CIMGeometricEffectDashes"===t.at(-1)?.type&&(t=t.slice(0,-1)),super.executeEffects(t,e)}drawSolidFill(t,e,r){null!=r?this._hittestSvgPath(t,r,!0):this._hitTestFill(t)}drawHatchFill(t,e){this._hitTestFill(t)}drawPictureFill(t,e){this._hitTestFill(t)}drawGradientFill(t,e){this._hitTestFill(t)}drawSolidStroke(t,e,r,i,s,o,n){null!=n?this._hittestSvgPath(t,n,!1,r):this._hitTestStroke(t,r)}drawPictureStroke(t,e){this._hitTestStroke(t,e.width)}drawGradientStroke(t,e){this._hitTestStroke(t,e.width)}drawMarkerLayer(t,e){t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._hitTestFill(e):super.drawMarkerLayer(t,e)}pushClipPath(t){}popClipPath(){}drawImage(t,e){const{url:r}=t,i=G(t.scaleX,1),s=this._resourceManager.getResource(r);if(null==s||0===s.height||0===e)return;const o=e*this.geomUnitsPerPoint(),n=o*i*(s.width/s.height),a=this.reverseTransformPt(this._searchPoint),l=this._searchDistPoint;Math.abs(a[0])<n/2+l&&Math.abs(a[1])<o/2+l&&(this._earlyReturn=!0)}drawText(t,e){const r=this._textInfo;if(!r)return;const i=r.get(t);if(!i)return;if(!i.glyphMosaicItems.glyphs.length)return;const s=it(G(t.height,I.CIMTextSymbol.height)),{lineGapType:o,lineGap:n}=t,a=o?yt(o,G(n),s):0,l="CIMBackgroundCallout"===t.callout?.type,h=rt(i.glyphMosaicItems,{scale:s/Z,angle:0,xOffset:0,yOffset:0,horizontalAlignment:t.horizontalAlignment,verticalAlignment:t.verticalAlignment,maxLineWidth:st(t.lineWidth),lineHeight:Q*Math.max(.25,Math.min(a||1,4)),decoration:t.font.decoration||"none",useCIMAngleBehavior:!0,hasBackground:l}),c=this.reverseTransformPt(this._searchPoint),m=c[0],f=c[1];for(const u of h.glyphs)if(m>u.xTopLeft&&m<u.xBottomRight&&f>-u.yBottomRight&&f<-u.yTopLeft){this._earlyReturn=!0;break}}_hitTestFill(t){let e=null;if(y(t)){const r=t;e=[[[r.xmin,r.ymin],[r.xmin,r.ymax],[r.xmax,r.ymax],[r.xmax,r.ymin],[r.xmin,r.ymin]]]}else if(P(t))e=t.rings;else{if(!S(t))return;e=t.paths}const r=this.reverseTransformPt(this._searchPoint);if(dt(r,e)&&(this._earlyReturn=!0),!this._earlyReturn){pt(r,e,this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}}_getSvgPath(){return null!=this._svg&&null!=this._path||(this._svg??=$(),this._path??=K("path"),this._svg.appendChild(this._path)),this._path}_getCanvasContext(t,e){return this._canvas??=document.createElement("canvas"),this._canvas.width=t,this._canvas.height=e,this._canvas.getContext("2d",{willReadFrequently:!0})}_hittestSvgPath(t,e,r,i=0){const s=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint(),o=this.reverseTransformPt(this._searchPoint),n=l();g(n,t);const a={x:n[0],y:n[1],width:n[2]-n[0],height:n[3]-n[1]},h=this._getSvgPath();h.setAttribute("d",e);const c=h.getBBox();let m=Math.max(c.width/a.width,c.height/a.height),f=1;const u=2*s*m;u<1&&(f=2/u,m*=f,c.x*=f,c.y*=f,c.width*=f,c.height*=f);const d=1+i*m/2,p=this._getCanvasContext(c.width+2*d,c.height+2*d);p.setTransform(f,0,0,f,-c.x+d,-c.y+d);const _=new Path2D(e);r?p.fill(_):(p.lineWidth=i*(m/f),p.stroke(_));const y=(a.width*m-c.width)/2,P=(a.height*m-c.height)/2,S=Math.floor((o[0]-a.x-s)*m-y+d),w=Math.floor((a.height-(o[1]-a.y)-s)*m+P+d),x=Math.ceil(2*s*m),M=Math.ceil(2*s*m),b=p.getImageData(S,w,x,M).data;for(let l=3;l<b.length;l+=4)if(b[l]>127.5)return void(this._earlyReturn=!0)}_hitTestStroke(t,e){let r=null;if(y(t)){const e=t;r=[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]}else if(P(t))r=t.rings;else{if(!S(t))return;r=t.paths}pt(this.reverseTransformPt(this._searchPoint),r,G(e,I.CIMSolidStroke.width)*this.geomUnitsPerPoint()/2+this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}}class ft extends ht{constructor(t,e,r,i){super(e,r),this._applyAdditionalRenderProps=i,this._colorSubstitutionHelper=new b,this._ctx=t}drawSolidFill(t,e){if(!t)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else if(y(t))this._buildPath(_t(t).rings,!0);else{if(!x(t))return;console.log("CanvasDrawHelper.drawSolidFill - No implementation!")}const r=this._ctx;r.fillStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",r.fill("evenodd")}drawSolidStroke(t,e,r,i,s,o){if(!t||!e||0===r)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!1);else{if(!y(t))return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!");this._buildPath(_t(t).rings,!0)}const n=this._ctx;n.strokeStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",n.lineWidth=Math.max(this.transformSize(r),nt),this._setCapStyle(i),this._setJoinStyle(s),n.miterLimit=o,n.stroke()}pushClipPath(t){if(this._ctx.save(),P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else{if(!y(t))return;this._buildPath(_t(t).rings,!0)}this._ctx.clip("evenodd")}popClipPath(){this._ctx.restore()}drawImage(t,e){const{colorSubstitutions:r,url:i,tintColor:s}=t,o=G(t.scaleX,1),n=this._resourceManager.getResource(i);if(null==n)return;let a=e*(n.width/n.height),l=e;e||(a=n.width,l=n.height);const h=D(i)||"src"in n&&D(n.src);let c="getFrame"in n?T(n):n;r&&(c=this._colorSubstitutionHelper.applyColorSubstitution(c,r)),this._applyAdditionalRenderProps&&!h&&s&&(c=this._colorSubstitutionHelper.tintImageData(c,s));const m=this.transformPt([0,0]),[f,u]=this.getTransformAngle(),d=this.transformSize(1),p=this._ctx;p.save(),p.setTransform({m11:o*d*f,m12:o*d*u,m21:-d*u,m22:d*f,m41:m[0],m42:m[1]}),p.drawImage(c,-a/2,-l/2,a,l),p.restore()}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new F);const r=Pt(t,this.transformSize(n(1))),i=this._textRasterizer.rasterizeText(e,r);if(!i)return;const{size:s,anchorX:o,anchorY:a,canvas:l}=i,h=s[0]*(o+.5),c=s[1]*(a-.5),m=this._ctx,f=this.transformPt([0,0]),[u,d]=this.getTransformAngle(),p=1;m.save(),m.setTransform({m11:p*u,m12:p*d,m21:-p*d,m22:p*u,m41:f[0]-p*h,m42:f[1]+p*c}),m.drawImage(l,0,0),m.restore()}drawPictureFill(t,e){if(!t)return;let{colorSubstitutions:r,height:i,offsetX:s,offsetY:o,rotation:n,scaleX:a,tintColor:l,url:h}=e;const c=this._resourceManager.getResource(h);if(null==c)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else if(y(t))this._buildPath(_t(t).rings,!0);else{if(!x(t))return;console.log("CanvasDrawHelper.drawPictureFill - No implementation!")}const m=this._ctx,f=D(h)||"src"in c&&D(c.src);let u,d="getFrame"in c?T(c):c;if(r&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,r)),this._applyAdditionalRenderProps){f||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)),u=m.createPattern(d,"repeat");const t=this.transformSize(1);n||(n=0),s?s*=t:s=0,o?o*=t:o=0,i&&(i*=t);const e=i?i/c.height:1,r=a&&i?a*i/c.width:1;if(0!==n||1!==e||1!==r||0!==s||0!==o){const t=new DOMMatrix;t.rotateSelf(0,0,-n).translateSelf(s,o).scaleSelf(r,e,1),u.setTransform(t)}}else u=m.createPattern(d,"repeat");m.save(),m.fillStyle=u,m.fill("evenodd"),m.restore()}drawPictureStroke(t,r){if(!t)return;let{colorSubstitutions:i,capStyle:s,joinStyle:n,miterLimit:a,tintColor:l,url:h,width:c}=r;const m=this._resourceManager.getResource(h);if(null==m)return;let f;if(P(t))f=t.rings;else if(S(t))f=t.paths;else{if(!y(t))return x(t)?void console.log("CanvasDrawHelper.drawPictureStroke - No implementation!"):void 0;f=_t(t).rings}c||(c=m.width);const u=D(h)||"src"in m&&D(m.src);let d="getFrame"in m?T(m):m;i&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,i)),this._applyAdditionalRenderProps&&(u||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)));const p=Math.max(this.transformSize(o(c)),.5),g=p/d.width,_=this._ctx,w=_.createPattern(d,"repeat-y");let M,b;_.save(),this._setCapStyle(s),this._setJoinStyle(n),void 0!==a&&(_.miterLimit=a),_.lineWidth=p;for(let o of f)if(o=e(o),wt(o),o&&!(o.length<=1)){M=this.transformPt(o[0]);for(let t=1;t<o.length;t++){b=this.transformPt(o[t]);const e=gt(M,b),r=new DOMMatrix;r.translateSelf(0,M[1]-p/2).scaleSelf(g,g,1).rotateSelf(0,0,90-e),w.setTransform(r),_.strokeStyle=w,_.beginPath(),_.moveTo(M[0],M[1]),_.lineTo(b[0],b[1]),_.stroke(),M=b}}_.restore()}drawGradientFill(t,e){if(!t)return;let r;if(P(t))r=t.rings;else if(S(t))r=t.paths;else{if(!y(t))return void at().error("Unable to draw gradient fill");r=_t(t).rings}this._buildPath(r,!0);const{angle:s,gradientMethod:n,gradientSize:a,gradientSizeUnits:l}=e,h=I.CIMGradientFill,g=e.gradientType??h.gradientType,_=-i(s??0),w=c();for(const i of r){const t=i?i.length:0;if(t>1)for(let e=0;e<t;e++){let t=this.transformPt(i[e]);"Linear"!==n&&"Rectangular"!==n||(t=R(t,-_)),m(w,t)}}const[x,M,b,k]=w,C=this._ctx;switch(C.save(),n){case"Buffered":at().error(`Gradient method "${n}" currently unsupported.`);break;case"Linear":{const t=(M+k)/2,r="Absolute"===l?this.transformSize(o(a)):H(a,h.gradientSize)*(b-x),[i,s]="Discrete"===g?[b,b-r]:[x+r,x],n=R([i,t],_),c=R([s,t],_),m=C.createLinearGradient(n[0],n[1],c[0],c[1]);z(m,e),C.fillStyle=m,C.fill("evenodd");break}case"Circular":{const t=f(w),r=p(w)/2,i="Absolute"===l?this.transformSize(o(a)):H(a,h.gradientSize)*r,[s,n]="Discrete"===g?[r,r-i]:[i,0],c=C.createRadialGradient(t[0],t[1],s,t[0],t[1],n);z(c,e),C.fillStyle=c,C.fill("evenodd");break}case"Rectangular":{const r=f(w),i=r[0],s=r[1],n=R(r,_),c=(r,i,s,o,a,l,h,c)=>{C.save(),this.pushClipPath(t);const m=R([a,l],_),f=R([h,c],_);C.beginPath(),C.moveTo(n[0],n[1]),C.lineTo(m[0],m[1]),C.lineTo(f[0],f[1]),C.lineTo(n[0],n[1]),C.clip();const u=R([r,i],_),d=R([s,o],_),p=C.createLinearGradient(u[0],u[1],d[0],d[1]);z(p,e),C.fillStyle=p,C.fill("evenodd"),C.restore()};let m="Absolute"===l?this.transformSize(o(a)):H(a,h.gradientSize)*(u(w)/2),[p,y]="Discrete"===g?[b,b-m]:[i+m,i];c(p,s,y,s,b,M,b,k),[p,y]="Discrete"===g?[x,x+m]:[i-m,i],c(p,s,y,s,x,k,x,M),m="Absolute"===l?this.transformSize(o(a)):H(a,h.gradientSize)*(d(w)/2);let[P,S]="Discrete"===g?[k,k-m]:[s+m,s];c(i,P,i,S,b,k,x,k),[P,S]="Discrete"===g?[M,M+m]:[s-m,s],c(i,P,i,S,x,M,b,M);break}}C.restore()}drawGradientStroke(t,r){const{capStyle:i,gradientMethod:s,gradientSize:n,gradientSizeUnits:a,joinStyle:l,miterLimit:h,width:c}=r;if(!t||0===c)return;let m;if(P(t))m=t.rings;else if(S(t))m=t.paths;else{if(!y(t))return void at().error("Unable to draw gradient stroke");m=_t(t).rings}const f=r.gradientType??I.CIMGradientStroke.gradientType,u=Math.max(this.transformSize(o(c)),.5),d=this._ctx;let p,g;d.save(),this._setCapStyle(i),this._setJoinStyle(l),void 0!==h&&(d.miterLimit=h),d.lineWidth=u;for(let _ of m){if(_=e(_),wt(_),!_||_.length<=1)continue;let t=0;p=this.transformPt(_[0]);for(let e=1;e<_.length;e++){g=this.transformPt(_[e]);const r=g[0]-p[0],i=g[1]-p[1];t+=Math.sqrt(r*r+i*i),p=g}const i="Absolute"===a?this.transformSize(o(n)):H(n,I.CIMGradientStroke.gradientSize)*("AcrossLine"===s?u:t);let l=0;p=this.transformPt(_[0]);for(let e=1;e<_.length;e++){g=this.transformPt(_[e]);const o=g[0]-p[0],n=g[1]-p[1],a=Math.sqrt(o*o+n*n);let h,c,m,y;switch(s){case"AcrossLine":{const[t,e]=R([o/a,n/a],-Math.PI/2),r=u/2,s="Discrete"===f?r:i-r;h=(p[0]+g[0])/2+t*s,c=(p[1]+g[1])/2+e*s,m=h-t*i,y=c-e*i;break}case"AlongLine":{const e=o/a,r=n/a;"Discrete"===f?(h=p[0]-e*l,c=p[1]-r*l,m=h+e*i,y=c+r*i):(m=p[0]+e*(t-l),y=p[1]+r*(t-l),h=m-e*i,c=y-r*i);break}default:return at().error("Unrecognized gradient method:",s),void d.restore()}const P=d.createLinearGradient(h,c,m,y);z(P,r),d.strokeStyle=P,d.beginPath(),d.moveTo(p[0],p[1]),d.lineTo(g[0],g[1]),d.stroke(),l+=a,p=g}}d.restore()}_buildPath(t,e){const r=this._ctx;if(r.beginPath(),t)for(const i of t){const t=i?i.length:0;if(t>1){let s=this.transformPt(i[0]);r.moveTo(s[0],s[1]);for(let e=1;e<t;e++)s=this.transformPt(i[e]),r.lineTo(s[0],s[1]);e&&r.closePath()}}}_setCapStyle(t){switch(t){case"Butt":this._ctx.lineCap="butt";break;case"Round":this._ctx.lineCap="round";break;case"Square":this._ctx.lineCap="square"}}_setJoinStyle(t){switch(t){case"Bevel":this._ctx.lineJoin="bevel";break;case"Round":this._ctx.lineJoin="round";break;case"Miter":this._ctx.lineJoin="miter"}}}function ut(t,e,r){let i=G(t.separation,I.CIMHatchFill.separation)*r,s=G(t.rotation);if(0===i)return null;i<0&&(i=-i);let o=0;const n=.5*i;for(;o>n;)o-=i;for(;o<-n;)o+=i;const a=l();g(a,e),a[0]-=n,a[1]-=n,a[2]+=n,a[3]+=n;const h=[[a[0],a[1]],[a[0],a[3]],[a[2],a[3]],[a[2],a[1]]];for(;s>180;)s-=180;for(;s<0;)s+=180;const c=Math.cos(s*ot),m=Math.sin(s*ot),f=-i*m,u=i*c;let d,p,_,y;o=G(t.offsetX)*r*m-G(t.offsetY)*r*c,d=_=Number.MAX_VALUE,p=y=-Number.MAX_VALUE;for(const l of h){const t=l[0],e=l[1],r=c*t+m*e,i=-m*t+c*e;d=Math.min(d,r),_=Math.min(_,i),p=Math.max(p,r),y=Math.max(y,i)}_=Math.floor(_/i)*i;let P=c*d-m*_-f*o/i,S=m*d+c*_-u*o/i,w=c*p-m*_-f*o/i,x=m*p+c*_-u*o/i;const M=1+Math.round((y-_)/i),b=[];for(let l=0;l<M;l++)P+=f,S+=u,w+=f,x+=u,b.push([[P,S],[w,x]]);return{paths:b}}function dt(t,e){let r=0;for(const i of e){const e=i.length;for(let s=1;s<e;s++){const e=i[s-1],o=i[s];if(e[1]>t[1]==o[1]>t[1])continue;(o[0]-e[0])*(t[1]-e[1])-(o[1]-e[1])*(t[0]-e[0])>0?r++:r--}}return 0!==r}function pt(t,e,r){for(const i of e){const e=i.length;for(let s=1;s<e;s++){const e=i[s-1],o=i[s];let n=(o[0]-e[0])*(o[0]-e[0])+(o[1]-e[1])*(o[1]-e[1]);if(0===n)continue;n=Math.sqrt(n);const a=((o[0]-e[0])*(t[1]-e[1])-(o[1]-e[1])*(t[0]-e[0]))/n;if(Math.abs(a)<r){const i=((o[0]-e[0])*(t[0]-e[0])+(o[1]-e[1])*(t[1]-e[1]))/n;if(i>-r&&i<n+r)return!0}}}return!1}function gt(t,e){const r=e[0]-t[0],i=e[1]-t[1];return 180/Math.PI*Math.atan2(i,r)}const _t=t=>t?{spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:null,yt=(t,e,r)=>{switch(t){case"ExtraLeading":return 1+e/r;case"Multiple":return e;case"Exact":return e/r}};function Pt(e,r=1){const i=B(e),s=E(e.fontStyleName),o=e.fontFamilyName??t,{weight:n,style:a}=s,l=r*(e.height||5),h=X(e.horizontalAlignment),c=J(e.verticalAlignment),m=N(e),f=N(e.haloSymbol),u=null!=f?r*(e.haloSize??0):0,d=O(e.symbol),p=r*(q(e.symbol)||0),g="CIMBackgroundCallout"===e.callout?.type?e.callout.backgroundSymbol:null,_=N(g),y=q(g),P=O(g);return{color:m,size:l,horizontalAlignment:h,verticalAlignment:c,font:{family:o,style:W(a),weight:V(n),decoration:i},outline:{size:p||0,color:d},halo:{size:u||0,color:f,style:a},backgroundColor:_,borderLine:null!=y&&null!=P?{size:y,color:P}:null,pixelRatio:1,premultiplyColors:!0}}const St=1e-4;function wt(t){let e,r,i,s,o,n=t[0],a=1;for(;a<t.length;)e=t[a][0]-n[0],r=t[a][1]-n[1],s=0!==e?r/e:Math.PI/2,void 0!==i&&Math.abs(s-i)<=St?(t.splice(a-1,1),n=o):(o=n,n=t[a],a++),i=s}export{ht as CIMSymbolDrawHelper,ft as CanvasDrawHelper,ct as EnvDrawHelper,mt as HittestDrawHelper,lt as Transformation,ot as cDegToRad,yt as lineGapType2LineHeight};
2
+ import{defaultFontFamily as t}from"../../core/fontUtils.js";import has from"../../core/has.js";import{clone as e}from"../../core/lang.js";import r from"../../core/Logger.js";import{deg2rad as i}from"../../core/mathUtils.js";import s from"../../core/ObjectPool.js";import{pt2px as o,px2pt as n}from"../../core/screenUtils.js";import{GeometryCursor as a}from"../../geometry/GeometryCursor.js";import{create as l,fromValues as h,empty as c,expandPointInPlace as m,center as f,width as u,height as d,diagonal as p}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as g}from"../../geometry/support/boundsUtils.js";import{polygonCentroid as _}from"../../geometry/support/centroid.js";import{isExtent as y,isPolygon as P,isPolyline as S,isPoint as w,isMultipoint as x}from"../../geometry/support/jsonTypeUtils.js";import{SimpleEffectCursor as M}from"./CIMEffects.js";import b from"./CIMImageColorSubstitutionHelper.js";import{getEffectOperator as k,getPlacementOperator as C}from"./CIMOperators.js";import{Placement as v}from"./CIMPlacements.js";import{defaultCIMValues as I}from"./defaultCIMValues.js";import{getFirstFrame as T}from"./imageUtils.js";import{rotate as R}from"./mathUtils.js";import{addColorStops as z}from"./rasterizingUtils.js";import L from"./Rect.js";import F from"./TextRasterizer.js";import{isMarkerScreenAligned as U,isCIMFill as A,getSize as j,getNumericValue as G,isSVGImage as D,getRelativeGradientSize as H,fromCIMFontDecoration as B,fromCIMFontStyle as E,fromCIMHorizontalAlignment as X,fromCIMVerticalAlignment as J,getFillColor as N,getStrokeColor as O,getStrokeWidth as q,getFontWeight as V,getFontStyle as W}from"./utils.js";import{destroyHiddenSvg as Y,createHiddenSvg as $,createSvgElement as K}from"../../views/2d/engine/svgUtils.js";import{magicLabelLineHeight as Q,glyphSize as Z,hittestToleranceSmallSymbol as tt,hittestSmallSymbolThreshold as et}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as rt}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";import{roundPtToWholePixel as it,getLineWidth as st}from"../../views/2d/layers/graphics/graphicsUtils.js";const ot=Math.PI/180,nt=.5,at=()=>r.getLogger("esri.symbols.cim.CIMSymbolDrawHelper");class lt{constructor(t){this._t=t}static createIdentity(){return new lt([1,0,0,0,1,0])}clone(){const t=this._t;return new lt(t.slice())}transform(t){const e=this._t;return[e[0]*t[0]+e[1]*t[1]+e[2],e[3]*t[0]+e[4]*t[1]+e[5]]}static createScale(t,e){return new lt([t,0,0,0,e,0])}scale(t,e){const r=this._t;return r[0]*=t,r[1]*=t,r[2]*=t,r[3]*=e,r[4]*=e,r[5]*=e,this}scaleRatio(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])}static createTranslate(t,e){return new lt([0,0,t,0,0,e])}translate(t,e){const r=this._t;return r[2]+=t,r[5]+=e,this}static createRotate(t){const e=Math.cos(t),r=Math.sin(t);return new lt([e,-r,0,r,e,0])}rotate(t){return lt.multiply(this,lt.createRotate(t),this)}angle(){const t=this._t[0],e=this._t[3],r=Math.sqrt(t*t+e*e);return[t/r,e/r]}static multiply(t,e,r){const i=t._t,s=e._t,o=i[0]*s[0]+i[3]*s[1],n=i[1]*s[0]+i[4]*s[1],a=i[2]*s[0]+i[5]*s[1]+s[2],l=i[0]*s[3]+i[3]*s[4],h=i[1]*s[3]+i[4]*s[4],c=i[2]*s[3]+i[5]*s[4]+s[5],m=r._t;return m[0]=o,m[1]=n,m[2]=a,m[3]=l,m[4]=h,m[5]=c,r}invert(){const t=this._t;let e=t[0]*t[4]-t[1]*t[3];if(0===e)return new lt([0,0,0,0,0,0]);e=1/e;const r=(t[1]*t[5]-t[2]*t[4])*e,i=(t[2]*t[3]-t[0]*t[5])*e,s=t[4]*e,o=-t[1]*e,n=-t[3]*e,a=t[0]*e;return new lt([s,o,r,n,a,i])}}class ht{constructor(t,e){this._resourceManager=t,this._transfos=[],this._sizeTransfos=[],this._geomUnitsPerPoint=1,this._placementPool=new s(()=>new v,void 0,void 0,100),this._earlyReturn=!1,this._mapRotation=0,this._transfos.push(e||lt.createIdentity()),this._sizeTransfos.push(e?e.scaleRatio():1)}setTransform(t,e){this._transfos=[t||lt.createIdentity()],this._sizeTransfos=[e||(t?t.scaleRatio():1)]}setGeomUnitsPerPoint(t){this._geomUnitsPerPoint=t}transformPt(t){return this._transfos[this._transfos.length-1].transform(t)}transformSize(t){return t*this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformPt(t){return this._transfos[this._transfos.length-1].invert().transform(t)}reverseTransformSize(t){return t/this._sizeTransfos[this._sizeTransfos.length-1]}reverseTransformScalar(t){return t/this._transfos[this._transfos.length-1].scaleRatio()}getTransformAngle(){return this._transfos[this._transfos.length-1].angle()}geomUnitsPerPoint(){return this.isEmbedded()?1:this._geomUnitsPerPoint}prevGeomUnitsPerPoint(){return this._transfos.length>2?1:this._geomUnitsPerPoint}isEmbedded(){return this._transfos.length>1}back(){return this._transfos[this._transfos.length-1]}push(t,e){const r=e?t.scaleRatio():1;lt.multiply(t,this.back(),t),this._transfos.push(t),this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*r)}pop(){this._transfos.splice(-1,1),this._sizeTransfos.splice(-1,1)}drawSymbol(t,e,r){if(t)switch(t.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this.drawMultiLayerSymbol(t,e);break;case"CIMTextSymbol":this.drawTextSymbol(t,e,r)}}drawMultiLayerSymbol(t,e){if(!t||!e)return;const r=t.symbolLayers;if(!r)return;const i=t.effects;if(i&&i.length>0){const t=this.executeEffects(i,e);if(t){let e=t.next();for(;e;)this.drawSymbolLayers(r,e.asJSON()),e=t.next()}}else this.drawSymbolLayers(r,e)}executeEffects(t,e){let r=new M(a.fromJSONCIM(e));for(const i of t){const t=k(i);t&&(r=t.execute(r,i,this.geomUnitsPerPoint(),null))}return r}drawSymbolLayers(t,e){let r=t.length;for(;r--;){const i=t[r];if(!i||!1===i.enable)continue;const s=i.effects;if(s&&s.length>0){const t=this.executeEffects(s,e);if(t){let e=null;for(;(e=t.next())&&(this.drawSymbolLayer(i,e.asJSON()),!this._earlyReturn););}}else this.drawSymbolLayer(i,e);if(this._earlyReturn)return}}drawSymbolLayer(t,e){switch(t.type){case"CIMSolidFill":this.drawSolidFill(e,t.color,t.path);break;case"CIMHatchFill":this.drawHatchFill(e,t);break;case"CIMPictureFill":this.drawPictureFill(e,t);break;case"CIMGradientFill":this.drawGradientFill(e,t);break;case"CIMSolidStroke":this.drawSolidStroke(e,t.color,t.width,t.capStyle,t.joinStyle,t.miterLimit,t.path);break;case"CIMPictureStroke":this.drawPictureStroke(e,t);break;case"CIMGradientStroke":this.drawGradientStroke(e,t);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":this.drawMarkerLayer(t,e)}}drawHatchFill(t,e){const r=ut(e,t,this.geomUnitsPerPoint());r&&(this.pushClipPath(t),this.drawMultiLayerSymbol(e.lineSymbol,r),this.popClipPath())}drawPictureFill(t,e){}drawGradientFill(t,e){}drawPictureStroke(t,e){}drawGradientStroke(t,e){}drawMarkerLayer(t,e){const r=t.markerPlacement;if(r){const i=C(r);if(i){const s="CIMMarkerPlacementInsidePolygon"===r.type||"CIMMarkerPlacementPolygonCenter"===r.type&&r.clipAtBoundary;s&&this.pushClipPath(e);const o=i.execute(a.fromJSONCIM(e),r,this.geomUnitsPerPoint(),null);if(o){let e=null;for(;(e=o.next())&&(this.drawMarker(t,e),!this._earlyReturn););}s&&this.popClipPath()}}else{const r=this._placementPool.acquire();if(w(e))r.tx=e.x,r.ty=e.y,this.drawMarker(t,r);else if(P(e)){const i=_(e);i&&([r.tx,r.ty]=i,this.drawMarker(t,r))}else if(S(e)){for(const i of e.paths)for(const e of i)if(r.tx=e[0],r.ty=e[1],this.drawMarker(t,r),this._earlyReturn)break}else for(const i of e.points)if(r.tx=i[0],r.ty=i[1],this.drawMarker(t,r),this._earlyReturn)break;this._placementPool.release(r)}}drawMarker(t,e){switch(t.type){case"CIMCharacterMarker":case"CIMPictureMarker":this.drawPictureMarker(t,e);break;case"CIMVectorMarker":this.drawVectorMarker(t,e)}}drawPictureMarker(t,e){if(!t)return;const r=this._resourceManager.getResource(t.url),i=G(t.size,I.CIMPictureMarker.size);if(null==r||i<=0)return;const s=r.width,o=r.height;if(!s||!o)return;const n=s/o,a=G(t.scaleX,1),l=lt.createIdentity(),h=t.anchorPoint;if(h){let e=h.x,r=h.y;"Absolute"!==t.anchorPointUnits&&(e*=i*n*a,r*=i),l.translate(-e,-r)}let c=G(t.rotation);t.rotateClockwise&&(c=-c),this._mapRotation&&(c+=this._mapRotation),c&&l.rotate(c*ot);let m=G(t.offsetX),f=G(t.offsetY);if(m||f){if(this._mapRotation){const t=ot*this._mapRotation,e=Math.cos(t),r=Math.sin(t),i=m*r+f*e;m=m*e-f*r,f=i}l.translate(m,f)}const u=this.geomUnitsPerPoint();1!==u&&l.scale(u,u);const d=e.getAngle();d&&l.rotate(d),l.translate(e.tx,e.ty),this.push(l,!1),this.drawImage(t,i),this.pop()}drawVectorMarker(t,e){if(!t)return;const r=t.markerGraphics;if(!r)return;const i=G(t.size,I.CIMVectorMarker.size),s=t.frame,o=s?s.ymax-s.ymin:0,n=i&&o?i/o:1,a=lt.createIdentity();s&&a.translate(.5*-(s.xmax+s.xmin),.5*-(s.ymax+s.ymin));const l=t.anchorPoint;if(l){let e=l.x,r=l.y;"Absolute"!==t.anchorPointUnits?s&&(e*=s.xmax-s.xmin,r*=s.ymax-s.ymin):(e/=n,r/=n),a.translate(-e,-r)}1!==n&&a.scale(n,n);let h=G(t.rotation);t.rotateClockwise&&(h=-h),this._mapRotation&&(h+=this._mapRotation),h&&a.rotate(h*ot);let c=G(t.offsetX),m=G(t.offsetY);if(c||m){if(this._mapRotation){const t=ot*this._mapRotation,e=Math.cos(t),r=Math.sin(t),i=c*r+m*e;c=c*e-m*r,m=i}a.translate(c,m)}const f=this.geomUnitsPerPoint();1!==f&&a.scale(f,f);const u=e.getAngle();u&&a.rotate(u),a.translate(e.tx,e.ty),this.push(a,t.scaleSymbolsProportionally);for(const d of r){d?.symbol&&d.geometry||at().error("Invalid marker graphic",d);let t=d.textString;if("number"==typeof t&&(t=t.toString()),this.drawSymbol(d.symbol,d.geometry,t),this._earlyReturn)break}this.pop()}drawTextSymbol(t,e,r){if(!t)return;if(!w(e))return;if(G(t.height,I.CIMTextSymbol.height)<=0)return;const i=lt.createIdentity();let s=G(t.angle);s=-s,s&&i.rotate(s*ot);const o=G(t.offsetX),n=G(t.offsetY);(o||n)&&i.translate(o,n);const a=this.geomUnitsPerPoint();1!==a&&i.scale(a,a),i.translate(e.x,e.y),this.push(i,!1),this.drawText(t,r),this.pop()}}class ct extends ht{constructor(t,e){super(t,e),this.reset()}reset(){this._xmin=this._ymin=1/0,this._xmax=this._ymax=-1/0,this._clipCount=0}envelope(){return new L(this._xmin,this._ymin,this._xmax-this._xmin,this._ymax-this._ymin)}bounds(){return h(this._xmin,this._ymin,this._xmax,this._ymax)}drawSolidFill(t){if(t&&!(this._clipCount>0))if(P(t))this._processPath(t.rings,0);else if(S(t))this._processPath(t.paths,0);else if(y(t)){const e=_t(t);e&&this._processPath(e.rings,0)}else console.error("drawSolidFill Unexpected geometry type!")}drawSolidStroke(t,e,r){if(!t||this._clipCount>0||null==r||r<=0)return;const i=Math.max(.5*this.transformSize(G(r,I.CIMSolidStroke.width)),.5*nt);if(P(t))this._processPath(t.rings,i);else if(S(t))this._processPath(t.paths,i);else if(y(t)){const e=_t(t);e&&this._processPath(e.rings,i)}else console.error("drawSolidStroke unexpected geometry type!")}drawMarkerLayer(t,e){P(e)&&t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._processPath(e.rings,0):super.drawMarkerLayer(t,e)}drawHatchFill(t,e){this.drawSolidFill(t)}drawPictureFill(t,e){this.drawSolidFill(t)}drawGradientFill(t,e){this.drawSolidFill(t)}drawPictureStroke(t,e){this.drawSolidStroke(t,null,e.width)}drawGradientStroke(t,e){this.drawSolidStroke(t,null,e.width)}pushClipPath(t){this.drawSolidFill(t),this._clipCount++}popClipPath(){this._clipCount--}drawImage(t,e){const{url:r}=t,i=G(t.scaleX,1);let s=i*e,o=e;const n=this._resourceManager.getResource(r);if(null!=n){const t=n.height/n.width;s=i*(e?t>1?e:e/t:n.width),o=e?t>1?e*t:e:n.height}this._merge(this.transformPt([-s/2,-o/2]),0),this._merge(this.transformPt([-s/2,o/2]),0),this._merge(this.transformPt([s/2,-o/2]),0),this._merge(this.transformPt([s/2,o/2]),0)}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new F);const r=Pt(t);let[i,s]=this._textRasterizer.computeTextSize(e,r);i=n(i),s=n(s);const o=this.transformSize(1)*this.reverseTransformScalar(1);i*=o,s*=o;let a=0;switch(t.horizontalAlignment){case"Left":a=i/2;break;case"Right":a=-i/2}let l=0;switch(t.verticalAlignment){case"Bottom":l=s/2;break;case"Top":l=-s/2;break;case"Baseline":l=s/6}this._merge(this.transformPt([-i/2+a,-s/2+l]),0),this._merge(this.transformPt([-i/2+a,s/2+l]),0),this._merge(this.transformPt([i/2+a,-s/2+l]),0),this._merge(this.transformPt([i/2+a,s/2+l]),0)}_processPath(t,e){if(t)for(const r of t){const t=r?r.length:0;if(t>1){this._merge(this.transformPt(r[0]),e);for(let i=1;i<t;i++)this._merge(this.transformPt(r[i]),e)}}}_merge(t,e){t[0]-e<this._xmin&&(this._xmin=t[0]-e),t[0]+e>this._xmax&&(this._xmax=t[0]+e),t[1]-e<this._ymin&&(this._ymin=t[1]-e),t[1]+e>this._ymax&&(this._ymax=t[1]+e)}}class mt extends ht{constructor(){super(...arguments),this._searchPoint=[0,0],this._searchDistPoint=0,this._textInfo=null,this._svg=null,this._path=null,this._canvas=null}destroy(){this._svg=Y(this._svg),this._path=null,this._canvas=null}hitTest(t,e,r,i,s,a){const l=a*o(1);this.setTransform(),this.setGeomUnitsPerPoint(l),this._searchPoint=[(t[0]+t[2])/2,(t[1]+t[3])/2],this._searchDistPoint=(t[2]-t[0])/2/l,this._textInfo=i;const h=e&&("CIMPointSymbol"===e.type&&"Map"!==e.angleAlignment||"CIMTextSymbol"===e.type||e.symbolLayers?.some(t=>U(t)));if(this._mapRotation=h?s:0,!has("esri-mobile")){const t=n(tt*window.devicePixelRatio),r=n(et);!(("CIMLineSymbol"===e?.type||"CIMPolygonSymbol"===e?.type)&&e.symbolLayers?.some(A))&&"CIMMeshSymbol"!==e?.type&&(j(e)??0)<r&&(this._searchDistPoint=t)}return this._earlyReturn=!1,this.drawSymbol(e,r),this._earlyReturn}executeEffects(t,e){return"CIMGeometricEffectDashes"===t.at(-1)?.type&&(t=t.slice(0,-1)),super.executeEffects(t,e)}drawSolidFill(t,e,r){null!=r?this._hittestSvgPath(t,r,!0):this._hitTestFill(t)}drawHatchFill(t,e){this._hitTestFill(t)}drawPictureFill(t,e){this._hitTestFill(t)}drawGradientFill(t,e){this._hitTestFill(t)}drawSolidStroke(t,e,r,i,s,o,n){null!=n?this._hittestSvgPath(t,n,!1,r):this._hitTestStroke(t,r)}drawPictureStroke(t,e){this._hitTestStroke(t,e.width)}drawGradientStroke(t,e){this._hitTestStroke(t,e.width)}drawMarkerLayer(t,e){t.markerPlacement&&("CIMMarkerPlacementInsidePolygon"===t.markerPlacement.type||"CIMMarkerPlacementPolygonCenter"===t.markerPlacement.type&&t.markerPlacement.clipAtBoundary)?this._hitTestFill(e):super.drawMarkerLayer(t,e)}pushClipPath(t){}popClipPath(){}drawImage(t,e){const{url:r}=t,i=G(t.scaleX,1),s=this._resourceManager.getResource(r);if(null==s||0===s.height||0===e)return;const o=e*this.geomUnitsPerPoint(),n=o*i*(s.width/s.height),a=this.reverseTransformPt(this._searchPoint),l=this._searchDistPoint;Math.abs(a[0])<n/2+l&&Math.abs(a[1])<o/2+l&&(this._earlyReturn=!0)}drawText(t,e){const r=this._textInfo;if(!r)return;const i=r.get(t);if(!i)return;if(!i.glyphMosaicItems.glyphs.length)return;const s=it(G(t.height,I.CIMTextSymbol.height)),{lineGapType:o,lineGap:n}=t,a=o?yt(o,G(n),s):0,l="CIMBackgroundCallout"===t.callout?.type,h=rt(i.glyphMosaicItems,{scale:s/Z,angle:0,xOffset:0,yOffset:0,horizontalAlignment:t.horizontalAlignment,verticalAlignment:t.verticalAlignment,maxLineWidth:st(t.lineWidth),lineHeight:Q*Math.max(.25,Math.min(a||1,4)),decoration:t.font.decoration||"none",useCIMAngleBehavior:!0,hasBackground:l}),c=this.reverseTransformPt(this._searchPoint),m=c[0],f=c[1];for(const u of h.glyphs){const[t,e]=u.offsets.topLeft,[r,i]=u.offsets.bottomRight;if(m>t&&m<r&&f>-i&&f<-e){this._earlyReturn=!0;break}}}_hitTestFill(t){let e=null;if(y(t)){const r=t;e=[[[r.xmin,r.ymin],[r.xmin,r.ymax],[r.xmax,r.ymax],[r.xmax,r.ymin],[r.xmin,r.ymin]]]}else if(P(t))e=t.rings;else{if(!S(t))return;e=t.paths}const r=this.reverseTransformPt(this._searchPoint);if(dt(r,e)&&(this._earlyReturn=!0),!this._earlyReturn){pt(r,e,this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}}_getSvgPath(){return null!=this._svg&&null!=this._path||(this._svg??=$(),this._path??=K("path"),this._svg.appendChild(this._path)),this._path}_getCanvasContext(t,e){return this._canvas??=document.createElement("canvas"),this._canvas.width=t,this._canvas.height=e,this._canvas.getContext("2d",{willReadFrequently:!0})}_hittestSvgPath(t,e,r,i=0){const s=this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint(),o=this.reverseTransformPt(this._searchPoint),n=l();g(n,t);const a={x:n[0],y:n[1],width:n[2]-n[0],height:n[3]-n[1]},h=this._getSvgPath();h.setAttribute("d",e);const c=h.getBBox();let m=Math.max(c.width/a.width,c.height/a.height),f=1;const u=2*s*m;u<1&&(f=2/u,m*=f,c.x*=f,c.y*=f,c.width*=f,c.height*=f);const d=1+i*m/2,p=this._getCanvasContext(c.width+2*d,c.height+2*d);p.setTransform(f,0,0,f,-c.x+d,-c.y+d);const _=new Path2D(e);r?p.fill(_):(p.lineWidth=i*(m/f),p.stroke(_));const y=(a.width*m-c.width)/2,P=(a.height*m-c.height)/2,S=Math.floor((o[0]-a.x-s)*m-y+d),w=Math.floor((a.height-(o[1]-a.y)-s)*m+P+d),x=Math.ceil(2*s*m),M=Math.ceil(2*s*m),b=p.getImageData(S,w,x,M).data;for(let l=3;l<b.length;l+=4)if(b[l]>127.5)return void(this._earlyReturn=!0)}_hitTestStroke(t,e){let r=null;if(y(t)){const e=t;r=[[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]}else if(P(t))r=t.rings;else{if(!S(t))return;r=t.paths}pt(this.reverseTransformPt(this._searchPoint),r,G(e,I.CIMSolidStroke.width)*this.geomUnitsPerPoint()/2+this.reverseTransformScalar(this._searchDistPoint)*this.prevGeomUnitsPerPoint())&&(this._earlyReturn=!0)}}class ft extends ht{constructor(t,e,r,i){super(e,r),this._applyAdditionalRenderProps=i,this._colorSubstitutionHelper=new b,this._ctx=t}drawSolidFill(t,e){if(!t)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else if(y(t))this._buildPath(_t(t).rings,!0);else{if(!x(t))return;console.log("CanvasDrawHelper.drawSolidFill - No implementation!")}const r=this._ctx;r.fillStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",r.fill("evenodd")}drawSolidStroke(t,e,r,i,s,o){if(!t||!e||0===r)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!1);else{if(!y(t))return void console.log("CanvasDrawHelper.drawSolidStroke isn't implemented!");this._buildPath(_t(t).rings,!0)}const n=this._ctx;n.strokeStyle="string"==typeof e?e:"rgba("+Math.round(e[0])+","+Math.round(e[1])+","+Math.round(e[2])+","+(e[3]??255)/255+")",n.lineWidth=Math.max(this.transformSize(r),nt),this._setCapStyle(i),this._setJoinStyle(s),n.miterLimit=o,n.stroke()}pushClipPath(t){if(this._ctx.save(),P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else{if(!y(t))return;this._buildPath(_t(t).rings,!0)}this._ctx.clip("evenodd")}popClipPath(){this._ctx.restore()}drawImage(t,e){const{colorSubstitutions:r,url:i,tintColor:s}=t,o=G(t.scaleX,1),n=this._resourceManager.getResource(i);if(null==n)return;let a=e*(n.width/n.height),l=e;e||(a=n.width,l=n.height);const h=D(i)||"src"in n&&D(n.src);let c="getFrame"in n?T(n):n;r&&(c=this._colorSubstitutionHelper.applyColorSubstitution(c,r)),this._applyAdditionalRenderProps&&!h&&s&&(c=this._colorSubstitutionHelper.tintImageData(c,s));const m=this.transformPt([0,0]),[f,u]=this.getTransformAngle(),d=this.transformSize(1),p=this._ctx;p.save(),p.setTransform({m11:o*d*f,m12:o*d*u,m21:-d*u,m22:d*f,m41:m[0],m42:m[1]}),p.drawImage(c,-a/2,-l/2,a,l),p.restore()}drawText(t,e){if(!e||0===e.length)return;this._textRasterizer||(this._textRasterizer=new F);const r=Pt(t,this.transformSize(n(1))),i=this._textRasterizer.rasterizeText(e,r);if(!i)return;const{size:s,anchorX:o,anchorY:a,canvas:l}=i,h=s[0]*(o+.5),c=s[1]*(a-.5),m=this._ctx,f=this.transformPt([0,0]),[u,d]=this.getTransformAngle(),p=1;m.save(),m.setTransform({m11:p*u,m12:p*d,m21:-p*d,m22:p*u,m41:f[0]-p*h,m42:f[1]+p*c}),m.drawImage(l,0,0),m.restore()}drawPictureFill(t,e){if(!t)return;let{colorSubstitutions:r,height:i,offsetX:s,offsetY:o,rotation:n,scaleX:a,tintColor:l,url:h}=e;const c=this._resourceManager.getResource(h);if(null==c)return;if(P(t))this._buildPath(t.rings,!0);else if(S(t))this._buildPath(t.paths,!0);else if(y(t))this._buildPath(_t(t).rings,!0);else{if(!x(t))return;console.log("CanvasDrawHelper.drawPictureFill - No implementation!")}const m=this._ctx,f=D(h)||"src"in c&&D(c.src);let u,d="getFrame"in c?T(c):c;if(r&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,r)),this._applyAdditionalRenderProps){f||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)),u=m.createPattern(d,"repeat");const t=this.transformSize(1);n||(n=0),s?s*=t:s=0,o?o*=t:o=0,i&&(i*=t);const e=i?i/c.height:1,r=a&&i?a*i/c.width:1;if(0!==n||1!==e||1!==r||0!==s||0!==o){const t=new DOMMatrix;t.rotateSelf(0,0,-n).translateSelf(s,o).scaleSelf(r,e,1),u.setTransform(t)}}else u=m.createPattern(d,"repeat");m.save(),m.fillStyle=u,m.fill("evenodd"),m.restore()}drawPictureStroke(t,r){if(!t)return;let{colorSubstitutions:i,capStyle:s,joinStyle:n,miterLimit:a,tintColor:l,url:h,width:c}=r;const m=this._resourceManager.getResource(h);if(null==m)return;let f;if(P(t))f=t.rings;else if(S(t))f=t.paths;else{if(!y(t))return x(t)?void console.log("CanvasDrawHelper.drawPictureStroke - No implementation!"):void 0;f=_t(t).rings}c||(c=m.width);const u=D(h)||"src"in m&&D(m.src);let d="getFrame"in m?T(m):m;i&&(d=this._colorSubstitutionHelper.applyColorSubstitution(d,i)),this._applyAdditionalRenderProps&&(u||l&&(d=this._colorSubstitutionHelper.tintImageData(d,l)));const p=Math.max(this.transformSize(o(c)),.5),g=p/d.width,_=this._ctx,w=_.createPattern(d,"repeat-y");let M,b;_.save(),this._setCapStyle(s),this._setJoinStyle(n),void 0!==a&&(_.miterLimit=a),_.lineWidth=p;for(let o of f)if(o=e(o),wt(o),o&&!(o.length<=1)){M=this.transformPt(o[0]);for(let t=1;t<o.length;t++){b=this.transformPt(o[t]);const e=gt(M,b),r=new DOMMatrix;r.translateSelf(0,M[1]-p/2).scaleSelf(g,g,1).rotateSelf(0,0,90-e),w.setTransform(r),_.strokeStyle=w,_.beginPath(),_.moveTo(M[0],M[1]),_.lineTo(b[0],b[1]),_.stroke(),M=b}}_.restore()}drawGradientFill(t,e){if(!t)return;let r;if(P(t))r=t.rings;else if(S(t))r=t.paths;else{if(!y(t))return void at().error("Unable to draw gradient fill");r=_t(t).rings}this._buildPath(r,!0);const{angle:s,gradientMethod:n,gradientSize:a,gradientSizeUnits:l}=e,h=I.CIMGradientFill,g=e.gradientType??h.gradientType,_=-i(s??0),w=c();for(const i of r){const t=i?i.length:0;if(t>1)for(let e=0;e<t;e++){let t=this.transformPt(i[e]);"Linear"!==n&&"Rectangular"!==n||(t=R(t,-_)),m(w,t)}}const[x,M,b,k]=w,C=this._ctx;switch(C.save(),n){case"Buffered":at().error(`Gradient method "${n}" currently unsupported.`);break;case"Linear":{const t=(M+k)/2,r="Absolute"===l?this.transformSize(o(a)):H(a,h.gradientSize)*(b-x),[i,s]="Discrete"===g?[b,b-r]:[x+r,x],n=R([i,t],_),c=R([s,t],_),m=C.createLinearGradient(n[0],n[1],c[0],c[1]);z(m,e),C.fillStyle=m,C.fill("evenodd");break}case"Circular":{const t=f(w),r=p(w)/2,i="Absolute"===l?this.transformSize(o(a)):H(a,h.gradientSize)*r,[s,n]="Discrete"===g?[r,r-i]:[i,0],c=C.createRadialGradient(t[0],t[1],s,t[0],t[1],n);z(c,e),C.fillStyle=c,C.fill("evenodd");break}case"Rectangular":{const r=f(w),i=r[0],s=r[1],n=R(r,_),c=(r,i,s,o,a,l,h,c)=>{C.save(),this.pushClipPath(t);const m=R([a,l],_),f=R([h,c],_);C.beginPath(),C.moveTo(n[0],n[1]),C.lineTo(m[0],m[1]),C.lineTo(f[0],f[1]),C.lineTo(n[0],n[1]),C.clip();const u=R([r,i],_),d=R([s,o],_),p=C.createLinearGradient(u[0],u[1],d[0],d[1]);z(p,e),C.fillStyle=p,C.fill("evenodd"),C.restore()};let m="Absolute"===l?this.transformSize(o(a)):H(a,h.gradientSize)*(u(w)/2),[p,y]="Discrete"===g?[b,b-m]:[i+m,i];c(p,s,y,s,b,M,b,k),[p,y]="Discrete"===g?[x,x+m]:[i-m,i],c(p,s,y,s,x,k,x,M),m="Absolute"===l?this.transformSize(o(a)):H(a,h.gradientSize)*(d(w)/2);let[P,S]="Discrete"===g?[k,k-m]:[s+m,s];c(i,P,i,S,b,k,x,k),[P,S]="Discrete"===g?[M,M+m]:[s-m,s],c(i,P,i,S,x,M,b,M);break}}C.restore()}drawGradientStroke(t,r){const{capStyle:i,gradientMethod:s,gradientSize:n,gradientSizeUnits:a,joinStyle:l,miterLimit:h,width:c}=r;if(!t||0===c)return;let m;if(P(t))m=t.rings;else if(S(t))m=t.paths;else{if(!y(t))return void at().error("Unable to draw gradient stroke");m=_t(t).rings}const f=r.gradientType??I.CIMGradientStroke.gradientType,u=Math.max(this.transformSize(o(c)),.5),d=this._ctx;let p,g;d.save(),this._setCapStyle(i),this._setJoinStyle(l),void 0!==h&&(d.miterLimit=h),d.lineWidth=u;for(let _ of m){if(_=e(_),wt(_),!_||_.length<=1)continue;let t=0;p=this.transformPt(_[0]);for(let e=1;e<_.length;e++){g=this.transformPt(_[e]);const r=g[0]-p[0],i=g[1]-p[1];t+=Math.sqrt(r*r+i*i),p=g}const i="Absolute"===a?this.transformSize(o(n)):H(n,I.CIMGradientStroke.gradientSize)*("AcrossLine"===s?u:t);let l=0;p=this.transformPt(_[0]);for(let e=1;e<_.length;e++){g=this.transformPt(_[e]);const o=g[0]-p[0],n=g[1]-p[1],a=Math.sqrt(o*o+n*n);let h,c,m,y;switch(s){case"AcrossLine":{const[t,e]=R([o/a,n/a],-Math.PI/2),r=u/2,s="Discrete"===f?r:i-r;h=(p[0]+g[0])/2+t*s,c=(p[1]+g[1])/2+e*s,m=h-t*i,y=c-e*i;break}case"AlongLine":{const e=o/a,r=n/a;"Discrete"===f?(h=p[0]-e*l,c=p[1]-r*l,m=h+e*i,y=c+r*i):(m=p[0]+e*(t-l),y=p[1]+r*(t-l),h=m-e*i,c=y-r*i);break}default:return at().error("Unrecognized gradient method:",s),void d.restore()}const P=d.createLinearGradient(h,c,m,y);z(P,r),d.strokeStyle=P,d.beginPath(),d.moveTo(p[0],p[1]),d.lineTo(g[0],g[1]),d.stroke(),l+=a,p=g}}d.restore()}_buildPath(t,e){const r=this._ctx;if(r.beginPath(),t)for(const i of t){const t=i?i.length:0;if(t>1){let s=this.transformPt(i[0]);r.moveTo(s[0],s[1]);for(let e=1;e<t;e++)s=this.transformPt(i[e]),r.lineTo(s[0],s[1]);e&&r.closePath()}}}_setCapStyle(t){switch(t){case"Butt":this._ctx.lineCap="butt";break;case"Round":this._ctx.lineCap="round";break;case"Square":this._ctx.lineCap="square"}}_setJoinStyle(t){switch(t){case"Bevel":this._ctx.lineJoin="bevel";break;case"Round":this._ctx.lineJoin="round";break;case"Miter":this._ctx.lineJoin="miter"}}}function ut(t,e,r){let i=G(t.separation,I.CIMHatchFill.separation)*r,s=G(t.rotation);if(0===i)return null;i<0&&(i=-i);let o=0;const n=.5*i;for(;o>n;)o-=i;for(;o<-n;)o+=i;const a=l();g(a,e),a[0]-=n,a[1]-=n,a[2]+=n,a[3]+=n;const h=[[a[0],a[1]],[a[0],a[3]],[a[2],a[3]],[a[2],a[1]]];for(;s>180;)s-=180;for(;s<0;)s+=180;const c=Math.cos(s*ot),m=Math.sin(s*ot),f=-i*m,u=i*c;let d,p,_,y;o=G(t.offsetX)*r*m-G(t.offsetY)*r*c,d=_=Number.MAX_VALUE,p=y=-Number.MAX_VALUE;for(const l of h){const t=l[0],e=l[1],r=c*t+m*e,i=-m*t+c*e;d=Math.min(d,r),_=Math.min(_,i),p=Math.max(p,r),y=Math.max(y,i)}_=Math.floor(_/i)*i;let P=c*d-m*_-f*o/i,S=m*d+c*_-u*o/i,w=c*p-m*_-f*o/i,x=m*p+c*_-u*o/i;const M=1+Math.round((y-_)/i),b=[];for(let l=0;l<M;l++)P+=f,S+=u,w+=f,x+=u,b.push([[P,S],[w,x]]);return{paths:b}}function dt(t,e){let r=0;for(const i of e){const e=i.length;for(let s=1;s<e;s++){const e=i[s-1],o=i[s];if(e[1]>t[1]==o[1]>t[1])continue;(o[0]-e[0])*(t[1]-e[1])-(o[1]-e[1])*(t[0]-e[0])>0?r++:r--}}return 0!==r}function pt(t,e,r){for(const i of e){const e=i.length;for(let s=1;s<e;s++){const e=i[s-1],o=i[s];let n=(o[0]-e[0])*(o[0]-e[0])+(o[1]-e[1])*(o[1]-e[1]);if(0===n)continue;n=Math.sqrt(n);const a=((o[0]-e[0])*(t[1]-e[1])-(o[1]-e[1])*(t[0]-e[0]))/n;if(Math.abs(a)<r){const i=((o[0]-e[0])*(t[0]-e[0])+(o[1]-e[1])*(t[1]-e[1]))/n;if(i>-r&&i<n+r)return!0}}}return!1}function gt(t,e){const r=e[0]-t[0],i=e[1]-t[1];return 180/Math.PI*Math.atan2(i,r)}const _t=t=>t?{spatialReference:t.spatialReference,rings:[[[t.xmin,t.ymin],[t.xmin,t.ymax],[t.xmax,t.ymax],[t.xmax,t.ymin],[t.xmin,t.ymin]]]}:null,yt=(t,e,r)=>{switch(t){case"ExtraLeading":return 1+e/r;case"Multiple":return e;case"Exact":return e/r}};function Pt(e,r=1){const i=B(e),s=E(e.fontStyleName),o=e.fontFamilyName??t,{weight:n,style:a}=s,l=r*(e.height||5),h=X(e.horizontalAlignment),c=J(e.verticalAlignment),m=N(e),f=N(e.haloSymbol),u=null!=f?r*(e.haloSize??0):0,d=O(e.symbol),p=r*(q(e.symbol)||0),g="CIMBackgroundCallout"===e.callout?.type?e.callout.backgroundSymbol:null,_=N(g),y=q(g),P=O(g);return{color:m,size:l,horizontalAlignment:h,verticalAlignment:c,font:{family:o,style:W(a),weight:V(n),decoration:i},outline:{size:p||0,color:d},halo:{size:u||0,color:f,style:a},backgroundColor:_,borderLine:null!=y&&null!=P?{size:y,color:P}:null,pixelRatio:1,premultiplyColors:!0}}const St=1e-4;function wt(t){let e,r,i,s,o,n=t[0],a=1;for(;a<t.length;)e=t[a][0]-n[0],r=t[a][1]-n[1],s=0!==e?r/e:Math.PI/2,void 0!==i&&Math.abs(s-i)<=St?(t.splice(a-1,1),n=o):(o=n,n=t[a],a++),i=s}export{ht as CIMSymbolDrawHelper,ft as CanvasDrawHelper,ct as EnvDrawHelper,mt as HittestDrawHelper,lt as Transformation,ot as cDegToRad,yt as lineGapType2LineHeight};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{RenderingDevice as e}from"../webgl/RenderingDevice.js";import{simplePipelineState as t}from"../webgl/shaderGraph/utils.js";import{VTLTechniquesRepo as i}from"../webgl/shaderGraph/techniques/vectorTiles/VTLTechniques.js";const r=1e-6;class s{constructor(t,r){this.spriteMosaic=t,this.glyphMosaic=r,this._vtlTechniques=new i,this._context=null,this._vtlTechniques.startup(),this._renderingDevice=new e}dispose(){this._vtlTechniques&&this._vtlTechniques.shutdown(this._context),this.spriteMosaic.dispose(),this.glyphMosaic.dispose(),this._renderingDevice.dispose(),this._context=null}drawSymbols(e,t,i){const s=i.layers;e.renderPass="translucent";const o=this._vtlTechniques.getTechnique(3);n[0]=t;for(let l=0;l<s.length;l++){const t=s[l];if(3!==t.type)continue;const i=t.getLayoutProperty("visibility");if(i&&1===i.getValue())continue;const a=e.displayLevel;void 0!==t.minzoom&&t.minzoom>a+r||void 0!==t.maxzoom&&t.maxzoom<=a-r||(e.styleLayerUID=t.uid,e.styleLayer=t,o.render(e,{tiles:n}))}n[0]=null}drawBackground(e,t,i){if(0===i.backgroundBucketIds.length)return;const{displayLevel:s,requiredLevel:o}=e;t.key.level=o,this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"composite"},stencil:!1,depth:!1}),e.renderPass="background";const l=this._vtlTechniques.getTechnique(0);n[0]=t,i.backgroundBucketIds.forEach(t=>{const o=i.getLayerById(t);if(0!==o.type)return;const a=o.getLayoutProperty("visibility");a&&1===a.getValue()||void 0!==o.minzoom&&o.minzoom>s+r||void 0!==o.maxzoom&&o.maxzoom<=s-r||(e.styleLayerUID=o.uid,e.styleLayer=o,l.render(e,{tiles:n}))}),n[0]=null}drawTile(e,i,r,s){const n=r.layers,{context:o}=e,l=o.getPipelineState(),{depthWrite:a}=l;let c=0,u=1;void 0!==a?.zNear&&void 0!==a.zFar&&(c=a.zNear,u=a.zFar),this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"composite"},stencil:!1,depth:{write:{zNear:c,zFar:u},test:515}});const d=n.filter(e=>{if(null!=s&&s!==e.type||!i.layerData.has(e.uid))return!1;const t=e.getLayoutProperty("visibility");return 1!==t?.getValue()});e.renderPass="opaque";for(let t=d.length-1;t>=0;--t)this._renderStyleLayer(d[t],e,i);this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"composite"},stencil:!1,depth:{write:!1,test:515}}),e.renderPass="translucent",d.forEach(t=>this._renderStyleLayer(t,e,i)),this._renderingDevice.setPipelineState(t),this._context||(this._context=e.context)}setShader(e){return this._renderingDevice.setShader(e)}setPipelineState(e){return this._renderingDevice.setPipelineState(e)}getPipelineState(){return this._renderingDevice.getPipelineState()}submitDraw(e,t,i){return this._renderingDevice.submitDraw(e,t,i)}submitDrawMesh(e,t,i,r){this._renderingDevice.submitDrawMesh(e,t,i,r)}submitDrawMeshUntyped(e,t,i,r){this._renderingDevice.submitDrawMeshUntyped(e,t,i,r)}updatePipelineState(e){return this._renderingDevice.updatePipelineState(e)}setStencilRef(e,t){return this._renderingDevice.setStencilRef(e,t)}_renderStyleLayer(e,t,i){const{renderPass:s}=t;let o;switch(e.type){case 0:if("background"!==s)return;o=this._vtlTechniques.getTechnique(0);break;case 1:if("opaque"!==s&&"translucent"!==t.renderPass)return;o=this._vtlTechniques.getTechnique(1);break;case 2:if("translucent"!==s)return;o=this._vtlTechniques.getTechnique(2);break;case 4:if("translucent"!==s)return;o=this._vtlTechniques.getTechnique(4);break;case 3:if("translucent"!==s)return;o=this._vtlTechniques.getTechnique(3)}const{displayLevel:l}=t,{minzoom:a,maxzoom:c}=e;void 0!==a&&a>l+r||void 0!==c&&c<=l-r||!o||(this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"composite"},stencil:{write:{mask:0},test:!1},depth:!1}),t.styleLayerUID=e.uid,t.styleLayer=e,n[0]=i,o.render(t,{tiles:n}),n[0]=null)}}const n=[null];export{s as default};
2
+ import{RenderingDevice as e}from"../webgl/RenderingDevice.js";import{simplePipelineState as t}from"../webgl/shaderGraph/utils.js";import{VTLTechniquesRepo as i}from"../webgl/shaderGraph/techniques/vectorTiles/VTLTechniques.js";const r=1e-6;class n{constructor(t,r){this.spriteMosaic=t,this.glyphMosaic=r,this._vtlTechniques=new i,this._context=null,this._vtlTechniques.startup(),this._renderingDevice=new e}dispose(){this._vtlTechniques&&this._vtlTechniques.shutdown(this._context),this.spriteMosaic.dispose(),this.glyphMosaic.dispose(),this._renderingDevice.dispose(),this._context=null}drawSymbols(e,t,i){const n=i.layers;e.renderPass="translucent";const o=this._vtlTechniques.getTechnique(3);s[0]=t;for(let l=0;l<n.length;l++){const t=n[l];if(3!==t.type)continue;const i=t.getLayoutProperty("visibility");if(i&&1===i.getValue())continue;const a=e.displayLevel;void 0!==t.minzoom&&t.minzoom>a+r||void 0!==t.maxzoom&&t.maxzoom<=a-r||(e.styleLayerUID=t.uid,e.styleLayer=t,o.render(e,{tiles:s}))}s[0]=null}drawBackground(e,t,i){if(0===i.backgroundBucketIds.length)return;const{displayLevel:n,requiredLevel:o}=e;t.key.level=o,this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"composite"},stencil:!1,depth:{write:!1,test:519}}),e.renderPass="background";const l=this._vtlTechniques.getTechnique(0);s[0]=t,i.backgroundBucketIds.forEach(t=>{const o=i.getLayerById(t);if(0!==o.type)return;const a=o.getLayoutProperty("visibility");a&&1===a.getValue()||void 0!==o.minzoom&&o.minzoom>n+r||void 0!==o.maxzoom&&o.maxzoom<=n-r||(e.styleLayerUID=o.uid,e.styleLayer=o,l.render(e,{tiles:s}))}),s[0]=null}drawTile(e,i,r,n){const s=r.layers.filter(e=>{if(null!=n&&n!==e.type||!i.layerData.has(e.uid))return!1;const t=e.getLayoutProperty("visibility");return 1!==t?.getValue()}),{context:o}=e,l=o.getPipelineState(),{depthWrite:a}=l;let c=0,u=1;void 0!==a?.zNear&&void 0!==a.zFar&&(c=a.zNear,u=a.zFar),this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"none"},stencil:!1,depth:{write:{zNear:c,zFar:u},test:515}}),e.renderPass="opaque";for(let t=s.length-1;t>=0;--t)this._renderStyleLayer(s[t],e,i);this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"composite"},stencil:!1,depth:{write:!1,test:515}}),e.renderPass="translucent",s.forEach(t=>this._renderStyleLayer(t,e,i)),this._renderingDevice.setPipelineState(t),this._context||(this._context=e.context)}setShader(e){return this._renderingDevice.setShader(e)}setPipelineState(e){return this._renderingDevice.setPipelineState(e)}getPipelineState(){return this._renderingDevice.getPipelineState()}submitDraw(e,t,i){return this._renderingDevice.submitDraw(e,t,i)}submitDrawMesh(e,t,i,r){this._renderingDevice.submitDrawMesh(e,t,i,r)}submitDrawMeshUntyped(e,t,i,r){this._renderingDevice.submitDrawMeshUntyped(e,t,i,r)}updatePipelineState(e){return this._renderingDevice.updatePipelineState(e)}setStencilRef(e,t){return this._renderingDevice.setStencilRef(e,t)}_renderStyleLayer(e,t,i){const{renderPass:n}=t;let o;switch(e.type){case 0:if("background"!==n)return;o=this._vtlTechniques.getTechnique(0);break;case 1:if("opaque"!==n&&"translucent"!==n)return;o=this._vtlTechniques.getTechnique(1);break;case 2:if("translucent"!==n)return;o=this._vtlTechniques.getTechnique(2);break;case 4:if("translucent"!==n)return;o=this._vtlTechniques.getTechnique(4);break;case 3:if("translucent"!==n)return;o=this._vtlTechniques.getTechnique(3)}const{displayLevel:l}=t,{minzoom:a,maxzoom:c}=e;void 0!==a&&a>l+r||void 0!==c&&c<=l-r||!o||(3===e.type&&this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:"composite"},stencil:!1,depth:!1}),t.styleLayerUID=e.uid,t.styleLayer=e,s[0]=i,o.render(t,{tiles:s}),s[0]=null)}}const s=[null];export{n as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import t from"../../../../request.js";import{bidiText as e}from"../../../../core/BidiText.js";import has from"../../../../core/has.js";import{throwIfNotAbortError as s}from"../../../../core/promiseUtils.js";import{loadTextModule as i}from"../../../../libs/text/loadTextModule.js";import{sdfRadiusComplex as h,sdfBufferGlyphSDFCreator as a,sdfSizeComplex as r,sdfBufferServer as n,sdfRadiusSimple as o,sdfSizeSimple as c}from"./definitions.js";import{GlyphSDFCreator as l}from"./GlyphSDFCreator.js";import p from"./Rect.js";import g from"./RectangleBinPack.js";import{charCodes as d}from"./Utils.js";import _ from"../../../webgl/Texture.js";import{TextureDescriptor as f}from"../../../webgl/TextureDescriptor.js";const u=256,y=.25,m=t=>Math.floor(t/256);function w(t){const e=new Set;for(const s of t)e.add(m(s));return e}function C(t,e,i){return t.has(e)||t.set(e,i().then(()=>{t.delete(e)}).catch(i=>{t.delete(e),s(i)})),t.get(e)}const x=t=>({rect:new p(0,0,0,0),page:0,metrics:{left:0,width:0,height:0,advance:0,top:0},code:t,sdf:!0});class P{constructor(t,e,s,i=!1){this._snapCoords=i,this.width=0,this.height=0,this._dirties=[],this._pageData=[],this._currentPage=0,this._glyphCache={},this._glyphCacheById={},this._textures=[],this._rangePromises=new Map,this._facePromises=new Map,this._preloadCache={},this._glyphSDFCreator=new l({sdfSizePx:r,sdfBufferPx:a,radius:h,cutoff:y}),this._faces=new Map,this.width=t,this.height=e,this._glyphSource=s,this._binPack=new g(t,e),this._pageData.push(new Uint8Array(t*e)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs()}dispose(){this._binPack=null;for(const t of this._textures)t&&t.dispose();this._textures.length=0,this._pageData.length=0}_initDecorationGlyphs(){const t=[117,149,181,207,207,181,149,117],e=[],s=[];for(let a=0;a<t.length;a++){const i=t[a];for(let t=0;t<11;t++){const h=a>=3&&a<5&&t>=3&&t<8?255:0;e.push(i),s.push(h)}}const i={metrics:{width:5,height:2,left:0,top:0,advance:0},bitmap:new Uint8Array(e)},h={metrics:{width:5,height:2,left:0,top:0,advance:0},bitmap:new Uint8Array(s)};this._recordGlyph(i,n),this._recordGlyph(h,n)}getTexture(t,e){if(!this._textures[e]){const s=new f(this.width,this.height);s.pixelFormat=6406,s.wrapMode=33071,this._textures[e]=new _(t,s,new Uint8Array(this.width*this.height))}return this._dirties[e]&&(this._textures[e].setData(this._pageData[e]),this._dirties[e]=!1),this._textures[e]}async getGlyphItems(t,s,i,l){const p=s?r:c,g=s?h:o,_=s?a:n;let f,u,y=!1;if(s){const s=this._getGlyphCacheById(i),h=await this.getFace(i);if(!h)return null;const a=this._glyphSDFCreator.sdfSizePx,[r,n,o]=e(t,!1);y=n;const c=new Uint32Array(Array.from(r).map((t,e)=>o.levels[o.targetToSource[e]]));f={baseline:h.baseline()/a,midline:h.midline()/a},u=h.shape(r,c,a).map(t=>this._getMosaicItemComplex(s,t,h))}else{const[s,h,a]=e(t);y=h;const r=this._getGlyphCache(i),n=d(s);try{await this._fetchRanges(i,n,l)}catch{return null}u=n.map(t=>this._getMosaicItem(r,i,t))}return{type:"glyphs",isRightToLeft:y,glyphs:u,faceInfo:f,sdfSize:p,sdfRadius:g,sdfPadding:_}}async getGlyphItemsVTL(t,e){const s=this._getGlyphCache(t);await this._fetchRanges(t,e,null);const i=[];for(const h of e)i[h]=this._getMosaicItem(s,t,h);return i}async getFace(e){if(this._faces.has(e))return this._faces.get(e);const s=this._glyphSource.woffURL(e);return await C(this._facePromises,e,async()=>{const h=await t(s,{responseType:"array-buffer"}),a=(await i()).Face.parseWoff2(new Uint8Array(h.data));this._faces.set(e,a)}),this._faces.get(e)}_getMosaicItem(t,e,s){if(!t[s]){const i=this._glyphSource.getGlyph(e,s);if(!i?.metrics)return x(s);const h=this._recordGlyph(i,n),a=this._currentPage,r=i.metrics;t[s]={rect:h,page:a,metrics:r,code:s,sdf:!0},this._invalidate()}return t[s]}_getMosaicItemComplex(t,e,s){if(!t[e.glyphId]){const i=this._glyphSDFCreator.draw(s,e.glyphId),h={width:i?.width??0,height:i?.height??0,left:i?.left??0,top:i?.top??0,advance:e.xAdvance};let r=new p(0,0,0,0);if(i){const t={bitmap:i.buffer,metrics:h};r=this._recordGlyph(t,a)}const n=e.isNewline?10:e.isWhitespace?32:NaN;t[e.glyphId]={rect:r,page:this._currentPage,metrics:h,sdf:!0,code:n}}return t[e.glyphId]}bind(t,e,s,i){const h=this.getTexture(t,s);h.setSamplingMode(e),t.bindTexture(h,i)}preloadASCIIGlyphCache(t){const e=this._preloadCache[t];if(null!=e)return e;const s=this._glyphSource.preloadASCIIRange(t).then(()=>{const e=this._getGlyphCache(t);for(let s=0;s<256;s++)this._getMosaicItem(e,t,s)});return this._preloadCache[t]=s,s}_getGlyphCache(t){return this._glyphCache[t]||(this._glyphCache[t]={}),this._glyphCache[t]}_getGlyphCacheById(t){return this._glyphCacheById[t]||(this._glyphCacheById[t]={}),this._glyphCacheById[t]}_invalidate(){this._dirties[this._currentPage]=!0}async _fetchRanges(t,e,s){const i=w(e),h=[];i.forEach(e=>{h.push(this._fetchRange(t,e,s))}),await Promise.all(h)}async _fetchRange(t,e,s){if(e>u)return;const i=t+e;return C(this._rangePromises,i,()=>this._glyphSource.getRange(t,e,s))}_allocNewPage(){this._dirties[this._currentPage]||(this._pageData[this._currentPage]=null),this._currentPage=this._pageData.length,this._pageData.push(new Uint8Array(this.width*this.height)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs(),this._binPack=new g(this.width,this.height)}_recordGlyph(t,e){const s=t.metrics;let i;if(0===s.width)i=new p(0,0,0,0);else{const h=s.width+2*e,a=s.height+2*e;let r=h,n=a;if(this._snapCoords){r+=h%4?4-h%4:4,n+=a%4?4-a%4:4}i=this._binPack.allocate(r,n),i.isEmpty&&(this._allocNewPage(),i=this._binPack.allocate(r,n));const o=this._pageData[this._currentPage],c=t.bitmap;for(let t=0;t<a;t++){const e=h*t,s=this.width*(i.y+t)+i.x;for(let t=0;t<h;t++)o[s+t]=c[e+t]}has("esri-glyph-debug")&&this._showDebugPage(o)}return i}_showDebugPage(t){const e=document.createElement("canvas"),s=e.getContext("2d"),i=new ImageData(this.width,this.height),h=i.data;e.width=this.width,e.height=this.height,e.style.border="1px solid black";for(let a=0;a<t.length;++a)h[4*a]=t[a],h[4*a+1]=0,h[4*a+2]=0,h[4*a+3]=255;s.putImageData(i,0,0),document.body.appendChild(e)}}export{P as default};
2
+ import t from"../../../../request.js";import{bidiText as e}from"../../../../core/BidiText.js";import has from"../../../../core/has.js";import{throwIfNotAbortError as s}from"../../../../core/promiseUtils.js";import{loadTextModule as i}from"../../../../libs/text/loadTextModule.js";import{sdfRadiusComplex as h,sdfBufferGlyphSDFCreator as r,sdfSizeComplex as a,sdfBufferServer as n,sdfRadiusSimple as o,sdfSizeSimple as c}from"./definitions.js";import{GlyphSDFCreator as l}from"./GlyphSDFCreator.js";import p from"./Rect.js";import g from"./RectangleBinPack.js";import{charCodes as _}from"./Utils.js";import d from"../../../webgl/Texture.js";import{TextureDescriptor as f}from"../../../webgl/TextureDescriptor.js";const u=256,y=.25,m=t=>Math.floor(t/256);function w(t){const e=new Set;for(const s of t)e.add(m(s));return e}function C(t,e,i){return t.has(e)||t.set(e,i().then(()=>{t.delete(e)}).catch(i=>{t.delete(e),s(i)})),t.get(e)}const x=t=>({rect:new p(0,0,0,0),page:0,metrics:{left:0,width:0,height:0,advance:0,top:0},code:t,sdf:!0});class P{constructor(t,e,s,i=!1){this._snapCoords=i,this.width=0,this.height=0,this._dirties=[],this._pageData=[],this._currentPage=0,this._glyphCache={},this._glyphCacheById={},this._textures=[],this._rangePromises=new Map,this._facePromises=new Map,this._preloadCache={},this._glyphSDFCreator=new l({sdfSizePx:a,sdfBufferPx:r,radius:h,cutoff:y}),this._faces=new Map,this.width=t,this.height=e,this._glyphSource=s,this._binPack=new g(t,e),this._pageData.push(new Uint8Array(t*e)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs()}dispose(){this._binPack=null;for(const t of this._textures)t&&t.dispose();this._textures.length=0,this._pageData.length=0}_initDecorationGlyphs(){const t=[117,149,181,207,207,181,149,117],e=[],s=[];for(let a=0;a<t.length;a++){const i=t[a];for(let t=0;t<11;t++){const h=a>=3&&a<5&&t>=3&&t<8?255:0;e.push(i),s.push(h)}}const i={width:5,height:2,left:0,top:0,advance:0},h=new Uint8Array(e),r=new Uint8Array(s);this._recordGlyph(i,h,n),this._recordGlyph(i,r,n)}getTexture(t,e){if(!this._textures[e]){const s=new f(this.width,this.height);s.pixelFormat=6406,s.wrapMode=33071,this._textures[e]=new d(t,s,new Uint8Array(this.width*this.height))}return this._dirties[e]&&(this._textures[e].setData(this._pageData[e]),this._dirties[e]=!1),this._textures[e]}async getGlyphItems(t,s,i,l){const p=s?a:c,g=s?h:o,d=s?r:n;let f,u=[],y=!1;if(s){const s=this._getGlyphCacheById(i),h=await this.getFace(i);if(!h)return null;const r=this._glyphSDFCreator.sdfSizePx,[a,n,o]=e(t,!1);y=n;const c=new Uint32Array(Array.from(a).map((t,e)=>o.levels[o.targetToSource[e]]));f={baseline:h.baseline()/r,midline:h.midline()/r},u=h.shape(a,c,r).map(t=>this._getMosaicItemComplex(s,t,h))}else{const[s,h,r]=e(t);y=h;const a=this._getGlyphCache(i),n=_(s);try{await this._fetchRanges(i,n,l)}catch{return null}for(const t of n){const e=this._getMosaicItem(a,i,t);e&&u.push(e)}}return{type:"glyphs",isRightToLeft:y,glyphs:u,faceInfo:f,sdfSize:p,sdfRadius:g,sdfPadding:d}}async getGlyphItemsVTL(t,e){const s=this._getGlyphCache(t);await this._fetchRanges(t,e,null);const i=[];for(const h of e){const e=this._getMosaicItem(s,t,h,!0);e&&(i[h]=e)}return i}async getFace(e){if(this._faces.has(e))return this._faces.get(e);const s=this._glyphSource.woffURL(e);return await C(this._facePromises,e,async()=>{const h=await t(s,{responseType:"array-buffer"}),r=(await i()).Face.parseWoff2(new Uint8Array(h.data));this._faces.set(e,r)}),this._faces.get(e)}_getMosaicItem(t,e,s,i=!1){if(!t[s]){const{metrics:h,bitmap:r}=this._glyphSource.getGlyph(e,s);if(i&&!h)return;if(!h)return x(s);const a=r?this._recordGlyph(h,r,n):new p(0,0,0,0),o=this._currentPage;t[s]={rect:a,page:o,metrics:h,code:s,sdf:!0},this._invalidate()}return t[s]}_getMosaicItemComplex(t,e,s){if(!t[e.glyphId]){const i=this._glyphSDFCreator.draw(s,e.glyphId),h={width:i?.width??0,height:i?.height??0,left:i?.left??0,top:i?.top??0,advance:e.xAdvance},a=i?this._recordGlyph(h,i.buffer,r):new p(0,0,0,0),n=e.isNewline?10:e.isWhitespace?32:NaN;t[e.glyphId]={rect:a,page:this._currentPage,metrics:h,sdf:!0,code:n}}return t[e.glyphId]}bind(t,e,s,i){const h=this.getTexture(t,s);h.setSamplingMode(e),t.bindTexture(h,i)}preloadASCIIGlyphCache(t){const e=this._preloadCache[t];if(null!=e)return e;const s=this._glyphSource.preloadASCIIRange(t).then(()=>{const e=this._getGlyphCache(t);for(let s=0;s<256;s++)this._getMosaicItem(e,t,s)});return this._preloadCache[t]=s,s}_getGlyphCache(t){return this._glyphCache[t]||(this._glyphCache[t]={}),this._glyphCache[t]}_getGlyphCacheById(t){return this._glyphCacheById[t]||(this._glyphCacheById[t]={}),this._glyphCacheById[t]}_invalidate(){this._dirties[this._currentPage]=!0}async _fetchRanges(t,e,s){const i=w(e),h=[];i.forEach(e=>{h.push(this._fetchRange(t,e,s))}),await Promise.all(h)}async _fetchRange(t,e,s){if(e>u)return;const i=t+e;return C(this._rangePromises,i,()=>this._glyphSource.getRange(t,e,s))}_allocNewPage(){this._dirties[this._currentPage]||(this._pageData[this._currentPage]=null),this._currentPage=this._pageData.length,this._pageData.push(new Uint8Array(this.width*this.height)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs(),this._binPack=new g(this.width,this.height)}_recordGlyph(t,e,s){let i;if(0===t.width)i=new p(0,0,0,0);else{const h=t.width+2*s,r=t.height+2*s;let a=h,n=r;if(this._snapCoords){a+=h%4?4-h%4:4,n+=r%4?4-r%4:4}i=this._binPack.allocate(a,n),i.isEmpty&&(this._allocNewPage(),i=this._binPack.allocate(a,n));const o=this._pageData[this._currentPage];for(let t=0;t<r;t++){const s=h*t,r=this.width*(i.y+t)+i.x;for(let t=0;t<h;t++)o[r+t]=e[s+t]}has("esri-glyph-debug")&&this._showDebugPage(o)}return i}_showDebugPage(t){const e=document.createElement("canvas"),s=e.getContext("2d"),i=new ImageData(this.width,this.height),h=i.data;e.width=this.width,e.height=this.height,e.style.border="1px solid black";for(let r=0;r<t.length;++r)h[4*r]=t[r],h[4*r+1]=0,h[4*r+2]=0,h[4*r+3]=255;s.putImageData(i,0,0),document.body.appendChild(e)}}export{P as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import t from"../../../../config.js";import e from"../../../../request.js";import a from"../../../../core/pbf.js";class s{constructor(t){this._metrics=[],this._bitmaps=[];const e=new Map;let a=0;for(;t.next();)switch(t.tag()){case 1:{const s=t.getMessage();for(;s.next();)switch(s.tag()){case 3:{const t=s.getMessage();let r,n,i,o,c,g,f;for(;t.next();)switch(t.tag()){case 1:r=t.getUInt32();break;case 2:n=t.getBytes();break;case 3:i=t.getUInt32();break;case 4:o=t.getUInt32();break;case 5:c=t.getSInt32();break;case 6:g=t.getSInt32();break;case 7:f=t.getUInt32();break;default:t.skip()}if(t.release(),r&&(this._metrics[r]={width:i,height:o,left:c,top:g,advance:f},n)){const t=n.length;e.set(r,n),this._bitmaps[r]={start:a,length:t},a+=t}break}default:s.skip()}s.release();break}default:t.skip()}this._buffer=new Uint8Array(a);for(const[s,r]of e)this._buffer.set(r,this._bitmaps[s].start)}getMetrics(t){return this._metrics[t]}getBitmap(t){const e=this._bitmaps.at(t);if(void 0!==e&&0!==e.length)return this._buffer.subarray(e.start,e.start+e.length)}}class r{constructor(){this._ranges=[]}getRange(t){return this._ranges[t]}addRange(t,e){this._ranges[t]=e}}class n{constructor(e){this._glyphInfo={},this._baseURL=e,this._woff2URL=`${t.fontsUrl}/woff2/{fontstack}.woff2`}async getRange(t,r,n){const i=this._getFontStack(t);if(i.getRange(r))return;const o=256*r,c=o+255,g=this._baseURL.replace("{fontstack}",t).replace("{range}",o+"-"+c);return e(g,{responseType:"array-buffer",...n}).then(t=>{i.addRange(r,new s(new a(new Uint8Array(t.data),new DataView(t.data))))})}async preloadASCIIRange(t){const r=this._getFontStack(t),n=0,i=255,o=this._baseURL.replace("{fontstack}",t).replace("{range}",n+"-"+i),c=await e(o,{responseType:"array-buffer"}),g=new s(new a(new Uint8Array(c.data),new DataView(c.data)));for(let e=n;e<=i;e++)r.getRange(e)||r.addRange(e,g)}getGlyph(t,e){const a=this._getFontStack(t);if(!a)return;const s=Math.floor(e/256),r=a.getRange(s);return r?{metrics:r.getMetrics(e),bitmap:r.getBitmap(e)}:void 0}woffURL(t){return this._woff2URL.replace("{fontstack}",t)}_getFontStack(t){let e=this._glyphInfo[t];return e||(e=this._glyphInfo[t]=new r),e}}export{n as default};
2
+ import t from"../../../../config.js";import e from"../../../../request.js";import a from"../../../../core/pbf.js";class s{constructor(t){this._metrics=[],this._bitmaps=[];const e=new Map;let a=0;for(;t.next();)switch(t.tag()){case 1:{const s=t.getMessage();for(;s.next();)switch(s.tag()){case 3:{const t=s.getMessage();let r,n,i,c,o,g,f;for(;t.next();)switch(t.tag()){case 1:r=t.getUInt32();break;case 2:n=t.getBytes();break;case 3:i=t.getUInt32();break;case 4:c=t.getUInt32();break;case 5:o=t.getSInt32();break;case 6:g=t.getSInt32();break;case 7:f=t.getUInt32();break;default:t.skip()}if(t.release(),r&&(this._metrics[r]={width:i,height:c,left:o,top:g,advance:f},n)){const t=n.length;e.set(r,n),this._bitmaps[r]={start:a,length:t},a+=t}break}default:s.skip()}s.release();break}default:t.skip()}this._buffer=new Uint8Array(a);for(const[s,r]of e)this._buffer.set(r,this._bitmaps[s].start)}getMetrics(t){return this._metrics.at(t)}getBitmap(t){const e=this._bitmaps.at(t);if(void 0!==e&&0!==e.length)return this._buffer.subarray(e.start,e.start+e.length)}}class r{constructor(){this._ranges=[]}getRange(t){return this._ranges.at(t)}addRange(t,e){this._ranges[t]=e}}class n{constructor(e){this._glyphInfo={},this._baseURL=e,this._woff2URL=`${t.fontsUrl}/woff2/{fontstack}.woff2`}async getRange(t,r,n){const i=this._getFontStack(t);if(i.getRange(r))return;const c=256*r,o=c+255,g=this._baseURL.replace("{fontstack}",t).replace("{range}",c+"-"+o);return e(g,{responseType:"array-buffer",...n}).then(t=>{i.addRange(r,new s(new a(new Uint8Array(t.data),new DataView(t.data))))})}async preloadASCIIRange(t){const r=this._getFontStack(t),n=0,i=255,c=this._baseURL.replace("{fontstack}",t).replace("{range}",n+"-"+i),o=await e(c,{responseType:"array-buffer"}),g=new s(new a(new Uint8Array(o.data),new DataView(o.data)));for(let e=n;e<=i;e++)r.getRange(e)||r.addRange(e,g)}getGlyph(t,e){let a,s;const r=this._getFontStack(t).getRange(Math.floor(e/256));return r&&(a=r.getMetrics(e),s=r.getBitmap(e)),{metrics:a,bitmap:s}}woffURL(t){return this._woff2URL.replace("{fontstack}",t)}_getFontStack(t){let e=this._glyphInfo[t];return e||(e=this._glyphInfo[t]=new r),e}}export{n as default};