@arcgis/core 4.33.0-next.20250218 → 4.33.0-next.20250220

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 (216) hide show
  1. package/applications/ExperienceBuilder/sketchUtils.d.ts +1 -0
  2. package/applications/ExperienceBuilder/sketchUtils.js +1 -1
  3. package/arcade/treeAnalysis.js +1 -1
  4. package/assets/esri/core/workers/RemoteClient.js +1 -1
  5. package/assets/esri/core/workers/chunks/{f5ce6af342c02a4b0d15.js → 030384851fa745908a6e.js} +13 -12
  6. package/assets/esri/core/workers/chunks/0c3930e40fc9f8a84599.js +2 -0
  7. package/assets/esri/core/workers/chunks/{ccee343fb8c415b59ce3.js.LICENSE.txt → 0c3930e40fc9f8a84599.js.LICENSE.txt} +1 -1
  8. package/assets/esri/core/workers/chunks/0e6762d69b7449f8a997.js +1 -0
  9. package/assets/esri/core/workers/chunks/{5ad51a68d20b0d0d404f.js → 1661ac4e1b6c6af6ee0f.js} +1 -1
  10. package/assets/esri/core/workers/chunks/186db99d05ca1183d4e9.js +1 -0
  11. package/assets/esri/core/workers/chunks/{a42ae5d5e5f66d120b4d.js → 21c7265f1f2a718de7c6.js} +1 -1
  12. package/assets/esri/core/workers/chunks/2a88909a03600349dff9.js +1 -0
  13. package/assets/esri/core/workers/chunks/333bb93a28209c997d8b.js +314 -0
  14. package/assets/esri/core/workers/chunks/469c50c49447f0d602c0.js +1 -0
  15. package/assets/esri/core/workers/chunks/486df1e042204b90b0dd.js.LICENSE.txt +1 -1
  16. package/assets/esri/core/workers/chunks/{c2d539359f321bba3432.js → 52c13b3c074c9f6dadde.js} +2 -2
  17. package/assets/esri/core/workers/chunks/{c2d539359f321bba3432.js.LICENSE.txt → 52c13b3c074c9f6dadde.js.LICENSE.txt} +1 -1
  18. package/assets/esri/core/workers/chunks/5352b374454bc4f73d55.js +1 -0
  19. package/assets/esri/core/workers/chunks/5693d9ce4472a4c5959f.js.LICENSE.txt +1 -1
  20. package/assets/esri/core/workers/chunks/5984ab09ea8010f8a874.js +1 -0
  21. package/assets/esri/core/workers/chunks/5b56b271afb0fadf48b4.js.LICENSE.txt +1 -1
  22. package/assets/esri/core/workers/chunks/6518954889df2e781c47.js.LICENSE.txt +1 -1
  23. package/assets/esri/core/workers/chunks/68322a63ec92d33701ea.js +1 -0
  24. package/assets/esri/core/workers/chunks/{ec62fffe07c4382e8796.js → 6c64ccf5f64b5025b239.js} +1 -1
  25. package/assets/esri/core/workers/chunks/717d7e9912d948e44d8d.js +1 -0
  26. package/assets/esri/core/workers/chunks/aacebda644be06ad1a61.js +1 -0
  27. package/assets/esri/core/workers/chunks/ac11b2168feee63d2f09.js +1 -0
  28. package/assets/esri/core/workers/chunks/b0952b81d5be214262dd.js.LICENSE.txt +1 -1
  29. package/assets/esri/core/workers/chunks/b9292cd91005137a2094.js +1 -0
  30. package/assets/esri/core/workers/chunks/b9d2f60b2d587a2b6cd7.js +1 -0
  31. package/assets/esri/core/workers/chunks/cf285e45c18cd4399dde.js +1 -0
  32. package/assets/esri/core/workers/chunks/{42f21349f488a14198e4.js → d4a08800c75051a5131d.js} +1 -1
  33. package/assets/esri/core/workers/chunks/e2df18662cc4d6e47715.js +1 -0
  34. package/assets/esri/core/workers/chunks/e96f4c76c8bc78a7f80f.js +1 -0
  35. package/assets/esri/core/workers/chunks/f24aef061e60d2c2f597.js +1 -0
  36. package/assets/esri/core/workers/chunks/f664cc15238c8e9856a0.js +1 -0
  37. package/assets/esri/themes/base/widgets/_Editor.scss +3 -0
  38. package/assets/esri/themes/base/widgets/_Print.scss +1 -0
  39. package/assets/esri/themes/base/widgets/_ResponsiveToolbar.scss +23 -3
  40. package/assets/esri/themes/base/widgets/_Sketch.scss +32 -24
  41. package/assets/esri/themes/dark/main.css +1 -1
  42. package/assets/esri/themes/light/main.css +1 -1
  43. package/assets/esri/themes/light/view.css +1 -1
  44. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm.json +1 -1
  45. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ar.json +1 -1
  46. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bg.json +1 -1
  47. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_bs.json +1 -1
  48. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ca.json +1 -1
  49. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_cs.json +1 -1
  50. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_da.json +1 -1
  51. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_de.json +1 -1
  52. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_el.json +1 -1
  53. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_en.json +1 -1
  54. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_es.json +1 -1
  55. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_et.json +1 -1
  56. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fi.json +1 -1
  57. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_fr.json +1 -1
  58. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_he.json +1 -1
  59. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hr.json +1 -1
  60. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_hu.json +1 -1
  61. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_id.json +1 -1
  62. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_it.json +1 -1
  63. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ja.json +1 -1
  64. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ko.json +1 -1
  65. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lt.json +1 -1
  66. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_lv.json +1 -1
  67. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_nl.json +1 -1
  68. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_no.json +1 -1
  69. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pl.json +1 -1
  70. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-BR.json +1 -1
  71. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_pt-PT.json +1 -1
  72. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ro.json +1 -1
  73. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_ru.json +1 -1
  74. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sk.json +1 -1
  75. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sl.json +1 -1
  76. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sr.json +1 -1
  77. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_sv.json +1 -1
  78. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_th.json +1 -1
  79. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_tr.json +1 -1
  80. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_uk.json +1 -1
  81. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_vi.json +1 -1
  82. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-CN.json +1 -1
  83. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-HK.json +1 -1
  84. package/assets/esri/widgets/BatchAttributeForm/t9n/BatchAttributeForm_zh-TW.json +1 -1
  85. package/chunks/RealisticTree.glsl.js +18 -17
  86. package/copyright.txt +91 -0
  87. package/geometry/support/meshUtils/elevation.js +1 -1
  88. package/interfaces.d.ts +493 -131
  89. package/layers/BuildingSceneLayer.js +1 -1
  90. package/layers/FeatureLayer.js +1 -1
  91. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  92. package/layers/IntegratedMeshLayer.js +1 -1
  93. package/layers/OrientedImageryLayer.js +1 -1
  94. package/layers/PointCloudLayer.js +1 -1
  95. package/layers/RouteLayer.js +1 -1
  96. package/layers/SceneLayer.js +1 -1
  97. package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
  98. package/layers/graphics/OptimizedGeometry.js +1 -1
  99. package/layers/graphics/featureConversionUtils.js +1 -1
  100. package/layers/support/featureLayerUtils.js +1 -1
  101. package/layers/support/rasterFunctionUtils.d.ts +11 -0
  102. package/networks/UtilityNetwork.js +1 -1
  103. package/package.json +2 -2
  104. package/portal/Portal.js +1 -1
  105. package/rest/route.js +1 -1
  106. package/rest/support/AttributeBinsGrouping.js +1 -1
  107. package/rest/support/AttributeBinsQuery.js +1 -1
  108. package/rest/support/RouteParameters.js +1 -1
  109. package/rest/support/RouteSolveResult.js +1 -1
  110. package/support/revision.js +1 -1
  111. package/symbols/cim/CIMEffects.js +1 -1
  112. package/symbols/cim/cimAnalyzer.js +1 -1
  113. package/symbols/cim/effects/EffectAddControlPoints.js +1 -1
  114. package/symbols/cim/effects/EffectBuffer.js +1 -1
  115. package/symbols/cim/effects/EffectDonut.js +1 -1
  116. package/symbols/cim/effects/EffectOffset.js +1 -1
  117. package/views/2d/FrameTask.js +1 -1
  118. package/views/2d/engine/webgl/TextureManager.js +1 -1
  119. package/views/2d/engine/webgl/Utils.js +1 -1
  120. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelTechnique.js +1 -1
  121. package/views/2d/engine/webgl/shaderGraph/techniques/markers/MarkerMeshWriter.js +1 -1
  122. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  123. package/views/2d/layers/FeatureLayerView2D.js +1 -1
  124. package/views/2d/layers/features/FeaturePipelineWorker.js +1 -1
  125. package/views/2d/layers/features/sources/FeatureCache.js +1 -1
  126. package/views/2d/layers/features/sources/FeatureSource.js +1 -1
  127. package/views/2d/layers/features/sources/strategies/chunks/Overrides.js +1 -1
  128. package/views/2d/layers/features/support/FeatureSetReader.js +1 -1
  129. package/views/2d/layers/features/support/FeatureSetReaderPBF.js +1 -1
  130. package/views/2d/viewpointUtils.js +1 -1
  131. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  132. package/views/3d/layers/I3SMeshView3D.js +1 -1
  133. package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
  134. package/views/3d/layers/graphics/pipeline/Tile.js +1 -1
  135. package/views/3d/layers/graphics/pipeline/Tile3DManager.js +1 -1
  136. package/views/3d/layers/graphics/pipeline/featureData/FeatureData.js +1 -1
  137. package/views/3d/layers/graphics/pipeline/featureData/FeatureDataSubset.js +5 -0
  138. package/views/3d/layers/graphics/pipeline/featureData/processingUtils.js +1 -1
  139. package/views/3d/layers/graphics/pipeline/featureSet/PBFPointFeatureSetView.js +1 -1
  140. package/views/3d/layers/graphics/pipeline/featureSet/TiledFeatureStore.js +1 -1
  141. package/views/3d/layers/graphics/pipeline/fetching/Tile3DFetcher.js +1 -1
  142. package/views/3d/layers/graphics/pipeline/symbolization/TestObjectSymbol.js +1 -1
  143. package/views/3d/layers/graphics/pipeline/symbolization/TestSymbol.js +1 -1
  144. package/views/3d/layers/graphics/pipeline/symbolization/UniqueValueFeatureRenderer.js +1 -1
  145. package/views/3d/layers/support/FeatureTile.js +1 -1
  146. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  147. package/views/3d/terrain/TileRenderer.js +1 -1
  148. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  149. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  150. package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentBVH.js +1 -1
  151. package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRange.js +5 -0
  152. package/views/3d/webgl-engine/lib/ComponentUtils.js +1 -1
  153. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  154. package/views/3d/webgl-engine/materials/renderers/BufferRange.js +1 -1
  155. package/views/VideoView.js +1 -1
  156. package/views/View2D.js +1 -1
  157. package/views/Viewport2DMixin.js +5 -0
  158. package/views/webgl/Texture.js +1 -1
  159. package/webmap/utils.js +1 -1
  160. package/widgets/BasemapLayerList.js +1 -1
  161. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  162. package/widgets/BatchAttributeForm/inputs/FieldInput.js +1 -1
  163. package/widgets/BatchAttributeForm/templates/support/contingentValuesUtils.js +5 -0
  164. package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
  165. package/widgets/BatchAttributeForm.js +1 -1
  166. package/widgets/CatalogLayerList.js +1 -1
  167. package/widgets/DirectionalPad/DirectionalPadViewModel.js +1 -1
  168. package/widgets/Directions/DirectionsViewModel.js +1 -1
  169. package/widgets/Directions.js +1 -1
  170. package/widgets/ElevationProfile/components/LegendItem.js +1 -1
  171. package/widgets/ElevationProfile/components/SettingsButton.js +1 -1
  172. package/widgets/Feature/FeatureUtilityNetworkAssociations.js +1 -1
  173. package/widgets/FeatureForm/FeatureFormUtilityNetworkAssociations/UtilityNetworkAssociationItemList.js +1 -1
  174. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  175. package/widgets/FeatureForm/featureFormUtils.js +1 -1
  176. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  177. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  178. package/widgets/LayerList.js +1 -1
  179. package/widgets/Legend/styles/support/utils.js +1 -1
  180. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  181. package/widgets/OrientedImageryViewer/components/ImageOverlays.js +1 -1
  182. package/widgets/OrientedImageryViewer/digitizationUtils.js +1 -1
  183. package/widgets/OrientedImageryViewer/galleryUtils.js +1 -1
  184. package/widgets/OrientedImageryViewer/imageMeasurementUtils.js +1 -1
  185. package/widgets/OrientedImageryViewer.js +1 -1
  186. package/widgets/Print.js +1 -1
  187. package/widgets/ShadowCast.js +1 -1
  188. package/widgets/Sketch/SketchViewModel.js +1 -1
  189. package/widgets/Sketch/support/ResponsiveToolbar/OverflowGroup.js +1 -1
  190. package/widgets/Sketch/support/ResponsiveToolbar/ResponsiveToolbar.js +1 -1
  191. package/widgets/Sketch/support/ResponsiveToolbar/SplitButton.js +1 -1
  192. package/widgets/Sketch/support/sketchUtils.js +1 -1
  193. package/widgets/Sketch.js +1 -1
  194. package/widgets/VideoPlayer.js +1 -1
  195. package/widgets/support/UtilityNetworkAssociations/utilityNetworkUtils.js +1 -1
  196. package/assets/esri/core/workers/chunks/1cbea0c0b20a2963a86d.js +0 -1
  197. package/assets/esri/core/workers/chunks/238bcf6514a1f214cc8a.js +0 -1
  198. package/assets/esri/core/workers/chunks/26b5397f63dc602612f2.js +0 -1
  199. package/assets/esri/core/workers/chunks/290f613ef70590de9f15.js +0 -314
  200. package/assets/esri/core/workers/chunks/33c6fd524711efd8ef13.js +0 -1
  201. package/assets/esri/core/workers/chunks/3f077176c03a360e1edd.js +0 -1
  202. package/assets/esri/core/workers/chunks/544ad8fa4777ba8ec177.js +0 -1
  203. package/assets/esri/core/workers/chunks/6039da57a2adedd3b83f.js +0 -1
  204. package/assets/esri/core/workers/chunks/842db06ce62758fab1e7.js +0 -1
  205. package/assets/esri/core/workers/chunks/916f0ca8e3aaed5a9508.js +0 -1
  206. package/assets/esri/core/workers/chunks/bdc9dec6a359d2e3705c.js +0 -1
  207. package/assets/esri/core/workers/chunks/bf127fe767174e2715b5.js +0 -1
  208. package/assets/esri/core/workers/chunks/cb3148cf11a420d6e9ab.js +0 -1
  209. package/assets/esri/core/workers/chunks/ccee343fb8c415b59ce3.js +0 -2
  210. package/assets/esri/core/workers/chunks/d342c56558f164e9e786.js +0 -1
  211. package/assets/esri/core/workers/chunks/d3f7ff03ab5b40062d89.js +0 -1
  212. package/assets/esri/core/workers/chunks/ed89a108b032b982b12f.js +0 -1
  213. package/assets/esri/core/workers/chunks/ef6279f5c63ab1e88c71.js +0 -1
  214. package/assets/esri/core/workers/chunks/f088e7db4e7ac85aaff1.js +0 -1
  215. package/views/3d/layers/graphics/pipeline/featureData/FeatureDataStore.js +0 -5
  216. package/views/3d/webgl-engine/collections/Component/IndexRange/ComponentRangeRunLengthEncoded.js +0 -5
