@arcgis/core 4.27.0-rc.0 → 4.27.0-rc.2

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 (207) hide show
  1. package/README.md +2 -2
  2. package/arcade/featureSetUtils.js +1 -1
  3. package/arcade/featureset/actions/GroupBy.js +1 -1
  4. package/arcade/featureset/actions/OrderBy.js +1 -1
  5. package/arcade/functions/featuresetbase.js +1 -1
  6. package/arcade/functions/featuresetstring.js +1 -1
  7. package/arcade/languageUtils.js +1 -1
  8. package/arcade/treeAnalysis.js +1 -1
  9. package/assets/esri/core/workers/RemoteClient.js +1 -1
  10. package/assets/esri/core/workers/chunks/0407bf97ad621c89a734.js +1 -0
  11. package/assets/esri/core/workers/chunks/0610691a0c0d9fbbd6d2.js +1 -0
  12. package/assets/esri/core/workers/chunks/0a86c458916e83d6c523.js +1 -0
  13. package/assets/esri/core/workers/chunks/14145959a3dab1437818.js +1 -0
  14. package/assets/esri/core/workers/chunks/16db0bc87d87a7313dc4.js +1 -0
  15. package/assets/esri/core/workers/chunks/183e2e0cb86c1c640d94.js +1 -0
  16. package/assets/esri/core/workers/chunks/19d329b9d4ec2eff1d13.js +1 -0
  17. package/assets/esri/core/workers/chunks/1b8074269800b384ecf6.js +1 -0
  18. package/assets/esri/core/workers/chunks/1f69fb9687de9ebfcf90.js +1 -0
  19. package/assets/esri/core/workers/chunks/2154d395f405be3cd3ba.js +1 -0
  20. package/assets/esri/core/workers/chunks/{33dbba3b7fc648437e50.js → 21e1f3b11e7d363b727a.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{31a158c73994603c169d.js → 2446e336b1f7256d4fde.js} +1 -1
  22. package/assets/esri/core/workers/chunks/29290a44fd3b183c24e3.js +1 -0
  23. package/assets/esri/core/workers/chunks/2b55295590b4a0503749.js +1 -0
  24. package/assets/esri/core/workers/chunks/{f498c4d4831141125781.js → 2f5639886f577baedbca.js} +1 -1
  25. package/assets/esri/core/workers/chunks/33901eb1574e46abd9af.js +1 -0
  26. package/assets/esri/core/workers/chunks/{9c78ad5ab57e0d47ac43.js → 3ba2fcb9110230f8790c.js} +1 -1
  27. package/assets/esri/core/workers/chunks/3e239bfad611985e50fb.js +1 -0
  28. package/assets/esri/core/workers/chunks/42f3421740a5479559dc.js +1 -0
  29. package/assets/esri/core/workers/chunks/471f6eba213412b82840.js +1 -0
  30. package/assets/esri/core/workers/chunks/53ad34bf32f5f3d4fe18.js +1 -0
  31. package/assets/esri/core/workers/chunks/{97cdbec7532cfcdf9ad2.js → 595a2baa04d92de59558.js} +1 -1
  32. package/assets/esri/core/workers/chunks/{2e627c94e57c924e5917.js → 5e6471dd2a08e66b47d0.js} +79 -81
  33. package/assets/esri/core/workers/chunks/624521961fe1f2c4f2c5.js +1 -0
  34. package/assets/esri/core/workers/chunks/{212d59764c275c763941.js → 659b7bad7281c0e2aed3.js} +1 -1
  35. package/assets/esri/core/workers/chunks/6a3d611e8842afbb50ab.js.LICENSE.txt +1 -1
  36. package/assets/esri/core/workers/chunks/6cd248d065f6d1616294.js +1 -0
  37. package/assets/esri/core/workers/chunks/6e562fa57c0347091154.js +1 -0
  38. package/assets/esri/core/workers/chunks/6f510f28526c73ab453c.js +1 -0
  39. package/assets/esri/core/workers/chunks/7479dc0c790337af7597.js +1 -0
  40. package/assets/esri/core/workers/chunks/{e88cff2537be52da6531.js → 74fd2059ddda9083cbcc.js} +1 -1
  41. package/assets/esri/core/workers/chunks/7dc6774c77c822b68c99.js +1 -0
  42. package/assets/esri/core/workers/chunks/82a103a8b5382300889d.js +1 -0
  43. package/assets/esri/core/workers/chunks/83e3d104886b48f00397.js +1 -0
  44. package/assets/esri/core/workers/chunks/{9849f64793f2ad39366b.js → 9290b0d330f02233d803.js} +1 -1
  45. package/assets/esri/core/workers/chunks/{3c5a64a545272f148e93.js → 9621b7d8d951aa881686.js} +1 -1
  46. package/assets/esri/core/workers/chunks/{36df72362b38759b895b.js → 9648a8f2b24f1ca3d637.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{ad18fb7bb54a0c4bdb38.js → a20361b4d3bdd7d196ca.js} +1 -1
  48. package/assets/esri/core/workers/chunks/a7fd2a95fde197c06828.js +1 -0
  49. package/assets/esri/core/workers/chunks/b0cda39b53ecd6c44cd0.js +1 -0
  50. package/assets/esri/core/workers/chunks/b2a423d9ce8bb784267c.js +1 -0
  51. package/assets/esri/core/workers/chunks/{b6e173eddaad4244cb5f.js → b31974524932e638df8c.js} +1 -1
  52. package/assets/esri/core/workers/chunks/{df0453cdfe685d6436cc.js → b6dc41fce601b9d3480e.js} +1 -1
  53. package/assets/esri/core/workers/chunks/b8e6c64792a512df4c4d.js +1 -0
  54. package/assets/esri/core/workers/chunks/c6617a937440701c0180.js +1 -0
  55. package/assets/esri/core/workers/chunks/d8607326a199dd994844.js +1 -0
  56. package/assets/esri/core/workers/chunks/da57eba2fe25495ea217.js +1 -0
  57. package/assets/esri/core/workers/chunks/dabd889e064c4e7807fa.js +1 -0
  58. package/assets/esri/core/workers/chunks/{39e473586579d11d6732.js → e2432871f1329f47465d.js} +1 -1
  59. package/assets/esri/core/workers/chunks/ee5ee03dd2c7dc940272.js +1 -0
  60. package/assets/esri/core/workers/chunks/{c83669cf08391a62fb72.js → f1da7b29eecad0e9efae.js} +1 -1
  61. package/assets/esri/core/workers/chunks/f35895e03c036d67b3ed.js +1 -0
  62. package/assets/esri/core/workers/chunks/f505ebd4bd3bfb6c790d.js +1 -0
  63. package/assets/esri/core/workers/chunks/f6e68befe2812b90b40d.js +1 -0
  64. package/assets/esri/core/workers/chunks/{3c6c082157c916f8ddba.js → ffe61d5a6a9b34bee9d4.js} +1 -1
  65. package/assets/esri/themes/base/widgets/_Bookmarks.scss +5 -0
  66. package/assets/esri/themes/base/widgets/_Feature.scss +4 -0
  67. package/assets/esri/themes/base/widgets/_FeatureContent.scss +9 -2
  68. package/assets/esri/themes/base/widgets/_Features.scss +5 -7
  69. package/assets/esri/themes/base/widgets/_Popup.scss +3 -3
  70. package/assets/esri/themes/base/widgets/_ScaleRangeSlider.scss +1 -0
  71. package/assets/esri/themes/base/widgets/_Swipe.scss +11 -0
  72. package/assets/esri/themes/dark/main.css +1 -1
  73. package/assets/esri/themes/light/main.css +1 -1
  74. package/assets/esri/themes/light/view.css +1 -1
  75. package/chunks/DefaultMaterial.glsl.js +3 -2
  76. package/chunks/SSAO.glsl.js +1 -1
  77. package/chunks/ShadowCastAccumulate.glsl.js +1 -1
  78. package/chunks/languageUtils.js +1 -1
  79. package/core/timeUtils.js +1 -1
  80. package/geometry/Mesh.js +1 -1
  81. package/geometry/support/DoubleArray.js +1 -1
  82. package/geometry/support/meshUtils/bounds.js +5 -0
  83. package/geometry/support/meshUtils/georeference.js +1 -1
  84. package/geometry/support/meshVertexSpaceUtils.js +5 -0
  85. package/interfaces.d.ts +181 -33
  86. package/kernel.js +1 -1
  87. package/layers/FeatureLayer.js +1 -1
  88. package/layers/StreamLayer.js +1 -1
  89. package/layers/VideoLayer.js +1 -1
  90. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  91. package/layers/graphics/controllers/StreamController.js +1 -1
  92. package/layers/graphics/data/QueryEngine.js +1 -1
  93. package/layers/graphics/data/attributeSupport.js +1 -1
  94. package/layers/graphics/editingSupport.js +1 -1
  95. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  96. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  97. package/layers/support/FeatureReductionBinning.js +1 -1
  98. package/layers/support/FeatureReductionCluster.js +1 -1
  99. package/layers/support/featureLayerUtils.js +1 -1
  100. package/layers/support/rasterFunctions/colormaps.js +1 -1
  101. package/layers/video/VideoController.js +1 -1
  102. package/layers/video/videoUtils.js +5 -0
  103. package/package.json +2 -2
  104. package/renderers/support/utils.js +1 -1
  105. package/rest/support/meshFeatureSet.js +1 -1
  106. package/smartMapping/symbology/flow.js +1 -1
  107. package/statistics/utils.js +1 -1
  108. package/support/arcadeUtils.js +1 -1
  109. package/support/revision.js +1 -1
  110. package/symbols/cim/CIMSymbolHelper.js +1 -1
  111. package/symbols/cim/effects/EffectBuffer.js +1 -1
  112. package/symbols/cim/effects/EffectDonut.js +1 -1
  113. package/symbols/cim/effects/EffectOffset.js +1 -1
  114. package/views/2d/layers/StreamLayerView2D.js +1 -1
  115. package/views/2d/layers/features/Store2D.js +1 -1
  116. package/views/2d/layers/features/sources/StreamSource.js +1 -1
  117. package/views/3d/environment/ChapmanAtmosphereTechnique.js +1 -1
  118. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  119. package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
  120. package/views/3d/layers/I3SMeshView3D.js +1 -1
  121. package/views/3d/layers/II3SMeshView3D.js +1 -1
  122. package/views/3d/layers/SceneLayerView3D.js +1 -1
  123. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  124. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  125. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  126. package/views/3d/layers/graphics/webStyleUtils.js +1 -1
  127. package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
  128. package/views/3d/layers/i3s/I3SMaterialUtil.js +1 -1
  129. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  130. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  131. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  132. package/views/3d/webgl-engine/core/shaderLibrary/Transform.glsl.js +3 -9
  133. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +12 -9
  134. package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js +10 -10
  135. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +2 -2
  136. package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterDistortion.glsl.js +2 -2
  137. package/views/3d/webgl-engine/core/shaderLibrary/terrain/TerrainTexture.glsl.js +8 -8
  138. package/views/3d/webgl-engine/core/shaderModules/Matrix4sDrawUniform.js +1 -1
  139. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  140. package/views/3d/webgl-engine/lib/ShadowHighlight.js +1 -1
  141. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  142. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  143. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  144. package/views/3d/webgl-engine/materials/pbrUtils.js +5 -0
  145. package/views/3d/webgl-engine/shaders/AtmosphereCompositingTechnique.js +1 -1
  146. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  147. package/views/3d/webgl-engine/shaders/ShadowHighlightTechnique.js +1 -1
  148. package/views/draw/DrawGraphicTool.js +1 -1
  149. package/views/layers/GroupLayerView.js +1 -1
  150. package/webdoc/support/writeUtils.js +1 -1
  151. package/widgets/Bookmarks/css.js +1 -1
  152. package/widgets/Bookmarks.js +1 -1
  153. package/widgets/Daylight/DaylightViewModel.js +1 -1
  154. package/widgets/Editor/EditorViewModel.js +1 -1
  155. package/widgets/Editor/UpdateWorkflow.js +1 -1
  156. package/widgets/Editor/Workflow.js +1 -1
  157. package/widgets/Editor/workflowUtils.js +1 -1
  158. package/widgets/Editor.js +1 -1
  159. package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
  160. package/widgets/Feature/FeatureRelationship.js +1 -1
  161. package/widgets/FeatureForm/EditableInput.d.ts +2 -2
  162. package/widgets/FeatureTable/FieldColumn.js +1 -1
  163. package/widgets/Features.js +1 -1
  164. package/widgets/UtilityNetworkTrace/UtilityNetworkTraceViewModel.js +1 -1
  165. package/widgets/UtilityNetworkTrace/support/GeometryHandler.js +1 -1
  166. package/widgets/UtilityNetworkTrace/support/ResultAreaHandler.js +1 -1
  167. package/widgets/UtilityNetworkTrace.js +1 -1
  168. package/widgets/UtilityNetworkValidateTopology/UtilityNetworkValidateTopologyViewModel.js +1 -1
  169. package/widgets/UtilityNetworkValidateTopology.js +1 -1
  170. package/widgets/ValuePicker/ValuePickerBaseComponent.js +1 -1
  171. package/widgets/ValuePicker.js +1 -1
  172. package/assets/esri/core/workers/chunks/0b03165dbf289797cefa.js +0 -1
  173. package/assets/esri/core/workers/chunks/0c1c0024879f944f44c4.js +0 -1
  174. package/assets/esri/core/workers/chunks/13a48796905613bc1679.js +0 -1
  175. package/assets/esri/core/workers/chunks/1ea1104651ab15f9a13c.js +0 -1
  176. package/assets/esri/core/workers/chunks/2108cfc7921430f0b805.js +0 -1
  177. package/assets/esri/core/workers/chunks/2eacca322737aafd8f0c.js +0 -1
  178. package/assets/esri/core/workers/chunks/39577683e334eb4d904c.js +0 -1
  179. package/assets/esri/core/workers/chunks/39714837f9d3708e3806.js +0 -1
  180. package/assets/esri/core/workers/chunks/3fe357df92afa1bee70a.js +0 -1
  181. package/assets/esri/core/workers/chunks/4d3deeb0ebd0ce8c1215.js +0 -1
  182. package/assets/esri/core/workers/chunks/576bddc3fa7d91a7e5bd.js +0 -1
  183. package/assets/esri/core/workers/chunks/623d6710a4f800c622ce.js +0 -1
  184. package/assets/esri/core/workers/chunks/6782cc3feb713676d544.js +0 -1
  185. package/assets/esri/core/workers/chunks/6e7178de0b2c3d2f7e6b.js +0 -1
  186. package/assets/esri/core/workers/chunks/785a6c925f29bc962992.js +0 -1
  187. package/assets/esri/core/workers/chunks/78ce0b1af62435d8ebf4.js +0 -1
  188. package/assets/esri/core/workers/chunks/79d2baf392589588ef9b.js +0 -1
  189. package/assets/esri/core/workers/chunks/7bbdba52157da13a01fc.js +0 -1
  190. package/assets/esri/core/workers/chunks/7ec6be2bc0f354011e46.js +0 -1
  191. package/assets/esri/core/workers/chunks/84860b535a70ec448cfe.js +0 -1
  192. package/assets/esri/core/workers/chunks/9035d9e09a4e7cb94d37.js +0 -1
  193. package/assets/esri/core/workers/chunks/956b0fef7bc849415354.js +0 -1
  194. package/assets/esri/core/workers/chunks/9ab98321a4a7eaeeb018.js +0 -1
  195. package/assets/esri/core/workers/chunks/9cb7a68ff46e5c43e1d2.js +0 -1
  196. package/assets/esri/core/workers/chunks/a0f7f7f578521970c714.js +0 -1
  197. package/assets/esri/core/workers/chunks/a60eac45d3c65bd0216f.js +0 -1
  198. package/assets/esri/core/workers/chunks/aca5260f6984952a6e3d.js +0 -1
  199. package/assets/esri/core/workers/chunks/b05be356743fa5d24573.js +0 -1
  200. package/assets/esri/core/workers/chunks/ba6024465308c248170b.js +0 -1
  201. package/assets/esri/core/workers/chunks/d0983f808008920514f2.js +0 -1
  202. package/assets/esri/core/workers/chunks/dab832799bc06b0fec34.js +0 -1
  203. package/assets/esri/core/workers/chunks/e45d36aef2bc69ee9132.js +0 -1
  204. package/assets/esri/core/workers/chunks/e5bbd4cc5edbf7ab3624.js +0 -1
  205. package/assets/esri/core/workers/chunks/e700cf4d1f99291a4396.js +0 -1
  206. package/assets/esri/core/workers/chunks/f398a5cf33c3fd2522a5.js +0 -1
  207. package/assets/esri/core/workers/chunks/f4ee94a6cde4ea8837f1.js +0 -1
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
+ */
5
+ import e from"../support/VideoTimeExtent.js";function n(n){const{duration:t,end:o,start:r,timezone:u="UTC"}=n||{};return"number"!=typeof t?null:new e({duration:t||null,end:"number"==typeof o?new Date(o):null,start:"number"==typeof r?new Date(r):null,timezone:u})}export{n as readVideoTimeExtent};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.27.0-rc.0",
3
+ "version": "4.27.0-rc.2",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -27,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "@esri/arcgis-html-sanitizer": "~3.0.1",
29
29
  "@esri/calcite-colors": "~6.1.0",
30
- "@esri/calcite-components": "^1.4.1",
30
+ "@esri/calcite-components": "^1.4.2",
31
31
  "@popperjs/core": "~2.11.7",
32
32
  "focus-trap": "~7.4.3",
33
33
  "luxon": "~3.3.0",
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{unique as e,isSome as l}from"../../core/arrayUtils.js";import t from"../../core/Logger.js";import{getOrCreateMapValue as i}from"../../core/MapUtils.js";import{convertDateFormatToIntlOptions as o,formatDate as a}from"../../intl/date.js";import{format as n,round as s}from"./numberUtils.js";import r from"../visualVariables/support/ColorStop.js";import{getColorFromSymbol as u}from"../../symbols/support/utils.js";import{getRampStops as f}from"../../widgets/Legend/support/colorRampUtils.js";import{getHeatmapRampStops as d}from"../../widgets/Legend/support/heatmapRampUtils.js";const p=t.getLogger("esri.renderers.support.utils"),m={lte:"<=",gte:">=",lt:"<",gt:">",pct:"%",ld:"–"},c={millisecond:0,second:1,minute:2,hour:3,day:4,month:5,year:6},y={millisecond:"long-month-day-year-long-time",second:"long-month-day-year-long-time",minute:"long-month-day-year-short-time",hour:"long-month-day-year-short-time",day:"long-month-day-year",month:"long-month-day-year",year:"year"},g=o("short-date");async function h(e,l,t){i(e,l,(()=>[])).push(...t)}async function b(l){const t=new Map;if(!l)return t;if("visualVariables"in l&&l.visualVariables){const e=l.visualVariables.filter((e=>"color"===e.type));for(const l of e){const e=(await f(l)??[]).map((e=>e.color));await h(t,l.field||l.valueExpression,e)}}if("heatmap"===l.type){const e=d(l).map((e=>e.color));await h(t,l.field||l.valueExpression,e)}else if("pie-chart"===l.type){for(const e of l.attributes)await h(t,e.field||e.valueExpression,[e.color]);await h(t,"default",[l?.othersCategory?.color,u(l.backgroundFillSymbol,null)])}else if("dot-density"===l.type){for(const e of l.attributes)await h(t,e.field||e.valueExpression,[e.color]);await h(t,"default",[l.backgroundColor])}else if("unique-value"===l.type)if("predominance"===l.authoringInfo?.type)for(const e of l.uniqueValueInfos??[])await h(t,e.value.toString(),[u(e.symbol,null)]);else{const e=(l.uniqueValueInfos??[]).map((e=>u(e.symbol,null))),{field:i,field2:o,field3:a,valueExpression:n}=l;(i||n)&&await h(t,i||n,e),o&&await h(t,o,e),a&&await h(t,a,e)}else if("class-breaks"===l.type){const e=l.classBreakInfos.map((e=>u(e.symbol,null))),{field:i,valueExpression:o}=l;await h(t,i??o,e)}else"simple"===l.type&&await h(t,"default",[u(l.symbol,null)]);return"defaultSymbol"in l&&l.defaultSymbol&&await h(t,"default",[u(l.defaultSymbol,null)]),t.forEach(((l,i)=>{const o=e(l.filter(Boolean),((e,l)=>JSON.stringify(e)===JSON.stringify(l)));t.set(i,o)})),t}async function v(e,l,t){const o=i(e,l,(()=>new Map));for(const i of t)o.set(i.value,i.color)}async function w(e){const l=new Map;if(!e)return l;if("unique-value"!==e.type||e.authoringInfo?.type)if("class-breaks"===e.type){const t=e.classBreakInfos.map((e=>({value:e.minValue,color:u(e.symbol,null)}))).reverse(),{field:i,valueExpression:o}=e;await v(l,i??o,t)}else"simple"===e.type&&await v(l,"default",[{value:null,color:u(e.symbol,null)}]);else{const t=(e.uniqueValueInfos??[]).map((e=>({value:e.value,color:u(e.symbol,null)}))),{field:i,field2:o,field3:a,valueExpression:n,fieldDelimiter:s}=e,r=[i,o,a].filter(Boolean).join(s||"");(r||n)&&await v(l,r||n,t)}if("defaultSymbol"in e&&e.defaultSymbol&&await v(l,"default",[{value:null,color:u(e.defaultSymbol,null)}]),"visualVariables"in e&&e.visualVariables){const t=e.visualVariables.filter((e=>"color"===e.type));for(const e of t){const t=await f(e)??[];await v(l,e.field||e.valueExpression,t)}}return l}function V(e,l,t){let i="";return 0===l?i=m.lt+" ":l===t&&(i=m.gt+" "),i+e}function x(e){const{values:l,colors:t,labelIndexes:i,isDate:o,dateFormatOptions:s}=e;return l.map(((e,u)=>{let f=null;if(!i||i.includes(u)){let t;t=o?a(e,s):n(e),t&&(f=V(t,u,l.length-1))}return new r({value:e,color:t[u],label:f})}))}function E(e){let l=e.minValue,t=e.maxValue;const i=e.isFirstBreak?"":m.gt+" ",o="percent-of-total"===e.normalizationType?m.pct:"";return l=null==l?"":n(l),t=null==t?"":n(t),i+l+o+" "+m.ld+" "+t+o}function F(e){const l=e.classBreakInfos,t=e.normalizationType;let i=[];if(l&&l.length)if("standard-deviation"!==e.classificationMethod)if(e.round){i.push(l[0].minValue);for(const e of l)i.push(e.maxValue);i=s(i),l.forEach(((e,l)=>{e.label=E({minValue:0===l?i[0]:i[l],maxValue:i[l+1],isFirstBreak:0===l,normalizationType:t})}))}else l.forEach(((e,l)=>{e.label=E({minValue:e.minValue,maxValue:e.maxValue,isFirstBreak:0===l,normalizationType:t})}));else p.warn("setLabelsForClassBreaks","cannot set labels for class breaks generated using 'standard-deviation' method.")}function z(e){const l=e.map((e=>new Date(e))),t=l.length;let i=1/0,o=null;for(let a=0;a<t-1;a++){const e=l[a];let n=1/0,s=null;for(let i=a+1;i<t;i++){const t=l[i],o=(e.getFullYear()!==t.getFullYear()?"year":e.getMonth()!==t.getMonth()&&"month")||e.getDate()!==t.getDate()&&"day"||e.getHours()!==t.getHours()&&"hour"||e.getMinutes()!==t.getMinutes()&&"minute"||e.getSeconds()!==t.getSeconds()&&"second"||"millisecond",a=c[o];a<n&&(n=a,s=o)}n<i&&(i=n,o=s)}return o}function I(e){const{value:l,domain:t,fieldInfo:i,dateFormatInterval:s}=e;let r=String(l);const u=t&&"codedValues"in t&&t.codedValues?t.getName(l):null;return u?r=u:"number"==typeof l&&(r=i&&"date"===i.type?a(l,s&&o(y[s])):n(l)),r}function S(e,l){return"normalizationField"in e&&e.normalizationField?j(e.field,e.normalizationField):"field"in e&&e.field?k(e.field):"valueExpression"in e&&e.valueExpression?B(e.valueExpression,e.valueExpressionTitle,l):null}function k(e){return{type:"field",field:e}}function j(e,l){return{type:"normalized-field",field:e,normalizationField:l}}function B(e,l,t){return{type:"expression",expression:e,title:l,returnType:t}}function M(t,i){const o=[];if("class-breaks"===t.type||"heatmap"===t.type)o.push(S(t,"number"));else if("unique-value"===t.type){const e=t.authoringInfo;if(e&&"relationship"===e.type){if(e.field1&&e.field2){const l=e.field1.field,t=e.field2.field,i=e.field1.normalizationField,a=e.field2.normalizationField;o.push(S({field:l,normalizationField:i})),o.push(S({field:t,normalizationField:a}))}}else{const e=t.uniqueValueInfos?.[0];let l=null;if(e&&e.value){const e=typeof t.uniqueValueInfos[0].value;"string"!==e&&"number"!==e||(l=e)}o.push(S(t,l)),[t.field2,t.field3].forEach((e=>e&&o.push(k(e))))}}else"attributes"in t&&t.attributes?.forEach((e=>o.push(S(e,"number"))));const a=i?i(t):"visualVariables"in t?t.visualVariables:null;return a&&a.forEach((e=>o.push(S(e,"number")))),e(o.filter(l),((e,l)=>"field"===e.type&&"field"===l.type?e.field===l.field:"normalized-field"===e.type&&"normalized-field"===l.type?e.field===l.field&&e.normalizationField===l.normalizationField:"expression"===e.type&&"expression"===l.type&&e.expression===l.expression))}export{z as calculateDateFormatInterval,E as createClassBreakLabel,x as createColorStops,I as createUniqueValueLabel,S as getAttribute,M as getAttributes,w as getColorsForRendererValues,b as getColorsFromRenderer,F as setLabelsForClassBreaks,g as timelineDateFormatOptions};
5
+ import{unique as e,isSome as l}from"../../core/arrayUtils.js";import t from"../../core/Logger.js";import{getOrCreateMapValue as i}from"../../core/MapUtils.js";import{convertDateFormatToIntlOptions as o,formatDate as a}from"../../intl/date.js";import{format as n,round as s}from"./numberUtils.js";import r from"../visualVariables/support/ColorStop.js";import{getColorFromSymbol as u}from"../../symbols/support/utils.js";import{getRampStops as f}from"../../widgets/Legend/support/colorRampUtils.js";import{getHeatmapRampStops as d}from"../../widgets/Legend/support/heatmapRampUtils.js";const p=t.getLogger("esri.renderers.support.utils"),m={lte:"<=",gte:">=",lt:"<",gt:">",pct:"%",ld:"–"},c={millisecond:0,second:1,minute:2,hour:3,day:4,month:5,year:6},y={millisecond:"long-month-day-year-long-time",second:"long-month-day-year-long-time",minute:"long-month-day-year-short-time",hour:"long-month-day-year-short-time",day:"long-month-day-year",month:"long-month-day-year",year:"year"},g=o("short-date");async function h(e,l,t){i(e,l,(()=>[])).push(...t)}async function b(l){const t=new Map;if(!l)return t;if("visualVariables"in l&&l.visualVariables){const e=l.visualVariables.filter((e=>"color"===e.type));for(const l of e){const e=(await f(l)??[]).map((e=>e.color));await h(t,l.field||l.valueExpression,e)}}if("heatmap"===l.type){const e=d(l).map((e=>e.color));await h(t,l.field||l.valueExpression,e)}else if("pie-chart"===l.type){for(const e of l.attributes)await h(t,e.field||e.valueExpression,[e.color]);await h(t,"default",[l?.othersCategory?.color,u(l.backgroundFillSymbol,null)])}else if("dot-density"===l.type){for(const e of l.attributes)await h(t,e.field||e.valueExpression,[e.color]);await h(t,"default",[l.backgroundColor])}else if("unique-value"===l.type)if("predominance"===l.authoringInfo?.type)for(const e of l.uniqueValueInfos??[])await h(t,e.value.toString(),[u(e.symbol,null)]);else{const e=(l.uniqueValueInfos??[]).map((e=>u(e.symbol,null))),{field:i,field2:o,field3:a,valueExpression:n}=l;(i||n)&&await h(t,i||n,e),o&&await h(t,o,e),a&&await h(t,a,e)}else if("class-breaks"===l.type){const e=l.classBreakInfos.map((e=>u(e.symbol,null))),{field:i,valueExpression:o}=l;await h(t,i??o,e)}else"simple"===l.type&&await h(t,"default",[u(l.symbol,null)]);return"defaultSymbol"in l&&l.defaultSymbol&&await h(t,"default",[u(l.defaultSymbol,null)]),t.forEach(((l,i)=>{const o=e(l.filter(Boolean),((e,l)=>JSON.stringify(e)===JSON.stringify(l)));t.set(i,o)})),t}async function v(e,l,t){const o=i(e,l,(()=>new Map));for(const i of t)o.set(i.value,i.color)}async function w(e){const l=new Map;if(!e)return l;if("unique-value"!==e.type||e.authoringInfo?.type)if("class-breaks"===e.type){const t=e.classBreakInfos.map((e=>({value:e.minValue,color:u(e.symbol,null)}))).reverse(),{field:i,valueExpression:o}=e;await v(l,i??o,t)}else"simple"===e.type&&await v(l,"default",[{value:"default",color:u(e.symbol,null)}]);else{const t=(e.uniqueValueInfos??[]).map((e=>({value:e.value,color:u(e.symbol,null)}))),{field:i,field2:o,field3:a,valueExpression:n,fieldDelimiter:s}=e,r=[i,o,a].filter(Boolean).join(s||"");(r||n)&&await v(l,r||n,t)}if("defaultSymbol"in e&&e.defaultSymbol&&await v(l,"default",[{value:"default",color:u(e.defaultSymbol,null)}]),"visualVariables"in e&&e.visualVariables){const t=e.visualVariables.filter((e=>"color"===e.type));for(const e of t){const t=await f(e)??[];await v(l,e.field||e.valueExpression,t)}}return l}function V(e,l,t){let i="";return 0===l?i=m.lt+" ":l===t&&(i=m.gt+" "),i+e}function x(e){const{values:l,colors:t,labelIndexes:i,isDate:o,dateFormatOptions:s}=e;return l.map(((e,u)=>{let f=null;if(!i||i.includes(u)){let t;t=o?a(e,s):n(e),t&&(f=V(t,u,l.length-1))}return new r({value:e,color:t[u],label:f})}))}function E(e){let l=e.minValue,t=e.maxValue;const i=e.isFirstBreak?"":m.gt+" ",o="percent-of-total"===e.normalizationType?m.pct:"";return l=null==l?"":n(l),t=null==t?"":n(t),i+l+o+" "+m.ld+" "+t+o}function F(e){const l=e.classBreakInfos,t=e.normalizationType;let i=[];if(l&&l.length)if("standard-deviation"!==e.classificationMethod)if(e.round){i.push(l[0].minValue);for(const e of l)i.push(e.maxValue);i=s(i),l.forEach(((e,l)=>{e.label=E({minValue:0===l?i[0]:i[l],maxValue:i[l+1],isFirstBreak:0===l,normalizationType:t})}))}else l.forEach(((e,l)=>{e.label=E({minValue:e.minValue,maxValue:e.maxValue,isFirstBreak:0===l,normalizationType:t})}));else p.warn("setLabelsForClassBreaks","cannot set labels for class breaks generated using 'standard-deviation' method.")}function z(e){const l=e.map((e=>new Date(e))),t=l.length;let i=1/0,o=null;for(let a=0;a<t-1;a++){const e=l[a];let n=1/0,s=null;for(let i=a+1;i<t;i++){const t=l[i],o=(e.getFullYear()!==t.getFullYear()?"year":e.getMonth()!==t.getMonth()&&"month")||e.getDate()!==t.getDate()&&"day"||e.getHours()!==t.getHours()&&"hour"||e.getMinutes()!==t.getMinutes()&&"minute"||e.getSeconds()!==t.getSeconds()&&"second"||"millisecond",a=c[o];a<n&&(n=a,s=o)}n<i&&(i=n,o=s)}return o}function I(e){const{value:l,domain:t,fieldInfo:i,dateFormatInterval:s}=e;let r=String(l);const u=t&&"codedValues"in t&&t.codedValues?t.getName(l):null;return u?r=u:"number"==typeof l&&(r=i&&"date"===i.type?a(l,s&&o(y[s])):n(l)),r}function S(e,l){return"normalizationField"in e&&e.normalizationField?j(e.field,e.normalizationField):"field"in e&&e.field?k(e.field):"valueExpression"in e&&e.valueExpression?B(e.valueExpression,e.valueExpressionTitle,l):null}function k(e){return{type:"field",field:e}}function j(e,l){return{type:"normalized-field",field:e,normalizationField:l}}function B(e,l,t){return{type:"expression",expression:e,title:l,returnType:t}}function M(t,i){const o=[];if("class-breaks"===t.type||"heatmap"===t.type)o.push(S(t,"number"));else if("unique-value"===t.type){const e=t.authoringInfo;if(e&&"relationship"===e.type){if(e.field1&&e.field2){const l=e.field1.field,t=e.field2.field,i=e.field1.normalizationField,a=e.field2.normalizationField;o.push(S({field:l,normalizationField:i})),o.push(S({field:t,normalizationField:a}))}}else{const e=t.uniqueValueInfos?.[0];let l=null;if(e&&e.value){const e=typeof t.uniqueValueInfos[0].value;"string"!==e&&"number"!==e||(l=e)}o.push(S(t,l)),[t.field2,t.field3].forEach((e=>e&&o.push(k(e))))}}else"attributes"in t&&t.attributes?.forEach((e=>o.push(S(e,"number"))));const a=i?i(t):"visualVariables"in t?t.visualVariables:null;return a&&a.forEach((e=>o.push(S(e,"number")))),e(o.filter(l),((e,l)=>"field"===e.type&&"field"===l.type?e.field===l.field:"normalized-field"===e.type&&"normalized-field"===l.type?e.field===l.field&&e.normalizationField===l.normalizationField:"expression"===e.type&&"expression"===l.type&&e.expression===l.expression))}export{z as calculateDateFormatInterval,E as createClassBreakLabel,x as createColorStops,I as createUniqueValueLabel,S as getAttribute,M as getAttributes,w as getColorsForRendererValues,b as getColorsFromRenderer,F as setLabelsForClassBreaks,g as timelineDateFormatOptions};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../Graphic.js";import t from"../../core/Logger.js";import{getOrCreateMapValue as r}from"../../core/MapUtils.js";import{f as o}from"../../chunks/vec3f64.js";import n from"../../geometry/Extent.js";import s from"../../geometry/Mesh.js";import i from"../../geometry/Point.js";import a from"../../geometry/SpatialReference.js";import u from"../../geometry/support/MeshGeoreferencedRelativeVertexSpace.js";import c from"../../geometry/support/MeshLocalVertexSpace.js";import f from"../../geometry/support/MeshTransform.js";import{ServiceAssetPart as p,ServiceAsset as m}from"../../geometry/support/meshUtils/External.js";import{getFormatIdMimeType as l}from"../../layers/support/infoFor3D.js";import g from"./FeatureSet.js";function y(t,r,o){const n=o.features;o.features=[],delete o.geometryType;const s=g.fromJSON(o);if(s.geometryType="mesh",!o.assetMaps)return s;const i=M(r,o.assetMaps),u=t.sourceSpatialReference??a.WGS84,c=o.globalIdFieldName,{outFields:f}=t,p=null!=f&&f.length>0?E(f.includes("*")?null:new Set(f)):()=>({});for(const a of n){const t=h(a,c,u,r,i);null!=t&&s.features.push(new e({geometry:t,attributes:p(a)}))}return s}function E(e){return({attributes:t})=>{if(!t)return{};if(!e)return t;for(const r in t)e.has(r)||delete t[r];return t}}function h(e,t,r,o,i){const a=e.attributes[t],f=i.get(a);if(null==f)return null;const{originPoint:p,originVector:m}=S(e,r,o),l=n.fromJSON(e.geometry);l.spatialReference=r;const g=j(e.attributes,o),y=f.projectVertices?new u({origin:m}):new c({origin:m}),E=T(f);return E?s.createWithExternalSource(p,E,{extent:l,transform:g,vertexSpace:y}):s.createIncomplete(p,{extent:l,transform:g,vertexSpace:y})}function S({attributes:e},t,{transformFieldRoles:r}){const n=e[r.originX],s=e[r.originY],a=e[r.originZ];return{originPoint:new i({x:n,y:s,z:a,spatialReference:t}),originVector:o(n,s,a)}}function j(e,{transformFieldRoles:t}){return new f({translation:[e[t.translationX],-e[t.translationZ],e[t.translationY]],rotationAxis:[e[t.rotationX],e[t.rotationZ],e[t.rotationY]],rotationAngle:e[t.rotationDeg],scale:[e[t.scaleX],e[t.scaleY],e[t.scaleZ]]})}var d;function M(e,o){const n=new Map;for(const s of o){const o=s.parentGlobalId;if(null==o)continue;const i=s.assetName,a=s.assetType,u=s.assetHash,c=s.assetURL,f=s.conversionStatus,p=s.seqNo,m=l(a,e.supportedFormats);if(!m){t.getLogger("esri.rest.support.meshFeatureSet").error("mesh-feature-set:unknown-format",`Service returned an asset of type ${a}, but it does not list it as a supported type`);continue}const g=r(n,o,(()=>({projectVertices:D(s.flags).projectVertices,files:new Map})));r(g.files,i,(()=>({name:i,type:a,mimeType:m,status:w(f),parts:[]}))).parts[p]={hash:u,url:c}}return n}function T(e){const t=Array.from(e.files.values()),r=new Array;for(const o of t){if(o.status!==d.COMPLETED)return null;const e=new Array;for(const t of o.parts){if(!t)return null;e.push(new p(t.url,t.hash))}r.push(new m(o.name,o.mimeType,e))}return r}function w(e){switch(e){case"COMPLETED":case"SUBMITTED":return d.COMPLETED;case"INPROGRESS":return d.PENDING;default:return d.FAILED}}function D(e){return{projectVertices:e.includes("PROJECT_VERTICES")}}!function(e){e[e.FAILED=0]="FAILED",e[e.PENDING=1]="PENDING",e[e.COMPLETED=2]="COMPLETED"}(d||(d={}));export{M as assetMapFromAssetMapsJSON,h as extractMesh,y as meshFeatureSetFromJSON};
5
+ import e from"../../Graphic.js";import t from"../../core/Logger.js";import{getOrCreateMapValue as r}from"../../core/MapUtils.js";import{f as o}from"../../chunks/vec3f64.js";import n from"../../geometry/Extent.js";import s from"../../geometry/Mesh.js";import i from"../../geometry/Point.js";import a from"../../geometry/SpatialReference.js";import u from"../../geometry/support/MeshGeoreferencedRelativeVertexSpace.js";import c from"../../geometry/support/MeshLocalVertexSpace.js";import f from"../../geometry/support/MeshTransform.js";import{ServiceAssetPart as p,ServiceAsset as m}from"../../geometry/support/meshUtils/External.js";import{getFormatIdMimeType as l}from"../../layers/support/infoFor3D.js";import g from"./FeatureSet.js";function y(t,r,o){const n=o.features;o.features=[],delete o.geometryType;const s=g.fromJSON(o);if(s.geometryType="mesh",!o.assetMaps)return s;const i=M(r,o.assetMaps),u=t.sourceSpatialReference??a.WGS84,c=o.globalIdFieldName,{outFields:f}=t,p=null!=f&&f.length>0?E(f.includes("*")?null:new Set(f)):()=>({});for(const a of n){const t=h(a,c,u,r,i);null!=t&&s.features.push(new e({geometry:t,attributes:p(a)}))}return s}function E(e){return({attributes:t})=>{if(!t)return{};if(!e)return t;for(const r in t)e.has(r)||delete t[r];return t}}function h(e,t,r,o,i){const a=e.attributes[t],f=i.get(a);if(null==f||!e.geometry)return null;const{originPoint:p,originVector:m}=S(e,r,o),l=n.fromJSON(e.geometry);l.spatialReference=r;const g=j(e.attributes,o),y=f.projectVertices?new u({origin:m}):new c({origin:m}),E=T(f);return E?s.createWithExternalSource(p,E,{extent:l,transform:g,vertexSpace:y}):s.createIncomplete(p,{extent:l,transform:g,vertexSpace:y})}function S({attributes:e},t,{transformFieldRoles:r}){const n=e[r.originX],s=e[r.originY],a=e[r.originZ];return{originPoint:new i({x:n,y:s,z:a,spatialReference:t}),originVector:o(n,s,a)}}function j(e,{transformFieldRoles:t}){return new f({translation:[e[t.translationX],-e[t.translationZ],e[t.translationY]],rotationAxis:[e[t.rotationX],e[t.rotationZ],e[t.rotationY]],rotationAngle:e[t.rotationDeg],scale:[e[t.scaleX],e[t.scaleY],e[t.scaleZ]]})}var d;function M(e,o){const n=new Map;for(const s of o){const o=s.parentGlobalId;if(null==o)continue;const i=s.assetName,a=s.assetType,u=s.assetHash,c=s.assetURL,f=s.conversionStatus,p=s.seqNo,m=l(a,e.supportedFormats);if(!m){t.getLogger("esri.rest.support.meshFeatureSet").error("mesh-feature-set:unknown-format",`Service returned an asset of type ${a}, but it does not list it as a supported type`);continue}const g=r(n,o,(()=>({projectVertices:D(s.flags).projectVertices,files:new Map})));r(g.files,i,(()=>({name:i,type:a,mimeType:m,status:w(f),parts:[]}))).parts[p]={hash:u,url:c}}return n}function T(e){const t=Array.from(e.files.values()),r=new Array;for(const o of t){if(o.status!==d.COMPLETED)return null;const e=new Array;for(const t of o.parts){if(!t)return null;e.push(new p(t.url,t.hash))}r.push(new m(o.name,o.mimeType,e))}return r}function w(e){switch(e){case"COMPLETED":case"SUBMITTED":return d.COMPLETED;case"INPROGRESS":return d.PENDING;default:return d.FAILED}}function D(e){return{projectVertices:e.includes("PROJECT_VERTICES")}}!function(e){e[e.FAILED=0]="FAILED",e[e.PENDING=1]="PENDING",e[e.COMPLETED=2]="COMPLETED"}(d||(d={}));export{M as assetMapFromAssetMapsJSON,h as extractMesh,y as meshFeatureSetFromJSON};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../Color.js";import{isSome as r}from"../../core/arrayUtils.js";import{sequentialLightSchemes as o,sequentialDarkSchemes as t}from"./color.js";import a from"./support/colors.js";import{createThemes as n,getThemesforBasemap as i,getRawSchemes as m,filterSchemesByName as l,filterSchemesByTag as s}from"./support/symbologyUtils.js";const c={color:"#4c64c9",density:.8,layerEffect:"drop-shadow(1px, 1px, 3px, rgba(0,0,0,0.75))"},p={color:"#00ffff",density:.8,layerEffect:"bloom(1.4, 0.6px, 0)"},f={flowSpeed:10,trailLength:100,trailWidth:1,trailCap:"butt",minSize:1,maxSize:4},d={flowSpeed:3,trailLength:.7,trailWidth:8,trailCap:"butt",minSize:4,maxSize:16},h=n({themeDictionary:{"flow-line":{name:"flow-line",label:"TODO",description:"TODO",schemes:{default:{light:{common:{...f,...c},primary:"seq-lines-purple-brown",secondary:[...o,...t].filter((e=>"seq-lines-purple-brown"!==e))},dark:{common:{...f,...p},primary:"seq-mentone-beach",secondary:[...t,...o].filter((e=>"seq-mentone-beach"!==e))}}}},"wave-front":{name:"wave-front",label:"TODO",description:"TODO",schemes:{default:{light:{common:{...d,...c},primary:"seq-lines-purple-brown",secondary:[...o,...t].filter((e=>"seq-lines-purple-brown"!==e))},dark:{common:{...d,...p},primary:"seq-mentone-beach",secondary:[...t,...o].filter((e=>"seq-mentone-beach"!==e))}}}}}});function u(e){return i(h,e)}function y(e){const o=e.theme||"flow-line",t=m({basemap:e.basemap,basemapTheme:e.basemapTheme,theme:h.get(o)});if(!t)return;const{schemesInfo:a,basemapId:n,basemapTheme:i}=t,l=a.common;return{primaryScheme:S(e,a.primary,l),secondarySchemes:a.secondary.map((r=>S(e,r,l))).filter(r),basemapId:n,basemapTheme:i}}function b(e){return l(e.name,y(e))}function w(e){return s(e.includedTags,e.excludedTags,y(e))}function g(r){if(!r)return;const o={...r};return o.colors=o.colors.map((r=>new e(r))),o.tags=[...o.tags],o.color&&(o.color=new e(o.color)),o}function S(r,o,t){const n=r.theme||"flow-line",i=a[o];if(!i)return;const m=i.stops;return{id:`${n}/${r.basemap}/${o}`,name:i.name,tags:[...i.tags],theme:n,color:new e(t.color),colors:m.map((r=>new e(r))),density:t.density,flowSpeed:t.flowSpeed,trailLength:"wave-front"===n&&r.hasSizeVariable?2*t.trailLength:t.trailLength,trailWidth:t.trailWidth,trailCap:t.trailCap,layerEffect:t.layerEffect,minSize:t.minSize,maxSize:t.maxSize,minOpacity:.25,maxOpacity:1}}export{g as cloneScheme,b as getSchemeByName,y as getSchemes,w as getSchemesByTag,u as getThemes};
5
+ import e from"../../Color.js";import{isSome as r}from"../../core/arrayUtils.js";import{sequentialLightSchemes as o,sequentialDarkSchemes as t}from"./color.js";import a from"./support/colors.js";import{createThemes as n,getThemesforBasemap as i,getRawSchemes as m,filterSchemesByName as s,filterSchemesByTag as l}from"./support/symbologyUtils.js";const c={color:"#4c64c9",density:.8,layerEffect:"drop-shadow(1px, 1px, 3px, rgba(0,0,0,0.75))"},p={color:"#00ffff",density:.8,layerEffect:"bloom(1.4, 0.6px, 0)"},f={flowSpeed:10,trailLength:100,trailWidth:1,trailCap:"butt",minSize:1,maxSize:4},d={flowSpeed:3,trailLength:.7,trailWidth:8,trailCap:"butt",minSize:4,maxSize:16},h=n({themeDictionary:{"flow-line":{name:"flow-line",label:"TODO",description:"TODO",schemes:{default:{light:{common:{...f,...c},primary:"seq-lines-purple-brown",secondary:[...o,...t].filter((e=>"seq-lines-purple-brown"!==e))},dark:{common:{...f,...p},primary:"seq-mentone-beach",secondary:[...t,...o].filter((e=>"seq-mentone-beach"!==e))}}}},"wave-front":{name:"wave-front",label:"TODO",description:"TODO",schemes:{default:{light:{common:{...d,...c},primary:"seq-lines-purple-brown",secondary:[...o,...t].filter((e=>"seq-lines-purple-brown"!==e))},dark:{common:{...d,...p},primary:"seq-mentone-beach",secondary:[...t,...o].filter((e=>"seq-mentone-beach"!==e))}}}}}});function u(e){return i(h,e)}function b(e){const o=e.theme||"flow-line",t=m({basemap:e.basemap,basemapTheme:e.basemapTheme,theme:h.get(o)});if(!t)return;const{schemesInfo:a,basemapId:n,basemapTheme:i}=t,s=a.common,l={...e,basemap:n};return{primaryScheme:S(l,a.primary,s),secondarySchemes:a.secondary.map((e=>S(l,e,s))).filter(r),basemapId:n,basemapTheme:i}}function y(e){return s(e.name,b(e))}function w(e){return l(e.includedTags,e.excludedTags,b(e))}function g(r){if(!r)return;const o={...r};return o.colors=o.colors.map((r=>new e(r))),o.tags=[...o.tags],o.color&&(o.color=new e(o.color)),o}function S(r,o,t){const n=r.theme||"flow-line",i=a[o];if(!i)return;const m=i.stops;return{id:`${n}/${r.basemap}/${o}`,name:i.name,tags:[...i.tags],theme:n,color:new e(t.color),colors:m.map((r=>new e(r))),density:t.density,flowSpeed:t.flowSpeed,trailLength:"wave-front"===n&&r.hasSizeVariable?2*t.trailLength:t.trailLength,trailWidth:t.trailWidth,trailCap:t.trailCap,layerEffect:t.layerEffect,minSize:t.minSize,maxSize:t.maxSize,minOpacity:.25,maxOpacity:1}}export{g as cloneScheme,y as getSchemeByName,b as getSchemes,w as getSchemesByTag,u as getThemes};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import n from"../rest/support/ClassBreaksDefinition.js";import{createGenerateRendererClassBreaks as e}from"../rest/support/generateRendererUtils.js";const t="<Null>",l="equal-interval",i=1,a=5,r=10,o=/\s*(\+|-)?((\d+(\.\d+)?)|(\.\d+))\s*/gi,u=new Set(["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeSingle","esriFieldTypeDouble"]),s=["min","max","avg","stddev","count","sum","variance","nullcount","median"];function c(n){return null==n||"string"==typeof n&&!n?t:n}function m(n){const e=null!=n.normalizationField||null!=n.normalizationType,t=null!=n.minValue||null!=n.maxValue,l=!!n.sqlExpression&&n.supportsSQLExpression;return!e&&!t&&!l}function f(n){const e=n.returnDistinct?[...new Set(n.values)]:n.values,t=e.filter((n=>null!=n)).length,l={count:t};return n.supportsNullCount&&(l.nullcount=e.length-t),n.percentileParams&&(l.median=p(e,n.percentileParams)),l}function d(n){const{values:e,useSampleStdDev:t,supportsNullCount:l}=n;let i=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,r=null,o=null,u=null,s=null,c=0;const m=null==n.minValue?-1/0:n.minValue,f=null==n.maxValue?1/0:n.maxValue;for(const p of e)Number.isFinite(p)?p>=m&&p<=f&&(r=null===r?p:r+p,i=Math.min(i,p),a=Math.max(a,p),c++):"string"==typeof p&&c++;if(c&&null!=r){o=r/c;let n=0;for(const t of e)Number.isFinite(t)&&t>=m&&t<=f&&(n+=(t-o)**2);s=t?c>1?n/(c-1):0:c>0?n/c:0,u=Math.sqrt(s)}else i=null,a=null;const d={avg:o,count:c,max:a,min:i,stddev:u,sum:r,variance:s};return l&&(d.nullcount=e.length-c),n.percentileParams&&(d.median=p(e,n.percentileParams)),d}function p(n,e){const{fieldType:t,value:l,orderBy:i,isDiscrete:a}=e,r=v(t,"desc"===i);if(0===(n=[...n].filter((n=>null!=n)).sort(((n,e)=>r(n,e)))).length)return null;if(l<=0)return n[0];if(l>=1)return n[n.length-1];const o=(n.length-1)*l,u=Math.floor(o),s=u+1,c=o%1,m=n[u],f=n[s];return s>=n.length||a||"string"==typeof m||"string"==typeof f?m:m*(1-c)+f*c}function v(n,e){const t=e?1:-1,l=h(e),i=V(e);if(!(!!n&&["esriFieldTypeDate","esriFieldTypeString","esriFieldTypeGUID","esriFieldTypeGlobalID",...u].includes(n)))return(n,e)=>"number"==typeof n&&"number"==typeof e?l(n,e):"string"==typeof n&&"string"==typeof e?i(n,e):t;if("esriFieldTypeDate"===n)return(n,e)=>{const i=new Date(n).getTime(),a=new Date(e).getTime();return isNaN(i)||isNaN(a)?t:l(i,a)};if(u.has(n))return(n,e)=>l(n,e);if("esriFieldTypeString"===n)return(n,e)=>i(n,e);if("esriFieldTypeGUID"===n||"esriFieldTypeGlobalID"===n){const n=V(e);return(e,t)=>n(T(e),T(t))}return e?(n,e)=>1:(n,e)=>-1}function b(n,e,t){if(t){if(null==n)return null==e?0:1;if(null==e)return-1}else{if(null==n)return null==e?0:-1;if(null==e)return 1}return null}function V(n){return n?(n,e)=>{const t=b(n,e,!0);return null!=t?t:(n=n.toUpperCase())>(e=e.toUpperCase())?-1:n<e?1:0}:(n,e)=>{const t=b(n,e,!1);return null!=t?t:(n=n.toUpperCase())<(e=e.toUpperCase())?-1:n>e?1:0}}function h(n){return n?(n,e)=>{const t=b(n,e,!0);return null!=t?t:e-n}:(n,e)=>{const t=b(n,e,!1);return null!=t?t:n-e}}function T(n){return n.substr(24,12)+n.substr(19,4)+n.substr(16,2)+n.substr(14,2)+n.substr(11,2)+n.substr(9,2)+n.substr(6,2)+n.substr(4,2)+n.substr(2,2)+n.substr(0,2)}function g(n,e){let t;for(t in n)s.includes(t)&&(Number.isFinite(n[t])||(n[t]=null));return e?(["avg","stddev","variance"].forEach((e=>{null!=n[e]&&(n[e]=Math.ceil(n[e]??0))})),n):n}function y(n){const e={};for(let t of n)(null==t||"string"==typeof t&&""===t.trim())&&(t=null),null==e[t]?e[t]={count:1,data:t}:e[t].count++;return{count:e}}function x(n){return"coded-value"!==n?.type?[]:n.codedValues.map((n=>n.code))}function F(n,e,t,l){const i=n.count,a=[];if(t&&e){const n=[],t=x(e[0]);for(const i of t)if(e[1]){const t=x(e[1]);for(const a of t)if(e[2]){const t=x(e[2]);for(const e of t)n.push(`${c(i)}${l}${c(a)}${l}${c(e)}`)}else n.push(`${c(i)}${l}${c(a)}`)}else n.push(i);for(const e of n)i.hasOwnProperty(e)||(i[e]={data:e,count:0})}for(const r in i){const n=i[r];a.push({value:n.data,count:n.count,label:n.label})}return{uniqueValueInfos:a}}function z(n,e,t,l){let i=null;switch(e){case"log":0!==n&&(i=Math.log(n)*Math.LOG10E);break;case"percent-of-total":Number.isFinite(l)&&0!==l&&(i=n/l*100);break;case"field":Number.isFinite(t)&&0!==t&&(i=n/t);break;case"natural-log":n>0&&(i=Math.log(n));break;case"square-root":n>0&&(i=n**.5)}return i}function D(n,t){const l=N({field:t.field,normalizationType:t.normalizationType,normalizationField:t.normalizationField,classificationMethod:t.classificationMethod,standardDeviationInterval:t.standardDeviationInterval,breakCount:t.numClasses||a});return n=I(n,t.minValue,t.maxValue),e({definition:l,values:n,normalizationTotal:t.normalizationTotal})}function I(n,e,t){const l=e??-1/0,i=t??1/0;return n.filter((n=>Number.isFinite(n)&&n>=l&&n<=i))}function N(e){const{breakCount:t,field:a,normalizationField:r,normalizationType:o}=e,u=e.classificationMethod||l,s="standard-deviation"===u?e.standardDeviationInterval||i:void 0;return new n({breakCount:t,classificationField:a,classificationMethod:u,normalizationField:"field"===o?r:void 0,normalizationType:o,standardDeviationInterval:s})}function S(n,e){let t=n.classBreaks;const l=t.length,i=t[0]?.minValue,a=t[l-1]?.maxValue,r="standard-deviation"===e,u=o;return t=t.map((n=>{const e=n.label,t={minValue:n.minValue,maxValue:n.maxValue,label:e};if(r&&e){const n=e.match(u),l=n?.map((n=>+n.trim()))??[];2===l.length?(t.minStdDev=l[0],t.maxStdDev=l[1],l[0]<0&&l[1]>0&&(t.hasAvg=!0)):1===l.length&&(e.includes("<")?(t.minStdDev=null,t.maxStdDev=l[0]):e.includes(">")&&(t.minStdDev=l[0],t.maxStdDev=null))}return t})),{minValue:i,maxValue:a,classBreakInfos:t,normalizationTotal:n.normalizationTotal}}function M(n,e){const t=C(n,e);if(null==t.min&&null==t.max)return{bins:[],minValue:t.min,maxValue:t.max,normalizationTotal:e.normalizationTotal};const l=t.intervals,i=t.min??0,a=t.max??0,r=l.map(((n,e)=>({minValue:l[e][0],maxValue:l[e][1],count:0})));for(const o of n)if(null!=o&&o>=i&&o<=a){const n=k(l,o);n>-1&&r[n].count++}return{bins:r,minValue:i,maxValue:a,normalizationTotal:e.normalizationTotal}}function C(n,e){const{field:t,classificationMethod:l,standardDeviationInterval:i,normalizationType:a,normalizationField:o,normalizationTotal:u,minValue:s,maxValue:c}=e,f=e.numBins||r;let p=null,v=null,b=null;if((!l||"equal-interval"===l)&&!a){if(null!=s&&null!=c)p=s,v=c;else{const e=d({values:n,minValue:s,maxValue:c,useSampleStdDev:!a,supportsNullCount:m({normalizationType:a,normalizationField:o,minValue:s,maxValue:c})});p=e.min??null,v=e.max??null}b=$(p??0,v??0,f)}else{const{classBreaks:e}=D(n,{field:t,normalizationType:a,normalizationField:o,normalizationTotal:u,classificationMethod:l,standardDeviationInterval:i,minValue:s,maxValue:c,numClasses:f});p=e[0].minValue,v=e[e.length-1].maxValue,b=e.map((n=>[n.minValue,n.maxValue]))}return{min:p,max:v,intervals:b}}function k(n,e){let t=-1;for(let l=n.length-1;l>=0;l--){if(e>=n[l][0]){t=l;break}}return t}function $(n,e,t){const l=(e-n)/t,i=[];let a,r=n;for(let o=1;o<=t;o++)a=r+l,a=Number(a.toFixed(16)),i.push([r,o===t?e:a]),r=a;return i}export{D as calculateClassBreaks,M as calculateHistogram,p as calculatePercentile,d as calculateStatistics,f as calculateStringStatistics,y as calculateUniqueValuesCount,N as createClassBreaksDefinition,F as createUVResult,v as getAttributeComparator,$ as getEqualIntervalBins,z as getNormalizedValue,m as isNullCountSupported,c as processNullValue,g as processSummaryStatisticsResult,S as resolveCBResult,s as statisticTypes};
5
+ import n from"../rest/support/ClassBreaksDefinition.js";import{createGenerateRendererClassBreaks as e}from"../rest/support/generateRendererUtils.js";const t="<Null>",l="equal-interval",i=1,a=5,r=10,o=/\s*(\+|-)?((\d+(\.\d+)?)|(\.\d+))\s*/gi,u=new Set(["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeSingle","esriFieldTypeDouble"]),s=["min","max","avg","stddev","count","sum","variance","nullcount","median"];function c(n){return null==n||"string"==typeof n&&!n?t:n}function m(n){const e=null!=n.normalizationField||null!=n.normalizationType,t=null!=n.minValue||null!=n.maxValue,l=!!n.sqlExpression&&n.supportsSQLExpression;return!e&&!t&&!l}function f(n){const e=n.returnDistinct?[...new Set(n.values)]:n.values,t=e.filter((n=>null!=n)).sort(),l=t.length,i={count:l,min:t[0],max:t[l-1]};return n.supportsNullCount&&(i.nullcount=e.length-l),n.percentileParams&&(i.median=p(e,n.percentileParams)),i}function d(n){const{values:e,useSampleStdDev:t,supportsNullCount:l}=n;let i=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY,r=null,o=null,u=null,s=null,c=0;const m=null==n.minValue?-1/0:n.minValue,f=null==n.maxValue?1/0:n.maxValue;for(const p of e)Number.isFinite(p)?p>=m&&p<=f&&(r=null===r?p:r+p,i=Math.min(i,p),a=Math.max(a,p),c++):"string"==typeof p&&c++;if(c&&null!=r){o=r/c;let n=0;for(const t of e)Number.isFinite(t)&&t>=m&&t<=f&&(n+=(t-o)**2);s=t?c>1?n/(c-1):0:c>0?n/c:0,u=Math.sqrt(s)}else i=null,a=null;const d={avg:o,count:c,max:a,min:i,stddev:u,sum:r,variance:s};return l&&(d.nullcount=e.length-c),n.percentileParams&&(d.median=p(e,n.percentileParams)),d}function p(n,e){const{fieldType:t,value:l,orderBy:i,isDiscrete:a}=e,r=v(t,"desc"===i);if(0===(n=[...n].filter((n=>null!=n)).sort(((n,e)=>r(n,e)))).length)return null;if(l<=0)return n[0];if(l>=1)return n[n.length-1];const o=(n.length-1)*l,u=Math.floor(o),s=u+1,c=o%1,m=n[u],f=n[s];return s>=n.length||a||"string"==typeof m||"string"==typeof f?m:m*(1-c)+f*c}function v(n,e){const t=e?1:-1,l=h(e),i=V(e);if(!(!!n&&["esriFieldTypeDate","esriFieldTypeString","esriFieldTypeGUID","esriFieldTypeGlobalID",...u].includes(n)))return(n,e)=>"number"==typeof n&&"number"==typeof e?l(n,e):"string"==typeof n&&"string"==typeof e?i(n,e):t;if("esriFieldTypeDate"===n)return(n,e)=>{const i=new Date(n).getTime(),a=new Date(e).getTime();return isNaN(i)||isNaN(a)?t:l(i,a)};if(u.has(n))return(n,e)=>l(n,e);if("esriFieldTypeString"===n)return(n,e)=>i(n,e);if("esriFieldTypeGUID"===n||"esriFieldTypeGlobalID"===n){const n=V(e);return(e,t)=>n(T(e),T(t))}return e?(n,e)=>1:(n,e)=>-1}function b(n,e,t){if(t){if(null==n)return null==e?0:1;if(null==e)return-1}else{if(null==n)return null==e?0:-1;if(null==e)return 1}return null}function V(n){return n?(n,e)=>{const t=b(n,e,!0);return null!=t?t:(n=n.toUpperCase())>(e=e.toUpperCase())?-1:n<e?1:0}:(n,e)=>{const t=b(n,e,!1);return null!=t?t:(n=n.toUpperCase())<(e=e.toUpperCase())?-1:n>e?1:0}}function h(n){return n?(n,e)=>{const t=b(n,e,!0);return null!=t?t:e-n}:(n,e)=>{const t=b(n,e,!1);return null!=t?t:n-e}}function T(n){return n.substr(24,12)+n.substr(19,4)+n.substr(16,2)+n.substr(14,2)+n.substr(11,2)+n.substr(9,2)+n.substr(6,2)+n.substr(4,2)+n.substr(2,2)+n.substr(0,2)}function g(n,e){let t;for(t in n)s.includes(t)&&(Number.isFinite(n[t])||(n[t]=null));return e?(["avg","stddev","variance"].forEach((e=>{null!=n[e]&&(n[e]=Math.ceil(n[e]??0))})),n):n}function x(n){const e={};for(let t of n)(null==t||"string"==typeof t&&""===t.trim())&&(t=null),null==e[t]?e[t]={count:1,data:t}:e[t].count++;return{count:e}}function y(n){return"coded-value"!==n?.type?[]:n.codedValues.map((n=>n.code))}function F(n,e,t,l){const i=n.count,a=[];if(t&&e){const n=[],t=y(e[0]);for(const i of t)if(e[1]){const t=y(e[1]);for(const a of t)if(e[2]){const t=y(e[2]);for(const e of t)n.push(`${c(i)}${l}${c(a)}${l}${c(e)}`)}else n.push(`${c(i)}${l}${c(a)}`)}else n.push(i);for(const e of n)i.hasOwnProperty(e)||(i[e]={data:e,count:0})}for(const r in i){const n=i[r];a.push({value:n.data,count:n.count,label:n.label})}return{uniqueValueInfos:a}}function z(n,e,t,l){let i=null;switch(e){case"log":0!==n&&(i=Math.log(n)*Math.LOG10E);break;case"percent-of-total":Number.isFinite(l)&&0!==l&&(i=n/l*100);break;case"field":Number.isFinite(t)&&0!==t&&(i=n/t);break;case"natural-log":n>0&&(i=Math.log(n));break;case"square-root":n>0&&(i=n**.5)}return i}function D(n,t){const l=N({field:t.field,normalizationType:t.normalizationType,normalizationField:t.normalizationField,classificationMethod:t.classificationMethod,standardDeviationInterval:t.standardDeviationInterval,breakCount:t.numClasses||a});return n=I(n,t.minValue,t.maxValue),e({definition:l,values:n,normalizationTotal:t.normalizationTotal})}function I(n,e,t){const l=e??-1/0,i=t??1/0;return n.filter((n=>Number.isFinite(n)&&n>=l&&n<=i))}function N(e){const{breakCount:t,field:a,normalizationField:r,normalizationType:o}=e,u=e.classificationMethod||l,s="standard-deviation"===u?e.standardDeviationInterval||i:void 0;return new n({breakCount:t,classificationField:a,classificationMethod:u,normalizationField:"field"===o?r:void 0,normalizationType:o,standardDeviationInterval:s})}function S(n,e){let t=n.classBreaks;const l=t.length,i=t[0]?.minValue,a=t[l-1]?.maxValue,r="standard-deviation"===e,u=o;return t=t.map((n=>{const e=n.label,t={minValue:n.minValue,maxValue:n.maxValue,label:e};if(r&&e){const n=e.match(u),l=n?.map((n=>+n.trim()))??[];2===l.length?(t.minStdDev=l[0],t.maxStdDev=l[1],l[0]<0&&l[1]>0&&(t.hasAvg=!0)):1===l.length&&(e.includes("<")?(t.minStdDev=null,t.maxStdDev=l[0]):e.includes(">")&&(t.minStdDev=l[0],t.maxStdDev=null))}return t})),{minValue:i,maxValue:a,classBreakInfos:t,normalizationTotal:n.normalizationTotal}}function M(n,e){const t=C(n,e);if(null==t.min&&null==t.max)return{bins:[],minValue:t.min,maxValue:t.max,normalizationTotal:e.normalizationTotal};const l=t.intervals,i=t.min??0,a=t.max??0,r=l.map(((n,e)=>({minValue:l[e][0],maxValue:l[e][1],count:0})));for(const o of n)if(null!=o&&o>=i&&o<=a){const n=k(l,o);n>-1&&r[n].count++}return{bins:r,minValue:i,maxValue:a,normalizationTotal:e.normalizationTotal}}function C(n,e){const{field:t,classificationMethod:l,standardDeviationInterval:i,normalizationType:a,normalizationField:o,normalizationTotal:u,minValue:s,maxValue:c}=e,f=e.numBins||r;let p=null,v=null,b=null;if((!l||"equal-interval"===l)&&!a){if(null!=s&&null!=c)p=s,v=c;else{const e=d({values:n,minValue:s,maxValue:c,useSampleStdDev:!a,supportsNullCount:m({normalizationType:a,normalizationField:o,minValue:s,maxValue:c})});p=e.min??null,v=e.max??null}b=$(p??0,v??0,f)}else{const{classBreaks:e}=D(n,{field:t,normalizationType:a,normalizationField:o,normalizationTotal:u,classificationMethod:l,standardDeviationInterval:i,minValue:s,maxValue:c,numClasses:f});p=e[0].minValue,v=e[e.length-1].maxValue,b=e.map((n=>[n.minValue,n.maxValue]))}return{min:p,max:v,intervals:b}}function k(n,e){let t=-1;for(let l=n.length-1;l>=0;l--){if(e>=n[l][0]){t=l;break}}return t}function $(n,e,t){const l=(e-n)/t,i=[];let a,r=n;for(let o=1;o<=t;o++)a=r+l,a=Number(a.toFixed(16)),i.push([r,o===t?e:a]),r=a;return i}export{D as calculateClassBreaks,M as calculateHistogram,p as calculatePercentile,d as calculateStatistics,f as calculateStringStatistics,x as calculateUniqueValuesCount,N as createClassBreaksDefinition,F as createUVResult,v as getAttributeComparator,$ as getEqualIntervalBins,z as getNormalizedValue,m as isNullCountSupported,c as processNullValue,g as processSummaryStatisticsResult,S as resolveCBResult,s as statisticTypes};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import"../geometry.js";import{p as e,c as r,e as n,a as t,r as o,l as s,b as i,d as a,f as u,s as l,g as c}from"../chunks/arcade.js";export{h as arcade}from"../chunks/arcade.js";import f from"../arcade/Dictionary.js";import p from"../arcade/Feature.js";import{m,o as y,k as d,c as v,a as g,b as x,p as j,r as w,q as b}from"../chunks/languageUtils.js";import{clone as E}from"../core/lang.js";import{isSizeVariable as F}from"../renderers/visualVariables/support/sizeVariableUtils.js";import S from"../geometry/Point.js";import $ from"../geometry/Polygon.js";import R from"../geometry/Polyline.js";import k from"../geometry/Multipoint.js";import z from"../geometry/Extent.js";const C=/^\$(feature|aggregatedFeatures)\./i,M={vars:{$feature:"any",$view:"any"},spatialReference:null};function P(e){return e.replaceAll(/[|\\{}()[\]^$+*?.]/g,"\\$&")}function A(e){return null==e?null:m(e)||y(e)?"array":d(e)?"date":v(e)?"text":g(e)?"boolean":x(e)?"number":e instanceof f?"dictionary":j(e)?"feature":e instanceof S?"point":e instanceof $?"polygon":e instanceof R?"polyline":e instanceof k?"multipoint":e instanceof z?"extent":w(e)?"featureSet":b(e)?"featureSetCollection":null}function I(r){if(!r)return null;try{return e(r)}catch(n){}return null}function G(e,n){const t="string"==typeof e?I(e):e;if(!t)return null;try{return n=n||E(M),r(t,n)}catch(o){}return null}function V(e,r){return{vars:{$feature:null==e?new p:p.createFromGraphic(e,null),$view:r&&r.view},spatialReference:r&&r.sr}}function q(e,r,n){return p.createFromGraphicLikeObject(r,e,n,null)}function L(e,r){null!=e.vars&&(e.vars.$feature=r)}function T(e,r){let t;try{t=n(e,r)}catch(o){t=null}return t}function U(e,r){let n;try{n=e?e(r):null}catch(t){n=null}return n}function D(e,r){try{return e?e(r):Promise.resolve(null)}catch(n){return Promise.resolve(null)}}function J(e,r){if(!e)return[];const n="string"==typeof e?I(e):e;if(!n)return[];const o=t(n);let s=new Array;o.forEach((e=>{C.test(e)&&(e=e.replace(C,""),s.push(e))}));const i=s.filter((e=>e.includes("*")));return s=s.filter((e=>!i.includes(e))),r&&i.forEach((e=>{const n=new RegExp(`^${e.split(/\*+/).map(P).join(".*")}$`,"i");r.forEach((e=>n.test(e)?s.push(e):null))})),[...new Set(s.sort())]}function O(e){return o(e,"$view")}function B(e,r){return!!e&&o(e,r)}function H(e){if(!e||null==e.spatialReference&&(null==e.scale||null==e.viewingMode))return;return{view:e.viewingMode&&null!=e.scale?new f({viewingMode:e.viewingMode,scale:e.scale}):null,sr:e.spatialReference}}function K({url:e,spatialReference:r,lrucache:n,interceptor:t}){const o=u();return o?o.createFeatureSetCollectionFromService(e,r,n,t):null}function N({layer:e,spatialReference:r,outFields:n,returnGeometry:t,lrucache:o,interceptor:s}){if(null===e)return null;const i=u();return i?i.constructFeatureSet(e,r,n,t??!0,o,s):null}function Q(e){if(null===e?.map)return null;const r=u();return r?r.createFeatureSetCollectionFromMap(e.map,e.spatialReference,e.lrucache,e.interceptor):null}function W(e,r){return f.convertJsonToArcade(e,r)}function X(e,r,n=[]){return s(e,r,n)}function Y(){return i()}function Z(){return a()}function _(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type||"dot-density"===e.type||"dictionary"===e.type||"pie-chart"===e.type}function ee(e){return"esri.layers.support.LabelClass"===e.declaredClass}function re(e){return"esri.PopupTemplate"===e.declaredClass}function ne(e,r){if(!e)return!1;if("string"==typeof e)return r(e);const n=e;if(_(n)){if("dot-density"===n.type){const e=n.attributes?.some((e=>r(e.valueExpression)));if(e)return e}const e=n.visualVariables,t=!!e&&e.some((e=>{let n=r(e.valueExpression);return"size"===e.type&&(F(e.minSize)&&(n=n||r(e.minSize.valueExpression)),F(e.maxSize)&&(n=n||r(e.maxSize.valueExpression))),n}));return!(!("valueExpression"in n)||!r(n.valueExpression))||t}if(ee(n)){const e=n.labelExpressionInfo&&n.labelExpressionInfo.expression;return!(!e||!r(e))||!1}return!!re(n)&&(!!n.expressionInfos&&n.expressionInfos.some((e=>r(e.expression)))||Array.isArray(n.content)&&n.content.some((e=>"expression"===e.type&&r(e.expressionInfo?.expression))))}function te(e){const r=I(e);return!!r&&l(r)}function oe(e){return ne(e,te)}function se(e){const r=I(e);return!!r&&c(r)}function ie(e){return ne(e,se)}export{f as Dictionary,p as arcadeFeature,N as convertFeatureLayerToFeatureSet,W as convertJsonToArcade,Q as convertMapToFeatureSetCollection,K as convertServiceUrlToWorkspace,V as createExecContext,q as createFeature,G as createFunction,I as createSyntaxTree,O as dependsOnView,Z as enableFeatureSetOperations,Y as enableGeometryOperations,T as evalSyntaxTree,D as executeAsyncFunction,U as executeFunction,J as extractFieldNames,A as getArcadeType,H as getViewInfo,oe as hasGeometryFunctions,ie as hasGeometryOperations,B as hasVariable,X as loadScriptDependencies,L as updateExecContext};
5
+ import"../geometry.js";import{p as e,c as r,e as n,a as t,r as o,l as s,b as i,d as a,f as u,s as l,g as c}from"../chunks/arcade.js";export{h as arcade}from"../chunks/arcade.js";import f from"../arcade/Dictionary.js";import p from"../arcade/Feature.js";import{m,o as y,k as d,c as v,a as g,b as x,p as j,r as w,q as b}from"../chunks/languageUtils.js";import{clone as E}from"../core/lang.js";import S from"../geometry/Point.js";import F from"../geometry/Polygon.js";import $ from"../geometry/Polyline.js";import R from"../geometry/Multipoint.js";import C from"../geometry/Extent.js";const k=/^\$(feature|aggregatedFeatures)\./i,z={vars:{$feature:"any",$view:"any"},spatialReference:null};function M(e){return e.replaceAll(/[|\\{}()[\]^$+*?.]/g,"\\$&")}function P(e){return null==e?null:m(e)||y(e)?"array":d(e)?"date":v(e)?"text":g(e)?"boolean":x(e)?"number":e instanceof f?"dictionary":j(e)?"feature":e instanceof S?"point":e instanceof F?"polygon":e instanceof $?"polyline":e instanceof R?"multipoint":e instanceof C?"extent":w(e)?"featureSet":b(e)?"featureSetCollection":null}function A(r){if(!r)return null;try{return e(r)}catch(n){}return null}function I(e,n){const t="string"==typeof e?A(e):e;if(!t)return null;try{return n=n||E(z),r(t,n)}catch(o){}return null}function G(e,r){return{vars:{$feature:null==e?new p:p.createFromGraphic(e,null),$view:r&&r.view},spatialReference:r&&r.sr}}function V(e,r,n){return p.createFromGraphicLikeObject(r,e,n,null)}function q(e,r){null!=e.vars&&(e.vars.$feature=r)}function L(e,r){let t;try{t=n(e,r)}catch(o){t=null}return t}function T(e,r){let n;try{n=e?e(r):null}catch(t){n=null}return n}function D(e,r){try{return e?e(r):Promise.resolve(null)}catch(n){return Promise.resolve(null)}}function J(e,r){if(!e)return[];const n="string"==typeof e?A(e):e;if(!n)return[];const o=t(n);let s=new Array;o.forEach((e=>{k.test(e)&&(e=e.replace(k,""),s.push(e))}));const i=s.filter((e=>e.includes("*")));return s=s.filter((e=>!i.includes(e))),r&&i.forEach((e=>{const n=new RegExp(`^${e.split(/\*+/).map(M).join(".*")}$`,"i");r.forEach((e=>n.test(e)?s.push(e):null))})),[...new Set(s.sort())]}function O(e){return o(e,"$view")}function U(e,r){return!!e&&o(e,r)}function B(e){if(!e||null==e.spatialReference&&(null==e.scale||null==e.viewingMode))return;return{view:e.viewingMode&&null!=e.scale?new f({viewingMode:e.viewingMode,scale:e.scale}):null,sr:e.spatialReference}}function H({url:e,spatialReference:r,lrucache:n,interceptor:t}){const o=u();return o?o.createFeatureSetCollectionFromService(e,r,n,t):null}function K({layer:e,spatialReference:r,outFields:n,returnGeometry:t,lrucache:o,interceptor:s}){if(null===e)return null;const i=u();return i?i.constructFeatureSet(e,r,n,t??!0,o,s):null}function N(e){if(null===e?.map)return null;const r=u();return r?r.createFeatureSetCollectionFromMap(e.map,e.spatialReference,e.lrucache,e.interceptor):null}function Q(e,r){return f.convertJsonToArcade(e,r)}function W(e,r,n=[]){return s(e,r,n)}function X(){return i()}function Y(){return a()}function Z(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type||"dot-density"===e.type||"dictionary"===e.type||"pie-chart"===e.type}function _(e){return"esri.layers.support.LabelClass"===e.declaredClass}function ee(e){return"esri.PopupTemplate"===e.declaredClass}function re(e,r){if(!e)return!1;if("string"==typeof e)return r(e);const n=e;if(Z(n)){if("dot-density"===n.type){const e=n.attributes?.some((e=>r(e.valueExpression)));if(e)return e}const e=n.visualVariables,t=!!e&&e.some((e=>{let n=r(e.valueExpression);return"size"===e.type&&(ie(e.minSize)&&(n=n||r(e.minSize.valueExpression)),ie(e.maxSize)&&(n=n||r(e.maxSize.valueExpression))),n}));return!(!("valueExpression"in n)||!r(n.valueExpression))||t}if(_(n)){const e=n.labelExpressionInfo&&n.labelExpressionInfo.expression;return!(!e||!r(e))||!1}return!!ee(n)&&(!!n.expressionInfos&&n.expressionInfos.some((e=>r(e.expression)))||Array.isArray(n.content)&&n.content.some((e=>"expression"===e.type&&r(e.expressionInfo?.expression))))}function ne(e){const r=A(e);return!!r&&l(r)}function te(e){return re(e,ne)}function oe(e){const r=A(e);return!!r&&c(r)}function se(e){return re(e,oe)}function ie(e){return e&&"esri.renderers.visualVariables.SizeVariable"===e.declaredClass}export{f as Dictionary,p as arcadeFeature,K as convertFeatureLayerToFeatureSet,Q as convertJsonToArcade,N as convertMapToFeatureSetCollection,H as convertServiceUrlToWorkspace,G as createExecContext,V as createFeature,I as createFunction,A as createSyntaxTree,O as dependsOnView,Y as enableFeatureSetOperations,X as enableGeometryOperations,L as evalSyntaxTree,D as executeAsyncFunction,T as executeFunction,J as extractFieldNames,P as getArcadeType,B as getViewInfo,te as hasGeometryFunctions,se as hasGeometryOperations,U as hasVariable,W as loadScriptDependencies,q as updateExecContext};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- const c="20230530",e="a0f411b737b032456ef1be75e402f2c32571dcc4";export{c as buildDate,e as commitHash};
5
+ const d="20230602",b="b746839026244a4bbd04222d89c103d654a48fd5";export{d as buildDate,b as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../Color.js";import"../../symbols.js";import{bidiText as t}from"../../core/BidiText.js";import{getFontFamily as r}from"../../core/fontUtils.js";import{clone as o}from"../../core/lang.js";import a from"../../core/Logger.js";import i from"../../core/RandomLCG.js";import{pt2px as s,px2pt as n}from"../../core/screenUtils.js";import{create as l,expandPointInPlace as c}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as m}from"../../geometry/support/boundsUtils.js";import{createRendererExpression as f}from"../../support/arcadeOnDemand.js";import{Placement as y}from"./CIMPlacements.js";import{DEFAULT_TEXT_HEIGHT as u,horizontalAlignment2HAlign as h,verticalAlignment2VAlign as p,EnvDrawHelper as M,Transformation as d,CanvasDrawHelper as S,DEFAULT_HATCH_FILL_SEPARATION as b,lineGapType2LineHeight as g}from"./CIMSymbolDrawHelper.js";import{LineCapStyle as C,LineJoinStyle as I,BlockProgression as k,FontEffects as x,FontEncoding as w,FontType as P,GlyphHinting as L,TextReadingDirection as v,VerticalGlyphOrientation as F,BillBoardMode as D,TextureFilter as T,ExtremityPlacement as G}from"./enums.js";import{getValue as z,fromCIMFontStyle as E,fromCIMFontDecoration as O,isCIMMarkerStrokePlacement as A,attributesToFields as N,analyzeTextParts as R,assignTextValuesFromFeature as j,isGeometryEngineRequired as V,importGeometryEngine as B}from"./utils.js";import X from"../../views/2d/arcade/callExpressionWithFeature.js";import{C_INFINITY as _}from"../../views/2d/engine/vectorTiles/GeometryUtils.js";import{GLYPH_SIZE as H,MAGIC_LABEL_LINE_HEIGHT as Y,RANDOM_INSIDE_POLYGON_TEXTURE_SIZE as U}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as $}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";import q from"../Font.js";const W=Math.PI,J=W/2,K=Math.PI/180,Q=96/72,Z=4,ee=a.getLogger("esri.symbols.cim.CIMSymbolHelper");function te(e){if(!e||!e.type)return null;let t;switch(e.type){case"cim":return e.data;case"web-style":return e;case"simple-marker":{const r=ne.fromSimpleMarker(e);if(!r)return null;t=r;break}case"picture-marker":t=ne.fromPictureMarker(e);break;case"simple-line":t=ne.fromSimpleLineSymbol(e);break;case"simple-fill":t=ne.fromSimpleFillSymbol(e);break;case"picture-fill":t=ne.fromPictureFillSymbol(e);break;case"text":t=ne.fromTextSymbol(e)}return{type:"CIMSymbolReference",symbol:t}}function re(e,t,r){switch(t.type){case"CIMSymbolReference":return re(e,t.symbol,r);case"CIMPointSymbol":null==r&&(r={x:0,y:0}),e.drawSymbol(t,r);break;case"CIMLineSymbol":null==r&&(r={paths:[[[0,0],[10,0]]]}),e.drawSymbol(t,r);break;case"CIMPolygonSymbol":null==r&&(r={rings:[[[0,0],[0,10],[10,10],[10,0],[0,0]]]}),e.drawSymbol(t,r);break;case"CIMTextSymbol":{const r={x:0,y:0};e.drawSymbol(t,r);break}case"CIMVectorMarker":{const r=new y;e.drawMarker(t,r);break}}return e.envelope()}function oe(e){if(!e)return 0;switch(e.type){case"CIMMarkerPlacementAlongLineSameSize":case"CIMMarkerPlacementAlongLineRandomSize":case"CIMMarkerPlacementAtExtremities":case"CIMMarkerPlacementAtMeasuredUnits":case"CIMMarkerPlacementAtRatioPositions":case"CIMMarkerPlacementOnLine":case"CIMMarkerPlacementOnVertices":return Math.abs(e.offset);default:return 0}}function ae(e){if(!e)return 0;switch(e.type){case"CIMGeometricEffectArrow":return Math.abs(.5*e.width);case"CIMGeometricEffectBuffer":return Math.abs(e.size);case"CIMGeometricEffectExtension":case"CIMGeometricEffectRadial":return Math.abs(e.length);case"CIMGeometricEffectJog":return Math.abs(.5*e.length);case"CIMGeometricEffectMove":return Math.max(Math.abs(z(e.offsetX)),Math.abs(z(e.offsetY)));case"CIMGeometricEffectOffset":case"CIMGeometricEffectOffsetTangent":return Math.abs(e.offset);case"CIMGeometricEffectRegularPolygon":return Math.abs(e.radius);case"CIMGeometricEffectRotate":case"CIMGeometricEffectScale":default:return 0;case"CIMGeometricEffectTaperedPolygon":return.5*Math.max(Math.abs(e.fromWidth),Math.abs(e.toWidth));case"CIMGeometricEffectWave":return Math.abs(e.amplitude);case"CIMGeometricEffectDonut":return e.width}}function ie(e){if(!e)return 0;let t=0;for(const r of e)t+=ae(r);return t}class se{getSymbolInflateSize(e,t,r,o,a){return e||(e=[0,0,0,0]),t?this._getInflateSize(e,t,r,o,a):e}static safeSize(e){const t=Math.max(Math.abs(e[0]),Math.abs(e[2])),r=Math.max(Math.abs(e[1]),Math.abs(e[3]));return Math.sqrt(t*t+r*r)}_vectorMarkerBounds(e,t,r,o){let a=!0;const i=l();if(t&&t.markerGraphics)for(const s of t.markerGraphics){const t=[0,0,0,0];s.geometry&&(m(i,s.geometry),t[0]=0,t[1]=0,t[2]=0,t[3]=0,this.getSymbolInflateSize(t,s.symbol,r,0,o),i[0]+=t[0],i[1]+=t[1],i[2]+=t[2],i[3]+=t[3],a?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],a=!1):(e[0]=Math.min(e[0],i[0]),e[1]=Math.min(e[1],i[1]),e[2]=Math.max(e[2],i[2]),e[3]=Math.max(e[3],i[3])))}return e}_getInflateSize(e,t,r,o,a){if(Se(t)){const i=this._getLayersInflateSize(e,t.symbolLayers,r,o,a),s=ie(t.effects);return s>0&&(i[0]-=s,i[1]-=s,i[2]+=s,i[3]+=s),i}return this._getTextInflatedSize(e,t,a)}_getLayersInflateSize(e,t,r,o,a){let i=!0;if(!t)return e;for(const s of t){if(!s)continue;let t=[0,0,0,0];switch(s.type){case"CIMSolidFill":case"CIMPictureFill":case"CIMHatchFill":case"CIMGradientFill":break;case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const e=s;let r=e.width;null!=r&&(e.capStyle===C.Square||e.joinStyle===I.Miter?r/=1.4142135623730951:r/=2,t[0]=-r,t[1]=-r,t[2]=r,t[3]=r);break}case"CIMCharacterMarker":case"CIMVectorMarker":case"CIMPictureMarker":{const e=s;if("CIMVectorMarker"===s.type){const e=s;if(t=this._vectorMarkerBounds(t,e,r,a),e.frame){const r=(e.frame.xmin+e.frame.xmax)/2,o=(e.frame.ymin+e.frame.ymax)/2;if(t[0]-=r,t[1]-=o,t[2]-=r,t[3]-=o,null!=e.size){const r=e.size/(e.frame.ymax-e.frame.ymin);t[0]*=r,t[1]*=r,t[2]*=r,t[3]*=r}}}else if("CIMPictureMarker"===s.type){const o=s,a=r.getResource(o.url);let i=1;if(null!=a&&a.height&&(i=a.width/a.height),null!=e.size){const r=e.size/2,a=e.size*i*o.scaleX/2;t=[-a,-r,a,r]}}else if(null!=e.size){const r=e.size/2;t=[-r,-r,r,r]}if(e.anchorPoint){let r,o;"Absolute"===e.anchorPointUnits?(r=e.anchorPoint.x,o=e.anchorPoint.y):(r=e.anchorPoint.x*(t[2]-t[0]),o=e.anchorPoint.y*(t[3]-t[1])),t[0]-=r,t[1]-=o,t[2]-=r,t[3]-=o}let i=z(e.rotation);if(e.rotateClockwise&&(i=-i),o&&(i-=o),i){const e=K*i,r=Math.cos(e),o=Math.sin(e),a=l([_,_,-_,-_]);c(a,[t[0]*r-t[1]*o,t[0]*o+t[1]*r]),c(a,[t[0]*r-t[3]*o,t[0]*o+t[3]*r]),c(a,[t[2]*r-t[1]*o,t[2]*o+t[1]*r]),c(a,[t[2]*r-t[3]*o,t[2]*o+t[3]*r]),t=a}let n=z(e.offsetX),m=z(e.offsetY);if(o){const e=K*o,t=Math.cos(e),r=Math.sin(e),a=n*r+m*t;n=n*t-m*r,m=a}t[0]+=n,t[1]+=m,t[2]+=n,t[3]+=m;const f=oe(e.markerPlacement);f>0&&(t[0]-=f,t[1]-=f,t[2]+=f,t[3]+=f);break}}const n=ie(s.effects);n>0&&(t[0]-=n,t[1]-=n,t[2]+=n,t[3]+=n),i?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],i=!1):(e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[2]),e[3]=Math.max(e[3],t[3]))}return e}_getTextInflatedSize(e,r,o){const a=r.height??u;if(e[0]=-a/2,e[1]=-a/2,e[2]=a/2,e[3]=a/2,!o)return e;const i=o.get(r);if(!i)return e;const{text:s,mosaicItem:n}=i;if(!n?.glyphMosaicItems?.length)return e;const{lineGapType:l,lineGap:c}=r,m=l?g(l,c??0,a):0,f=t(s)[1],y=n.glyphMosaicItems,M="CIMBackgroundCallout"===r.callout?.type,d=$(y,f,{scale:a/H,angle:z(r.angle),xOffset:z(r.offsetX),yOffset:z(r.offsetY),hAlign:h(r.horizontalAlignment),vAlign:p(r.verticalAlignment),maxLineWidth:512,lineHeight:Y*Math.max(.25,Math.min(m||1,4)),decoration:r.font.decoration||"none",isCIM:!0,hasBackground:M}).boundsT;return e[0]=d.x-d.halfWidth,e[1]=-d.y-d.halfHeight,e[2]=d.x+d.halfWidth,e[3]=-d.y+d.halfHeight,e}}class ne{static getEnvelope(e,t,r){if(!e)return null;const o=new M(r);if(Array.isArray(e)){let r;for(const a of e)r?r.union(re(o,a,t)):r=re(o,a,t);return r}return re(o,e,t)}static getTextureAnchor(e,t){const r=this.getEnvelope(e,null,t);if(!r)return[0,0,0];const o=(r.x+.5*r.width)*Q,a=(r.y+.5*r.height)*Q,i=r.width*Q+2,s=r.height*Q+2;return[-o/i,-a/s,s]}static rasterize(e,t,r,o,a=!0){const i=r||this.getEnvelope(t,null,o);if(!i)return[null,0,0,0,0];const s=(i.x+.5*i.width)*Q,n=(i.y+.5*i.height)*Q;e.width=i.width*Q,e.height=i.height*Q,r||(e.width+=2,e.height+=2);const l=e.getContext("2d"),c=d.createScale(Q,-Q);c.translate(.5*e.width-s,.5*e.height+n);const m=new S(l,o,c);switch(t.type){case"CIMPointSymbol":{const e={type:"point",x:0,y:0};m.drawSymbol(t,e);break}case"CIMVectorMarker":{const e=new y;m.drawMarker(t,e);break}}const f=l.getImageData(0,0,e.width,e.height),u=new Uint8Array(f.data);if(a){let e;for(let t=0;t<u.length;t+=4)e=u[t+3]/255,u[t]=u[t]*e,u[t+1]=u[t+1]*e,u[t+2]=u[t+2]*e}return[u,e.width,e.height,-s/e.width,-n/e.height]}static fromTextSymbol(e){const{angle:r,color:o,font:a,haloColor:i,haloSize:s,horizontalAlignment:n,kerning:l,text:c,verticalAlignment:m,xoffset:f,yoffset:y,backgroundColor:u,borderLineColor:h,borderLineSize:p}=e;let M,d,S,b,g,C;a&&(M=a.family,d=a.style,S=a.weight,b=a.size,g=a.decoration);let I=!1;if(c){I=t(c)[1]}return(u||p)&&(C={type:"CIMBackgroundCallout",margin:null,backgroundSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",color:ue(u)},{type:"CIMSolidStroke",color:ue(h),width:p}]},accentBarSymbol:null,gap:null,leaderLineSymbol:null,lineStyle:null}),{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,anchorPointUnits:"Relative",dominantSizeAxis3D:"Y",size:10,billboardMode3D:"FaceNearPlane",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",angle:r,blockProgression:k.BTT,depth3D:1,extrapolateBaselines:!0,fontEffects:x.Normal,fontEncoding:w.Unicode,fontFamilyName:M||"Arial",fontStyleName:he(d,S),fontType:P.Unspecified,haloSize:s,height:b,hinting:L.Default,horizontalAlignment:fe(n??"center"),kerning:l,letterWidth:100,ligatures:!0,lineGapType:"Multiple",offsetX:z(f),offsetY:z(y),strikethrough:"line-through"===g,underline:"underline"===g,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:ue(o)}]},haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:ue(i)}]},shadowColor:[0,0,0,255],shadowOffsetX:1,shadowOffsetY:1,textCase:"Normal",textDirection:I?v.RTL:v.LTR,verticalAlignment:ye(m??"baseline"),verticalGlyphOrientation:F.Right,wordSpacing:100,billboardMode3D:D.FaceNearPlane,callout:C},textString:c}],scaleSymbolsProportionally:!0,respectFrame:!0}],scaleX:1,angleAlignment:"Display"}}static fromPictureFillSymbol(e){const{height:t,outline:r,width:o,xoffset:a,xscale:i,yoffset:s,yscale:n}=e,l=[],c={type:"CIMPolygonSymbol",symbolLayers:l};if(r){const{cap:e,join:t,miterLimit:o,width:a}=r;l.push({type:"CIMSolidStroke",color:ue(r.color),capStyle:ce(e),joinStyle:me(t),miterLimit:o,width:a})}let m=e.url;"esriPFS"===e.type&&e.imageData&&(m=e.imageData);const f="angle"in e?e.angle??0:0,y=(o??0)*(i||1),u=(t??0)*(n||1);return l.push({type:"CIMPictureFill",invertBackfaceTexture:!1,scaleX:1,textureFilter:T.Picture,tintColor:null,url:m,height:u,width:y,offsetX:z(a),offsetY:z(s),rotation:z(-f),colorSubstitutions:null}),c}static fromSimpleFillSymbol(e){const{color:t,style:r,outline:a}=e,i=[],s={type:"CIMPolygonSymbol",symbolLayers:i};let l=null;if(a){const{cap:e,join:t,style:r}=a;"solid"!==r&&"none"!==r&&"esriSLSSolid"!==r&&"esriSLSNull"!==r&&(l=[{type:"CIMGeometricEffectDashes",dashTemplate:de(r,e),lineDashEnding:"NoConstraint",scaleDash:!0,offsetAlongLine:null}]),i.push({type:"CIMSolidStroke",color:"esriSLSNull"!==r&&"none"!==r?ue(a.color):[0,0,0,0],capStyle:ce(e),joinStyle:me(t),miterLimit:a.miterLimit,width:a.width,effects:l})}if(r&&"solid"!==r&&"none"!==r&&"esriSFSSolid"!==r&&"esriSFSNull"!==r){const e={type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",color:ue(t),capStyle:C.Butt,joinStyle:I.Miter,width:.75}]};let a=0;const s=n(ge(r)?8:10);switch(r){case"vertical":case"esriSFSVertical":a=90;break;case"forward-diagonal":case"esriSFSForwardDiagonal":case"diagonal-cross":case"esriSFSDiagonalCross":a=-45;break;case"backward-diagonal":case"esriSFSBackwardDiagonal":a=45;break;case"cross":case"esriSFSCross":a=0}i.push({type:"CIMHatchFill",lineSymbol:e,offsetX:0,offsetY:0,rotation:a,separation:s}),"cross"===r||"esriSFSCross"===r?i.push({type:"CIMHatchFill",lineSymbol:o(e),offsetX:0,offsetY:0,rotation:90,separation:s}):"diagonal-cross"!==r&&"esriSFSDiagonalCross"!==r||i.push({type:"CIMHatchFill",lineSymbol:o(e),offsetX:0,offsetY:0,rotation:45,separation:s})}else!r||"solid"!==r&&"esriSFSSolid"!==r||i.push({type:"CIMSolidFill",enable:!0,color:ue(t)});return s}static fromSimpleLineSymbol(e){const{cap:t,color:r,join:o,marker:a,miterLimit:i,style:s,width:n}=e;let l=null;"solid"!==s&&"none"!==s&&"esriSLSSolid"!==s&&"esriSLSNull"!==s&&(l=[{type:"CIMGeometricEffectDashes",dashTemplate:de(s,t),lineDashEnding:"NoConstraint",scaleDash:!0,offsetAlongLine:null}]);const c=[];if(a){let e;switch(a.placement){case"begin-end":e=G.Both;break;case"begin":e=G.JustBegin;break;case"end":e=G.JustEnd;break;default:e=G.None}const t=ne.fromSimpleMarker(a,n,r).symbolLayers[0];t.markerPlacement={type:"CIMMarkerPlacementAtExtremities",angleToLine:!0,offset:0,extremityPlacement:e,offsetAlongLine:0},c.push(t)}return c.push({type:"CIMSolidStroke",color:"none"!==s&&"esriSLSNull"!==s?ue(r):[0,0,0,0],capStyle:ce(t),joinStyle:me(o),miterLimit:i,width:n,effects:l}),{type:"CIMLineSymbol",symbolLayers:c}}static fromPictureMarker(e){const{angle:t,height:r,width:o,xoffset:a,yoffset:i}=e;let s=e.url;return"esriPMS"===e.type&&e.imageData&&(s=e.imageData),{type:"CIMPointSymbol",symbolLayers:[{type:"CIMPictureMarker",invertBackfaceTexture:!1,scaleX:1,textureFilter:T.Picture,tintColor:null,url:s,size:r,width:o,offsetX:z(a),offsetY:z(i),rotation:z(-t)}]}}static fromSimpleMarker(e,t,r){const{style:o}=e,a=e.color??r;if("path"===o){const t=[];if("outline"in e&&e.outline){const r=e.outline;t.push({type:"CIMSolidStroke",enable:!0,width:s(Math.round(n(r.width))),color:ue(r.color)})}t.push({type:"CIMSolidFill",enable:!0,color:ue(a),path:e.path});const[r,o]=be("square");return{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,rotation:z(-e.angle),size:z(e.size||6),offsetX:z(e.xoffset),offsetY:z(e.yoffset),frame:r,markerGraphics:[{type:"CIMMarkerGraphic",geometry:o,symbol:{type:"CIMPolygonSymbol",symbolLayers:t}}]}]}}const[i,l]=be(o);let c;if(l&&i){const r=[];if("outline"in e&&e.outline){const t=e.outline;r.push({type:"CIMSolidStroke",enable:!0,width:null!=t.width&&t.width>.667?s(Math.round(n(t.width))):t.width,color:ue(t.color)})}else!t||"line-marker"!==e.type||"cross"!==e.style&&"x"!==e.style||r.push({type:"CIMSolidStroke",enable:!0,width:t,color:ue(a)});r.push({type:"CIMSolidFill",enable:!0,color:ue(a)});const o={type:"CIMPolygonSymbol",symbolLayers:r};c={type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,rotation:z(-e.angle),size:z(e.size||6*t),offsetX:z(e.xoffset),offsetY:z(e.yoffset),frame:i,markerGraphics:[{type:"CIMMarkerGraphic",geometry:l,symbol:o}]}]}}return c}static fromCIMHatchFill(e,t){const r=t*(e.separation??b),a=r/2,i=o(e.lineSymbol);i.symbolLayers?.forEach((e=>{switch(e.type){case"CIMSolidStroke":null!=e.width&&(e.width*=t),e.effects?.forEach((e=>{"CIMGeometricEffectDashes"===e.type&&(e.dashTemplate=e.dashTemplate.map((e=>e*t)))}));break;case"CIMVectorMarker":{null!=e.size&&(e.size*=t);const r=e.markerPlacement;null!=r&&"placementTemplate"in r&&(r.placementTemplate=r.placementTemplate.map((e=>e*t)));break}}}));let s=this._getLineSymbolPeriod(i)||Z;for(;s<Z;)s*=2;const n=s/2;return{type:"CIMVectorMarker",frame:{xmin:-n,xmax:n,ymin:-a,ymax:a},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{paths:[[[-n,0],[n,0]]]},symbol:i}],size:r}}static fetchResources(e,t,o){if(e&&t)switch(e.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":{const r=e.symbolLayers;if(!r)return;for(const e of r)switch(Ie(e,t,o),e.type){case"CIMPictureFill":case"CIMHatchFill":case"CIMGradientFill":case"CIMPictureStroke":case"CIMGradientStroke":case"CIMCharacterMarker":case"CIMPictureMarker":"url"in e&&e.url&&o.push(t.fetchResource(e.url,null));break;case"CIMVectorMarker":{const r=e.markerGraphics;if(!r)continue;for(const e of r)if(e){const r=e.symbol;r&&ne.fetchResources(r,t,o)}}}break}case"CIMTextSymbol":{const a=e,i=r(a.fontFamilyName),{style:s,weight:n}=E(a.fontStyleName),l=O(a);o.push(t.loadFont(new q({family:i,style:s,weight:n,decoration:l})).catch((()=>{ee.error("unsupported font in preview")})));break}}}static _getLineSymbolPeriod(e){if(e){const t=this._getEffectsRepeat(e.effects);if(t)return t;if(e.symbolLayers)for(const r of e.symbolLayers)if(r){const e=this._getEffectsRepeat(r.effects);if(e)return e;switch(r.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const e=this._getPlacementRepeat(r.markerPlacement);if(e)return e}}}}return 0}static _getEffectsRepeat(e){if(e)for(const t of e)if(t)switch(t.type){case"CIMGeometricEffectDashes":{const e=t.dashTemplate;if(e&&e.length){let t=0;for(const r of e)t+=r;return 1&e.length&&(t*=2),t}break}case"CIMGeometricEffectWave":return t.period;default:ee.error(`unsupported geometric effect type ${t.type}`)}return 0}static _getPlacementRepeat(e){if(e)switch(e.type){case"CIMMarkerPlacementAlongLineSameSize":case"CIMMarkerPlacementAlongLineRandomSize":case"CIMMarkerPlacementAlongLineVariableSize":{const t=e.placementTemplate;if(t&&t.length){let e=0;for(const r of t)e+=+r;return 1&t.length&&(e*=2),e}break}}return 0}static fromCIMInsidePolygon(e){const t=e.markerPlacement,r={...e};r.markerPlacement=null,r.anchorPoint=null;const o=Math.abs(t.stepX),a=Math.abs(t.stepY),s=(t.randomness??100)/100;let l,c,m,f;if("Random"===t.gridType){const e=n(U),r=Math.max(Math.floor(e/o),1),y=Math.max(Math.floor(e/a),1);l=r*o/2,c=y*a/2,m=2*c;const u=new i(t.seed),h=s*o/1.5,p=s*a/1.5;f=[];for(let t=0;t<r;t++)for(let e=0;e<y;e++){const r=t*o-l+h*(.5-u.getFloat()),i=e*a-c+p*(.5-u.getFloat());f.push({x:r,y:i}),0===t&&f.push({x:r+2*l,y:i}),0===e&&f.push({x:r,y:i+2*c})}}else!0===t.shiftOddRows?(l=o/2,c=a,m=2*a,f=[{x:-l,y:0},{x:l,y:0},{x:0,y:c},{x:0,y:-c}]):(l=o/2,c=a/2,m=a,f=[{x:-o,y:0},{x:0,y:-a},{x:-o,y:-a},{x:0,y:0},{x:o,y:0},{x:0,y:a},{x:o,y:a},{x:-o,y:a},{x:o,y:-a}]);return{type:"CIMVectorMarker",frame:{xmin:-l,xmax:l,ymin:-c,ymax:c},markerGraphics:f.map((e=>({type:"CIMMarkerGraphic",geometry:e,symbol:{type:"CIMPointSymbol",symbolLayers:[r]}}))),size:m}}static getSize(e){if(e)switch(e.type){case"CIMTextSymbol":return e.height;case"CIMPointSymbol":{let t=0;if(e.symbolLayers)for(const r of e.symbolLayers)if(r)switch(r.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const e=r.size;null!=e&&e>t&&(t=e);break}}return t}case"CIMLineSymbol":case"CIMPolygonSymbol":{let t=0;if(e.symbolLayers)for(const r of e.symbolLayers)if(r)switch(r.type){case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const e=r.width;null!=e&&e>t&&(t=e);break}case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":if(r.markerPlacement&&A(r.markerPlacement)){const e=r.size;null!=e&&e>t&&(t=e)}}return t}}}static getMarkerScaleRatio(e){if(e&&"CIMVectorMarker"===e.type)if(!1!==e.scaleSymbolsProportionally&&e.frame&&null!=e.size){const t=e.frame.ymax-e.frame.ymin;return e.size/t}return 1}}class le{static findApplicableOverrides(e,t,r){if(e&&t){if(e.primitiveName){let o=!1;for(const t of r)if(t.primitiveName===e.primitiveName){o=!0;break}if(!o)for(const a of t)a.primitiveName===e.primitiveName&&r.push(a)}switch(e.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(e.effects)for(const o of e.effects)le.findApplicableOverrides(o,t,r);if(e.symbolLayers)for(const o of e.symbolLayers)le.findApplicableOverrides(o,t,r);break;case"CIMTextSymbol":break;case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":case"CIMSolidFill":case"CIMPictureFill":case"CIMHatchFill":case"CIMGradientFill":case"CIMVectorMarker":case"CIMCharacterMarker":case"CIMPictureMarker":if(e.effects)for(const o of e.effects)le.findApplicableOverrides(o,t,r);if(e.markerPlacement&&le.findApplicableOverrides(e.markerPlacement,t,r),"CIMVectorMarker"===e.type){if(e.markerGraphics)for(const o of e.markerGraphics)le.findApplicableOverrides(o,t,r),le.findApplicableOverrides(o.symbol,t,r)}else"CIMCharacterMarker"===e.type?le.findApplicableOverrides(e.symbol,t,r):"CIMHatchFill"===e.type?le.findApplicableOverrides(e.lineSymbol,t,r):"CIMPictureMarker"===e.type&&le.findApplicableOverrides(e.animatedSymbolProperties,t,r)}}}static findEffectOverrides(e,t,r){if(!t||!e)return;const o=e.length;for(let a=0;a<o;a++){const o=e[a],i=o?.primitiveName;if(i){let e=!1;for(const t of r)if(t.primitiveName===i){e=!0;break}if(!e)for(const o of t)o.primitiveName===i&&r.push(o)}}}static async resolveSymbolOverrides(e,t,r,a,i,s,n){if(!e||!e.symbol)return null;let{symbol:l,primitiveOverrides:c}=e;const m=!!c;if(!m&&!a)return l;l=o(l);let f=!0;if(t||(t={attributes:{}},f=!1),m){if(f||(c=c.filter((e=>!e.valueExpressionInfo?.expression.includes("$feature")))),n||(c=c.filter((e=>!e.valueExpressionInfo?.expression.includes("$view")))),c.length>0){const e=N(t.attributes);await le.evaluateOverrides(c,t,{spatialReference:r,fields:e,geometryType:i},s,n)}le.applyOverrides(l,c)}return a&&le.applyDictionaryTextOverrides(l,t,a),l}static async evaluateOverrides(e,t,r,o,a){if(!t)return;let i;for(const s of e){const e=s.valueExpressionInfo;if(e&&r&&r.geometryType){i||(i=[]),s.value=void 0;const n=f(e.expression,r.spatialReference,r.fields).then((e=>{s.value=X(e,t,{$view:a},r.geometryType,o)}));i.push(n)}}void 0!==i&&i.length>0&&await Promise.all(i)}static applyDictionaryTextOverrides(e,t,r,o="Normal"){if(e&&e.type)switch(e.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":case"CIMTextSymbol":{const a=e.symbolLayers;if(!a)return;for(const i of a)i&&"CIMVectorMarker"===i.type&&le.applyDictionaryTextOverrides(i,t,r,"CIMTextSymbol"===e.type?e.textCase:o)}break;case"CIMVectorMarker":{const o=e.markerGraphics;if(!o)return;for(const e of o)e&&le.applyDictionaryTextOverrides(e,t,r)}break;case"CIMMarkerGraphic":{const a=e.textString;if(a&&a.includes("[")){const i=R(a,r);e.textString=j(t,i,o)}}}}static applyOverrides(e,t,r,o){if(e.primitiveName)for(const a of t)if(a.primitiveName===e.primitiveName){const t=Ce(a.propertyName);if(o&&o.push({cim:e,nocapPropertyName:t,value:e[t]}),a.expression&&(a.value=le.toValue(a.propertyName,a.expression)),r){let t=!1;for(const o of r)o.primitiveName===e.primitiveName&&(t=!0);t||r.push(a)}null!=a.value&&(e[t]=a.value)}switch(e.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(e.effects)for(const a of e.effects)le.applyOverrides(a,t,r,o);if(e.symbolLayers)for(const a of e.symbolLayers)le.applyOverrides(a,t,r,o);break;case"CIMTextSymbol":break;case"CIMSolidStroke":case"CIMSolidFill":case"CIMVectorMarker":if(e.effects)for(const a of e.effects)le.applyOverrides(a,t,r,o);if("CIMVectorMarker"===e.type&&e.markerGraphics)for(const a of e.markerGraphics)le.applyOverrides(a,t,r,o),le.applyOverrides(a.symbol,t,r,o)}}static restoreOverrides(e){for(const t of e)t.cim[t.nocapPropertyName]=t.value}static buildOverrideKey(e){let t="";for(const r of e)void 0!==r.value&&(t+=`${r.primitiveName}${r.propertyName}${JSON.stringify(r.value)}`);return t}static toValue(t,r){if("DashTemplate"===t)return r.split(" ").map((e=>Number(e)));if("Color"===t){const t=new e(r).toRgba();return t[3]*=255,t}return r}}const ce=e=>{if(!e)return C.Butt;switch(e){case"butt":return C.Butt;case"square":return C.Square;case"round":return C.Round}},me=e=>{if(!e)return I.Miter;switch(e){case"miter":return I.Miter;case"round":return I.Round;case"bevel":return I.Bevel}},fe=e=>{if(null==e)return"Center";switch(e){case"left":return"Left";case"right":return"Right";case"center":return"Center"}},ye=e=>{if(null==e)return"Center";switch(e){case"baseline":return"Baseline";case"top":return"Top";case"middle":return"Center";case"bottom":return"Bottom"}},ue=e=>{if(!e)return[0,0,0,0];const{r:t,g:r,b:o,a}=e;return[t,r,o,255*a]},he=(e,t)=>{const r=pe(t),o=Me(e);return r&&o?`${r}-${o}`:`${r}${o}`},pe=e=>{if(!e)return"";switch(e.toLowerCase()){case"bold":case"bolder":return"bold"}return""},Me=e=>{if(!e)return"";switch(e.toLowerCase()){case"italic":case"oblique":return"italic"}return""},de=(e,t)=>{const r="butt"===t;switch(e){case"dash":case"esriSLSDash":return r?[4,3]:[3,4];case"dash-dot":case"esriSLSDashDot":return r?[4,3,1,3]:[3,4,0,4];case"dot":case"esriSLSDot":return r?[1,3]:[0,4];case"long-dash":case"esriSLSLongDash":return r?[8,3]:[7,4];case"long-dash-dot":case"esriSLSLongDashDot":return r?[8,3,1,3]:[7,4,0,4];case"long-dash-dot-dot":case"esriSLSDashDotDot":return r?[8,3,1,3,1,3]:[7,4,0,4,0,4];case"short-dash":case"esriSLSShortDash":return r?[4,1]:[3,2];case"short-dash-dot":case"esriSLSShortDashDot":return r?[4,1,1,1]:[3,2,0,2];case"short-dash-dot-dot":case"esriSLSShortDashDotDot":return r?[4,1,1,1,1,1]:[3,2,0,2,0,2];case"short-dot":case"esriSLSShortDot":return r?[1,1]:[0,2];case"solid":case"esriSLSSolid":case"none":return ee.error("Unexpected: style does not require rasterization"),[0,0];default:return ee.error(`Tried to rasterize SLS, but found an unexpected style: ${e}!`),[0,0]}};function Se(e){return void 0!==e.symbolLayers}const be=e=>{const t=100,r=50;let o,a;const i=e;if("circle"===i||"esriSMSCircle"===i){const e=.25;let t=Math.acos(1-e/r),i=Math.ceil(W/t/4);0===i&&(i=1),t=J/i,i*=4;const s=[];s.push([r,0]);for(let o=1;o<i;o++)s.push([r*Math.cos(o*t),-r*Math.sin(o*t)]);s.push([r,0]),o={rings:[s]},a={xmin:-r,ymin:-r,xmax:r,ymax:r}}else if("cross"===i||"esriSMSCross"===i){const e=0;o={rings:[[[e,r],[e,e],[r,e],[r,-e],[e,-e],[e,-r],[-e,-r],[-e,-e],[-r,-e],[-r,e],[-e,e],[-e,r],[e,r]]]},a={xmin:-r,ymin:-r,xmax:r,ymax:r}}else if("diamond"===i||"esriSMSDiamond"===i)o={rings:[[[-r,0],[0,r],[r,0],[0,-r],[-r,0]]]},a={xmin:-r,ymin:-r,xmax:r,ymax:r};else if("square"===i||"esriSMSSquare"===i)o={rings:[[[-r,-r],[-r,r],[r,r],[r,-r],[-r,-r]]]},a={xmin:-r,ymin:-r,xmax:r,ymax:r};else if("x"===i||"esriSMSX"===i){const e=0;o={rings:[[[0,e],[r-e,r],[r,r-e],[e,0],[r,e-r],[r-e,-r],[0,-e],[e-r,-r],[-r,e-r],[-e,0],[-r,r-e],[e-r,r],[0,e]]]},a={xmin:-r,ymin:-r,xmax:r,ymax:r}}else if("triangle"===i||"esriSMSTriangle"===i){const e=t*.5773502691896257,r=-e,i=2/3*t,s=i-t;o={rings:[[[r,s],[0,i],[e,s],[r,s]]]},a={xmin:r,ymin:s,xmax:e,ymax:i}}else"arrow"===i&&(o={rings:[[[-50,50],[50,0],[-50,-50],[-33,-20],[-33,20],[-50,50]]]},a={xmin:-r,ymin:-r,xmax:r,ymax:r});return[a,o]},ge=e=>"vertical"===e||"horizontal"===e||"cross"===e||"esriSFSCross"===e||"esriSFSVertical"===e||"esriSFSHorizontal"===e,Ce=e=>e?e.charAt(0).toLowerCase()+e.substr(1):e;function Ie(e,t,r){if(!e.effects||null!=t.geometryEngine)return;if(t.geometryEnginePromise)return void r.push(t.geometryEnginePromise);V(e.effects)&&(t.geometryEnginePromise=B(),r.push(t.geometryEnginePromise),t.geometryEnginePromise.then((e=>t.geometryEngine=e)))}export{ne as CIMSymbolHelper,se as CIMSymbolInflatedSizeHelper,le as OverrideHelper,ie as getEffectsInflateSize,de as slsDashToTemplateArray,te as symbolToCIM};
5
+ import e from"../../Color.js";import"../../symbols.js";import{bidiText as t}from"../../core/BidiText.js";import{getFontFamily as r}from"../../core/fontUtils.js";import{clone as a}from"../../core/lang.js";import o from"../../core/Logger.js";import i from"../../core/RandomLCG.js";import{pt2px as s,px2pt as n}from"../../core/screenUtils.js";import{create as l,expandPointInPlace as c}from"../../geometry/support/aaBoundingRect.js";import{getBoundsXY as m}from"../../geometry/support/boundsUtils.js";import{createRendererExpression as f}from"../../support/arcadeOnDemand.js";import{Placement as y}from"./CIMPlacements.js";import{DEFAULT_TEXT_HEIGHT as u,horizontalAlignment2HAlign as h,verticalAlignment2VAlign as p,EnvDrawHelper as M,Transformation as d,CanvasDrawHelper as S,DEFAULT_HATCH_FILL_SEPARATION as b,lineGapType2LineHeight as g}from"./CIMSymbolDrawHelper.js";import{LineCapStyle as C,LineJoinStyle as I,BlockProgression as k,FontEffects as x,FontEncoding as w,FontType as P,GlyphHinting as v,TextReadingDirection as L,VerticalGlyphOrientation as F,BillBoardMode as D,TextureFilter as T,ExtremityPlacement as G}from"./enums.js";import{getValue as z,fromCIMFontStyle as E,fromCIMFontDecoration as O,isCIMMarkerStrokePlacement as A,attributesToFields as N,analyzeTextParts as R,assignTextValuesFromFeature as j,isGeometryEngineRequired as V,importGeometryEngine as B}from"./utils.js";import X from"../../views/2d/arcade/callExpressionWithFeature.js";import{C_INFINITY as _}from"../../views/2d/engine/vectorTiles/GeometryUtils.js";import{GLYPH_SIZE as H,MAGIC_LABEL_LINE_HEIGHT as Y,RANDOM_INSIDE_POLYGON_TEXTURE_SIZE as U}from"../../views/2d/engine/webgl/definitions.js";import{shapeGlyphs as $}from"../../views/2d/engine/webgl/mesh/templates/shapingUtils.js";import q from"../Font.js";const W=Math.PI,J=W/2,K=Math.PI/180,Q=96/72,Z=4,ee=o.getLogger("esri.symbols.cim.CIMSymbolHelper");function te(e){if(!e||!e.type)return null;let t;switch(e.type){case"cim":return e.data;case"web-style":return e;case"simple-marker":{const r=ne.fromSimpleMarker(e);if(!r)return null;t=r;break}case"picture-marker":t=ne.fromPictureMarker(e);break;case"simple-line":t=ne.fromSimpleLineSymbol(e);break;case"simple-fill":t=ne.fromSimpleFillSymbol(e);break;case"picture-fill":t=ne.fromPictureFillSymbol(e);break;case"text":t=ne.fromTextSymbol(e)}return{type:"CIMSymbolReference",symbol:t}}function re(e,t,r){switch(t.type){case"CIMSymbolReference":return re(e,t.symbol,r);case"CIMPointSymbol":null==r&&(r={x:0,y:0}),e.drawSymbol(t,r);break;case"CIMLineSymbol":null==r&&(r={paths:[[[0,0],[10,0]]]}),e.drawSymbol(t,r);break;case"CIMPolygonSymbol":null==r&&(r={rings:[[[0,0],[0,10],[10,10],[10,0],[0,0]]]}),e.drawSymbol(t,r);break;case"CIMTextSymbol":{const r={x:0,y:0};e.drawSymbol(t,r);break}case"CIMVectorMarker":{const r=new y;e.drawMarker(t,r);break}}return e.envelope()}function ae(e){if(!e)return 0;switch(e.type){case"CIMMarkerPlacementAlongLineSameSize":case"CIMMarkerPlacementAlongLineRandomSize":case"CIMMarkerPlacementAtExtremities":case"CIMMarkerPlacementAtMeasuredUnits":case"CIMMarkerPlacementAtRatioPositions":case"CIMMarkerPlacementOnLine":case"CIMMarkerPlacementOnVertices":return Math.abs(e.offset);default:return 0}}function oe(e){if(!e)return 0;switch(e.type){case"CIMGeometricEffectArrow":return Math.abs(.5*e.width);case"CIMGeometricEffectBuffer":return Math.abs(e.size);case"CIMGeometricEffectExtension":case"CIMGeometricEffectRadial":return Math.abs(e.length);case"CIMGeometricEffectJog":return Math.abs(.5*e.length);case"CIMGeometricEffectMove":return Math.max(Math.abs(z(e.offsetX)),Math.abs(z(e.offsetY)));case"CIMGeometricEffectOffset":case"CIMGeometricEffectOffsetTangent":return Math.abs(e.offset);case"CIMGeometricEffectRegularPolygon":return Math.abs(e.radius);case"CIMGeometricEffectRotate":case"CIMGeometricEffectScale":default:return 0;case"CIMGeometricEffectTaperedPolygon":return.5*Math.max(Math.abs(e.fromWidth),Math.abs(e.toWidth));case"CIMGeometricEffectWave":return Math.abs(e.amplitude);case"CIMGeometricEffectDonut":return Math.abs(e.width)}}function ie(e){if(!e)return 0;let t=0;for(const r of e)t+=oe(r);return t}class se{getSymbolInflateSize(e,t,r,a,o){return e||(e=[0,0,0,0]),t?this._getInflateSize(e,t,r,a,o):e}static safeSize(e){const t=Math.max(Math.abs(e[0]),Math.abs(e[2])),r=Math.max(Math.abs(e[1]),Math.abs(e[3]));return Math.sqrt(t*t+r*r)}_vectorMarkerBounds(e,t,r,a){let o=!0;const i=l();if(t&&t.markerGraphics)for(const s of t.markerGraphics){const t=[0,0,0,0];s.geometry&&(m(i,s.geometry),t[0]=0,t[1]=0,t[2]=0,t[3]=0,this.getSymbolInflateSize(t,s.symbol,r,0,a),i[0]+=t[0],i[1]+=t[1],i[2]+=t[2],i[3]+=t[3],o?(e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],o=!1):(e[0]=Math.min(e[0],i[0]),e[1]=Math.min(e[1],i[1]),e[2]=Math.max(e[2],i[2]),e[3]=Math.max(e[3],i[3])))}return e}_getInflateSize(e,t,r,a,o){if(Se(t)){const i=this._getLayersInflateSize(e,t.symbolLayers,r,a,o),s=ie(t.effects);return s>0&&(i[0]-=s,i[1]-=s,i[2]+=s,i[3]+=s),i}return this._getTextInflatedSize(e,t,o)}_getLayersInflateSize(e,t,r,a,o){let i=!0;if(!t)return e;for(const s of t){if(!s)continue;let t=[0,0,0,0];switch(s.type){case"CIMSolidFill":case"CIMPictureFill":case"CIMHatchFill":case"CIMGradientFill":break;case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const e=s;let r=e.width;null!=r&&(e.capStyle===C.Square||e.joinStyle===I.Miter?r/=1.4142135623730951:r/=2,t[0]=-r,t[1]=-r,t[2]=r,t[3]=r);break}case"CIMCharacterMarker":case"CIMVectorMarker":case"CIMPictureMarker":{const e=s;if("CIMVectorMarker"===s.type){const e=s;if(t=this._vectorMarkerBounds(t,e,r,o),e.frame){const r=(e.frame.xmin+e.frame.xmax)/2,a=(e.frame.ymin+e.frame.ymax)/2;if(t[0]-=r,t[1]-=a,t[2]-=r,t[3]-=a,null!=e.size){const r=e.size/(e.frame.ymax-e.frame.ymin);t[0]*=r,t[1]*=r,t[2]*=r,t[3]*=r}}}else if("CIMPictureMarker"===s.type){const a=s,o=r.getResource(a.url);let i=1;if(null!=o&&o.height&&(i=o.width/o.height),null!=e.size){const r=e.size/2,o=e.size*i*a.scaleX/2;t=[-o,-r,o,r]}}else if(null!=e.size){const r=e.size/2;t=[-r,-r,r,r]}if(e.anchorPoint){let r,a;"Absolute"===e.anchorPointUnits?(r=e.anchorPoint.x,a=e.anchorPoint.y):(r=e.anchorPoint.x*(t[2]-t[0]),a=e.anchorPoint.y*(t[3]-t[1])),t[0]-=r,t[1]-=a,t[2]-=r,t[3]-=a}let i=z(e.rotation);if(e.rotateClockwise&&(i=-i),a&&(i-=a),i){const e=K*i,r=Math.cos(e),a=Math.sin(e),o=l([_,_,-_,-_]);c(o,[t[0]*r-t[1]*a,t[0]*a+t[1]*r]),c(o,[t[0]*r-t[3]*a,t[0]*a+t[3]*r]),c(o,[t[2]*r-t[1]*a,t[2]*a+t[1]*r]),c(o,[t[2]*r-t[3]*a,t[2]*a+t[3]*r]),t=o}let n=z(e.offsetX),m=z(e.offsetY);if(a){const e=K*a,t=Math.cos(e),r=Math.sin(e),o=n*r+m*t;n=n*t-m*r,m=o}t[0]+=n,t[1]+=m,t[2]+=n,t[3]+=m;const f=ae(e.markerPlacement);f>0&&(t[0]-=f,t[1]-=f,t[2]+=f,t[3]+=f);break}}const n=ie(s.effects);n>0&&(t[0]-=n,t[1]-=n,t[2]+=n,t[3]+=n),i?(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],i=!1):(e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[2]),e[3]=Math.max(e[3],t[3]))}return e}_getTextInflatedSize(e,r,a){const o=r.height??u;if(e[0]=-o/2,e[1]=-o/2,e[2]=o/2,e[3]=o/2,!a)return e;const i=a.get(r);if(!i)return e;const{text:s,mosaicItem:n}=i;if(!n?.glyphMosaicItems?.length)return e;const{lineGapType:l,lineGap:c}=r,m=l?g(l,c??0,o):0,f=t(s)[1],y=n.glyphMosaicItems,M="CIMBackgroundCallout"===r.callout?.type,d=$(y,f,{scale:o/H,angle:z(r.angle),xOffset:z(r.offsetX),yOffset:z(r.offsetY),hAlign:h(r.horizontalAlignment),vAlign:p(r.verticalAlignment),maxLineWidth:512,lineHeight:Y*Math.max(.25,Math.min(m||1,4)),decoration:r.font.decoration||"none",isCIM:!0,hasBackground:M}).boundsT;return e[0]=d.x-d.halfWidth,e[1]=-d.y-d.halfHeight,e[2]=d.x+d.halfWidth,e[3]=-d.y+d.halfHeight,e}}class ne{static getEnvelope(e,t,r){if(!e)return null;const a=new M(r);if(Array.isArray(e)){let r;for(const o of e)r?r.union(re(a,o,t)):r=re(a,o,t);return r}return re(a,e,t)}static getTextureAnchor(e,t){const r=this.getEnvelope(e,null,t);if(!r)return[0,0,0];const a=(r.x+.5*r.width)*Q,o=(r.y+.5*r.height)*Q,i=r.width*Q+2,s=r.height*Q+2;return[-a/i,-o/s,s]}static rasterize(e,t,r,a,o=!0){const i=r||this.getEnvelope(t,null,a);if(!i)return[null,0,0,0,0];const s=(i.x+.5*i.width)*Q,n=(i.y+.5*i.height)*Q;e.width=i.width*Q,e.height=i.height*Q,r||(e.width+=2,e.height+=2);const l=e.getContext("2d"),c=d.createScale(Q,-Q);c.translate(.5*e.width-s,.5*e.height+n);const m=new S(l,a,c);switch(t.type){case"CIMPointSymbol":{const e={type:"point",x:0,y:0};m.drawSymbol(t,e);break}case"CIMVectorMarker":{const e=new y;m.drawMarker(t,e);break}}const f=l.getImageData(0,0,e.width,e.height),u=new Uint8Array(f.data);if(o){let e;for(let t=0;t<u.length;t+=4)e=u[t+3]/255,u[t]=u[t]*e,u[t+1]=u[t+1]*e,u[t+2]=u[t+2]*e}return[u,e.width,e.height,-s/e.width,-n/e.height]}static fromTextSymbol(e){const{angle:r,color:a,font:o,haloColor:i,haloSize:s,horizontalAlignment:n,kerning:l,text:c,verticalAlignment:m,xoffset:f,yoffset:y,backgroundColor:u,borderLineColor:h,borderLineSize:p}=e;let M,d,S,b,g,C;o&&(M=o.family,d=o.style,S=o.weight,b=o.size,g=o.decoration);let I=!1;if(c){I=t(c)[1]}return(u||p)&&(C={type:"CIMBackgroundCallout",margin:null,backgroundSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",color:ue(u)},{type:"CIMSolidStroke",color:ue(h),width:p}]},accentBarSymbol:null,gap:null,leaderLineSymbol:null,lineStyle:null}),{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,anchorPointUnits:"Relative",dominantSizeAxis3D:"Y",size:10,billboardMode3D:"FaceNearPlane",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{x:0,y:0},symbol:{type:"CIMTextSymbol",angle:r,blockProgression:k.BTT,depth3D:1,extrapolateBaselines:!0,fontEffects:x.Normal,fontEncoding:w.Unicode,fontFamilyName:M||"Arial",fontStyleName:he(d,S),fontType:P.Unspecified,haloSize:s,height:b,hinting:v.Default,horizontalAlignment:fe(n??"center"),kerning:l,letterWidth:100,ligatures:!0,lineGapType:"Multiple",offsetX:z(f),offsetY:z(y),strikethrough:"line-through"===g,underline:"underline"===g,symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:ue(a)}]},haloSymbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:ue(i)}]},shadowColor:[0,0,0,255],shadowOffsetX:1,shadowOffsetY:1,textCase:"Normal",textDirection:I?L.RTL:L.LTR,verticalAlignment:ye(m??"baseline"),verticalGlyphOrientation:F.Right,wordSpacing:100,billboardMode3D:D.FaceNearPlane,callout:C},textString:c}],scaleSymbolsProportionally:!0,respectFrame:!0}],scaleX:1,angleAlignment:"Display"}}static fromPictureFillSymbol(e){const{height:t,outline:r,width:a,xoffset:o,xscale:i,yoffset:s,yscale:n}=e,l=[],c={type:"CIMPolygonSymbol",symbolLayers:l};if(r){const e=ke(r);e&&l.push(e)}let m=e.url;"esriPFS"===e.type&&e.imageData&&(m=e.imageData);const f="angle"in e?e.angle??0:0,y=(a??0)*(i||1),u=(t??0)*(n||1);return l.push({type:"CIMPictureFill",invertBackfaceTexture:!1,scaleX:1,textureFilter:T.Picture,tintColor:null,url:m,height:u,width:y,offsetX:z(o),offsetY:z(s),rotation:z(-f),colorSubstitutions:null}),c}static fromSimpleFillSymbol(e){const{color:t,style:r,outline:o}=e,i=[],s={type:"CIMPolygonSymbol",symbolLayers:i};if(o){const e=ke(o);e&&i.push(e)}if(r&&"solid"!==r&&"none"!==r&&"esriSFSSolid"!==r&&"esriSFSNull"!==r){const e={type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",color:ue(t),capStyle:C.Butt,joinStyle:I.Miter,width:.75}]};let o=0;const s=n(ge(r)?8:10);switch(r){case"vertical":case"esriSFSVertical":o=90;break;case"forward-diagonal":case"esriSFSForwardDiagonal":case"diagonal-cross":case"esriSFSDiagonalCross":o=-45;break;case"backward-diagonal":case"esriSFSBackwardDiagonal":o=45;break;case"cross":case"esriSFSCross":o=0}i.push({type:"CIMHatchFill",lineSymbol:e,offsetX:0,offsetY:0,rotation:o,separation:s}),"cross"===r||"esriSFSCross"===r?i.push({type:"CIMHatchFill",lineSymbol:a(e),offsetX:0,offsetY:0,rotation:90,separation:s}):"diagonal-cross"!==r&&"esriSFSDiagonalCross"!==r||i.push({type:"CIMHatchFill",lineSymbol:a(e),offsetX:0,offsetY:0,rotation:45,separation:s})}else!r||"solid"!==r&&"esriSFSSolid"!==r||i.push({type:"CIMSolidFill",enable:!0,color:ue(t)});return s}static fromSimpleLineSymbol(e){const{cap:t,color:r,join:a,marker:o,miterLimit:i,style:s,width:n}=e;let l=null;"solid"!==s&&"none"!==s&&"esriSLSSolid"!==s&&"esriSLSNull"!==s&&(l=[{type:"CIMGeometricEffectDashes",dashTemplate:de(s,t),lineDashEnding:"NoConstraint",scaleDash:!0,offsetAlongLine:null}]);const c=[];if(o){let e;switch(o.placement){case"begin-end":e=G.Both;break;case"begin":e=G.JustBegin;break;case"end":e=G.JustEnd;break;default:e=G.None}const t=ne.fromSimpleMarker(o,n,r).symbolLayers[0];t.markerPlacement={type:"CIMMarkerPlacementAtExtremities",angleToLine:!0,offset:0,extremityPlacement:e,offsetAlongLine:0},c.push(t)}return c.push({type:"CIMSolidStroke",color:"none"!==s&&"esriSLSNull"!==s?ue(r):[0,0,0,0],capStyle:ce(t),joinStyle:me(a),miterLimit:i,width:n,effects:l}),{type:"CIMLineSymbol",symbolLayers:c}}static fromPictureMarker(e){const{angle:t,height:r,width:a,xoffset:o,yoffset:i}=e;let s=e.url;return"esriPMS"===e.type&&e.imageData&&(s=e.imageData),{type:"CIMPointSymbol",symbolLayers:[{type:"CIMPictureMarker",invertBackfaceTexture:!1,scaleX:1,textureFilter:T.Picture,tintColor:null,url:s,size:r,width:a,offsetX:z(o),offsetY:z(i),rotation:z(-t)}]}}static fromSimpleMarker(e,t,r){const{style:a}=e,o=e.color??r;if("path"===a){const t=[];if("outline"in e&&e.outline){const r=e.outline;t.push({type:"CIMSolidStroke",enable:!0,width:s(Math.round(n(r.width))),color:ue(r.color)})}t.push({type:"CIMSolidFill",enable:!0,color:ue(o),path:e.path});const[r,a]=be("square");return{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,rotation:z(-e.angle),size:z(e.size||6),offsetX:z(e.xoffset),offsetY:z(e.yoffset),frame:r,markerGraphics:[{type:"CIMMarkerGraphic",geometry:a,symbol:{type:"CIMPolygonSymbol",symbolLayers:t}}]}]}}const[i,l]=be(a);let c;if(l&&i){const r=[];if("outline"in e&&e.outline){const t=e.outline;r.push({type:"CIMSolidStroke",enable:!0,width:null!=t.width&&t.width>.667?s(Math.round(n(t.width))):t.width,color:ue(t.color)})}else!t||"line-marker"!==e.type||"cross"!==e.style&&"x"!==e.style||r.push({type:"CIMSolidStroke",enable:!0,width:t,color:ue(o)});r.push({type:"CIMSolidFill",enable:!0,color:ue(o)});const a={type:"CIMPolygonSymbol",symbolLayers:r};c={type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,rotation:z(-e.angle),size:z(e.size||6*t),offsetX:z(e.xoffset),offsetY:z(e.yoffset),frame:i,markerGraphics:[{type:"CIMMarkerGraphic",geometry:l,symbol:a}]}]}}return c}static fromCIMHatchFill(e,t){const r=t*(e.separation??b),o=r/2,i=a(e.lineSymbol);i.symbolLayers?.forEach((e=>{switch(e.type){case"CIMSolidStroke":null!=e.width&&(e.width*=t),e.effects?.forEach((e=>{"CIMGeometricEffectDashes"===e.type&&(e.dashTemplate=e.dashTemplate.map((e=>e*t)))}));break;case"CIMVectorMarker":{null!=e.size&&(e.size*=t);const r=e.markerPlacement;null!=r&&"placementTemplate"in r&&(r.placementTemplate=r.placementTemplate.map((e=>e*t)));break}}}));let s=this._getLineSymbolPeriod(i)||Z;for(;s<Z;)s*=2;const n=s/2;return{type:"CIMVectorMarker",frame:{xmin:-n,xmax:n,ymin:-o,ymax:o},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{paths:[[[-n,0],[n,0]]]},symbol:i}],size:r}}static fetchResources(e,t,a){if(e&&t)switch(e.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":{const r=e.symbolLayers;if(!r)return;for(const e of r)switch(Ie(e,t,a),e.type){case"CIMPictureFill":case"CIMHatchFill":case"CIMGradientFill":case"CIMPictureStroke":case"CIMGradientStroke":case"CIMCharacterMarker":case"CIMPictureMarker":"url"in e&&e.url&&a.push(t.fetchResource(e.url,null));break;case"CIMVectorMarker":{const r=e.markerGraphics;if(!r)continue;for(const e of r)if(e){const r=e.symbol;r&&ne.fetchResources(r,t,a)}}}break}case"CIMTextSymbol":{const o=e,i=r(o.fontFamilyName),{style:s,weight:n}=E(o.fontStyleName),l=O(o);a.push(t.loadFont(new q({family:i,style:s,weight:n,decoration:l})).catch((()=>{ee.error("unsupported font in preview")})));break}}}static _getLineSymbolPeriod(e){if(e){const t=this._getEffectsRepeat(e.effects);if(t)return t;if(e.symbolLayers)for(const r of e.symbolLayers)if(r){const e=this._getEffectsRepeat(r.effects);if(e)return e;switch(r.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const e=this._getPlacementRepeat(r.markerPlacement);if(e)return e}}}}return 0}static _getEffectsRepeat(e){if(e)for(const t of e)if(t)switch(t.type){case"CIMGeometricEffectDashes":{const e=t.dashTemplate;if(e&&e.length){let t=0;for(const r of e)t+=r;return 1&e.length&&(t*=2),t}break}case"CIMGeometricEffectWave":return t.period;default:ee.error(`unsupported geometric effect type ${t.type}`)}return 0}static _getPlacementRepeat(e){if(e)switch(e.type){case"CIMMarkerPlacementAlongLineSameSize":case"CIMMarkerPlacementAlongLineRandomSize":case"CIMMarkerPlacementAlongLineVariableSize":{const t=e.placementTemplate;if(t&&t.length){let e=0;for(const r of t)e+=+r;return 1&t.length&&(e*=2),e}break}}return 0}static fromCIMInsidePolygon(e){const t=e.markerPlacement,r={...e};r.markerPlacement=null,r.anchorPoint=null;const a=Math.abs(t.stepX),o=Math.abs(t.stepY),s=(t.randomness??100)/100;let l,c,m,f;if("Random"===t.gridType){const e=n(U),r=Math.max(Math.floor(e/a),1),y=Math.max(Math.floor(e/o),1);l=r*a/2,c=y*o/2,m=2*c;const u=new i(t.seed),h=s*a/1.5,p=s*o/1.5;f=[];for(let t=0;t<r;t++)for(let e=0;e<y;e++){const r=t*a-l+h*(.5-u.getFloat()),i=e*o-c+p*(.5-u.getFloat());f.push({x:r,y:i}),0===t&&f.push({x:r+2*l,y:i}),0===e&&f.push({x:r,y:i+2*c})}}else!0===t.shiftOddRows?(l=a/2,c=o,m=2*o,f=[{x:-l,y:0},{x:l,y:0},{x:0,y:c},{x:0,y:-c}]):(l=a/2,c=o/2,m=o,f=[{x:-a,y:0},{x:0,y:-o},{x:-a,y:-o},{x:0,y:0},{x:a,y:0},{x:0,y:o},{x:a,y:o},{x:-a,y:o},{x:a,y:-o}]);return{type:"CIMVectorMarker",frame:{xmin:-l,xmax:l,ymin:-c,ymax:c},markerGraphics:f.map((e=>({type:"CIMMarkerGraphic",geometry:e,symbol:{type:"CIMPointSymbol",symbolLayers:[r]}}))),size:m}}static getSize(e){if(e)switch(e.type){case"CIMTextSymbol":return e.height;case"CIMPointSymbol":{let t=0;if(e.symbolLayers)for(const r of e.symbolLayers)if(r)switch(r.type){case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":{const e=r.size;null!=e&&e>t&&(t=e);break}}return t}case"CIMLineSymbol":case"CIMPolygonSymbol":{let t=0;if(e.symbolLayers)for(const r of e.symbolLayers)if(r)switch(r.type){case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":{const e=r.width;null!=e&&e>t&&(t=e);break}case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":case"CIMObjectMarker3D":case"CIMglTFMarker3D":if(r.markerPlacement&&A(r.markerPlacement)){const e=r.size;null!=e&&e>t&&(t=e)}}return t}}}static getMarkerScaleRatio(e){if(e&&"CIMVectorMarker"===e.type)if(!1!==e.scaleSymbolsProportionally&&e.frame&&null!=e.size){const t=e.frame.ymax-e.frame.ymin;return e.size/t}return 1}}class le{static findApplicableOverrides(e,t,r){if(e&&t){if(e.primitiveName){let a=!1;for(const t of r)if(t.primitiveName===e.primitiveName){a=!0;break}if(!a)for(const o of t)o.primitiveName===e.primitiveName&&r.push(o)}switch(e.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(e.effects)for(const a of e.effects)le.findApplicableOverrides(a,t,r);if(e.symbolLayers)for(const a of e.symbolLayers)le.findApplicableOverrides(a,t,r);break;case"CIMTextSymbol":break;case"CIMSolidStroke":case"CIMPictureStroke":case"CIMGradientStroke":case"CIMSolidFill":case"CIMPictureFill":case"CIMHatchFill":case"CIMGradientFill":case"CIMVectorMarker":case"CIMCharacterMarker":case"CIMPictureMarker":if(e.effects)for(const a of e.effects)le.findApplicableOverrides(a,t,r);if(e.markerPlacement&&le.findApplicableOverrides(e.markerPlacement,t,r),"CIMVectorMarker"===e.type){if(e.markerGraphics)for(const a of e.markerGraphics)le.findApplicableOverrides(a,t,r),le.findApplicableOverrides(a.symbol,t,r)}else"CIMCharacterMarker"===e.type?le.findApplicableOverrides(e.symbol,t,r):"CIMHatchFill"===e.type?le.findApplicableOverrides(e.lineSymbol,t,r):"CIMPictureMarker"===e.type&&le.findApplicableOverrides(e.animatedSymbolProperties,t,r)}}}static findEffectOverrides(e,t,r){if(!t||!e)return;const a=e.length;for(let o=0;o<a;o++){const a=e[o],i=a?.primitiveName;if(i){let e=!1;for(const t of r)if(t.primitiveName===i){e=!0;break}if(!e)for(const a of t)a.primitiveName===i&&r.push(a)}}}static async resolveSymbolOverrides(e,t,r,o,i,s,n){if(!e||!e.symbol)return null;let{symbol:l,primitiveOverrides:c}=e;const m=!!c;if(!m&&!o)return l;l=a(l);let f=!0;if(t||(t={attributes:{}},f=!1),m){if(f||(c=c.filter((e=>!e.valueExpressionInfo?.expression.includes("$feature")))),n||(c=c.filter((e=>!e.valueExpressionInfo?.expression.includes("$view")))),c.length>0){const e=N(t.attributes);await le.evaluateOverrides(c,t,{spatialReference:r,fields:e,geometryType:i},s,n)}le.applyOverrides(l,c)}return o&&le.applyDictionaryTextOverrides(l,t,o),l}static async evaluateOverrides(e,t,r,a,o){if(!t)return;let i;for(const s of e){const e=s.valueExpressionInfo;if(e&&r&&r.geometryType){i||(i=[]),s.value=void 0;const n=f(e.expression,r.spatialReference,r.fields).then((e=>{s.value=X(e,t,{$view:o},r.geometryType,a)}));i.push(n)}}void 0!==i&&i.length>0&&await Promise.all(i)}static applyDictionaryTextOverrides(e,t,r,a="Normal"){if(e&&e.type)switch(e.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":case"CIMTextSymbol":{const o=e.symbolLayers;if(!o)return;for(const i of o)i&&"CIMVectorMarker"===i.type&&le.applyDictionaryTextOverrides(i,t,r,"CIMTextSymbol"===e.type?e.textCase:a)}break;case"CIMVectorMarker":{const a=e.markerGraphics;if(!a)return;for(const e of a)e&&le.applyDictionaryTextOverrides(e,t,r)}break;case"CIMMarkerGraphic":{const o=e.textString;if(o&&o.includes("[")){const i=R(o,r);e.textString=j(t,i,a)}}}}static applyOverrides(e,t,r,a){if(e.primitiveName)for(const o of t)if(o.primitiveName===e.primitiveName){const t=Ce(o.propertyName);if(a&&a.push({cim:e,nocapPropertyName:t,value:e[t]}),o.expression&&(o.value=le.toValue(o.propertyName,o.expression)),r){let t=!1;for(const a of r)a.primitiveName===e.primitiveName&&(t=!0);t||r.push(o)}null!=o.value&&(e[t]=o.value)}switch(e.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":if(e.effects)for(const o of e.effects)le.applyOverrides(o,t,r,a);if(e.symbolLayers)for(const o of e.symbolLayers)le.applyOverrides(o,t,r,a);break;case"CIMTextSymbol":break;case"CIMSolidStroke":case"CIMSolidFill":case"CIMVectorMarker":if(e.effects)for(const o of e.effects)le.applyOverrides(o,t,r,a);if("CIMVectorMarker"===e.type&&e.markerGraphics)for(const o of e.markerGraphics)le.applyOverrides(o,t,r,a),le.applyOverrides(o.symbol,t,r,a)}}static restoreOverrides(e){for(const t of e)t.cim[t.nocapPropertyName]=t.value}static buildOverrideKey(e){let t="";for(const r of e)void 0!==r.value&&(t+=`${r.primitiveName}${r.propertyName}${JSON.stringify(r.value)}`);return t}static toValue(t,r){if("DashTemplate"===t)return r.split(" ").map((e=>Number(e)));if("Color"===t){const t=new e(r).toRgba();return t[3]*=255,t}return r}}const ce=e=>{if(!e)return C.Butt;switch(e){case"butt":return C.Butt;case"square":return C.Square;case"round":return C.Round}},me=e=>{if(!e)return I.Miter;switch(e){case"miter":return I.Miter;case"round":return I.Round;case"bevel":return I.Bevel}},fe=e=>{if(null==e)return"Center";switch(e){case"left":return"Left";case"right":return"Right";case"center":return"Center"}},ye=e=>{if(null==e)return"Center";switch(e){case"baseline":return"Baseline";case"top":return"Top";case"middle":return"Center";case"bottom":return"Bottom"}},ue=e=>{if(!e)return[0,0,0,0];const{r:t,g:r,b:a,a:o}=e;return[t,r,a,255*o]},he=(e,t)=>{const r=pe(t),a=Me(e);return r&&a?`${r}-${a}`:`${r}${a}`},pe=e=>{if(!e)return"";switch(e.toLowerCase()){case"bold":case"bolder":return"bold"}return""},Me=e=>{if(!e)return"";switch(e.toLowerCase()){case"italic":case"oblique":return"italic"}return""},de=(e,t)=>{const r="butt"===t;switch(e){case"dash":case"esriSLSDash":return r?[4,3]:[3,4];case"dash-dot":case"esriSLSDashDot":return r?[4,3,1,3]:[3,4,0,4];case"dot":case"esriSLSDot":return r?[1,3]:[0,4];case"long-dash":case"esriSLSLongDash":return r?[8,3]:[7,4];case"long-dash-dot":case"esriSLSLongDashDot":return r?[8,3,1,3]:[7,4,0,4];case"long-dash-dot-dot":case"esriSLSDashDotDot":return r?[8,3,1,3,1,3]:[7,4,0,4,0,4];case"short-dash":case"esriSLSShortDash":return r?[4,1]:[3,2];case"short-dash-dot":case"esriSLSShortDashDot":return r?[4,1,1,1]:[3,2,0,2];case"short-dash-dot-dot":case"esriSLSShortDashDotDot":return r?[4,1,1,1,1,1]:[3,2,0,2,0,2];case"short-dot":case"esriSLSShortDot":return r?[1,1]:[0,2];case"solid":case"esriSLSSolid":case"none":return ee.error("Unexpected: style does not require rasterization"),[0,0];default:return ee.error(`Tried to rasterize SLS, but found an unexpected style: ${e}!`),[0,0]}};function Se(e){return void 0!==e.symbolLayers}const be=e=>{const t=100,r=50;let a,o;const i=e;if("circle"===i||"esriSMSCircle"===i){const e=.25;let t=Math.acos(1-e/r),i=Math.ceil(W/t/4);0===i&&(i=1),t=J/i,i*=4;const s=[];s.push([r,0]);for(let a=1;a<i;a++)s.push([r*Math.cos(a*t),-r*Math.sin(a*t)]);s.push([r,0]),a={rings:[s]},o={xmin:-r,ymin:-r,xmax:r,ymax:r}}else if("cross"===i||"esriSMSCross"===i){const e=0;a={rings:[[[e,r],[e,e],[r,e],[r,-e],[e,-e],[e,-r],[-e,-r],[-e,-e],[-r,-e],[-r,e],[-e,e],[-e,r],[e,r]]]},o={xmin:-r,ymin:-r,xmax:r,ymax:r}}else if("diamond"===i||"esriSMSDiamond"===i)a={rings:[[[-r,0],[0,r],[r,0],[0,-r],[-r,0]]]},o={xmin:-r,ymin:-r,xmax:r,ymax:r};else if("square"===i||"esriSMSSquare"===i)a={rings:[[[-r,-r],[-r,r],[r,r],[r,-r],[-r,-r]]]},o={xmin:-r,ymin:-r,xmax:r,ymax:r};else if("x"===i||"esriSMSX"===i){const e=0;a={rings:[[[0,e],[r-e,r],[r,r-e],[e,0],[r,e-r],[r-e,-r],[0,-e],[e-r,-r],[-r,e-r],[-e,0],[-r,r-e],[e-r,r],[0,e]]]},o={xmin:-r,ymin:-r,xmax:r,ymax:r}}else if("triangle"===i||"esriSMSTriangle"===i){const e=t*.5773502691896257,r=-e,i=2/3*t,s=i-t;a={rings:[[[r,s],[0,i],[e,s],[r,s]]]},o={xmin:r,ymin:s,xmax:e,ymax:i}}else"arrow"===i&&(a={rings:[[[-50,50],[50,0],[-50,-50],[-33,-20],[-33,20],[-50,50]]]},o={xmin:-r,ymin:-r,xmax:r,ymax:r});return[o,a]},ge=e=>"vertical"===e||"horizontal"===e||"cross"===e||"esriSFSCross"===e||"esriSFSVertical"===e||"esriSFSHorizontal"===e,Ce=e=>e?e.charAt(0).toLowerCase()+e.substr(1):e;function Ie(e,t,r){if(!e.effects||null!=t.geometryEngine)return;if(t.geometryEnginePromise)return void r.push(t.geometryEnginePromise);V(e.effects)&&(t.geometryEnginePromise=B(),r.push(t.geometryEnginePromise),t.geometryEnginePromise.then((e=>t.geometryEngine=e)))}function ke(e){if(!e)return null;let t=null;const{cap:r,color:a,join:o,miterLimit:i,style:s,width:n}=e;return"solid"!==s&&"none"!==s&&"esriSLSSolid"!==s&&"esriSLSNull"!==s&&(t=[{type:"CIMGeometricEffectDashes",dashTemplate:de(s,r),lineDashEnding:"NoConstraint",scaleDash:!0,offsetAlongLine:null}]),{type:"CIMSolidStroke",color:"esriSLSNull"!==s&&"none"!==s?ue(a):[0,0,0,0],capStyle:ce(r),joinStyle:me(o),miterLimit:i,width:n,effects:t}}export{ne as CIMSymbolHelper,se as CIMSymbolInflatedSizeHelper,le as OverrideHelper,ie as getEffectsInflateSize,de as slsDashToTemplateArray,te as symbolToCIM};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import"../../../geometry.js";import{GeometryCursor as e}from"../../../geometry/GeometryCursor.js";import{collectMultipath as t}from"../../../geometry/geometryCursorCollectUtils.js";import{clipCursorToTileExtent as i}from"../CIMEffects.js";import{CurveHelper as s,PIXEL_TOLERANCE as r}from"../CurveHelper.js";import{GeometricEffectOffsetMethod as n}from"../enums.js";import o from"../../../geometry/SpatialReference.js";class m{static local(){return null===m.instance&&(m.instance=new m),m.instance}execute(e,t,i,s,r,n){return new l(e,t,i,s,r,n)}}m.instance=null;class l{constructor(e,t,i,n,o,m){this._inputGeometries=e,this._tileKey=n,this._geometryEngine=o,this._curveHelper=new s,this._size=(void 0!==t.size?t.size:1)*i,this._maxInflateSize=m??0,this._offsetFlattenError=r*i}next(){let s;for(;s=this._inputGeometries.next();){if(0===this._size)return s;if("esriGeometryEnvelope"===s.geometryType)if(this._size>0){const i=e.createEmptyOptimizedCIM(s.geometryType),r=t(s)[0],o=this._curveHelper.offset(r,this._size,n.Rounded,4,this._offsetFlattenError);if(o)return i.pushPath(o),i}else if(this._size<0){const t=s.asJSON();if(Math.min(t.xmax-t.xmin,t.ymax-t.ymin)+2*this._size>0)return e.fromJSONCIM({xmin:t.xmin-this._size,xmax:t.xmax+this._size,ymin:t.ymin-this._size,ymax:t.ymax+this._size})}const r=this._geometryEngine;if(null==r)return null;const m=this._tileKey?i(s,Math.abs(this._maxInflateSize)+1):s;if(!m)continue;const l=r.buffer(o.WebMercator,m.asJSON(),this._size,1);return l?e.fromJSONCIM(l):null}return null}}export{m as EffectBuffer};
5
+ import"../../../geometry.js";import{GeometryCursor as e}from"../../../geometry/GeometryCursor.js";import{collectMultipath as t}from"../../../geometry/geometryCursorCollectUtils.js";import{clipCursorToTileExtent as i}from"../CIMEffects.js";import{CurveHelper as s,PIXEL_TOLERANCE as r}from"../CurveHelper.js";import{GeometricEffectOffsetMethod as n}from"../enums.js";import o from"../../../geometry/SpatialReference.js";class m{static local(){return null===m.instance&&(m.instance=new m),m.instance}execute(e,t,i,s,r,n){return new l(e,t,i,s,r,n)}}m.instance=null;class l{constructor(e,t,i,n,o,m){this._inputGeometries=e,this._tileKey=n,this._geometryEngine=o,this._curveHelper=new s,this._size=(void 0!==t.size?t.size:1)*i,this._maxInflateSize=m*i,this._offsetFlattenError=r*i}next(){let s;for(;s=this._inputGeometries.next();){if(0===this._size)return s;if("esriGeometryEnvelope"===s.geometryType)if(this._size>0){const i=e.createEmptyOptimizedCIM(s.geometryType),r=t(s)[0],o=this._curveHelper.offset(r,this._size,n.Rounded,4,this._offsetFlattenError);if(o)return i.pushPath(o),i}else if(this._size<0){const t=s.asJSON();if(Math.min(t.xmax-t.xmin,t.ymax-t.ymin)+2*this._size>0)return e.fromJSONCIM({xmin:t.xmin-this._size,xmax:t.xmax+this._size,ymin:t.ymin-this._size,ymax:t.ymax+this._size})}const r=this._geometryEngine;if(null==r)return null;const m=this._tileKey?i(s,this._maxInflateSize):s;if(!m)continue;const l=r.buffer(o.WebMercator,m.asJSON(),this._size,1);return l?e.fromJSONCIM(l):null}return null}}export{m as EffectBuffer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import"../../../geometry.js";import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as i}from"../CIMEffects.js";import{GeometricEffectDonutMethod as e}from"../enums.js";import n from"../../../geometry/SpatialReference.js";class s{static local(){return null===s.instance&&(s.instance=new s),s.instance}execute(t,i,e,n,s,m){return new r(t,i,e,n,s,m)}}s.instance=null;class r{constructor(t,i,n,s,r,m){switch(this._inputGeometries=t,this._tileKey=s,this._geometryEngine=r,this._maxInflateSize=m,this._width=(void 0!==i.width?i.width:2)*n,i.method){case e.Mitered:case e.Bevelled:case e.Rounded:case e.TrueBuffer:case e.Square:}this._option=i.option}next(){let e;for(;e=this._inputGeometries.next();){if("esriGeometryEnvelope"===e.geometryType&&this._width>0){const i=e.asJSON();return Math.min(i.xmax-i.xmin,i.ymax-i.ymin)-2*this._width<0?e:t.fromJSONCIM({paths:[[[i.xmin+this._width,i.ymin+this._width],[i.xmax-this._width,i.ymin+this._width],[i.xmax-this._width,i.ymax-this._width],[i.xmin+this._width,i.ymax-this._width],[i.xmin+this._width,i.ymin+this._width]],[[i.xmin,i.ymin],[i.xmin,i.ymax],[i.xmax,i.ymax],[i.xmax,i.ymin],[i.xmin,i.ymin]]]})}if("esriGeometryPolygon"===e.geometryType){if(0===this._width)return e.clone();const t=this._geometryEngine;if(null==t)return null;const s=this._tileKey?i(e,this._width+Math.abs(this._maxInflateSize)+1):e.clone();if(!s)continue;const r=t.buffer(n.WebMercator,s.asJSON(),-this._width,1);if(r)for(const i of r.rings)i&&s.pushPath(i.reverse());return s}}return null}}export{s as EffectDonut};
5
+ import"../../../geometry.js";import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as e}from"../CIMEffects.js";import{GeometricEffectDonutMethod as i}from"../enums.js";import n from"../../../geometry/SpatialReference.js";class s{static local(){return null===s.instance&&(s.instance=new s),s.instance}execute(t,e,i,n,s,m){return new r(t,e,i,n,s,m)}}s.instance=null;class r{constructor(t,e,n,s,r,m){switch(this._inputGeometries=t,this._tileKey=s,this._geometryEngine=r,this._maxInflateSize=m*n,this._width=(void 0!==e.width?e.width:2)*n,e.method){case i.Mitered:case i.Bevelled:case i.Rounded:case i.TrueBuffer:case i.Square:}this._option=e.option}next(){let i;for(;i=this._inputGeometries.next();){if("esriGeometryEnvelope"===i.geometryType&&this._width>0){const e=i.asJSON();return Math.min(e.xmax-e.xmin,e.ymax-e.ymin)-2*this._width<0?i:t.fromJSONCIM({paths:[[[e.xmin+this._width,e.ymin+this._width],[e.xmax-this._width,e.ymin+this._width],[e.xmax-this._width,e.ymax-this._width],[e.xmin+this._width,e.ymax-this._width],[e.xmin+this._width,e.ymin+this._width]],[[e.xmin,e.ymin],[e.xmin,e.ymax],[e.xmax,e.ymax],[e.xmax,e.ymin],[e.xmin,e.ymin]]]})}if("esriGeometryPolygon"===i.geometryType){if(0===this._width)return i.clone();const t=this._geometryEngine;if(null==t)return null;const s=this._tileKey?e(i,this._maxInflateSize):i.clone();if(!s)continue;const r=t.buffer(n.WebMercator,s.asJSON(),-this._width,1);if(r)for(const e of r.rings)e&&s.pushPath(e.reverse());return s}}return null}}export{s as EffectDonut};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import"../../../geometry.js";import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import{collectPath as e}from"../../../geometry/geometryCursorCollectUtils.js";import{isExtent as s}from"../../../geometry/support/jsonUtils.js";import{clipCursorToTileExtent as o}from"../CIMEffects.js";import{CurveHelper as i,PIXEL_TOLERANCE as r}from"../CurveHelper.js";import{GeometricEffectOffsetMethod as n}from"../enums.js";import f from"../../../geometry/SpatialReference.js";class m{static local(){return null===m.instance&&(m.instance=new m),m.instance}execute(t,e,s,o,i,r){return new h(t,e,s,o,i,r)}}m.instance=null;class h{constructor(t,e,s,o,n,f){this._inputGeometries=t,this._tileKey=o,this._geometryEngine=n,this._curveHelper=new i,this._maxInflateSize=f,this._offset=(e.offset??1)*s,this._method=e.method,this._maxInflateSize=f,this._option=e.option,this._offsetFlattenError=r*s}next(){let i;for(;i=this._inputGeometries.next();){if(0===this._offset)return i.clone();if("esriGeometryEnvelope"===i.geometryType){if(this._method===n.Rounded&&this._offset>0){const s=e(i),o=this._curveHelper.offset(s,-this._offset,this._method,4,this._offsetFlattenError);if(o){const e=t.createEmptyOptimizedCIM(i.geometryType);return e.pushPath(o),e}return null}const o=i.asJSON();if(s(o)&&Math.min(o.xmax-o.xmin,o.ymax-o.ymin)+2*this._offset>0)return t.fromJSONCIM({xmin:o.xmin-this._offset,xmax:o.xmax+this._offset,ymin:o.ymin-this._offset,ymax:o.ymax+this._offset})}const r=this._geometryEngine;if(null==r)continue;const m=this._tileKey?o(i,Math.abs(this._maxInflateSize)+1):i.clone();if(!m)continue;const h=r.offset(f.WebMercator,m.asJSON(),-this._offset,1,this._method,4,this._offsetFlattenError);return h?t.fromJSONCIM(h):null}return null}}export{m as EffectOffset};
5
+ import"../../../geometry.js";import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import{collectPath as e}from"../../../geometry/geometryCursorCollectUtils.js";import{isExtent as o}from"../../../geometry/support/jsonUtils.js";import{clipCursorToTileExtent as s}from"../CIMEffects.js";import{CurveHelper as r,PIXEL_TOLERANCE as i}from"../CurveHelper.js";import{GeometricEffectOffsetMethod as n}from"../enums.js";import f from"../../../geometry/SpatialReference.js";class m{static local(){return null===m.instance&&(m.instance=new m),m.instance}execute(t,e,o,s,r,i){return new h(t,e,o,s,r,i)}}m.instance=null;class h{constructor(t,e,o,s,n,f){this._inputGeometries=t,this._tileKey=s,this._geometryEngine=n,this._curveHelper=new r,this._offset=(e.offset??1)*o,this._method=e.method,this._maxInflateSize=f*o,this._option=e.option,this._offsetFlattenError=i*o}next(){let r;for(;r=this._inputGeometries.next();){if(0===this._offset)return r.clone();if("esriGeometryEnvelope"===r.geometryType){if(this._method===n.Rounded&&this._offset>0){const o=e(r),s=this._curveHelper.offset(o,-this._offset,this._method,4,this._offsetFlattenError);if(s){const e=t.createEmptyOptimizedCIM(r.geometryType);return e.pushPath(s),e}return null}const s=r.asJSON();if(o(s)&&Math.min(s.xmax-s.xmin,s.ymax-s.ymin)+2*this._offset>0)return t.fromJSONCIM({xmin:s.xmin-this._offset,xmax:s.xmax+this._offset,ymin:s.ymin-this._offset,ymax:s.ymax+this._offset})}const i=this._geometryEngine;if(null==i)continue;const m=this._tileKey?s(r,this._maxInflateSize):r.clone();if(!m)continue;const h=i.offset(f.WebMercator,m.asJSON(),-this._offset,1,this._method,4,this._offsetFlattenError);return h?t.fromJSONCIM(h):null}return null}}export{m as EffectOffset};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{handlesGroup as r}from"../../../core/handleUtils.js";import{watch as s}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import n from"../../../rest/support/FeatureSet.js";import a from"./FeatureLayerView2D.js";import{toJSONGeometryType as l}from"./support/util.js";import p from"../../layers/StreamLayerView.js";function c(e,t){if(null==e&&null==t)return null;const r={};return null!=t&&(r.geometry=t.toJSON()),null!=e&&(r.where=e),r}let u=class extends(p(a)){constructor(){super(...arguments),this.pipelineConnectionStatus="disconnected",this.pipelineErrorString=null,this._enabledEventTypes=new Set}initialize(){this.addHandles([s((()=>this.layer.customParameters),(e=>this._proxy.updateCustomParameters(e))),this.layer.on("send-message-to-socket",(e=>this._proxy.sendMessageToSocket(e))),this.layer.on("send-message-to-client",(e=>this._proxy.sendMessageToClient(e))),s((()=>this.layer.purgeOptions),(()=>this._update())),s((()=>this.suspended),this._onSuspendedChange.bind(this))],"constructor")}get connectionError(){return this.pipelineErrorString?new t("stream-controller",this.pipelineErrorString):null}on(e,t){if(Array.isArray(e))return r(e.map((e=>this.on(e,t))));const s=["data-received","message-received"].includes(e);s&&(this._enabledEventTypes.add(e),this._proxy.enableEvent(e,!0));const i=super.on(e,t),o=this;return{remove(){i.remove(),s&&(o._proxy.closed||o.hasEventListener(e)||o._proxy.enableEvent(e,!1))}}}queryLatestObservations(e,r){if(!(this.layer.timeInfo?.endField||this.layer.timeInfo?.startField||this.layer.timeInfo?.trackIdField))throw new t("streamlayer-no-timeField","queryLatestObservation can only be used with services that define a TrackIdField");return this._proxy.queryLatestObservations(this._cleanUpQuery(e),r).then((e=>{const t=n.fromJSON(e);return t.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),t}))}detach(){super.detach(),this.pipelineConnectionStatus="disconnected"}get _streamConnectionStatus(){return this.pipelineConnectionStatus}_doPause(){this._proxy?.pauseStream()}_doResume(){this._proxy?.resumeStream()}_createClientOptions(){return{...super._createClientOptions(),setProperty:e=>{this.set(e.propertyName,e.value)}}}_createTileRendererHash(e){const t=`${JSON.stringify(this.layer.purgeOptions)}.${JSON.stringify(c(this.layer.definitionExpression,this.layer.geometryDefinition))})`;return super._createTileRendererHash(e)+t}async _createServiceOptions(){const e=this.layer,{objectIdField:t}=e,r=e.fields.map((e=>e.toJSON())),s=l(e.geometryType),i=e.timeInfo&&e.timeInfo.toJSON()||null,o=e.spatialReference?e.spatialReference.toJSON():null;return{type:"stream",fields:r,geometryType:s,objectIdField:t,timeInfo:i,source:this.layer.parsedUrl,serviceFilter:c(this.layer.definitionExpression,this.layer.geometryDefinition),purgeOptions:this.layer.purgeOptions.toJSON(),enabledEventTypes:Array.from(this._enabledEventTypes.values()),spatialReference:o,maxReconnectionAttempts:this.layer.maxReconnectionAttempts,maxReconnectionInterval:this.layer.maxReconnectionInterval,updateInterval:this.layer.updateInterval,customParameters:e.customParameters}}};e([i()],u.prototype,"pipelineConnectionStatus",void 0),e([i()],u.prototype,"pipelineErrorString",void 0),e([i({readOnly:!0})],u.prototype,"connectionError",null),e([i({readOnly:!0})],u.prototype,"_streamConnectionStatus",null),u=e([o("esri.views.2d.layers.StreamLayerView2D")],u);const y=u;export{y as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{handlesGroup as r}from"../../../core/handleUtils.js";import{watch as s}from"../../../core/reactiveUtils.js";import{property as i}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import n from"../../../rest/support/FeatureSet.js";import a from"./FeatureLayerView2D.js";import{toJSONGeometryType as l}from"./support/util.js";import p from"../../layers/StreamLayerView.js";function c(e,t){if(null==e&&null==t)return null;const r={};return null!=t&&(r.geometry=t.toJSON()),null!=e&&(r.where=e),r}let u=class extends(p(a)){constructor(){super(...arguments),this.pipelineConnectionStatus="disconnected",this.pipelineErrorString=null,this._enabledEventTypes=new Set}initialize(){this.addHandles([s((()=>this.layer.customParameters),(e=>this._proxy.updateCustomParameters(e))),this.layer.on("send-message-to-socket",(e=>this._proxy.sendMessageToSocket(e))),this.layer.on("send-message-to-client",(e=>this._proxy.sendMessageToClient(e))),s((()=>this.layer.purgeOptions),(()=>this._update())),s((()=>this.suspended),this._onSuspendedChange.bind(this))],"constructor")}get connectionError(){return this.pipelineErrorString?new t("stream-controller",this.pipelineErrorString):null}on(e,t){if(Array.isArray(e))return r(e.map((e=>this.on(e,t))));const s=["data-received","message-received"].includes(e);s&&(this._enabledEventTypes.add(e),this._proxy.enableEvent(e,!0));const i=super.on(e,t),o=this;return{remove(){i.remove(),s&&(o._proxy.closed||o.hasEventListener(e)||o._proxy.enableEvent(e,!1))}}}queryLatestObservations(e,r){if(!(this.layer.timeInfo?.endField||this.layer.timeInfo?.startField||this.layer.timeInfo?.trackIdField))throw new t("streamlayer-no-timeField","queryLatestObservation can only be used with services that define a TrackIdField");return this._proxy.queryLatestObservations(this._cleanUpQuery(e),r).then((e=>{const t=n.fromJSON(e);return t.features.forEach((e=>{e.layer=this.layer,e.sourceLayer=this.layer})),t}))}detach(){super.detach(),this.pipelineConnectionStatus="disconnected"}get _streamConnectionStatus(){return this.pipelineConnectionStatus}_doPause(){this._proxy?.pauseStream()}_doResume(){this._proxy?.resumeStream()}_createClientOptions(){return{...super._createClientOptions(),setProperty:e=>{this.set(e.propertyName,e.value)}}}_createTileRendererHash(e){const t=`${JSON.stringify(this.layer.purgeOptions)}.${JSON.stringify(c(this.layer.definitionExpression,this.layer.geometryDefinition))})`;return super._createTileRendererHash(e)+t}async _createServiceOptions(){const e=this.layer,{objectIdField:t}=e,r=e.fields.map((e=>e.toJSON())),s=l(e.geometryType),i=e.timeInfo&&e.timeInfo.toJSON()||null,o=e.spatialReference?e.spatialReference.toJSON():null;return{type:"stream",isPaused:this._isUserPaused,fields:r,geometryType:s,objectIdField:t,timeInfo:i,source:this.layer.parsedUrl,serviceFilter:c(this.layer.definitionExpression,this.layer.geometryDefinition),purgeOptions:this.layer.purgeOptions.toJSON(),enabledEventTypes:Array.from(this._enabledEventTypes.values()),spatialReference:o,maxReconnectionAttempts:this.layer.maxReconnectionAttempts,maxReconnectionInterval:this.layer.maxReconnectionInterval,updateInterval:this.layer.updateInterval,customParameters:e.customParameters}}};e([i()],u.prototype,"pipelineConnectionStatus",void 0),e([i()],u.prototype,"pipelineErrorString",void 0),e([i({readOnly:!0})],u.prototype,"connectionError",null),e([i({readOnly:!0})],u.prototype,"_streamConnectionStatus",null),u=e([o("esri.views.2d.layers.StreamLayerView2D")],u);const y=u;export{y as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{diff as e,hasDiff as s}from"../../../../core/accessorSupport/diffUtils.js";import{createRendererExpression as t}from"../../../../support/arcadeOnDemand.js";import i from"../../arcade/callExpressionWithCursor.js";const a=import("../../../../layers/support/labelFormatUtils.js");class r{constructor(e,s){this._canCacheExpressionValue=!1,this._sourceInfo=e,this._storage=s,this._bitsets={computed:s.getBitset(s.createBitset())}}get storage(){return this._storage}invalidate(){this._bitsets.computed.clear()}async updateSchema(t,i){const a=e(this._schema,i);if(this._schema=i,!i||null==a||!s(a,"attributes"))return;has("esri-2d-update-debug")&&console.debug("Applying Update - Store:",a),this._bitsets.computed.clear(),t.targets[i.name]=!0;const r=i.attributes,o=[],c=[];for(const e in r){const s=r[e];switch(s.type){case"field":break;case"expression":o.push(this._createArcadeComputedField(s));break;case"label-expression":o.push(this._createLabelArcadeComputedField(s));break;case"statistic":c.push(s)}}this._computedFields=await Promise.all(o),this._canCacheExpressionValue=!this._computedFields.some((e=>"expression"===e.type&&null!=e.expression&&e.expression.referencesScale())),this._statisticFields=c}setComputedAttributes(e,s,t,i){const a=this._bitsets.computed;if(!this._canCacheExpressionValue||!a.has(t)){a.set(t);for(const a of this._computedFields){const r=this._evaluateField(s,a,i);switch(a.resultType){case"numeric":e.setComputedNumericAtIndex(t,a.fieldIndex,r);break;case"string":e.setComputedStringAtIndex(t,a.fieldIndex,r)}}}}async _createArcadeComputedField(e){const s=this._sourceInfo.spatialReference,i=this._sourceInfo.fieldsIndex;return{...e,expression:await t(e.valueExpression,s,i)}}async _createLabelArcadeComputedField(e){const s=this._sourceInfo.spatialReference,t=this._sourceInfo.fieldsIndex,{createLabelFunction:i}=await a,r=await i(e.label,t,s);return{...e,builder:r}}_evaluateField(e,s,t){switch(s.type){case"label-expression":{const t=e.readArcadeFeature();return s.builder.evaluate(t)||""}case"expression":{const{expression:a}=s;return i(a,e,{$view:{scale:t}})}}}}export{r as Store2D};
5
+ import has from"../../../../core/has.js";import{diff as e,hasDiff as s}from"../../../../core/accessorSupport/diffUtils.js";import{createRendererExpression as t}from"../../../../support/arcadeOnDemand.js";import i from"../../arcade/callExpressionWithCursor.js";class a{constructor(e,s){this._canCacheExpressionValue=!1,this._sourceInfo=e,this._storage=s,this._bitsets={computed:s.getBitset(s.createBitset())}}get storage(){return this._storage}invalidate(){this._bitsets.computed.clear()}async updateSchema(t,i){const a=e(this._schema,i);if(this._schema=i,!i||null==a||!s(a,"attributes"))return;has("esri-2d-update-debug")&&console.debug("Applying Update - Store:",a),this._bitsets.computed.clear(),t.targets[i.name]=!0;const r=i.attributes,o=[],c=[];for(const e in r){const s=r[e];switch(s.type){case"field":break;case"expression":o.push(this._createArcadeComputedField(s));break;case"label-expression":o.push(this._createLabelArcadeComputedField(s));break;case"statistic":c.push(s)}}this._computedFields=await Promise.all(o),this._canCacheExpressionValue=!this._computedFields.some((e=>"expression"===e.type&&null!=e.expression&&e.expression.referencesScale())),this._statisticFields=c}setComputedAttributes(e,s,t,i){const a=this._bitsets.computed;if(!this._canCacheExpressionValue||!a.has(t)){a.set(t);for(const a of this._computedFields){const r=this._evaluateField(s,a,i);switch(a.resultType){case"numeric":e.setComputedNumericAtIndex(t,a.fieldIndex,r);break;case"string":e.setComputedStringAtIndex(t,a.fieldIndex,r)}}}}async _createArcadeComputedField(e){const s=this._sourceInfo.spatialReference,i=this._sourceInfo.fieldsIndex;return{...e,expression:await t(e.valueExpression,s,i)}}async _createLabelArcadeComputedField(e){const s=this._sourceInfo.spatialReference,t=this._sourceInfo.fieldsIndex,{createLabelFunction:i}=await import("../../../../layers/support/labelFormatUtils.js"),a=await i(e.label,t,s);return{...e,builder:a}}_evaluateField(e,s,t){switch(s.type){case"label-expression":{const t=e.readArcadeFeature();return s.builder.evaluate(t)||""}case"expression":{const{expression:a}=s;return i(a,e,{$view:{scale:t}})}}}}export{a as Store2D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{handlesGroup as e}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{r as t}from"../../../../../chunks/rbush.js";import{convertFromFeature as s,quantizeOptimizedGeometry as n,quantizeX as i,quantizeY as r}from"../../../../../layers/graphics/featureConversionUtils.js";import o from"../../../../../layers/graphics/OptimizedGeometry.js";import{StreamFeatureManager as a}from"../../../../../layers/graphics/data/StreamFeatureManager.js";import{createConnection as d}from"../../../../../layers/graphics/sources/connections/createConnection.js";import{DataTileSource as c}from"./DataTileSource.js";import{StreamConnectionState as h}from"./StreamConnectionState.js";import{FeatureSetReaderJSON as u}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as l}from"../support/UpdateToken.js";const p=2500;function _(e,t){const s=e.weakClone();if(null!=e.geometry){const n=i(t,e.geometry.coords[0]),a=r(t,e.geometry.coords[1]);s.geometry=new o([],[n,a])}return s}function m(e){return"esriGeometryPoint"===e?_:(t,s)=>{const i=t.weakClone(),r=new o,a=!1,d=!1,c=n(r,t.geometry,a,d,e,s,!1,!1);return i.geometry=c,i}}function g(e){return"esriGeometryPoint"===e?e=>null!=e.geometry?{minX:e.geometry.coords[0],minY:e.geometry.coords[1],maxX:e.geometry.coords[0],maxY:e.geometry.coords[1]}:{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}:e=>{let t=1/0,s=1/0,n=-1/0,i=-1/0;return null!=e.geometry&&e.geometry.forEachVertex(((e,r)=>{t=Math.min(t,e),s=Math.min(s,r),n=Math.max(n,e),i=Math.max(i,r)})),{minX:t,minY:s,maxX:n,maxY:i}}}function y(e,s){const n=t(9,g(s));return n.load(e),n}function f(e,t){return e.search({minX:t.bounds[0],minY:t.bounds[1],maxX:t.bounds[2],maxY:t.bounds[3]})}class v{constructor(e,t){this.onUpdate=e,this._geometryType=t,this._objectIdToFeature=new Map,this._index=null}get _features(){const e=[];return this._objectIdToFeature.forEach((t=>e.push(t))),e}add(e){this._objectIdToFeature.set(e.objectId,e),this._index=null}get(e){return this._objectIdToFeature.has(e)?this._objectIdToFeature.get(e):null}forEach(e){this._objectIdToFeature.forEach(e)}search(e){return this._index||(this._index=y(this._features,this._geometryType)),f(this._index,e)}clear(){this._index=null,this._objectIdToFeature.clear()}removeById(e){const t=this._objectIdToFeature.get(e);return t?(this._objectIdToFeature.delete(e),this._index=null,t):null}update(e,t){this.onUpdate(e,t)}get size(){return this._objectIdToFeature.size}}class I extends c{constructor(t){super(t),this.type="stream",this._updateIntervalId=0,this._level=0,this._isPaused=!1,this._updateInfo={websocket:0,client:0},this._inUpdate=!1;const{outSR:s}=t,{geometryType:n,objectIdField:i,timeInfo:r,purgeOptions:o,source:c,spatialReference:u,serviceFilter:l,maxReconnectionAttempts:_,maxReconnectionInterval:g,updateInterval:y,customParameters:f,enabledEventTypes:I}=t.serviceInfo,b=new v(this._onUpdate.bind(this),n),T=new a(b,i,r,o),j=d(c,u,s,n,l,_,g,f??{});this._connectionState=new h({connection:j}),this._store=b,this._manager=T,this._connection=j,this._quantize=m(n),this._enabledEventTypes=new Set(I),this._handlesGroup=e([this._connection.on("data-received",(e=>this._onFeature(e))),this._connection.on("message-received",(e=>this._onWebSocketMessage(e)))]),this._initUpdateInterval=()=>{let e=performance.now();this._updateIntervalId=setInterval((()=>{const s=performance.now(),n=s-e;if(n>p){e=s;const t=Math.round(this._updateInfo.client/(n/1e3)),i=Math.round(this._updateInfo.websocket/(n/1e3));this._updateInfo.client=0,this._updateInfo.websocket=0,this.events.emit("updateRate",{client:t,websocket:i})}t.canAcceptRequest()&&!this._inUpdate&&this._manager.checkForUpdates()}),y)},this._initUpdateInterval()}destroy(){super.destroy(),this._clearUpdateInterval(),this._connection.destroy(),this._handlesGroup?.remove()}_fetchDataTile(){}get connectionStatus(){return this._connectionState.connectionStatus}get errorString(){return this._connectionState.errorString}updateCustomParameters(e){this._connection.updateCustomParameters(e)}pauseStream(){this._isPaused||(this._isPaused=!0,this._clearUpdateInterval())}resumeStream(){this._isPaused&&(this._isPaused=!1,this._initUpdateInterval())}sendMessageToSocket(e){this._connection.sendMessageToSocket(e)}sendMessageToClient(e){this._isPaused&&"type"in e&&"clear"===e.type?(this._store.forEach((e=>this._manager.removeById(e.objectId))),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,clear:!0,end:!0})}))):this._connection.sendMessageToClient(e)}enableEvent(e,t){t?this._enabledEventTypes.add(e):this._enabledEventTypes.delete(e)}subscribe(e,t){super.subscribe(e,t);const s=this._subscriptions.get(e.id);s.resolve(),this._level=e.level;const n=this._getTileFeatures(e);this._onMessage({type:"append",id:e.key.id,addOrUpdate:n,end:!0}),s.didSend=!0}unsubscribe(e){super.unsubscribe(e)}*readers(e){const t=this._subscriptions.get(e),{tile:s}=t;yield this._getTileFeatures(s)}createTileQuery(e){throw new Error("Service does not support tile queries")}async resend(){this._subscriptions.forEach((e=>{const{tile:t}=e,s={type:"append",id:t.id,addOrUpdate:this._getTileFeatures(t),end:!0};this._onMessage(s)}))}_getTileFeatures(e){const t=this._store.search(e).map((t=>this._quantize(t,e.transform)));return u.fromOptimizedFeatures(t,this._serviceInfo,e.transform)}_onWebSocketMessage(e){if(this._enabledEventTypes.has("message-received")&&this.events.emit("message-received",e),"type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this._manager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this._manager.removeByTrackId(t);break;case"clear":this._store.forEach((e=>this._manager.removeById(e.objectId)))}}_onFeature(e){this._updateInfo.websocket++;try{this._enabledEventTypes.has("data-received")&&this.events.emit("data-received",e);const t=s(e,this._serviceInfo.geometryType,!1,!1,this._serviceInfo.objectIdField);this._manager.add(t)}catch(t){}}_clearUpdateInterval(){clearInterval(this._updateIntervalId),this._updateIntervalId=0}async _onUpdate(e,t){this._inUpdate=!0;try{null!=e&&(this._updateInfo.client+=e.length),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,clear:!0,end:!1})}));const t=[];this._subscriptions.forEach(((e,s)=>{if(!e.didSend||e.tile.level!==this._level)return;const n=e.tile,i={type:"append",id:s,addOrUpdate:this._getTileFeatures(n),remove:[],end:!1,status:l.empty()};e.requests.stream.enqueue(i),t.push(this._onMessage(i))})),await Promise.all(t),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,end:!0})}))}catch{}this._inUpdate=!1}}export{I as StreamSource};
5
+ import{handlesGroup as e}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{r as t}from"../../../../../chunks/rbush.js";import{convertFromFeature as s,quantizeOptimizedGeometry as i,quantizeX as n,quantizeY as r}from"../../../../../layers/graphics/featureConversionUtils.js";import o from"../../../../../layers/graphics/OptimizedGeometry.js";import{StreamFeatureManager as a}from"../../../../../layers/graphics/data/StreamFeatureManager.js";import{createConnection as d}from"../../../../../layers/graphics/sources/connections/createConnection.js";import{DataTileSource as c}from"./DataTileSource.js";import{StreamConnectionState as h}from"./StreamConnectionState.js";import{FeatureSetReaderJSON as u}from"../support/FeatureSetReaderJSON.js";import{UpdateToken as l}from"../support/UpdateToken.js";const p=2500;function _(e,t){const s=e.weakClone();if(null!=e.geometry){const i=n(t,e.geometry.coords[0]),a=r(t,e.geometry.coords[1]);s.geometry=new o([],[i,a])}return s}function m(e){return"esriGeometryPoint"===e?_:(t,s)=>{const n=t.weakClone(),r=new o,a=!1,d=!1,c=i(r,t.geometry,a,d,e,s,!1,!1);return n.geometry=c,n}}function g(e){return"esriGeometryPoint"===e?e=>null!=e.geometry?{minX:e.geometry.coords[0],minY:e.geometry.coords[1],maxX:e.geometry.coords[0],maxY:e.geometry.coords[1]}:{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}:e=>{let t=1/0,s=1/0,i=-1/0,n=-1/0;return null!=e.geometry&&e.geometry.forEachVertex(((e,r)=>{t=Math.min(t,e),s=Math.min(s,r),i=Math.max(i,e),n=Math.max(n,r)})),{minX:t,minY:s,maxX:i,maxY:n}}}function y(e,s){const i=t(9,g(s));return i.load(e),i}function f(e,t){return e.search({minX:t.bounds[0],minY:t.bounds[1],maxX:t.bounds[2],maxY:t.bounds[3]})}class v{constructor(e,t){this.onUpdate=e,this._geometryType=t,this._objectIdToFeature=new Map,this._index=null}get _features(){const e=[];return this._objectIdToFeature.forEach((t=>e.push(t))),e}add(e){this._objectIdToFeature.set(e.objectId,e),this._index=null}get(e){return this._objectIdToFeature.has(e)?this._objectIdToFeature.get(e):null}forEach(e){this._objectIdToFeature.forEach(e)}search(e){return this._index||(this._index=y(this._features,this._geometryType)),f(this._index,e)}clear(){this._index=null,this._objectIdToFeature.clear()}removeById(e){const t=this._objectIdToFeature.get(e);return t?(this._objectIdToFeature.delete(e),this._index=null,t):null}update(e,t){this.onUpdate(e,t)}get size(){return this._objectIdToFeature.size}}class I extends c{constructor(t){super(t),this.type="stream",this._updateIntervalId=0,this._level=0,this._isPaused=!1,this._updateInfo={websocket:0,client:0},this._inUpdate=!1;const{outSR:s}=t,{geometryType:i,objectIdField:n,timeInfo:r,purgeOptions:o,source:c,spatialReference:u,serviceFilter:l,maxReconnectionAttempts:_,maxReconnectionInterval:g,updateInterval:y,customParameters:f,enabledEventTypes:I}=t.serviceInfo,b=new v(this._onUpdate.bind(this),i),T=new a(b,n,r,o),j=d(c,u,s,i,l,_,g,f??{});this._connectionState=new h({connection:j}),this._store=b,this._manager=T,this._connection=j,this._quantize=m(i),this._enabledEventTypes=new Set(I),this._handlesGroup=e([this._connection.on("data-received",(e=>this._onFeature(e))),this._connection.on("message-received",(e=>this._onWebSocketMessage(e)))]),this._initUpdateInterval=()=>{let e=performance.now();this._updateIntervalId=setInterval((()=>{const s=performance.now(),i=s-e;if(i>p){e=s;const t=Math.round(this._updateInfo.client/(i/1e3)),n=Math.round(this._updateInfo.websocket/(i/1e3));this._updateInfo.client=0,this._updateInfo.websocket=0,this.events.emit("updateRate",{client:t,websocket:n})}t.canAcceptRequest()&&!this._inUpdate&&this._manager.checkForUpdates()}),y)},this._isPaused=t.serviceInfo.isPaused,this._isPaused||this._initUpdateInterval()}destroy(){super.destroy(),this._clearUpdateInterval(),this._connection.destroy(),this._handlesGroup?.remove()}_fetchDataTile(){}get connectionStatus(){return this._connectionState.connectionStatus}get errorString(){return this._connectionState.errorString}updateCustomParameters(e){this._connection.updateCustomParameters(e)}pauseStream(){this._isPaused||(this._isPaused=!0,this._clearUpdateInterval())}resumeStream(){this._isPaused&&(this._isPaused=!1,this._initUpdateInterval())}sendMessageToSocket(e){this._connection.sendMessageToSocket(e)}sendMessageToClient(e){this._isPaused&&"type"in e&&"clear"===e.type?(this._store.clear(),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,clear:!0,end:!0})}))):this._connection.sendMessageToClient(e)}enableEvent(e,t){t?this._enabledEventTypes.add(e):this._enabledEventTypes.delete(e)}subscribe(e,t){super.subscribe(e,t);const s=this._subscriptions.get(e.id);s.resolve(),this._level=e.level;const i=this._getTileFeatures(e);this._onMessage({type:"append",id:e.key.id,addOrUpdate:i,end:!0}),s.didSend=!0}unsubscribe(e){super.unsubscribe(e)}*readers(e){const t=this._subscriptions.get(e),{tile:s}=t;yield this._getTileFeatures(s)}createTileQuery(e){throw new Error("Service does not support tile queries")}async resend(){this._subscriptions.forEach((e=>{const{tile:t}=e,s={type:"append",id:t.id,addOrUpdate:this._getTileFeatures(t),end:!0};this._onMessage(s)}))}_getTileFeatures(e){const t=this._store.search(e).map((t=>this._quantize(t,e.transform)));return u.fromOptimizedFeatures(t,this._serviceInfo,e.transform)}_onWebSocketMessage(e){if(this._enabledEventTypes.has("message-received")&&this.events.emit("message-received",e),"type"in e)switch(e.type){case"delete":if(e.objectIds)for(const t of e.objectIds)this._manager.removeById(t);if(e.trackIds)for(const t of e.trackIds)this._manager.removeByTrackId(t);break;case"clear":this._store.forEach((e=>this._manager.removeById(e.objectId)))}}_onFeature(e){this._updateInfo.websocket++;try{this._enabledEventTypes.has("data-received")&&this.events.emit("data-received",e);const t=s(e,this._serviceInfo.geometryType,!1,!1,this._serviceInfo.objectIdField);this._manager.add(t)}catch(t){}}_clearUpdateInterval(){clearInterval(this._updateIntervalId),this._updateIntervalId=0}async _onUpdate(e,t){this._inUpdate=!0;try{null!=e&&(this._updateInfo.client+=e.length),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,clear:!0,end:!1})}));const t=[];this._subscriptions.forEach(((e,s)=>{if(!e.didSend||e.tile.level!==this._level)return;const i=e.tile,n={type:"append",id:s,addOrUpdate:this._getTileFeatures(i),remove:[],end:!1,status:l.empty()};e.requests.stream.enqueue(n),t.push(this._onMessage(n))})),await Promise.all(t),this._subscriptions.forEach(((e,t)=>{e.didSend&&e.tile.level===this._level&&this._onMessage({type:"append",id:t,addOrUpdate:null,end:!0})}))}catch{}this._inUpdate=!1}}export{I as StreamSource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import{a as e}from"../../../chunks/vec2f64.js";import{c as r}from"../../../chunks/vec3f64.js";import{c as i}from"../../../chunks/vec4f64.js";import{C as t}from"../../../chunks/ChapmanAtmosphere.glsl.js";import{NoParameters as s}from"../webgl-engine/core/shaderModules/interfaces.js";import{ReloadableShaderModule as n}from"../webgl-engine/core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as o}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{Default3D as a}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{Program as h}from"../webgl-engine/lib/Program.js";import{BlendFactor as c,CompareFunction as l}from"../../webgl/enums.js";import{makePipelineState as m,simpleBlendingParams as d,defaultColorWriteParams as g,separateBlendingParams as u}from"../../webgl/renderState.js";class f extends s{constructor(){super(...arguments),this.heightParameters=i(),this.radii=e(),this.innerFadeDistance=0,this.altitudeFade=0,this.hazeStrength=1,this.renderScale=e(),this.backgroundColor=r()}}class p extends o{initializeProgram(e){return new h(e.rctx,p.shader.get().build(this.configuration),a)}initializePipeline(){return this.configuration.reduced?m({blending:d(c.ONE,c.ZERO),depthTest:{func:l.ALWAYS},colorWrite:g}):this.configuration.haze?m({blending:u(c.ONE,c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ONE),colorWrite:g}):m({blending:d(c.ONE,c.ONE_MINUS_SRC_ALPHA),depthTest:{func:l.LEQUAL},colorWrite:g})}}p.shader=new n(t,(()=>import("./ChapmanAtmosphere.glsl.js")));export{f as ChapmanAtmospherePassParameters,p as ChapmanAtmosphereTechnique};
5
+ import{a as e}from"../../../chunks/vec2f64.js";import{c as r}from"../../../chunks/vec3f64.js";import{c as i}from"../../../chunks/vec4f64.js";import{C as t}from"../../../chunks/ChapmanAtmosphere.glsl.js";import{NoParameters as s}from"../webgl-engine/core/shaderModules/interfaces.js";import{ReloadableShaderModule as n}from"../webgl-engine/core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as o}from"../webgl-engine/core/shaderTechnique/ShaderTechnique.js";import{Default3D as a}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{Program as h}from"../webgl-engine/lib/Program.js";import{BlendFactor as c,CompareFunction as l}from"../../webgl/enums.js";import{makePipelineState as m,simpleBlendingParams as d,defaultColorWriteParams as g,separateBlendingParams as u}from"../../webgl/renderState.js";class f extends s{constructor(){super(...arguments),this.heightParameters=i(),this.radii=e(),this.innerFadeDistance=0,this.altitudeFade=0,this.hazeStrength=1,this.renderScale=e(),this.backgroundColor=r()}}class p extends o{initializeProgram(e){return new h(e.rctx,p.shader.get().build(this.configuration),a)}initializePipeline(){return this.configuration.reduced?m({blending:d(c.ONE,c.ZERO),depthTest:{func:l.ALWAYS},colorWrite:g}):this.configuration.haze?m({blending:u(c.ONE,c.ZERO,c.ONE_MINUS_SRC_COLOR,c.ONE),colorWrite:g}):m({blending:d(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA),depthTest:{func:l.LEQUAL},colorWrite:g})}}p.shader=new n(t,(()=>import("./ChapmanAtmosphere.glsl.js")));export{f as ChapmanAtmospherePassParameters,p as ChapmanAtmosphereTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.27/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Evented.js";import{s as t,a as r,g as i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{g as n,c as a}from"../../../../chunks/vec4.js";import{f as o,c as l}from"../../../../chunks/vec4f32.js";import{projectBuffer as h}from"../../../../geometry/projection.js";import{expandWithBuffer as c}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as d}from"../../../../geometry/support/DoubleArray.js";import{makeDehydratedPoint as p}from"../../../../layers/graphics/dehydratedFeatures.js";import{getGeometryEffectiveElevationMode as u}from"../../../../support/elevationInfoUtils.js";import m from"../../../../symbols/support/ElevationInfo.js";import{EngineVisualElement as _}from"./EngineVisualElement.js";import{LaserlineVisualElement as f}from"./LaserlineVisualElement.js";import{ElevationContext as g}from"../../layers/graphics/ElevationContext.js";import{createGeometry as y}from"../../support/engineContent/line.js";import{geometryToRenderInfoDraped as O,geometryToRenderInfo as v}from"../../support/renderInfoUtils/line.js";import{RenderOccludedFlag as R}from"../../webgl-engine/lib/Material.js";import{RenderGeometry as C}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as b}from"../../webgl-engine/lib/VertexAttribute.js";import{RibbonLineMaterial as w}from"../../webgl-engine/materials/RibbonLineMaterial.js";class j extends _{constructor(t){super(t),this._attachmentOrigin=p(0,0,0,null),this._attachmentOriginDirty=!0,this.events=new e,this._geometry=null,this._width=1,this._color=o(1,0,1,1),this._innerWidth=0,this._innerColor=o(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._falloff=0,this._elevationInfo=null,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=R.OccludeAndTransparentStencil,this._attachmentOrigin.spatialReference=t.view.spatialReference,this._laserline=new f({view:t.view}),this.applyProps(t),this.attached=t.attached??!0}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:e=>this._destroyExternalResources(e),recreateGeometry:(e,t)=>{e.geometries.length=0,this._recreateGeometry(t,e.material,e.geometries)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:e=>this._destroyExternalResources(e),recreateGeometry:e=>{e.geometries=this._createRenderGeometriesDraped(e.material),this._attachmentOriginChanged()}}}get _laserlineAttached(){return this.attached&&this.visible&&null!=this._laserlineStyle&&!this.isDraped&&this.laserlineEnabled}onAttachedChange(e){this._laserline.attached=this._laserlineAttached,e&&this._attachmentOriginChanged()}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){n(e,this._color)||(a(this._color,e),this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){n(e,this._innerColor)||(a(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){const t=null!=e!=(null!=this._stipplePattern);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){e&&this._stippleOffColor&&n(e,this._stippleOffColor)||(this._stippleOffColor=e?l(e):null,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,null!=e&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get attachmentOrigin(){if(!this._attachmentOriginDirty)return this._attachmentOrigin;const e=this.object3dResources.resources?.geometries;if(!e||0===e.length)return null;t(E,0,0,0);let s=0;for(const t of e)t.computeAttachmentOrigin(P)&&(r(E,E,P),s++);return 0===s?null:(i(E,E,1/s),this.view.renderCoordsHelper.fromRenderCoords(E,this._attachmentOrigin),this._attachmentOriginDirty=!1,this._attachmentOrigin)}_updateMaterial(){null!=this.object3dResources.resources&&this.object3dResources.resources.material.setParameters(this._materialParameters),null!=this.drapedResources.resources&&this.drapedResources.resources.material.setParameters(this._materialParameters)}get _isClosed(){return null!=this.geometry&&"polygon"===this.geometry.type}get _materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:!1,isClosed:this._isClosed,falloff:this._falloff,innerColor:this._innerColor,innerWidth:this._innerWidth,join:"round",hasPolygonOffset:!0,renderOccluded:this._normalizedRenderOccluded}}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===R.OccludeAndTransparentStencil?R.OccludeAndTransparent:this._renderOccluded}_recreateGeometry(e,t,r){this._createRenderGeometries(t,r);for(const i of r)e.addGeometry(i);this._attachmentOriginChanged()}_attachmentOriginChanged(){this._attachmentOriginDirty=!0,this.events.emit("attachment-origin-changed")}_destroyExternalResources(e){e.geometries=[],e.material.dispose()}_createObject3DResources(e){const t=new w(this._materialParameters),r=new Array;return this._recreateGeometry(e,t,r),{material:t,geometries:r,forEach:e=>{e(t),r.forEach(e)}}}_createDrapedResources(){const e=new w(this._materialParameters);return{material:e,geometries:this._createRenderGeometriesDraped(e)}}_createRenderGeometriesDraped(e){const t=this.geometry;if(null==t||null==this.view.basemapTerrain.spatialReference)return[];const r=O(t,this.view.basemapTerrain.spatialReference),i=[];for(const{position:s}of r.lines){const t={overlayInfo:{spatialReference:this.view.basemapTerrain.spatialReference,renderCoordsHelper:this.view.renderCoordsHelper},attributeData:{position:s},removeDuplicateStartEnd:this._isClosed};i.push(new C(y(e,t)))}return i}calculateMapBounds(e){if(null==this.object3dResources.resources)return!1;const t=this.view.renderCoordsHelper;for(const r of this.object3dResources.resources.geometries){const i=r.vertexAttributes.get(b.POSITION),s=d(i.data.length);h(i.data,t.spatialReference,0,s,this.view.spatialReference,0,i.data.length/3),c(e,s)}return!0}_createRenderGeometries(e,t){const r=this.geometry;if(null==r)return;const i=v(r,this.view.elevationProvider,this.view.renderCoordsHelper,g.fromElevationInfo(this.elevationInfo??new m({mode:u(r,null)}))),s=new Array;for(const{position:n,mapPositions:a}of i.lines){const r={mapPositions:a,attributeData:{position:n},removeDuplicateStartEnd:this._isClosed};t.push(y(e,r)),s.push(n)}this._laserline.pathVerticalPlane=s}}const P=s(),E=s();export{j as OutlineVisualElement};
5
+ import e from"../../../../core/Evented.js";import{s as t,a as r,g as i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{g as n,c as a}from"../../../../chunks/vec4.js";import{f as o,c as l}from"../../../../chunks/vec4f32.js";import{projectBuffer as h}from"../../../../geometry/projection.js";import{expandWithBuffer as c}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as d}from"../../../../geometry/support/DoubleArray.js";import{makeDehydratedPoint as u}from"../../../../layers/graphics/dehydratedFeatures.js";import{getGeometryEffectiveElevationMode as p}from"../../../../support/elevationInfoUtils.js";import m from"../../../../symbols/support/ElevationInfo.js";import{EngineVisualElement as _}from"./EngineVisualElement.js";import{LaserlineVisualElement as f}from"./LaserlineVisualElement.js";import{ElevationContext as g}from"../../layers/graphics/ElevationContext.js";import{createGeometry as y}from"../../support/engineContent/line.js";import{geometryToRenderInfoDraped as O,geometryToRenderInfo as C}from"../../support/renderInfoUtils/line.js";import{RenderOccludedFlag as R}from"../../webgl-engine/lib/Material.js";import{RenderGeometry as v}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as b}from"../../webgl-engine/lib/VertexAttribute.js";import{RibbonLineMaterial as w}from"../../webgl-engine/materials/RibbonLineMaterial.js";class j extends _{constructor(t){super(t),this._attachmentOrigin=u(0,0,0,null),this._attachmentOriginDirty=!0,this.events=new e,this._geometry=null,this._width=1,this._color=o(1,0,1,1),this._innerWidth=0,this._innerColor=o(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._falloff=0,this._elevationInfo=null,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=R.OccludeAndTransparentStencil,this._attachmentOrigin.spatialReference=t.view.spatialReference,this._laserline=new f({view:t.view}),this.applyProps(t),this.attached=t.attached??!0}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:e=>this._destroyExternalResources(e),recreateGeometry:(e,t)=>{e.geometries.length=0,this._recreateGeometry(t,e.material,e.geometries)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:e=>this._destroyExternalResources(e),recreateGeometry:e=>{e.geometries=this._createRenderGeometriesDraped(e.material),this._attachmentOriginChanged()}}}get _laserlineAttached(){return this.attached&&this.visible&&null!=this._laserlineStyle&&!this.isDraped&&this.laserlineEnabled}onAttachedChange(e){this._laserline.attached=this._laserlineAttached,e&&this._attachmentOriginChanged()}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){n(e,this._color)||(a(this._color,e),this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){n(e,this._innerColor)||(a(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){const t=null!=e!=(null!=this._stipplePattern);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){e&&this._stippleOffColor&&n(e,this._stippleOffColor)||(this._stippleOffColor=e?l(e):null,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,null!=e&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get attachmentOrigin(){if(!this._attachmentOriginDirty)return this._attachmentOrigin;const e=this.object3dResources.resources?.geometries;if(!e||0===e.length)return null;t(E,0,0,0);let s=0;for(const t of e)t.computeAttachmentOrigin(P)&&(r(E,E,P),s++);return 0===s?null:(i(E,E,1/s),this.view.renderCoordsHelper.fromRenderCoords(E,this._attachmentOrigin),this._attachmentOriginDirty=!1,this._attachmentOrigin)}_updateMaterial(){null!=this.object3dResources.resources&&this.object3dResources.resources.material.setParameters(this._materialParameters),null!=this.drapedResources.resources&&this.drapedResources.resources.material.setParameters(this._materialParameters)}get _isClosed(){return null!=this.geometry&&"polygon"===this.geometry.type}get _materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:!1,isClosed:this._isClosed,falloff:this._falloff,innerColor:this._innerColor,innerWidth:this._innerWidth,join:"round",hasPolygonOffset:!0,renderOccluded:this._normalizedRenderOccluded}}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===R.OccludeAndTransparentStencil?R.OccludeAndTransparent:this._renderOccluded}_recreateGeometry(e,t,r){this._createRenderGeometries(t,r);for(const i of r)e.addGeometry(i);this._attachmentOriginChanged()}_attachmentOriginChanged(){this._attachmentOriginDirty=!0,this.events.emit("attachment-origin-changed")}_destroyExternalResources(e){e.geometries=[],e.material.dispose()}_createObject3DResources(e){const t=new w(this._materialParameters),r=new Array;return this._recreateGeometry(e,t,r),{material:t,geometries:r,forEach:e=>{e(t),r.forEach(e)}}}_createDrapedResources(){const e=new w(this._materialParameters);return{material:e,geometries:this._createRenderGeometriesDraped(e)}}_createRenderGeometriesDraped(e){const{geometry:t,view:r}=this,i=r.basemapTerrain.spatialReference;if(null==t||null==i)return[];return O(t,i).lines.map((({position:t})=>{const s={overlayInfo:{spatialReference:i,renderCoordsHelper:r.renderCoordsHelper},attributeData:{position:t},removeDuplicateStartEnd:this._isClosed};return new v(y(e,s))}))}calculateMapBounds(e){if(null==this.object3dResources.resources)return!1;const t=this.view.renderCoordsHelper;for(const r of this.object3dResources.resources.geometries){const i=r.vertexAttributes.get(b.POSITION),s=d(i.data.length);h(i.data,t.spatialReference,0,s,this.view.spatialReference,0,i.data.length/3),c(e,s)}return!0}_createRenderGeometries(e,t){const r=this.geometry;if(null==r)return;const i=C(r,this.view.elevationProvider,this.view.renderCoordsHelper,g.fromElevationInfo(this.elevationInfo??new m({mode:p(r,null)}))),s=new Array;for(const{position:n,mapPositions:a}of i.lines){const r={mapPositions:a,attributeData:{position:n},removeDuplicateStartEnd:this._isClosed};t.push(y(e,r)),s.push(n)}this._laserline.pathVerticalPlane=s}}const P=s(),E=s();export{j as OutlineVisualElement};