@arcgis/core 6.0.0-next.35 → 6.0.0-next.37

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 (188) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{0202eb8c2b2865f99981.js → 00311d1b18d5952a014b.js} +1 -1
  3. package/assets/esri/core/workers/chunks/0b21d0e2e5a91c34a108.js +1 -0
  4. package/assets/esri/core/workers/chunks/{f717005e14a7e9141df7.js → 2050c844b5a29b1df28a.js} +1 -1
  5. package/assets/esri/core/workers/chunks/2c3612379111457c3221.js +1 -0
  6. package/assets/esri/core/workers/chunks/2f9072563194026e320e.js +1 -0
  7. package/assets/esri/core/workers/chunks/{d9a240a3c6bf85124474.js → 342a97974a78007b25e0.js} +1 -1
  8. package/assets/esri/core/workers/chunks/34467f7d84baffd772a3.js +1 -0
  9. package/assets/esri/core/workers/chunks/{4d18b48d4a282a0f341c.js → 427d929dc7f89b0a1ea9.js} +1 -1
  10. package/assets/esri/core/workers/chunks/432728c557be5dfa26b5.js +1 -0
  11. package/assets/esri/core/workers/chunks/46969f379623810b2eca.js +1 -0
  12. package/assets/esri/core/workers/chunks/592b5db1459c02cf6a0c.js +1 -0
  13. package/assets/esri/core/workers/chunks/6a21dc13a465757ba007.js +1 -0
  14. package/assets/esri/core/workers/chunks/{379db67f78161ebd5468.js → 7023651ed6398dcf8efb.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{90360c0bd053d3e3fd77.js → 7027a0e7bfabb3bb7fc2.js} +1 -1
  16. package/assets/esri/core/workers/chunks/78818c2a898444f7e890.js +1 -0
  17. package/assets/esri/core/workers/chunks/{40c2674dae73f0942751.js → 7d497df6e13162156342.js} +1 -1
  18. package/assets/esri/core/workers/chunks/8a3dfe997712dc2ddead.js +1 -0
  19. package/assets/esri/core/workers/chunks/{81bcc495e6eaf2cf7474.js → 8f82a0a6747f673a2a7e.js} +1 -1
  20. package/assets/esri/core/workers/chunks/9826baa3c15ea2062669.js +1 -0
  21. package/assets/esri/core/workers/chunks/{d3369ffed19f4c264dcd.js → 9ab0735e86cf8932bf9d.js} +1 -1
  22. package/assets/esri/core/workers/chunks/ab0ea4042f4e13874aed.js +1 -0
  23. package/assets/esri/core/workers/chunks/ab98ade3257360015d6c.js +1 -0
  24. package/assets/esri/core/workers/chunks/{796c6195b6bf59dcc9bd.js → b25a05c58b0fd0f6ac60.js} +1 -1
  25. package/assets/esri/core/workers/chunks/b90271ce38522bcf813b.js +1 -0
  26. package/assets/esri/core/workers/chunks/ba91df9835cdea7698a9.js +1 -0
  27. package/assets/esri/core/workers/chunks/bfe13ac9fa1aafb190a1.js +1 -0
  28. package/assets/esri/core/workers/chunks/ce0274847ccce6a1ac53.js +1 -0
  29. package/assets/esri/core/workers/chunks/cf2e5f827cea7d7319ce.js +1 -0
  30. package/assets/esri/core/workers/chunks/dae2036faa28dade2119.js +1 -0
  31. package/assets/esri/core/workers/chunks/{e8fb2ba7b7a4f0916325.js → eed4b90494a54f8b337b.js} +1 -1
  32. package/assets/esri/core/workers/chunks/fc77eb7683e708774168.js +1 -0
  33. package/chunks/Clouds.glsl.js +7 -11
  34. package/chunks/RibbonLine.glsl.js +158 -84
  35. package/config.js +1 -1
  36. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  37. package/kernel.js +1 -1
  38. package/layers/BaseElevationLayer.js +1 -1
  39. package/layers/ElevationLayer.js +1 -1
  40. package/layers/IntegratedMesh3DTilesLayer.js +1 -1
  41. package/layers/IntegratedMeshLayer.d.ts +2 -0
  42. package/layers/IntegratedMeshLayer.js +1 -1
  43. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  44. package/layers/support/ElevationQuery.js +1 -1
  45. package/layers/video/VideoController.js +3 -3
  46. package/layers/video/types.d.ts +12 -0
  47. package/package.json +3 -3
  48. package/support/timeUtils.js +1 -1
  49. package/views/2d/engine/Bitmap.js +1 -1
  50. package/views/2d/engine/flow/styles/Imagery.js +1 -1
  51. package/views/2d/engine/vectorTiles/SpriteMosaic.js +1 -1
  52. package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
  53. package/views/2d/engine/webgl/AttributeStoreView.js +1 -1
  54. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  55. package/views/2d/engine/webgl/Overlay.js +1 -1
  56. package/views/2d/engine/webgl/OverlayMultipoint.js +1 -1
  57. package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
  58. package/views/2d/engine/webgl/VideoScreenRenderer.js +1 -1
  59. package/views/2d/engine/webgl/animations/store/AnimationStore.js +1 -1
  60. package/views/2d/engine/webgl/collisions/LabelStore.js +1 -1
  61. package/views/2d/engine/webgl/effects/highlight/HighlightGradient.js +1 -1
  62. package/views/2d/engine/webgl/shaderGraph/techniques/TextureStatisticsTechnique.js +1 -1
  63. package/views/2d/engine/webgl/shaderGraph/techniques/blend/BlendTechnique.js +1 -1
  64. package/views/2d/engine/webgl/shaderGraph/techniques/colorize/ColorizeTechnique.js +1 -1
  65. package/views/2d/engine/webgl/shaderGraph/techniques/dotDensity/DotDensityResources.js +1 -1
  66. package/views/2d/engine/webgl/shaderGraph/techniques/drop-shadow/DropShadowTechnique.js +1 -1
  67. package/views/2d/engine/webgl/shaderGraph/techniques/heatmap/HeatmapResources.js +1 -1
  68. package/views/2d/engine/webgl/shaderGraph/techniques/magnifier/MagnifierTechnique.js +1 -1
  69. package/views/2d/engine/webgl/shaderGraph/techniques/opacity/OpacityTechnique.js +1 -1
  70. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterColorizerTechnique.js +1 -1
  71. package/views/2d/engine/webgl/shaderGraph/techniques/raster/RasterHighlightTechnique.js +1 -1
  72. package/views/2d/engine/webgl/shaderGraph/techniques/raster/processor/textureUtils.js +1 -1
  73. package/views/2d/engine/webgl/shaderGraph/techniques/tile/TileDebugInfoTexture.js +1 -1
  74. package/views/2d/engine/webgl/textureUtils.js +1 -1
  75. package/views/2d/layers/LayerView2D.js +1 -1
  76. package/views/2d/webglDeps.js +1 -1
  77. package/views/3d/GroundView3D.js +1 -1
  78. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  79. package/views/3d/analysis/LineOfSight/placementUtils.js +1 -1
  80. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  81. package/views/3d/input/SceneInputManager.js +1 -1
  82. package/views/3d/interactive/Manipulator3D.js +1 -1
  83. package/views/3d/interactive/editingTools/draw/DrawGraphicTool3D.js +1 -1
  84. package/views/3d/interactive/editingTools/originGeometryVisualElementUtils.js +1 -1
  85. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  86. package/views/3d/layers/I3SMeshView3D.js +1 -1
  87. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  88. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  89. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  90. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  91. package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
  92. package/views/3d/layers/support/Tiles3DBVH.js +1 -1
  93. package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
  94. package/views/3d/support/engineContent/line.js +1 -1
  95. package/views/3d/support/engineContent/marker.js +1 -1
  96. package/views/3d/support/flow/StreamlineResources3D.js +1 -1
  97. package/views/3d/support/flow/StreamlineResources3DOverlay.js +1 -1
  98. package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
  99. package/views/3d/support/flow/geometryUtils.js +1 -1
  100. package/views/3d/support/gaussianSplatting/GaussianSplatFadeHelper.js +1 -1
  101. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  102. package/views/3d/support/gaussianSplatting/GaussianSplatOrderTexture.js +1 -1
  103. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  104. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  105. package/views/3d/support/gaussianSplatting/GaussianTileBuilder.js +2 -0
  106. package/views/3d/support/gaussianSplatting/formatConstants.js +2 -0
  107. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  108. package/views/3d/support/pointsOfInterest/StableSurfaceCenter.js +1 -1
  109. package/views/3d/support/pointsOfInterest/SurfaceGeometryUpdates.js +1 -1
  110. package/views/3d/terrain/OverlayRenderer.js +1 -1
  111. package/views/3d/terrain/TerrainRenderer.js +1 -1
  112. package/views/3d/terrain/TerrainSurface.js +1 -1
  113. package/views/3d/terrain/TileCompositor.js +1 -1
  114. package/views/3d/terrain/TileRenderer.js +1 -1
  115. package/views/3d/webgl/RenderNode.d.ts +1 -1
  116. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  117. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  118. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  119. package/views/3d/webgl-engine/core/shaderLibrary/hud/HUD.glsl.js +1 -1
  120. package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatUnpacking.glsl.js +15 -11
  121. package/views/3d/webgl-engine/effects/atmosphere/LocalAtmosphere.js +1 -1
  122. package/views/3d/webgl-engine/effects/atmosphere/MarsAtmosphere.js +1 -1
  123. package/views/3d/webgl-engine/effects/clouds/CloudsRenderer.js +1 -1
  124. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  125. package/views/3d/webgl-engine/effects/magnifier/Magnifier.js +1 -1
  126. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  127. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  128. package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
  129. package/views/3d/webgl-engine/lib/AttributeView.js +1 -1
  130. package/views/3d/webgl-engine/lib/BasisUtil.js +1 -1
  131. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  132. package/views/3d/webgl-engine/lib/DDSUtil.js +1 -1
  133. package/views/3d/webgl-engine/lib/DrapedHeatmapRenderer.js +1 -1
  134. package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
  135. package/views/3d/webgl-engine/lib/GaussianSplatRenderUtils.js +1 -1
  136. package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
  137. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  138. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  139. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +1 -1
  140. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBufferView.js +1 -1
  141. package/views/3d/webgl-engine/lib/VerticesView.js +2 -0
  142. package/views/3d/webgl-engine/lib/attributeViewUtils.js +1 -1
  143. package/views/3d/webgl-engine/lib/edgeRendering/strokes.js +1 -1
  144. package/views/3d/webgl-engine/lib/glUtil3D.js +1 -1
  145. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  146. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  147. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  148. package/views/3d/webgl-engine/materials/internal/WaterTextureRepository.js +1 -1
  149. package/views/3d/webgl-engine/materials/internal/lineMarkerBufferUtils.js +2 -0
  150. package/views/3d/webgl-engine/materials/internal/ribbonLineBufferUtils.js +2 -0
  151. package/views/3d/webgl-engine/materials/renderers/VaoRenderer.js +1 -1
  152. package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
  153. package/views/draw/DrawTool.js +1 -1
  154. package/views/draw/support/ManagedTooltipField.js +1 -1
  155. package/views/support/TextureCompressionHelper.js +1 -1
  156. package/views/support/imageReprojection.js +1 -1
  157. package/views/webgl/FramebufferObject.js +1 -1
  158. package/views/webgl/RenderingContext.js +1 -1
  159. package/views/webgl/Texture.js +1 -1
  160. package/views/webgl/rasterUtils.js +1 -1
  161. package/views/webgl/testSVGPremultipliedAlpha.js +1 -1
  162. package/views/webgl/textureUtils.js +1 -1
  163. package/widgets/OrientedImageryViewer/navigation/NavigationManager.js +1 -1
  164. package/widgets/OrientedImageryViewer/navigation/queries.js +1 -1
  165. package/widgets/OrientedImageryViewer/navigation/utils.js +1 -1
  166. package/widgets/OrientedImageryViewer.js +2 -2
  167. package/widgets/ScaleRangeSlider/types.d.ts +3 -3
  168. package/assets/esri/core/workers/chunks/039d9bc5b5015012f811.js +0 -1
  169. package/assets/esri/core/workers/chunks/08140725277de5d2e41a.js +0 -1
  170. package/assets/esri/core/workers/chunks/16cda273927ab0a39544.js +0 -1
  171. package/assets/esri/core/workers/chunks/29c610ce1c81ebb84a6b.js +0 -1
  172. package/assets/esri/core/workers/chunks/3223f9fbc76ba9ef8d13.js +0 -1
  173. package/assets/esri/core/workers/chunks/3fdcc383bbd9cf0d274c.js +0 -1
  174. package/assets/esri/core/workers/chunks/46c290108a90518ef695.js +0 -1
  175. package/assets/esri/core/workers/chunks/48b8b57f559a53c6c513.js +0 -1
  176. package/assets/esri/core/workers/chunks/4a979fce1c971b614a18.js +0 -1
  177. package/assets/esri/core/workers/chunks/5bd1414220e42cb8ebcf.js +0 -1
  178. package/assets/esri/core/workers/chunks/5d781c2c6204cffffd0d.js +0 -1
  179. package/assets/esri/core/workers/chunks/723df53cfa0189837d01.js +0 -1
  180. package/assets/esri/core/workers/chunks/7400b8c454b47ee4fb3c.js +0 -1
  181. package/assets/esri/core/workers/chunks/7af4edc6e87d27b9d467.js +0 -1
  182. package/assets/esri/core/workers/chunks/990e96139b5a1dccb061.js +0 -1
  183. package/assets/esri/core/workers/chunks/a607541959169741a943.js +0 -1
  184. package/assets/esri/core/workers/chunks/aa779896fd9e5c341349.js +0 -1
  185. package/assets/esri/core/workers/chunks/c131e0dd180a4c10e12e.js +0 -1
  186. package/assets/esri/core/workers/chunks/f3b4159c0722df8ffe13.js +0 -1
  187. package/assets/esri/core/workers/chunks/f75eec2cbc541eec9712.js +0 -1
  188. package/views/3d/webgl-engine/lib/GaussianSplatPrepassDepthRenderer.js +0 -2
@@ -85,6 +85,12 @@ export interface LivestreamStatus {
85
85
  * @since 5.0
86
86
  */
87
87
  liveCurrentTime?: number | null;
88
+ /**
89
+ * The live tolerance of the livestream in seconds.
90
+ *
91
+ * @since 6.0
92
+ */
93
+ liveTolerance?: number | null;
88
94
  /**
89
95
  * The live window of the livestream in seconds.
90
96
  *
@@ -109,6 +115,12 @@ export interface LivestreamStatus {
109
115
  * @since 5.0
110
116
  */
111
117
  seekableStart?: number | null;
118
+ /**
119
+ * The target live delay of the livestream in seconds.
120
+ *
121
+ * @since 6.0
122
+ */
123
+ targetLiveDelay?: number | null;
112
124
  }
113
125
 
114
126
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "6.0.0-next.35",
3
+ "version": "6.0.0-next.37",
4
4
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
5
5
  "keywords": [
6
6
  "ArcGIS",
@@ -20,13 +20,13 @@
20
20
  "license": "SEE LICENSE IN LICENSE.md",
21
21
  "dependencies": {
22
22
  "@amcharts/amcharts5": "~5.21.5",
23
- "@arcgis/toolkit": "6.0.0-next.35",
23
+ "@arcgis/toolkit": "6.0.0-next.37",
24
24
  "@esri/arcgis-html-sanitizer": "~4.2.0",
25
25
  "@esri/calcite-components": "^5.2.1",
26
26
  "@vaadin/grid": "~25.3.5",
27
27
  "@zip.js/zip.js": "~2.24.0",
28
28
  "luxon": "~3.7.2",
29
- "marked": "~18.1.2",
29
+ "marked": "~18.2.0",
30
30
  "tslib": "^2.8.1"
31
31
  }
32
32
  }
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isSome as e}from"../core/arrayUtils.js";import{clone as t}from"../core/lang.js";import{offsetDate as n}from"../core/timeUtils.js";import r from"../rest/support/StatisticDefinition.js";import i from"../time/TimeExtent.js";import{isWebMap as a}from"../webmap/utils.js";import{isWebScene as o}from"../webscene/utils.js";function s(e){return e.timeInfo!==void 0}async function c(t,n){if(!t.timeInfo||!t.timeInfo.startField&&!t.timeInfo.endField)return null;let{startField:a,endField:o}=t.timeInfo,s=t.createQuery();s.outStatistics=[],a&&s.outStatistics.push(new r({onStatisticField:a,outStatisticFieldName:`minStart`,statisticType:`min`}),new r({onStatisticField:a,outStatisticFieldName:`maxStart`,statisticType:`max`})),o&&s.outStatistics.push(new r({onStatisticField:o,outStatisticFieldName:`minEnd`,statisticType:`min`}),new r({onStatisticField:o,outStatisticFieldName:`maxEnd`,statisticType:`max`}));let{features:c}=await t.queryFeatures(s,{signal:n}),l=c.at(0),u=[l?.getAttribute(`minStart`),l?.getAttribute(`maxStart`),l?.getAttribute(`minEnd`),l?.getAttribute(`maxEnd`)].filter(e).map(e=>typeof e==`string`?Date.parse(e):e);if(!u.length)return null;let d=new Date(Math.min(...u)),f=new Date(Math.max(...u)),p=new i({start:d,end:f}),{visibilityTimeExtent:m}=t;return p?.intersection(m)??m}async function l(e,t){return e.widgets?.timeSlider?.fullTimeExtent??f(e.allLayers,t)}function u(e){let t=e.numThumbs??2,n=e.currentTimeExtent;if(n){let{start:e,end:r}=n;return e!=null&&r!=null&&e.getTime()===r.getTime()?`instant`:t===2?`time-window`:e==null||e.getTime()===0?`cumulative-from-start`:`cumulative-from-end`}return t===2?`time-window`:`cumulative-from-start`}function d(e){let{numStops:n,stopInterval:r,stops:i}=e;return i?{dates:t(i)}:r?{interval:r.clone()}:{count:n??5}}async function f(t,n){if(t.length===0)return i.allTime;await Promise.all(t.map(e=>e.load({signal:n})));let r=t.filter(s),a=t.filter(e=>!s(e)&&e.visibilityTimeExtent!=null);if(r.length===0&&a.length===0)return i.allTime;let o=[],l=[],u=[];for(let e of r)e.type===`feature`&&h(e)?o.push(e):(e.type===`feature`||e.type===`map-image`)&&e.timeInfo?.hasLiveData?l.push(e):u.push(e);let d=e=>e==null||e.isAllTime,f=[...u.map(e=>{let t=e.timeInfo?.fullTimeExtent,{visibilityTimeExtent:n}=e;return t?.intersection(n)??n}),...a.map(e=>e.visibilityTimeExtent)];if(f.some(d))return i.allTime;let p=l.map(async e=>{let t=(await e.fetchRecomputedExtents({signal:n}))?.timeExtent??e.timeInfo?.fullTimeExtent,{visibilityTimeExtent:r}=e;return t?.intersection(r)??r}),m=(await Promise.allSettled(p)).map(e=>e.status===`fulfilled`?e.value:null);if(m.some(d))return i.allTime;let g=o.map(e=>c(e,n)),_=(await Promise.allSettled(g)).filter(e=>e.status===`fulfilled`).map(e=>e.value),v=[...m,...f,..._].filter(e);return v.length===0?i.allTime:v.reduce((e,t)=>e.union(t))}function p(e,t){let n=e.currentTimeExtent;if(!n)return null;let{start:r,end:a}=n,o=r??a??null;switch(t){case`time-window`:return new i({start:r,end:a});case`cumulative-from-start`:return new i({start:null,end:o});case`cumulative-from-end`:return new i({start:o,end:null});case`instant`:return new i({start:o,end:o})}}async function m(e,t){if(!(a(e)||o(e)))return null;await e.load({signal:t});let n=e?.widgets?.timeSlider;if(!n)return null;let r=await l(e,t),{loop:i}=n,s=u(n);return{fullTimeExtent:r,loop:i,mode:s,playRate:n.stopDelay??2e3,stops:d(n),timeExtent:p(n,s)}}function h(e){if(!e.url)return!1;let t=e.timeInfo,n=e.getAtOrigin(`timeInfo`,`service`);return n?!(!t||t===n||(t.startField===n.startField||!t.startField&&!n.startField)&&(t.endField===n.endField||!t.endField&&!n.endField)):!!t}function g(e){if(!e)return e;let{start:t,end:r}=e;return new i({start:t==null?t:n(t,-t.getTimezoneOffset(),`minutes`),end:r==null?r:n(r,-r.getTimezoneOffset(),`minutes`)})}function _(e){if(!e)return e;let{start:t,end:r}=e;return new i({start:t==null?t:n(t,t.getTimezoneOffset(),`minutes`),end:r==null?r:n(r,r.getTimezoneOffset(),`minutes`)})}export{c as fetchTimeExtent,f as getTimeExtentFromLayers,m as getTimeSliderSettingsFromWebDocument,h as requireFetchTimeExtent,_ as toLocalTimeExtent,g as toUTCTimeExtent};
2
+ import{isSome as e}from"../core/arrayUtils.js";import{clone as t}from"../core/lang.js";import{offsetDate as n}from"../core/timeUtils.js";import r from"../rest/support/StatisticDefinition.js";import i from"../time/TimeExtent.js";import{isWebMap as a}from"../webmap/utils.js";import{isWebScene as o}from"../webscene/utils.js";function s(e){return e.timeInfo!==void 0}async function c(t,n){if(!t.timeInfo||!t.timeInfo.startField&&!t.timeInfo.endField)return null;let{startField:a,endField:o}=t.timeInfo,s=t.createQuery();s.outStatistics=[],a&&s.outStatistics.push(new r({onStatisticField:a,outStatisticFieldName:`minStart`,statisticType:`min`}),new r({onStatisticField:a,outStatisticFieldName:`maxStart`,statisticType:`max`})),o&&s.outStatistics.push(new r({onStatisticField:o,outStatisticFieldName:`minEnd`,statisticType:`min`}),new r({onStatisticField:o,outStatisticFieldName:`maxEnd`,statisticType:`max`}));let{features:c}=await t.queryFeatures(s,{signal:n}),l=c.at(0),u=[l?.getAttribute(`minStart`),l?.getAttribute(`maxStart`),l?.getAttribute(`minEnd`),l?.getAttribute(`maxEnd`)].filter(e).map(e=>typeof e==`string`?Date.parse(e):e);if(!u.length)return null;let d=new Date(Math.min(...u)),f=new Date(Math.max(...u)),p=new i({start:d,end:f}),{visibilityTimeExtent:m}=t;return p?.intersection(m)??m}async function l(e,t){return e.widgets?.timeSlider?.fullTimeExtent??f(e.allLayers,t)}function u(e){let t=e.numThumbs??2,n=e.currentTimeExtent;if(n){let{start:e,end:r}=n;return e!=null&&r!=null&&e.getTime()===r.getTime()?`instant`:t===2?`time-window`:e==null||e.getTime()===0?`cumulative-from-start`:`cumulative-from-end`}return t===2?`time-window`:`cumulative-from-start`}function d(e){let{numStops:n,stopInterval:r,stops:i}=e;return i?{dates:t(i)}:r?{interval:r.clone()}:{count:n??5}}async function f(t,n){if(t.length===0)return i.allTime;await Promise.all(t.map(e=>e.load({signal:n})));let r=t.filter(s),a=t.filter(e=>!s(e)&&e.visibilityTimeExtent!=null);if(r.length===0&&a.length===0)return i.allTime;let o=[],l=[],u=[];for(let e of r)(e.type===`feature`||e.type===`scene`)&&h(e)?o.push(e):(e.type===`feature`||e.type===`map-image`)&&e.timeInfo?.hasLiveData?l.push(e):u.push(e);let d=e=>e==null||e.isAllTime,f=[...u.map(e=>{let t=e.timeInfo?.fullTimeExtent,{visibilityTimeExtent:n}=e;return t?.intersection(n)??n}),...a.map(e=>e.visibilityTimeExtent)];if(f.some(d))return i.allTime;let p=l.map(async e=>{let t=(await e.fetchRecomputedExtents({signal:n}))?.timeExtent??e.timeInfo?.fullTimeExtent,{visibilityTimeExtent:r}=e;return t?.intersection(r)??r}),m=(await Promise.allSettled(p)).map(e=>e.status===`fulfilled`?e.value:null);if(m.some(d))return i.allTime;let g=o.map(e=>c(e,n)),_=(await Promise.allSettled(g)).filter(e=>e.status===`fulfilled`).map(e=>e.value),v=[...m,...f,..._].filter(e);return v.length===0?i.allTime:v.reduce((e,t)=>e.union(t))}function p(e,t){let n=e.currentTimeExtent;if(!n)return null;let{start:r,end:a}=n,o=r??a??null;switch(t){case`time-window`:return new i({start:r,end:a});case`cumulative-from-start`:return new i({start:null,end:o});case`cumulative-from-end`:return new i({start:o,end:null});case`instant`:return new i({start:o,end:o})}}async function m(e,t){if(!(a(e)||o(e)))return null;await e.load({signal:t});let n=e?.widgets?.timeSlider;if(!n)return null;let r=await l(e,t),{loop:i}=n,s=u(n);return{fullTimeExtent:r,loop:i,mode:s,playRate:n.stopDelay??2e3,stops:d(n),timeExtent:p(n,s)}}function h(e){if(!e.url)return!1;let t=e.timeInfo,n=e.getAtOrigin(`timeInfo`,`service`);return n?!(!t||t===n||(t.startField===n.startField||!t.startField&&!n.startField)&&(t.endField===n.endField||!t.endField&&!n.endField)):!!t}function g(e){if(!e)return e;let{start:t,end:r}=e;return new i({start:t==null?t:n(t,-t.getTimezoneOffset(),`minutes`),end:r==null?r:n(r,-r.getTimezoneOffset(),`minutes`)})}function _(e){if(!e)return e;let{start:t,end:r}=e;return new i({start:t==null?t:n(t,t.getTimezoneOffset(),`minutes`),end:r==null?r:n(r,r.getTimezoneOffset(),`minutes`)})}export{c as fetchTimeExtent,f as getTimeExtentFromLayers,m as getTimeSliderSettingsFromWebDocument,h as requireFetchTimeExtent,_ as toLocalTimeExtent,g as toUTCTimeExtent};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{onAbortOrThrow as e,throwIfNotAbortError as t}from"../../../core/promiseUtils.js";import{identity as n,translate as r,rotate as i,scaleByVec2 as a}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as s}from"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{DisplayObject as c}from"./DisplayObject.js";import l from"./ImageryBitmapSource.js";import{SizedPixelFormat as u}from"../../webgl/enums.js";import d from"../../webgl/Texture.js";import{TextureDescriptor as f}from"../../webgl/TextureDescriptor.js";function p(e){e instanceof ImageBitmap&&e.close()}function m(e){return e&&`render`in e}function h(e){let t=document.createElement(`canvas`);return t.width=e.width,t.height=e.height,e.render(t.getContext(`2d`)),t}function g(e){return m(e)?e instanceof l?e.getRenderedRasterPixels()?.renderedRasterPixels:h(e):e}class _ extends c{constructor(e=null,t=!1){super(),this.blendFunction=`standard`,this._sourceWidth=0,this._sourceHeight=0,this._textureInvalidated=!1,this.stencilRef=0,this.coordScale=[1,1],this._height=void 0,this.pixelRatio=1,this.resolution=0,this.rotation=0,this._source=null,this._texture=null,this._width=void 0,this.x=0,this.y=0,this.immutable=t,this.source=e,this.requestRender=this.requestRender.bind(this)}destroy(){super.destroy(),this._texture&&=(this._texture.dispose(),null),this._source&&p(this._source),this._uploadStatus!=null&&(this._uploadStatus.controller.abort(),this._uploadStatus=null)}get isSourceScaled(){return this.width!==this._sourceWidth||this.height!==this._sourceHeight}get height(){return this._height===void 0?this._sourceHeight:this._height}set height(e){this._height=e}get source(){return this._source}set source(e){(e!=null||this._source!=null)&&(this._source&&p(this._source),this._source=e,this.invalidateTexture(),this.requestRender())}get texture(){return this._texture}get width(){return this._width===void 0?this._sourceWidth:this._width}set width(e){this._width=e}beforeRender(e){super.beforeRender(e),this.updateTexture(e)}async setSourceAsync(t,n){this._uploadStatus!=null&&this._uploadStatus.controller.abort();let r=new AbortController,i=Promise.withResolvers();return e(n,()=>r.abort()),e(r,e=>i.reject(e)),this._uploadStatus={controller:r,resolver:i},this.source=t,i.promise}invalidateTexture(){this._textureInvalidated||(this._textureInvalidated=!0,this._source instanceof HTMLImageElement?(this._sourceHeight=this._source.naturalHeight,this._sourceWidth=this._source.naturalWidth):this._source&&(this._sourceHeight=this._source.height,this._sourceWidth=this._source.width))}transitionStep(e,t){e>=64&&(this.fadeTransitionEnabled=!1),super.transitionStep(e,t)}setTransform(e){let t=n(this.transforms.localToScreenMat3),[o,c]=e.toScreenNoRotation([0,0],[this.x,this.y]),l=this.resolution/this.pixelRatio/e.resolution,u=l*this.width,d=l*this.height,f=Math.PI*this.rotation/180;r(t,t,s(o,c)),r(t,t,s(u/2,d/2)),i(t,t,-f),r(t,t,s(-u/2,-d/2)),a(t,t,s(u,d))}setSamplingProfile(e){this._texture&&(e.mips&&!this._texture.descriptor.hasMipmap&&this._texture.generateMipmap(),this._texture.setSamplingMode(e.samplingMode))}bind(e,t){this._texture&&e.bindTexture(this._texture,t)}async updateTexture({context:e,painter:n}){if(!this._textureInvalidated)return;if(this._textureInvalidated=!1,this._texture||=this._createTexture(e),!this.source){this._texture.setData(null);return}this._texture.resize(this._sourceWidth,this._sourceHeight);let r=g(this.source);try{if(this._uploadStatus!=null){let{controller:e,resolver:t}=this._uploadStatus,i={signal:e.signal},{width:a,height:o}=this,s=this._texture;await n.textureUploadManager.enqueueTextureUpdate({data:r,texture:s,width:a,height:o},i),t.resolve(),this._uploadStatus=null}else this._texture.setData(r);this.ready()}catch(e){t(e)}}onDetach(){this.destroy()}_createTransforms(){return{displayViewScreenMat3:o(),localToScreenMat3:o()}}_createTexture(e){let t=this.immutable,n=new f(this._sourceWidth,this._sourceHeight);return n.internalFormat=t?u.RGBA8:6408,n.wrapMode=33071,n.isImmutable=t,new d(e,n)}}export{_ as Bitmap,m as isImageSource,h as rasterize};
2
+ import{onAbortOrThrow as e,throwIfNotAbortError as t}from"../../../core/promiseUtils.js";import{identity as n,translate as r,rotate as i,scaleByVec2 as a}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{fromValues as s}from"../../../core/libs/gl-matrix-2/factories/vec2f32.js";import{DisplayObject as c}from"./DisplayObject.js";import l from"./ImageryBitmapSource.js";import{SizedPixelFormat as u}from"../../webgl/enums.js";import{Texture as d}from"../../webgl/Texture.js";import{TextureDescriptor as f}from"../../webgl/TextureDescriptor.js";function p(e){e instanceof ImageBitmap&&e.close()}function m(e){return e&&`render`in e}function h(e){let t=document.createElement(`canvas`);return t.width=e.width,t.height=e.height,e.render(t.getContext(`2d`)),t}function g(e){return m(e)?e instanceof l?e.getRenderedRasterPixels()?.renderedRasterPixels:h(e):e}class _ extends c{constructor(e=null,t=!1){super(),this.blendFunction=`standard`,this._sourceWidth=0,this._sourceHeight=0,this._textureInvalidated=!1,this.stencilRef=0,this.coordScale=[1,1],this._height=void 0,this.pixelRatio=1,this.resolution=0,this.rotation=0,this._source=null,this._texture=null,this._width=void 0,this.x=0,this.y=0,this.immutable=t,this.source=e,this.requestRender=this.requestRender.bind(this)}destroy(){super.destroy(),this._texture&&=(this._texture.dispose(),null),this._source&&p(this._source),this._uploadStatus!=null&&(this._uploadStatus.controller.abort(),this._uploadStatus=null)}get isSourceScaled(){return this.width!==this._sourceWidth||this.height!==this._sourceHeight}get height(){return this._height===void 0?this._sourceHeight:this._height}set height(e){this._height=e}get source(){return this._source}set source(e){(e!=null||this._source!=null)&&(this._source&&p(this._source),this._source=e,this.invalidateTexture(),this.requestRender())}get texture(){return this._texture}get width(){return this._width===void 0?this._sourceWidth:this._width}set width(e){this._width=e}beforeRender(e){super.beforeRender(e),this.updateTexture(e)}async setSourceAsync(t,n){this._uploadStatus!=null&&this._uploadStatus.controller.abort();let r=new AbortController,i=Promise.withResolvers();return e(n,()=>r.abort()),e(r,e=>i.reject(e)),this._uploadStatus={controller:r,resolver:i},this.source=t,i.promise}invalidateTexture(){this._textureInvalidated||(this._textureInvalidated=!0,this._source instanceof HTMLImageElement?(this._sourceHeight=this._source.naturalHeight,this._sourceWidth=this._source.naturalWidth):this._source&&(this._sourceHeight=this._source.height,this._sourceWidth=this._source.width))}transitionStep(e,t){e>=64&&(this.fadeTransitionEnabled=!1),super.transitionStep(e,t)}setTransform(e){let t=n(this.transforms.localToScreenMat3),[o,c]=e.toScreenNoRotation([0,0],[this.x,this.y]),l=this.resolution/this.pixelRatio/e.resolution,u=l*this.width,d=l*this.height,f=Math.PI*this.rotation/180;r(t,t,s(o,c)),r(t,t,s(u/2,d/2)),i(t,t,-f),r(t,t,s(-u/2,-d/2)),a(t,t,s(u,d))}setSamplingProfile(e){this._texture&&(e.mips&&!this._texture.descriptor.hasMipmap&&this._texture.generateMipmap(),this._texture.setSamplingMode(e.samplingMode))}bind(e,t){this._texture&&e.bindTexture(this._texture,t)}async updateTexture({context:e,painter:n}){if(!this._textureInvalidated)return;if(this._textureInvalidated=!1,this._texture||=this._createTexture(e),!this.source){this._texture.setData(null);return}this._texture.resize(this._sourceWidth,this._sourceHeight);let r=g(this.source);try{if(this._uploadStatus!=null){let{controller:e,resolver:t}=this._uploadStatus,i={signal:e.signal},{width:a,height:o}=this,s=this._texture;await n.textureUploadManager.enqueueTextureUpdate({data:r,texture:s,width:a,height:o},i),t.resolve(),this._uploadStatus=null}else this._texture.setData(r);this.ready()}catch(e){t(e)}}onDetach(){this.destroy()}_createTransforms(){return{displayViewScreenMat3:o(),localToScreenMat3:o()}}_createTexture(e){let t=this.immutable,n=new f(this._sourceWidth,this._sourceHeight);return n.internalFormat=t?u.RGBA8:6408,n.wrapMode=33071,n.isImmutable=t,new d(e,n)}}export{_ as Bitmap,m as isImageSource,h as rasterize};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{throwIfAborted as e}from"../../../../../core/promiseUtils.js";import{timeExtentsEqual as t,getFlowFloatUniforms as n,getFlowColorUniforms as r}from"../utils.js";import{AFlowResources as i}from"./AFlowResources.js";import{Mesh as a}from"../../webgl/meshing/Mesh.js";import{FlowImageryShader as o}from"../../webgl/shaderGraph/techniques/shaders/flow/FlowImageryShader.js";import{PrimitiveType as s,DataType as c}from"../../../../webgl/enums.js";import l from"../../../../webgl/Texture.js";import{TextureDescriptor as u}from"../../../../webgl/TextureDescriptor.js";import{VertexElementDescriptor as d}from"../../../../webgl/VertexElementDescriptor.js";class f{constructor(e){this._params=e,this.supportsContinuation=!1,this.slideoutDuration=0,this.animated=!1}isCompatible(e){if(!(e instanceof f)||!t(this._params.timeExtent,e._params.timeExtent))return!1;let n=!0;return n&&=this._params.loadImagery===e._params.loadImagery,n&&=this._params.color.kind===e._params.color.kind,n&&=this._params.opacity.kind===e._params.opacity.kind,n}updateResource(e){e.update(this._params.color,this._params.opacity)}async load(t,n,r){let{extent:i,size:a}=t;e(r);let o=await this._params.loadImagery(i,a[0],a[1],this._params.timeExtent,r);return new m(o,t,[],o,{color:this._params.color,opacity:this._params.opacity})}}const p=[new d(`position`,2,c.UNSIGNED_SHORT,0,8),new d(`texcoord`,2,c.UNSIGNED_SHORT,4,8)];class m extends i{static{this._shader=new o}constructor(e,t,n,r,i){super(t,n,r),this._flowData=e,this._values=i,this.kind=`imagery`}attach(e){let{context:t}=e,{width:n,height:r}=this._flowData;this.mesh=new a(t,{vertex:{geometry:{data:new Uint16Array([0,0,0,1,n,0,1,1,0,r,0,0,n,r,1,0]),layout:p}},groups:[{primitive:s.TRIANGLE_STRIP}],parts:[{group:0,start:0,count:4}]});let i=1e6,o=-1e6;for(let e=0;e<r;e++)for(let t=0;t<n;t++)if(this._flowData.mask[e*n+t]!==0){let r=this._flowData.data[(e*n+t)*2],a=this._flowData.data[(e*n+t)*2+1],s=Math.sqrt(r*r+a*a);i=Math.min(i,s),o=Math.max(o,s)}let c=new Uint8Array(4*n*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++)if(this._flowData.mask[e*n+t]!==0){let r=this._flowData.data[(e*n+t)*2],a=this._flowData.data[(e*n+t)*2+1],s=(Math.sqrt(r*r+a*a)-i)/(o-i);c[(e*n+t)*4]=s*255,c[(e*n+t)*4+1]=0,c[(e*n+t)*4+2]=0,c[(e*n+t)*4+3]=255}else c[(e*n+t)*4]=0,c[(e*n+t)*4+1]=0,c[(e*n+t)*4+2]=0,c[(e*n+t)*4+3]=0;let d=new u(n,r);d.internalFormat=6408,d.wrapMode=33071,d.flipped=!0;let f=new l(t,d,c);this.texture=f,this.min=i,this.max=o,this._flowData=null}detach(){this.mesh.destroy(),this.texture.dispose()}get ready(){return!0}update(e,t){this._values={color:e,opacity:t}}getProgramSpec(e){return{shader:m._shader,uniforms:{transform:{localToScreenMat3:e.localToScreenMat3},state:{time:e.time,displayOpacity:e.displayOpacity,startTime:e.startTime,endTime:e.endTime},config:{min:this.min,max:this.max},color:r(this._values.color),opacity:n(this._values.opacity)},textures:{texture:{texture:this.texture,unit:0}},defines:{vvColor:this._values.color.kind===`ramp`,vvOpacity:this._values.opacity.kind===`ramp`},optionalAttributes:null}}}export{f as Imagery,m as ImageryResources};
2
+ import{throwIfAborted as e}from"../../../../../core/promiseUtils.js";import{timeExtentsEqual as t,getFlowFloatUniforms as n,getFlowColorUniforms as r}from"../utils.js";import{AFlowResources as i}from"./AFlowResources.js";import{Mesh as a}from"../../webgl/meshing/Mesh.js";import{FlowImageryShader as o}from"../../webgl/shaderGraph/techniques/shaders/flow/FlowImageryShader.js";import{PrimitiveType as s,DataType as c}from"../../../../webgl/enums.js";import{Texture as l}from"../../../../webgl/Texture.js";import{TextureDescriptor as u}from"../../../../webgl/TextureDescriptor.js";import{VertexElementDescriptor as d}from"../../../../webgl/VertexElementDescriptor.js";class f{constructor(e){this._params=e,this.supportsContinuation=!1,this.slideoutDuration=0,this.animated=!1}isCompatible(e){if(!(e instanceof f)||!t(this._params.timeExtent,e._params.timeExtent))return!1;let n=!0;return n&&=this._params.loadImagery===e._params.loadImagery,n&&=this._params.color.kind===e._params.color.kind,n&&=this._params.opacity.kind===e._params.opacity.kind,n}updateResource(e){e.update(this._params.color,this._params.opacity)}async load(t,n,r){let{extent:i,size:a}=t;e(r);let o=await this._params.loadImagery(i,a[0],a[1],this._params.timeExtent,r);return new m(o,t,[],o,{color:this._params.color,opacity:this._params.opacity})}}const p=[new d(`position`,2,c.UNSIGNED_SHORT,0,8),new d(`texcoord`,2,c.UNSIGNED_SHORT,4,8)];class m extends i{static{this._shader=new o}constructor(e,t,n,r,i){super(t,n,r),this._flowData=e,this._values=i,this.kind=`imagery`}attach(e){let{context:t}=e,{width:n,height:r}=this._flowData;this.mesh=new a(t,{vertex:{geometry:{data:new Uint16Array([0,0,0,1,n,0,1,1,0,r,0,0,n,r,1,0]),layout:p}},groups:[{primitive:s.TRIANGLE_STRIP}],parts:[{group:0,start:0,count:4}]});let i=1e6,o=-1e6;for(let e=0;e<r;e++)for(let t=0;t<n;t++)if(this._flowData.mask[e*n+t]!==0){let r=this._flowData.data[(e*n+t)*2],a=this._flowData.data[(e*n+t)*2+1],s=Math.sqrt(r*r+a*a);i=Math.min(i,s),o=Math.max(o,s)}let c=new Uint8Array(4*n*r);for(let e=0;e<r;e++)for(let t=0;t<n;t++)if(this._flowData.mask[e*n+t]!==0){let r=this._flowData.data[(e*n+t)*2],a=this._flowData.data[(e*n+t)*2+1],s=(Math.sqrt(r*r+a*a)-i)/(o-i);c[(e*n+t)*4]=s*255,c[(e*n+t)*4+1]=0,c[(e*n+t)*4+2]=0,c[(e*n+t)*4+3]=255}else c[(e*n+t)*4]=0,c[(e*n+t)*4+1]=0,c[(e*n+t)*4+2]=0,c[(e*n+t)*4+3]=0;let d=new u(n,r);d.internalFormat=6408,d.wrapMode=33071,d.flipped=!0;let f=new l(t,d,c);this.texture=f,this.min=i,this.max=o,this._flowData=null}detach(){this.mesh.destroy(),this.texture.dispose()}get ready(){return!0}update(e,t){this._values={color:e,opacity:t}}getProgramSpec(e){return{shader:m._shader,uniforms:{transform:{localToScreenMat3:e.localToScreenMat3},state:{time:e.time,displayOpacity:e.displayOpacity,startTime:e.startTime,endTime:e.endTime},config:{min:this.min,max:this.max},color:r(this._values.color),opacity:n(this._values.opacity)},textures:{texture:{texture:this.texture,unit:0}},defines:{vvColor:this._values.color.kind===`ramp`,vvOpacity:this._values.opacity.kind===`ramp`},optionalAttributes:null}}}export{f as Imagery,m as ImageryResources};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../../../../core/has.js";import{rasterizeDash as e}from"../../../../symbols/cim/rasterizingUtils.js";import{log2 as t}from"./GeometryUtils.js";import n from"../webgl/Rect.js";import r from"../webgl/RectangleBinPack.js";import i from"../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../webgl/TextureDescriptor.js";class o{constructor(e,t,n=0){this._mosaicPages=[],this._currentPage=0,this._maxItemSize=0,this._pageWidth=0,this._pageHeight=0,this._mosaicRects={},t<=0&&console.error(`Sprites mosaic defaultWidth and defaultHeight must be greater than zero!`),this._pageWidth=e,this._pageHeight=t,n>0&&(this._maxItemSize=n),this._binPack=new r(e-4,t-4),this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(this._pageWidth*this._pageHeight)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0})}destroy(){this.dispose()}dispose(){if(this._binPack=null,this._mosaicPages!==null){for(let e of this._mosaicPages){let t=e.texture;t&&t.dispose()}this._mosaicPages=null}}getWidth(e){return e<0||e>=this._mosaicPages.length?-1:this._mosaicPages[e].size[0]}getHeight(e){return e<0||e>=this._mosaicPages.length?-1:this._mosaicPages[e].size[1]}getPageSize(e){return e<0||e>=this._mosaicPages.length?null:this._mosaicPages[e].size}getTexture(e){return e<0||e>=this._mosaicPages.length?null:this._mosaicPages[e].texture||null}setSpriteSource(e){for(let e of this._mosaicPages)e.texture&&=(e.texture.dispose(),null),e.dirty=!0;if(this._mosaicPages.length===0){this._binPack=new r(this._pageWidth-4,this._pageHeight-4);let e=Math.floor(this._pageWidth)*Math.floor(this._pageHeight),t=new Uint32Array(e);for(let n=0;n<e;n++)t[n]=0;this._mosaicPages.push({mosaicsData:{type:`static`,data:t},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:null})}this._sprites=e}getSpriteItem(e,t=!1){let n=this._mosaicRects[e];if(n)return n;let r,i;if(e&&e.startsWith(`dasharray-`))[r,i]=this._rasterizeDash(e),t=!0;else{if(!this._sprites||this._sprites.loadStatus!==`loaded`)return null;r=this._sprites.getSpriteInfo(e)}if(!r?.width||!r.height||r.width<0||r.height<0)return null;let a=r.width,o=r.height,[s,c,l]=this._allocateImage(a,o);return s.width<=0?null:(this._copy(s,r,c,l,t,i),n={type:`sprite`,rect:s,width:a,height:o,sdf:r.sdf,simplePattern:!1,rasterizationScale:r.pixelRatio??1,samplingMode:`Linear`,page:c},this._mosaicRects[e]=n,n)}getSpriteItems(e){let t={};for(let n of e)t[n.name]=this.getSpriteItem(n.name,n.repeat);return t}getMosaicItemPosition(e,t){let n=this.getSpriteItem(e,t),r=n?.rect;if(!r)return null;r.width=n.width,r.height=n.height;let i=n.width,a=n.height;return{tl:[r.x+2,r.y+2],br:[r.x+2+i,r.y+2+a],page:n.page}}bind(e,t,n=0,r=0){if(n>=this._mosaicPages.length||n>=this._mosaicPages.length)return;let o=this._mosaicPages[n],s=o.texture;if(!s){let t=new a(o.size[0],o.size[1]);t.wrapMode=33071,s=new i(e,t),o.texture=s}if(s.setSamplingMode(t),e.bindTexture(s,r),o.dirty){let e=o.mosaicsData.data;s.setData(new Uint8Array(e.buffer))}o.dirty=!1}static _copyBits(e,t,n,r,i,a,o,s,c,l,u){let d=r*t+n,f=s*a+o;if(u){f-=a;for(let o=-1;o<=l;o++,d=((o+l)%l+r)*t+n,f+=a)for(let t=-1;t<=c;t++)i[f+t]=e[d+(t+c)%c]}else for(let n=0;n<l;n++){for(let t=0;t<c;t++)i[f+t]=e[d+t];d+=t,f+=a}}_copy(e,t,n,r,i,a){if(n>=this._mosaicPages.length||!a&&(!this._sprites||this._sprites.loadStatus!==`loaded`))return;let s=this._mosaicPages[n],c=s.mosaicsData.data,l=new Uint32Array(a?a.buffer:this._sprites.image.buffer),u=a?t.width:this._sprites.width;o._copyBits(l,u,t.x,t.y,c,r[0],e.x+2,e.y+2,t.width,t.height,i),s.dirty=!0}_allocateImage(e,i){e+=2,i+=2;let a=Math.max(e,i);if(this._maxItemSize&&this._maxItemSize<a){let r=2**Math.ceil(t(e)),a=2**Math.ceil(t(i)),o=new n(0,0,e,i);return this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(r*a)},size:[r,a],dirty:!0,texture:null}),[o,this._mosaicPages.length-1,[r,a]]}let o=e%4?4-e%4:4,s=i%4?4-i%4:4;o===1&&(o=5),s===1&&(s=5);let c=this._binPack.allocate(e+o,i+s);if(c.width<=0){let t=this._mosaicPages[this._currentPage];return t.dirty||(t.mosaicsData.data=null),this._currentPage=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(this._pageWidth*this._pageHeight)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:null}),this._binPack=new r(this._pageWidth-4,this._pageHeight-4),this._allocateImage(e,i)}return[c,this._currentPage,[this._pageWidth,this._pageHeight]]}_rasterizeDash(t){let n=t.match(/\[(.*?)\]/);if(!n)return null;let r=n[1].split(`,`).map(Number),i=t.slice(t.lastIndexOf(`-`)+1),[a,o,s]=e(r,i),c=new Uint8Array(a.buffer);return[{x:0,y:0,width:o,height:s,sdf:!0,pixelRatio:1},c]}}export{o as default};
2
+ import"../../../../core/has.js";import{rasterizeDash as e}from"../../../../symbols/cim/rasterizingUtils.js";import{log2 as t}from"./GeometryUtils.js";import n from"../webgl/Rect.js";import r from"../webgl/RectangleBinPack.js";import{Texture as i}from"../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../webgl/TextureDescriptor.js";class o{constructor(e,t,n=0){this._mosaicPages=[],this._currentPage=0,this._maxItemSize=0,this._pageWidth=0,this._pageHeight=0,this._mosaicRects={},t<=0&&console.error(`Sprites mosaic defaultWidth and defaultHeight must be greater than zero!`),this._pageWidth=e,this._pageHeight=t,n>0&&(this._maxItemSize=n),this._binPack=new r(e-4,t-4),this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(this._pageWidth*this._pageHeight)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0})}destroy(){this.dispose()}dispose(){if(this._binPack=null,this._mosaicPages!==null){for(let e of this._mosaicPages){let t=e.texture;t&&t.dispose()}this._mosaicPages=null}}getWidth(e){return e<0||e>=this._mosaicPages.length?-1:this._mosaicPages[e].size[0]}getHeight(e){return e<0||e>=this._mosaicPages.length?-1:this._mosaicPages[e].size[1]}getPageSize(e){return e<0||e>=this._mosaicPages.length?null:this._mosaicPages[e].size}getTexture(e){return e<0||e>=this._mosaicPages.length?null:this._mosaicPages[e].texture||null}setSpriteSource(e){for(let e of this._mosaicPages)e.texture&&=(e.texture.dispose(),null),e.dirty=!0;if(this._mosaicPages.length===0){this._binPack=new r(this._pageWidth-4,this._pageHeight-4);let e=Math.floor(this._pageWidth)*Math.floor(this._pageHeight),t=new Uint32Array(e);for(let n=0;n<e;n++)t[n]=0;this._mosaicPages.push({mosaicsData:{type:`static`,data:t},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:null})}this._sprites=e}getSpriteItem(e,t=!1){let n=this._mosaicRects[e];if(n)return n;let r,i;if(e&&e.startsWith(`dasharray-`))[r,i]=this._rasterizeDash(e),t=!0;else{if(!this._sprites||this._sprites.loadStatus!==`loaded`)return null;r=this._sprites.getSpriteInfo(e)}if(!r?.width||!r.height||r.width<0||r.height<0)return null;let a=r.width,o=r.height,[s,c,l]=this._allocateImage(a,o);return s.width<=0?null:(this._copy(s,r,c,l,t,i),n={type:`sprite`,rect:s,width:a,height:o,sdf:r.sdf,simplePattern:!1,rasterizationScale:r.pixelRatio??1,samplingMode:`Linear`,page:c},this._mosaicRects[e]=n,n)}getSpriteItems(e){let t={};for(let n of e)t[n.name]=this.getSpriteItem(n.name,n.repeat);return t}getMosaicItemPosition(e,t){let n=this.getSpriteItem(e,t),r=n?.rect;if(!r)return null;r.width=n.width,r.height=n.height;let i=n.width,a=n.height;return{tl:[r.x+2,r.y+2],br:[r.x+2+i,r.y+2+a],page:n.page}}bind(e,t,n=0,r=0){if(n>=this._mosaicPages.length||n>=this._mosaicPages.length)return;let o=this._mosaicPages[n],s=o.texture;if(!s){let t=new a(o.size[0],o.size[1]);t.wrapMode=33071,s=new i(e,t),o.texture=s}if(s.setSamplingMode(t),e.bindTexture(s,r),o.dirty){let e=o.mosaicsData.data;s.setData(new Uint8Array(e.buffer))}o.dirty=!1}static _copyBits(e,t,n,r,i,a,o,s,c,l,u){let d=r*t+n,f=s*a+o;if(u){f-=a;for(let o=-1;o<=l;o++,d=((o+l)%l+r)*t+n,f+=a)for(let t=-1;t<=c;t++)i[f+t]=e[d+(t+c)%c]}else for(let n=0;n<l;n++){for(let t=0;t<c;t++)i[f+t]=e[d+t];d+=t,f+=a}}_copy(e,t,n,r,i,a){if(n>=this._mosaicPages.length||!a&&(!this._sprites||this._sprites.loadStatus!==`loaded`))return;let s=this._mosaicPages[n],c=s.mosaicsData.data,l=new Uint32Array(a?a.buffer:this._sprites.image.buffer),u=a?t.width:this._sprites.width;o._copyBits(l,u,t.x,t.y,c,r[0],e.x+2,e.y+2,t.width,t.height,i),s.dirty=!0}_allocateImage(e,i){e+=2,i+=2;let a=Math.max(e,i);if(this._maxItemSize&&this._maxItemSize<a){let r=2**Math.ceil(t(e)),a=2**Math.ceil(t(i)),o=new n(0,0,e,i);return this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(r*a)},size:[r,a],dirty:!0,texture:null}),[o,this._mosaicPages.length-1,[r,a]]}let o=e%4?4-e%4:4,s=i%4?4-i%4:4;o===1&&(o=5),s===1&&(s=5);let c=this._binPack.allocate(e+o,i+s);if(c.width<=0){let t=this._mosaicPages[this._currentPage];return t.dirty||(t.mosaicsData.data=null),this._currentPage=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(this._pageWidth*this._pageHeight)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:null}),this._binPack=new r(this._pageWidth-4,this._pageHeight-4),this._allocateImage(e,i)}return[c,this._currentPage,[this._pageWidth,this._pageHeight]]}_rasterizeDash(t){let n=t.match(/\[(.*?)\]/);if(!n)return null;let r=n[1].split(`,`).map(Number),i=t.slice(t.lastIndexOf(`-`)+1),[a,o,s]=e(r,i),c=new Uint8Array(a.buffer);return[{x:0,y:0,width:o,height:s,sdf:!0,pixelRatio:1},c]}}export{o as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{RenderingDevice as e}from"../webgl/RenderingDevice.js";import{simplePipelineState as t}from"../webgl/shaderGraph/utils.js";import{VTLTechniquesRepo as n}from"../webgl/shaderGraph/techniques/vectorTiles/VTLTechniques.js";const r=1e-6;class i{constructor(t,r){this.spriteMosaic=t,this.glyphMosaic=r,this._vtlTechniques=new n,this._context=null,this._vtlTechniques.startup(),this._renderingDevice=new e}dispose(){this._vtlTechniques&&this._vtlTechniques.shutdown(this._context),this.spriteMosaic.dispose(),this._renderingDevice.dispose(),this._context=null}drawSymbols(e,t,n){this._context??=e.context;let i=n.layers;e.renderPass=`translucent`;let o=this._vtlTechniques.getTechnique(3);a[0]=t;for(let t=0;t<i.length;t++){let n=i[t];if(n.type!==3)continue;let s=n.getLayoutProperty(`visibility`);if(s&&s.getValue()===1)continue;let c=e.displayLevel;n.minzoom!==void 0&&n.minzoom>c+r||n.maxzoom!==void 0&&n.maxzoom<=c-r||(e.styleLayerUID=n.uid,e.styleLayer=n,o.render(e,{tiles:a}))}a[0]=null}drawBackground(e,t,n){if(n.backgroundBucketIds.length===0)return;this._context??=e.context;let{displayLevel:i}=e;this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:`composite`},stencil:!1,depth:{write:!1,test:519}}),e.renderPass=`background`;let o=this._vtlTechniques.getTechnique(0);a[0]=t,n.backgroundBucketIds.forEach(t=>{let s=n.getLayerById(t);if(s.type!==0)return;let c=s.getLayoutProperty(`visibility`);c&&c.getValue()===1||s.minzoom!==void 0&&s.minzoom>i+r||s.maxzoom!==void 0&&s.maxzoom<=i-r||(e.styleLayerUID=s.uid,e.styleLayer=s,o.render(e,{tiles:a}))}),a[0]=null}drawTile(e,n,r,i){this._context??=e.context;let a=r.layers,o=i?e=>i!==e.type||!n.layerData.has(e.uid):e=>!n.layerData.has(e.uid),s=a.filter(e=>!(o(e)||e.getLayoutProperty(`visibility`)?.getValue()===1)),{context:c}=e,l=c.getPipelineState(),{depthWrite:u}=l;n.disposeLayerData();let d=0,f=1;u?.zNear!==void 0&&u.zFar!==void 0&&(d=u.zNear,f=u.zFar),this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:`none`},stencil:!1,depth:{write:{zNear:d,zFar:f},test:515}}),e.renderPass=`opaque`;for(let t=s.length-1;t>=0;--t)this._renderStyleLayer(s[t],e,n);this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:`composite`},stencil:!1,depth:{write:!1,test:515}}),e.renderPass=`translucent`,s.forEach(t=>this._renderStyleLayer(t,e,n)),this._renderingDevice.setPipelineState(t),c.setPipelineState(l)}setShader(e){return this._renderingDevice.setShader(e)}setPipelineState(e){return this._renderingDevice.setPipelineState(e)}getPipelineState(){return this._renderingDevice.getPipelineState()}submitDraw(e,t,n){return this._renderingDevice.submitDraw(e,t,n)}submitDrawMesh(e,t,n,r){this._renderingDevice.submitDrawMesh(e,t,n,r)}submitDrawMeshUntyped(e,t,n,r){this._renderingDevice.submitDrawMeshUntyped(e,t,n,r)}updatePipelineState(e){return this._renderingDevice.updatePipelineState(e)}setStencilRef(e,t){return this._renderingDevice.setStencilRef(e,t)}_renderStyleLayer(e,t,n){let{renderPass:i}=t,o;switch(e.type){case 0:if(i!==`background`)return;o=this._vtlTechniques.getTechnique(0);break;case 1:if(i!==`opaque`&&i!==`translucent`)return;o=this._vtlTechniques.getTechnique(1);break;case 2:if(i!==`translucent`)return;o=this._vtlTechniques.getTechnique(2);break;case 4:if(i!==`translucent`)return;o=this._vtlTechniques.getTechnique(4);break;case 3:if(i!==`translucent`)return;o=this._vtlTechniques.getTechnique(3)}let{displayLevel:s}=t,{minzoom:c,maxzoom:l}=e;if(c!==void 0&&c>s+r||l!==void 0&&l<=s-r||!o)return;let u=this._renderingDevice.getPipelineState();e.type===3&&this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:`composite`},stencil:!1,depth:!1}),t.styleLayerUID=e.uid,t.styleLayer=e,a[0]=n,o.render(t,{tiles:a}),a[0]=null,e.type===3&&this._renderingDevice.setPipelineState(u)}}const a=[null];export{i as default};
2
+ import{RenderingDevice as e}from"../webgl/RenderingDevice.js";import{simplePipelineState as t}from"../webgl/shaderGraph/utils.js";import{VTLTechniquesRepo as n}from"../webgl/shaderGraph/techniques/vectorTiles/VTLTechniques.js";const r=1e-6;class i{constructor(t,r){this.spriteMosaic=t,this.glyphMosaic=r,this._vtlTechniques=new n,this._context=null,this._vtlTechniques.startup(),this._renderingDevice=new e}dispose(){this._vtlTechniques&&this._vtlTechniques.shutdown(this._context),this.spriteMosaic.dispose(),this._renderingDevice.dispose(),this._context=null}drawSymbols(e,t,n){this._context??=e.context;let i=n.layers;e.renderPass=`translucent`;let o=this._vtlTechniques.getTechnique(3);a[0]=t;for(let n=0;n<i.length;n++){let s=i[n];if(s.type!==3||!t.layerData.has(s.uid))continue;let c=s.getLayoutProperty(`visibility`);if(c&&c.getValue()===1)continue;let l=e.displayLevel;s.minzoom!==void 0&&s.minzoom>l+r||s.maxzoom!==void 0&&s.maxzoom<=l-r||(e.styleLayerUID=s.uid,e.styleLayer=s,o.render(e,{tiles:a}))}a[0]=null}drawBackground(e,t,n){if(n.backgroundBucketIds.length===0)return;this._context??=e.context;let{displayLevel:i}=e;this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:`composite`},stencil:!1,depth:{write:!1,test:519}}),e.renderPass=`background`;let o=this._vtlTechniques.getTechnique(0);a[0]=t,n.backgroundBucketIds.forEach(t=>{let s=n.getLayerById(t);if(s.type!==0)return;let c=s.getLayoutProperty(`visibility`);c&&c.getValue()===1||s.minzoom!==void 0&&s.minzoom>i+r||s.maxzoom!==void 0&&s.maxzoom<=i-r||(e.styleLayerUID=s.uid,e.styleLayer=s,o.render(e,{tiles:a}))}),a[0]=null}drawTile(e,n,r,i){this._context??=e.context;let a=r.layers,o=i?e=>i!==e.type||!n.layerData.has(e.uid):e=>!n.layerData.has(e.uid),s=a.filter(e=>!(o(e)||e.getLayoutProperty(`visibility`)?.getValue()===1)),{context:c}=e,l=c.getPipelineState(),{depthWrite:u}=l;n.disposeLayerData();let d=0,f=1;u?.zNear!==void 0&&u.zFar!==void 0&&(d=u.zNear,f=u.zFar),this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:`none`},stencil:!1,depth:{write:{zNear:d,zFar:f},test:515}}),e.renderPass=`opaque`;for(let t=s.length-1;t>=0;--t)this._renderStyleLayer(s[t],e,n);this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:`composite`},stencil:!1,depth:{write:!1,test:515}}),e.renderPass=`translucent`,s.forEach(t=>this._renderStyleLayer(t,e,n)),this._renderingDevice.setPipelineState(t),c.setPipelineState(l)}setShader(e){return this._renderingDevice.setShader(e)}setPipelineState(e){return this._renderingDevice.setPipelineState(e)}getPipelineState(){return this._renderingDevice.getPipelineState()}submitDraw(e,t,n){return this._renderingDevice.submitDraw(e,t,n)}submitDrawMesh(e,t,n,r){this._renderingDevice.submitDrawMesh(e,t,n,r)}submitDrawMeshUntyped(e,t,n,r){this._renderingDevice.submitDrawMeshUntyped(e,t,n,r)}updatePipelineState(e){return this._renderingDevice.updatePipelineState(e)}setStencilRef(e,t){return this._renderingDevice.setStencilRef(e,t)}_renderStyleLayer(e,t,n){let{renderPass:i}=t,o;switch(e.type){case 0:if(i!==`background`)return;o=this._vtlTechniques.getTechnique(0);break;case 1:if(i!==`opaque`&&i!==`translucent`)return;o=this._vtlTechniques.getTechnique(1);break;case 2:if(i!==`translucent`)return;o=this._vtlTechniques.getTechnique(2);break;case 4:if(i!==`translucent`)return;o=this._vtlTechniques.getTechnique(4);break;case 3:if(i!==`translucent`)return;o=this._vtlTechniques.getTechnique(3)}let{displayLevel:s}=t,{minzoom:c,maxzoom:l}=e;if(c!==void 0&&c>s+r||l!==void 0&&l<=s-r||!o)return;let u=this._renderingDevice.getPipelineState();e.type===3&&this._renderingDevice.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:`composite`},stencil:!1,depth:!1}),t.styleLayerUID=e.uid,t.styleLayer=e,a[0]=n,o.render(t,{tiles:a}),a[0]=null,e.type===3&&this._renderingDevice.setPipelineState(u)}}const a=[null];export{i as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import t from"../../../../core/Logger.js";import{estimateNumberArrayMemory as n}from"../../../../core/memoryEstimations.js";import{signal as r}from"../../../../core/signal.js";import{dataDrivenUnit2 as i,dataDrivenUnit1 as a,dataDrivenUnit0 as o,visualVariableUnit as s,localTimeOriginUnit as c,gpgpuUnit as l,animationUnit as u,filterFlagsUnit as d}from"./definitions.js";import{getDisplayIdTexel as f}from"./DisplayId.js";import{SizedPixelFormat as p,PixelType as m}from"../../../webgl/enums.js";import{DisposableFramebufferObject as h}from"../../../webgl/FramebufferObject.js";import g from"../../../webgl/Texture.js";import{TextureDescriptor as _}from"../../../webgl/TextureDescriptor.js";const v=()=>t.getLogger(`esri.views.2d.engine.webgl.AttributeStoreView`),y=t=>{switch(t){case m.UNSIGNED_BYTE:return 1;case m.UNSIGNED_SHORT_4_4_4_4:return 2;case m.FLOAT:return 4;default:v().error(new e(`webgl-utils`,`Unable to handle type ${t}`));return}},b=t=>{switch(t){case m.UNSIGNED_BYTE:return Uint8Array;case m.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case m.FLOAT:return Float32Array;default:v().error(new e(`webgl-utils`,`Unable to handle type ${t}`));return}};class x{constructor(e,t,n){this._texture=null,this._lastTexture=null,this._fbos={},this.texelSize=4;let{buffer:r,pixelType:i,textureOnly:a}=e,o=b(i);this.blockIndex=n,this.pixelType=i,this.size=t,this.textureOnly=a,a||(this.data=new o(r)),this._resetRange()}destroy(){this._texture?.dispose();for(let e in this._fbos){let t=this._fbos[e];t&&(e===`0`&&t.detachColorTexture(),t.dispose()),this._fbos[e]=null}this._texture=null}get _textureDesc(){let e=new _(this.size);return e.wrapMode=33071,e.samplingMode=9728,e.dataType=this.pixelType,this.blockIndex===2&&(e.pixelFormat=6403,e.internalFormat=p.R8),e}get usedMemory(){return this.data==null?0:n(this.data)}setData(e,t,n){let r=f(e),i=this.data,a=r*this.texelSize+t;!i||a>=i.length||(i[a]=n,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r))}getData(e,t){if(this.data==null)return null;let n=f(e)*this.texelSize+t;return!this.data||n>=this.data.length?null:this.data[n]}getTexture(e){return this._texture??this._initTexture(e)}getFBO(e,t=0){if(!this._fbos[t]){let n=t===0?this.getTexture(e):this._textureDesc;this._fbos[t]=new h(e,n)}return this._fbos[t]}get hasDirty(){let e=this.dirtyStart;return this.dirtyEnd>=e}updateTexture(t,n){try{let r=this.dirtyStart,i=this.dirtyEnd;if(!this.hasDirty)return;has(`esri-2d-update-debug`)&&console.debug(`Version[${n}] AttributeStoreView.updateTexture`,{start:r,end:i,firstBytes:new Uint8Array(this.data.buffer.slice(0,16)),block:this}),this._resetRange();let a=this.data.buffer,o=this.getTexture(t),s=(r-r%this.size)/this.size,c=(i-i%this.size)/this.size,l=s,u=this.size,d=c,f=s*this.size*4,p=(u+d*this.size)*4-f,m=b(this.pixelType),h=m.BYTES_PER_ELEMENT,g=new m(a,f*h,p),_=this.size,y=d-l+1;if(y>this.size){v().error(new e(`mapview-webgl`,`Out-of-bounds index when updating AttributeData`));return}o.updateData(0,0,l,_,y,g)}catch{}}update(e){let{data:t,start:n,end:r}=e;if(t!=null&&this.data!=null){let r=this.data,i=n*this.texelSize;for(let n=0;n<t.length;n++){let a=1<<n%this.texelSize;e.layout&a&&(r[i+n]=t[n])}}this.dirtyStart=Math.min(this.dirtyStart,n),this.dirtyEnd=Math.max(this.dirtyEnd,r)}resize(e,t){let n=this.size;if(this.size=t,this.textureOnly){n!==this.size&&(this._lastTexture=this._texture,this._texture=null);return}let r=b(this.pixelType);this.destroy(),this.data=new r(e.buffer)}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}_initTexture(e){let t=new g(e,this._textureDesc,this.data??void 0);if(this._lastTexture!=null&&this._fbos[0]){let n=this._lastTexture.descriptor.width,r=this._lastTexture.descriptor.height,i=this._lastTexture.descriptor.dataType,a=this._lastTexture.descriptor.pixelFormat,o=this.getFBO(e),s=y(i),c=new(b(i))(new ArrayBuffer(n*r*s*this.texelSize)),l=e.boundFramebuffer,{x:u,y:d,width:f,height:p}=e.getViewport();e.bindFramebuffer(o),o.readPixels(0,0,n,r,a,i,c),t.updateData(0,0,0,n*2,r/2,c),e.setViewport(u,d,f,p),e.bindFramebuffer(l)}return this.destroy(),this._texture=t,this._texture}}class S{constructor(){this.size=0,this._pendingAttributeUpdates=[],this._version=0,this._epoch=0,this._hasPendingUpdate=r(!1),this._locked=!1}get updating(){return this._hasPendingUpdate.value}get locked(){return this._locked}get usedMemory(){let e=0;for(let t of this._data??[])t!=null&&(e+=t.usedMemory);return e}_initialize(e){if(!e)throw Error(`InternalError: initArgs must be defined`);let t=e.blockDescriptors;if(this.size=e.blockSize,has(`esri-2d-update-debug`)&&console.debug(`AttributeStoreView.initialize`,{message:e}),this._data==null)this._data=t.map((e,t)=>e==null?null:new x(e,this.size,t));else for(let e=0;e<this._data.length;e++){let n=this._data[e],r=t[e];r!=null&&(n==null?this._data[e]=new x(r,this.size,e):n.resize(r,this.size))}}destroy(){for(let e of this._data??[])e?.destroy();this._defaultTexture?.dispose(),this._defaultTexture=null,this._pendingAttributeUpdates=[]}isEmpty(){return this._data==null}getBlock(e){return this._data==null?null:this._data[e]}setLabelMinZoom(e,t){this.setData(e,0,1,t)}setLocalTimeOrigin(e,t){this.setData(e,7,0,t)}getLabelMinZoom(e){return this.getData(e,0,1,255)}getFilterFlags(e){return this.getData(e,0,0,0)}getVisualVariableData(e,t){return this.getData(e,3,t,0)}getData(e,t,n,r){if(!this._data)return 0;let i=this._data[t];return i==null?0:i.getData(e,n)??r}setData(e,t,n,r){this._data[t].setData(e,n,r)}lockTextureUploads(){this._locked=!0}unlockTextureUploads(){return this._locked=!1,this.update()}requestUpdate(e){this._version=e.version,this._pendingAttributeUpdates.push(e),this._hasPendingUpdate.value=!0,has(`esri-2d-update-debug`)&&console.debug(`Version[${this._version}] AttributeStoreView.requestUpdate`,{message:e})}get currentEpoch(){return this._epoch}get hasPendingUpdates(){return this._pendingAttributeUpdates.length>0}update(){if(this._locked)return!1;let e=this._pendingAttributeUpdates;this._pendingAttributeUpdates=[];let t=!!e.length;for(let t of e){let{blockData:e,initArgs:n,sendUpdateEpoch:r,version:i}=t;has(`esri-2d-update-debug`)&&console.debug(`Version[${this._version}] Epoch[${r}] AttributeStoreView.applyUpdate`),this._version=i,this._epoch=r,n!=null&&this._initialize(n);let a=this._data;for(let t=0;t<e.length;t++){let n=e[t],r=a[t];r!=null&&n!=null&&(has(`esri-2d-update-debug`)&&console.debug(`Version[${this._version}] CpuBlock[${t}] AttributeStoreView.update`,{block:n}),r.update(n))}}return this._hasPendingUpdate.value=!1,t}getUniforms(){return{size:this.size}}getTextures(e){return{filterFlags:{texture:this._getTexture(e,0),unit:d},animation:{texture:this._getTexture(e,1),unit:u},gpgpu:{texture:this._getTexture(e,2),unit:l},localTimeOrigin:{texture:this._getTexture(e,7),unit:c},visualVariableData:{texture:this._getTexture(e,3),unit:s},dataDriven0:{texture:this._getTexture(e,4),unit:o},dataDriven1:{texture:this._getTexture(e,5),unit:a},dataDriven2:{texture:this._getTexture(e,6),unit:i}}}_getTexture(e,t){let n=this._data?.[t];return n?(n.updateTexture(e,this._version),n.getTexture(e)):this._getDefaultTexture(e)}_getDefaultTexture(e){if(this._defaultTexture==null){let t=new _(1);t.wrapMode=33071,t.samplingMode=9728,this._defaultTexture=new g(e,t,new Uint8Array(4))}return this._defaultTexture}}export{S as AttributeStoreView};
2
+ import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import t from"../../../../core/Logger.js";import{estimateNumberArrayMemory as n}from"../../../../core/memoryEstimations.js";import{signal as r}from"../../../../core/signal.js";import{dataDrivenUnit2 as i,dataDrivenUnit1 as a,dataDrivenUnit0 as o,visualVariableUnit as s,localTimeOriginUnit as c,gpgpuUnit as l,animationUnit as u,filterFlagsUnit as d}from"./definitions.js";import{getDisplayIdTexel as f}from"./DisplayId.js";import{SizedPixelFormat as p,PixelType as m}from"../../../webgl/enums.js";import{DisposableFramebufferObject as h}from"../../../webgl/FramebufferObject.js";import{Texture as g}from"../../../webgl/Texture.js";import{TextureDescriptor as _}from"../../../webgl/TextureDescriptor.js";const v=()=>t.getLogger(`esri.views.2d.engine.webgl.AttributeStoreView`),y=t=>{switch(t){case m.UNSIGNED_BYTE:return 1;case m.UNSIGNED_SHORT_4_4_4_4:return 2;case m.FLOAT:return 4;default:v().error(new e(`webgl-utils`,`Unable to handle type ${t}`));return}},b=t=>{switch(t){case m.UNSIGNED_BYTE:return Uint8Array;case m.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case m.FLOAT:return Float32Array;default:v().error(new e(`webgl-utils`,`Unable to handle type ${t}`));return}};class x{constructor(e,t,n){this._texture=null,this._lastTexture=null,this._fbos={},this.texelSize=4;let{buffer:r,pixelType:i,textureOnly:a}=e,o=b(i);this.blockIndex=n,this.pixelType=i,this.size=t,this.textureOnly=a,a||(this.data=new o(r)),this._resetRange()}destroy(){this._texture?.dispose();for(let e in this._fbos){let t=this._fbos[e];t&&(e===`0`&&t.detachColorTexture(),t.dispose()),this._fbos[e]=null}this._texture=null}get _textureDesc(){let e=new _(this.size);return e.wrapMode=33071,e.samplingMode=9728,e.dataType=this.pixelType,this.blockIndex===2&&(e.pixelFormat=6403,e.internalFormat=p.R8),e}get usedMemory(){return this.data==null?0:n(this.data)}setData(e,t,n){let r=f(e),i=this.data,a=r*this.texelSize+t;!i||a>=i.length||(i[a]=n,this.dirtyStart=Math.min(this.dirtyStart,r),this.dirtyEnd=Math.max(this.dirtyEnd,r))}getData(e,t){if(this.data==null)return null;let n=f(e)*this.texelSize+t;return!this.data||n>=this.data.length?null:this.data[n]}getTexture(e){return this._texture??this._initTexture(e)}getFBO(e,t=0){if(!this._fbos[t]){let n=t===0?this.getTexture(e):this._textureDesc;this._fbos[t]=new h(e,n)}return this._fbos[t]}get hasDirty(){let e=this.dirtyStart;return this.dirtyEnd>=e}updateTexture(t,n){try{let r=this.dirtyStart,i=this.dirtyEnd;if(!this.hasDirty)return;has(`esri-2d-update-debug`)&&console.debug(`Version[${n}] AttributeStoreView.updateTexture`,{start:r,end:i,firstBytes:new Uint8Array(this.data.buffer.slice(0,16)),block:this}),this._resetRange();let a=this.data.buffer,o=this.getTexture(t),s=(r-r%this.size)/this.size,c=(i-i%this.size)/this.size,l=s,u=this.size,d=c,f=s*this.size*4,p=(u+d*this.size)*4-f,m=b(this.pixelType),h=m.BYTES_PER_ELEMENT,g=new m(a,f*h,p),_=this.size,y=d-l+1;if(y>this.size){v().error(new e(`mapview-webgl`,`Out-of-bounds index when updating AttributeData`));return}o.updateData(0,0,l,_,y,g)}catch{}}update(e){let{data:t,start:n,end:r}=e;if(t!=null&&this.data!=null){let r=this.data,i=n*this.texelSize;for(let n=0;n<t.length;n++){let a=1<<n%this.texelSize;e.layout&a&&(r[i+n]=t[n])}}this.dirtyStart=Math.min(this.dirtyStart,n),this.dirtyEnd=Math.max(this.dirtyEnd,r)}resize(e,t){let n=this.size;if(this.size=t,this.textureOnly){n!==this.size&&(this._lastTexture=this._texture,this._texture=null);return}let r=b(this.pixelType);this.destroy(),this.data=new r(e.buffer)}_resetRange(){this.dirtyStart=2147483647,this.dirtyEnd=0}_initTexture(e){let t=new g(e,this._textureDesc,this.data??void 0);if(this._lastTexture!=null&&this._fbos[0]){let n=this._lastTexture.descriptor.width,r=this._lastTexture.descriptor.height,i=this._lastTexture.descriptor.dataType,a=this._lastTexture.descriptor.pixelFormat,o=this.getFBO(e),s=y(i),c=new(b(i))(new ArrayBuffer(n*r*s*this.texelSize)),l=e.boundFramebuffer,{x:u,y:d,width:f,height:p}=e.getViewport();e.bindFramebuffer(o),o.readPixels(0,0,n,r,a,i,c),t.updateData(0,0,0,n*2,r/2,c),e.setViewport(u,d,f,p),e.bindFramebuffer(l)}return this.destroy(),this._texture=t,this._texture}}class S{constructor(){this.size=0,this._pendingAttributeUpdates=[],this._version=0,this._epoch=0,this._hasPendingUpdate=r(!1),this._locked=!1}get updating(){return this._hasPendingUpdate.value}get locked(){return this._locked}get usedMemory(){let e=0;for(let t of this._data??[])t!=null&&(e+=t.usedMemory);return e}_initialize(e){if(!e)throw Error(`InternalError: initArgs must be defined`);let t=e.blockDescriptors;if(this.size=e.blockSize,has(`esri-2d-update-debug`)&&console.debug(`AttributeStoreView.initialize`,{message:e}),this._data==null)this._data=t.map((e,t)=>e==null?null:new x(e,this.size,t));else for(let e=0;e<this._data.length;e++){let n=this._data[e],r=t[e];r!=null&&(n==null?this._data[e]=new x(r,this.size,e):n.resize(r,this.size))}}destroy(){for(let e of this._data??[])e?.destroy();this._defaultTexture?.dispose(),this._defaultTexture=null,this._pendingAttributeUpdates=[]}isEmpty(){return this._data==null}getBlock(e){return this._data==null?null:this._data[e]}setLabelMinZoom(e,t){this.setData(e,0,1,t)}setLocalTimeOrigin(e,t){this.setData(e,7,0,t)}getLabelMinZoom(e){return this.getData(e,0,1,255)}getFilterFlags(e){return this.getData(e,0,0,0)}getVisualVariableData(e,t){return this.getData(e,3,t,0)}getData(e,t,n,r){if(!this._data)return 0;let i=this._data[t];return i==null?0:i.getData(e,n)??r}setData(e,t,n,r){this._data[t].setData(e,n,r)}lockTextureUploads(){this._locked=!0}unlockTextureUploads(){return this._locked=!1,this.update()}requestUpdate(e){this._version=e.version,this._pendingAttributeUpdates.push(e),this._hasPendingUpdate.value=!0,has(`esri-2d-update-debug`)&&console.debug(`Version[${this._version}] AttributeStoreView.requestUpdate`,{message:e})}get currentEpoch(){return this._epoch}get hasPendingUpdates(){return this._pendingAttributeUpdates.length>0}update(){if(this._locked)return!1;let e=this._pendingAttributeUpdates;this._pendingAttributeUpdates=[];let t=!!e.length;for(let t of e){let{blockData:e,initArgs:n,sendUpdateEpoch:r,version:i}=t;has(`esri-2d-update-debug`)&&console.debug(`Version[${this._version}] Epoch[${r}] AttributeStoreView.applyUpdate`),this._version=i,this._epoch=r,n!=null&&this._initialize(n);let a=this._data;for(let t=0;t<e.length;t++){let n=e[t],r=a[t];r!=null&&n!=null&&(has(`esri-2d-update-debug`)&&console.debug(`Version[${this._version}] CpuBlock[${t}] AttributeStoreView.update`,{block:n}),r.update(n))}}return this._hasPendingUpdate.value=!1,t}getUniforms(){return{size:this.size}}getTextures(e){return{filterFlags:{texture:this._getTexture(e,0),unit:d},animation:{texture:this._getTexture(e,1),unit:u},gpgpu:{texture:this._getTexture(e,2),unit:l},localTimeOrigin:{texture:this._getTexture(e,7),unit:c},visualVariableData:{texture:this._getTexture(e,3),unit:s},dataDriven0:{texture:this._getTexture(e,4),unit:o},dataDriven1:{texture:this._getTexture(e,5),unit:a},dataDriven2:{texture:this._getTexture(e,6),unit:i}}}_getTexture(e,t){let n=this._data?.[t];return n?(n.updateTexture(e,this._version),n.getTexture(e)):this._getDefaultTexture(e)}_getDefaultTexture(e){if(this._defaultTexture==null){let t=new _(1);t.wrapMode=33071,t.samplingMode=9728,this._defaultTexture=new g(e,t,new Uint8Array(4))}return this._defaultTexture}}export{S as AttributeStoreView};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{open as e}from"../../../../core/workers.js";import{decorGlyphRect as t}from"./decorGlyphRect.js";import{sdfBufferServer as n}from"./definitions.js";import r from"./Rect.js";import i from"../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../webgl/TextureDescriptor.js";const o=new r(0,0,11,8),s=new r(11,0,11,8);class c{constructor(e,t,n,r){this._snapCoords=n,this._setTextureKey=r,this.width=0,this.height=0,this._dirties=[],this._pageData=[],this._currentPage=0,this._textures=[],this._worker=this._load(),this.width=e,this.height=t,this._pageData.push(new Uint8Array(e*t)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs()}dispose(){for(let e of this._textures)e&&e.dispose();this._textures.length=0,this._pageData.length=0,this._worker.then(e=>e.connection.close())}async openMessagePorts(){return(await this._worker).connection.openPorts()}async rasterizeText(e,t,n){return(await this._worker).worker.rasterizeText(e,t,n)}getTexture(e,t){if(!this._textures[t]){let n=new a(this.width,this.height);n.pixelFormat=6406,n.wrapMode=33071,this._textures[t]=new i(e,n,new Uint8Array(this.width*this.height))}return this._dirties[t]&&(this._textures[t].setData(this._pageData[t]),this._dirties[t]=!1),this._textures[t]}bind(e,t,n,r){let i=this.getTexture(e,n);i.setSamplingMode(t),e.bindTexture(i,r)}async _load(){let t=await e(`GlyphWorker`,{client:{getOptions:()=>({width:this.width,height:this.height,snapCoords:!!this._snapCoords}),recordGlyphs:e=>{let t=n;for(let n of e)n.sdf&&this.recordGlyph(n.mosaicItem,n.rect,n.sdf.buffer,t),this._setTextureKey&&n.mosaicItem.textureKey!==0&&this._setTextureKey(n.mosaicItem)}},strategy:`dedicated`});return{worker:t.createInvokeProxy(),connection:t}}_invalidate(){this._dirties[this._currentPage]=!0}recordGlyph(e,t,n,r){let{page:i,rect:a}=e;if(t.width===0)return;let o=t.width+r*2,s=t.height+r*2;this._pageData[i]||this._allocNewPage(i);let c=this._pageData[i];for(let e=0;e<s;e++){let t=o*e,r=this.width*(a.y+e)+a.x;for(let e=0;e<o;e++)c[r+e]=n[t+e]}has(`esri-glyph-debug`)&&this._showDebugPage(c),this._invalidate()}_allocNewPage(e){this._dirties[this._currentPage]||(this._pageData[this._currentPage]=null),this._currentPage=e,this._pageData[e]=new Uint8Array(this.width*this.height),this._dirties[e]=!0,this._textures[e]=null,this._initDecorationGlyphs()}_initDecorationGlyphs(){let e=[117,149,181,207,207,181,149,117],r=[],i=[];for(let t=0;t<e.length;t++){let n=e[t];for(let e=0;e<11;e++){let a=t>=3&&t<5&&e>=3&&e<8?255:0;r.push(n),i.push(a)}}let a=new Uint8Array(r),c={rect:o,page:this._currentPage,sdf:!0},l=new Uint8Array(i),u={rect:s,page:this._currentPage,sdf:!0};this.recordGlyph(c,t,a,n),this.recordGlyph(u,t,l,n)}_showDebugPage(e){let t=document.createElement(`canvas`),n=t.getContext(`2d`),r=new ImageData(this.width,this.height),i=r.data;t.width=this.width,t.height=this.height,t.style.border=`1px solid black`;for(let t=0;t<e.length;++t)i[t*4]=e[t],i[t*4+1]=0,i[t*4+2]=0,i[t*4+3]=255;n.putImageData(r,0,0),document.body.appendChild(t)}}export{c as GlyphMosaic};
2
+ import has from"../../../../core/has.js";import{open as e}from"../../../../core/workers.js";import{decorGlyphRect as t}from"./decorGlyphRect.js";import{sdfBufferServer as n}from"./definitions.js";import r from"./Rect.js";import{Texture as i}from"../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../webgl/TextureDescriptor.js";const o=new r(0,0,11,8),s=new r(11,0,11,8);class c{constructor(e,t,n,r){this._snapCoords=n,this._setTextureKey=r,this.width=0,this.height=0,this._dirties=[],this._pageData=[],this._currentPage=0,this._textures=[],this._worker=this._load(),this.width=e,this.height=t,this._pageData.push(new Uint8Array(e*t)),this._dirties.push(!0),this._textures.push(null),this._initDecorationGlyphs()}dispose(){for(let e of this._textures)e&&e.dispose();this._textures.length=0,this._pageData.length=0,this._worker.then(e=>e.connection.close())}async openMessagePorts(){return(await this._worker).connection.openPorts()}async rasterizeText(e,t,n){return(await this._worker).worker.rasterizeText(e,t,n)}getTexture(e,t){if(!this._textures[t]){let n=new a(this.width,this.height);n.pixelFormat=6406,n.wrapMode=33071,this._textures[t]=new i(e,n,new Uint8Array(this.width*this.height))}return this._dirties[t]&&(this._textures[t].setData(this._pageData[t]),this._dirties[t]=!1),this._textures[t]}bind(e,t,n,r){let i=this.getTexture(e,n);i.setSamplingMode(t),e.bindTexture(i,r)}async _load(){let t=await e(`GlyphWorker`,{client:{getOptions:()=>({width:this.width,height:this.height,snapCoords:!!this._snapCoords}),recordGlyphs:e=>{let t=n;for(let n of e)n.sdf&&this.recordGlyph(n.mosaicItem,n.rect,n.sdf.buffer,t),this._setTextureKey&&n.mosaicItem.textureKey!==0&&this._setTextureKey(n.mosaicItem)}},strategy:`dedicated`});return{worker:t.createInvokeProxy(),connection:t}}_invalidate(){this._dirties[this._currentPage]=!0}recordGlyph(e,t,n,r){let{page:i,rect:a}=e;if(t.width===0)return;let o=t.width+r*2,s=t.height+r*2;this._pageData[i]||this._allocNewPage(i);let c=this._pageData[i];for(let e=0;e<s;e++){let t=o*e,r=this.width*(a.y+e)+a.x;for(let e=0;e<o;e++)c[r+e]=n[t+e]}has(`esri-glyph-debug`)&&this._showDebugPage(c),this._invalidate()}_allocNewPage(e){this._dirties[this._currentPage]||(this._pageData[this._currentPage]=null),this._currentPage=e,this._pageData[e]=new Uint8Array(this.width*this.height),this._dirties[e]=!0,this._textures[e]=null,this._initDecorationGlyphs()}_initDecorationGlyphs(){let e=[117,149,181,207,207,181,149,117],r=[],i=[];for(let t=0;t<e.length;t++){let n=e[t];for(let e=0;e<11;e++){let a=t>=3&&t<5&&e>=3&&e<8?255:0;r.push(n),i.push(a)}}let a=new Uint8Array(r),c={rect:o,page:this._currentPage,sdf:!0},l=new Uint8Array(i),u={rect:s,page:this._currentPage,sdf:!0};this.recordGlyph(c,t,a,n),this.recordGlyph(u,t,l,n)}_showDebugPage(e){let t=document.createElement(`canvas`),n=t.getContext(`2d`),r=new ImageData(this.width,this.height),i=r.data;t.width=this.width,t.height=this.height,t.style.border=`1px solid black`;for(let t=0;t<e.length;++t)i[t*4]=e[t],i[t*4+1]=0,i[t*4+2]=0,i[t*4+3]=255;n.putImageData(r,0,0),document.body.appendChild(t)}}export{c as GlyphMosaic};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import n from"../../../../core/Handles.js";import r from"../../../../core/Logger.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{getProjectiveTransform as a}from"../../../../core/perspectiveUtils.js";import{watch as o,initial as s,when as c}from"../../../../core/reactiveUtils.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as u}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{getClosestDenormalizedXToReference as f}from"../../../../geometry/support/normalizeUtils.js";import{isVideoElement as p}from"../../../../support/mediaLayerUtils.js";import{DisplayObject as m}from"../DisplayObject.js";import{createPlayer as h,updateIfNeeded as g}from"./animatedFormats/utils.js";import _ from"../../../webgl/Texture.js";import{TextureDescriptor as v}from"../../../webgl/TextureDescriptor.js";const y=[1,1],b=l(),x={none:`None`,loop:`Loop`,oscillate:`Oscillate`};function S(e){return e?{type:`CIMAnimatedSymbolProperties`,...e,playAnimation:e.playing,repeatType:e.repeatType?x[e.repeatType]:void 0}:{type:`CIMAnimatedSymbolProperties`}}class C extends m{constructor(a){super(),this.elementView=a,this.isWrapAround=!1,this.wrapAroundShift=0,this.perspectiveTransform=d(),this._handles=new n,this._vertices=new Float32Array(8),this._indices=new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]),this._playAnimation=!0,this._handles.add([o(()=>this.elementView.element.opacity,e=>this.opacity=e,s),o(()=>[this.elementView.coords],()=>{this.requestRender()},s),o(()=>[`animationOptions`in this.elementView.element&&this.elementView.element.animationOptions],()=>{this.texture=i(this.texture),this.requestRender()},s),c(()=>this.elementView.element.loaded,()=>{let e=this.elementView.element;this.ready(),p(e)&&e.content!=null&&(this._handles.add([t(e.content,`play`,()=>this.requestRender()),t(e.content,`loadeddata`,()=>this.requestRender()),t(e.content,`loaded`,()=>this.requestRender())]),`requestVideoFrameCallback`in e.content?e.content.requestVideoFrameCallback(()=>this.requestRender()):this._handles.add([t(e.content,`seeked`,()=>this.requestRender())]),this.requestRender())},s)]),a.element.load().catch(t=>{r.getLogger(`esri.views.2d.layers.MediaLayerView2D`).error(new e(`element-load-error`,`Element cannot be displayed`,{element:a,error:t}))})}getMesh(e){throw Error(`Method not implemented.`)}destroy(){super.destroy(),this._handles.destroy(),this.texture=i(this.texture)}get textureSize(){return y}beforeRender(e){let{context:t}=e,n=this.elementView.element.content;if(n!=null){let r=n instanceof HTMLImageElement,i=n instanceof HTMLVideoElement,a=r?n.naturalWidth:i?n.videoWidth:n.width,o=r?n.naturalHeight:i?n.videoHeight:n.height;if(this._updatePerspectiveTransform(a,o),!this.texture){let e=new v(a,o);if(e.wrapMode=33071,e.preMultiplyAlpha=!0,`getFrame`in n){let r=n=>{this.texture?this.texture.setData(n):this.texture=new _(t,e,n)};if(`animationOptions`in this.elementView.element){let e=S(this.elementView.element.animationOptions);this._playAnimation=e.playAnimation??!1,this._player=h(n,e,null,r)}}else this.texture=new _(t,e,n);this.texture.generateMipmap(),i&&this._requestVideoFrame(n)}else if(i){if(n.readyState>=n.HAVE_CURRENT_DATA)e.animationsEnabled&&this._updateTextureAndRequestRender(n);else{let e=()=>{this._updateTextureAndRequestRender(n),n.removeEventListener(`canplay`,e),n.removeEventListener(`seeked`,e)};n.addEventListener(`canplay`,e),n.addEventListener(`seeked`,e)}}else`getFrame`in n&&e.animationsEnabled&&this.requestRender()}super.beforeRender(e)}_updateTextureAndRequestRender(e){this.texture.setData(e),this.texture.generateMipmap(),this._requestVideoFrame(e)}_requestVideoFrame(e){`requestVideoFrameCallback`in e?e.requestVideoFrameCallback(()=>this.requestRender()):e.paused||this.requestRender()}_createTransforms(){return null}draw(e,t){!this.isReady||this.texture==null?this.requestRender():(this._playAnimation&&g(e,this._player),t.render(e,{config:{perspective:this.perspectiveTransform,texSize:y,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity},texture:{texture:this.texture,unit:0},position:this._vertices,tex:this._indices}))}updateDrawCoords(e,t,n,r){let{coords:i,bounds:a}=this.elementView;if(i==null||a==null)return;let[o,s,c,l]=i.rings[0],u=this._vertices,d=(a[0]+a[2])/2,p=f(e.x,d,i.spatialReference),m=e.y;u.set([s[0]-p,s[1]-m,o[0]-p,o[1]-m,c[0]-p,c[1]-m,l[0]-p,l[1]-m]);let h=0;if(r){let{worldWidth:e}=r,t=e/2,n=a[0]-p,i=a[2]-p;n<-t?h=e:i>t&&(h=-e)}this.wrapAroundShift=h,this.isWrapAround=h!==0}_updatePerspectiveTransform(e,t){let n=this._vertices;a(b,[0,0,e,0,0,t,e,t],[n[0],n[1],n[4],n[5],n[2],n[3],n[6],n[7]]),u(this.perspectiveTransform,b[6]/b[8]*e,b[7]/b[8]*t)}}export{C as default};
2
+ import e from"../../../../core/Error.js";import{on as t}from"../../../../core/events.js";import n from"../../../../core/Handles.js";import r from"../../../../core/Logger.js";import{disposeMaybe as i}from"../../../../core/maybe.js";import{getProjectiveTransform as a}from"../../../../core/perspectiveUtils.js";import{watch as o,initial as s,when as c}from"../../../../core/reactiveUtils.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{set as u}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{getClosestDenormalizedXToReference as f}from"../../../../geometry/support/normalizeUtils.js";import{isVideoElement as p}from"../../../../support/mediaLayerUtils.js";import{DisplayObject as m}from"../DisplayObject.js";import{createPlayer as h,updateIfNeeded as g}from"./animatedFormats/utils.js";import{Texture as _}from"../../../webgl/Texture.js";import{TextureDescriptor as v}from"../../../webgl/TextureDescriptor.js";const y=[1,1],b=l(),x={none:`None`,loop:`Loop`,oscillate:`Oscillate`};function S(e){return e?{type:`CIMAnimatedSymbolProperties`,...e,playAnimation:e.playing,repeatType:e.repeatType?x[e.repeatType]:void 0}:{type:`CIMAnimatedSymbolProperties`}}class C extends m{constructor(a){super(),this.elementView=a,this.isWrapAround=!1,this.wrapAroundShift=0,this.perspectiveTransform=d(),this._handles=new n,this._vertices=new Float32Array(8),this._indices=new Uint16Array([0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,1,1,0,1,1]),this._playAnimation=!0,this._handles.add([o(()=>this.elementView.element.opacity,e=>this.opacity=e,s),o(()=>[this.elementView.coords],()=>{this.requestRender()},s),o(()=>[`animationOptions`in this.elementView.element&&this.elementView.element.animationOptions],()=>{this.texture=i(this.texture),this.requestRender()},s),c(()=>this.elementView.element.loaded,()=>{let e=this.elementView.element;this.ready(),p(e)&&e.content!=null&&(this._handles.add([t(e.content,`play`,()=>this.requestRender()),t(e.content,`loadeddata`,()=>this.requestRender()),t(e.content,`loaded`,()=>this.requestRender())]),`requestVideoFrameCallback`in e.content?e.content.requestVideoFrameCallback(()=>this.requestRender()):this._handles.add([t(e.content,`seeked`,()=>this.requestRender())]),this.requestRender())},s)]),a.element.load().catch(t=>{r.getLogger(`esri.views.2d.layers.MediaLayerView2D`).error(new e(`element-load-error`,`Element cannot be displayed`,{element:a,error:t}))})}getMesh(e){throw Error(`Method not implemented.`)}destroy(){super.destroy(),this._handles.destroy(),this.texture=i(this.texture)}get textureSize(){return y}beforeRender(e){let{context:t}=e,n=this.elementView.element.content;if(n!=null){let r=n instanceof HTMLImageElement,i=n instanceof HTMLVideoElement,a=r?n.naturalWidth:i?n.videoWidth:n.width,o=r?n.naturalHeight:i?n.videoHeight:n.height;if(this._updatePerspectiveTransform(a,o),!this.texture){let e=new v(a,o);if(e.wrapMode=33071,e.preMultiplyAlpha=!0,`getFrame`in n){let r=n=>{this.texture?this.texture.setData(n):this.texture=new _(t,e,n)};if(`animationOptions`in this.elementView.element){let e=S(this.elementView.element.animationOptions);this._playAnimation=e.playAnimation??!1,this._player=h(n,e,null,r)}}else this.texture=new _(t,e,n);this.texture.generateMipmap(),i&&this._requestVideoFrame(n)}else if(i){if(n.readyState>=n.HAVE_CURRENT_DATA)e.animationsEnabled&&this._updateTextureAndRequestRender(n);else{let e=()=>{this._updateTextureAndRequestRender(n),n.removeEventListener(`canplay`,e),n.removeEventListener(`seeked`,e)};n.addEventListener(`canplay`,e),n.addEventListener(`seeked`,e)}}else`getFrame`in n&&e.animationsEnabled&&this.requestRender()}super.beforeRender(e)}_updateTextureAndRequestRender(e){this.texture.setData(e),this.texture.generateMipmap(),this._requestVideoFrame(e)}_requestVideoFrame(e){`requestVideoFrameCallback`in e?e.requestVideoFrameCallback(()=>this.requestRender()):e.paused||this.requestRender()}_createTransforms(){return null}draw(e,t){!this.isReady||this.texture==null?this.requestRender():(this._playAnimation&&g(e,this._player),t.render(e,{config:{perspective:this.perspectiveTransform,texSize:y,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity},texture:{texture:this.texture,unit:0},position:this._vertices,tex:this._indices}))}updateDrawCoords(e,t,n,r){let{coords:i,bounds:a}=this.elementView;if(i==null||a==null)return;let[o,s,c,l]=i.rings[0],u=this._vertices,d=(a[0]+a[2])/2,p=f(e.x,d,i.spatialReference),m=e.y;u.set([s[0]-p,s[1]-m,o[0]-p,o[1]-m,c[0]-p,c[1]-m,l[0]-p,l[1]-m]);let h=0;if(r){let{worldWidth:e}=r,t=e/2,n=a[0]-p,i=a[2]-p;n<-t?h=e:i>t&&(h=-e)}this.wrapAroundShift=h,this.isWrapAround=h!==0}_updatePerspectiveTransform(e,t){let n=this._vertices;a(b,[0,0,e,0,0,t,e,t],[n[0],n[1],n[4],n[5],n[2],n[3],n[6],n[7]]),u(this.perspectiveTransform,b[6]/b[8]*e,b[7]/b[8]*t)}}export{C as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{on as e}from"../../../../core/events.js";import t from"../../../../core/Handles.js";import{disposeMaybe as n}from"../../../../core/maybe.js";import{when as r,initial as i}from"../../../../core/reactiveUtils.js";import{createScreenPoint as a}from"../../../../core/screenUtils.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import s from"../../../../geometry/Point.js";import c from"../../../../geometry/Polygon.js";import{project as l}from"../../../../geometry/projectionUtils.js";import u from"../../../../layers/support/ControlPoint.js";import{DisplayObject as d}from"../DisplayObject.js";import f from"../../../layers/support/GeometryClipArea.js";import p from"../../../webgl/Texture.js";import{TextureDescriptor as m}from"../../../webgl/TextureDescriptor.js";class h extends d{constructor(n){super(),this.element=n,this._handles=new t,this.isWrapAround=!1,this.perspectiveTransform=o(),this.wrapAroundShift=0,this.clipGeometry=null,this._handles.add(r(()=>this.element,()=>{let t=this.element;this.ready(),t&&this._handles.add(e(t,`play`,()=>this.requestRender()))},i))}getMesh(e){throw Error(`Method not implemented.`)}destroy(){super.destroy(),this._handles.destroy(),this.texture=n(this.texture)}get textureSize(){if(!this.texture)return[1,1];let e=this.texture.descriptor;return[e.width,e.height]}beforeRender(e){let t=this.element;if(t==null)return;let{context:n}=e,{videoWidth:r,videoHeight:i}=t;if(r!==0&&i!==0){if(this.texture)t.paused||e.animationsEnabled&&this.texture.setData(t);else{let e=new m(r,i);e.wrapMode=33071,e.preMultiplyAlpha=!0,this.texture=new p(n,e,t)}!t.paused&&this._vertices!=null&&this.texture.generateMipmap(),super.beforeRender(e)}}_createTransforms(){return null}updateDrawCoords(e,t,n,r){let i=this.element,a=this._getFrameInfo();if(!i||!a)return;let{spatialReference:o}=n;this._initializeData(e,a,o);let{controlPoints:s,horizon:u}=a,d=Math.sqrt(s.length),p=d,{x:m,y:h}=e,g=this._vertices,_=s[0],v=s[d-1],y=s[(p-1)*d],b=s[(p-1)*d+d-1],x=l(u?u[0].mapPoint:_.mapPoint,o),S=l(u?u[1].mapPoint:v.mapPoint,o),C=l(y.mapPoint,o),w=l(b.mapPoint,o);this.clipGeometry=u?new f({geometry:c.fromJSON({rings:[[[C.x,C.y],[w.x,w.y],[S.x,S.y],[x.x,x.y],[C.x,C.y]]],spatialReference:o})}):null;for(let e=0;e<s.length;e++){let{sourcePoint:t,mapPoint:n}=s[e];if(t==null||n==null)continue;let r=l(n,o);g[e*2+0]=r.x-m,g[e*2+1]=r.y-h}let T=t;if(r){let e=Math.min(x.x,S.x,C.x,w.x),t=Math.max(x.x,S.x,C.x,w.x),{worldWidth:n,xBounds:i}=r,[a,o]=i;e<a&&t>a?T=n:t>o&&e<o&&(T=-n)}this.wrapAroundShift=T,this.isWrapAround=T!==0}draw(e,t){this.visible&&(!this.isReady||!this._vertices||!this._indices||!this._texCoords?this.requestRender():(this.stage||console.warn(`OverlayMultipoint: stage is null`),t.render(e,{config:{perspective:this.perspectiveTransform,texSize:this.textureSize,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity},texture:{texture:this.texture,unit:0},position:this._vertices,tex:this._texCoords,index:this._indices})))}_initializeData(e,t,n){if(this._vertices!=null&&this._indices!=null)return;let{controlPoints:r}=t,i=Math.sqrt(r.length),a=i,o=new Float32Array(2*r.length),s=new Uint16Array(2*r.length);for(let t=0;t<r.length;t++){let{sourcePoint:i,mapPoint:a}=r[t];if(i==null||a==null)continue;let c=l(a,n);o[t*2+0]=c.x-e.x,o[t*2+1]=c.y-e.y,s[t*2+0]=i.x,s[t*2+1]=i.y}let c=new Uint16Array(a*i+(a-2)*(i+2)),u=0;for(let e=0;e<a;e++){for(let t=0;t<i;t++)c[u++]=e*i+t,c[u++]=(e+1)*i+t;e<a-2&&(c[u++]=(e+1)*i+(i-1),c[u++]=(e+1)*i)}this._vertices=o,this._texCoords=s,this._indices=c}_getFrameInfo(){if(!this.groundControlPoints)return null;let e=this._getFrameControlPoints(),t=this.frameHorizonPoints,n=null;if(t){let e=t.startX,r=t.startY,i=t.endX,o=t.endY;n=[new u({sourcePoint:a(e,r),mapPoint:new s(t.startLongitude,t.startLatitude)}),new u({sourcePoint:a(i,o),mapPoint:new s(t.endLongitude,t.endLatitude)})]}return{controlPoints:e,horizon:n}}_getFrameControlPoints(){let e=this.groundControlPoints,t=e?.length;if(!t)return[];let n=Array(t),r=Math.max(...e.map(({x:e})=>e)),i=this.element.videoWidth/r;for(let r=0;r<t;r++){let{x:t,y:o,lat:c,lon:l}=e[r];n[r]=new u({sourcePoint:a(t*i,-o*i),mapPoint:new s(l,c)})}return n}}export{h as default};
2
+ import{on as e}from"../../../../core/events.js";import t from"../../../../core/Handles.js";import{disposeMaybe as n}from"../../../../core/maybe.js";import{when as r,initial as i}from"../../../../core/reactiveUtils.js";import{createScreenPoint as a}from"../../../../core/screenUtils.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import s from"../../../../geometry/Point.js";import c from"../../../../geometry/Polygon.js";import{project as l}from"../../../../geometry/projectionUtils.js";import u from"../../../../layers/support/ControlPoint.js";import{DisplayObject as d}from"../DisplayObject.js";import f from"../../../layers/support/GeometryClipArea.js";import{Texture as p}from"../../../webgl/Texture.js";import{TextureDescriptor as m}from"../../../webgl/TextureDescriptor.js";class h extends d{constructor(n){super(),this.element=n,this._handles=new t,this.isWrapAround=!1,this.perspectiveTransform=o(),this.wrapAroundShift=0,this.clipGeometry=null,this._handles.add(r(()=>this.element,()=>{let t=this.element;this.ready(),t&&this._handles.add(e(t,`play`,()=>this.requestRender()))},i))}getMesh(e){throw Error(`Method not implemented.`)}destroy(){super.destroy(),this._handles.destroy(),this.texture=n(this.texture)}get textureSize(){if(!this.texture)return[1,1];let e=this.texture.descriptor;return[e.width,e.height]}beforeRender(e){let t=this.element;if(t==null)return;let{context:n}=e,{videoWidth:r,videoHeight:i}=t;if(r!==0&&i!==0){if(this.texture)t.paused||e.animationsEnabled&&this.texture.setData(t);else{let e=new m(r,i);e.wrapMode=33071,e.preMultiplyAlpha=!0,this.texture=new p(n,e,t)}!t.paused&&this._vertices!=null&&this.texture.generateMipmap(),super.beforeRender(e)}}_createTransforms(){return null}updateDrawCoords(e,t,n,r){let i=this.element,a=this._getFrameInfo();if(!i||!a)return;let{spatialReference:o}=n;this._initializeData(e,a,o);let{controlPoints:s,horizon:u}=a,d=Math.sqrt(s.length),p=d,{x:m,y:h}=e,g=this._vertices,_=s[0],v=s[d-1],y=s[(p-1)*d],b=s[(p-1)*d+d-1],x=l(u?u[0].mapPoint:_.mapPoint,o),S=l(u?u[1].mapPoint:v.mapPoint,o),C=l(y.mapPoint,o),w=l(b.mapPoint,o);this.clipGeometry=u?new f({geometry:c.fromJSON({rings:[[[C.x,C.y],[w.x,w.y],[S.x,S.y],[x.x,x.y],[C.x,C.y]]],spatialReference:o})}):null;for(let e=0;e<s.length;e++){let{sourcePoint:t,mapPoint:n}=s[e];if(t==null||n==null)continue;let r=l(n,o);g[e*2+0]=r.x-m,g[e*2+1]=r.y-h}let T=t;if(r){let e=Math.min(x.x,S.x,C.x,w.x),t=Math.max(x.x,S.x,C.x,w.x),{worldWidth:n,xBounds:i}=r,[a,o]=i;e<a&&t>a?T=n:t>o&&e<o&&(T=-n)}this.wrapAroundShift=T,this.isWrapAround=T!==0}draw(e,t){this.visible&&(!this.isReady||!this._vertices||!this._indices||!this._texCoords?this.requestRender():(this.stage||console.warn(`OverlayMultipoint: stage is null`),t.render(e,{config:{perspective:this.perspectiveTransform,texSize:this.textureSize,wrapAroundShift:this.wrapAroundShift,isWrapAround:this.isWrapAround,opacity:this.opacity},texture:{texture:this.texture,unit:0},position:this._vertices,tex:this._texCoords,index:this._indices})))}_initializeData(e,t,n){if(this._vertices!=null&&this._indices!=null)return;let{controlPoints:r}=t,i=Math.sqrt(r.length),a=i,o=new Float32Array(2*r.length),s=new Uint16Array(2*r.length);for(let t=0;t<r.length;t++){let{sourcePoint:i,mapPoint:a}=r[t];if(i==null||a==null)continue;let c=l(a,n);o[t*2+0]=c.x-e.x,o[t*2+1]=c.y-e.y,s[t*2+0]=i.x,s[t*2+1]=i.y}let c=new Uint16Array(a*i+(a-2)*(i+2)),u=0;for(let e=0;e<a;e++){for(let t=0;t<i;t++)c[u++]=e*i+t,c[u++]=(e+1)*i+t;e<a-2&&(c[u++]=(e+1)*i+(i-1),c[u++]=(e+1)*i)}this._vertices=o,this._texCoords=s,this._indices=c}_getFrameInfo(){if(!this.groundControlPoints)return null;let e=this._getFrameControlPoints(),t=this.frameHorizonPoints,n=null;if(t){let e=t.startX,r=t.startY,i=t.endX,o=t.endY;n=[new u({sourcePoint:a(e,r),mapPoint:new s(t.startLongitude,t.startLatitude)}),new u({sourcePoint:a(i,o),mapPoint:new s(t.endLongitude,t.endLatitude)})]}return{controlPoints:e,horizon:n}}_getFrameControlPoints(){let e=this.groundControlPoints,t=e?.length;if(!t)return[];let n=Array(t),r=Math.max(...e.map(({x:e})=>e)),i=this.element.videoWidth/r;for(let r=0;r<t;r++){let{x:t,y:o,lat:c,lon:l}=e[r];n[r]=new u({sourcePoint:a(t*i,-o*i),mapPoint:new s(l,c)})}return n}}export{h as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{spritePadding as t}from"./definitions.js";import{log2 as n}from"./GeometryUtils.js";import r from"./Rect.js";import i from"./RectangleBinPack.js";import a from"../../../webgl/Texture.js";import{TextureDescriptor as o}from"../../../webgl/TextureDescriptor.js";function s(e){return e&&e.type===`static`}class c{constructor(e,t,n=0){this._mosaicPages=[],this._maxItemSize=0,this._currentPage=0,this._pageWidth=0,this._pageHeight=0,this._mosaicRects=new Map,this._pageWidth=e,this._pageHeight=t,n>0&&(this._maxItemSize=n),this._binPack=new i(this._pageWidth,this._pageHeight);let r=Math.floor(this._pageWidth),a=Math.floor(this._pageHeight);this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(r*a)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0})}getSize(e){return e>=this._mosaicPages.length?[0,0]:this._mosaicPages[e].size}has(e){return this._mosaicRects.has(e)}getSpriteItem(e){return this._mosaicRects.get(e)}addSpriteItem(e,n,i,a,o,c,l=1,u=`Linear`,d=.5,f=1){if(this._mosaicRects.has(e))return this._mosaicRects.get(e);let p,m,h;if(s(i)?[p,m,h]=this._allocateImage(n[0],n[1]):(p=new r(0,0,n[0],n[1]),m=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:i,size:[n[0]+2*t,n[1]+2*t],dirty:!0,texture:void 0})),p.width<=0||p.height<=0)return null;let g={type:`sprite`,rect:p,width:n[0],height:n[1],sdf:o,simplePattern:c,rasterizationScale:l,samplingMode:u,sdfPaddingRatio:d,sdfDecodeCoeff:f,page:m};return this._mosaicRects.set(e,g),s(i)&&(has(`esri-mosaic-debug`)&&this._showDebugSprite(n,i.data),this._copy({rect:p,spriteSize:n,spriteData:i.data,page:m,pageSize:h,repeat:a,sdf:o})),g}getTexture(e,t=0){let{context:n}=e,r=this._mosaicPages[t],i=r.mosaicsData,a=r.texture;if(a||(a=u(n,r.size),r.texture=a),s(i))r.dirty&&(a.setData(new Uint8Array(i.data.buffer)),a.generateMipmap(),has(`esri-mosaic-debug`)&&this._showDebugPage(t));else{let t=i.data;t.update(e),t.hasFrameData&&(t.loadFrame(a),a.generateMipmap())}return r.dirty=!1,a}dispose(){this._binPack=null;for(let e of this._mosaicPages){let t=e.texture;t&&t.dispose();let n=e.mosaicsData;s(n)||n.data.destroy()}this._mosaicPages=null,this._mosaicRects.clear()}static _copyBits(e,t,n,r,i,a,o,s,c,l,u){let d=r*t+n,f=s*a+o;if(u){f-=a;for(let o=-1;o<=l;o++,d=((o+l)%l+r)*t+n,f+=a)for(let t=-1;t<=c;t++)i[f+t]=e[d+(t+c)%c]}else for(let n=0;n<l;n++){for(let t=0;t<c;t++)i[f+t]=e[d+t];d+=t,f+=a}}_copy(n){if(n.page>=this._mosaicPages.length)return;let r=this._mosaicPages[n.page],i=r.mosaicsData;if(!s(r.mosaicsData))throw new e(`mapview-invalid-resource`,`unsuitable data type!`);let a=n.spriteData,o=i.data;c._copyBits(a,n.spriteSize[0],0,0,o,n.pageSize[0],n.rect.x+t,n.rect.y+t,n.spriteSize[0],n.spriteSize[1],n.repeat),r.dirty=!0}_allocateImage(e,a){e+=2*t,a+=2*t;let o=Math.max(e,a);if(this._maxItemSize&&this._maxItemSize<o){let t=2**Math.ceil(n(e)),i=2**Math.ceil(n(a)),o=new r(0,0,e,a);return this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(t*i)},size:[t,i],dirty:!0,texture:void 0}),[o,this._mosaicPages.length-1,[t,i]]}let c=this._binPack.allocate(e,a);if(c.width<=0){let t=this._mosaicPages[this._currentPage];return!t.dirty&&s(t.mosaicsData)&&(t.mosaicsData.data=null),this._currentPage=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(this._pageWidth*this._pageHeight)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0}),this._binPack=new i(this._pageWidth,this._pageHeight),this._allocateImage(e,a)}return[c,this._currentPage,[this._pageWidth,this._pageHeight]]}_showDebugSprite([e,t],n){let r=document.createElement(`canvas`);r.width=e,r.height=t,r.setAttribute(`style`,`position: absolute; top: ${4+204*l++}px; right: 208px; width: 200px; height: 200px; border: 1px solid black;`);let i=r.getContext(`2d`),a=new ImageData(e,t);a.data.set(new Uint8Array(n.buffer)),i.putImageData(a,0,0),document.body.appendChild(r)}_showDebugPage(e){let{size:[t,n],mosaicsData:r}=this._mosaicPages[e];if(!s(r))return;let i=`mosaicDebugPage${e}`,a=document.getElementById(i)??document.createElement(`canvas`);a.id=i,a.width=t,a.height=n,a.setAttribute(`style`,`position: absolute; top: ${4+204*e}px; right: 4px; width: 200px; height: 200px; border: 1px solid black;`);let o=a.getContext(`2d`),c=new ImageData(t,n);c.data.set(new Uint8Array(r.data.buffer)),o.putImageData(c,0,0),document.body.appendChild(a)}}let l=0;function u(e,n){let r=new o(n[0],n[1]);return r.wrapMode=33071,r.maxMipLevel=Math.floor(Math.log2(t/2)),new a(e,r,null)}export{c as default};
2
+ import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{spritePadding as t}from"./definitions.js";import{log2 as n}from"./GeometryUtils.js";import r from"./Rect.js";import i from"./RectangleBinPack.js";import{Texture as a}from"../../../webgl/Texture.js";import{TextureDescriptor as o}from"../../../webgl/TextureDescriptor.js";function s(e){return e&&e.type===`static`}class c{constructor(e,t,n=0){this._mosaicPages=[],this._maxItemSize=0,this._currentPage=0,this._pageWidth=0,this._pageHeight=0,this._mosaicRects=new Map,this._pageWidth=e,this._pageHeight=t,n>0&&(this._maxItemSize=n),this._binPack=new i(this._pageWidth,this._pageHeight);let r=Math.floor(this._pageWidth),a=Math.floor(this._pageHeight);this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(r*a)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0})}getSize(e){return e>=this._mosaicPages.length?[0,0]:this._mosaicPages[e].size}has(e){return this._mosaicRects.has(e)}getSpriteItem(e){return this._mosaicRects.get(e)}addSpriteItem(e,n,i,a,o,c,l=1,u=`Linear`,d=.5,f=1){if(this._mosaicRects.has(e))return this._mosaicRects.get(e);let p,m,h;if(s(i)?[p,m,h]=this._allocateImage(n[0],n[1]):(p=new r(0,0,n[0],n[1]),m=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:i,size:[n[0]+2*t,n[1]+2*t],dirty:!0,texture:void 0})),p.width<=0||p.height<=0)return null;let g={type:`sprite`,rect:p,width:n[0],height:n[1],sdf:o,simplePattern:c,rasterizationScale:l,samplingMode:u,sdfPaddingRatio:d,sdfDecodeCoeff:f,page:m};return this._mosaicRects.set(e,g),s(i)&&(has(`esri-mosaic-debug`)&&this._showDebugSprite(n,i.data),this._copy({rect:p,spriteSize:n,spriteData:i.data,page:m,pageSize:h,repeat:a,sdf:o})),g}getTexture(e,t=0){let{context:n}=e,r=this._mosaicPages[t],i=r.mosaicsData,a=r.texture;if(a||(a=u(n,r.size),r.texture=a),s(i))r.dirty&&(a.setData(new Uint8Array(i.data.buffer)),a.generateMipmap(),has(`esri-mosaic-debug`)&&this._showDebugPage(t));else{let t=i.data;t.update(e),t.hasFrameData&&(t.loadFrame(a),a.generateMipmap())}return r.dirty=!1,a}dispose(){this._binPack=null;for(let e of this._mosaicPages){let t=e.texture;t&&t.dispose();let n=e.mosaicsData;s(n)||n.data.destroy()}this._mosaicPages=null,this._mosaicRects.clear()}static _copyBits(e,t,n,r,i,a,o,s,c,l,u){let d=r*t+n,f=s*a+o;if(u){f-=a;for(let o=-1;o<=l;o++,d=((o+l)%l+r)*t+n,f+=a)for(let t=-1;t<=c;t++)i[f+t]=e[d+(t+c)%c]}else for(let n=0;n<l;n++){for(let t=0;t<c;t++)i[f+t]=e[d+t];d+=t,f+=a}}_copy(n){if(n.page>=this._mosaicPages.length)return;let r=this._mosaicPages[n.page],i=r.mosaicsData;if(!s(r.mosaicsData))throw new e(`mapview-invalid-resource`,`unsuitable data type!`);let a=n.spriteData,o=i.data;c._copyBits(a,n.spriteSize[0],0,0,o,n.pageSize[0],n.rect.x+t,n.rect.y+t,n.spriteSize[0],n.spriteSize[1],n.repeat),r.dirty=!0}_allocateImage(e,a){e+=2*t,a+=2*t;let o=Math.max(e,a);if(this._maxItemSize&&this._maxItemSize<o){let t=2**Math.ceil(n(e)),i=2**Math.ceil(n(a)),o=new r(0,0,e,a);return this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(t*i)},size:[t,i],dirty:!0,texture:void 0}),[o,this._mosaicPages.length-1,[t,i]]}let c=this._binPack.allocate(e,a);if(c.width<=0){let t=this._mosaicPages[this._currentPage];return!t.dirty&&s(t.mosaicsData)&&(t.mosaicsData.data=null),this._currentPage=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(this._pageWidth*this._pageHeight)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0}),this._binPack=new i(this._pageWidth,this._pageHeight),this._allocateImage(e,a)}return[c,this._currentPage,[this._pageWidth,this._pageHeight]]}_showDebugSprite([e,t],n){let r=document.createElement(`canvas`);r.width=e,r.height=t,r.setAttribute(`style`,`position: absolute; top: ${4+204*l++}px; right: 208px; width: 200px; height: 200px; border: 1px solid black;`);let i=r.getContext(`2d`),a=new ImageData(e,t);a.data.set(new Uint8Array(n.buffer)),i.putImageData(a,0,0),document.body.appendChild(r)}_showDebugPage(e){let{size:[t,n],mosaicsData:r}=this._mosaicPages[e];if(!s(r))return;let i=`mosaicDebugPage${e}`,a=document.getElementById(i)??document.createElement(`canvas`);a.id=i,a.width=t,a.height=n,a.setAttribute(`style`,`position: absolute; top: ${4+204*e}px; right: 4px; width: 200px; height: 200px; border: 1px solid black;`);let o=a.getContext(`2d`),c=new ImageData(t,n);c.data.set(new Uint8Array(r.data.buffer)),o.putImageData(c,0,0),document.body.appendChild(a)}}let l=0;function u(e,n){let r=new o(n[0],n[1]);return r.wrapMode=33071,r.maxMipLevel=Math.floor(Math.log2(t/2)),new a(e,r,null)}export{c as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{disposeMaybe as e}from"../../../../core/maybe.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import r from"../../../../geometry/Point.js";import{projectLoad as i,projectExecute as a}from"../../../../geometry/operators/projectOperator.js";import{DisplayObject as o}from"../DisplayObject.js";import{VideoScreenTechnique as s}from"./shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js";import{ColorAttachment0 as c,SizedPixelFormat as l}from"../../../webgl/enums.js";import{DisposableFramebufferObject as u}from"../../../webgl/FramebufferObject.js";import d from"../../../webgl/Texture.js";import{TextureDescriptor as f}from"../../../webgl/TextureDescriptor.js";class p extends o{constructor(e,t){super(),this._controlPointsOwner=t,this.readbackScreenCoords=n(),this.videoTextureCoords=Array(36),this.overlayTextureCoords=Array(36),this._prevFBO=null,this._acquiredFBO=null,this._isBound=!1,this._hasCoordinates=!1,this._geIsLoaded=!1,this._ndcRect=[0,0,2,2],this._technique=new s,this.visible=!1,this.stage=e;for(let e=0;e<6;e++){let t=e/5;for(let n=0;n<6;n++){let r=n/5;this.videoTextureCoords[e*6+n]={u:r,v:t}}}}getMesh(e){throw Error(`Method not implemented.`)}destroy(){super.destroy(),e(this._readbackTexture)}bind(e){let{context:t,pixelRatio:n,state:r}=e;if(this._update(e),!this.ready||this.readbackScreenCoords[2]===0||this.readbackScreenCoords[3]===0)return this.requestRender(),!1;let{size:i}=r,a=Math.round(n*i[0]),o=Math.round(n*i[1]),s=new f(a,o);return s.samplingMode=9729,s.wrapMode=33071,this._acquiredFBO??=new u(t,s),this._acquiredFBO.resize(a,o),t.bindFramebuffer(this._acquiredFBO),this._isBound=!0,!0}unbind(e){if(!this._isBound)return;let{context:t,pixelRatio:n,state:r}=e,{size:i}=r,a=this._acquiredFBO;if(!a.getColorTexture(c))throw Error(`Failed to get color texture from FBO.`);let o=this._getReadbackTexture(e),s=this.readbackScreenCoords,l=Math.round(n*s[0]),u=Math.round(n*(i[1]-s[1]))-o.descriptor.height,d=l+o.descriptor.width,f=u+o.descriptor.height,p=Math.max(l,0),m=Math.max(u,0),h=Math.min(d,a.width),g=Math.min(f,a.height),_=h-p,v=g-m;_>0&&v>0&&a.copyToTexture(p,m,_,v,p-l,m-u,o),t.bindFramebuffer(this._prevFBO)}_update(e){let{state:n}=e,o=this._controlPointsOwner,s=o.groundControlPoints(),c=o.getSize(),l=n.size,u=s?.length;if(!u)return;if(i().then(()=>{this._geIsLoaded=!0}),!this._geIsLoaded){this.requestRender();return}let d=c[0],f=c[1],p=l[0],m=f/l[1],h=d/p;if(m>h){let e=h/m*2,t=(2-e)/2;this._ndcRect[0]=-1+t,this._ndcRect[1]=1,this._ndcRect[2]=e,this._ndcRect[3]=2}else{let e=m/h*2,t=(2-e)/2;this._ndcRect[0]=-1,this._ndcRect[1]=1-t,this._ndcRect[2]=2,this._ndcRect[3]=e}let g=Array(u),_=n.spatialReference;for(let e=0;e<u;e++){let{lat:t,lon:n}=s[e],i=new r(n,t);g[e]=a(i,_)}let v=[],y=1/0,b=1/0,x=-1/0,S=-1/0;for(let e of g){let r=t();n.toScreen(r,e.x,e.y),v.push({x:r[0],y:r[1]}),y=Math.min(y,r[0]),b=Math.min(b,r[1]),x=Math.max(x,r[0]),S=Math.max(S,r[1])}let C=[y,S],w=[x,b];this.readbackScreenCoords[0]=Math.max(Math.floor(C[0]),0),this.readbackScreenCoords[1]=Math.max(Math.floor(w[1]),0),this.readbackScreenCoords[2]=Math.ceil(w[0]),this.readbackScreenCoords[3]=Math.ceil(C[1]);for(let e=0;e<v.length;e++){let t=v[e],n=(t.x-y)/(x-y),r=(S-t.y)/(S-b);this.overlayTextureCoords[e]={u:n,v:r}}this._hasCoordinates=!0}_createTransforms(){return null}doRender(e){!this._readbackTexture||!this._hasCoordinates?this.requestRender():this._technique.render(e,{texture:this._readbackTexture,textureCoords:this.overlayTextureCoords,opacity:1,ndcRect:this._ndcRect})}_getReadbackTexture(e){let{context:t,pixelRatio:n}=e,r=Math.round(n*Math.abs(this.readbackScreenCoords[2]-this.readbackScreenCoords[0])),i=Math.round(n*Math.abs(this.readbackScreenCoords[3]-this.readbackScreenCoords[1]));if(this._readbackTexture)this._readbackTexture.resize(r,i);else{let e=new f(r,i);e.wrapMode=33071,e.internalFormat=l.RGBA8,this._readbackTexture=new d(t,e)}return this._readbackTexture}}export{p as default};
2
+ import{disposeMaybe as e}from"../../../../core/maybe.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec4f32.js";import r from"../../../../geometry/Point.js";import{projectLoad as i,projectExecute as a}from"../../../../geometry/operators/projectOperator.js";import{DisplayObject as o}from"../DisplayObject.js";import{VideoScreenTechnique as s}from"./shaderGraph/techniques/videoScreenRenderer/VideoScreenTechnique.js";import{ColorAttachment0 as c,SizedPixelFormat as l}from"../../../webgl/enums.js";import{DisposableFramebufferObject as u}from"../../../webgl/FramebufferObject.js";import{Texture as d}from"../../../webgl/Texture.js";import{TextureDescriptor as f}from"../../../webgl/TextureDescriptor.js";class p extends o{constructor(e,t){super(),this._controlPointsOwner=t,this.readbackScreenCoords=n(),this.videoTextureCoords=Array(36),this.overlayTextureCoords=Array(36),this._prevFBO=null,this._acquiredFBO=null,this._isBound=!1,this._hasCoordinates=!1,this._geIsLoaded=!1,this._ndcRect=[0,0,2,2],this._technique=new s,this.visible=!1,this.stage=e;for(let e=0;e<6;e++){let t=e/5;for(let n=0;n<6;n++){let r=n/5;this.videoTextureCoords[e*6+n]={u:r,v:t}}}}getMesh(e){throw Error(`Method not implemented.`)}destroy(){super.destroy(),e(this._readbackTexture)}bind(e){let{context:t,pixelRatio:n,state:r}=e;if(this._update(e),!this.ready||this.readbackScreenCoords[2]===0||this.readbackScreenCoords[3]===0)return this.requestRender(),!1;let{size:i}=r,a=Math.round(n*i[0]),o=Math.round(n*i[1]),s=new f(a,o);return s.samplingMode=9729,s.wrapMode=33071,this._acquiredFBO??=new u(t,s),this._acquiredFBO.resize(a,o),t.bindFramebuffer(this._acquiredFBO),this._isBound=!0,!0}unbind(e){if(!this._isBound)return;let{context:t,pixelRatio:n,state:r}=e,{size:i}=r,a=this._acquiredFBO;if(!a.getColorTexture(c))throw Error(`Failed to get color texture from FBO.`);let o=this._getReadbackTexture(e),s=this.readbackScreenCoords,l=Math.round(n*s[0]),u=Math.round(n*(i[1]-s[1]))-o.descriptor.height,d=l+o.descriptor.width,f=u+o.descriptor.height,p=Math.max(l,0),m=Math.max(u,0),h=Math.min(d,a.width),g=Math.min(f,a.height),_=h-p,v=g-m;_>0&&v>0&&a.copyToTexture(p,m,_,v,p-l,m-u,o),t.bindFramebuffer(this._prevFBO)}_update(e){let{state:n}=e,o=this._controlPointsOwner,s=o.groundControlPoints(),c=o.getSize(),l=n.size,u=s?.length;if(!u)return;if(i().then(()=>{this._geIsLoaded=!0}),!this._geIsLoaded){this.requestRender();return}let d=c[0],f=c[1],p=l[0],m=f/l[1],h=d/p;if(m>h){let e=h/m*2,t=(2-e)/2;this._ndcRect[0]=-1+t,this._ndcRect[1]=1,this._ndcRect[2]=e,this._ndcRect[3]=2}else{let e=m/h*2,t=(2-e)/2;this._ndcRect[0]=-1,this._ndcRect[1]=1-t,this._ndcRect[2]=2,this._ndcRect[3]=e}let g=Array(u),_=n.spatialReference;for(let e=0;e<u;e++){let{lat:t,lon:n}=s[e],i=new r(n,t);g[e]=a(i,_)}let v=[],y=1/0,b=1/0,x=-1/0,S=-1/0;for(let e of g){let r=t();n.toScreen(r,e.x,e.y),v.push({x:r[0],y:r[1]}),y=Math.min(y,r[0]),b=Math.min(b,r[1]),x=Math.max(x,r[0]),S=Math.max(S,r[1])}let C=[y,S],w=[x,b];this.readbackScreenCoords[0]=Math.max(Math.floor(C[0]),0),this.readbackScreenCoords[1]=Math.max(Math.floor(w[1]),0),this.readbackScreenCoords[2]=Math.ceil(w[0]),this.readbackScreenCoords[3]=Math.ceil(C[1]);for(let e=0;e<v.length;e++){let t=v[e],n=(t.x-y)/(x-y),r=(S-t.y)/(S-b);this.overlayTextureCoords[e]={u:n,v:r}}this._hasCoordinates=!0}_createTransforms(){return null}doRender(e){!this._readbackTexture||!this._hasCoordinates?this.requestRender():this._technique.render(e,{texture:this._readbackTexture,textureCoords:this.overlayTextureCoords,opacity:1,ndcRect:this._ndcRect})}_getReadbackTexture(e){let{context:t,pixelRatio:n}=e,r=Math.round(n*Math.abs(this.readbackScreenCoords[2]-this.readbackScreenCoords[0])),i=Math.round(n*Math.abs(this.readbackScreenCoords[3]-this.readbackScreenCoords[1]));if(this._readbackTexture)this._readbackTexture.resize(r,i);else{let e=new f(r,i);e.wrapMode=33071,e.internalFormat=l.RGBA8,this._readbackTexture=new d(t,e)}return this._readbackTexture}}export{p as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{PixelType as e}from"../../../../../webgl/enums.js";import t from"../../../../../webgl/Texture.js";import{TextureDescriptor as n}from"../../../../../webgl/TextureDescriptor.js";import{ValidatedTextureDescriptor as r}from"../../../../../webgl/ValidatedTextureDescriptor.js";class i{constructor(){this._entries=new o,this._nodes=new Map,this._book=new s}add(e){let t=this._entries.get(e);if(!t){let n=this._book.add(e),r={};t={location:n,references:0,handle:r};let i=this._entries.set(e,t);this._nodes.set(r,i)}return t.references++,t}remove(e){let t=this._nodes.get(e.handle);t&&t.payload&&(t.payload.references--,t.payload.references===0&&(this._book.remove(t.payload.location),this._entries.delete(t),this._nodes.delete(e.handle)))}getTexture(e,t){return this._book.getTexture(e,t)}destroy(){this._book.destroy()}}class a{constructor(e,t){this.parent=e,this.key=t,this.payload=null,this._children=new Map}get(e){return this._children.get(e)}ensure(e){let t=this._children.get(e);return t||(t=new a(this,e),this._children.set(e,t)),t}delete(e){this._children.delete(e)}}class o{constructor(){this._root=new a(null,NaN)}set(e,t){let n=this._root;for(let t of e)for(let e of t)n=n.ensure(e);return n.payload=t,n}delete(e){e.parent?.delete(e.key)}get(e){let t=this._root;for(let n of e)for(let e of n){let n=t.get(e);if(!n)return;t=n}return t.payload||void 0}}class s{constructor(){this._pages=[]}add(e){this._pages.length===0&&this._pages.push(new c);let t=this._pages.length-1,n=this._pages[t].add(e);if(n||=(this._pages.push(new c),t=this._pages.length-1,this._pages[t].add(e)),!n)throw Error(`Data allocation failed.`);return{...n,page:t}}remove(e){this._pages[e.page].remove(e)}getTexture(e,t){return this._pages[t].getTexture(e)}destroy(){}}class c{constructor(){this._cursor={row:0,column:0},this._columns=1024,this._rows=1024,this._data=new Float32Array(this._columns*this._rows*4),this._texture=null,this._textureCursor={row:0,column:0}}add(e){if(e.length>this._columns)throw Error(`The maximum allocation size is ${this._columns} texels.`);let t={...this._cursor};if(t.column+=e.length,t.column>=this._columns&&(t.column=e.length,t.row++),t.row>=this._rows)return null;this._cursor=t;let n={...this._cursor};n.column-=e.length;let r=4*(n.row*this._columns+n.column);for(let t=0;t<e.length;t++)this._data[r++]=e[t][0],this._data[r++]=e[t][1],this._data[r++]=e[t][2],this._data[r++]=e[t][3];return n}remove(e){}getTexture(i){if(!this._texture){let a=new n(this._columns,this._rows);a.pixelFormat=6408,a.dataType=e.FLOAT,a.wrapMode=33071,a.samplingMode=9728,a.hasMipmap=!1;let o=new r(i,a);this._texture=new t(i,o)}if(this._cursor.row===this._textureCursor.row&&this._cursor.column===this._textureCursor.column)return this._texture;let a=this._textureCursor.row,o=this._cursor.row-a+1;return this._texture.updateData(0,0,a,this._columns,o,this._data,a),this._textureCursor.row=this._cursor.row,this._textureCursor.column=this._cursor.column,this._texture}destroy(){this._texture?.dispose()}}export{i as AnimationStore,o as PrefixMap};
2
+ import{PixelType as e}from"../../../../../webgl/enums.js";import{Texture as t}from"../../../../../webgl/Texture.js";import{TextureDescriptor as n}from"../../../../../webgl/TextureDescriptor.js";import{ValidatedTextureDescriptor as r}from"../../../../../webgl/ValidatedTextureDescriptor.js";class i{constructor(){this._entries=new o,this._nodes=new Map,this._book=new s}add(e){let t=this._entries.get(e);if(!t){let n=this._book.add(e),r={};t={location:n,references:0,handle:r};let i=this._entries.set(e,t);this._nodes.set(r,i)}return t.references++,t}remove(e){let t=this._nodes.get(e.handle);t&&t.payload&&(t.payload.references--,t.payload.references===0&&(this._book.remove(t.payload.location),this._entries.delete(t),this._nodes.delete(e.handle)))}getTexture(e,t){return this._book.getTexture(e,t)}destroy(){this._book.destroy()}}class a{constructor(e,t){this.parent=e,this.key=t,this.payload=null,this._children=new Map}get(e){return this._children.get(e)}ensure(e){let t=this._children.get(e);return t||(t=new a(this,e),this._children.set(e,t)),t}delete(e){this._children.delete(e)}}class o{constructor(){this._root=new a(null,NaN)}set(e,t){let n=this._root;for(let t of e)for(let e of t)n=n.ensure(e);return n.payload=t,n}delete(e){e.parent?.delete(e.key)}get(e){let t=this._root;for(let n of e)for(let e of n){let n=t.get(e);if(!n)return;t=n}return t.payload||void 0}}class s{constructor(){this._pages=[]}add(e){this._pages.length===0&&this._pages.push(new c);let t=this._pages.length-1,n=this._pages[t].add(e);if(n||=(this._pages.push(new c),t=this._pages.length-1,this._pages[t].add(e)),!n)throw Error(`Data allocation failed.`);return{...n,page:t}}remove(e){this._pages[e.page].remove(e)}getTexture(e,t){return this._pages[t].getTexture(e)}destroy(){}}class c{constructor(){this._cursor={row:0,column:0},this._columns=1024,this._rows=1024,this._data=new Float32Array(this._columns*this._rows*4),this._texture=null,this._textureCursor={row:0,column:0}}add(e){if(e.length>this._columns)throw Error(`The maximum allocation size is ${this._columns} texels.`);let t={...this._cursor};if(t.column+=e.length,t.column>=this._columns&&(t.column=e.length,t.row++),t.row>=this._rows)return null;this._cursor=t;let n={...this._cursor};n.column-=e.length;let r=4*(n.row*this._columns+n.column);for(let t=0;t<e.length;t++)this._data[r++]=e[t][0],this._data[r++]=e[t][1],this._data[r++]=e[t][2],this._data[r++]=e[t][3];return n}remove(e){}getTexture(i){if(!this._texture){let a=new n(this._columns,this._rows);a.pixelFormat=6408,a.dataType=e.FLOAT,a.wrapMode=33071,a.samplingMode=9728,a.hasMipmap=!1;let o=new r(i,a);this._texture=new t(i,o)}if(this._cursor.row===this._textureCursor.row&&this._cursor.column===this._textureCursor.column)return this._texture;let a=this._textureCursor.row,o=this._cursor.row-a+1;return this._texture.updateData(0,0,a,this._columns,o,this._data,a),this._textureCursor.row=this._cursor.row,this._textureCursor.column=this._cursor.column,this._texture}destroy(){this._texture?.dispose()}}export{i as AnimationStore,o as PrefixMap};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../../core/Logger.js";import{labelAnchorStoreUnit as t,labelStoreUnit as n}from"../definitions.js";import{PixelType as r}from"../../../../webgl/enums.js";import i from"../../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../../webgl/TextureDescriptor.js";const o=()=>e.getLogger(`esri.views.2d.engine.webgl.collisions.LabelStore`);class s{constructor(){this._data=new Uint8Array(4096),this._anchors=new Float32Array(4096),this._dirtyStart=0,this._dirtyEnd=0,this._entries=new Map,this._freeIds=[],this._nextId=1,this._size=32,this._data[3]=255}get size(){return this._size}get usedMemory(){return this._data.byteLength+this._anchors.byteLength}destroy(){this._entries.size&&o().warn(`InternalError: Leaking label store entries`),this._texture?.dispose(),this._anchorTexture?.dispose(),this._texture=null,this._anchorTexture=null,this._entries.clear(),this._freeIds.length=0}acquire(e){if(e.labelStoreId!=null)return e.labelStoreId;let t=this._freeIds.pop()??this._nextId++;return this._ensureCapacity(t),this._entries.set(t,e),this._writeFeatureId(t,e.displayId),this._writeAnchor(t,e.anchorX,e.anchorY),this._data[t*4+3]=255,this._markDirty(t),e.labelStoreId=t,t}release(e){let t=e.labelStoreId;if(t!=null){if(this._entries.get(t)!==e)throw Error(`InternalError: expected label store entry`);this._entries.delete(t),this._data.fill(0,t*4,t*4+4),this._data[t*4+3]=255,this._anchors.fill(0,t*4,t*4+4),this._markDirty(t),e.labelStoreId=null,this._freeIds.push(t)}}invalidateColliders(){for(let e of this._entries.values())e.invalidateColliders()}setVisibility(e,t){let n=e.labelStoreId;if(n==null||this._entries.get(n)!==e)throw Error(`InternalError: expected label metric to have a store id`);let r=t?0:255,i=n*4+3;this._writeReferenceSymbolVVOffset(n,e.referenceSymbolVVOffset),this._data[i]!==r&&(this._data[i]=r,this._markDirty(n))}getVisibility(e){let t=e.labelStoreId;return t==null?255:this._data[t*4+3]}has(e){return e.labelStoreId!=null&&this._entries.get(e.labelStoreId)===e}getAnchor(e){if(!this._entries.has(e))return null;let t=e*4;return[this._anchors[t],this._anchors[t+1]]}getReferenceSymbolVVOffset(e){if(!this._entries.has(e))return null;let t=e*4;return[this._anchors[t+2],this._anchors[t+3]]}upload(e){let t=this._texture??this._createTexture(e,!1),n=this._anchorTexture??this._createTexture(e,!0);this._uploadDirty(t,n)}getTexture(e){let r=this._texture??this._createTexture(e,!1),i=this._anchorTexture??this._createTexture(e,!0);if(this._dirtyStart!==1/0)throw Error(`InternalError: expected label store to be uploaded before rendering`);return{labelStoreTexture:{texture:r,unit:n},labelAnchorStoreTexture:{texture:i,unit:t}}}_createTexture(e,t){let n=new a(this._size);n.wrapMode=33071,n.samplingMode=9728,n.pixelFormat=6408,n.dataType=t?r.FLOAT:r.UNSIGNED_BYTE;let o=new i(e,n,t?this._anchors:this._data);return t?this._anchorTexture=o:this._texture=o,o}_ensureCapacity(e){if(e<this._size*this._size)return;let t=this._size;for(;e>=t*t;)t*=2;let n=new Uint8Array(t*t*4);n.set(this._data),this._data=n;let r=new Float32Array(t*t*4);r.set(this._anchors),this._anchors=r,this._size=t,this._texture?.dispose(),this._anchorTexture?.dispose(),this._texture=null,this._anchorTexture=null,this._dirtyStart=0,this._dirtyEnd=e}_writeFeatureId(e,t){let n=e*4;this._data[n]=t&255,this._data[n+1]=t>>8&255,this._data[n+2]=t>>16&255,this._markDirty(e)}_writeAnchor(e,t,n){let r=e*4;this._anchors[r]=t,this._anchors[r+1]=n,this._markDirty(e)}_writeReferenceSymbolVVOffset(e,[t,n]){let r=e*4;(this._anchors[r+2]!==t||this._anchors[r+3]!==n)&&(this._anchors[r+2]=t,this._anchors[r+3]=n,this._markDirty(e))}_markDirty(e){this._dirtyStart=Math.min(this._dirtyStart,e),this._dirtyEnd=Math.max(this._dirtyEnd,e)}_uploadDirty(e,t){if(this._dirtyStart===1/0)return;let n=Math.floor(this._dirtyStart/this._size),r=Math.floor(this._dirtyEnd/this._size),i=n*this._size*4,a=(r+1)*this._size*4;e.updateData(0,0,n,this._size,r-n+1,this._data.subarray(i,a)),t.updateData(0,0,n,this._size,r-n+1,this._anchors.subarray(i,a)),this._dirtyStart=1/0,this._dirtyEnd=0}}export{s as LabelStore};
2
+ import e from"../../../../../core/Logger.js";import{labelAnchorStoreUnit as t,labelStoreUnit as n}from"../definitions.js";import{PixelType as r}from"../../../../webgl/enums.js";import{Texture as i}from"../../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../../webgl/TextureDescriptor.js";const o=()=>e.getLogger(`esri.views.2d.engine.webgl.collisions.LabelStore`);class s{constructor(){this._data=new Uint8Array(4096),this._anchors=new Float32Array(4096),this._dirtyStart=0,this._dirtyEnd=0,this._entries=new Map,this._freeIds=[],this._nextId=1,this._size=32,this._data[3]=255}get size(){return this._size}get usedMemory(){return this._data.byteLength+this._anchors.byteLength}destroy(){this._entries.size&&o().warn(`InternalError: Leaking label store entries`),this._texture?.dispose(),this._anchorTexture?.dispose(),this._texture=null,this._anchorTexture=null,this._entries.clear(),this._freeIds.length=0}acquire(e){if(e.labelStoreId!=null)return e.labelStoreId;let t=this._freeIds.pop()??this._nextId++;return this._ensureCapacity(t),this._entries.set(t,e),this._writeFeatureId(t,e.displayId),this._writeAnchor(t,e.anchorX,e.anchorY),this._data[t*4+3]=255,this._markDirty(t),e.labelStoreId=t,t}release(e){let t=e.labelStoreId;if(t!=null){if(this._entries.get(t)!==e)throw Error(`InternalError: expected label store entry`);this._entries.delete(t),this._data.fill(0,t*4,t*4+4),this._data[t*4+3]=255,this._anchors.fill(0,t*4,t*4+4),this._markDirty(t),e.labelStoreId=null,this._freeIds.push(t)}}invalidateColliders(){for(let e of this._entries.values())e.invalidateColliders()}setVisibility(e,t){let n=e.labelStoreId;if(n==null||this._entries.get(n)!==e)throw Error(`InternalError: expected label metric to have a store id`);let r=t?0:255,i=n*4+3;this._writeReferenceSymbolVVOffset(n,e.referenceSymbolVVOffset),this._data[i]!==r&&(this._data[i]=r,this._markDirty(n))}getVisibility(e){let t=e.labelStoreId;return t==null?255:this._data[t*4+3]}has(e){return e.labelStoreId!=null&&this._entries.get(e.labelStoreId)===e}getAnchor(e){if(!this._entries.has(e))return null;let t=e*4;return[this._anchors[t],this._anchors[t+1]]}getReferenceSymbolVVOffset(e){if(!this._entries.has(e))return null;let t=e*4;return[this._anchors[t+2],this._anchors[t+3]]}upload(e){let t=this._texture??this._createTexture(e,!1),n=this._anchorTexture??this._createTexture(e,!0);this._uploadDirty(t,n)}getTexture(e){let r=this._texture??this._createTexture(e,!1),i=this._anchorTexture??this._createTexture(e,!0);if(this._dirtyStart!==1/0)throw Error(`InternalError: expected label store to be uploaded before rendering`);return{labelStoreTexture:{texture:r,unit:n},labelAnchorStoreTexture:{texture:i,unit:t}}}_createTexture(e,t){let n=new a(this._size);n.wrapMode=33071,n.samplingMode=9728,n.pixelFormat=6408,n.dataType=t?r.FLOAT:r.UNSIGNED_BYTE;let o=new i(e,n,t?this._anchors:this._data);return t?this._anchorTexture=o:this._texture=o,o}_ensureCapacity(e){if(e<this._size*this._size)return;let t=this._size;for(;e>=t*t;)t*=2;let n=new Uint8Array(t*t*4);n.set(this._data),this._data=n;let r=new Float32Array(t*t*4);r.set(this._anchors),this._anchors=r,this._size=t,this._texture?.dispose(),this._anchorTexture?.dispose(),this._texture=null,this._anchorTexture=null,this._dirtyStart=0,this._dirtyEnd=e}_writeFeatureId(e,t){let n=e*4;this._data[n]=t&255,this._data[n+1]=t>>8&255,this._data[n+2]=t>>16&255,this._markDirty(e)}_writeAnchor(e,t,n){let r=e*4;this._anchors[r]=t,this._anchors[r+1]=n,this._markDirty(e)}_writeReferenceSymbolVVOffset(e,[t,n]){let r=e*4;(this._anchors[r+2]!==t||this._anchors[r+3]!==n)&&(this._anchors[r+2]=t,this._anchors[r+3]=n,this._markDirty(e))}_markDirty(e){this._dirtyStart=Math.min(this._dirtyStart,e),this._dirtyEnd=Math.max(this._dirtyEnd,e)}_uploadDirty(e,t){if(this._dirtyStart===1/0)return;let n=Math.floor(this._dirtyStart/this._size),r=Math.floor(this._dirtyEnd/this._size),i=n*this._size*4,a=(r+1)*this._size*4;e.updateData(0,0,n,this._size,r-n+1,this._data.subarray(i,a)),t.updateData(0,0,n,this._size,r-n+1,this._anchors.subarray(i,a)),this._dirtyStart=1/0,this._dirtyEnd=0}}export{s as LabelStore};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../../../core/Logger.js";import{maxHighlightGroups as t}from"../../definitions.js";import{shadeTextureSize as n,sigma as r}from"./parameters.js";import i from"../../../../../support/HighlightOptions.js";import a from"../../../../../webgl/Texture.js";import{TextureDescriptor as o}from"../../../../../webgl/TextureDescriptor.js";const s=()=>e.getLogger(`esri.views.2d.engine.webgl.painter.highlight.HighlightGradient`);function c(e,t){t.fillColor[0]=e.color.r/255,t.fillColor[1]=e.color.g/255,t.fillColor[2]=e.color.b/255,t.fillColor[3]=e.color.a,e.haloColor?(t.outlineColor[0]=e.haloColor.r/255,t.outlineColor[1]=e.haloColor.g/255,t.outlineColor[2]=e.haloColor.b/255,t.outlineColor[3]=e.haloColor.a):(t.outlineColor[0]=t.fillColor[0],t.outlineColor[1]=t.fillColor[1],t.outlineColor[2]=t.fillColor[2],t.outlineColor[3]=t.fillColor[3]),t.fillColor[3]*=e.fillOpacity,t.outlineColor[3]*=e.haloOpacity,t.fillColor[0]*=t.fillColor[3],t.fillColor[1]*=t.fillColor[3],t.fillColor[2]*=t.fillColor[3],t.outlineColor[0]*=t.outlineColor[3],t.outlineColor[1]*=t.outlineColor[3],t.outlineColor[2]*=t.outlineColor[3],t.outlineWidth=(1-e.haloBlur)*e.haloWidth,t.outerHaloWidth=e.haloBlur*e.haloWidth/2,t.innerHaloWidth=e.haloBlur*e.haloWidth/2,t.outlinePosition=0}const l=[0,0,0,0];class u{constructor(){this.type=`single`,this._highlightOptions=new i,this._convertedHighlightOptions={fillColor:[0,0,0,0],outlineColor:[0,0,0,0],outlinePosition:0,outlineWidth:0,innerHaloWidth:0,outerHaloWidth:0},this._optionsShadeTexKey=``,this._texelData=new Uint8Array(n*4),this._minMaxDistance=[0,0]}setHighlightOptions(e){this._highlightOptions=e}getProgramState(e){return this._updateGradientTexture(e),{minMaxDistance:this._minMaxDistance,shadeTexture:this._shadeTex}}destroy(){this._shadeTex?.dispose(),this._shadeTex=null}getGroupsWithGradients(){return[{activeGroups:(1<<t)-1,activeGradient:this}]}_updateGradientTexture(e){let t=d(this._highlightOptions);if(t===this._optionsShadeTexKey)return;this._optionsShadeTexKey=t,c(this._highlightOptions,this._convertedHighlightOptions);let i=this._convertedHighlightOptions,u=i.outlinePosition-i.outlineWidth/2-i.outerHaloWidth,f=i.outlinePosition-i.outlineWidth/2,p=i.outlinePosition+i.outlineWidth/2,m=i.outlinePosition+i.outlineWidth/2+i.innerHaloWidth,h=Math.sqrt(Math.PI/2)*r,g=Math.abs(u)>h?Math.round((Math.abs(u)-h)*10)/10:0,_=Math.abs(m)>h?Math.round((Math.abs(m)-h)*10)/10:0;g&&!_?s().error(`The outer rim of the highlight is `+g+`px away from the edge of the feature; consider reducing some width values or shifting the outline position towards positive values (inwards).`):!g&&_?s().error(`The inner rim of the highlight is `+_+`px away from the edge of the feature; consider reducing some width values or shifting the outline position towards negative values (outwards).`):g&&_&&s().error(`The highlight is `+Math.max(g,_)+`px away from the edge of the feature; consider reducing some width values.`);let v,y=[void 0,void 0,void 0,void 0];function b(e,t,n){y[0]=(1-n)*e[0]+n*t[0],y[1]=(1-n)*e[1]+n*t[1],y[2]=(1-n)*e[2]+n*t[2],y[3]=(1-n)*e[3]+n*t[3]}let{_texelData:x}=this;for(let e=0;e<n;++e)v=u+e/(n-1)*(m-u),v<u?(y[0]=0,y[1]=0,y[2]=0,y[3]=0):v<f?b(l,i.outlineColor,(v-u)/(f-u)):v<p?[y[0],y[1],y[2],y[3]]=i.outlineColor:v<m?b(i.outlineColor,i.fillColor,(v-p)/(m-p)):[y[0],y[1],y[2],y[3]]=i.fillColor,x[e*4]=255*y[0],x[e*4+1]=255*y[1],x[e*4+2]=255*y[2],x[e*4+3]=255*y[3];if(this._minMaxDistance[0]=u,this._minMaxDistance[1]=m,!this._shadeTex){let t=new o(n,1);t.wrapMode=33071,this._shadeTex=new a(e,t)}this._shadeTex.updateData(0,0,0,n,1,this._texelData)}}function d(e){return`${e.color};${e.haloColor};${e.haloOpacity};${e.fillOpacity};${e.haloWidth};${e.haloBlur}`}export{u as default};
2
+ import e from"../../../../../../core/Logger.js";import{maxHighlightGroups as t}from"../../definitions.js";import{shadeTextureSize as n,sigma as r}from"./parameters.js";import i from"../../../../../support/HighlightOptions.js";import{Texture as a}from"../../../../../webgl/Texture.js";import{TextureDescriptor as o}from"../../../../../webgl/TextureDescriptor.js";const s=()=>e.getLogger(`esri.views.2d.engine.webgl.painter.highlight.HighlightGradient`);function c(e,t){t.fillColor[0]=e.color.r/255,t.fillColor[1]=e.color.g/255,t.fillColor[2]=e.color.b/255,t.fillColor[3]=e.color.a,e.haloColor?(t.outlineColor[0]=e.haloColor.r/255,t.outlineColor[1]=e.haloColor.g/255,t.outlineColor[2]=e.haloColor.b/255,t.outlineColor[3]=e.haloColor.a):(t.outlineColor[0]=t.fillColor[0],t.outlineColor[1]=t.fillColor[1],t.outlineColor[2]=t.fillColor[2],t.outlineColor[3]=t.fillColor[3]),t.fillColor[3]*=e.fillOpacity,t.outlineColor[3]*=e.haloOpacity,t.fillColor[0]*=t.fillColor[3],t.fillColor[1]*=t.fillColor[3],t.fillColor[2]*=t.fillColor[3],t.outlineColor[0]*=t.outlineColor[3],t.outlineColor[1]*=t.outlineColor[3],t.outlineColor[2]*=t.outlineColor[3],t.outlineWidth=(1-e.haloBlur)*e.haloWidth,t.outerHaloWidth=e.haloBlur*e.haloWidth/2,t.innerHaloWidth=e.haloBlur*e.haloWidth/2,t.outlinePosition=0}const l=[0,0,0,0];class u{constructor(){this.type=`single`,this._highlightOptions=new i,this._convertedHighlightOptions={fillColor:[0,0,0,0],outlineColor:[0,0,0,0],outlinePosition:0,outlineWidth:0,innerHaloWidth:0,outerHaloWidth:0},this._optionsShadeTexKey=``,this._texelData=new Uint8Array(n*4),this._minMaxDistance=[0,0]}setHighlightOptions(e){this._highlightOptions=e}getProgramState(e){return this._updateGradientTexture(e),{minMaxDistance:this._minMaxDistance,shadeTexture:this._shadeTex}}destroy(){this._shadeTex?.dispose(),this._shadeTex=null}getGroupsWithGradients(){return[{activeGroups:(1<<t)-1,activeGradient:this}]}_updateGradientTexture(e){let t=d(this._highlightOptions);if(t===this._optionsShadeTexKey)return;this._optionsShadeTexKey=t,c(this._highlightOptions,this._convertedHighlightOptions);let i=this._convertedHighlightOptions,u=i.outlinePosition-i.outlineWidth/2-i.outerHaloWidth,f=i.outlinePosition-i.outlineWidth/2,p=i.outlinePosition+i.outlineWidth/2,m=i.outlinePosition+i.outlineWidth/2+i.innerHaloWidth,h=Math.sqrt(Math.PI/2)*r,g=Math.abs(u)>h?Math.round((Math.abs(u)-h)*10)/10:0,_=Math.abs(m)>h?Math.round((Math.abs(m)-h)*10)/10:0;g&&!_?s().error(`The outer rim of the highlight is `+g+`px away from the edge of the feature; consider reducing some width values or shifting the outline position towards positive values (inwards).`):!g&&_?s().error(`The inner rim of the highlight is `+_+`px away from the edge of the feature; consider reducing some width values or shifting the outline position towards negative values (outwards).`):g&&_&&s().error(`The highlight is `+Math.max(g,_)+`px away from the edge of the feature; consider reducing some width values.`);let v,y=[void 0,void 0,void 0,void 0];function b(e,t,n){y[0]=(1-n)*e[0]+n*t[0],y[1]=(1-n)*e[1]+n*t[1],y[2]=(1-n)*e[2]+n*t[2],y[3]=(1-n)*e[3]+n*t[3]}let{_texelData:x}=this;for(let e=0;e<n;++e)v=u+e/(n-1)*(m-u),v<u?(y[0]=0,y[1]=0,y[2]=0,y[3]=0):v<f?b(l,i.outlineColor,(v-u)/(f-u)):v<p?[y[0],y[1],y[2],y[3]]=i.outlineColor:v<m?b(i.outlineColor,i.fillColor,(v-p)/(m-p)):[y[0],y[1],y[2],y[3]]=i.fillColor,x[e*4]=255*y[0],x[e*4+1]=255*y[1],x[e*4+2]=255*y[2],x[e*4+3]=255*y[3];if(this._minMaxDistance[0]=u,this._minMaxDistance[1]=m,!this._shadeTex){let t=new o(n,1);t.wrapMode=33071,this._shadeTex=new a(e,t)}this._shadeTex.updateData(0,0,0,n,1,this._texelData)}}function d(e){return`${e.color};${e.haloColor};${e.haloOpacity};${e.fillOpacity};${e.haloWidth};${e.haloBlur}`}export{u as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import"../../../../../../core/has.js";import{isPowerOfTwo as e,nextPowerOfTwo as t}from"../../../../../../core/mathUtils.js";import{disposeMaybe as n}from"../../../../../../core/maybe.js";import{simplePipelineState as r}from"../utils.js";import{Technique as i}from"./Technique.js";import{TextureStatisticsDiffShader as a}from"./shaders/TextureStatisticsDiffShader.js";import{TextureStatisticsMinMaxSumShader as o}from"./shaders/TextureStatisticsMinMaxSumShader.js";import{TextureStatisticsStdDevShader as s}from"./shaders/TextureStatisticsStdDevShader.js";import{TextureStatisticsSumOfSquaredDiffShader as c}from"./shaders/TextureStatisticsSumOfSquaredDiffShader.js";import{getWebGLCapabilities as l}from"../../../../../webgl/capabilities.js";import{ColorAttachment2 as u,ColorAttachment3 as d,ColorAttachment0 as f,ColorAttachment1 as p,SizedPixelFormat as m,PixelType as h}from"../../../../../webgl/enums.js";import{DisposableFramebufferObject as g}from"../../../../../webgl/FramebufferObject.js";import _ from"../../../../../webgl/Texture.js";import{TextureDescriptor as v}from"../../../../../webgl/TextureDescriptor.js";const y=1048576;class b extends i{constructor(){super(...arguments),this.type=36,this._width=0,this._height=0,this._framebuffers=null,this._minTexture=null,this._maxTexture=null,this._sumTexture=null,this._numOfNoDataTexture=null,this._resultsFramebuffer=null,this._startFramebuffer=null,this._diffFramebuffer=null,this._scaleFbo=null,this.shaders={textureStatisticsMinMaxSum:new o,textureStatisticsSum:new c,textureStatisticsDiff:new a,textureStatisticsStdDev:new s}}dispose(){this.shaders.textureStatisticsMinMaxSum=null,this._framebuffers&&=(this._framebuffers.forEach(e=>n(e)),null),n(this._resultsFramebuffer),n(this._startFramebuffer),n(this._diffFramebuffer),n(this._scaleFbo),n(this._minTexture),n(this._maxTexture),n(this._sumTexture),n(this._numOfNoDataTexture)}get minValuesTexture(){return this._minTexture||null}get maxValuesTexture(){return this._maxTexture||null}get meanValuesTexture(){return this._resultsFramebuffer?.getColorTexture(u)||null}get stdDevValuesTexture(){return this._resultsFramebuffer?.getColorTexture(d)||null}get statsFbo(){return this._resultsFramebuffer}render(t,n){let{context:i,painter:a}=t,o=n.fbo.width,s=n.fbo.height,c=n.fbo,l=i.gl,u=i.boundFramebuffer;if(o*s>y||!e(o)||!e(s)){let r=o/s;if(o*s>y){let e=Math.max(Math.floor(Math.sqrt(y/r)),1);o=Math.max(Math.floor(r*e),1),s=e}if(e(o)||(o=w(o)),e(s)||(s=w(s)),this._scaleFbo)this._scaleFbo.resize(o,s);else{let{dataType:e,internalFormat:t}=n.fbo.getColorTexture(f).descriptor,r=t??m.RGBA8;this._scaleFbo=S(i,o,s,e,r)}i.bindFramebuffer(this._scaleFbo),i.setViewport(0,0,o,s),a.blitTexture(t,c.getColorTexture(f),9728),c=this._scaleFbo}this._updateResources(t,c),a.setPipelineState({...r,color:{write:[!0,!0,!0,!0],blendMode:`none`}});let d=this._applyReductionPass(t);l.readBuffer(l.COLOR_ATTACHMENT3),d.copyToTexture(0,0,1,1,0,0,this._numOfNoDataTexture),l.readBuffer(l.COLOR_ATTACHMENT2),d.copyToTexture(0,0,1,1,0,0,this._sumTexture),l.readBuffer(l.COLOR_ATTACHMENT1),d.copyToTexture(0,0,1,1,0,0,this._maxTexture),l.readBuffer(l.COLOR_ATTACHMENT0),d.copyToTexture(0,0,1,1,0,0,this._minTexture);let p=n.fbo.getColorTexture(f);if(!p)throw Error(`Start buffer color texture is not available, cannot compute diff.`);this._computeDiff(t,p,this._sumTexture,this._numOfNoDataTexture,o,s);let h=this._applySecondReductionPass(t,o,s).getColorTexture(f);this._computeSdtDev(t,this._minTexture,this._maxTexture,this._sumTexture,this._numOfNoDataTexture,h,o,s),i.bindFramebuffer(u),i.setViewport(0,0,n.fbo.width,n.fbo.height),a.setPipelineState(r)}_applyReductionPass(e){let{context:t,painter:n}=e,r=this.shaders.textureStatisticsMinMaxSum,i=this._framebuffers;if(i===null)throw Error(`Framebuffers are not initialized, cannot apply reduction pass.`);let a=this._startFramebuffer,o=a.getColorTexture(f),s=a.getColorTexture(p),c=a.getColorTexture(u),l=a.getColorTexture(d),m=o,h=s,g=c,_=l,v=i,y=0;for(let e of v){t.setViewport(0,0,e.width,e.height),t.bindFramebuffer(e),t.setClearColor(0,0,0,0),t.clear(16384);let i={shader:r,uniforms:{config:{width:e.width,height:e.height,isFirstPass:+(y===0)}},textures:{minTexture:{texture:m,unit:1},maxTexture:{texture:h,unit:2},sumTexture:{texture:g,unit:3},numOfNoDataTexture:{texture:_,unit:4}},defines:null,optionalAttributes:null,useComputeBuffer:!1};n.submitDrawMesh(t,i,n.quadMesh),m=e.getColorTexture(f),h=e.getColorTexture(p),g=e.getColorTexture(u),_=e.getColorTexture(d),y++}return i.at(-1)}_applySecondReductionPass(e,t,n){let{context:r,painter:i}=e,a=this.shaders.textureStatisticsSum,o=this._framebuffers;if(o===null||this._diffFramebuffer==null)throw Error(`Framebuffers are not initialized, cannot apply reduction pass.`);let s=this._diffFramebuffer.getColorTexture(f),c=o;for(let e of c){r.setViewport(0,0,e.width,e.height),r.bindFramebuffer(e),r.setClearColor(0,0,0,0),r.clear(16384);let t={shader:a,uniforms:{config:{width:e.width,height:e.height}},textures:{sumTexture:{texture:s,unit:2}},defines:null,optionalAttributes:null,useComputeBuffer:!1};i.submitDrawMesh(r,t,i.quadMesh),s=e.getColorTexture(f)}return o.at(-1)}_updateResources(e,t){let{context:n}=e,r=t.width,i=t.height;if(this._startFramebuffer===null){if(!l().supportsColorBufferFloat)throw Error(`WebGL does not support color buffer float, cannot compute texture statistics.`);let e=t.getColorTexture(f);if(!e)throw Error(`Input FBO does not have a color attachment 0, cannot compute texture statistics.`);let{dataType:a,internalFormat:o}=e.descriptor,s=S(n,r,i,a,o??m.RGBA8,4),c=s.getColorTexture(f),g=s.getColorTexture(p),_=s.getColorTexture(u),v=s.getColorTexture(d);t.copyToTexture(0,0,r,i,0,0,c),t.copyToTexture(0,0,r,i,0,0,g),t.copyToTexture(0,0,r,i,0,0,_),t.copyToTexture(0,0,r,i,0,0,v),this._startFramebuffer=s,this._diffFramebuffer=S(n,r,i,h.FLOAT,m.RGBA32F),this._resultsFramebuffer=S(n,1,1,h.FLOAT,m.RGBA32F,4),this._minTexture=C(n,1,1,h.FLOAT,m.RGBA32F),this._maxTexture=C(n,1,1,h.FLOAT,m.RGBA32F),this._sumTexture=C(n,1,1,h.FLOAT,m.RGBA32F),this._numOfNoDataTexture=C(n,1,1,h.FLOAT,m.R32F)}else{let e=this._startFramebuffer;e.resize(r,i);let n=e.getColorTexture(f),a=e.getColorTexture(p),o=e.getColorTexture(u),s=e.getColorTexture(d);t.copyToTexture(0,0,r,i,0,0,n),t.copyToTexture(0,0,r,i,0,0,a),t.copyToTexture(0,0,r,i,0,0,o),t.copyToTexture(0,0,r,i,0,0,s),this._diffFramebuffer.resize(r,i)}if(this._width===r&&this._height===i&&this._framebuffers!==null)return;let a=(this._framebuffers||[]).reverse();this._framebuffers=null,this._width=r,this._height=i,this._framebuffers=this._updateFramebuffers(n,r,i,a,4)}_updateFramebuffers(e,t,r,i,a=1){let o=[],s=t,c=r;for(;s>1||c>1;){let t=Math.max(1,Math.floor(s/2)),n=Math.max(1,Math.floor(c/2)),r=x(e,t,n,i,a);o.push(r),s=t,c=n}return o.at(-1),i.forEach(e=>n(e)),i.length=0,o}_computeDiff(e,t,n,r,i,a){let{context:o,painter:s}=e;o.bindFramebuffer(this._diffFramebuffer),o.setViewport(0,0,i,a),o.setClearColor(0,0,0,0),o.clear(16384);let c={shader:this.shaders.textureStatisticsDiff,uniforms:{config:{numTexels:i*a}},textures:{inputTexture:{texture:t,unit:1},sumTexture:{texture:n,unit:2},numOfNoDataTexture:{texture:r,unit:3}},defines:null,optionalAttributes:null,useComputeBuffer:!1};s.submitDrawMesh(o,c,s.quadMesh)}_computeSdtDev(e,t,n,r,i,a,o,s){let{context:c,painter:l}=e;c.bindFramebuffer(this._resultsFramebuffer),c.setViewport(0,0,1,1),c.setClearColor(0,0,0,0),c.clear(16384);let u={shader:this.shaders.textureStatisticsStdDev,uniforms:{config:{numTexels:o*s}},textures:{minTexture:{texture:t,unit:1},maxTexture:{texture:n,unit:2},sumTexture:{texture:r,unit:3},numOfNoDataTexture:{texture:i,unit:4},diffSqTexture:{texture:a,unit:5}},defines:null,optionalAttributes:null,useComputeBuffer:!1};l.submitDrawMesh(c,u,l.quadMesh)}}function x(e,t,n,r,i=1){let a=r.pop();return a===void 0?a=S(e,t,n,h.FLOAT,m.RGBA32F,i):a.resize(t,n),a}function S(e,t,n,r,i,a=1){if(a<1||a>4)throw Error(`Number of color attachments must be between 1 and 4.`);let o=new g(e,C(e,t,n,r,i));for(let s=1;s<a;s++){let a=C(e,t,n,r,i);o.attachColorTexture(a,f+s)}return o}function C(e,t,n,r,i){let a=new v(t,n);return a.samplingMode=9728,a.wrapMode=33071,a.pixelFormat=6408,a.dataType=r,a.internalFormat=i,new _(e,a)}function w(e){let n=t(e),r=n/2;return Math.abs(n-e)<Math.abs(r-e)?n:r}export{b as TextureStatisticsTechnique};
2
+ import"../../../../../../core/has.js";import{isPowerOfTwo as e,nextPowerOfTwo as t}from"../../../../../../core/mathUtils.js";import{disposeMaybe as n}from"../../../../../../core/maybe.js";import{simplePipelineState as r}from"../utils.js";import{Technique as i}from"./Technique.js";import{TextureStatisticsDiffShader as a}from"./shaders/TextureStatisticsDiffShader.js";import{TextureStatisticsMinMaxSumShader as o}from"./shaders/TextureStatisticsMinMaxSumShader.js";import{TextureStatisticsStdDevShader as s}from"./shaders/TextureStatisticsStdDevShader.js";import{TextureStatisticsSumOfSquaredDiffShader as c}from"./shaders/TextureStatisticsSumOfSquaredDiffShader.js";import{getWebGLCapabilities as l}from"../../../../../webgl/capabilities.js";import{ColorAttachment2 as u,ColorAttachment3 as d,ColorAttachment0 as f,ColorAttachment1 as p,SizedPixelFormat as m,PixelType as h}from"../../../../../webgl/enums.js";import{DisposableFramebufferObject as g}from"../../../../../webgl/FramebufferObject.js";import{Texture as _}from"../../../../../webgl/Texture.js";import{TextureDescriptor as v}from"../../../../../webgl/TextureDescriptor.js";const y=1048576;class b extends i{constructor(){super(...arguments),this.type=36,this._width=0,this._height=0,this._framebuffers=null,this._minTexture=null,this._maxTexture=null,this._sumTexture=null,this._numOfNoDataTexture=null,this._resultsFramebuffer=null,this._startFramebuffer=null,this._diffFramebuffer=null,this._scaleFbo=null,this.shaders={textureStatisticsMinMaxSum:new o,textureStatisticsSum:new c,textureStatisticsDiff:new a,textureStatisticsStdDev:new s}}dispose(){this.shaders.textureStatisticsMinMaxSum=null,this._framebuffers&&=(this._framebuffers.forEach(e=>n(e)),null),n(this._resultsFramebuffer),n(this._startFramebuffer),n(this._diffFramebuffer),n(this._scaleFbo),n(this._minTexture),n(this._maxTexture),n(this._sumTexture),n(this._numOfNoDataTexture)}get minValuesTexture(){return this._minTexture||null}get maxValuesTexture(){return this._maxTexture||null}get meanValuesTexture(){return this._resultsFramebuffer?.getColorTexture(u)||null}get stdDevValuesTexture(){return this._resultsFramebuffer?.getColorTexture(d)||null}get statsFbo(){return this._resultsFramebuffer}render(t,n){let{context:i,painter:a}=t,o=n.fbo.width,s=n.fbo.height,c=n.fbo,l=i.gl,u=i.boundFramebuffer;if(o*s>y||!e(o)||!e(s)){let r=o/s;if(o*s>y){let e=Math.max(Math.floor(Math.sqrt(y/r)),1);o=Math.max(Math.floor(r*e),1),s=e}if(e(o)||(o=w(o)),e(s)||(s=w(s)),this._scaleFbo)this._scaleFbo.resize(o,s);else{let{dataType:e,internalFormat:t}=n.fbo.getColorTexture(f).descriptor,r=t??m.RGBA8;this._scaleFbo=S(i,o,s,e,r)}i.bindFramebuffer(this._scaleFbo),i.setViewport(0,0,o,s),a.blitTexture(t,c.getColorTexture(f),9728),c=this._scaleFbo}this._updateResources(t,c),a.setPipelineState({...r,color:{write:[!0,!0,!0,!0],blendMode:`none`}});let d=this._applyReductionPass(t);l.readBuffer(l.COLOR_ATTACHMENT3),d.copyToTexture(0,0,1,1,0,0,this._numOfNoDataTexture),l.readBuffer(l.COLOR_ATTACHMENT2),d.copyToTexture(0,0,1,1,0,0,this._sumTexture),l.readBuffer(l.COLOR_ATTACHMENT1),d.copyToTexture(0,0,1,1,0,0,this._maxTexture),l.readBuffer(l.COLOR_ATTACHMENT0),d.copyToTexture(0,0,1,1,0,0,this._minTexture);let p=n.fbo.getColorTexture(f);if(!p)throw Error(`Start buffer color texture is not available, cannot compute diff.`);this._computeDiff(t,p,this._sumTexture,this._numOfNoDataTexture,o,s);let h=this._applySecondReductionPass(t,o,s).getColorTexture(f);this._computeSdtDev(t,this._minTexture,this._maxTexture,this._sumTexture,this._numOfNoDataTexture,h,o,s),i.bindFramebuffer(u),i.setViewport(0,0,n.fbo.width,n.fbo.height),a.setPipelineState(r)}_applyReductionPass(e){let{context:t,painter:n}=e,r=this.shaders.textureStatisticsMinMaxSum,i=this._framebuffers;if(i===null)throw Error(`Framebuffers are not initialized, cannot apply reduction pass.`);let a=this._startFramebuffer,o=a.getColorTexture(f),s=a.getColorTexture(p),c=a.getColorTexture(u),l=a.getColorTexture(d),m=o,h=s,g=c,_=l,v=i,y=0;for(let e of v){t.setViewport(0,0,e.width,e.height),t.bindFramebuffer(e),t.setClearColor(0,0,0,0),t.clear(16384);let i={shader:r,uniforms:{config:{width:e.width,height:e.height,isFirstPass:+(y===0)}},textures:{minTexture:{texture:m,unit:1},maxTexture:{texture:h,unit:2},sumTexture:{texture:g,unit:3},numOfNoDataTexture:{texture:_,unit:4}},defines:null,optionalAttributes:null,useComputeBuffer:!1};n.submitDrawMesh(t,i,n.quadMesh),m=e.getColorTexture(f),h=e.getColorTexture(p),g=e.getColorTexture(u),_=e.getColorTexture(d),y++}return i.at(-1)}_applySecondReductionPass(e,t,n){let{context:r,painter:i}=e,a=this.shaders.textureStatisticsSum,o=this._framebuffers;if(o===null||this._diffFramebuffer==null)throw Error(`Framebuffers are not initialized, cannot apply reduction pass.`);let s=this._diffFramebuffer.getColorTexture(f),c=o;for(let e of c){r.setViewport(0,0,e.width,e.height),r.bindFramebuffer(e),r.setClearColor(0,0,0,0),r.clear(16384);let t={shader:a,uniforms:{config:{width:e.width,height:e.height}},textures:{sumTexture:{texture:s,unit:2}},defines:null,optionalAttributes:null,useComputeBuffer:!1};i.submitDrawMesh(r,t,i.quadMesh),s=e.getColorTexture(f)}return o.at(-1)}_updateResources(e,t){let{context:n}=e,r=t.width,i=t.height;if(this._startFramebuffer===null){if(!l().supportsColorBufferFloat)throw Error(`WebGL does not support color buffer float, cannot compute texture statistics.`);let e=t.getColorTexture(f);if(!e)throw Error(`Input FBO does not have a color attachment 0, cannot compute texture statistics.`);let{dataType:a,internalFormat:o}=e.descriptor,s=S(n,r,i,a,o??m.RGBA8,4),c=s.getColorTexture(f),g=s.getColorTexture(p),_=s.getColorTexture(u),v=s.getColorTexture(d);t.copyToTexture(0,0,r,i,0,0,c),t.copyToTexture(0,0,r,i,0,0,g),t.copyToTexture(0,0,r,i,0,0,_),t.copyToTexture(0,0,r,i,0,0,v),this._startFramebuffer=s,this._diffFramebuffer=S(n,r,i,h.FLOAT,m.RGBA32F),this._resultsFramebuffer=S(n,1,1,h.FLOAT,m.RGBA32F,4),this._minTexture=C(n,1,1,h.FLOAT,m.RGBA32F),this._maxTexture=C(n,1,1,h.FLOAT,m.RGBA32F),this._sumTexture=C(n,1,1,h.FLOAT,m.RGBA32F),this._numOfNoDataTexture=C(n,1,1,h.FLOAT,m.R32F)}else{let e=this._startFramebuffer;e.resize(r,i);let n=e.getColorTexture(f),a=e.getColorTexture(p),o=e.getColorTexture(u),s=e.getColorTexture(d);t.copyToTexture(0,0,r,i,0,0,n),t.copyToTexture(0,0,r,i,0,0,a),t.copyToTexture(0,0,r,i,0,0,o),t.copyToTexture(0,0,r,i,0,0,s),this._diffFramebuffer.resize(r,i)}if(this._width===r&&this._height===i&&this._framebuffers!==null)return;let a=(this._framebuffers||[]).reverse();this._framebuffers=null,this._width=r,this._height=i,this._framebuffers=this._updateFramebuffers(n,r,i,a,4)}_updateFramebuffers(e,t,r,i,a=1){let o=[],s=t,c=r;for(;s>1||c>1;){let t=Math.max(1,Math.floor(s/2)),n=Math.max(1,Math.floor(c/2)),r=x(e,t,n,i,a);o.push(r),s=t,c=n}return o.at(-1),i.forEach(e=>n(e)),i.length=0,o}_computeDiff(e,t,n,r,i,a){let{context:o,painter:s}=e;o.bindFramebuffer(this._diffFramebuffer),o.setViewport(0,0,i,a),o.setClearColor(0,0,0,0),o.clear(16384);let c={shader:this.shaders.textureStatisticsDiff,uniforms:{config:{numTexels:i*a}},textures:{inputTexture:{texture:t,unit:1},sumTexture:{texture:n,unit:2},numOfNoDataTexture:{texture:r,unit:3}},defines:null,optionalAttributes:null,useComputeBuffer:!1};s.submitDrawMesh(o,c,s.quadMesh)}_computeSdtDev(e,t,n,r,i,a,o,s){let{context:c,painter:l}=e;c.bindFramebuffer(this._resultsFramebuffer),c.setViewport(0,0,1,1),c.setClearColor(0,0,0,0),c.clear(16384);let u={shader:this.shaders.textureStatisticsStdDev,uniforms:{config:{numTexels:o*s}},textures:{minTexture:{texture:t,unit:1},maxTexture:{texture:n,unit:2},sumTexture:{texture:r,unit:3},numOfNoDataTexture:{texture:i,unit:4},diffSqTexture:{texture:a,unit:5}},defines:null,optionalAttributes:null,useComputeBuffer:!1};l.submitDrawMesh(c,u,l.quadMesh)}}function x(e,t,n,r,i=1){let a=r.pop();return a===void 0?a=S(e,t,n,h.FLOAT,m.RGBA32F,i):a.resize(t,n),a}function S(e,t,n,r,i,a=1){if(a<1||a>4)throw Error(`Number of color attachments must be between 1 and 4.`);let o=new g(e,C(e,t,n,r,i));for(let s=1;s<a;s++){let a=C(e,t,n,r,i);o.attachColorTexture(a,f+s)}return o}function C(e,t,n,r,i){let a=new v(t,n);return a.samplingMode=9728,a.wrapMode=33071,a.pixelFormat=6408,a.dataType=r,a.internalFormat=i,new _(e,a)}function w(e){let n=t(e),r=n/2;return Math.abs(n-e)<Math.abs(r-e)?n:r}export{b as TextureStatisticsTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{simplePipelineState as e}from"../../utils.js";import{Technique as t}from"../Technique.js";import{BlendShader as n}from"../shaders/BlendShader.js";import{OpacityShader as r}from"../shaders/OpacityShader.js";import i from"../../../../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../../../../webgl/TextureDescriptor.js";class o extends t{constructor(){super(...arguments),this.type=5,this._backBufferTexture=null,this.shaders={blend:new n,opacity:new r}}shutdown(){super.shutdown(),this._backBufferTexture!==null&&(this._backBufferTexture.dispose(),this._backBufferTexture=null)}render(t,n){let{context:r,state:i,pixelRatio:a,inFadeTransition:o,painter:s}=t,{size:c}=i,l=r.boundFramebuffer,u,d;l==null?(u=Math.round(a*c[0]),d=Math.round(a*c[1])):(u=l.width,d=l.height);let{blendMode:f}=n;if(f===`normal`){let t={shader:this.shaders.opacity,uniforms:{config:{opacity:n.config.opacity}},textures:{layerTexture:{texture:n.colorTexture,unit:0}},defines:null,optionalAttributes:null,useComputeBuffer:!1};s.setPipelineState(e),s.submitDrawMesh(r,t,s.quadMesh);return}let p=this._createOrResizeTexture(t,u,d);l?.copyToTexture(0,0,u,d,0,0,p);let m={...e,color:{write:[!0,!0,!0,!0],blendMode:`custom`,blendParameters:{srcRGB:1,dstRGB:0,srcAlpha:1,dstAlpha:0},blendEquation:32774},depth:!1,stencil:!1};s.setPipelineState(m);let h={inFadeOpacity:+!!o,...n.config},g={shader:this.shaders.blend,uniforms:{config:h},textures:{backbufferTexture:{texture:p,unit:0},layerTexture:{texture:n.colorTexture,unit:1}},defines:{blendMode:f},optionalAttributes:null,useComputeBuffer:!1};s.submitDrawMesh(r,g,s.quadMesh)}_createOrResizeTexture(e,t,n){let{context:r}=e;if(this._backBufferTexture!==null&&this._backBufferTexture.descriptor?.width===t&&this._backBufferTexture.descriptor?.height===n)return this._backBufferTexture;if(this._backBufferTexture===null){let e=new a(t,n);e.internalFormat=6408,e.wrapMode=33071,this._backBufferTexture=new i(r,e)}else this._backBufferTexture.resize(t,n);return this._backBufferTexture}}export{o as BlendTechnique};
2
+ import{simplePipelineState as e}from"../../utils.js";import{Technique as t}from"../Technique.js";import{BlendShader as n}from"../shaders/BlendShader.js";import{OpacityShader as r}from"../shaders/OpacityShader.js";import{Texture as i}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../../../../webgl/TextureDescriptor.js";class o extends t{constructor(){super(...arguments),this.type=5,this._backBufferTexture=null,this.shaders={blend:new n,opacity:new r}}shutdown(){super.shutdown(),this._backBufferTexture!==null&&(this._backBufferTexture.dispose(),this._backBufferTexture=null)}render(t,n){let{context:r,state:i,pixelRatio:a,inFadeTransition:o,painter:s}=t,{size:c}=i,l=r.boundFramebuffer,u,d;l==null?(u=Math.round(a*c[0]),d=Math.round(a*c[1])):(u=l.width,d=l.height);let{blendMode:f}=n;if(f===`normal`){let t={shader:this.shaders.opacity,uniforms:{config:{opacity:n.config.opacity}},textures:{layerTexture:{texture:n.colorTexture,unit:0}},defines:null,optionalAttributes:null,useComputeBuffer:!1};s.setPipelineState(e),s.submitDrawMesh(r,t,s.quadMesh);return}let p=this._createOrResizeTexture(t,u,d);l?.copyToTexture(0,0,u,d,0,0,p);let m={...e,color:{write:[!0,!0,!0,!0],blendMode:`custom`,blendParameters:{srcRGB:1,dstRGB:0,srcAlpha:1,dstAlpha:0},blendEquation:32774},depth:!1,stencil:!1};s.setPipelineState(m);let h={inFadeOpacity:+!!o,...n.config},g={shader:this.shaders.blend,uniforms:{config:h},textures:{backbufferTexture:{texture:p,unit:0},layerTexture:{texture:n.colorTexture,unit:1}},defines:{blendMode:f},optionalAttributes:null,useComputeBuffer:!1};s.submitDrawMesh(r,g,s.quadMesh)}_createOrResizeTexture(e,t,n){let{context:r}=e;if(this._backBufferTexture!==null&&this._backBufferTexture.descriptor?.width===t&&this._backBufferTexture.descriptor?.height===n)return this._backBufferTexture;if(this._backBufferTexture===null){let e=new a(t,n);e.internalFormat=6408,e.wrapMode=33071,this._backBufferTexture=new i(r,e)}else this._backBufferTexture.resize(t,n);return this._backBufferTexture}}export{o as BlendTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{disposeMaybe as e}from"../../../../../../../core/maybe.js";import{simplePipelineState as t}from"../../utils.js";import{Technique as n}from"../Technique.js";import{FilterEffectShader as r}from"../shaders/ColorizeShader.js";import i from"../../../../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../../../../webgl/TextureDescriptor.js";class o extends n{constructor(){super(...arguments),this.type=9,this._layerFBOTexture=null,this._size=[0,0],this.shaders={filterEffect:new r}}shutdown(){super.shutdown(),this._layerFBOTexture=e(this._layerFBOTexture)}render(e,n){let{width:r,height:i}=n.layerFBO;this._createOrResizeResources(e,r,i);let{context:a,painter:o}=e,s=n.effect.colorMatrix,c=this._layerFBOTexture;a.bindFramebuffer(n.layerFBO),n.layerFBO.copyToTexture(0,0,r,i,0,0,c),o.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:`none`},depth:!1,stencil:!1});let l={coefficients:s};o.submitDrawMesh(a,{shader:this.shaders.filterEffect,uniforms:{filterEffectConfig:l},textures:{colorTexture:{texture:c,unit:2}},defines:null,optionalAttributes:null,useComputeBuffer:!1},o.quadMesh),o.setPipelineState({...t,stencil:{test:{mask:255,compare:514,op:{fail:7680,zFail:7680,zPass:7680}},write:!1}})}_createOrResizeResources(e,t,n){let{context:r}=e;if(!(this._layerFBOTexture&&this._size[0]===t&&this._size[1]===n)){if(this._size[0]=t,this._size[1]=n,this._layerFBOTexture)this._layerFBOTexture.resize(t,n);else{let e=new a(t,n);e.internalFormat=6408,e.wrapMode=33071,this._layerFBOTexture=new i(r,e)}}}}export{o as ColorizeTechnique};
2
+ import{disposeMaybe as e}from"../../../../../../../core/maybe.js";import{simplePipelineState as t}from"../../utils.js";import{Technique as n}from"../Technique.js";import{FilterEffectShader as r}from"../shaders/ColorizeShader.js";import{Texture as i}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as a}from"../../../../../../webgl/TextureDescriptor.js";class o extends n{constructor(){super(...arguments),this.type=9,this._layerFBOTexture=null,this._size=[0,0],this.shaders={filterEffect:new r}}shutdown(){super.shutdown(),this._layerFBOTexture=e(this._layerFBOTexture)}render(e,n){let{width:r,height:i}=n.layerFBO;this._createOrResizeResources(e,r,i);let{context:a,painter:o}=e,s=n.effect.colorMatrix,c=this._layerFBOTexture;a.bindFramebuffer(n.layerFBO),n.layerFBO.copyToTexture(0,0,r,i,0,0,c),o.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:`none`},depth:!1,stencil:!1});let l={coefficients:s};o.submitDrawMesh(a,{shader:this.shaders.filterEffect,uniforms:{filterEffectConfig:l},textures:{colorTexture:{texture:c,unit:2}},defines:null,optionalAttributes:null,useComputeBuffer:!1},o.quadMesh),o.setPipelineState({...t,stencil:{test:{mask:255,compare:514,op:{fail:7680,zFail:7680,zPass:7680}},write:!1}})}_createOrResizeResources(e,t,n){let{context:r}=e;if(!(this._layerFBOTexture&&this._size[0]===t&&this._size[1]===n)){if(this._size[0]=t,this._size[1]=n,this._layerFBOTexture)this._layerFBOTexture.resize(t,n);else{let e=new a(t,n);e.internalFormat=6408,e.wrapMode=33071,this._layerFBOTexture=new i(r,e)}}}}export{o as ColorizeTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../../../../core/RandomLCG.js";import{tileSize as t}from"../../../definitions.js";import{SimpleMesh as n}from"../../../meshing/SimpleMesh.js";import{SizedDepthStencilFormat as r,DataType as i,PrimitiveType as a,PixelType as o}from"../../../../../../webgl/enums.js";import{DisposableFramebufferObject as s}from"../../../../../../webgl/FramebufferObject.js";import{Renderbuffer as c}from"../../../../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as l}from"../../../../../../webgl/RenderbufferDescriptor.js";import u from"../../../../../../webgl/Texture.js";import{TextureDescriptor as d}from"../../../../../../webgl/TextureDescriptor.js";const f={pos:{count:2,type:i.UNSIGNED_SHORT}};class p{constructor(){this._dotTextureSize=0,this._dotTextures=null,this._dotMesh=null}destroy(){this._disposeTextures(),this._dotFBO?.dispose(),this._dotMesh?.destroy()}getFBO(e){if(this._dotFBO==null){let n=t,i=t,a=new d(n,i);a.samplingMode=9728,a.wrapMode=33071;let o=new c(e,new l(r.DEPTH24_STENCIL8,n,i));this._dotFBO=new s(e,a,o)}return this._dotFBO}getDotDensityMesh(e){if(this._dotMesh==null){let r=t,i=r*r,o=new Int16Array(i*2);for(let e=0;e<r;e++)for(let t=0;t<r;t++)o[2*(t+e*r)]=t,o[2*(t+e*r)+1]=e;this._dotMesh=n.create(e,{primitive:a.POINTS,vertex:o,count:i,layout:f})}return this._dotMesh}getDotDensityTextures(t,n,r){if((this._dotTextureSize!==n||this._seed!==r)&&(this._disposeTextures(),this._dotTextureSize=n,this._seed=r),this._dotTextures===null){let i=new e(r);this._dotTextures=[this._allocDotDensityTexture(t,n,i),this._allocDotDensityTexture(t,n,i)]}return this._dotTextures}_disposeTextures(){if(this._dotTextures){for(let e=0;e<this._dotTextures.length;e++)this._dotTextures[e].dispose();this._dotTextures=null}}_allocDotDensityTexture(e,t,n){let r=new Float32Array(t*t*4);for(let e=0;e<r.length;e++)r[e]=n.getFloat();let i=new d(t);return i.dataType=o.FLOAT,i.samplingMode=9728,new u(e,i,r)}}export{p as DotDensityResources};
2
+ import e from"../../../../../../../core/RandomLCG.js";import{tileSize as t}from"../../../definitions.js";import{SimpleMesh as n}from"../../../meshing/SimpleMesh.js";import{SizedDepthStencilFormat as r,DataType as i,PrimitiveType as a,PixelType as o}from"../../../../../../webgl/enums.js";import{DisposableFramebufferObject as s}from"../../../../../../webgl/FramebufferObject.js";import{Renderbuffer as c}from"../../../../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as l}from"../../../../../../webgl/RenderbufferDescriptor.js";import{Texture as u}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as d}from"../../../../../../webgl/TextureDescriptor.js";const f={pos:{count:2,type:i.UNSIGNED_SHORT}};class p{constructor(){this._dotTextureSize=0,this._dotTextures=null,this._dotMesh=null}destroy(){this._disposeTextures(),this._dotFBO?.dispose(),this._dotMesh?.destroy()}getFBO(e){if(this._dotFBO==null){let n=t,i=t,a=new d(n,i);a.samplingMode=9728,a.wrapMode=33071;let o=new c(e,new l(r.DEPTH24_STENCIL8,n,i));this._dotFBO=new s(e,a,o)}return this._dotFBO}getDotDensityMesh(e){if(this._dotMesh==null){let r=t,i=r*r,o=new Int16Array(i*2);for(let e=0;e<r;e++)for(let t=0;t<r;t++)o[2*(t+e*r)]=t,o[2*(t+e*r)+1]=e;this._dotMesh=n.create(e,{primitive:a.POINTS,vertex:o,count:i,layout:f})}return this._dotMesh}getDotDensityTextures(t,n,r){if((this._dotTextureSize!==n||this._seed!==r)&&(this._disposeTextures(),this._dotTextureSize=n,this._seed=r),this._dotTextures===null){let i=new e(r);this._dotTextures=[this._allocDotDensityTexture(t,n,i),this._allocDotDensityTexture(t,n,i)]}return this._dotTextures}_disposeTextures(){if(this._dotTextures){for(let e=0;e<this._dotTextures.length;e++)this._dotTextures[e].dispose();this._dotTextures=null}}_allocDotDensityTexture(e,t,n){let r=new Float32Array(t*t*4);for(let e=0;e<r.length;e++)r[e]=n.getFloat();let i=new d(t);return i.dataType=o.FLOAT,i.samplingMode=9728,new u(e,i,r)}}export{p as DotDensityResources};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{disposeMaybe as e}from"../../../../../../../core/maybe.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{simplePipelineState as n}from"../../utils.js";import{Technique as r}from"../Technique.js";import{GaussianBlurShader as i}from"../shaders/BlurShader.js";import{DropShadowCompositeShader as a}from"../shaders/DropShadowShader.js";import{DisposableFramebufferObject as o}from"../../../../../../webgl/FramebufferObject.js";import s from"../../../../../../webgl/Texture.js";import{TextureDescriptor as c}from"../../../../../../webgl/TextureDescriptor.js";const l=[1,0],u=[0,1];class d extends r{constructor(){super(...arguments),this.type=13,this._layerFBOTexture=null,this._horizontalBlurFBO=null,this._verticalBlurFBO=null,this._size=[0,0],this.shaders={gaussianBlur:new i,composite:new a}}shutdown(){super.shutdown(),this._horizontalBlurFBO=e(this._horizontalBlurFBO),this._verticalBlurFBO=e(this._verticalBlurFBO),this._layerFBOTexture=e(this._layerFBOTexture)}render(e,r){let{context:i,painter:a}=e,{layerFBO:o}=r,s=o.width,c=o.height,d=[Math.round(s),Math.round(c)],{blurRadius:f,offsetX:p,offsetY:m,color:h}=r.effect,g=[t(p),t(m)];this._createOrResizeResources(e,s,c,d);let _=this._horizontalBlurFBO,v=this._verticalBlurFBO;a.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:`none`},depth:{write:!1,test:!1},stencil:{write:{mask:0},test:!1}});let y=this._layerFBOTexture;o.copyToTexture(0,0,s,c,0,0,y),i.setViewport(0,0,d[0],d[1]),i.bindFramebuffer(_),a.submitDrawMesh(i,{shader:this.shaders.gaussianBlur,uniforms:{gaussianBlurConfig:{texSize:d,direction:l,sigma:f}},textures:{texture:{texture:o.colorTexture,unit:4}},defines:{kernelRadius:Math.ceil(f)},optionalAttributes:null,useComputeBuffer:!1},a.quadMesh),i.bindFramebuffer(v),a.submitDrawMesh(i,{shader:this.shaders.gaussianBlur,uniforms:{gaussianBlurConfig:{texSize:d,direction:u,sigma:f}},textures:{texture:{texture:_?.colorTexture,unit:5}},defines:{kernelRadius:Math.ceil(f)},optionalAttributes:null,useComputeBuffer:!1},a.quadMesh),i.bindFramebuffer(o),i.setViewport(0,0,s,c),a.submitDrawMesh(i,{shader:this.shaders.composite,uniforms:{compositeConfig:{shadowColor:[h[3]*(h[0]/255),h[3]*(h[1]/255),h[3]*(h[2]/255),h[3]],shadowOffset:g}},textures:{blurTexture:{texture:v?.colorTexture,unit:2},layerFBOTexture:{texture:y,unit:3}},defines:null,optionalAttributes:null,useComputeBuffer:!1},a.quadMesh),a.setPipelineState({...n,stencil:{test:{mask:255,compare:514,op:{fail:7680,zFail:7680,zPass:7680}},write:!1}})}_createOrResizeResources(e,t,n,r){let{context:i}=e;if(!(this._horizontalBlurFBO&&this._size[0]===t&&this._size[1]===n)){if(this._size[0]=t,this._size[1]=n,this._horizontalBlurFBO)this._horizontalBlurFBO.resize(r[0],r[1]);else{let e=new c(r[0],r[1]);e.internalFormat=6408,e.wrapMode=33071,this._horizontalBlurFBO=new o(i,e)}if(this._verticalBlurFBO)this._verticalBlurFBO.resize(r[0],r[1]);else{let e=new c(r[0],r[1]);e.internalFormat=6408,e.wrapMode=33071,this._verticalBlurFBO=new o(i,e)}if(this._layerFBOTexture)this._layerFBOTexture.resize(t,n);else{let e=new c(t,n);e.internalFormat=6408,e.wrapMode=33071,this._layerFBOTexture=new s(i,e)}}}}export{d as DropShadowTechnique};
2
+ import{disposeMaybe as e}from"../../../../../../../core/maybe.js";import{pt2px as t}from"../../../../../../../core/screenUtils.js";import{simplePipelineState as n}from"../../utils.js";import{Technique as r}from"../Technique.js";import{GaussianBlurShader as i}from"../shaders/BlurShader.js";import{DropShadowCompositeShader as a}from"../shaders/DropShadowShader.js";import{DisposableFramebufferObject as o}from"../../../../../../webgl/FramebufferObject.js";import{Texture as s}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as c}from"../../../../../../webgl/TextureDescriptor.js";const l=[1,0],u=[0,1];class d extends r{constructor(){super(...arguments),this.type=13,this._layerFBOTexture=null,this._horizontalBlurFBO=null,this._verticalBlurFBO=null,this._size=[0,0],this.shaders={gaussianBlur:new i,composite:new a}}shutdown(){super.shutdown(),this._horizontalBlurFBO=e(this._horizontalBlurFBO),this._verticalBlurFBO=e(this._verticalBlurFBO),this._layerFBOTexture=e(this._layerFBOTexture)}render(e,r){let{context:i,painter:a}=e,{layerFBO:o}=r,s=o.width,c=o.height,d=[Math.round(s),Math.round(c)],{blurRadius:f,offsetX:p,offsetY:m,color:h}=r.effect,g=[t(p),t(m)];this._createOrResizeResources(e,s,c,d);let _=this._horizontalBlurFBO,v=this._verticalBlurFBO;a.setPipelineState({color:{write:[!0,!0,!0,!0],blendMode:`none`},depth:{write:!1,test:!1},stencil:{write:{mask:0},test:!1}});let y=this._layerFBOTexture;o.copyToTexture(0,0,s,c,0,0,y),i.setViewport(0,0,d[0],d[1]),i.bindFramebuffer(_),a.submitDrawMesh(i,{shader:this.shaders.gaussianBlur,uniforms:{gaussianBlurConfig:{texSize:d,direction:l,sigma:f}},textures:{texture:{texture:o.colorTexture,unit:4}},defines:{kernelRadius:Math.ceil(f)},optionalAttributes:null,useComputeBuffer:!1},a.quadMesh),i.bindFramebuffer(v),a.submitDrawMesh(i,{shader:this.shaders.gaussianBlur,uniforms:{gaussianBlurConfig:{texSize:d,direction:u,sigma:f}},textures:{texture:{texture:_?.colorTexture,unit:5}},defines:{kernelRadius:Math.ceil(f)},optionalAttributes:null,useComputeBuffer:!1},a.quadMesh),i.bindFramebuffer(o),i.setViewport(0,0,s,c),a.submitDrawMesh(i,{shader:this.shaders.composite,uniforms:{compositeConfig:{shadowColor:[h[3]*(h[0]/255),h[3]*(h[1]/255),h[3]*(h[2]/255),h[3]],shadowOffset:g}},textures:{blurTexture:{texture:v?.colorTexture,unit:2},layerFBOTexture:{texture:y,unit:3}},defines:null,optionalAttributes:null,useComputeBuffer:!1},a.quadMesh),a.setPipelineState({...n,stencil:{test:{mask:255,compare:514,op:{fail:7680,zFail:7680,zPass:7680}},write:!1}})}_createOrResizeResources(e,t,n,r){let{context:i}=e;if(!(this._horizontalBlurFBO&&this._size[0]===t&&this._size[1]===n)){if(this._size[0]=t,this._size[1]=n,this._horizontalBlurFBO)this._horizontalBlurFBO.resize(r[0],r[1]);else{let e=new c(r[0],r[1]);e.internalFormat=6408,e.wrapMode=33071,this._horizontalBlurFBO=new o(i,e)}if(this._verticalBlurFBO)this._verticalBlurFBO.resize(r[0],r[1]);else{let e=new c(r[0],r[1]);e.internalFormat=6408,e.wrapMode=33071,this._verticalBlurFBO=new o(i,e)}if(this._layerFBOTexture)this._layerFBOTexture.resize(t,n);else{let e=new c(t,n);e.internalFormat=6408,e.wrapMode=33071,this._layerFBOTexture=new s(i,e)}}}}export{d as DropShadowTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../../../../core/Logger.js";import{disposeMaybe as t}from"../../../../../../../core/maybe.js";import{PixelType as n,SizedDepthStencilFormat as r}from"../../../../../../webgl/enums.js";import{DisposableFramebufferObject as i}from"../../../../../../webgl/FramebufferObject.js";import{loadHeatmapTextureConfiguration as a}from"../../../../../../webgl/heatmapTextureUtils.js";import{RenderbufferDescriptor as o}from"../../../../../../webgl/RenderbufferDescriptor.js";import s from"../../../../../../webgl/Texture.js";import{TextureDescriptor as c}from"../../../../../../webgl/TextureDescriptor.js";const l=()=>e.getLogger(`esri.views.2d.engine.webgl.shaderGraph.techniques.heatmap.HeatmapResources`);class u{destroy(){this._accumulateFramebuffer=t(this._accumulateFramebuffer),this._resolveGradientTexture=t(this._resolveGradientTexture),this._prevGradientHash=null,this._qualityProfile=null}get initialized(){return this._accumulateFramebuffer!=null&&this._resolveGradientTexture!=null}get accumulateFramebuffer(){return this._accumulateFramebuffer}get resolveGradientTexture(){return this._resolveGradientTexture}loadQualityProfile(e){if(this._qualityProfile==null){let t=a(e,l());this._qualityProfile={...t,defines:{usesHalfFloatPrecision:t.dataType!==n.FLOAT}}}return this._qualityProfile}ensureAccumulateFBO(e,t,n){if(this._accumulateFramebuffer==null){let{dataType:a,samplingMode:s,pixelFormat:l,internalFormat:u}=this.loadQualityProfile(e),d=new c(t,n);d.pixelFormat=l,d.internalFormat=u,d.dataType=a,d.samplingMode=s,d.wrapMode=33071;let f=new o(r.DEPTH24_STENCIL8,t,n);this._accumulateFramebuffer=new i(e,d,f)}else{let{width:e,height:r}=this._accumulateFramebuffer;(e!==t||r!==n)&&this._accumulateFramebuffer.resize(t,n)}return this._accumulateFramebuffer}ensureResolveGradientTexture(e,t,n){if(this._resolveGradientTexture==null){let t=new c;t.wrapMode=33071,this._resolveGradientTexture=new s(e,t),this._prevGradientHash=null}return this._prevGradientHash!==t&&(this._resolveGradientTexture.resize(n.length/4,1),this._resolveGradientTexture.setData(n),this._prevGradientHash=t),this._resolveGradientTexture}}export{u as HeatmapResources};
2
+ import e from"../../../../../../../core/Logger.js";import{disposeMaybe as t}from"../../../../../../../core/maybe.js";import{PixelType as n,SizedDepthStencilFormat as r}from"../../../../../../webgl/enums.js";import{DisposableFramebufferObject as i}from"../../../../../../webgl/FramebufferObject.js";import{loadHeatmapTextureConfiguration as a}from"../../../../../../webgl/heatmapTextureUtils.js";import{RenderbufferDescriptor as o}from"../../../../../../webgl/RenderbufferDescriptor.js";import{Texture as s}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as c}from"../../../../../../webgl/TextureDescriptor.js";const l=()=>e.getLogger(`esri.views.2d.engine.webgl.shaderGraph.techniques.heatmap.HeatmapResources`);class u{destroy(){this._accumulateFramebuffer=t(this._accumulateFramebuffer),this._resolveGradientTexture=t(this._resolveGradientTexture),this._prevGradientHash=null,this._qualityProfile=null}get initialized(){return this._accumulateFramebuffer!=null&&this._resolveGradientTexture!=null}get accumulateFramebuffer(){return this._accumulateFramebuffer}get resolveGradientTexture(){return this._resolveGradientTexture}loadQualityProfile(e){if(this._qualityProfile==null){let t=a(e,l());this._qualityProfile={...t,defines:{usesHalfFloatPrecision:t.dataType!==n.FLOAT}}}return this._qualityProfile}ensureAccumulateFBO(e,t,n){if(this._accumulateFramebuffer==null){let{dataType:a,samplingMode:s,pixelFormat:l,internalFormat:u}=this.loadQualityProfile(e),d=new c(t,n);d.pixelFormat=l,d.internalFormat=u,d.dataType=a,d.samplingMode=s,d.wrapMode=33071;let f=new o(r.DEPTH24_STENCIL8,t,n);this._accumulateFramebuffer=new i(e,d,f)}else{let{width:e,height:r}=this._accumulateFramebuffer;(e!==t||r!==n)&&this._accumulateFramebuffer.resize(t,n)}return this._accumulateFramebuffer}ensureResolveGradientTexture(e,t,n){if(this._resolveGradientTexture==null){let t=new c;t.wrapMode=33071,this._resolveGradientTexture=new s(e,t),this._prevGradientHash=null}return this._prevGradientHash!==t&&(this._resolveGradientTexture.resize(n.length/4,1),this._resolveGradientTexture.setData(n),this._prevGradientHash=t),this._resolveGradientTexture}}export{u as HeatmapResources};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{clamp as e}from"../../../../../../../core/mathUtils.js";import{disposeMaybe as t}from"../../../../../../../core/maybe.js";import{isSVG as n}from"../../../../../../../core/urlUtils.js";import{simplePipelineState as r}from"../../utils.js";import{Technique as i}from"../Technique.js";import{MagnifierShader as a}from"../shaders/MagnifierShader.js";import o from"../../../../../../webgl/Texture.js";import{TextureDescriptor as s}from"../../../../../../webgl/TextureDescriptor.js";class c extends i{constructor(){super(...arguments),this.type=22,this._resourcePixelRatio=1,this._position=[0,0,0,0],this.shaders={magnifier:new a}}updateResources(t,n,r,i){t.pixelRatio!==this._resourcePixelRatio&&this._destroyResources(),this._readbackTexture||this._initializeResources(t,n,r,i);let{context:a,pixelRatio:o}=t,{factor:s,offset:c,position:l}=i,{size:u}=t.state,d=i.size*o,f=1/s,p=Math.ceil(f*d);this._readbackTexture.resize(p,p);let m=o*u[0],h=o*u[1],g=.5*p,_=.5*p,v=e(o*l.x,g,m-g-1),y=e(h-o*l.y,_,h-_-1),b=v-g,x=y-_,S=this._readbackTexture;a.bindTexture(S,0),a.gl.copyTexImage2D(S.descriptor.target,0,S.descriptor.pixelFormat,b,x,p,p,0);let C=c.x*o,w=c.y*o,T=-1+2*((v+C)/m),E=-1+2*((y-w)/h),D=d/m*2,O=d/h*2;this._position[0]=T,this._position[1]=E,this._position[2]=D,this._position[3]=O}render(e,t){let{context:n,painter:i}=e;i.setPipelineState(r);let a={drawPos:this._position,...t};i.submitDrawMesh(n,{shader:this.shaders.magnifier,uniforms:{config:a},textures:{readbackTexture:{texture:this._readbackTexture,unit:0},maskTexture:{texture:this._maskTexture,unit:7},overlayTexture:{texture:this._overlayTexture,unit:6}},defines:null,optionalAttributes:null,useComputeBuffer:!1},i.quadMesh)}shutdown(){this._destroyResources()}_initializeResources(e,t,r,i){let a=e.context;this._resourcePixelRatio=e.pixelRatio;let c=Math.ceil(i.size*e.pixelRatio);r.width=c,r.height=c;let l=new s(Math.ceil(c/i.factor));l.internalFormat=6408,l.wrapMode=33071,l.samplingMode=9728,l.flipped=!0,l.preMultiplyAlpha=!n(r.src)||!e.context.driverTest.svgPremultipliesAlpha.result,this._overlayTexture=new o(a,l,r),t.width=c,t.height=c,l.pixelFormat=l.internalFormat=6406,this._maskTexture=new o(a,l,t),l.pixelFormat=l.internalFormat=6408,l.samplingMode=9729,l.flipped=!1,this._readbackTexture=new o(a,l)}_destroyResources(){t(this._maskTexture),t(this._overlayTexture),t(this._readbackTexture),this._maskTexture=null,this._overlayTexture=null,this._readbackTexture=null}}export{c as MagnifierTechnique};
2
+ import{clamp as e}from"../../../../../../../core/mathUtils.js";import{disposeMaybe as t}from"../../../../../../../core/maybe.js";import{isSVG as n}from"../../../../../../../core/urlUtils.js";import{simplePipelineState as r}from"../../utils.js";import{Technique as i}from"../Technique.js";import{MagnifierShader as a}from"../shaders/MagnifierShader.js";import{Texture as o}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as s}from"../../../../../../webgl/TextureDescriptor.js";class c extends i{constructor(){super(...arguments),this.type=22,this._resourcePixelRatio=1,this._position=[0,0,0,0],this.shaders={magnifier:new a}}updateResources(t,n,r,i){t.pixelRatio!==this._resourcePixelRatio&&this._destroyResources(),this._readbackTexture||this._initializeResources(t,n,r,i);let{context:a,pixelRatio:o}=t,{factor:s,offset:c,position:l}=i,{size:u}=t.state,d=i.size*o,f=1/s,p=Math.ceil(f*d);this._readbackTexture.resize(p,p);let m=o*u[0],h=o*u[1],g=.5*p,_=.5*p,v=e(o*l.x,g,m-g-1),y=e(h-o*l.y,_,h-_-1),b=v-g,x=y-_,S=this._readbackTexture;a.bindTexture(S,0),a.gl.copyTexImage2D(S.descriptor.target,0,S.descriptor.pixelFormat,b,x,p,p,0);let C=c.x*o,w=c.y*o,T=-1+2*((v+C)/m),E=-1+2*((y-w)/h),D=d/m*2,O=d/h*2;this._position[0]=T,this._position[1]=E,this._position[2]=D,this._position[3]=O}render(e,t){let{context:n,painter:i}=e;i.setPipelineState(r);let a={drawPos:this._position,...t};i.submitDrawMesh(n,{shader:this.shaders.magnifier,uniforms:{config:a},textures:{readbackTexture:{texture:this._readbackTexture,unit:0},maskTexture:{texture:this._maskTexture,unit:7},overlayTexture:{texture:this._overlayTexture,unit:6}},defines:null,optionalAttributes:null,useComputeBuffer:!1},i.quadMesh)}shutdown(){this._destroyResources()}_initializeResources(e,t,r,i){let a=e.context;this._resourcePixelRatio=e.pixelRatio;let c=Math.ceil(i.size*e.pixelRatio);r.width=c,r.height=c;let l=new s(Math.ceil(c/i.factor));l.internalFormat=6408,l.wrapMode=33071,l.samplingMode=9728,l.flipped=!0,l.preMultiplyAlpha=!n(r.src)||!e.context.driverTest.svgPremultipliesAlpha.result,this._overlayTexture=new o(a,l,r),t.width=c,t.height=c,l.pixelFormat=l.internalFormat=6406,this._maskTexture=new o(a,l,t),l.pixelFormat=l.internalFormat=6408,l.samplingMode=9729,l.flipped=!1,this._readbackTexture=new o(a,l)}_destroyResources(){t(this._maskTexture),t(this._overlayTexture),t(this._readbackTexture),this._maskTexture=null,this._overlayTexture=null,this._readbackTexture=null}}export{c as MagnifierTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{disposeMaybe as e}from"../../../../../../../core/maybe.js";import{Technique as t}from"../Technique.js";import{OpacityShader as n}from"../shaders/OpacityShader.js";import r from"../../../../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../../../../webgl/TextureDescriptor.js";class a extends t{constructor(){super(...arguments),this.type=25,this._layerFBOTexture=null,this._size=[0,0],this.shaders={opacity:new n}}shutdown(){super.shutdown(),this._layerFBOTexture=e(this._layerFBOTexture)}render(e,t){let{layerFBO:n}=t,{width:r,height:i}=n;this._createOrResizeResources(e,r,i);let{context:a,painter:o}=e,{amount:s}=t.effect,c=this._layerFBOTexture;a.bindFramebuffer(n),t.layerFBO.copyToTexture(0,0,r,i,0,0,c);let l={color:{write:[!0,!0,!0,!0],blendMode:`composite`},depth:!1,stencil:!1},u={opacity:s};c.setSamplingMode(9728),a.setClearColor(0,0,0,0),a.clear(16384),o.setPipelineState(l),o.submitDrawMesh(a,{shader:this.shaders.opacity,uniforms:{config:u},textures:{layerTexture:{texture:c,unit:0}},defines:null,optionalAttributes:null,useComputeBuffer:!1},o.quadMesh)}_createOrResizeResources(e,t,n){let{context:a}=e;if(!(this._layerFBOTexture&&this._size[0]===t&&this._size[1]===n)){if(this._size[0]=t,this._size[1]=n,this._layerFBOTexture)this._layerFBOTexture.resize(t,n);else{let e=new i(t,n);e.internalFormat=6408,e.wrapMode=33071,e.samplingMode=9728,this._layerFBOTexture=new r(a,e)}}}}export{a as OpacityTechnique};
2
+ import{disposeMaybe as e}from"../../../../../../../core/maybe.js";import{Technique as t}from"../Technique.js";import{OpacityShader as n}from"../shaders/OpacityShader.js";import{Texture as r}from"../../../../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../../../../webgl/TextureDescriptor.js";class a extends t{constructor(){super(...arguments),this.type=25,this._layerFBOTexture=null,this._size=[0,0],this.shaders={opacity:new n}}shutdown(){super.shutdown(),this._layerFBOTexture=e(this._layerFBOTexture)}render(e,t){let{layerFBO:n}=t,{width:r,height:i}=n;this._createOrResizeResources(e,r,i);let{context:a,painter:o}=e,{amount:s}=t.effect,c=this._layerFBOTexture;a.bindFramebuffer(n),t.layerFBO.copyToTexture(0,0,r,i,0,0,c);let l={color:{write:[!0,!0,!0,!0],blendMode:`composite`},depth:!1,stencil:!1},u={opacity:s};c.setSamplingMode(9728),a.setClearColor(0,0,0,0),a.clear(16384),o.setPipelineState(l),o.submitDrawMesh(a,{shader:this.shaders.opacity,uniforms:{config:u},textures:{layerTexture:{texture:c,unit:0}},defines:null,optionalAttributes:null,useComputeBuffer:!1},o.quadMesh)}_createOrResizeResources(e,t,n){let{context:a}=e;if(!(this._layerFBOTexture&&this._size[0]===t&&this._size[1]===n)){if(this._size[0]=t,this._size[1]=n,this._layerFBOTexture)this._layerFBOTexture.resize(t,n);else{let e=new i(t,n);e.internalFormat=6408,e.wrapMode=33071,e.samplingMode=9728,this._layerFBOTexture=new r(a,e)}}}}export{a as OpacityTechnique};