package/rest/route.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../request.js";import{get as r}from"../core/accessorSupport/get.js";import{normalizeCentralMeridian as t}from"../geometry/support/normalizeUtils.js";import{collectGeometries as s,isInputGeometryZAware as o,fetchServiceDescription as a,dropZValuesOffInputGeometry as i}from"./networkService.js";import{parseUrl as n}from"./utils.js";import{routeParametersToQueryParameters as u}from"./route/utils.js";import f from"./support/FeatureSet.js";import p from"./support/RouteSolveResult.js";function c(e){return e instanceof f}async function l(f,p,l){const y=[],d=[],g={},h={},R=n(f),{path:v}=R;c(p.stops)&&s(p.stops.features,d,"stops.features",g),c(p.pointBarriers)&&s(p.pointBarriers.features,d,"pointBarriers.features",g),c(p.polylineBarriers)&&s(p.polylineBarriers.features,d,"polylineBarriers.features",g),c(p.polygonBarriers)&&s(p.polygonBarriers.features,d,"polygonBarriers.features",g);const B=await t(d);for(const e in g){const r=g[e];y.push(e),h[e]=B.slice(r[0],r[1])}if(o(h,y)){let e=null;try{e=await a(v,p.apiKey,l)}catch{}e&&!e.hasZ&&i(h,y)}for(const e in h)h[e].forEach(((t,s)=>{r(p,e)[s].geometry=t}));const E={...l,query:{...R.query,...u(p),f:"json"}},T=v.endsWith("/solve")?v:`${v}/solve`,{data:b}=await e(T,E);return m(b)}function m(e){const{barriers:r,directionLines:t,directionPoints:s,directions:o,messages:a,polygonBarriers:i,polylineBarriers:n,routes:u,stops:f,traversedEdges:c,traversedJunctions:l,traversedTurns:m}=e,y=e=>{const r=g.find((r=>r.routeName===e));if(null!=r)return r;const t={routeId:g.length+1,routeName:e};return g.push(t),t},d=e=>{const r=g.find((r=>r.routeId===e));if(null!=r)return r;const t={routeId:e,routeName:null};return g.push(t),t},g=[];u?.features.forEach(((e,r)=>{e.geometry.spatialReference=u.spatialReference??void 0;const t=e.attributes.Name,s=r+1;g.push({routeId:s,routeName:t,route:e})})),o?.forEach((e=>{const{routeName:r}=e;y(r).directions=e}));const h=(f?.features.every((e=>null==e.attributes.RouteName))??!1)&&g.length>0?g[0].routeName:null;return f?.features.forEach((e=>{e.geometry&&(e.geometry.spatialReference??=f.spatialReference??void 0);const r=h??e.attributes.RouteName,t=y(r);t.stops??=[],t.stops.push(e)})),t?.features.forEach((e=>{const r=e.attributes.RouteID,s=d(r),{geometryType:o,spatialReference:a}=t;s.directionLines??={features:[],geometryType:o,spatialReference:a},s.directionLines.features.push(e)})),s?.features.forEach((e=>{const r=e.attributes.RouteID,t=d(r),{geometryType:o,spatialReference:a}=s;t.directionPoints??={features:[],geometryType:o,spatialReference:a},t.directionPoints.features.push(e)})),c?.features.forEach((e=>{const r=e.attributes.RouteID,t=d(r),{geometryType:s,spatialReference:o}=c;t.traversedEdges??={features:[],geometryType:s,spatialReference:o},t.traversedEdges.features.push(e)})),l?.features.forEach((e=>{const r=e.attributes.RouteID,t=d(r),{geometryType:s,spatialReference:o}=l;t.traversedJunctions??={features:[],geometryType:s,spatialReference:o},t.traversedJunctions.features.push(e)})),m?.features.forEach((e=>{const r=e.attributes.RouteID,t=d(r);t.traversedTurns??={features:[]},t.traversedTurns.features.push(e)})),p.fromJSON({routeResults:g,barriers:r,polygonBarriers:i,polylineBarriers:n,messages:a})}export{l as solve};
5
+ import e from"../request.js";import{get as r}from"../core/accessorSupport/get.js";import{normalizeCentralMeridian as t}from"../geometry/support/normalizeUtils.js";import{collectGeometries as s,isInputGeometryZAware as o,fetchServiceDescription as a,dropZValuesOffInputGeometry as u}from"./networkService.js";import{parseUrl as i}from"./utils.js";import{routeParametersToQueryParameters as n}from"./route/utils.js";import c from"./support/FeatureSet.js";import f from"./support/RouteSolveResult.js";function p(e){return e instanceof c}async function l(c,f,l){const y=[],d=[],h={},g={},R=i(c),{path:v}=R;p(f.stops)&&s(f.stops.features,d,"stops.features",h),p(f.pointBarriers)&&s(f.pointBarriers.features,d,"pointBarriers.features",h),p(f.polylineBarriers)&&s(f.polylineBarriers.features,d,"polylineBarriers.features",h),p(f.polygonBarriers)&&s(f.polygonBarriers.features,d,"polygonBarriers.features",h);const B=await t(d);for(const e in h){const r=h[e];y.push(e),g[e]=B.slice(r[0],r[1])}if(o(g,y)){let e=null;try{e=await a(v,f.apiKey,l)}catch{}e&&!e.hasZ&&u(g,y)}for(const e in g)g[e].forEach(((t,s)=>{r(f,e)[s].geometry=t}));const E={...l,query:{...R.query,...n(f),f:"json"}},T=v.endsWith("/solve")?v:`${v}/solve`,{data:b}=await e(T,E);return m(b)}function m(e){const{barriers:r,checksum:t,directionLines:s,directionPoints:o,directions:a,messages:u,polygonBarriers:i,polylineBarriers:n,routes:c,stops:p,traversedEdges:l,traversedJunctions:m,traversedTurns:y}=e,d=e=>{const r=g.find((r=>r.routeName===e));if(null!=r)return r;const t={routeId:g.length+1,routeName:e};return g.push(t),t},h=e=>{const r=g.find((r=>r.routeId===e));if(null!=r)return r;const t={routeId:e,routeName:null};return g.push(t),t},g=[];c?.features.forEach(((e,r)=>{e.geometry.spatialReference=c.spatialReference??void 0;const t=e.attributes.Name,s=r+1;g.push({routeId:s,routeName:t,route:e})})),a?.forEach((e=>{const{routeName:r}=e;d(r).directions=e}));const R=(p?.features.every((e=>null==e.attributes.RouteName))??!1)&&g.length>0?g[0].routeName:null;return p?.features.forEach((e=>{e.geometry&&(e.geometry.spatialReference??=p.spatialReference??void 0);const r=R??e.attributes.RouteName,t=d(r);t.stops??=[],t.stops.push(e)})),s?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r),{geometryType:o,spatialReference:a}=s;t.directionLines??={features:[],geometryType:o,spatialReference:a},t.directionLines.features.push(e)})),o?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r),{geometryType:s,spatialReference:a}=o;t.directionPoints??={features:[],geometryType:s,spatialReference:a},t.directionPoints.features.push(e)})),l?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r),{geometryType:s,spatialReference:o}=l;t.traversedEdges??={features:[],geometryType:s,spatialReference:o},t.traversedEdges.features.push(e)})),m?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r),{geometryType:s,spatialReference:o}=m;t.traversedJunctions??={features:[],geometryType:s,spatialReference:o},t.traversedJunctions.features.push(e)})),y?.features.forEach((e=>{const r=e.attributes.RouteID,t=h(r);t.traversedTurns??={features:[]},t.traversedTurns.features.push(e)})),f.fromJSON({barriers:r,checksum:t,messages:u,polygonBarriers:i,polylineBarriers:n,routeResults:g})}export{l as solve};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Clonable.js";import e from"../../core/JSONSupport.js";import{property as t}from"../../core/accessorSupport/decorators/property.js";import{ensureType as s}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as p}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{kebabDict as a}from"../../layers/support/fieldType.js";let l=class extends(r.ClonableMixin(e)){constructor(o){super(o),this.alias=null,this.responseType=null,this.type=null,this.value=null,this.valueType=null}};o([t({type:String,json:{name:"outAlias",write:!0}})],l.prototype,"alias",void 0),o([t({type:String})],l.prototype,"responseType",void 0),o([t({type:String,json:{write:!0}})],l.prototype,"type",void 0),o([t({type:String,json:{write:!0}})],l.prototype,"value",void 0),o([p(a)],l.prototype,"valueType",void 0),l=o([i("esri.rest.support.AttributeBinsGrouping")],l);const n=l;l.from=s(l);export{n as default};
5
+ import{_ as o}from"../../chunks/tslib.es6.js";import r from"../../core/Clonable.js";import{JSONMap as e}from"../../core/jsonMap.js";import t from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import{ensureType as p}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as i}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as n}from"../../core/accessorSupport/decorators/subclass.js";const a=new e({esriFieldTypeInteger:"integer",esriFieldTypeString:"string"});let l=class extends(r.ClonableMixin(t)){constructor(o){super(o),this.alias=null,this.responseType=null,this.type=null,this.value=null,this.valueType=null}};o([s({type:String,json:{name:"outAlias",write:!0}})],l.prototype,"alias",void 0),o([s({type:String})],l.prototype,"responseType",void 0),o([s({type:String,json:{write:!0}})],l.prototype,"type",void 0),o([s({type:String,json:{write:!0}})],l.prototype,"value",void 0),o([i(a)],l.prototype,"valueType",void 0),l=o([n("esri.rest.support.AttributeBinsGrouping")],l);const c=l;l.from=p(l);export{c 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../TimeExtent.js";import t from"../../core/Clonable.js";import{JSONMap as o}from"../../core/jsonMap.js";import r from"../../core/JSONSupport.js";import i from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import{ensureType as n}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as a}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import m from"../../geometry/SpatialReference.js";import{fromJSON as l}from"../../geometry/support/jsonUtils.js";import{geometryTypes as u}from"../../geometry/support/typeUtils.js";import{unitsKebabDict as d}from"../../layers/graphics/data/queryUtils.js";import c from"./AutoIntervalBinParameters.js";import y from"./BinParametersBase.js";import j from"./DateBinParameters.js";import f from"./FixedBoundariesBinParameters.js";import h from"./FixedIntervalBinParameters.js";import{spatialRelKebabDict as v}from"./spatialRelationships.js";import w from"./StatisticDefinition.js";import{isTimeZoneValid as S}from"../../time/timeZoneUtils.js";import g from"../../time/TimeExtent.js";const b=new o({asc:"ascending",desc:"descending"}),B={base:y,key:"type",typeMap:{"auto-interval":c,date:j,"fixed-boundaries":f,"fixed-interval":h}};let R=class extends(t.ClonableMixin(r)){constructor(e){super(e),this.binParameters=null,this.binOrder="ascending",this.cacheHint=void 0,this.datumTransformation=null,this.defaultSpatialReference=null,this.distance=void 0,this.geometry=null,this.lowerBoundaryAlias=null,this.outSpatialReference=null,this.outStatistics=null,this.returnDistinctValues=null,this.spatialRelationship="intersects",this.timeExtent=null,this.upperBoundaryAlias=null,this.units=null,this.where="1=1"}set outTimeZone(e){this._set("outTimeZone",e),e&&!S(e)&&i.getLogger(this).warn("#outTimeZone",`the parsed value '${e}' may not be a valid IANA time zone`)}};e([s({types:B,json:{name:"bin",write:!0}})],R.prototype,"binParameters",void 0),e([a(b)],R.prototype,"binOrder",void 0),e([s({type:Boolean,json:{write:!0}})],R.prototype,"cacheHint",void 0),e([s({json:{write:!0}})],R.prototype,"datumTransformation",void 0),e([s({type:m,json:{name:"defaultSR",write:!0}})],R.prototype,"defaultSpatialReference",void 0),e([s({type:Number,json:{write:{overridePolicy:e=>({enabled:e>0})}}})],R.prototype,"distance",void 0),e([s({types:u,json:{read:l,write:!0}})],R.prototype,"geometry",void 0),e([s({type:String,json:{write:!0}})],R.prototype,"lowerBoundaryAlias",void 0),e([s({type:m,json:{name:"outSR",write:!0}})],R.prototype,"outSpatialReference",void 0),e([s({type:[w],json:{write:{enabled:!0,overridePolicy(){return{enabled:null!=this.outStatistics&&this.outStatistics.length>0}}}}})],R.prototype,"outStatistics",void 0),e([s({value:null,json:{name:"outTimeReference",read:{reader:e=>e.ianaTimeZone},write:{writer:(e,t,o)=>{e&&(t[o]={ianaTimeZone:e})}}}})],R.prototype,"outTimeZone",null),e([s({type:Boolean,json:{write:!0}})],R.prototype,"returnDistinctValues",void 0),e([a(v,{name:"spatialRel"})],R.prototype,"spatialRelationship",void 0),e([s({type:g,json:{write:!0}})],R.prototype,"timeExtent",void 0),e([s({type:String,json:{write:!0}})],R.prototype,"upperBoundaryAlias",void 0),e([s({type:String,json:{read:d.read,write:{writer:d.write,overridePolicy(e){return{enabled:null!=e&&null!=this.distance}}}}})],R.prototype,"units",void 0),e([s({type:String,json:{write:!0}})],R.prototype,"where",void 0),R=e([p("esri.rest.support.AttributeBinsQuery")],R);const T=R;R.from=n(R);export{T as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Clonable.js";import{JSONMap as o}from"../../core/jsonMap.js";import r from"../../core/JSONSupport.js";import i from"../../core/Logger.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import{ensureType as n}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as a}from"../../core/accessorSupport/decorators/enumeration.js";import{subclass as p}from"../../core/accessorSupport/decorators/subclass.js";import l from"../../geometry/SpatialReference.js";import{fromJSON as m}from"../../geometry/support/jsonUtils.js";import{geometryTypes as u}from"../../geometry/support/typeUtils.js";import{unitsKebabDict as d}from"../../layers/graphics/data/queryUtils.js";import c from"./AutoIntervalBinParameters.js";import y from"./BinParametersBase.js";import j from"./DateBinParameters.js";import f from"./FixedBoundariesBinParameters.js";import h from"./FixedIntervalBinParameters.js";import{spatialRelKebabDict as v}from"./spatialRelationships.js";import w from"./StatisticDefinition.js";import S from"../../time/TimeExtent.js";import{isTimeZoneValid as g}from"../../time/timeZoneUtils.js";const b=new o({asc:"ascending",desc:"descending"}),B={base:y,key:"type",typeMap:{"auto-interval":c,date:j,"fixed-boundaries":f,"fixed-interval":h}};let R=class extends(t.ClonableMixin(r)){constructor(e){super(e),this.binParameters=null,this.binOrder="ascending",this.cacheHint=void 0,this.datumTransformation=null,this.defaultSpatialReference=null,this.distance=void 0,this.geometry=null,this.lowerBoundaryAlias=null,this.outSpatialReference=null,this.outStatistics=null,this.returnDistinctValues=null,this.spatialRelationship="intersects",this.timeExtent=null,this.upperBoundaryAlias=null,this.units=null,this.where="1=1"}set outTimeZone(e){this._set("outTimeZone",e),e&&!g(e)&&i.getLogger(this).warn("#outTimeZone",`the parsed value '${e}' may not be a valid IANA time zone`)}};e([s({types:B,json:{name:"bin",write:!0}})],R.prototype,"binParameters",void 0),e([a(b)],R.prototype,"binOrder",void 0),e([s({type:Boolean,json:{write:!0}})],R.prototype,"cacheHint",void 0),e([s({json:{write:!0}})],R.prototype,"datumTransformation",void 0),e([s({type:l,json:{name:"defaultSR",write:!0}})],R.prototype,"defaultSpatialReference",void 0),e([s({type:Number,json:{write:{overridePolicy:e=>({enabled:e>0})}}})],R.prototype,"distance",void 0),e([s({types:u,json:{read:m,write:!0}})],R.prototype,"geometry",void 0),e([s({type:String,json:{write:!0}})],R.prototype,"lowerBoundaryAlias",void 0),e([s({type:l,json:{name:"outSR",write:!0}})],R.prototype,"outSpatialReference",void 0),e([s({type:[w],json:{write:{enabled:!0,overridePolicy(){return{enabled:null!=this.outStatistics&&this.outStatistics.length>0}}}}})],R.prototype,"outStatistics",void 0),e([s({value:null,json:{name:"outTimeReference",read:{reader:e=>e.ianaTimeZone},write:{writer:(e,t,o)=>{e&&(t[o]={ianaTimeZone:e})}}}})],R.prototype,"outTimeZone",null),e([s({type:Boolean,json:{write:!0}})],R.prototype,"returnDistinctValues",void 0),e([a(v,{name:"spatialRel"})],R.prototype,"spatialRelationship",void 0),e([s({type:S,json:{write:!0}})],R.prototype,"timeExtent",void 0),e([s({type:String,json:{write:!0}})],R.prototype,"upperBoundaryAlias",void 0),e([s({type:String,json:{read:d.read,write:{writer:d.write,overridePolicy(e){return{enabled:null!=e&&null!=this.distance}}}}})],R.prototype,"units",void 0),e([s({type:String,json:{write:!0}})],R.prototype,"where",void 0),R=e([p("esri.rest.support.AttributeBinsQuery")],R);const T=R;R.from=n(R);export{T 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Clonable.js";import r from"../../core/Collection.js";import o from"../../core/JSONSupport.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import{ensureClass as s}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as n}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import a from"../../geometry/SpatialReference.js";import{apiKey as y}from"./commonProperties.js";import m from"./DataLayer.js";import c from"./FeatureSet.js";import{impedanceAttributeNameJsonMap as d,restrictionAttributeNameJsonMap as v,directionsLengthUnitJsonMap as w,directionsOutputTypeJsonMap as j,directionsStyleNameJsonMap as h,durationImpedanceAttributeNameJsonMap as S,lengthUnitJsonMap as B,outputLineJsonMap as f,restrictUTurnJsonMap as b}from"./networkEnums.js";import T from"./NetworkFeatureSet.js";import g from"./NetworkUrl.js";import A from"./TravelMode.js";var N;let P=class extends(e.ClonableMixin(o)){static{N=this}constructor(t){super(t),this.accumulateAttributes=null,this.apiKey=null,this.attributeParameterValues=null,this.directionsLanguage=null,this.directionsLengthUnits=null,this.directionsOutputType=null,this.directionsStyleName=null,this.directionsTimeAttribute=null,this.findBestSequence=null,this.geometryPrecision=null,this.geometryPrecisionM=null,this.geometryPrecisionZ=null,this.ignoreInvalidLocations=null,this.impedanceAttribute=null,this.outputGeometryPrecision=null,this.outputGeometryPrecisionUnits=null,this.outputLines="true-shape",this.outSpatialReference=null,this.overrides=null,this.pointBarriers=null,this.polygonBarriers=null,this.polylineBarriers=null,this.preserveFirstStop=null,this.preserveLastStop=null,this.preserveObjectID=null,this.restrictionAttributes=null,this.restrictUTurns=null,this.returnBarriers=!1,this.returnDirections=!1,this.returnPolygonBarriers=!1,this.returnPolylineBarriers=!1,this.returnRoutes=!0,this.returnStops=!1,this.returnTraversedEdges=null,this.returnTraversedJunctions=null,this.returnTraversedTurns=null,this.returnZ=!0,this.startTime=null,this.startTimeIsUTC=!0,this.stops=null,this.timeWindowsAreUTC=null,this.travelMode=null,this.useHierarchy=null,this.useTimeWindows=null}static from(t){return s(N,t)}readAccumulateAttributes(t){return null==t?null:t.map((t=>d.fromJSON(t)))}writeAccumulateAttributes(t,e,r){t?.length&&(e[r]=t.map((t=>d.toJSON(t))))}writePointBarriers(t,e,r){k(t,e,r)}writePolygonBarrier(t,e,r){k(t,e,r)}writePolylineBarrier(t,e,r){k(t,e,r)}readRestrictionAttributes(t){return null==t?null:t.map((t=>v.fromJSON(t)))}writeRestrictionAttributes(t,e,r){t?.length&&(e[r]=t.map((t=>v.toJSON(t))))}readStartTime(t,e){const{startTime:r}=e;return null==r?null:"now"===r?"now":new Date(r)}writeStartTime(t,e){null!=t&&(e.startTime="now"===t?"now":t.getTime())}readStops(t,e){return C(e.stops)}writeStops(t,e,r){k(t,e,r)}};t([i({type:[String],json:{name:"accumulateAttributeNames",write:!0}})],P.prototype,"accumulateAttributes",void 0),t([p("accumulateAttributes")],P.prototype,"readAccumulateAttributes",null),t([l("accumulateAttributes")],P.prototype,"writeAccumulateAttributes",null),t([i(y)],P.prototype,"apiKey",void 0),t([i({json:{write:!0}})],P.prototype,"attributeParameterValues",void 0),t([i({type:String,json:{write:!0}})],P.prototype,"directionsLanguage",void 0),t([n(w)],P.prototype,"directionsLengthUnits",void 0),t([n(j)],P.prototype,"directionsOutputType",void 0),t([n(h)],P.prototype,"directionsStyleName",void 0),t([n(S,{name:"directionsTimeAttributeName",ignoreUnknown:!1})],P.prototype,"directionsTimeAttribute",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"findBestSequence",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecision",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecisionM",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecisionZ",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"ignoreInvalidLocations",void 0),t([n(d,{name:"impedanceAttributeName",ignoreUnknown:!1})],P.prototype,"impedanceAttribute",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"outputGeometryPrecision",void 0),t([n(B)],P.prototype,"outputGeometryPrecisionUnits",void 0),t([n(f)],P.prototype,"outputLines",void 0),t([i({type:a,json:{name:"outSR",write:!0}})],P.prototype,"outSpatialReference",void 0),t([i({json:{write:!0}})],P.prototype,"overrides",void 0),t([i({json:{name:"barriers",write:!0}})],P.prototype,"pointBarriers",void 0),t([l("pointBarriers")],P.prototype,"writePointBarriers",null),t([i({json:{write:!0}})],P.prototype,"polygonBarriers",void 0),t([l("polygonBarriers")],P.prototype,"writePolygonBarrier",null),t([i({json:{write:!0}})],P.prototype,"polylineBarriers",void 0),t([l("polylineBarriers")],P.prototype,"writePolylineBarrier",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveFirstStop",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveLastStop",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveObjectID",void 0),t([i({type:[String],json:{name:"restrictionAttributeNames",write:!0}})],P.prototype,"restrictionAttributes",void 0),t([p("restrictionAttributes")],P.prototype,"readRestrictionAttributes",null),t([l("restrictionAttributes")],P.prototype,"writeRestrictionAttributes",null),t([n(b)],P.prototype,"restrictUTurns",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnDirections",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnPolygonBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnPolylineBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnRoutes",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnStops",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedEdges",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedJunctions",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedTurns",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnZ",void 0),t([i({json:{write:!0}})],P.prototype,"startTime",void 0),t([p("startTime")],P.prototype,"readStartTime",null),t([l("startTime")],P.prototype,"writeStartTime",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"startTimeIsUTC",void 0),t([i({json:{write:!0}})],P.prototype,"stops",void 0),t([p("stops")],P.prototype,"readStops",null),t([l("stops")],P.prototype,"writeStops",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"timeWindowsAreUTC",void 0),t([i({type:A,json:{write:!0}})],P.prototype,"travelMode",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"useHierarchy",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"useTimeWindows",void 0),P=N=t([u("esri.rest.support.RouteParameters")],P);const O=P;function J(t){return t&&"type"in t}function L(t){return t&&"features"in t&&"doNotLocateOnRestrictedElements"in t}function R(t){return t&&"url"in t}function U(t){return t&&"features"in t}function C(t){return J(t)?m.fromJSON(t):R(t)?g.fromJSON(t):L(t)?T.fromJSON(t):U(t)?c.fromJSON(t):null}function k(t,e,o){null!=t&&(e[o]=r.isCollection(t)?{features:t.toArray().map((t=>t.toJSON()))}:t.toJSON())}export{O as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Clonable.js";import r from"../../core/Collection.js";import o from"../../core/JSONSupport.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import{ensureClass as s}from"../../core/accessorSupport/ensureType.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{enumeration as n}from"../../core/accessorSupport/decorators/enumeration.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as u}from"../../core/accessorSupport/decorators/subclass.js";import{writer as l}from"../../core/accessorSupport/decorators/writer.js";import a from"../../geometry/SpatialReference.js";import{apiKey as y}from"./commonProperties.js";import c from"./DataLayer.js";import m from"./FeatureSet.js";import{impedanceAttributeNameJsonMap as d,restrictionAttributeNameJsonMap as v,directionsLengthUnitJsonMap as w,directionsOutputTypeJsonMap as j,directionsStyleNameJsonMap as h,durationImpedanceAttributeNameJsonMap as S,lengthUnitJsonMap as B,outputLineJsonMap as f,restrictUTurnJsonMap as b}from"./networkEnums.js";import T from"./NetworkFeatureSet.js";import g from"./NetworkUrl.js";import A from"./TravelMode.js";var N;let P=class extends(e.ClonableMixin(o)){static{N=this}constructor(t){super(t),this.accumulateAttributes=null,this.apiKey=null,this.attributeParameterValues=null,this.checksum=null,this.directionsLanguage=null,this.directionsLengthUnits=null,this.directionsOutputType=null,this.directionsStyleName=null,this.directionsTimeAttribute=null,this.findBestSequence=null,this.geometryPrecision=null,this.geometryPrecisionM=null,this.geometryPrecisionZ=null,this.ignoreInvalidLocations=null,this.impedanceAttribute=null,this.outputGeometryPrecision=null,this.outputGeometryPrecisionUnits=null,this.outputLines="true-shape",this.outSpatialReference=null,this.overrides=null,this.pointBarriers=null,this.polygonBarriers=null,this.polylineBarriers=null,this.preserveFirstStop=null,this.preserveLastStop=null,this.preserveObjectID=null,this.restrictionAttributes=null,this.restrictUTurns=null,this.returnBarriers=!1,this.returnDirections=!1,this.returnPolygonBarriers=!1,this.returnPolylineBarriers=!1,this.returnRoutes=!0,this.returnStops=!1,this.returnTraversedEdges=null,this.returnTraversedJunctions=null,this.returnTraversedTurns=null,this.returnZ=!0,this.startTime=null,this.startTimeIsUTC=!0,this.stops=null,this.timeWindowsAreUTC=null,this.travelMode=null,this.useHierarchy=null,this.useTimeWindows=null}static from(t){return s(N,t)}readAccumulateAttributes(t){return null==t?null:t.map((t=>d.fromJSON(t)))}writeAccumulateAttributes(t,e,r){t?.length&&(e[r]=t.map((t=>d.toJSON(t))))}writePointBarriers(t,e,r){k(t,e,r)}writePolygonBarrier(t,e,r){k(t,e,r)}writePolylineBarrier(t,e,r){k(t,e,r)}readRestrictionAttributes(t){return null==t?null:t.map((t=>v.fromJSON(t)))}writeRestrictionAttributes(t,e,r){t?.length&&(e[r]=t.map((t=>v.toJSON(t))))}readStartTime(t,e){const{startTime:r}=e;return null==r?null:"now"===r?"now":new Date(r)}writeStartTime(t,e){null!=t&&(e.startTime="now"===t?"now":t.getTime())}readStops(t,e){return C(e.stops)}writeStops(t,e,r){k(t,e,r)}};t([i({type:[String],json:{name:"accumulateAttributeNames",write:!0}})],P.prototype,"accumulateAttributes",void 0),t([p("accumulateAttributes")],P.prototype,"readAccumulateAttributes",null),t([l("accumulateAttributes")],P.prototype,"writeAccumulateAttributes",null),t([i(y)],P.prototype,"apiKey",void 0),t([i({json:{write:!0}})],P.prototype,"attributeParameterValues",void 0),t([i({type:String,json:{write:!0}})],P.prototype,"checksum",void 0),t([i({type:String,json:{write:!0}})],P.prototype,"directionsLanguage",void 0),t([n(w)],P.prototype,"directionsLengthUnits",void 0),t([n(j)],P.prototype,"directionsOutputType",void 0),t([n(h)],P.prototype,"directionsStyleName",void 0),t([n(S,{name:"directionsTimeAttributeName",ignoreUnknown:!1})],P.prototype,"directionsTimeAttribute",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"findBestSequence",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecision",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecisionM",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"geometryPrecisionZ",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"ignoreInvalidLocations",void 0),t([n(d,{name:"impedanceAttributeName",ignoreUnknown:!1})],P.prototype,"impedanceAttribute",void 0),t([i({type:Number,json:{write:!0}})],P.prototype,"outputGeometryPrecision",void 0),t([n(B)],P.prototype,"outputGeometryPrecisionUnits",void 0),t([n(f)],P.prototype,"outputLines",void 0),t([i({type:a,json:{name:"outSR",write:!0}})],P.prototype,"outSpatialReference",void 0),t([i({json:{write:!0}})],P.prototype,"overrides",void 0),t([i({json:{name:"barriers",write:!0}})],P.prototype,"pointBarriers",void 0),t([l("pointBarriers")],P.prototype,"writePointBarriers",null),t([i({json:{write:!0}})],P.prototype,"polygonBarriers",void 0),t([l("polygonBarriers")],P.prototype,"writePolygonBarrier",null),t([i({json:{write:!0}})],P.prototype,"polylineBarriers",void 0),t([l("polylineBarriers")],P.prototype,"writePolylineBarrier",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveFirstStop",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveLastStop",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"preserveObjectID",void 0),t([i({type:[String],json:{name:"restrictionAttributeNames",write:!0}})],P.prototype,"restrictionAttributes",void 0),t([p("restrictionAttributes")],P.prototype,"readRestrictionAttributes",null),t([l("restrictionAttributes")],P.prototype,"writeRestrictionAttributes",null),t([n(b)],P.prototype,"restrictUTurns",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnDirections",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnPolygonBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnPolylineBarriers",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnRoutes",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnStops",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedEdges",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedJunctions",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnTraversedTurns",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"returnZ",void 0),t([i({json:{write:!0}})],P.prototype,"startTime",void 0),t([p("startTime")],P.prototype,"readStartTime",null),t([l("startTime")],P.prototype,"writeStartTime",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"startTimeIsUTC",void 0),t([i({json:{write:!0}})],P.prototype,"stops",void 0),t([p("stops")],P.prototype,"readStops",null),t([l("stops")],P.prototype,"writeStops",null),t([i({type:Boolean,json:{write:!0}})],P.prototype,"timeWindowsAreUTC",void 0),t([i({type:A,json:{write:!0}})],P.prototype,"travelMode",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"useHierarchy",void 0),t([i({type:Boolean,json:{write:!0}})],P.prototype,"useTimeWindows",void 0),P=N=t([u("esri.rest.support.RouteParameters")],P);const O=P;function J(t){return t&&"type"in t}function L(t){return t&&"features"in t&&"doNotLocateOnRestrictedElements"in t}function R(t){return t&&"url"in t}function U(t){return t&&"features"in t}function C(t){return J(t)?c.fromJSON(t):R(t)?g.fromJSON(t):L(t)?T.fromJSON(t):U(t)?m.fromJSON(t):null}function k(t,e,o){null!=t&&(e[o]=r.isCollection(t)?{features:t.toArray().map((t=>t.toJSON()))}:t.toJSON())}export{O 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as r}from"../../chunks/tslib.es6.js";import o from"../../Graphic.js";import{isSome as e}from"../../core/arrayUtils.js";import t from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import a from"./FeatureSet.js";import l from"./NAMessage.js";import n from"./RouteResult.js";function u(r){return r?a.fromJSON(r).features.filter(e):[]}let m=class extends t{constructor(r){super(r),this.messages=null,this.pointBarriers=null,this.polylineBarriers=null,this.polygonBarriers=null,this.routeResults=null}readPointBarriers(r,o){return u(o.barriers)}readPolylineBarriers(r){return u(r)}readPolygonBarriers(r){return u(r)}};r([s({type:[l]})],m.prototype,"messages",void 0),r([s({type:[o]})],m.prototype,"pointBarriers",void 0),r([p("pointBarriers",["barriers"])],m.prototype,"readPointBarriers",null),r([s({type:[o]})],m.prototype,"polylineBarriers",void 0),r([p("polylineBarriers")],m.prototype,"readPolylineBarriers",null),r([s({type:[o]})],m.prototype,"polygonBarriers",void 0),r([p("polygonBarriers")],m.prototype,"readPolygonBarriers",null),r([s({type:[n]})],m.prototype,"routeResults",void 0),m=r([i("esri.rest.support.RouteSolveResult")],m);const y=m;export{y as default};
5
+ import{_ as r}from"../../chunks/tslib.es6.js";import o from"../../Graphic.js";import{isSome as e}from"../../core/arrayUtils.js";import t from"../../core/JSONSupport.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import{reader as p}from"../../core/accessorSupport/decorators/reader.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import l from"./FeatureSet.js";import a from"./NAMessage.js";import u from"./RouteResult.js";function n(r){return r?l.fromJSON(r).features.filter(e):[]}let c=class extends t{constructor(r){super(r),this.checksum=null,this.messages=null,this.pointBarriers=null,this.polylineBarriers=null,this.polygonBarriers=null,this.routeResults=null}readPointBarriers(r,o){return n(o.barriers)}readPolylineBarriers(r){return n(r)}readPolygonBarriers(r){return n(r)}};r([s({type:String})],c.prototype,"checksum",void 0),r([s({type:[a]})],c.prototype,"messages",void 0),r([s({type:[o]})],c.prototype,"pointBarriers",void 0),r([p("pointBarriers",["barriers"])],c.prototype,"readPointBarriers",null),r([s({type:[o]})],c.prototype,"polylineBarriers",void 0),r([p("polylineBarriers")],c.prototype,"readPolylineBarriers",null),r([s({type:[o]})],c.prototype,"polygonBarriers",void 0),r([p("polygonBarriers")],c.prototype,"readPolygonBarriers",null),r([s({type:[u]})],c.prototype,"routeResults",void 0),c=r([i("esri.rest.support.RouteSolveResult")],c);const m=c;export{m 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.33/esri/copyright.txt for details.
4
4
  */
5
- const c="20250218",e="9fc78b716667e3412476039c7f00caeaf2db3d94";export{c as buildDate,e as commitHash};
5
+ const e="20250220",f="16000f8be9d49cf76f23d68136c3b75b3fe95ea4";export{e as buildDate,f 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{GeometryCursor as t}from"../../geometry/GeometryCursor.js";import{GeometryType as e,TileClipper as o}from"../../geometry/support/TileClipper.js";const r=512;let n;class s{constructor(t){this._geometry=t}next(){const t=this._geometry;return this._geometry=null,t}}function i(s,i){n||(n=new o(0,0,0,1));const y="esriGeometryPolygon"===s.geometryType,m=y?e.Polygon:e.LineString,l=y?3:2;let c,p;for(n.reset(m),n.setPixelMargin(i+1),n.setExtent(r);s.nextPath();)if(!(s.pathSize<l)){for(s.nextPoint(),c=s.x,p=-s.y,n.moveTo(c,p);s.nextPoint();)c=s.x,p=-s.y,n.lineTo(c,p);y&&n.close()}const f=n.result(!1);if(f){const e=t.createEmptyOptimizedCIM(s.geometryType);for(const t of f){e.startPath();for(const o of t)e.pushXY(o.x,-o.y)}return e.reset(),e}return null}export{s as SimpleEffectCursor,i as clipCursorToTileExtent};
5
+ import{GeometryCursor as t}from"../../geometry/GeometryCursor.js";import{GeometryType as e,TileClipper as o}from"../../geometry/support/TileClipper.js";const r=512;let n;class s{constructor(t){this._geometry=t}next(){const t=this._geometry;return this._geometry=null,t}}function i(s,i,l){if(!s)return null;n||(n=new o(0,0,0,1));const y=l?-1:1,m="esriGeometryPolygon"===s.geometryType,c=m?e.Polygon:e.LineString,p=m?3:2;let u,f;for(n.reset(c),n.setPixelMargin(i+1),n.setExtent(r);s.nextPath();)if(!(s.pathSize<p)){for(s.nextPoint(),u=s.x,f=y*s.y,n.moveTo(u,f);s.nextPoint();)u=s.x,f=y*s.y,n.lineTo(u,f);m&&n.close()}const g=n.result(!1);if(g){const e=t.createEmptyOptimizedCIM(s.geometryType);for(const t of g){e.startPath();for(const o of t)e.pushXY(o.x,y*o.y)}return e.reset(),e}return null}export{s as SimpleEffectCursor,i as clipCursorToTileExtent};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as r}from"../../core/fontUtils.js";import{clone as t}from"../../core/lang.js";import i from"../../core/Logger.js";import{pt2px as o,px2pt as a}from"../../core/screenUtils.js";import{numericHash as s}from"../../core/string.js";import{checkForAnimations as l,getAnimationParams as n,handleAbsoluteAnchor as p,handleMarker as c,handleRelativeAnchor as m,getFrameTranslation as y,translate as d,getStaticParam as h,shouldUseAnimatedPath as f}from"./animationUtils.js";import{CIMSymbolHelper as u}from"./CIMSymbolHelper.js";import{defaultCIMValues as v}from"./defaultCIMValues.js";import{Alignment as O,SymbolUnits as g}from"./enums.js";import{fitVectorMarker as _}from"./fitVectorMarker.js";import{OverrideHelper as M}from"./OverrideHelper.js";import{getExtent as S,getSDFMetrics as k,getSDFDimensions as b}from"./SDFHelper.js";import{colorToArray as C,normalizeAlpha as P,getSize as z,isCIMMarkerStrokePlacement as x,getTintColor as E,getNumericValue as I,normalizePrimitiveOverrideProps as L,getDefaultCIMValue as V,getEnum as N,getStrokeWidth as R,getFillColor as A,getStrokeColor as w,fromCIMFontDecoration as G,fromCIMFontStyle as F,fromCIMHorizontalAlignment as T,fromCIMVerticalAlignment as X,isValidCIMValue as Y,uncapitalize as j}from"./utils.js";import{CIMEffectHelper as W}from"./effects/CIMEffectHelper.js";import{rasterizedVectorMarkerMinSize as U,randomInsidePolygonTextureSize as D}from"../../views/2d/engine/webgl/definitions.js";const H=()=>i.getLogger("esri.symbols.cim.cimAnalyzer");function J(e){const r=e.markerPlacement;return r&&r.angleToLine?O.MAP:O.SCREEN}class B{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],e&&(this._resourceManager=e)}analyzeSymbolReference(r,t,i){if(this._cimLayers=i??[],!r)return this._cimLayers;if(this._reset(),r.primitiveOverrides){this._primitiveOverrides=r.primitiveOverrides;for(const r of this._primitiveOverrides){const t=r.valueExpressionInfo;if(t)this._setPoMap(r.primitiveName,r.propertyName,t);else if(null!=r.value){let t=r.value;r.propertyName.includes("Color")&&(e(t)&&(t=C(t)),t=P(t)),this._setPoMap(r.primitiveName,r.propertyName,t)}}}return this._analyzeSymbol(r.symbol,t),this._cimLayers}_reset(){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[]}_analyzeSymbol(e,r){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,r)}}_analyzeMultiLayerSymbol(e,r){const t=e?.symbolLayers;if(!t)return;for(let l=0;l<t.length;l++){const e=t[l];"CIMVectorMarker"===e.type&&(t[l]=_(e,this._resourceManager.geometryEngine))}const i=e.effects;let o=O.SCREEN;const a=z(e)??0;"CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(o=O.MAP);let s={transform:[0,0,0,1],fromColor:[1,1,1,1],toColor:[1,1,1,1],colorMix:[0,0,0,0],toOpacity:[1,1,1,1],opacityMix:[0,0,0,0],hasAnimations:l(e)};s=n(this._poMap,e,s);const p="CIMPolygonSymbol"===e.type;let c=t.length;for(;c--;){const l=t[c];if(!l||!1===l.enable)continue;let n;i?.length&&(n=[...i]);const m=l.effects;m?.length&&(i?n.push(...m):n=[...m]);let y=null;if(n){y=[];for(const e of n){const r=M.findEffectOverrides(e,this._primitiveOverrides);r&&y.push(r)}}const d=[];switch(M.findApplicableOverrides(l,this._primitiveOverrides,d),l.type){case"CIMSolidFill":this._analyzeSolidFill(l,y);break;case"CIMPictureFill":this._analyzePictureFill(l,y);break;case"CIMHatchFill":this._analyzeHatchFill(l,y);break;case"CIMGradientFill":this._analyzeGradientFill(l,y);break;case"CIMSolidStroke":this._analyzeSolidStroke(l,y,p,a);break;case"CIMPictureStroke":this._analyzePictureStroke(l,y,p,a);break;case"CIMGradientStroke":this._analyzeGradientStroke(l,y,p,a);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"!==e.type&&"CIMPolygonSymbol"!==e.type||(o=J(l));const t=[],i=l.primitiveName;i&&t.push(i);const n=p&&x(l.markerPlacement);this._analyzeMarker(l,y,null,t,o,a,r,[],s,!1,n);break}default:H().error("Cannot analyze CIM layer",l.type)}}}_analyzeSolidFill(e,r){const{primitiveName:t,type:i}=e,o=P(e.color);this._cimLayers.push({type:"fill",spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(i,t,"Color",o),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:r,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1})}_analyzePictureFill(e,r){const{primitiveName:t,type:i}=e,o=E(e),a=I(e.height,v.CIMPictureFill.height);let s=I(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height),s/=t*(a/r)}const l={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(t,i)};this._cimLayers.push({type:"fill",spriteRasterizationParam:l,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(i,t,"TintColor",o),height:this._getValueOrOverrideExpression(i,t,"Height",a),scaleX:this._getValueOrOverrideExpression(i,t,"ScaleX",s),angle:this._getValueOrOverrideExpression(i,t,"Rotation",I(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",I(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",I(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1})}_analyzeHatchFill(e,r){const{primitiveName:t,type:i}=e,o=this._analyzeMaterialOverrides(t,["Rotation","OffsetX","OffsetY"]),a=L(o);let s=[255,255,255,1],l=!1;if(e.lineSymbol?.symbolLayers)for(const p of e.lineSymbol.symbolLayers){if("CIMSolidStroke"!==p.type)continue;const e=p.primitiveName??t;l||!e||p.colorLocked||null==this._poMap[e]?.Color&&null==this._poMap[e]?.StrokeColor||(s=P(p.color),s=this._maybeGetValueOrOverrideExpression(e,"StrokeColor")??this._getValueOrOverrideExpression(i,e,"Color",s),l=!0);const r=this._maybeGetValueOrOverrideExpression(e,"StrokeWidth");if(r){let t=null,o=null;"number"==typeof r?t=r:o=r.valueExpressionInfo;let s=a.find((e=>"strokeWidth"===e.propertyName));s?s.propertyName="width":(s={type:"CIMPrimitiveOverride",primitiveName:e,propertyName:"width",valueExpressionInfo:o,value:t,defaultValue:V(i,"width")},a.push(s))}}const n={type:"sprite-rasterization-param",resource:e,overrides:a};this._cimLayers.push({type:"fill",spriteRasterizationParam:n,colorLocked:!!e.colorLocked,effects:r,color:s,height:this._getValueOrOverrideExpression(i,t,"Separation",I(e.separation,v.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(i,t,"Rotation",I(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",I(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",I(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!l})}_analyzeGradientFill(e,r){const{angle:t,gradientMethod:i,gradientSize:o,gradientSizeUnits:a,gradientType:s,interval:l,primitiveName:n,type:p}=e,c=v.CIMGradientFill,m=e.colorRamp;this._cimLayers.push({type:"gradientFill",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(n,p)},colorLocked:!1,effects:r,color:[255,255,255,1],gradientMethod:this._getValueOrOverrideExpression(p,n,"GradientMethod",i??"Linear"),angle:this._getValueOrOverrideExpression(p,n,"Angle",I(t,c.angle)),gradientType:this._getValueOrOverrideExpression(p,n,"GradientType",s??c.gradientType),interval:this._getValueOrOverrideExpression(p,n,"Interval",I(l,"CIMFixedColorRamp"===m.type?m.colors.length:c.interval)),gradientSize:this._getValueOrOverrideExpression(p,n,"GradientSize",I(o,c.gradientSize)),gradientSizeUnits:"Absolute"===a?g.Absolute:"Relative"===a?g.Relative:c.gradientSizeUnits})}_analyzeSolidStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=P(e.color),l=I(e.width,v.CIMSolidStroke.width),n=N(e.capStyle,v.CIMSolidStroke.capstyle),p=N(e.joinStyle,v.CIMSolidStroke.joinstyle),c=e.miterLimit;let m,y,d,h,f=[];if(this._analyzePrimitiveOverrides(o,r,null,null)&&(f=this._getPrimitiveMaterialOverrides(o,a)),r&&Array.isArray(r)&&r.length>0){const e=r[r.length-1].effect;e&&"CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&(m=e.dashTemplate,y=e.scaleDash,d=e.offsetAlongLine,h=e.primitiveName,(r=[...r]).pop())}null!=h&&f.push(...this._getPrimitiveMaterialOverrides(h,a).filter((e=>"dashTemplate"===e.propertyName)));const u=void 0!==m?{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:m,primitiveName:h},overrides:f}:null;this._cimLayers.push({type:"line",spriteRasterizationParam:u,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"Color",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",n),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(a,o,"MiterLimit",c),referenceWidth:i,zOrder:K(e.name),dashTemplate:this._maybeGetValueOrOverrideExpression(h,"DashTemplate")??m,offsetAlongLine:this._getValueOrOverrideExpression(a,h,"OffsetAlongLine",d??0),scaleDash:y,sampleAlphaOnly:!0})}_analyzePictureStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=E(e),l=I(e.width,v.CIMPictureStroke.width),n=N(e.capStyle,v.CIMPictureStroke.capstyle),p=N(e.joinStyle,v.CIMPictureStroke.joinstyle),c=e.miterLimit,m={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(o,a)};this._cimLayers.push({type:"line",spriteRasterizationParam:m,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"TintColor",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",n),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(a,o,"MiterLimit",c),referenceWidth:i,zOrder:K(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeGradientStroke(e,r,t,i){const{gradientMethod:o,gradientSize:a,gradientSizeUnits:s,gradientType:l,interval:n,primitiveName:p,type:c}=e,m=v.CIMGradientStroke,y=I(e.width,m.width),d=N(e.capStyle,m.capstyle),h=N(e.joinStyle,m.joinstyle),f=e.miterLimit,u=e.colorRamp;this._cimLayers.push({type:"gradientStroke",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(p,c)},colorLocked:!!e.colorLocked,effects:r,color:[255,255,255,1],width:this._getValueOrOverrideExpression(c,p,"Width",y),cap:this._getValueOrOverrideExpression(c,p,"CapStyle",d),join:this._getValueOrOverrideExpression(c,p,"JoinStyle",h),miterLimit:f&&this._getValueOrOverrideExpression(c,p,"MiterLimit",f),referenceWidth:i,isOutline:t,gradientMethod:this._getValueOrOverrideExpression(c,p,"GradientMethod",o??m.gradientMethod),gradientType:this._getValueOrOverrideExpression(c,p,"GradientType",l??m.gradientType),interval:this._getValueOrOverrideExpression(c,p,"Interval",I(n,"CIMFixedColorRamp"===u.type?u.colors.length:m.interval)),gradientSize:this._getValueOrOverrideExpression(c,p,"GradientSize",I(a,m.gradientSize)),gradientSizeUnits:"Absolute"===s?g.Absolute:"Relative"===s?g.Relative:m.gradientSizeUnits})}_analyzeMarker(e,r,t,i,o,a,s,l,y,d=!1,h=!1){if(d||=!!e.colorLocked,this._analyzeMarkerInsidePolygon(e,r,d))return;const f=I(e.size,v.CIMVectorMarker.size),u=I(e.rotation),O=I(e.offsetX),g=I(e.offsetY),{primitiveName:_,type:M}=e,S=this._getValueOrOverrideExpression(M,_,"Size",f),k=this._getValueOrOverrideExpression(M,_,"Rotation",u),b=this._getValueOrOverrideExpression(M,_,"OffsetX",O),C=this._getValueOrOverrideExpression(M,_,"OffsetY",g);let P=y;switch(P=p(e,P),P=c(this._poMap,e,P),P=m(e,P),P=n(this._poMap,e,P),e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,r,t,i,o,a,S,k,b,C,l,P,d,h);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,r,t,i,o,a,S,k,b,C,l,P,s,d,h)}}_analyzeMarkerInsidePolygon(e,r,t){const{markerPlacement:i,type:o}=e;if(!i||"CIMMarkerPlacementInsidePolygon"!==i.type)return!1;if("CIMVectorMarker"===o||"CIMPictureMarker"===o){const t=e.primitiveName;if(t&&this._analyzePrimitiveOverrides([t],r,null,null))return!1;const a=i.primitiveName;if(a&&this._analyzePrimitiveOverrides([a],r,null,null))return!1;if("CIMVectorMarker"===o){const{markerGraphics:r}=e;if(r)for(const e of r){const{symbol:r}=e;if("CIMPolygonSymbol"===r?.type&&r.symbolLayers){const{symbolLayers:e}=r;for(const r of e)if("CIMSolidStroke"===r.type)return!1}}}else{const{animatedSymbolProperties:r}=e;if(r)return!1}}const s=Math.abs(i.stepX),l=Math.abs(i.stepY);if(0===s||0===l)return!0;let n,p;if("Random"===i.gridType){const e=a(D),r=Math.max(Math.floor(e/s),1);n=l*Math.max(Math.floor(e/l),1);p=r*s/n}else i.shiftOddRows?(n=2*l,p=s/l*.5):(n=l,p=s/l);const c=E(e),m="CIMCharacterMarker"===e.type?null:{type:"sprite-rasterization-param",resource:e,overrides:[]};return this._cimLayers.push({type:"fill",spriteRasterizationParam:m,colorLocked:t,effects:r,color:c,height:n,scaleX:p,angle:i.gridAngle,offsetX:I(i.offsetX),offsetY:I(i.offsetY),applyRandomOffset:"Random"===i.gridType,sampleAlphaOnly:"CIMPictureMarker"!==e.type,hasUnresolvedReplacementColor:!0}),!0}_analyzePictureMarker(e,r,i,o,a,l,n,p,c,m,y,d,h,f){const{animatedSymbolProperties:u,primitiveName:v,type:O}=e;let g=I(e.scaleX,1);const _=E(e);i||(i=this._createMarkerPlacementOverrideExpression(e.markerPlacement));const M=this._createGIFAnimatedSymbolPropertiesOverrideExpression(u),S=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height);g/=t*(I(e.size)/r)}const k=[...o];let b;e.primitiveName&&k.push(e.primitiveName),u||M?b={type:"animated",url:e.url,urlHash:"H"+s(e.url),playAnimation:e.animatedSymbolProperties?.playAnimation,reverseAnimation:e.animatedSymbolProperties?.reverseAnimation,randomizeStartTime:e.animatedSymbolProperties?.randomizeStartTime,randomizeStartSeed:e.animatedSymbolProperties?.randomizeStartSeed,startTimeOffset:e.animatedSymbolProperties?.startTimeOffset,duration:e.animatedSymbolProperties?.duration,repeatType:e.animatedSymbolProperties?.repeatType,repeatDelay:e.animatedSymbolProperties?.repeatDelay}:(b=t(e),b.markerPlacement=null);const C={type:"sprite-rasterization-param",resource:b,overrides:this._getMaterialOverrides(k,O)};M&&C.overrides.push(...M.overrides);const P=n;this._cimLayers.push({type:"marker",spriteRasterizationParam:C,colorLocked:h,effects:r,scaleSymbolsProportionally:!1,alignment:a,size:n,scaleX:this._getValueOrOverrideExpression(O,v,"ScaleX",g),rotation:p,offsetX:c,offsetY:m,transform:{type:"cim-marker-transform-param",params:y},color:this._getValueOrOverrideExpression(O,v,"TintColor",_),anchorPoint:{x:S.x,y:S.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:1,isOutline:f,markerPlacement:i,animationParams:te(d),baseSize:P})}_analyzeVectorMarker(e,r,t,i,o,a,s,l,p,c,m,f,u,v,O){const g=e.markerGraphics;if(!g)return;const _=e.frame;let M=0;M=_?_.ymax-_.ymin:a;const S=!!e.scaleSymbolsProportionally;if(M){const r={offsetX:p,offsetY:c,rotation:l,size:s,frameHeight:M,rotateClockWise:!!e.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:S};m=[...m,r]}t||(t=this._createMarkerPlacementOverrideExpression(e.markerPlacement));for(const k of g)if(k){const s=k.symbol;if(!s)continue;const l=k.primitiveName;l&&i.push(l);let p,c=f;if(("CIMPointSymbol"===s.type||"CIMTextSymbol"===s.type)&&_){let r=0,t=0;const i=k.geometry;"x"in i&&"y"in i&&(r+=i.x-.5*(_.xmin+_.xmax),t+=i.y-.5*(_.ymin+_.ymax));const o=e.anchorPoint;let a=!1;o&&("Absolute"===e.anchorPointUnits?(r-=o.x,t-=o.y,a=!0):_&&(r-=(_.xmax-_.xmin)*o.x,t-=(_.ymax-_.ymin)*o.y));const s={offsetX:r,offsetY:t,rotation:0,size:0,frameHeight:0,rotateClockWise:!1,absoluteAnchorPoint:a,scaleSymbolsProportionally:S};p=[...m,s]}const g=k.geometry,[b,C]=y(g,_);switch(0===b&&0===C||(c=d(c,b,C)),"CIMPointSymbol"===s.type&&(c=n(this._poMap,s,c)),s.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":u||$(s)?(c={...c,transform:{type:"AnimatedTransform",relativeTranslation:!1,absoluteScale:!0,translation:h([0,0]),rotation:h(0),scale:h(M),parent:f.transform}},this._analyzeMultiLayerGraphicNonSDF(e,r,t,k,i,o,a,p??m,c,M,v,O)):this._analyzeMultiLayerGraphic(e,r,t,k,i,o,a,p??m,c,M,v,O);break;case"CIMTextSymbol":this._analyzeTextGraphic(r,t,k,i,o,a,p??m,v)}l&&i.pop()}}_analyzeMultiLayerGraphic(e,r,t,i,o,a,s,l,n,p,c,m){const y=i.symbol.symbolLayers;y&&(!Z(y)||f(n)?ee(y)?this._analyzeMultiLayerGraphicNonSDF(e,r,t,i,o,a,s,l,n,p,!!c,m):this._analyzeMarkerGraphicSymbolLayers(e,r,t,i,o,a,s,l,n,p,c,m):this._analyzeCompositeMarkerGraphic(e,r,t,i,y,a,s,l,p,c,m))}_analyzeMarkerGraphicSymbolLayers(e,r,t,i,o,a,s,l,p,c,m,y){const d=i.symbol,h=d.symbolLayers;if(!h)return;const f=this._resourceManager.geometryEngine,u=W.applyEffects(d.effects,i.geometry,f);if(!u)return;let O=h.length;for(;O--;){const d=h[O];if(!d||!1===d.enable)continue;const g=d.primitiveName;switch(g&&o.push(g),d.type){case"CIMSolidFill":case"CIMSolidStroke":{const o=W.applyEffects(d.effects,u,f),h=S(o);if(!h)continue;const O="Relative"!==e.anchorPointUnits,_=R(d)??0,{frameSizeRatio:M,anchorX:C,anchorY:z,widthRatio:x,sdfPaddingRatio:E}=k(h,e.frame,e.size,e.anchorPoint,O,_,e.scaleSymbolsProportionally),L="CIMSolidFill"===d.type,V={type:"sdf",geom:o,sdfPaddingRatio:E,asFill:L},{path:N}=d,G=L?P(A(d)):null==N?P(w(d)):[0,0,0,0],F=L?[0,0,0,0]:P(w(d));if(!L&&!_)break;const T=i.primitiveName;let X=null;L&&!d.colorLocked&&(X=this._maybeGetValueOrOverrideExpression(T,"FillColor"));let Y=null;L||d.colorLocked||(Y=this._maybeGetValueOrOverrideExpression(T,"StrokeColor"));const j=X??this._getValueOrOverrideExpression(d.type,g,"Color",G),U=Y??this._getValueOrOverrideExpression(d.type,g,"Color",F),D=this._maybeGetValueOrOverrideExpression(T,"StrokeWidth")??this._getValueOrOverrideExpression(d.type,g,"Width",_),H=N?{type:"sprite-rasterization-param",resource:{type:"path",path:N,asFill:L},overrides:[]}:{type:"sprite-rasterization-param",resource:V,overrides:[]},J=n(this._poMap,d,p),B=I(e.size,v.CIMVectorMarker.size),q=this._getValueOrOverrideExpression(e.type,e.primitiveName,"Size",B);this._cimLayers.push({type:"marker",spriteRasterizationParam:H,colorLocked:!!d.colorLocked||!!m,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:C,y:z},isAbsoluteAnchorPoint:O,size:c,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:c,widthRatio:x,rotateClockwise:!1,referenceSize:s,sizeRatio:M,color:j,outlineColor:U,outlineWidth:D,isOutline:y,markerPlacement:t,animationParams:te(J),isStroke:"CIMSolidFill"!==d.type,baseSize:q,...b(o,E)});break}case"CIMPictureMarker":case"CIMVectorMarker":if(d.markerPlacement){H().error("Error analyzing CIM, got unexpected marker placement");break}this._analyzeMarker(d,r,t,o,a,s,!1,l,p,m,y)}g&&o.pop()}}_analyzeTextGraphic(e,t,i,o,a,s,l,n){const p=[];M.findApplicableOverrides(i,this._primitiveOverrides,p);const c=i.geometry;if(!("x"in c)||!("y"in c))return;const m=i.symbol,y=G(m),d=F(m.fontStyleName),h=r(m.fontFamilyName);m.font={family:h,decoration:y,...d};const f=I(m.height,v.CIMTextSymbol.height),u=I(m.angle),O=I(m.offsetX),g=I(m.offsetY),{haloSymbol:_}=m,S=I(m.haloSize,0);let k=[0,0,0,0];if(_?.symbolLayers?.length){const e=_.symbolLayers;for(const r of e)if(r.color){k=this._getValueOrOverrideExpression(m?.haloSymbol?.type??"CIMPolygonSymbol",r.primitiveName,"Color",P(r.color));break}}const b=i.primitiveName;let C=[0,0,0,1],z=[0,0,0,0],x=0,E=!1;if(m.symbol?.symbolLayers)for(const r of m.symbol.symbolLayers){const e=r.primitiveName;if("CIMSolidStroke"===r.type)z=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Color",P(r.color)),x=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Width",R(r)??0);else if("CIMSolidFill"===r.type){const t=P(r.color);E=E??!!r.colorLocked,C=this._getValueOrOverrideExpression("CIMSolidFill",e??b,"Color",t)}}let L=null,V=null,N=null,A=null,w=null;b&&(L=this._maybeGetValueOrOverrideExpression(b,"TextSize"),V=this._maybeGetValueOrOverrideExpression(b,"TextAngle"),N=this._maybeGetValueOrOverrideExpression(b,"TextOffsetX"),A=this._maybeGetValueOrOverrideExpression(b,"TextOffsetY"),E||(w=this._maybeGetValueOrOverrideExpression(b,"FillColor")));const Y=w??C;let j=null,W=null,U=0;if(m.callout&&"CIMBackgroundCallout"===m.callout.type){const e=m.callout;if(e.backgroundSymbol){const r=e.backgroundSymbol.symbolLayers;if(r)for(const e of r)"CIMSolidFill"===e.type?j=P(e.color):"CIMSolidStroke"===e.type&&(W=P(e.color),U=I(e.width,v.CIMSolidStroke.width))}}const D=this._getValueOrOverrideExpression(m.type,i.primitiveName,"TextString",i.textString??"");if(null==D)return;const{fontStyleName:H}=m,J=h+(H?"-"+H.toLowerCase():"-regular"),B=this._getMaterialOverrides(o,m.type);B.push(...this._getPrimitiveMaterialOverrides(i.primitiveName,m.type));const q={type:"text-rasterization-param",resource:{type:"text",textString:i.textString??"",font:m.font,symbol:m,primitiveName:i.primitiveName},overrides:B};this._cimLayers.push({type:"text",lineWidth:m.lineWidth,textRasterizationParam:q,colorLocked:!!n||!!E,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:J,decoration:y,haloSize:S,haloColor:k,weight:d.weight,style:d.style,size:L??f,angle:V??u,offsetX:N??O,offsetY:A??g,transform:{type:"cim-marker-transform-param",params:l},horizontalAlignment:T(m.horizontalAlignment),verticalAlignment:X(m.verticalAlignment),text:D,color:Y,outlineColor:z,outlineSize:x,backgroundColor:j,borderLineColor:W,borderLineWidth:U,referenceSize:s,sizeRatio:1,markerPlacement:t})}_analyzeMultiLayerGraphicNonSDF(e,r,t,i,a,s,l,n,p,c,m,y){const d=q(e,i),h=e.primitiveName,f=this._analyzeMaterialOverrides(h,["Rotation","OffsetX","OffsetY"]),O=L(f),[g,_,M]=u.getTextureAnchor(d,this._resourceManager,U),S=this._getMaterialOverrides(a,e.type);S.push(...O);const k={type:"sprite-rasterization-param",resource:{...d,avoidSDFRasterization:!0},overrides:S},b=I(e.size,v.CIMVectorMarker.size),C=this._getValueOrOverrideExpression(e.type,h,"Size",b);this._cimLayers.push({type:"marker",spriteRasterizationParam:k,colorLocked:m,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:g,y:_},isAbsoluteAnchorPoint:!1,size:c,rotation:0,offsetX:0,offsetY:0,transform:{type:"cim-marker-transform-param",params:n},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:c,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:M/o(e.size),isOutline:y,markerPlacement:t,animationParams:te(p),baseSize:C})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;const r=[];return M.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-marker-placement-param",placement:e,overrides:re(r)}}_createGIFAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;const r=[];return M.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-gif-animation-params",animation:e,overrides:re(r)}}_analyzeCompositeMarkerGraphic(e,r,t,i,o,a,s,l,n,p,c){const m=i.geometry,y=o[0],d=o[1],h=S(m);if(!h)return;const f="Relative"!==e.anchorPointUnits,u=I(y.width,v.CIMSolidStroke.width),{frameSizeRatio:O,anchorX:g,anchorY:_,widthRatio:M,sdfPaddingRatio:b}=k(h,e.frame,e.size,e.anchorPoint,f,u,e.scaleSymbolsProportionally),{path:C}=d,z=d.primitiveName,x=y.primitiveName,E=i.primitiveName;let L=null;d.colorLocked||p||(L=this._maybeGetValueOrOverrideExpression(E,"FillColor"));const V=L??this._getValueOrOverrideExpression(d.type,z,"Color",P(d.color));let N=null;y.colorLocked||p||(N=this._maybeGetValueOrOverrideExpression(E,"StrokeColor"));const R=N??this._getValueOrOverrideExpression(y.type,x,"Color",P(y.color)),A=this._maybeGetValueOrOverrideExpression(E,"StrokeWidth")??this._getValueOrOverrideExpression(y.type,x,"Width",u),w={type:"sprite-rasterization-param",resource:C?{type:"path",path:C,asFill:!0}:{type:"sdf",geom:m,sdfPaddingRatio:b,asFill:!0},overrides:[]};this._cimLayers.push({type:"marker",spriteRasterizationParam:w,colorLocked:p,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:g,y:_},isAbsoluteAnchorPoint:f,size:n,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:n,widthRatio:M,rotateClockwise:!1,referenceSize:s,sizeRatio:O,color:V,outlineColor:R,outlineWidth:A,isOutline:c,markerPlacement:t})}_setPoMap(e,r,t){let i;this._poMap[e]?i=this._poMap[e]:(i={},this._poMap[e]=i),i[r]=t}_maybeGetValueOrOverrideExpression(e,r,t){return this._getValueOrOverrideExpression("",e,r,t,!1)}_getValueOrOverrideExpression(e,r,t,i,o=!0){if(o&&!Y(i)&&(i=V(e,t.toLowerCase())),null==r)return i;const a=this._poMap[r];if(null==a)return i;const s=a[t];return"string"==typeof s||"number"==typeof s||Array.isArray(s)?s:s?{valueExpressionInfo:s,defaultValue:i}:i}_analyzePrimitiveOverrides(e,r,t,i){if(null==e)return!1;"string"==typeof e&&(e=[e]);for(const o of this._primitiveOverrides)if(e.includes(o.primitiveName)&&o.valueExpressionInfo)return!0;if(null!=r)for(const o of r)if(o?.overrides.length>0)return!0;if(null!=t)for(const o of t)if(o?.overrides.length>0)return!0;if(null!=i)for(const o of i)if(o?.overrides.length>0)return!0;return!1}_getMaterialOverrides(e,r){if(!e)return[];const t=[];for(const i of e)t.push(...this._getPrimitiveMaterialOverrides(i,r));return t}_getPrimitiveMaterialOverrides(e,r){if(!e)return[];const t=L(this._primitiveOverrides.filter((r=>r.primitiveName===e)));return t.forEach((e=>e.defaultValue=V(r,e.propertyName.toLowerCase()))),t}_analyzeMaterialOverrides(e,r){return this._primitiveOverrides.filter((t=>t.primitiveName!==e||!r.includes(t.propertyName)))}}function q(e,r){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[r],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}function K(e){if(e&&0===e.indexOf("Level_")){const r=parseInt(e.slice(6),10);if(!isNaN(r))return r}return 0}function Q(e,r){if(!r||0===r.length)return e;const i=t(e);return M.applyOverrides(i,r),i}const Z=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&null==e[0].path&&null==e[1].path&&!e[0].effects&&!e[1].effects&&!e[0].animations&&!e[1].animations;function $(e){const r=e.symbolLayers;if(!r)return!1;const t=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectDashes"===e.type&&null!=e.dashTemplate)))),i=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectAddControlPoints"===e.type))));return!!t||!!i}function ee(e){return e.some((e=>"CIMSolidFill"!==e.type&&"CIMSolidStroke"!==e.type&&("CIMVectorMarker"!==e.type&&"CIMPictureMarker"!==e.type||null!=e.markerPlacement)))}function re(e){return t(e).map((e=>({...e,propertyName:j(e.propertyName)})))}function te(e){return f(e)?{type:"animation-params",params:e}:null}export{B as CIMAnalyzer,Q as analyzeCIMResource};
5
+ import{isRGB as e}from"../../core/colorUtils.js";import{getFontFamily as r}from"../../core/fontUtils.js";import{clone as t}from"../../core/lang.js";import i from"../../core/Logger.js";import{pt2px as o,px2pt as a}from"../../core/screenUtils.js";import{numericHash as s}from"../../core/string.js";import{checkForAnimations as l,getAnimationParams as n,handleAbsoluteAnchor as p,handleMarker as c,handleRelativeAnchor as m,getFrameTranslation as y,translate as d,getStaticParam as h,shouldUseAnimatedPath as f}from"./animationUtils.js";import{CIMSymbolHelper as u}from"./CIMSymbolHelper.js";import{defaultCIMValues as v}from"./defaultCIMValues.js";import{Alignment as O,SymbolUnits as g}from"./enums.js";import{fitVectorMarker as _}from"./fitVectorMarker.js";import{OverrideHelper as M}from"./OverrideHelper.js";import{getExtent as S,getSDFMetrics as k,getSDFDimensions as b}from"./SDFHelper.js";import{colorToArray as C,normalizeAlpha as P,getSize as z,isCIMMarkerStrokePlacement as x,getTintColor as E,getNumericValue as I,normalizePrimitiveOverrideProps as L,getDefaultCIMValue as V,getEnum as N,getStrokeWidth as R,getFillColor as A,getStrokeColor as w,fromCIMFontDecoration as G,fromCIMFontStyle as F,fromCIMHorizontalAlignment as T,fromCIMVerticalAlignment as X,isValidCIMValue as Y,uncapitalize as j}from"./utils.js";import{CIMEffectHelper as W}from"./effects/CIMEffectHelper.js";import{rasterizedVectorMarkerMinSize as U,randomInsidePolygonTextureSize as D}from"../../views/2d/engine/webgl/definitions.js";const H=()=>i.getLogger("esri.symbols.cim.cimAnalyzer");function J(e){const r=e.markerPlacement;return r&&r.angleToLine?O.MAP:O.SCREEN}class B{constructor(e){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[],e&&(this._resourceManager=e)}analyzeSymbolReference(r,t,i){if(this._cimLayers=i??[],!r)return this._cimLayers;if(this._reset(),r.primitiveOverrides){this._primitiveOverrides=r.primitiveOverrides;for(const r of this._primitiveOverrides){const t=r.valueExpressionInfo;if(t)this._setPoMap(r.primitiveName,r.propertyName,t);else if(null!=r.value){let t=r.value;r.propertyName.includes("Color")&&(e(t)&&(t=C(t)),t=P(t)),this._setPoMap(r.primitiveName,r.propertyName,t)}}}return this._analyzeSymbol(r.symbol,t),this._cimLayers}_reset(){this._cimLayers=[],this._poMap={},this._primitiveOverrides=[]}_analyzeSymbol(e,r){switch(e?.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":this._analyzeMultiLayerSymbol(e,r)}}_analyzeMultiLayerSymbol(e,r){const t=e?.symbolLayers;if(!t)return;for(let l=0;l<t.length;l++){const e=t[l];"CIMVectorMarker"===e.type&&(t[l]=_(e,this._resourceManager.geometryEngine))}const i=e.effects;let o=O.SCREEN;const a=z(e)??0;"CIMPointSymbol"===e.type&&"Map"===e.angleAlignment&&(o=O.MAP);let s={transform:[0,0,0,1],fromColor:[1,1,1,1],toColor:[1,1,1,1],colorMix:[0,0,0,0],toOpacity:[1,1,1,1],opacityMix:[0,0,0,0],hasAnimations:l(e)};s=n(this._poMap,e,s);const p="CIMPolygonSymbol"===e.type;let c=t.length;for(;c--;){const l=t[c];if(!l||!1===l.enable)continue;let n;i?.length&&(n=[...i]);const m=l.effects;m?.length&&(i?n.push(...m):n=[...m]);let y=null;if(n){y=[];for(const e of n){const r=M.findEffectOverrides(e,this._primitiveOverrides);r&&y.push(r)}}const d=[];switch(M.findApplicableOverrides(l,this._primitiveOverrides,d),l.type){case"CIMSolidFill":this._analyzeSolidFill(l,y);break;case"CIMPictureFill":this._analyzePictureFill(l,y);break;case"CIMHatchFill":this._analyzeHatchFill(l,y);break;case"CIMGradientFill":this._analyzeGradientFill(l,y);break;case"CIMSolidStroke":this._analyzeSolidStroke(l,y,p,a);break;case"CIMPictureStroke":this._analyzePictureStroke(l,y,p,a);break;case"CIMGradientStroke":this._analyzeGradientStroke(l,y,p,a);break;case"CIMCharacterMarker":case"CIMPictureMarker":case"CIMVectorMarker":{"CIMLineSymbol"!==e.type&&"CIMPolygonSymbol"!==e.type||(o=J(l));const t=[],i=l.primitiveName;i&&t.push(i);const n=p&&x(l.markerPlacement);this._analyzeMarker(l,y,null,t,o,a,r,[],s,!1,n);break}default:H().error("Cannot analyze CIM layer",l.type)}}}_analyzeSolidFill(e,r){const{primitiveName:t,type:i}=e,o=P(e.color);this._cimLayers.push({type:"fill",spriteRasterizationParam:null,colorLocked:!!e.colorLocked,color:this._getValueOrOverrideExpression(i,t,"Color",o),height:0,angle:0,offsetX:0,offsetY:0,scaleX:1,effects:r,applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!1})}_analyzePictureFill(e,r){const{primitiveName:t,type:i}=e,o=E(e),a=I(e.height,v.CIMPictureFill.height);let s=I(e.scaleX,1);if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height),s/=t*(a/r)}const l={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(t,i)};this._cimLayers.push({type:"fill",spriteRasterizationParam:l,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(i,t,"TintColor",o),height:this._getValueOrOverrideExpression(i,t,"Height",a),scaleX:this._getValueOrOverrideExpression(i,t,"ScaleX",s),angle:this._getValueOrOverrideExpression(i,t,"Rotation",I(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",I(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",I(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!1,hasUnresolvedReplacementColor:!1})}_analyzeHatchFill(e,r){const{primitiveName:t,type:i}=e,o=this._analyzeMaterialOverrides(t,["Rotation","OffsetX","OffsetY"]),a=L(o);let s=[255,255,255,1],l=!1;if(e.lineSymbol?.symbolLayers)for(const p of e.lineSymbol.symbolLayers){if("CIMSolidStroke"!==p.type)continue;const e=p.primitiveName??t;l||!e||p.colorLocked||null==this._poMap[e]?.Color&&null==this._poMap[e]?.StrokeColor||(s=P(p.color),s=this._maybeGetValueOrOverrideExpression(e,"StrokeColor")??this._getValueOrOverrideExpression(i,e,"Color",s),l=!0);const r=this._maybeGetValueOrOverrideExpression(e,"StrokeWidth");if(r){let t=null,o=null;"number"==typeof r?t=r:o=r.valueExpressionInfo;let s=a.find((e=>"strokeWidth"===e.propertyName));s?s.propertyName="width":(s={type:"CIMPrimitiveOverride",primitiveName:e,propertyName:"width",valueExpressionInfo:o,value:t,defaultValue:V(i,"width")},a.push(s))}}const n={type:"sprite-rasterization-param",resource:e,overrides:a};this._cimLayers.push({type:"fill",spriteRasterizationParam:n,colorLocked:!!e.colorLocked,effects:r,color:s,height:this._getValueOrOverrideExpression(i,t,"Separation",I(e.separation,v.CIMHatchFill.separation)),scaleX:1,angle:this._getValueOrOverrideExpression(i,t,"Rotation",I(e.rotation)),offsetX:this._getValueOrOverrideExpression(i,t,"OffsetX",I(e.offsetX)),offsetY:this._getValueOrOverrideExpression(i,t,"OffsetY",I(e.offsetY)),applyRandomOffset:!1,sampleAlphaOnly:!0,hasUnresolvedReplacementColor:!l})}_analyzeGradientFill(e,r){const{angle:t,gradientMethod:i,gradientSize:o,gradientSizeUnits:a,gradientType:s,interval:l,primitiveName:n,type:p}=e,c=v.CIMGradientFill,m=e.colorRamp;this._cimLayers.push({type:"gradientFill",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(n,p)},colorLocked:!1,effects:r,color:[255,255,255,1],gradientMethod:this._getValueOrOverrideExpression(p,n,"GradientMethod",i??"Linear"),angle:this._getValueOrOverrideExpression(p,n,"Angle",I(t,c.angle)),gradientType:this._getValueOrOverrideExpression(p,n,"GradientType",s??c.gradientType),interval:this._getValueOrOverrideExpression(p,n,"Interval",I(l,"CIMFixedColorRamp"===m.type?m.colors.length:c.interval)),gradientSize:this._getValueOrOverrideExpression(p,n,"GradientSize",I(o,c.gradientSize)),gradientSizeUnits:"Absolute"===a?g.Absolute:"Relative"===a?g.Relative:c.gradientSizeUnits})}_analyzeSolidStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=P(e.color),l=I(e.width,v.CIMSolidStroke.width),n=N(e.capStyle,v.CIMSolidStroke.capstyle),p=N(e.joinStyle,v.CIMSolidStroke.joinstyle),c=e.miterLimit;let m,y,d,h,f=[];if(this._analyzePrimitiveOverrides(o,r,null,null)&&(f=this._getPrimitiveMaterialOverrides(o,a)),r&&Array.isArray(r)&&r.length>0){const e=r[r.length-1].effect;e&&"CIMGeometricEffectDashes"===e.type&&"NoConstraint"===e.lineDashEnding&&(m=e.dashTemplate,y=e.scaleDash,d=e.offsetAlongLine,h=e.primitiveName,(r=[...r]).pop())}null!=h&&f.push(...this._getPrimitiveMaterialOverrides(h,a).filter((e=>"dashTemplate"===e.propertyName)));const u=void 0!==m?{type:"sprite-rasterization-param",resource:{type:"dash",dashTemplate:m,primitiveName:h},overrides:f}:null;this._cimLayers.push({type:"line",spriteRasterizationParam:u,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"Color",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",n),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(a,o,"MiterLimit",c),referenceWidth:i,zOrder:K(e.name),dashTemplate:this._maybeGetValueOrOverrideExpression(h,"DashTemplate")??m,offsetAlongLine:this._getValueOrOverrideExpression(a,h,"OffsetAlongLine",d??0),scaleDash:y,sampleAlphaOnly:!0})}_analyzePictureStroke(e,r,t,i){const{primitiveName:o,type:a}=e,s=E(e),l=I(e.width,v.CIMPictureStroke.width),n=N(e.capStyle,v.CIMPictureStroke.capstyle),p=N(e.joinStyle,v.CIMPictureStroke.joinstyle),c=e.miterLimit,m={type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(o,a)};this._cimLayers.push({type:"line",spriteRasterizationParam:m,isOutline:t,colorLocked:!!e.colorLocked,effects:r,color:this._getValueOrOverrideExpression(a,o,"TintColor",s),width:this._getValueOrOverrideExpression(a,o,"Width",l),cap:this._getValueOrOverrideExpression(a,o,"CapStyle",n),join:this._getValueOrOverrideExpression(a,o,"JoinStyle",p),miterLimit:c&&this._getValueOrOverrideExpression(a,o,"MiterLimit",c),referenceWidth:i,zOrder:K(e.name),dashTemplate:null,scaleDash:!1,sampleAlphaOnly:!1})}_analyzeGradientStroke(e,r,t,i){const{gradientMethod:o,gradientSize:a,gradientSizeUnits:s,gradientType:l,interval:n,primitiveName:p,type:c}=e,m=v.CIMGradientStroke,y=I(e.width,m.width),d=N(e.capStyle,m.capstyle),h=N(e.joinStyle,m.joinstyle),f=e.miterLimit,u=e.colorRamp;this._cimLayers.push({type:"gradientStroke",spriteRasterizationParam:{type:"sprite-rasterization-param",resource:e,overrides:this._getPrimitiveMaterialOverrides(p,c)},colorLocked:!!e.colorLocked,effects:r,color:[255,255,255,1],width:this._getValueOrOverrideExpression(c,p,"Width",y),cap:this._getValueOrOverrideExpression(c,p,"CapStyle",d),join:this._getValueOrOverrideExpression(c,p,"JoinStyle",h),miterLimit:f&&this._getValueOrOverrideExpression(c,p,"MiterLimit",f),referenceWidth:i,isOutline:t,gradientMethod:this._getValueOrOverrideExpression(c,p,"GradientMethod",o??m.gradientMethod),gradientType:this._getValueOrOverrideExpression(c,p,"GradientType",l??m.gradientType),interval:this._getValueOrOverrideExpression(c,p,"Interval",I(n,"CIMFixedColorRamp"===u.type?u.colors.length:m.interval)),gradientSize:this._getValueOrOverrideExpression(c,p,"GradientSize",I(a,m.gradientSize)),gradientSizeUnits:"Absolute"===s?g.Absolute:"Relative"===s?g.Relative:m.gradientSizeUnits})}_analyzeMarker(e,r,t,i,o,a,s,l,y,d=!1,h=!1){if(d||=!!e.colorLocked,this._analyzeMarkerInsidePolygon(e,r,d))return;const f=I(e.size,v.CIMVectorMarker.size),u=I(e.rotation),O=I(e.offsetX),g=I(e.offsetY),{primitiveName:_,type:M}=e,S=this._getValueOrOverrideExpression(M,_,"Size",f),k=this._getValueOrOverrideExpression(M,_,"Rotation",u),b=this._getValueOrOverrideExpression(M,_,"OffsetX",O),C=this._getValueOrOverrideExpression(M,_,"OffsetY",g);let P=y;switch(P=n(this._poMap,e,P),P=p(e,P),P=c(this._poMap,e,P),P=m(e,P),e.type){case"CIMPictureMarker":this._analyzePictureMarker(e,r,t,i,o,a,S,k,b,C,l,P,d,h);break;case"CIMVectorMarker":this._analyzeVectorMarker(e,r,t,i,o,a,S,k,b,C,l,P,s,d,h)}}_analyzeMarkerInsidePolygon(e,r,t){const{markerPlacement:i,type:o}=e;if(!i||"CIMMarkerPlacementInsidePolygon"!==i.type)return!1;if("CIMVectorMarker"===o||"CIMPictureMarker"===o){const t=e.primitiveName;if(t&&this._analyzePrimitiveOverrides([t],r,null,null))return!1;const a=i.primitiveName;if(a&&this._analyzePrimitiveOverrides([a],r,null,null))return!1;if("CIMVectorMarker"===o){const{markerGraphics:r}=e;if(r)for(const e of r){const{symbol:r}=e;if("CIMPolygonSymbol"===r?.type&&r.symbolLayers){const{symbolLayers:e}=r;for(const r of e)if("CIMSolidStroke"===r.type)return!1}}}else{const{animatedSymbolProperties:r}=e;if(r)return!1}}const s=Math.abs(i.stepX),l=Math.abs(i.stepY);if(0===s||0===l)return!0;let n,p;if("Random"===i.gridType){const e=a(D),r=Math.max(Math.floor(e/s),1);n=l*Math.max(Math.floor(e/l),1);p=r*s/n}else i.shiftOddRows?(n=2*l,p=s/l*.5):(n=l,p=s/l);const c=E(e),m="CIMCharacterMarker"===e.type?null:{type:"sprite-rasterization-param",resource:e,overrides:[]};return this._cimLayers.push({type:"fill",spriteRasterizationParam:m,colorLocked:t,effects:r,color:c,height:n,scaleX:p,angle:i.gridAngle,offsetX:I(i.offsetX),offsetY:I(i.offsetY),applyRandomOffset:"Random"===i.gridType,sampleAlphaOnly:"CIMPictureMarker"!==e.type,hasUnresolvedReplacementColor:!0}),!0}_analyzePictureMarker(e,r,i,o,a,l,n,p,c,m,y,d,h,f){const{animatedSymbolProperties:u,primitiveName:v,type:O}=e;let g=I(e.scaleX,1);const _=E(e);i||(i=this._createMarkerPlacementOverrideExpression(e.markerPlacement));const M=this._createGIFAnimatedSymbolPropertiesOverrideExpression(u),S=e.anchorPoint??{x:0,y:0};if("width"in e&&"number"==typeof e.width){const r=e.width;let t=1;const i=this._resourceManager.getResource(e.url);null!=i&&(t=i.width/i.height);g/=t*(I(e.size)/r)}const k=[...o];let b;e.primitiveName&&k.push(e.primitiveName),u||M?b={type:"animated",url:e.url,urlHash:"H"+s(e.url),playAnimation:e.animatedSymbolProperties?.playAnimation,reverseAnimation:e.animatedSymbolProperties?.reverseAnimation,randomizeStartTime:e.animatedSymbolProperties?.randomizeStartTime,randomizeStartSeed:e.animatedSymbolProperties?.randomizeStartSeed,startTimeOffset:e.animatedSymbolProperties?.startTimeOffset,duration:e.animatedSymbolProperties?.duration,repeatType:e.animatedSymbolProperties?.repeatType,repeatDelay:e.animatedSymbolProperties?.repeatDelay}:(b=t(e),b.markerPlacement=null);const C={type:"sprite-rasterization-param",resource:b,overrides:this._getMaterialOverrides(k,O)};M&&C.overrides.push(...M.overrides);const P=n;this._cimLayers.push({type:"marker",spriteRasterizationParam:C,colorLocked:h,effects:r,scaleSymbolsProportionally:!1,alignment:a,size:n,scaleX:this._getValueOrOverrideExpression(O,v,"ScaleX",g),rotation:p,offsetX:c,offsetY:m,transform:{type:"cim-marker-transform-param",params:y},color:this._getValueOrOverrideExpression(O,v,"TintColor",_),anchorPoint:{x:S.x,y:S.y},isAbsoluteAnchorPoint:"Relative"!==e.anchorPointUnits,outlineColor:[0,0,0,0],outlineWidth:0,frameHeight:0,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:1,isOutline:f,markerPlacement:i,animationParams:te(d),baseSize:P})}_analyzeVectorMarker(e,r,t,i,o,a,s,l,p,c,m,f,u,v,O){const g=e.markerGraphics;if(!g)return;const _=e.frame;let M=0;M=_?_.ymax-_.ymin:a;const S=!!e.scaleSymbolsProportionally;if(M){const r={offsetX:p,offsetY:c,rotation:l,size:s,frameHeight:M,rotateClockWise:!!e.rotateClockwise,absoluteAnchorPoint:!1,scaleSymbolsProportionally:S};m=[...m,r]}t||(t=this._createMarkerPlacementOverrideExpression(e.markerPlacement));for(const k of g)if(k){const s=k.symbol;if(!s)continue;const l=k.primitiveName;l&&i.push(l);let p,c=f;if(("CIMPointSymbol"===s.type||"CIMTextSymbol"===s.type)&&_){let r=0,t=0;const i=k.geometry;"x"in i&&"y"in i&&(r+=i.x-.5*(_.xmin+_.xmax),t+=i.y-.5*(_.ymin+_.ymax));const o=e.anchorPoint;let a=!1;o&&("Absolute"===e.anchorPointUnits?(r-=o.x,t-=o.y,a=!0):_&&(r-=(_.xmax-_.xmin)*o.x,t-=(_.ymax-_.ymin)*o.y));const s={offsetX:r,offsetY:t,rotation:0,size:0,frameHeight:0,rotateClockWise:!1,absoluteAnchorPoint:a,scaleSymbolsProportionally:S};p=[...m,s]}const g=k.geometry,[b,C]=y(g,_);switch(0===b&&0===C||(c=d(c,b,C)),"CIMPointSymbol"===s.type&&(c=n(this._poMap,s,c)),s.type){case"CIMPointSymbol":case"CIMLineSymbol":case"CIMPolygonSymbol":u||$(s)?(c={...c,transform:{type:"AnimatedTransform",relativeTranslation:!1,absoluteScale:!0,translation:h([0,0]),rotation:h(0),scale:h(M),parent:f.transform}},this._analyzeMultiLayerGraphicNonSDF(e,r,t,k,i,o,a,p??m,c,M,v,O)):this._analyzeMultiLayerGraphic(e,r,t,k,i,o,a,p??m,c,M,v,O);break;case"CIMTextSymbol":this._analyzeTextGraphic(r,t,k,i,o,a,p??m,v)}l&&i.pop()}}_analyzeMultiLayerGraphic(e,r,t,i,o,a,s,l,n,p,c,m){const y=i.symbol.symbolLayers;y&&(!Z(y)||f(n)?ee(y)?this._analyzeMultiLayerGraphicNonSDF(e,r,t,i,o,a,s,l,n,p,!!c,m):this._analyzeMarkerGraphicSymbolLayers(e,r,t,i,o,a,s,l,n,p,c,m):this._analyzeCompositeMarkerGraphic(e,r,t,i,y,a,s,l,p,c,m))}_analyzeMarkerGraphicSymbolLayers(e,r,t,i,o,a,s,l,p,c,m,y){const d=i.symbol,h=d.symbolLayers;if(!h)return;const f=this._resourceManager.geometryEngine,u=W.applyEffects(d.effects,i.geometry,f);if(!u)return;let O=h.length;for(;O--;){const d=h[O];if(!d||!1===d.enable)continue;const g=d.primitiveName;switch(g&&o.push(g),d.type){case"CIMSolidFill":case"CIMSolidStroke":{const o=W.applyEffects(d.effects,u,f),h=S(o);if(!h)continue;const O="Relative"!==e.anchorPointUnits,_=R(d)??0,{frameSizeRatio:M,anchorX:C,anchorY:z,widthRatio:x,sdfPaddingRatio:E}=k(h,e.frame,e.size,e.anchorPoint,O,_,e.scaleSymbolsProportionally),L="CIMSolidFill"===d.type,V={type:"sdf",geom:o,sdfPaddingRatio:E,asFill:L},{path:N}=d,G=L?P(A(d)):null==N?P(w(d)):[0,0,0,0],F=L?[0,0,0,0]:P(w(d));if(!L&&!_)break;const T=i.primitiveName;let X=null;L&&!d.colorLocked&&(X=this._maybeGetValueOrOverrideExpression(T,"FillColor"));let Y=null;L||d.colorLocked||(Y=this._maybeGetValueOrOverrideExpression(T,"StrokeColor"));const j=X??this._getValueOrOverrideExpression(d.type,g,"Color",G),U=Y??this._getValueOrOverrideExpression(d.type,g,"Color",F),D=this._maybeGetValueOrOverrideExpression(T,"StrokeWidth")??this._getValueOrOverrideExpression(d.type,g,"Width",_),H=N?{type:"sprite-rasterization-param",resource:{type:"path",path:N,asFill:L},overrides:[]}:{type:"sprite-rasterization-param",resource:V,overrides:[]},J=n(this._poMap,d,p),B=I(e.size,v.CIMVectorMarker.size),q=this._getValueOrOverrideExpression(e.type,e.primitiveName,"Size",B);this._cimLayers.push({type:"marker",spriteRasterizationParam:H,colorLocked:!!d.colorLocked||!!m,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:C,y:z},isAbsoluteAnchorPoint:O,size:c,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:c,widthRatio:x,rotateClockwise:!1,referenceSize:s,sizeRatio:M,color:j,outlineColor:U,outlineWidth:D,isOutline:y,markerPlacement:t,animationParams:te(J),isStroke:"CIMSolidFill"!==d.type,baseSize:q,...b(o,E)});break}case"CIMPictureMarker":case"CIMVectorMarker":if(d.markerPlacement){H().error("Error analyzing CIM, got unexpected marker placement");break}this._analyzeMarker(d,r,t,o,a,s,!1,l,p,m,y)}g&&o.pop()}}_analyzeTextGraphic(e,t,i,o,a,s,l,n){const p=[];M.findApplicableOverrides(i,this._primitiveOverrides,p);const c=i.geometry;if(!("x"in c)||!("y"in c))return;const m=i.symbol,y=G(m),d=F(m.fontStyleName),h=r(m.fontFamilyName);m.font={family:h,decoration:y,...d};const f=I(m.height,v.CIMTextSymbol.height),u=I(m.angle),O=I(m.offsetX),g=I(m.offsetY),{haloSymbol:_}=m,S=I(m.haloSize,0);let k=[0,0,0,0];if(_?.symbolLayers?.length){const e=_.symbolLayers;for(const r of e)if(r.color){k=this._getValueOrOverrideExpression(m?.haloSymbol?.type??"CIMPolygonSymbol",r.primitiveName,"Color",P(r.color));break}}const b=i.primitiveName;let C=[0,0,0,1],z=[0,0,0,0],x=0,E=!1;if(m.symbol?.symbolLayers)for(const r of m.symbol.symbolLayers){const e=r.primitiveName;if("CIMSolidStroke"===r.type)z=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Color",P(r.color)),x=this._getValueOrOverrideExpression("CIMSolidStroke",e,"Width",R(r)??0);else if("CIMSolidFill"===r.type){const t=P(r.color);E=E??!!r.colorLocked,C=this._getValueOrOverrideExpression("CIMSolidFill",e??b,"Color",t)}}let L=null,V=null,N=null,A=null,w=null;b&&(L=this._maybeGetValueOrOverrideExpression(b,"TextSize"),V=this._maybeGetValueOrOverrideExpression(b,"TextAngle"),N=this._maybeGetValueOrOverrideExpression(b,"TextOffsetX"),A=this._maybeGetValueOrOverrideExpression(b,"TextOffsetY"),E||(w=this._maybeGetValueOrOverrideExpression(b,"FillColor")));const Y=w??C;let j=null,W=null,U=0;if(m.callout&&"CIMBackgroundCallout"===m.callout.type){const e=m.callout;if(e.backgroundSymbol){const r=e.backgroundSymbol.symbolLayers;if(r)for(const e of r)"CIMSolidFill"===e.type?j=P(e.color):"CIMSolidStroke"===e.type&&(W=P(e.color),U=I(e.width,v.CIMSolidStroke.width))}}const D=this._getValueOrOverrideExpression(m.type,i.primitiveName,"TextString",i.textString??"");if(null==D)return;const{fontStyleName:H}=m,J=h+(H?"-"+H.toLowerCase():"-regular"),B=this._getMaterialOverrides(o,m.type);B.push(...this._getPrimitiveMaterialOverrides(i.primitiveName,m.type));const q={type:"text-rasterization-param",resource:{type:"text",textString:i.textString??"",font:m.font,symbol:m,primitiveName:i.primitiveName},overrides:B};this._cimLayers.push({type:"text",lineWidth:m.lineWidth,textRasterizationParam:q,colorLocked:!!n||!!E,effects:e,alignment:a,anchorPoint:{x:0,y:0},isAbsoluteAnchorPoint:!1,fontName:J,decoration:y,haloSize:S,haloColor:k,weight:d.weight,style:d.style,size:L??f,angle:V??u,offsetX:N??O,offsetY:A??g,transform:{type:"cim-marker-transform-param",params:l},horizontalAlignment:T(m.horizontalAlignment),verticalAlignment:X(m.verticalAlignment),text:D,color:Y,outlineColor:z,outlineSize:x,backgroundColor:j,borderLineColor:W,borderLineWidth:U,referenceSize:s,sizeRatio:1,markerPlacement:t})}_analyzeMultiLayerGraphicNonSDF(e,r,t,i,a,s,l,n,p,c,m,y){const d=q(e,i),h=e.primitiveName,f=this._analyzeMaterialOverrides(h,["Rotation","OffsetX","OffsetY"]),O=L(f),[g,_,M]=u.getTextureAnchor(d,this._resourceManager,U),S=this._getMaterialOverrides(a,e.type);S.push(...O);const k={type:"sprite-rasterization-param",resource:{...d,avoidSDFRasterization:!0},overrides:S},b=I(e.size,v.CIMVectorMarker.size),C=this._getValueOrOverrideExpression(e.type,h,"Size",b);this._cimLayers.push({type:"marker",spriteRasterizationParam:k,colorLocked:m,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:s,anchorPoint:{x:g,y:_},isAbsoluteAnchorPoint:!1,size:c,rotation:0,offsetX:0,offsetY:0,transform:{type:"cim-marker-transform-param",params:n},color:[255,255,255,1],outlineColor:[0,0,0,0],outlineWidth:0,scaleX:1,frameHeight:c,widthRatio:1,rotateClockwise:!!e.rotateClockwise,referenceSize:l,sizeRatio:M/o(e.size),isOutline:y,markerPlacement:t,animationParams:te(p),baseSize:C})}_createMarkerPlacementOverrideExpression(e){if(!e)return null;const r=[];return M.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-marker-placement-param",placement:e,overrides:re(r)}}_createGIFAnimatedSymbolPropertiesOverrideExpression(e){if(!e)return null;const r=[];return M.findApplicableOverrides(e,this._primitiveOverrides,r),{type:"cim-gif-animation-params",animation:e,overrides:re(r)}}_analyzeCompositeMarkerGraphic(e,r,t,i,o,a,s,l,n,p,c){const m=i.geometry,y=o[0],d=o[1],h=S(m);if(!h)return;const f="Relative"!==e.anchorPointUnits,u=I(y.width,v.CIMSolidStroke.width),{frameSizeRatio:O,anchorX:g,anchorY:_,widthRatio:M,sdfPaddingRatio:b}=k(h,e.frame,e.size,e.anchorPoint,f,u,e.scaleSymbolsProportionally),{path:C}=d,z=d.primitiveName,x=y.primitiveName,E=i.primitiveName;let L=null;d.colorLocked||p||(L=this._maybeGetValueOrOverrideExpression(E,"FillColor"));const V=L??this._getValueOrOverrideExpression(d.type,z,"Color",P(d.color));let N=null;y.colorLocked||p||(N=this._maybeGetValueOrOverrideExpression(E,"StrokeColor"));const R=N??this._getValueOrOverrideExpression(y.type,x,"Color",P(y.color)),A=this._maybeGetValueOrOverrideExpression(E,"StrokeWidth")??this._getValueOrOverrideExpression(y.type,x,"Width",u),w={type:"sprite-rasterization-param",resource:C?{type:"path",path:C,asFill:!0}:{type:"sdf",geom:m,sdfPaddingRatio:b,asFill:!0},overrides:[]};this._cimLayers.push({type:"marker",spriteRasterizationParam:w,colorLocked:p,effects:r,scaleSymbolsProportionally:!!e.scaleSymbolsProportionally,alignment:a,anchorPoint:{x:g,y:_},isAbsoluteAnchorPoint:f,size:n,rotation:0,offsetX:0,offsetY:0,scaleX:1,transform:{type:"cim-marker-transform-param",params:l},frameHeight:n,widthRatio:M,rotateClockwise:!1,referenceSize:s,sizeRatio:O,color:V,outlineColor:R,outlineWidth:A,isOutline:c,markerPlacement:t})}_setPoMap(e,r,t){let i;this._poMap[e]?i=this._poMap[e]:(i={},this._poMap[e]=i),i[r]=t}_maybeGetValueOrOverrideExpression(e,r,t){return this._getValueOrOverrideExpression("",e,r,t,!1)}_getValueOrOverrideExpression(e,r,t,i,o=!0){if(o&&!Y(i)&&(i=V(e,t.toLowerCase())),null==r)return i;const a=this._poMap[r];if(null==a)return i;const s=a[t];return"string"==typeof s||"number"==typeof s||Array.isArray(s)?s:s?{valueExpressionInfo:s,defaultValue:i}:i}_analyzePrimitiveOverrides(e,r,t,i){if(null==e)return!1;"string"==typeof e&&(e=[e]);for(const o of this._primitiveOverrides)if(e.includes(o.primitiveName)&&o.valueExpressionInfo)return!0;if(null!=r)for(const o of r)if(o?.overrides.length>0)return!0;if(null!=t)for(const o of t)if(o?.overrides.length>0)return!0;if(null!=i)for(const o of i)if(o?.overrides.length>0)return!0;return!1}_getMaterialOverrides(e,r){if(!e)return[];const t=[];for(const i of e)t.push(...this._getPrimitiveMaterialOverrides(i,r));return t}_getPrimitiveMaterialOverrides(e,r){if(!e)return[];const t=L(this._primitiveOverrides.filter((r=>r.primitiveName===e)));return t.forEach((e=>e.defaultValue=V(r,e.propertyName.toLowerCase()))),t}_analyzeMaterialOverrides(e,r){return this._primitiveOverrides.filter((t=>t.primitiveName!==e||!r.includes(t.propertyName)))}}function q(e,r){return{type:e.type,enable:!0,name:e.name,colorLocked:e.colorLocked,primitiveName:e.primitiveName,anchorPoint:e.anchorPoint,anchorPointUnits:e.anchorPointUnits,offsetX:0,offsetY:0,rotateClockwise:e.rotateClockwise,rotation:0,size:e.size,billboardMode3D:e.billboardMode3D,depth3D:e.depth3D,frame:e.frame,markerGraphics:[r],scaleSymbolsProportionally:e.scaleSymbolsProportionally,respectFrame:e.respectFrame,clippingPath:e.clippingPath}}function K(e){if(e&&0===e.indexOf("Level_")){const r=parseInt(e.slice(6),10);if(!isNaN(r))return r}return 0}function Q(e,r){if(!r||0===r.length)return e;const i=t(e);return M.applyOverrides(i,r),i}const Z=e=>e&&2===e.length&&e[0].enable&&e[1].enable&&"CIMSolidStroke"===e[0].type&&"CIMSolidFill"===e[1].type&&null==e[0].path&&null==e[1].path&&!e[0].effects&&!e[1].effects&&!e[0].animations&&!e[1].animations;function $(e){const r=e.symbolLayers;if(!r)return!1;const t=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectDashes"===e.type&&null!=e.dashTemplate)))),i=r.find((e=>e.effects?.find((e=>"CIMGeometricEffectAddControlPoints"===e.type))));return!!t||!!i}function ee(e){return e.some((e=>"CIMSolidFill"!==e.type&&"CIMSolidStroke"!==e.type&&("CIMVectorMarker"!==e.type&&"CIMPictureMarker"!==e.type||null!=e.markerPlacement)))}function re(e){return t(e).map((e=>({...e,propertyName:j(e.propertyName)})))}function te(e){return f(e)?{type:"animation-params",params:e}:null}export{B as CIMAnalyzer,Q as analyzeCIMResource};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- class e{static{this.instance=null}static local(){return null===e.instance&&(e.instance=new e),e.instance}execute(e,s,i,n,o){return new t(e,s,i)}}class t{constructor(e,t,s){this._inputGeometries=e,this._angleTolerance=void 0!==t.angleTolerance?t.angleTolerance:120,this._maxCosAngle=Math.cos((1-Math.abs(this._angleTolerance)/180)*Math.PI)}next(){let e=this._inputGeometries.next();for(;e;){if("esriGeometryPolygon"===e.geometryType)this._isClosed=!0;else if("esriGeometryPolyline"===e.geometryType)this._isClosed=!1;else{if("esriGeometryEnvelope"!==e.geometryType){e=this._inputGeometries.next();continue}if(this._maxCosAngle)return e;this._isClosed=!0}for(;e.nextPath();)this._processPath(e);return e.reset(),e}return null}_processPath(e){if(e.nextPoint()){const t=e.x,s=e.y;let i=t,n=s,o=e.pathSize,l=0,r=0,a=0,h=0,c=0,_=0;this._isClosed&&++o;for(let u=1;e.nextPoint()||u<o;++u){let x,m;this._isClosed&&u===o-1?(x=t,m=s):(x=e.x,m=e.y);const y=x-i,g=m-n,C=Math.sqrt(y*y+g*g);if(u>1&&C>0&&a>0){(l*y+r*g)/C/a<=this._maxCosAngle&&e.setControlPointAt(u-1)}1===u&&(h=y,c=g,_=C),C>0&&(i=x,n=m,l=y,r=g,a=C)}if(this._isClosed&&a>0&&_>0){(l*h+r*c)/_/a<=this._maxCosAngle&&e.setControlPointAt(0)}}}}export{e as EffectAddControlPoints};
5
+ class e{static{this.instance=null}static local(){return null===e.instance&&(e.instance=new e),e.instance}execute(e,s,n,i){return new t(e,s)}}class t{constructor(e,t){this._inputGeometries=e,this._angleTolerance=void 0!==t.angleTolerance?t.angleTolerance:120,this._maxCosAngle=Math.cos((1-Math.abs(this._angleTolerance)/180)*Math.PI)}next(){let e=this._inputGeometries.next();if(!e)return null;for(;e;){if("esriGeometryPolygon"===e.geometryType)this._isClosed=!0;else if("esriGeometryPolyline"===e.geometryType)this._isClosed=!1;else{if("esriGeometryEnvelope"!==e.geometryType){e=this._inputGeometries.next();continue}if(this._maxCosAngle)return e;this._isClosed=!0}for(;e.nextPath();)this._processPath(e);return e.reset(),e}return null}_processPath(e){if(e.nextPoint()){const t=e.x,s=e.y;let n=t,i=s,o=e.pathSize,l=0,r=0,a=0,h=0,c=0,_=0;this._isClosed&&++o;for(let u=1;e.nextPoint()||u<o;++u){let x,m;this._isClosed&&u===o-1?(x=t,m=s):(x=e.x,m=e.y);const y=x-n,g=m-i,C=Math.sqrt(y*y+g*g);if(u>1&&C>0&&a>0){(l*y+r*g)/C/a<=this._maxCosAngle&&e.setControlPointAt(u-1)}1===u&&(h=y,c=g,_=C),C>0&&(n=x,i=m,l=y,r=g,a=C)}if(this._isClosed&&a>0&&_>0){(l*h+r*c)/_/a<=this._maxCosAngle&&e.setControlPointAt(0)}}}}export{e as EffectAddControlPoints};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{GeometryCursor as e}from"../../../geometry/GeometryCursor.js";import{collectMultipath as t}from"../../../geometry/geometryCursorCollectUtils.js";import i from"../../../geometry/SpatialReference.js";import{clipCursorToTileExtent as s}from"../CIMEffects.js";import{CurveHelper as r,pixelTolerance as n}from"../CurveHelper.js";import{GeometricEffectOffsetMethod as o}from"../enums.js";class m{static{this.instance=null}static local(){return null===m.instance&&(m.instance=new m),m.instance}execute(e,t,i,s,r,n,o){return new l(e,t,i,s,r,n,o)}}class l{constructor(e,t,i,s,o,m,l){this._preventClipping=l,this._inputGeometries=e,this._tileKey=s,this._geometryEngine=o,this._curveHelper=new r,this._size=(void 0!==t.size?t.size:1)*i,this._maxInflateSize=m*i,this._offsetFlattenError=n*i}next(){let r;for(;r=this._inputGeometries.next();){if(0===this._size)return r;if("esriGeometryEnvelope"===r.geometryType)if(this._size>0){const i=e.createEmptyOptimizedCIM(r.geometryType),s=t(r)[0],n=this._curveHelper.offset(s,this._size,o.Rounded,4,this._offsetFlattenError);if(n)return i.pushPath(n),i}else if(this._size<0){const t=r.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 n=this._geometryEngine;if(null==n)return null;const m=!this._preventClipping&&this._tileKey?s(r,this._maxInflateSize):r;if(!m)continue;const l=n.buffer(i.WebMercator,m.asJSON(),this._size,1);return l?e.fromJSONCIM(l):null}return null}}export{m as EffectBuffer};
5
+ import{GeometryCursor as e}from"../../../geometry/GeometryCursor.js";import{collectMultipath as t}from"../../../geometry/geometryCursorCollectUtils.js";import i from"../../../geometry/SpatialReference.js";import{clipCursorToTileExtent as s}from"../CIMEffects.js";import{CurveHelper as r,pixelTolerance as n}from"../CurveHelper.js";import{GeometricEffectOffsetMethod as o}from"../enums.js";class m{static{this.instance=null}static local(){return null===m.instance&&(m.instance=new m),m.instance}execute(e,t,i,s,r,n,o){return new l(e,t,i,s,r,n,o)}}class l{constructor(e,t,i,s,o,m,l){this._preventClipping=l,this._inputGeometries=e,this._tileKey=s,this._geometryEngine=o,this._curveHelper=new r,this._size=(void 0!==t.size?t.size:1)*i,this._maxInflateSize=m*i,this._offsetFlattenError=n*i}next(){let r;for(;r=this._inputGeometries.next();){if(0===this._size)return r;if("esriGeometryEnvelope"===r.geometryType)if(this._size>0){const i=e.createEmptyOptimizedCIM(r.geometryType),s=t(r)[0],n=this._curveHelper.offset(s,this._size,o.Rounded,4,this._offsetFlattenError);if(n)return i.pushPath(n),i}else if(this._size<0){const t=r.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 n=this._geometryEngine;if(null==n)return null;const m=!this._preventClipping&&this._tileKey?s(r,this._maxInflateSize,!0):r;if(!m)continue;const l=n.buffer(i.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.33/esri/copyright.txt for details.
4
4
  */
5
- import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import i from"../../../geometry/SpatialReference.js";import{clipCursorToTileExtent as e}from"../CIMEffects.js";import{GeometricEffectDonutMethod as n}from"../enums.js";class s{static{this.instance=null}static local(){return null===s.instance&&(s.instance=new s),s.instance}execute(t,i,e,n,s,o,h){return new r(t,i,e,n,s,o,h)}}class r{constructor(t,i,e,s,r,o,h){switch(this._preventClipping=h,this._inputGeometries=t,this._tileKey=s,this._geometryEngine=r,this._maxInflateSize=o*e,this._width=(void 0!==i.width?i.width:2)*e,i.method){case n.Mitered:case n.Bevelled:case n.Rounded:case n.TrueBuffer:case n.Square:}this._option=i.option}next(){let n;for(;n=this._inputGeometries.next();){if("esriGeometryEnvelope"===n.geometryType&&this._width>0){const i=n.asJSON();return Math.min(i.xmax-i.xmin,i.ymax-i.ymin)-2*this._width<0?n: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"===n.geometryType){if(0===this._width)return n.clone();const t=this._geometryEngine;if(null==t)return null;const s=!this._preventClipping&&this._tileKey?e(n,this._maxInflateSize):n.clone();if(!s)continue;const r=t.buffer(i.WebMercator,s.asJSON(),-this._width,1);if(r)for(const i of r.rings)if(i){s.startPath();for(const t of i.reverse())s.pushXY(t[0],s.yFactor*t[1])}return s}}return null}}export{s as EffectDonut};
5
+ import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import i from"../../../geometry/SpatialReference.js";import{clipCursorToTileExtent as e}from"../CIMEffects.js";import{GeometricEffectDonutMethod as n}from"../enums.js";class s{static{this.instance=null}static local(){return null===s.instance&&(s.instance=new s),s.instance}execute(t,i,e,n,s,o,h){return new r(t,i,e,n,s,o,h)}}class r{constructor(t,i,e,s,r,o,h){switch(this._preventClipping=h,this._inputGeometries=t,this._tileKey=s,this._geometryEngine=r,this._maxInflateSize=o*e,this._width=(void 0!==i.width?i.width:2)*e,i.method){case n.Mitered:case n.Bevelled:case n.Rounded:case n.TrueBuffer:case n.Square:}this._option=i.option}next(){let n;for(;n=this._inputGeometries.next();){if("esriGeometryEnvelope"===n.geometryType&&this._width>0){const i=n.asJSON();return Math.min(i.xmax-i.xmin,i.ymax-i.ymin)-2*this._width<0?n: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"===n.geometryType){if(0===this._width)return n.clone();const t=this._geometryEngine;if(null==t)return null;const s=!this._preventClipping&&this._tileKey?e(n,this._maxInflateSize,!0):n.clone();if(!s)continue;const r=t.buffer(i.WebMercator,s.asJSON(),-this._width,1);if(r)for(const i of r.rings)if(i){s.startPath();for(const t of i.reverse())s.pushXY(t[0],s.yFactor*t[1])}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.33/esri/copyright.txt for details.
4
4
  */
5
- import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import{collectPath as e}from"../../../geometry/geometryCursorCollectUtils.js";import s from"../../../geometry/SpatialReference.js";import{isExtent as i}from"../../../geometry/support/jsonUtils.js";import{clipCursorToTileExtent as o}from"../CIMEffects.js";import{CurveHelper as r,pixelTolerance as n}from"../CurveHelper.js";import{GeometricEffectOffsetMethod as f}from"../enums.js";const m=10;class h{static{this.instance=null}static local(){return null===h.instance&&(h.instance=new h),h.instance}execute(t,e,s,i,o,r,n){return new l(t,e,s,i,o,r,n)}}class l{constructor(t,e,s,i,o,f,h){this._preventClipping=h,this._inputGeometries=t,this._tileKey=i,this._geometryEngine=o,this._curveHelper=new r,this._offset=(e.offset??1)*s,this._method=e.method,this._maxInflateSize=Math.max(Math.abs(f*s),m),this._option=e.option,this._offsetFlattenError=n*s}next(){let r;for(;r=this._inputGeometries.next();){if(0===this._offset)return r.clone();if("esriGeometryEnvelope"===r.geometryType){if(this._method===f.Rounded&&this._offset>0){const s=e(r),i=this._curveHelper.offset(s,-this._offset,this._method,4,this._offsetFlattenError);if(i){const e=t.createEmptyOptimizedCIM(r.geometryType);return e.pushPath(i),e}return null}const s=r.asJSON();if(i(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 n=this._geometryEngine;if(null==n)continue;const m=!this._preventClipping&&this._tileKey?o(r,this._maxInflateSize):r.clone();if(!m)continue;const h=n.offset(s.WebMercator,m.asJSON(),-this._offset,1,this._method,4,this._offsetFlattenError);return h?t.fromJSONCIM(h):null}return null}}export{h as EffectOffset};
5
+ import{GeometryCursor as t}from"../../../geometry/GeometryCursor.js";import{collectPath as e}from"../../../geometry/geometryCursorCollectUtils.js";import s from"../../../geometry/SpatialReference.js";import{isExtent as i}from"../../../geometry/support/jsonUtils.js";import{clipCursorToTileExtent as o}from"../CIMEffects.js";import{CurveHelper as r,pixelTolerance as n}from"../CurveHelper.js";import{GeometricEffectOffsetMethod as f}from"../enums.js";const m=10;class h{static{this.instance=null}static local(){return null===h.instance&&(h.instance=new h),h.instance}execute(t,e,s,i,o,r,n){return new l(t,e,s,i,o,r,n)}}class l{constructor(t,e,s,i,o,f,h){this._preventClipping=h,this._inputGeometries=t,this._tileKey=i,this._geometryEngine=o,this._curveHelper=new r,this._offset=(e.offset??1)*s,this._method=e.method,this._maxInflateSize=Math.max(Math.abs(f*s),m),this._option=e.option,this._offsetFlattenError=n*s}next(){let r;for(;r=this._inputGeometries.next();){if(0===this._offset)return r.clone();if("esriGeometryEnvelope"===r.geometryType){if(this._method===f.Rounded&&this._offset>0){const s=e(r),i=this._curveHelper.offset(s,-this._offset,this._method,4,this._offsetFlattenError);if(i){const e=t.createEmptyOptimizedCIM(r.geometryType);return e.pushPath(i),e}return null}const s=r.asJSON();if(i(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 n=this._geometryEngine;if(null==n)continue;const m=!this._preventClipping&&this._tileKey?o(r,this._maxInflateSize,!0):r.clone();if(!m)continue;const h=n.offset(s.WebMercator,m.asJSON(),-this._offset,1,this._method,4,this._offsetFlattenError);return h?t.fromJSONCIM(h):null}return null}}export{h 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.33/esri/copyright.txt for details.
4
4
  */
5
- import{isPromiseLike as e}from"../../core/promiseUtils.js";import{when as t,watch as a}from"../../core/reactiveUtils.js";import{addFrameTask as s}from"../../core/scheduling.js";import i from"./PaddedViewState.js";import{RenderState as r}from"../support/RenderState.js";import{newScheduler as d}from"../support/Scheduler.js";class h{constructor(a){this.view=a,this._stationaryHandle=null,this._frameTaskHandle=null,this._updateParameters=null,this._updateRequested=!1,this._scheduler=d(),this._schedulerHandle=t((()=>this._scheduler.updating),(()=>this.requestFrame())),this.stationary=!0,this.prepare=()=>{this._updateParameters&&(this._updateParameters.state=this.view.state,this._updateParameters.stationary=this.view.stationary,this._updateParameters.pixelRatio=window.devicePixelRatio,this._updateParameters.renderingOptions=this.view.renderingOptions,this._updateParameters.targetState.copy(this.view.state),null==this.view.animation?.target||e(this.view.animation.target)||(this._updateParameters.targetState.viewpoint=this.view.animation.target))},this.update=e=>{if(this._updateRequested=!1,this.view?.destroyed)return;const{allLayerViews:t,graphicsView:a,labelManager:s,state:{id:i}}=this.view;t.forEach(this._updateLayerView,this),null!=s&&(s.lastUpdateId!==i&&(s.viewChange(),s.lastUpdateId=i),s.updateRequested&&s.processUpdate(this._updateParameters)),null!=a&&(a.lastUpdateId!==i&&(a.viewChange(),a.lastUpdateId=i),a.updateRequested&&a.processUpdate(this._updateParameters)),this.view.graphicsTileStore.setViewState(this._updateParameters.state),this.view.animation?this._scheduler.state=r.ANIMATING:this.view.interacting?this._scheduler.state=r.INTERACTING:this._scheduler.state=r.IDLE;this._scheduler.frame(e)||this._updateRequested||this._scheduler.state!==r.IDLE||this._frameTaskHandle?.pause()}}destroy(){this.stop(),this._schedulerHandle.remove(),this._scheduler.destroy()}get scheduler(){return this._scheduler}start(){if(this._frameTaskHandle)return;const e=this.view;this.stationary=e.stationary,this._updateParameters={state:e.state,targetState:new i,pixelRatio:window.devicePixelRatio,stationary:this.stationary,renderingOptions:e.renderingOptions},this._stationaryHandle=a((()=>e.stationary),(e=>{this.stationary=e,this.requestFrame()})),this._frameTaskHandle=s(this),this.requestUpdate()}stop(){this._frameTaskHandle&&(this._updateRequested=!1,this._stationaryHandle?.remove(),this._frameTaskHandle.remove(),this._updateParameters=this._stationaryHandle=this._frameTaskHandle=null,this.stationary=!0)}requestUpdate(){this._updateRequested||(this._updateRequested=!0,this.requestFrame())}requestFrame(){this._frameTaskHandle&&this._frameTaskHandle.resume()}_updateLayerView(e){if(!e.attached)return void this.requestUpdate();const t=this.view.state,a=e.lastUpdateId;null!=a&&(this.stationary||e.moving)||(e.moving=!0),a!==t.id&&e.viewChange(),this.stationary&&e.moving&&(e.moving=!1,e.moveEnd()),e.lastUpdateId=t.id,e.updateRequested&&e.processUpdate(this._updateParameters),"layerViews"in e&&e.layerViews?.forEach(this._updateLayerView,this)}}export{h as default};
5
+ import{isPromiseLike as e}from"../../core/promiseUtils.js";import{when as t,watch as a}from"../../core/reactiveUtils.js";import{addFrameTask as s}from"../../core/scheduling.js";import i from"./PaddedViewState.js";import{RenderState as r}from"../support/RenderState.js";import{newScheduler as d}from"../support/Scheduler.js";class h{constructor(a){this.view=a,this._stationaryHandle=null,this._frameTaskHandle=null,this._updateParameters=null,this._updateRequested=!1,this._scheduler=d(),this._schedulerHandle=t((()=>this._scheduler.updating),(()=>this.requestFrame())),this.stationary=!0,this.prepare=()=>{this._updateParameters&&(this._updateParameters.state=this.view.state,this._updateParameters.stationary=this.view.stationary,this._updateParameters.pixelRatio=window.devicePixelRatio,this._updateParameters.renderingOptions=this.view.renderingOptions,this._updateParameters.targetState.copy(this.view.state),null==this.view.animation?.target||e(this.view.animation.target)||(this._updateParameters.targetState.viewpoint=this.view.animation.target))},this.update=e=>{if(this._updateRequested=!1,this.view?.destroyed)return;const{allLayerViews:t,graphicsView:a,labelManager:s,state:{id:i}}=this.view;t?.forEach(this._updateLayerView,this),null!=s&&(s.lastUpdateId!==i&&(s.viewChange(),s.lastUpdateId=i),s.updateRequested&&s.processUpdate(this._updateParameters)),null!=a&&(a.lastUpdateId!==i&&(a.viewChange(),a.lastUpdateId=i),a.updateRequested&&a.processUpdate(this._updateParameters)),this.view.graphicsTileStore?.setViewState(this._updateParameters.state),this.view.animation?this._scheduler.state=r.ANIMATING:this.view.interacting?this._scheduler.state=r.INTERACTING:this._scheduler.state=r.IDLE;this._scheduler.frame(e)||this._updateRequested||this._scheduler.state!==r.IDLE||this._frameTaskHandle?.pause()}}destroy(){this.stop(),this._schedulerHandle.remove(),this._scheduler.destroy()}get scheduler(){return this._scheduler}start(){if(this._frameTaskHandle)return;const e=this.view;this.stationary=e.stationary,this._updateParameters={state:e.state,targetState:new i,pixelRatio:window.devicePixelRatio,stationary:this.stationary,renderingOptions:e.renderingOptions},this._stationaryHandle=a((()=>e.stationary),(e=>{this.stationary=e,this.requestFrame()})),this._frameTaskHandle=s(this),this.requestUpdate()}stop(){this._frameTaskHandle&&(this._updateRequested=!1,this._stationaryHandle?.remove(),this._frameTaskHandle.remove(),this._updateParameters=this._stationaryHandle=this._frameTaskHandle=null,this.stationary=!0)}requestUpdate(){this._updateRequested||(this._updateRequested=!0,this.requestFrame())}requestFrame(){this._frameTaskHandle&&this._frameTaskHandle.resume()}_updateLayerView(e){if(!e.attached)return void this.requestUpdate();const t=this.view.state,a=e.lastUpdateId;null!=a&&(this.stationary||e.moving)||(e.moving=!0),a!==t.id&&e.viewChange(),this.stationary&&e.moving&&(e.moving=!1,e.moveEnd()),e.lastUpdateId=t.id,e.updateRequested&&e.processUpdate(this._updateParameters),"layerViews"in e&&e.layerViews?.forEach(this._updateLayerView,this)}}export{h 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.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../config.js";import t from"../../../../request.js";import{bidiText as i}from"../../../../core/BidiText.js";import s from"../../../../core/Error.js";import{getFullyQualifiedFontName as r}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{throwIfAborted as n,isAbortError as o}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{pt2px as h}from"../../../../core/screenUtils.js";import{numericHash as l}from"../../../../core/string.js";import u from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as p}from"../../../../symbols/cim/CIMSymbolHelper.js";import m from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as d}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as g,textureBindingSpriteAtlas as f,textureBindingGlyphAtlas as y}from"./definitions.js";import{MosaicType as M}from"./enums.js";import _ from"./GlyphMosaic.js";import I from"./GlyphSource.js";import w from"./Rect.js";import S from"./SDFConverter.js";import z from"./SpriteMosaic.js";import{charCodes as R,discardUrlIfHasUrlHash as T,isSVGImage as C}from"./Utils.js";import{AnimatableTextureResource as P}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as x}from"./animations/store/AnimationStore.js";import{TextureSamplingMode as b}from"../../../webgl/enums.js";const j="arial-unicode-ms-regular",v=()=>a.getLogger("esri.views.MapView"),$=(e,t,i)=>v().error(new s(e,t,i)),A=(e,t="")=>v().warnOnce(e,t);class k{static fromMosaic(e,t){return new k(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,s){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=s}}class F{constructor(i){this._requestRender=i,this._resourceManager=new u,this._invalidFontsMap=new Map,this._sdfConverter=new S(g),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new c({concurrency:10,process:async(e,i)=>{n(i);try{return await t(e,{responseType:"image",signal:i})}catch(r){if(!o(r))throw new s("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,r);throw r}}}),this.animationStore=new x,this._spriteMosaic=new z(2048,2048,500),this._glyphSource=new I(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new _(1024,1024,this._glyphSource),this._rasterizer=new m(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}async rasterizeItem(e,t){if(null==e)return $("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:s}=i;return{rect:new w(s.column,s.row,t.length,1),page:s.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return $("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);for(const t of e.glyphs)this._setTextureBinding(M.GLYPH,t);return e}const s=await this._rasterizeSprite(i,t);return s&&this._setTextureBinding(M.SPRITE,s),s}getMosaicInfo(e,t,i=!1){const s=this._getTextureBindingInfo(e,t,i);return s?{size:s.size,texture:{texture:s.texture,unit:"sprite"===s.type?f:y}}:($("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0],texture:{texture:null,unit:0}})}_getTextureBindingInfo(e,t,i){const s=this._bindingInfos[t-1],r=s.page,a="Nearest"===s.samplingMode?b.NEAREST:i?b.LINEAR_MIPMAP_LINEAR:b.LINEAR;switch(s.mosaicType){case M.SPRITE:{const t=[this.sprites.getWidth(r),this.sprites.getHeight(r)],i=this._spriteMosaic.getTexture(e,r);return i.setSamplingMode(a),{type:"sprite",texture:i,size:t}}case M.GLYPH:{const t=[this.glyphs.width,this.glyphs.height],i=this._glyphMosaic.getTexture(e,r);return this._glyphMosaic.bind(e,a,r,y),i.setSamplingMode(a),{type:"glyph",texture:i,size:t}}default:return $("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const s=k.fromMosaic(e,t),r=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,r),this._bindingInfos.push(s)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const{font:s,textString:a}=e,n=r(s),o=this._invalidFontsMap.has(n),[c,h]=i(a),l=R(c);try{const e=o?j:n;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(e);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(e,l,t),isRightToLeft:h}}catch(u){A(`Font ${n} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFontsMap.set(n,!0);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(j,l,t),isRightToLeft:h}}}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${d(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geom)}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(T(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=l(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t=[];p.fetchResources({type:"CIMPointSymbol",symbolLayers:[e]},this._resourceManager,t),t.length>0&&await Promise.all(t)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:s,image:r,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:h,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,s,{type:"static",data:r},G(t),a,n,o,c,h,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let s;return s="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,s),s.finally((()=>this._ongoingRasterizations.delete(e))),s}async _handleSVG(e,t,i){const s=[g,g],{asFill:r}=e,a=await this._sdfConverter.draw(e.path,r,i);return this._addItemToMosaic(t,s,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}async _handleGIFOrPNG(e,t,i){const s=e.url,r=this.resourceManager.getResource(s);if(null==r)return null;const{width:a,height:n}=r;if(r instanceof HTMLImageElement){if("animated"===e.type)return $("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:s,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,r,i);return this._addItemToMosaic(t,s,{type:"static",data:c},G(e),o,!1)}let o,c,h;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},h=e.startGroup||0):(o=G(e),c={type:"CIMAnimatedSymbolProperties"},h=0);const l=new P(r,this._requestRender,c,h);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,i){const r=e.url;if(B(r)||O(r))return this._handleGIFOrPNG(e,t,i);if("animated"===e.type)return $("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let s;const a=this.resourceManager.getResource(r);if(null!=a&&a instanceof HTMLImageElement)s=a;else{const{data:e}=await this._imageRequestQueue.push(r,{...i});s=e}if(C(r))if("width"in e&&"height"in e)s.width=h(e.width),s.height=h(e.height);else if("cim"in e){const t=e;s.width=h(t.width??t.scaleX*t.size),s.height=h(t.size)}if(!s.width||!s.height)return null;const n=s.width,o=s.height,c="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,s,c);return this._addItemToMosaic(t,l,{type:"static",data:p},G(e),u,!1)}catch($){if(!o($))throw new s("mapview-invalid-resource",`Could not fetch requested resource at ${r}. ${$.message}`);throw $}}_addItemToMosaic(e,t,i,s,r,a,n,o,c,h){return this._spriteMosaic.addSpriteItem(e,t,i,s,r,a,n,o,c,h)}}function G(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return E(e);default:return!0}}const N=e=>null!=e&&e.startsWith("data:image/gif"),B=e=>e&&(e.includes(".gif")||N(e)),L=e=>null!=e&&e.startsWith("data:image/png"),O=e=>e&&(e.includes(".png")||L(e)),E=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{F as default};
5
+ import e from"../../../../config.js";import t from"../../../../request.js";import{bidiText as i}from"../../../../core/BidiText.js";import s from"../../../../core/Error.js";import{getFullyQualifiedFontName as r}from"../../../../core/fontUtils.js";import has from"../../../../core/has.js";import a from"../../../../core/Logger.js";import{throwIfAborted as n,isAbortError as o}from"../../../../core/promiseUtils.js";import{QueueProcessor as c}from"../../../../core/QueueProcessor.js";import{pt2px as h}from"../../../../core/screenUtils.js";import{numericHash as l}from"../../../../core/string.js";import u from"../../../../symbols/cim/CIMResourceManager.js";import{CIMSymbolHelper as p}from"../../../../symbols/cim/CIMSymbolHelper.js";import m from"../../../../symbols/cim/Rasterizer.js";import{normalizeDashTemplate as d}from"../../../../symbols/cim/utils.js";import{svgSdfTextureInnerSize as g,textureBindingSpriteAtlas as f,textureBindingGlyphAtlas as y}from"./definitions.js";import{MosaicType as M}from"./enums.js";import _ from"./GlyphMosaic.js";import I from"./GlyphSource.js";import w from"./Rect.js";import S from"./SDFConverter.js";import z from"./SpriteMosaic.js";import{charCodes as R,discardUrlIfHasUrlHash as T,getCIMMarkerPlacementHash as C,isSVGImage as P}from"./Utils.js";import{AnimatableTextureResource as x}from"./animatedFormats/AnimatableTextureResource.js";import{AnimationStore as b}from"./animations/store/AnimationStore.js";import{TextureSamplingMode as j}from"../../../webgl/enums.js";const $="arial-unicode-ms-regular",v=()=>a.getLogger("esri.views.MapView"),k=(e,t,i)=>v().error(new s(e,t,i)),A=(e,t="")=>v().warnOnce(e,t);class F{static fromMosaic(e,t){return new F(e,t.page,t.sdf,t.samplingMode)}constructor(e,t,i,s){this.mosaicType=e,this.page=t,this.sdf=i,this.samplingMode=s}}class G{constructor(i){this._requestRender=i,this._resourceManager=new u,this._invalidFontsMap=new Map,this._sdfConverter=new S(g),this._bindingInfos=new Array,this._hashToBindingIndex=new Map,this._ongoingRasterizations=new Map,this._imageRequestQueue=new c({concurrency:10,process:async(e,i)=>{n(i);try{return await t(e,{responseType:"image",signal:i})}catch(r){if(!o(r))throw new s("mapview-invalid-resource",`Could not fetch requested resource at ${e}`,r);throw r}}}),this.animationStore=new b,this._spriteMosaic=new z(2048,2048,500),this._glyphSource=new I(`${e.fontsUrl}/{fontstack}/{range}.pbf`),this._glyphMosaic=new _(1024,1024,this._glyphSource),this._rasterizer=new m(this.resourceManager)}dispose(){this._spriteMosaic.dispose(),this._glyphMosaic.dispose(),this._rasterizer.dispose(),this._sdfConverter.dispose(),this._spriteMosaic=null,this._glyphMosaic=null,this._sdfConverter=null,this._hashToBindingIndex.clear(),this._hashToBindingIndex=null,this._bindingInfos=null,this._ongoingRasterizations.clear(),this._ongoingRasterizations=null,this._imageRequestQueue.clear(),this._imageRequestQueue=null,this._resourceManager.destroy(),this.animationStore.destroy()}get sprites(){return this._spriteMosaic}get glyphs(){return this._glyphMosaic}get resourceManager(){return this._resourceManager}async rasterizeItem(e,t){if(null==e)return k("mapview-null-resource","Unable to rasterize null resource"),null;if("animation-info"===e.type){const{resource:t}=e,i=this.animationStore.add(t),{location:s}=i;return{rect:new w(s.column,s.row,t.length,1),page:s.page,type:"sprite",width:t.length,height:1,rasterizationScale:1,sdfPaddingRatio:.5,samplingMode:"Linear",sdfDecodeCoeff:1,simplePattern:!1}}if("cim-rasterization-info"!==e.type)return k("mapview-unexpected-resource","Unable to rasterize resource"),null;const{resource:i}=e;if("text"===i.type){const e=await this._rasterizeText(i,t);for(const t of e.glyphs)this._setTextureBinding(M.GLYPH,t);return e}const s=await this._rasterizeSprite(i,t);return s&&this._setTextureBinding(M.SPRITE,s),s}getMosaicInfo(e,t,i=!1){const s=this._getTextureBindingInfo(e,t,i);return s?{size:s.size,texture:{texture:s.texture,unit:"sprite"===s.type?f:y}}:(k("mapview-invalid-resource",`Unable to find resource for ${t}`),{size:[0,0],texture:{texture:null,unit:0}})}_getTextureBindingInfo(e,t,i){const s=this._bindingInfos[t-1],r=s.page,a="Nearest"===s.samplingMode?j.NEAREST:i?j.LINEAR_MIPMAP_LINEAR:j.LINEAR;switch(s.mosaicType){case M.SPRITE:{const t=[this.sprites.getWidth(r),this.sprites.getHeight(r)],i=this._spriteMosaic.getTexture(e,r);return i.setSamplingMode(a),{type:"sprite",texture:i,size:t}}case M.GLYPH:{const t=[this.glyphs.width,this.glyphs.height],i=this._glyphMosaic.getTexture(e,r);return this._glyphMosaic.bind(e,a,r,y),i.setSamplingMode(a),{type:"glyph",texture:i,size:t}}default:return k("mapview-texture-manager",`Cannot handle unknown type ${s.mosaicType}`),null}}_hashMosaic(e,t){return 1|e<<1|(t.sdf?1:0)<<2|("Nearest"===t.samplingMode?1:0)<<3|t.page<<4}_setTextureBinding(e,t){const i=this._hashMosaic(e,t);if(!this._hashToBindingIndex.has(i)){const s=F.fromMosaic(e,t),r=this._bindingInfos.length+1;this._hashToBindingIndex.set(i,r),this._bindingInfos.push(s)}t.textureBinding=this._hashToBindingIndex.get(i)}async _rasterizeText(e,t){const{font:s,textString:a}=e,n=r(s),o=this._invalidFontsMap.has(n),[c,h]=i(a),l=R(c);try{const e=o?$:n;has("esri-2d-stabilize-glyphs")&&await this._glyphMosaic.preloadASCIIGlyphCache(e);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems(e,l,t),isRightToLeft:h}}catch(u){A(`Font ${n} is not available on the web, using "Arial Unicode MS Regular"`),this._invalidFontsMap.set(n,!0);return{type:"glyphs",glyphs:await this._glyphMosaic.getGlyphItems($,l,t),isRightToLeft:h}}}_hashSpriteResource(e){switch(e.type){case"path":return`path:${e.path}.${e.asFill?1:0}`;case"CIMPictureMarker":return`${e.type}:${e.url}:${e.size}:${C(e.markerPlacement)}`;case"CIMPictureFill":return`${e.type}:${e.url}:${e.height}`;case"CIMPictureStroke":return`${e.type}:${e.url}:${e.width}`;case"dash":return`dash:${e.capStyle}.${d(e.dashTemplate).join("")}`;case"sdf":return`sdf:${JSON.stringify(e.geom)}.${e.asFill?1:0}`;case"fill-style":return`fill_style:${e.style}`;case"animated":return JSON.stringify(T(e));case"CIMGradientFill":case"CIMGradientStroke":return`gradient:${JSON.stringify(e.colorRamp)}.${e.gradientType}.${e.interval}`;case"CIMHatchFill":case"CIMVectorMarker":return JSON.stringify(e)}}async _rasterizeSprite(e,t){if(!e)return null;const i=l(this._hashSpriteResource(e));if(this._spriteMosaic.has(i))return this._spriteMosaic.getSpriteItem(i);if("url"in e&&e.url||"CIMPictureFill"===e.type||"CIMPictureStroke"===e.type||"CIMPictureMarker"===e.type||"CIMVectorMarker"===e.type){const t=[];p.fetchResources({type:"CIMPointSymbol",symbolLayers:[e]},this._resourceManager,t),t.length>0&&await Promise.all(t)}switch(e.type){case"CIMPictureMarker":return"CIMMarkerPlacementInsidePolygon"===e.markerPlacement?.type?this._rasterizeJSONResource(i,e):this._handleAsyncResource(i,e,t);case"animated":case"CIMPictureFill":case"CIMPictureStroke":case"path":return this._handleAsyncResource(i,e,t);case"CIMGradientFill":case"CIMGradientStroke":case"CIMHatchFill":case"CIMVectorMarker":case"dash":case"fill-style":case"sdf":return this._rasterizeJSONResource(i,e)}}_rasterizeJSONResource(e,t){const i=this._rasterizer.rasterizeJSONResource(t);if(i){const{size:s,image:r,sdf:a,simplePattern:n,rasterizationScale:o,samplingMode:c,sdfPaddingRatio:h,sdfDecodeCoeff:l}=i;return this._addItemToMosaic(e,s,{type:"static",data:r},N(t),a,n,o,c,h,l)}return null}async _handleAsyncResource(e,t,i){if(this._ongoingRasterizations.has(e))return this._ongoingRasterizations.get(e);let s;return s="path"===t.type?this._handleSVG(t,e,i):this._handleImage(t,e,i),this._ongoingRasterizations.set(e,s),s.finally((()=>this._ongoingRasterizations.delete(e))),s}async _handleSVG(e,t,i){const s=[g,g],{asFill:r}=e,a=await this._sdfConverter.draw(e.path,r,i);return this._addItemToMosaic(t,s,{type:"static",data:new Uint32Array(a.buffer)},!1,!0,!0)}async _handleGIFOrPNG(e,t,i){const s=e.url,r=this.resourceManager.getResource(s);if(null==r)return null;const{width:a,height:n}=r;if(r instanceof HTMLImageElement){if("animated"===e.type)return k("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;const i="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:s,sdf:o,image:c}=this._rasterizer.rasterizeImageResource(a,n,r,i);return this._addItemToMosaic(t,s,{type:"static",data:c},N(e),o,!1)}let o,c,h;"animated"===e.type?(o=!1,c={type:"CIMAnimatedSymbolProperties",playAnimation:e.playAnimation,reverseAnimation:e.reverseAnimation,randomizeStartTime:e.randomizeStartTime,randomizeStartSeed:e.randomizeStartSeed,startTimeOffset:e.startTimeOffset,duration:e.duration,repeatType:e.repeatType,repeatDelay:e.repeatDelay},h=e.startGroup||0):(o=N(e),c={type:"CIMAnimatedSymbolProperties"},h=0);const l=new x(r,this._requestRender,c,h);return this._addItemToMosaic(t,[l.width,l.height],{type:"animated",data:l},o,!1,!1)}async _handleImage(e,t,i){const r=e.url;if(L(r)||E(r))return this._handleGIFOrPNG(e,t,i);if("animated"===e.type)return k("mapview-unexpected-resource","Attempt to configure animations for a non-animated image."),null;try{let s;const a=this.resourceManager.getResource(r);if(null!=a&&a instanceof HTMLImageElement)s=a;else{const{data:e}=await this._imageRequestQueue.push(r,{...i});s=e}if(P(r))if("width"in e&&"height"in e)s.width=h(e.width),s.height=h(e.height);else if("cim"in e){const t=e;s.width=h(t.width??t.scaleX*t.size),s.height=h(t.size)}if(!s.width||!s.height)return null;const n=s.width,o=s.height,c="colorSubstitutions"in e?e.colorSubstitutions:void 0,{size:l,sdf:u,image:p}=this._rasterizer.rasterizeImageResource(n,o,s,c);return this._addItemToMosaic(t,l,{type:"static",data:p},N(e),u,!1)}catch(k){if(!o(k))throw new s("mapview-invalid-resource",`Could not fetch requested resource at ${r}. ${k.message}`);throw k}}_addItemToMosaic(e,t,i,s,r,a,n,o,c,h){return this._spriteMosaic.addSpriteItem(e,t,i,s,r,a,n,o,c,h)}}function N(e){switch(e.type){case"CIMVectorMarker":case"CIMPictureMarker":return U(e);default:return!0}}const B=e=>null!=e&&e.startsWith("data:image/gif"),L=e=>e&&(e.includes(".gif")||B(e)),O=e=>null!=e&&e.startsWith("data:image/png"),E=e=>e&&(e.includes(".png")||O(e)),U=e=>e&&"markerPlacement"in e&&e.markerPlacement&&"CIMMarkerPlacementInsidePolygon"===e.markerPlacement.type;export{G 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.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import t from"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../webgl/checkWebGLError.js";import{PixelType as r}from"../../../webgl/enums.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/GLObjectType.js";import{getDataTypeBytes as n}from"../../../webgl/getDataTypeBytes.js";import{Texture as o}from"../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../webgl/TextureDescriptor.js";import{VertexElementDescriptor as i}from"../../../webgl/VertexElementDescriptor.js";const s=()=>t.getLogger("esri.views.2d.engine.webgl.Utils");function p(t){switch(t){case r.UNSIGNED_BYTE:return 1;case r.UNSIGNED_SHORT_4_4_4_4:return 2;case r.FLOAT:return 4;default:return void s().error(new e("webgl-utils",`Unable to handle type ${t}`))}}function l(t){switch(t){case r.UNSIGNED_BYTE:return Uint8Array;case r.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case r.FLOAT:return Float32Array;default:return void s().error(new e("webgl-utils",`Unable to handle type ${t}`))}}function m(e){const t=new Map;for(const r in e){const o=e[r];let a=0;t.set(r,o.map((e=>{const t=new i(e.name,e.count,e.type,a,0,e.normalized||!1);return a+=e.count*n(e.type),t}))),t.get(r).forEach((e=>e.stride=a))}return t}const u=e=>{const t=new Map;for(const r in e)for(const n of e[r])t.set(n.name,n.location);return t},c=e=>{const t={};return e.forEach(((e,r)=>t[r]=e?.length?e[0].stride:0)),t},g=new Map,f=(e,t)=>{if(!g.has(e)){const r=m(t),n={strides:c(r),bufferLayouts:r,attributes:u(t)};g.set(e,n)}return g.get(e)},d=e=>e.includes("data:image/svg+xml");function h(e){const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return t}const w=e=>!!e&&(e=e.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(e)&&/[\dz]$/i.test(e)&&e.length>4));function b(e,t,r){const n=new a(t.width,t.height);return n.dataType=t.dataType,t.depth&&(n.depth=t.depth),t.flipped&&(n.flipped=t.flipped),t.hasMipmap&&(n.hasMipmap=t.hasMipmap),n.internalFormat=t.internalFormat,t.isImmutable&&(n.isImmutable=t.isImmutable),t.isOpaque&&(n.isOpaque=t.isOpaque),t.maxAnisotropy&&(n.maxAnisotropy=t.maxAnisotropy),n.pixelFormat=t.pixelFormat,t.preMultiplyAlpha&&(n.preMultiplyAlpha=t.preMultiplyAlpha),t.samplingMode&&(n.samplingMode=t.samplingMode),t.target&&(n.target=t.target),n.uniform=t.uniform,t.unpackAlignment&&(n.unpackAlignment=t.unpackAlignment),t.wrapMode&&(n.wrapMode=t.wrapMode),new o(e,n,r)}function y(e){return"url"in e&&"urlHash"in e?{...e,url:""}:e}export{h as charCodes,m as createAttributeLayout,f as createProgramDescriptor,b as createTexture,y as discardUrlIfHasUrlHash,l as getPixelArrayCtor,p as getPixelBytes,d as isSVGImage,w as isValidSVG};
5
+ import e from"../../../../core/Error.js";import t from"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../webgl/checkWebGLError.js";import{PixelType as r}from"../../../webgl/enums.js";import"../../../webgl/FramebufferObject.js";import"../../../webgl/GLObjectType.js";import{getDataTypeBytes as n}from"../../../webgl/getDataTypeBytes.js";import{Texture as a}from"../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../webgl/TextureDescriptor.js";import{VertexElementDescriptor as o}from"../../../webgl/VertexElementDescriptor.js";const s=()=>t.getLogger("esri.views.2d.engine.webgl.Utils");function l(t){switch(t){case r.UNSIGNED_BYTE:return 1;case r.UNSIGNED_SHORT_4_4_4_4:return 2;case r.FLOAT:return 4;default:return void s().error(new e("webgl-utils",`Unable to handle type ${t}`))}}function p(t){switch(t){case r.UNSIGNED_BYTE:return Uint8Array;case r.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case r.FLOAT:return Float32Array;default:return void s().error(new e("webgl-utils",`Unable to handle type ${t}`))}}function c(e){const t=new Map;for(const r in e){const a=e[r];let i=0;t.set(r,a.map((e=>{const t=new o(e.name,e.count,e.type,i,0,e.normalized||!1);return i+=e.count*n(e.type),t}))),t.get(r).forEach((e=>e.stride=i))}return t}const m=e=>{const t=new Map;for(const r in e)for(const n of e[r])t.set(n.name,n.location);return t},u=e=>{const t={};return e.forEach(((e,r)=>t[r]=e?.length?e[0].stride:0)),t},d=new Map,f=(e,t)=>{if(!d.has(e)){const r=c(t),n={strides:u(r),bufferLayouts:r,attributes:m(t)};d.set(e,n)}return d.get(e)},g=e=>e.includes("data:image/svg+xml");function $(e){const t=[];for(let r=0;r<e.length;r++)t.push(e.charCodeAt(r));return t}const M=e=>!!e&&(e=e.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(e)&&/[\dz]$/i.test(e)&&e.length>4));function h(e,t,r){const n=new i(t.width,t.height);return n.dataType=t.dataType,t.depth&&(n.depth=t.depth),t.flipped&&(n.flipped=t.flipped),t.hasMipmap&&(n.hasMipmap=t.hasMipmap),n.internalFormat=t.internalFormat,t.isImmutable&&(n.isImmutable=t.isImmutable),t.isOpaque&&(n.isOpaque=t.isOpaque),t.maxAnisotropy&&(n.maxAnisotropy=t.maxAnisotropy),n.pixelFormat=t.pixelFormat,t.preMultiplyAlpha&&(n.preMultiplyAlpha=t.preMultiplyAlpha),t.samplingMode&&(n.samplingMode=t.samplingMode),t.target&&(n.target=t.target),n.uniform=t.uniform,t.unpackAlignment&&(n.unpackAlignment=t.unpackAlignment),t.wrapMode&&(n.wrapMode=t.wrapMode),new a(e,n,r)}function w(e){return"url"in e&&"urlHash"in e?{...e,url:""}:e}function y(e){if(null==e)return"";const{type:t}=e;switch(t){case"CIMMarkerPlacementAlongLineRandomSize":return`${t}-${e.seed}-${e.randomization}`;case"CIMMarkerPlacementAlongLineVariableSize":return`${t}-${e.maxRandomOffset}-${e.numberOfSizes}-${e.seed}-${e.variationMethod}`;case"CIMMarkerPlacementAtExtremities":return`${t}-${e.extremityPlacement}-${e.offsetAlongLine}`;case"CIMMarkerPlacementAtRatioPositions":return`${t}-${e.beginPosition}-${e.endPosition}-${e.flipFirst}-${JSON.stringify(e.positionArray)}`;case"CIMMarkerPlacementAtMeasuredUnits":return`${t}-${e.interval}-${e.skipMarkerRate}-${e.placeAtExtremities}`;case"CIMMarkerPlacementInsidePolygon":return`${t}-${e.stepX}-${e.stepY}-${e.randomness}-${e.gridType}-${e.seed}-${e.shiftOddRows}`;case"CIMMarkerPlacementOnLine":return`${t}-${e.relativeTo}-${e.startPointOffset}`;case"CIMMarkerPlacementOnVertices":return`${t}-${e.placeOnControlPoints}-${e.placeOnEndPoints}-${e.placeOnRegularVertices}`;case"CIMMarkerPlacementPolygonCenter":return`${t}-${e.method}`;default:return`${t}`}}export{$ as charCodes,c as createAttributeLayout,f as createProgramDescriptor,h as createTexture,w as discardUrlIfHasUrlHash,y as getCIMMarkerPlacementHash,p as getPixelArrayCtor,l as getPixelBytes,g as isSVGImage,M as isValidSVG};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{WGLDrawPhase as e,FeatureSymbologyDrawOrder as t}from"../../../enums.js";import{FeatureTechnique as s}from"../FeatureTechnique.js";import{getSelectionDefines as r,getFeaturePipelineState as a,resolveDynamicUniforms as i,getFeatureUniforms as o,isHittest as n}from"../featureTechniqueUtils.js";import{TechniqueType as u}from"../TechniqueType.js";import{TextShader as m,TextRenderPassType as p}from"../text/TextShader.js";class d extends s{constructor(){super(...arguments),this.type=u.Label,this.shaders={geometry:new m},this.drawPhase=e.LABEL|e.LABEL_ALPHA|e.HITTEST,this.symbologyPlane=t.TEXT}render(e,t){const{context:s,painter:u}=e,m=r(e),d={...a(e)},h=t.instance.getInput(),l={shader:this.shaders.geometry,uniforms:{...i(e,t.target,h.uniforms),...o(e,t.target),mosaicInfo:u.textureManager.getMosaicInfo(s,t.textureKey)},defines:{...m,textRenderPassType:p.Color,isBackgroundPass:!0,isLabel:!0},optionalAttributes:h.optionalAttributes,useComputeBuffer:n(e)};u.setShader(l),u.setPipelineState(d),u.submitDraw(e,t),u.setShader({...l,defines:{...m,textRenderPassType:p.Halo,isBackgroundPass:!1,isLabel:!0}}),u.setPipelineState(d),u.submitDraw(e,t),u.setShader({...l,defines:{...m,textRenderPassType:p.Color,isBackgroundPass:!1,isLabel:!0}}),u.setPipelineState(d),u.submitDraw(e,t)}}export{d as LabelTechnique};
5
+ import{WGLDrawPhase as e,FeatureSymbologyDrawOrder as t}from"../../../enums.js";import{FeatureTechnique as s}from"../FeatureTechnique.js";import{getSelectionDefines as r,getFeaturePipelineState as a,resolveDynamicUniforms as i,getFeatureUniforms as o,isHittest as n}from"../featureTechniqueUtils.js";import{TechniqueType as u}from"../TechniqueType.js";import{TextShader as m,TextRenderPassType as d}from"../text/TextShader.js";class p extends s{constructor(){super(...arguments),this.type=u.Label,this.shaders={geometry:new m},this.drawPhase=e.LABEL|e.LABEL_ALPHA|e.HITTEST,this.symbologyPlane=t.TEXT}render(e,t){const{context:s,painter:u}=e,m=r(e),p={...a(e)},h=t.instance.getInput(),f={shader:this.shaders.geometry,uniforms:{...i(e,t.target,h.uniforms),...o(e,t.target),mosaicInfo:u.textureManager.getMosaicInfo(s,t.textureKey)},defines:{...m,textRenderPassType:d.Color,isBackgroundPass:!0,isLabel:!0},optionalAttributes:h.optionalAttributes,useComputeBuffer:n(e)};u.setPipelineState(p),u.setShader(f),u.submitDraw(e,t),u.setShader({...f,defines:{...m,textRenderPassType:d.Halo,isBackgroundPass:!1,isLabel:!0}}),u.submitDraw(e,t),u.setShader({...f,defines:{...m,textRenderPassType:d.Color,isBackgroundPass:!1,isLabel:!0}}),u.submitDraw(e,t)}}export{p as LabelTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{identity as t,translate as r,rotate as o}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as s}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as i}from"../../../../../../../geometry/GeometryCursor.js";import{maxTileCoordValue as n}from"../../../../../../../symbols/cim/constants.js";import{Alignment as c}from"../../../../../../../symbols/cim/enums.js";import{CIMMarkerPlacementHelper as m}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{minMaxZoomPrecisionFactor as l}from"../../../definitions.js";import{getMinMaxZoom as d,processColorInput as u,packByteSqrt as p,getBitMask as h}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as f}from"./ComputedMarkerParams.js";import{MarkerConstants as y}from"./markerConstants.js";import{getGeometryEngine as x}from"../mesh/loadGeometryEngine.js";import{MeshWriter as P}from"../mesh/MeshWriter.js";import{DataType as M}from"../../../../../../webgl/enums.js";const g=3.14159265359/180,k=128/Math.PI;function b(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function v(e){return b(e*k,256)}function S(e,a,i,n,c=!1){const m=s(),l=c?1:-1;return t(m),(a||i)&&r(m,m,[a,-i]),n&&o(m,m,l*g*-n),m}const _={createComputedParams:e=>f.from(e),optionalAttributes:{zoomRange:{type:M.SHORT,count:2,packPrecisionFactor:l,pack:({scaleInfo:e},{tileInfo:t})=>d(e,t)}},attributes:{pos:{type:M.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:M.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:M.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:r,overrideOutlineColor:o,colorLocked:s})=>{let a=0;return e.sdf&&(a|=h(y.bitset.isSDF)),t===c.MAP&&(a|=h(y.bitset.isMapAligned)),r&&(a|=h(y.bitset.scaleSymbolsProportionally)),o&&(a|=h(y.bitset.overrideOutlineColor)),s&&(a|=h(y.bitset.colorLocked)),a}},offset:{type:M.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:r,anchorX:o,anchorY:s,offsetX:i,offsetY:n,rotateClockwise:c})=>{const m=S(0,i,n,-e,c),l=-(.5+o)*t,d=-(.5-s)*r,u=[l,d],p=[l+t,d],h=[l,d+r],f=[l+t,d+r];return a(u,u,m),a(p,p,m),a(h,h,m),a(f,f,m),[u,p,h,f]}}},textureUV:{type:M.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:r,texYmin:o})=>[[t,o],[e,o],[t,r],[e,r]]}},color:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>u(e)},outlineColor:{type:M.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>u(e)},sizing:{type:M.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:r,referenceSize:o})=>{const s=Math.max(e,t);return[p(s,128),p(r,128),p(o,128),0]}},placementAngle:{type:M.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>v(e)},sdfDecodeCoeff:{type:M.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:e})=>e}}};class I extends P{constructor(){super(...arguments),this.vertexSpec=_}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(e,t,r){const o=this.evaluatedMeshParams.sprite?.textureBinding,s=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,o);const a=this.evaluatedMeshParams.minPixelBuffer,i=Math.max(this.evaluatedMeshParams.computedWidth,a),c=Math.max(this.evaluatedMeshParams.computedHeight,a),m=-this.evaluatedMeshParams.anchorX*this.evaluatedMeshParams.computedWidth,l=this.evaluatedMeshParams.anchorY*this.evaluatedMeshParams.computedHeight,d=this.evaluatedMeshParams.offsetX+m,u=-this.evaluatedMeshParams.offsetY+l;if(null!=this.evaluatedMeshParams.placement)this._writePlacedMarkers(e,t,r,i,c);else if(r?.nextPath()){r.nextPoint();const t=r.x,o=r.y;e.recordBounds(t+d,o+u,i,c),this._writeQuad(e,s,t,o)}else if("esriGeometryPolygon"===t.geometryType){const r=t.readCentroidForDisplay();if(!r)return;const[o,a]=r.coords;e.recordBounds(o+d,a+u,i,c),this._writeQuad(e,s,o,a)}else if("esriGeometryPoint"===t.geometryType){const r=t.readXForDisplay(),o=t.readYForDisplay();e.recordBounds(r+d,o+u,i,c),this._writeQuad(e,s,r,o)}else{const r=t.readGeometryForDisplay();r?.forEachVertex(((t,r)=>{e.recordBounds(t+d,r+u,i,c),Math.abs(t)>n||Math.abs(r)>n||this._writeQuad(e,s,t,r)}))}e.recordEnd()}_writePlacedMarkers(t,r,o,s,a){const c=o??i.fromFeatureSetReaderCIM(r)?.clone();if(!c)return;const l=-1,d=m.getPlacement(c,l,this.evaluatedMeshParams.placement,e(1),t.id,x());if(!d)return;const u=r.getDisplayId();let p=d.next();const h=this.evaluatedMeshParams.offsetX,f=-this.evaluatedMeshParams.offsetY;for(;null!=p;){const e=p.tx,r=-p.ty;if(Math.abs(e)>n||Math.abs(r)>n){p=d.next();continue}const o=-p.getAngle();t.recordBounds(e+h,r+f,s,a),this._writeQuad(t,u,e,r,o),p=d.next()}}_writeQuad(e,t,r,o,s){const a=e.vertexCount(),i=null==s?null:{placementAngle:s};this._writeVertex(e,t,r,o,i),e.indexWrite(a+0),e.indexWrite(a+1),e.indexWrite(a+2),e.indexWrite(a+1),e.indexWrite(a+3),e.indexWrite(a+2)}}export{I as MarkerMeshWriter,_ as MarkerVertexSpec};
5
+ import{pt2px as e}from"../../../../../../../core/screenUtils.js";import{identity as t,translate as r,rotate as o}from"../../../../../../../core/libs/gl-matrix-2/math/mat2d.js";import{create as s}from"../../../../../../../core/libs/gl-matrix-2/factories/mat2df32.js";import{transformMat2d as a}from"../../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{GeometryCursor as i}from"../../../../../../../geometry/GeometryCursor.js";import{clipCursorToTileExtent as n}from"../../../../../../../symbols/cim/CIMEffects.js";import{maxTileCoordValue as c}from"../../../../../../../symbols/cim/constants.js";import{Alignment as m}from"../../../../../../../symbols/cim/enums.js";import{CIMMarkerPlacementHelper as l}from"../../../../../../../symbols/cim/placements/CIMMarkerPlacementHelper.js";import{minMaxZoomPrecisionFactor as d}from"../../../definitions.js";import{getMinMaxZoom as u,processColorInput as p,packByteSqrt as h,getBitMask as f}from"../fill/meshWriterUtils.js";import{ComputedMarkerParams as y}from"./ComputedMarkerParams.js";import{MarkerConstants as x}from"./markerConstants.js";import{getGeometryEngine as M}from"../mesh/loadGeometryEngine.js";import{MeshWriter as P}from"../mesh/MeshWriter.js";import{DataType as g}from"../../../../../../webgl/enums.js";const b=3.14159265359/180,k=128/Math.PI;function v(e,t){return e%=t,Math.abs(e>=0?e:e+t)}function S(e){return v(e*k,256)}function I(e,a,i,n,c=!1){const m=s(),l=c?1:-1;return t(m),(a||i)&&r(m,m,[a,-i]),n&&o(m,m,l*b*-n),m}const _={createComputedParams:e=>y.from(e),optionalAttributes:{zoomRange:{type:g.SHORT,count:2,packPrecisionFactor:d,pack:({scaleInfo:e},{tileInfo:t})=>u(e,t)}},attributes:{pos:{type:g.SHORT,count:2,pack:"position",packPrecisionFactor:10},id:{type:g.UNSIGNED_BYTE,count:3,pack:"id"},bitset:{type:g.UNSIGNED_BYTE,count:1,pack:({sprite:e,alignment:t,scaleSymbolsProportionally:r,overrideOutlineColor:o,colorLocked:s})=>{let a=0;return e.sdf&&(a|=f(x.bitset.isSDF)),t===m.MAP&&(a|=f(x.bitset.isMapAligned)),r&&(a|=f(x.bitset.scaleSymbolsProportionally)),o&&(a|=f(x.bitset.overrideOutlineColor)),s&&(a|=f(x.bitset.colorLocked)),a}},offset:{type:g.HALF_FLOAT,count:2,packAlternating:{count:4,pack:({angle:e,computedWidth:t,computedHeight:r,anchorX:o,anchorY:s,offsetX:i,offsetY:n,rotateClockwise:c})=>{const m=I(0,i,n,-e,c),l=-(.5+o)*t,d=-(.5-s)*r,u=[l,d],p=[l+t,d],h=[l,d+r],f=[l+t,d+r];return a(u,u,m),a(p,p,m),a(h,h,m),a(f,f,m),[u,p,h,f]}}},textureUV:{type:g.SHORT,count:2,packPrecisionFactor:4,packAlternating:{count:4,pack:({texXmax:e,texXmin:t,texYmax:r,texYmin:o})=>[[t,o],[e,o],[t,r],[e,r]]}},color:{type:g.UNSIGNED_BYTE,count:4,normalized:!0,pack:({color:e})=>p(e)},outlineColor:{type:g.UNSIGNED_BYTE,count:4,normalized:!0,pack:({outlineColor:e})=>p(e)},sizing:{type:g.UNSIGNED_BYTE,count:4,pack:({rawWidth:e,rawHeight:t,outlineSize:r,referenceSize:o})=>{const s=Math.max(e,t);return[h(s,128),h(r,128),h(o,128),0]}},placementAngle:{type:g.UNSIGNED_BYTE,count:1,packTessellation:({placementAngle:e})=>S(e)},sdfDecodeCoeff:{type:g.UNSIGNED_SHORT,count:1,packPrecisionFactor:64,pack:({sdfDecodeCoeff:e})=>e}}};class E extends P{constructor(){super(...arguments),this.vertexSpec=_}getBoundsInfo(){return this.evaluatedMeshParams.boundsInfo}_write(e,t,r){const o=this.evaluatedMeshParams.sprite?.textureBinding,s=t.getDisplayId();e.recordStart(this.instanceId,this.attributeLayout,o);const a=this.evaluatedMeshParams.minPixelBuffer,i=Math.max(this.evaluatedMeshParams.computedWidth,a),m=Math.max(this.evaluatedMeshParams.computedHeight,a),l=-this.evaluatedMeshParams.anchorX*this.evaluatedMeshParams.computedWidth,d=this.evaluatedMeshParams.anchorY*this.evaluatedMeshParams.computedHeight,u=this.evaluatedMeshParams.offsetX+l,p=-this.evaluatedMeshParams.offsetY+d;if(null!=this.evaluatedMeshParams.placement){const o=n(r,100,!1);this._writePlacedMarkers(e,t,o,i,m)}else if(r?.nextPath()){r.nextPoint();const t=r.x,o=r.y;e.recordBounds(t+u,o+p,i,m),this._writeQuad(e,s,t,o)}else if("esriGeometryPolygon"===t.geometryType){const r=t.readCentroidForDisplay();if(!r)return;const[o,a]=r.coords;e.recordBounds(o+u,a+p,i,m),this._writeQuad(e,s,o,a)}else if("esriGeometryPoint"===t.geometryType){const r=t.readXForDisplay(),o=t.readYForDisplay();e.recordBounds(r+u,o+p,i,m),this._writeQuad(e,s,r,o)}else{const r=t.readGeometryForDisplay();r?.forEachVertex(((t,r)=>{e.recordBounds(t+u,r+p,i,m),Math.abs(t)>c||Math.abs(r)>c||this._writeQuad(e,s,t,r)}))}e.recordEnd()}_writePlacedMarkers(t,r,o,s,a){const n=o??i.fromFeatureSetReaderCIM(r);if(!n)return;const m=-1,d=l.getPlacement(n,m,this.evaluatedMeshParams.placement,e(1),t.id,M());if(!d)return;const u=r.getDisplayId();let p=d.next();const h=this.evaluatedMeshParams.offsetX,f=-this.evaluatedMeshParams.offsetY;for(;null!=p;){const e=p.tx,r=-p.ty;if(Math.abs(e)>c||Math.abs(r)>c){p=d.next();continue}const o=-p.getAngle();t.recordBounds(e+h,r+f,s,a),this._writeQuad(t,u,e,r,o),p=d.next()}}_writeQuad(e,t,r,o,s){const a=e.vertexCount(),i=null==s?null:{placementAngle:s};this._writeVertex(e,t,r,o,i),e.indexWrite(a+0),e.indexWrite(a+1),e.indexWrite(a+2),e.indexWrite(a+1),e.indexWrite(a+3),e.indexWrite(a+2)}}export{E as MarkerMeshWriter,_ as MarkerVertexSpec};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t,a as e}from"../../../../../../../chunks/tslib.es6.js";import{minMaxZoomPrecisionFactor as i,labelPlacementOffsetPadding as o}from"../../../definitions.js";import{location as s,option as l,uniform as a,define as r,ComputeVertexInput as n,input as p}from"../../GraphShaderModule.js";import{abs as d,min as u,Float as y,floor as m,step as c,Vec3 as f,Mat3 as h,Vec2 as v,or as b,equal as w,greaterThan as x,Bool as V,Vec4 as S,texture2D as g,smoothstep as z,ifElse as j,Int as R,bitRShift as C,bitAnd as O}from"../../graph/glsl.js";import{FeatureVertexInput as M,FeatureFragmentInput as L,AFeatureShader as A}from"../shaders/AFeatureShader.js";import{bitsetTextIsBackground as H,sdfFontSize as P,bitsetTextIsMapAligned as N,maxSdfDistance as U}from"../shaders/constants.js";import{distPointTriangle as _,failHittest as k}from"../shaders/hittestUtils.js";import{MosaicInfo as T}from"../shaders/MosaicInfo.js";import{getBit as I}from"../shaders/utils.js";import{VisualVariableColor as D}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as B}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as q}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as E}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as F}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as W}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as G}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableSize as Z,getVisualVariableRotation as J}from"../shaders/vvUtils.js";const K=360/254;var Q;!function(t){t[t.Color=0]="Color",t[t.Outline=1]="Outline",t[t.Halo=2]="Halo"}(Q||(Q={}));class X extends M{}t([s(3,S)],X.prototype,"color",void 0),t([s(4,v)],X.prototype,"offset",void 0),t([s(5,v)],X.prototype,"textureUV",void 0),t([s(6,y)],X.prototype,"fontSize",void 0),t([s(7,y)],X.prototype,"referenceSize",void 0),t([s(8,S)],X.prototype,"outlineColor",void 0),t([s(9,S)],X.prototype,"haloColor",void 0),t([s(10,v)],X.prototype,"outlineAndHaloSize",void 0),t([s(11,v)],X.prototype,"zoomRange",void 0),t([s(12,y)],X.prototype,"clipAngle",void 0),t([s(13,S)],X.prototype,"referenceSymbol",void 0);class Y extends n{}t([s(14,v)],Y.prototype,"offsetNextVertex1",void 0),t([s(15,v)],Y.prototype,"offsetNextVertex2",void 0);class $ extends L{}class tt extends A{constructor(){super(...arguments),this.computeAttributes={offset:["offsetNextVertex1","offsetNextVertex2"]},this.textRenderPassType=Q.Color,this.isBackgroundPass=!1,this.isLabel=!1}clipLabel(t,e,o){const s=e.multiply(K),l=d(this.view.rotation.subtract(s)),a=u(new y(360).subtract(l),l);let r=new y(0);const n=m(this.view.currentZoom.multiply(i)).divide(i),p=t.x,f=t.y,h=new y(1).subtract(c(p,n)).multiply(2),v=c(new y(90),a).multiply(2),b=new y(2).multiply(new y(1).subtract(c(n,f)));return r=r.add(o.multiply(h)),r=r.add(o.multiply(v)),r=r.add(b),r}vertex(t,e){const i=I(t.bitset,H),s=new y(1).subtract(i);let l=t.fontSize,a=l.divide(P);const r=this.textRenderPassType===Q.Outline?t.outlineColor:this.textRenderPassType===Q.Halo?t.haloColor:this._getVertexColor(t),n=this.isLabel?this.storage.getLabelVisibility(t.id):new y(1),p=this.isLabel?r.multiply(n):r,d=this.view.displayViewScreenMat3.multiply(new f(t.pos,1));let u=t.offset,m=new y(1),c=h.identity(),g=new v(0);if(this.isLabel){if(!t.referenceSymbol)throw new Error("InternalError: Optional attribute 'referenceSymbol' expected for labels");const e=t.referenceSymbol,i=e.xy,s=e.z,l=this._unpackDirection(e.w),a=Z(this,t.id,s).divide(2),r=l.multiply(a.add(o));g=i.add(r),u=u.add(g)}else{m=Z(this,t.id,t.referenceSize).divide(t.referenceSize),l=l.multiply(m),a=a.multiply(m),u=u.multiply(m),c=J(this,t.id),u=c.multiply(new f(u,0)).xy}const z=I(t.bitset,N),j=this._getViewRotationMatrix(z).multiply(new f(u,0));let R=this.isLabel?this.clipLabel(t.zoomRange,t.clipAngle,z):this.clip(t.id,t.zoomRange);R=this.isBackgroundPass?R.add(s.multiply(2)):R.add(i.multiply(2));const C=this.isLabel?b(x(R,new y(1)),w(n,new y(0))):new V(!1),O=new S(d.xy.add(j.xy),R,1),M=t.textureUV.divide(this.mosaicInfo.size);let L=new y(0);if(this.textRenderPassType===Q.Outline){w(t.outlineAndHaloSize.x,new y(0))&&(R=R.add(new y(2)));L=new y(t.outlineAndHaloSize.x).divide(a).divide(U)}if(this.textRenderPassType===Q.Halo){const e=t.outlineAndHaloSize.x,i=new y(t.outlineAndHaloSize.y);w(i,new y(0))&&(R=R.add(new y(2)));L=i.add(e).divide(a).divide(U)}return{glPosition:O,color:p,size:a,textureUV:M,antialiasingWidth:new y(.105*P).divide(l).divide(this.view.pixelRatio),outlineDistanceOffset:L,...this.maybeRunHittest(t,e,{vvSizeAdjustment:m,vvRotation:c,labelOffset:g,labelClipped:C})}}_getViewRotationMatrix(t){const e=this.view.displayViewMat3,i=this.view.displayMat3,o=new y(1).subtract(t);return e.multiply(t).add(i.multiply(o))}fragment(t){const e=new y(2/8),i=new y(1).subtract(e),o=g(this.mosaicInfo.texture,t.textureUV).a;let s=i.subtract(t.outlineDistanceOffset);this.highlight&&(s=s.divide(2));const l=t.antialiasingWidth,a=z(s.subtract(l),s.add(l),o);return this.getFragmentOutput(t.color.multiply(a),t)}hittest(t,e,{vvSizeAdjustment:i,vvRotation:o,labelOffset:s,labelClipped:l}){let a,r,n;this.isLabel?(a=new f(t.offset.add(s),0),r=new f(e.offsetNextVertex1.add(s),0),n=new f(e.offsetNextVertex2.add(s),0)):(a=o.multiply(new f(t.offset.multiply(i),0)),r=o.multiply(new f(e.offsetNextVertex1.multiply(i),0)),n=o.multiply(new f(e.offsetNextVertex2.multiply(i),0)));const{viewMat3:p,tileMat3:d}=this.view,u=p.multiply(d).multiply(new f(t.pos,1)),y=u.add(d.multiply(a)).xy,m=u.add(d.multiply(r)).xy,c=u.add(d.multiply(n)).xy,h=_(this.hittestRequest.position,y.xy,m.xy,c.xy);return this.isLabel?j(l,k(this.hittestRequest),h):h}_unpackDirection(t){const e=new R(t),i=C(e,new R(2)),o=O(e,new R(3));return new v(new y(i).subtract(1),new y(o).subtract(1))}_getVertexColor(t){let e=t.color;if(this.visualVariableColor){const i=this.storage.getColorValue(t.id);e=this.visualVariableColor.getColor(i,t.color,new V(!1))}if(this.visualVariableOpacity){const i=this.storage.getOpacityValue(t.id),o=this.visualVariableOpacity.getOpacity(i);e=e.multiply(o)}return e}}t([l(D)],tt.prototype,"visualVariableColor",void 0),t([l(B)],tt.prototype,"visualVariableOpacity",void 0),t([l(q)],tt.prototype,"visualVariableRotation",void 0),t([l(E)],tt.prototype,"visualVariableSizeMinMaxValue",void 0),t([l(F)],tt.prototype,"visualVariableSizeScaleStops",void 0),t([l(W)],tt.prototype,"visualVariableSizeStops",void 0),t([l(G)],tt.prototype,"visualVariableSizeUnitValue",void 0),t([a(T)],tt.prototype,"mosaicInfo",void 0),t([r],tt.prototype,"textRenderPassType",void 0),t([r],tt.prototype,"isBackgroundPass",void 0),t([r],tt.prototype,"isLabel",void 0),t([e(0,p(X)),e(1,p(Y))],tt.prototype,"vertex",null),t([e(0,p($))],tt.prototype,"fragment",null);export{$ as TextFragmentInput,Q as TextRenderPassType,tt as TextShader,X as TextVertexInput};
5
+ import{_ as t,a as e}from"../../../../../../../chunks/tslib.es6.js";import{minMaxZoomPrecisionFactor as i,labelPlacementOffsetPadding as o}from"../../../definitions.js";import{location as s,option as l,uniform as a,define as r,ComputeVertexInput as n,input as p}from"../../GraphShaderModule.js";import{abs as d,min as u,Float as y,floor as m,step as c,Vec3 as f,Mat3 as h,Vec2 as v,ifElse as w,equal as b,or as x,lessThanEqual as V,greaterThan as S,Bool as g,Vec4 as z,texture2D as j,smoothstep as R,Int as C,bitRShift as O,bitAnd as M}from"../../graph/glsl.js";import{FeatureVertexInput as L,FeatureFragmentInput as A,AFeatureShader as H}from"../shaders/AFeatureShader.js";import{bitsetTextIsBackground as P,sdfFontSize as N,bitsetTextIsMapAligned as U,maxSdfDistance as _}from"../shaders/constants.js";import{distPointTriangle as k,failHittest as T}from"../shaders/hittestUtils.js";import{MosaicInfo as I}from"../shaders/MosaicInfo.js";import{getBit as D}from"../shaders/utils.js";import{VisualVariableColor as B}from"../shaders/VisualVariableColor.js";import{VisualVariableOpacity as q}from"../shaders/VisualVariableOpacity.js";import{VisualVariableRotation as E}from"../shaders/VisualVariableRotation.js";import{VisualVariableSizeMinMaxValue as F}from"../shaders/VisualVariableSizeMinMaxValue.js";import{VisualVariableSizeScaleStops as W}from"../shaders/VisualVariableSizeScaleStops.js";import{VisualVariableSizeStops as G}from"../shaders/VisualVariableSizeStops.js";import{VisualVariableSizeUnitValue as Z}from"../shaders/VisualVariableSizeUnitValue.js";import{getVisualVariableSize as J,getVisualVariableRotation as K}from"../shaders/vvUtils.js";const Q=360/254;var X;!function(t){t[t.Color=0]="Color",t[t.Outline=1]="Outline",t[t.Halo=2]="Halo"}(X||(X={}));class Y extends L{}t([s(3,z)],Y.prototype,"color",void 0),t([s(4,v)],Y.prototype,"offset",void 0),t([s(5,v)],Y.prototype,"textureUV",void 0),t([s(6,y)],Y.prototype,"fontSize",void 0),t([s(7,y)],Y.prototype,"referenceSize",void 0),t([s(8,z)],Y.prototype,"outlineColor",void 0),t([s(9,z)],Y.prototype,"haloColor",void 0),t([s(10,v)],Y.prototype,"outlineAndHaloSize",void 0),t([s(11,v)],Y.prototype,"zoomRange",void 0),t([s(12,y)],Y.prototype,"clipAngle",void 0),t([s(13,z)],Y.prototype,"referenceSymbol",void 0);class $ extends n{}t([s(14,v)],$.prototype,"offsetNextVertex1",void 0),t([s(15,v)],$.prototype,"offsetNextVertex2",void 0);class tt extends A{}class et extends H{constructor(){super(...arguments),this.computeAttributes={offset:["offsetNextVertex1","offsetNextVertex2"]},this.textRenderPassType=X.Color,this.isBackgroundPass=!1,this.isLabel=!1}clipLabel(t,e,o){const s=e.multiply(Q),l=d(this.view.rotation.subtract(s)),a=u(new y(360).subtract(l),l);let r=new y(0);const n=m(this.view.currentZoom.multiply(i)).divide(i),p=t.x,f=t.y,h=new y(1).subtract(c(p,n)).multiply(2),v=c(new y(90),a).multiply(2),w=new y(2).multiply(new y(1).subtract(c(n,f)));return r=r.add(o.multiply(h)),r=r.add(o.multiply(v)),r=r.add(w),r}vertex(t,e){const i=D(t.bitset,P),s=new y(1).subtract(i);let l=t.fontSize,a=l.divide(N);const r=this.textRenderPassType===X.Outline?t.outlineColor:this.textRenderPassType===X.Halo?t.haloColor:this._getVertexColor(t),n=this.isLabel?this.storage.getLabelVisibility(t.id):new y(1),p=this.isLabel?r.multiply(n):r,d=this.view.displayViewScreenMat3.multiply(new f(t.pos,1));let u=t.offset,m=new y(1),c=h.identity(),j=new v(0);if(this.isLabel){if(!t.referenceSymbol)throw new Error("InternalError: Optional attribute 'referenceSymbol' expected for labels");const e=t.referenceSymbol,i=e.xy,s=e.z,l=this._unpackDirection(e.w),a=J(this,t.id,s).divide(2),r=l.multiply(a.add(o));j=i.add(r),u=u.add(j)}else{m=J(this,t.id,t.referenceSize).divide(t.referenceSize),l=l.multiply(m),a=a.multiply(m),u=u.multiply(m),c=K(this,t.id),u=c.multiply(new f(u,0)).xy}const R=D(t.bitset,U),C=this._getViewRotationMatrix(R).multiply(new f(u,0));let O=this.isLabel?this.clipLabel(t.zoomRange,t.clipAngle,R):this.clip(t.id,t.zoomRange);O=this.isBackgroundPass?O.add(s.multiply(2)):O.add(i.multiply(2));let M=new y(0);if(this.textRenderPassType===X.Outline){O=O.add(w(b(t.outlineAndHaloSize.x,new y(0)),new y(2),new y(0)));M=new y(t.outlineAndHaloSize.x).divide(a).divide(_)}if(this.textRenderPassType===X.Halo){const e=t.outlineAndHaloSize.x,i=new y(t.outlineAndHaloSize.y);O=O.add(w(b(i,new y(0)),new y(2),new y(0)));M=i.add(e).divide(a).divide(_)}const L=this.isLabel?x(S(O,new y(1)),V(n,new y(0))):new g(!1);return{glPosition:new z(d.xy.add(C.xy),O,1),color:p,size:a,textureUV:t.textureUV.divide(this.mosaicInfo.size),antialiasingWidth:new y(.105*N).divide(l).divide(this.view.pixelRatio),outlineDistanceOffset:M,...this.maybeRunHittest(t,e,{vvSizeAdjustment:m,vvRotation:c,labelOffset:j,labelClipped:L})}}_getViewRotationMatrix(t){const e=this.view.displayViewMat3,i=this.view.displayMat3,o=new y(1).subtract(t);return e.multiply(t).add(i.multiply(o))}fragment(t){const e=new y(2/8),i=new y(1).subtract(e),o=j(this.mosaicInfo.texture,t.textureUV).a;let s=i.subtract(t.outlineDistanceOffset);this.highlight&&(s=s.divide(2));const l=t.antialiasingWidth,a=R(s.subtract(l),s.add(l),o);return this.getFragmentOutput(t.color.multiply(a),t)}hittest(t,e,{vvSizeAdjustment:i,vvRotation:o,labelOffset:s,labelClipped:l}){let a,r,n;this.isLabel?(a=new f(t.offset.add(s),0),r=new f(e.offsetNextVertex1.add(s),0),n=new f(e.offsetNextVertex2.add(s),0)):(a=o.multiply(new f(t.offset.multiply(i),0)),r=o.multiply(new f(e.offsetNextVertex1.multiply(i),0)),n=o.multiply(new f(e.offsetNextVertex2.multiply(i),0)));const{viewMat3:p,tileMat3:d}=this.view,u=p.multiply(d).multiply(new f(t.pos,1)),y=u.add(d.multiply(a)).xy,m=u.add(d.multiply(r)).xy,c=u.add(d.multiply(n)).xy,h=k(this.hittestRequest.position,y.xy,m.xy,c.xy);return this.isLabel?w(l,T(this.hittestRequest),h):h}_unpackDirection(t){const e=new C(t),i=O(e,new C(2)),o=M(e,new C(3));return new v(new y(i).subtract(1),new y(o).subtract(1))}_getVertexColor(t){let e=t.color;if(this.visualVariableColor){const i=this.storage.getColorValue(t.id);e=this.visualVariableColor.getColor(i,t.color,new g(!1))}if(this.visualVariableOpacity){const i=this.storage.getOpacityValue(t.id),o=this.visualVariableOpacity.getOpacity(i);e=e.multiply(o)}return e}}t([l(B)],et.prototype,"visualVariableColor",void 0),t([l(q)],et.prototype,"visualVariableOpacity",void 0),t([l(E)],et.prototype,"visualVariableRotation",void 0),t([l(F)],et.prototype,"visualVariableSizeMinMaxValue",void 0),t([l(W)],et.prototype,"visualVariableSizeScaleStops",void 0),t([l(G)],et.prototype,"visualVariableSizeStops",void 0),t([l(Z)],et.prototype,"visualVariableSizeUnitValue",void 0),t([a(I)],et.prototype,"mosaicInfo",void 0),t([r],et.prototype,"textRenderPassType",void 0),t([r],et.prototype,"isBackgroundPass",void 0),t([r],et.prototype,"isLabel",void 0),t([e(0,p(Y)),e(1,p($))],et.prototype,"vertex",null),t([e(0,p(tt))],et.prototype,"fragment",null);export{tt as TextFragmentInput,X as TextRenderPassType,et as TextShader,Y as TextVertexInput};