@arcgis/core 4.28.0-next.20230712 → 4.28.0-next.20230713

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 (61) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/08ee2bd914867fd2cbd5.js +1 -0
  3. package/assets/esri/core/workers/chunks/{4f92fd5167e22c602e8a.js → 169b04f05f5c875c5083.js} +1 -1
  4. package/assets/esri/core/workers/chunks/55109f141c9f120833f6.js +1 -0
  5. package/assets/esri/core/workers/chunks/8c5a8c1dfb086069bb06.js +1 -0
  6. package/assets/esri/core/workers/chunks/{f156387d6c645b18a8dd.js → b2a0e3e1dfccda7ed12e.js} +1 -1
  7. package/assets/esri/core/workers/chunks/d4881b238c8a93390cde.js +1 -0
  8. package/assets/esri/core/workers/chunks/dcb004dfba27335c7c3c.js +1 -0
  9. package/assets/esri/core/workers/chunks/{ad38aede3ec854191511.js → f6e24113643784bc6731.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{3a0e2535f6cdb2e65667.js → fb610982b1366cdbc0c3.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{5583921a498172edd5ac.js → fcab431f13b4a9f92dbf.js} +1 -1
  12. package/core/Collection.js +1 -1
  13. package/core/accessorSupport/ensureType.js +1 -1
  14. package/core/accessorSupport/set.js +1 -1
  15. package/layers/VoxelWasmPerSceneView.js +1 -1
  16. package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
  17. package/layers/support/rasterDatasets/multipartParser.js +1 -1
  18. package/layers/support/wmtsUtils.js +1 -1
  19. package/package.json +1 -1
  20. package/support/revision.js +1 -1
  21. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  22. package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
  23. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  24. package/views/3d/support/LaserLineRenderer.js +1 -1
  25. package/views/3d/support/engineContent/line.js +1 -1
  26. package/views/3d/terrain/PatchRenderData.js +1 -1
  27. package/views/3d/terrain/TerrainRenderer.js +1 -1
  28. package/views/3d/terrain/TileRenderer.js +1 -1
  29. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  30. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +17 -21
  31. package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
  32. package/views/3d/webgl-engine/lib/GLMaterials.js +1 -1
  33. package/views/3d/webgl-engine/lib/RenderPluginManager.js +1 -1
  34. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  35. package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
  36. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  37. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  38. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  39. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  40. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  41. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  42. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  43. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  44. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  45. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  46. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  47. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  48. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  49. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  50. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  51. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  52. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  53. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  54. package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
  55. package/widgets/ElevationProfile/support/ProfileGenerationError.js +1 -1
  56. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  57. package/assets/esri/core/workers/chunks/00b023cb63f23bc074b8.js +0 -1
  58. package/assets/esri/core/workers/chunks/1e413a44b35bfecbfa59.js +0 -1
  59. package/assets/esri/core/workers/chunks/71c029f95cb4666ae207.js +0 -1
  60. package/assets/esri/core/workers/chunks/c9ef45225947ccc2bd4c.js +0 -1
  61. package/assets/esri/core/workers/chunks/dda6fab95d50c1215808.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{s as t,k as e}from"../../../../chunks/vec2.js";import{a as r}from"../../../../chunks/vec2f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{Material as o}from"../lib/Material.js";import{RenderSlot as n}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as l,writeBufferFloat as c}from"./internal/bufferWriterUtils.js";import{HeatmapDensityPassParameters as f,HeatmapDensityTechniqueConfiguration as m,HeatmapDensityTechnique as T}from"../shaders/HeatmapDensityTechnique.js";const h=2;class p extends f{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class d extends o{constructor(t){super(t,new p),this._configuration=new m}requiresSlot(t,e){return t===n.DRAPED_MATERIAL&&e===i.Color}getConfiguration(){return this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats,this._configuration}createGLMaterial(t){return new A(t)}intersect(){}intersectDraped(r,s,i,a,o,n){const l=r.vertexAttributes.get(u.POSITION),{parameters:c}=this,{searchRadius:f}=c,{screenToWorldRatio:m}=r,T=f*m+h*m,p=T*T,d=l.data.length/l.size;for(let u=0;u<d;u++){const r=u*l.size,s=t(E,l.data[r],l.data[r+1]);e(s,a)<p&&o(n.dist,n.normal,-1,!1)}}createBufferWriter(){return new I(this.parameters.isAttributeDriven?g:b)}}class A extends a{beginSlot(t){return this.ensureTechnique(T,t)}}class I{constructor(t){this.vertexBufferLayout=t}elementCount(t){return t.indices.get(u.POSITION).length*v}write(t,e,r,s,i){l(r.indices.get(u.POSITION),r.vertexAttributes.get(u.POSITION).data,t,s.position,i,v);const a=r.indices.get(u.POSITION).length,o=s.uv0;let n=i;for(let u=0;u<a;++u)o.setValues(n++,-1,-1),o.setValues(n++,1,-1),o.setValues(n++,1,1),o.setValues(n++,1,1),o.setValues(n++,-1,1),o.setValues(n++,-1,-1);const f=u.FEATUREATTRIBUTE in s?s.featureAttribute:null;f&&c(r.indices.get(u.FEATUREATTRIBUTE),r.vertexAttributes.get(u.FEATUREATTRIBUTE).data,f,i,v)}}const b=s().vec3f(u.POSITION).vec2f(u.UV0),g=b.clone().f32(u.FEATUREATTRIBUTE),v=6,E=r();export{d as HeatmapDensityMaterial,p as HeatmapDensityMaterialParameters};
5
+ import{s as t,k as e}from"../../../../chunks/vec2.js";import{a as r}from"../../../../chunks/vec2f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{Material as n}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{writePosition as c,writeBufferFloat as l}from"./internal/bufferWriterUtils.js";import{HeatmapDensityPassParameters as f,HeatmapDensityTechniqueConfiguration as m,HeatmapDensityTechnique as T}from"../shaders/HeatmapDensityTechnique.js";const h=2;class p extends f{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class d extends n{constructor(t){super(t,new p),this._configuration=new m}canRender(t,e){return t===o.DRAPED_MATERIAL&&e===i.Color}getConfiguration(){return this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats,this._configuration}createGLMaterial(t){return new A(t)}intersect(){}intersectDraped(r,s,i,a,n,o){const c=r.vertexAttributes.get(u.POSITION),{parameters:l}=this,{searchRadius:f}=l,{screenToWorldRatio:m}=r,T=f*m+h*m,p=T*T,d=c.data.length/c.size;for(let u=0;u<d;u++){const r=u*c.size,s=t(E,c.data[r],c.data[r+1]);e(s,a)<p&&n(o.dist,o.normal,-1,!1)}}createBufferWriter(){return new I(this.parameters.isAttributeDriven?g:b)}}class A extends a{beginSlot(t){return this.ensureTechnique(T,t)}}class I{constructor(t){this.vertexBufferLayout=t}elementCount(t){return t.indices.get(u.POSITION).length*v}write(t,e,r,s,i){c(r.indices.get(u.POSITION),r.vertexAttributes.get(u.POSITION).data,t,s.position,i,v);const a=r.indices.get(u.POSITION).length,n=s.uv0;let o=i;for(let u=0;u<a;++u)n.setValues(o++,-1,-1),n.setValues(o++,1,-1),n.setValues(o++,1,1),n.setValues(o++,1,1),n.setValues(o++,-1,1),n.setValues(o++,-1,-1);const f=u.FEATUREATTRIBUTE in s?s.featureAttribute:null;f&&l(r.indices.get(u.FEATUREATTRIBUTE),r.vertexAttributes.get(u.FEATUREATTRIBUTE).data,f,i,v)}}const b=s().vec3f(u.POSITION).vec2f(u.UV0),g=b.clone().f32(u.FEATUREATTRIBUTE),v=6,E=r();export{d as HeatmapDensityMaterial,p as HeatmapDensityMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as t}from"../lib/basicInterfaces.js";import{GLTextureMaterial as r}from"../lib/GLTextureMaterial.js";import{MaterialParameters as a}from"../lib/Material.js";import{OITPolygonOffsetLimit as s}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as i}from"../lib/RenderSlot.js";import{DefaultBufferWriter as n}from"./DefaultBufferWriter.js";import{PositionUVLayout as u}from"./DefaultLayouts.js";import{TriangleMaterial as o}from"./TriangleMaterial.js";import{ImageMaterialTechniqueConfiguration as h,ImageMaterialTechnique as l}from"../shaders/ImageMaterialTechnique.js";class c extends o{constructor(e){super(e,new m),this.supportsEdges=!0,this._configuration=new h}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<s,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}requiresSlot(t,r){if(r===e.Color||r===e.Alpha||r===e.Highlight){if(t===i.DRAPED_MATERIAL)return!0;if(r===e.Highlight)return t===i.OPAQUE_MATERIAL;return t===(this.parameters.transparent?this.parameters.writeDepth?i.TRANSPARENT_MATERIAL:i.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:i.OPAQUE_MATERIAL)}return!1}createGLMaterial(e){return new p(e)}createBufferWriter(){return new n(u)}}class p extends r{constructor(e){super({...e,...e.material.parameters})}_updateParameters(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(l,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&(this._material.setParameters({hasOccludees:e.hasOccludees}),this._updateParameters(e))}beginSlot(t){return this._output!==e.Color&&this._output!==e.Alpha||this._updateOccludeeState(t),this._updateParameters(t)}}class m extends a{constructor(){super(...arguments),this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=t.None,this.hasOccludees=!1,this.opacity=1,this.textureId=null,this.initTextureTransparent=!0}}export{c as ImageMaterial,m as Parameters};
5
+ import{ShaderOutput as e}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as t}from"../lib/basicInterfaces.js";import{GLTextureMaterial as r}from"../lib/GLTextureMaterial.js";import{MaterialParameters as a}from"../lib/Material.js";import{OITPolygonOffsetLimit as s}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as i}from"../lib/RenderSlot.js";import{DefaultBufferWriter as n}from"./DefaultBufferWriter.js";import{PositionUVLayout as u}from"./DefaultLayouts.js";import{TriangleMaterial as o}from"./TriangleMaterial.js";import{ImageMaterialTechniqueConfiguration as h,ImageMaterialTechnique as l}from"../shaders/ImageMaterialTechnique.js";class c extends o{constructor(e){super(e,new m),this.supportsEdges=!0,this._configuration=new h}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<s,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}canRender(t,r){if(r===e.Color||r===e.Alpha||r===e.Highlight){if(t===i.DRAPED_MATERIAL)return!0;if(r===e.Highlight)return t===i.OPAQUE_MATERIAL;return t===(this.parameters.transparent?this.parameters.writeDepth?i.TRANSPARENT_MATERIAL:i.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:i.OPAQUE_MATERIAL)}return!1}createGLMaterial(e){return new p(e)}createBufferWriter(){return new n(u)}}class p extends r{constructor(e){super({...e,...e.material.parameters})}_updateParameters(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(l,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&(this._material.setParameters({hasOccludees:e.hasOccludees}),this._updateParameters(e))}beginSlot(t){return this._output!==e.Color&&this._output!==e.Alpha||this._updateOccludeeState(t),this._updateParameters(t)}}class m extends a{constructor(){super(...arguments),this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=t.None,this.hasOccludees=!1,this.opacity=1,this.textureId=null,this.initTextureTransparent=!0}}export{c as ImageMaterial,m as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{f as e}from"../../../../chunks/vec2f32.js";import{Z as t}from"../../../../chunks/vec2f64.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as s}from"../core/shaderLibrary/hud/HUD.glsl.js";import n from"../lib/GLMaterial.js";import{Material as a,MaterialParameters as o}from"../lib/Material.js";import{RenderSlot as u}from"../lib/RenderSlot.js";import{VertexAttribute as c}from"../lib/VertexAttribute.js";import{writePosition as f,writeNormal as l,writeBufferVec4 as h}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as d}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as m}from"../shaders/LineCalloutTechniqueConfiguration.js";class p extends a{get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}constructor(e){super(e,new O),this._configuration=new m,this._uniqueMaterialIdentifier=p.uniqueMaterialIdentifier(this.parameters)}getPassParameters(){return this.parameters}getConfiguration(e,t){const r=t?.slot!==u.LINE_CALLOUTS;return this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.depthHudEnabled=r,this._configuration.depthHudAlignStartEnabled=!!this.parameters.depthHUDAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?s.Screen:s.World,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration}intersect(){}requiresSlot(e,t){if(t===i.Color)switch(e){case u.LINE_CALLOUTS:case u.LINE_CALLOUTS_HUD_DEPTH:return!0}return!1}createGLMaterial(e){return new g(e)}createBufferWriter(){return new L}validateParameters(e){const t=p.uniqueMaterialIdentifier(e);t!==this._uniqueMaterialIdentifier&&(this._uniqueMaterialIdentifier=t)}static uniqueMaterialIdentifier(e){return JSON.stringify({screenOffset:e.screenOffset||[0,0],centerOffsetUnits:e.centerOffsetUnits||"world"})}}class g extends n{beginSlot(e){return this.ensureTechnique(d,e)}}class O extends o{constructor(){super(...arguments),this.screenOffset=t,this.color=[0,0,0,1],this.size=1,this.occlusionTest=!1,this.shaderPolygonOffset=1e-5,this.depthHUDAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}const S=r().vec3f(c.POSITION).vec3f(c.NORMAL).vec2f(c.UV0).vec4f(c.AUXPOS1),I=[e(0,0),e(1,0),e(0,1),e(1,0),e(1,1),e(0,1)];class L{constructor(){this.vertexBufferLayout=S}elementCount(e){return 6*e.indices.get(c.POSITION).length}write(e,t,r,i,s){f(r.indices.get(c.POSITION),r.vertexAttributes.get(c.POSITION).data,e,i.position,s,6),l(r.indices.get(c.NORMAL),r.vertexAttributes.get(c.NORMAL).data,t,i.normal,s,6),h(r.indices.get(c.AUXPOS1),r.vertexAttributes.get(c.AUXPOS1).data,i.auxpos1,s,6);for(let n=0;n<I.length;++n)i.uv0.setVec(s+n,I[n])}}export{p as LineCalloutMaterial,O as Parameters};
5
+ import{f as e}from"../../../../chunks/vec2f32.js";import{Z as t}from"../../../../chunks/vec2f64.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{HUDSpace as s}from"../core/shaderLibrary/hud/HUD.glsl.js";import n from"../lib/GLMaterial.js";import{Material as a,MaterialParameters as o}from"../lib/Material.js";import{RenderSlot as u}from"../lib/RenderSlot.js";import{VertexAttribute as c}from"../lib/VertexAttribute.js";import{writePosition as f,writeNormal as l,writeBufferVec4 as h}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as d}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as m}from"../shaders/LineCalloutTechniqueConfiguration.js";class p extends a{get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}constructor(e){super(e,new O),this._configuration=new m,this._uniqueMaterialIdentifier=p.uniqueMaterialIdentifier(this.parameters)}getPassParameters(){return this.parameters}getConfiguration(e,t){const r=t?.slot!==u.LINE_CALLOUTS;return this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.depthHudEnabled=r,this._configuration.depthHudAlignStartEnabled=!!this.parameters.depthHUDAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits?s.Screen:s.World,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration}intersect(){}canRender(e,t){if(t===i.Color)switch(e){case u.LINE_CALLOUTS:case u.LINE_CALLOUTS_HUD_DEPTH:return!0}return!1}createGLMaterial(e){return new g(e)}createBufferWriter(){return new L}validateParameters(e){const t=p.uniqueMaterialIdentifier(e);t!==this._uniqueMaterialIdentifier&&(this._uniqueMaterialIdentifier=t)}static uniqueMaterialIdentifier(e){return JSON.stringify({screenOffset:e.screenOffset||[0,0],centerOffsetUnits:e.centerOffsetUnits||"world"})}}class g extends n{beginSlot(e){return this.ensureTechnique(d,e)}}class O extends o{constructor(){super(...arguments),this.screenOffset=t,this.color=[0,0,0,1],this.size=1,this.occlusionTest=!1,this.shaderPolygonOffset=1e-5,this.depthHUDAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}const S=r().vec3f(c.POSITION).vec3f(c.NORMAL).vec2f(c.UV0).vec4f(c.AUXPOS1),I=[e(0,0),e(1,0),e(0,1),e(1,0),e(1,1),e(0,1)];class L{constructor(){this.vertexBufferLayout=S}elementCount(e){return 6*e.indices.get(c.POSITION).length}write(e,t,r,i,s){f(r.indices.get(c.POSITION),r.vertexAttributes.get(c.POSITION).data,e,i.position,s,6),l(r.indices.get(c.NORMAL),r.vertexAttributes.get(c.NORMAL).data,t,i.normal,s,6),h(r.indices.get(c.AUXPOS1),r.vertexAttributes.get(c.AUXPOS1).data,i.auxpos1,s,6);for(let n=0;n<I.length;++n)i.uv0.setVec(s+n,I[n])}}export{p as LineCalloutMaterial,O as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{s as e,G as t,m as r}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as a}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as o}from"../lib/GLTextureMaterial.js";import{Material as n,RenderOccludedFlag as h}from"../lib/Material.js";import{RenderSlot as c}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as p}from"./VisualVariablePassParameters.js";import{vertexAttributeLocations as l,LineMarkerTechnique as m}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d,LineMarkerSpace as A,LineMarkerAnchor as T}from"../shaders/LineMarkerTechniqueConfiguration.js";import{CapType as _}from"../shaders/RibbonLineTechniqueConfiguration.js";class v extends n{constructor(e){super(e,new E),this._vertexAttributeLocations=l,this._configuration=new d,this._layout=this.createLayout()}dispose(){}getConfiguration(e,t){return this._configuration.output=e,this._configuration.space=t.slot===c.DRAPED_MATERIAL?A.Draped:this.parameters.worldSpace?A.World:A.Screen,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==_.BUTT,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.occluder=this.parameters.renderOccluded===h.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(){}createLayout(){const e=s().vec3f(u.POSITION).vec2f(u.UV0).vec3f(u.AUXPOS1);return this.parameters.worldSpace&&e.vec3f(u.NORMAL),this.parameters.vvSize?e.f32(u.SIZEFEATUREATTRIBUTE):e.f32(u.SIZE),this.parameters.vvColor?e.f32(u.COLORFEATUREATTRIBUTE):e.vec4f(u.COLOR),this.parameters.vvOpacity&&e.f32(u.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new S(this._layout,this.parameters)}requiresSlot(e,t){if(t===a.Color||t===a.Alpha||t===a.Highlight||t===a.Depth){if(e===c.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===h.OccludeAndTransparentStencil)return e===c.OPAQUE_MATERIAL||e===c.OCCLUDER_MATERIAL||e===c.TRANSPARENT_OCCLUDER_MATERIAL;if(t===a.Color||t===a.Alpha){return e===(this.parameters.writeDepth?c.TRANSPARENT_MATERIAL:c.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return e===c.OPAQUE_MATERIAL}return!1}createGLMaterial(e){return new f(e)}}class f extends o{constructor(){super(...arguments),this._markerPrimitive=null}dispose(){super.dispose(),this._markerTextureRepository.release(this._markerPrimitive),this._markerPrimitive=null}_updateParameters(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextureRepository.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(m,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==a.Color&&this._output!==a.Alpha||this._updateOccludeeState(e),this._updateParameters(e)}}class E extends p{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=_.BUTT,this.anchor=T.Center,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.hasOccludees=!1,this.markerTexture=null}}class S{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,s,a,o,n){const h=a.vertexAttributes.get(u.POSITION).data,c=h.length/3;let p=[1,0,0];const l=a.vertexAttributes.get(u.NORMAL);this._parameters.worldSpace&&null!=l&&(p=l.data);let m=1,d=0;this._parameters.vvSize?d=a.vertexAttributes.get(u.SIZEFEATUREATTRIBUTE).data[0]:a.vertexAttributes.has(u.SIZE)&&(m=a.vertexAttributes.get(u.SIZE).data[0]);let A=[1,1,1,1],T=0;this._parameters.vvColor?T=a.vertexAttributes.get(u.COLORFEATUREATTRIBUTE).data[0]:a.vertexAttributes.has(u.COLOR)&&(A=a.vertexAttributes.get(u.COLOR).data);let _=0;this._parameters.vvOpacity&&(_=a.vertexAttributes.get(u.OPACITYFEATUREATTRIBUTE).data[0]);const v=new Float32Array(o.buffer);let f=n*(this.vertexBufferLayout.stride/4);const E=(e,t,r,i)=>{if(v[f++]=e[0],v[f++]=e[1],v[f++]=e[2],v[f++]=r[0],v[f++]=r[1],v[f++]=t[0],v[f++]=t[1],v[f++]=t[2],this._parameters.worldSpace&&(v[f++]=p[0],v[f++]=p[1],v[f++]=p[2]),this._parameters.vvSize?v[f++]=d:v[f++]=m,this._parameters.vvColor)v[f++]=T;else{const e=Math.min(4*i,A.length-4);v[f++]=A[e],v[f++]=A[e+1],v[f++]=A[e+2],v[f++]=A[e+3]}this._parameters.vvOpacity&&(v[f++]=_)};let S;!function(e){e[e.ASCENDING=1]="ASCENDING",e[e.DESCENDING=-1]="DESCENDING"}(S||(S={}));const g=(s,a)=>{const o=e(O,h[3*s],h[3*s+1],h[3*s+2]),n=R;let u=s+a;do{e(n,h[3*u],h[3*u+1],h[3*u+2]),u+=a}while(t(o,n)&&u>=0&&u<c);i&&(r(o,o,i),r(n,n,i)),E(o,n,[-1,-1],s),E(o,n,[1,-1],s),E(o,n,[1,1],s),E(o,n,[-1,-1],s),E(o,n,[1,1],s),E(o,n,[-1,1],s)},I=this._parameters.placement;"begin"!==I&&"begin-end"!==I||g(0,S.ASCENDING),"end"!==I&&"begin-end"!==I||g(c-1,S.DESCENDING)}}const O=i(),R=i();export{v as LineMarkerMaterial,E as Parameters};
5
+ import{s as e,G as t,m as r}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{newLayout as s}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as a}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as n}from"../lib/GLTextureMaterial.js";import{Material as o,RenderOccludedFlag as h}from"../lib/Material.js";import{RenderSlot as c}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as p}from"./VisualVariablePassParameters.js";import{vertexAttributeLocations as m,LineMarkerTechnique as l}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d,LineMarkerSpace as A,LineMarkerAnchor as T}from"../shaders/LineMarkerTechniqueConfiguration.js";import{CapType as _}from"../shaders/RibbonLineTechniqueConfiguration.js";class v extends o{constructor(e){super(e,new E),this._vertexAttributeLocations=m,this._configuration=new d,this._layout=this.createLayout()}dispose(){}getConfiguration(e,t){return this._configuration.output=e,this._configuration.space=t.slot===c.DRAPED_MATERIAL?A.Draped:this.parameters.worldSpace?A.World:A.Screen,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=this.parameters.cap!==_.BUTT,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.occluder=this.parameters.renderOccluded===h.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(){}createLayout(){const e=s().vec3f(u.POSITION).vec2f(u.UV0).vec3f(u.AUXPOS1);return this.parameters.worldSpace&&e.vec3f(u.NORMAL),this.parameters.vvSize?e.f32(u.SIZEFEATUREATTRIBUTE):e.f32(u.SIZE),this.parameters.vvColor?e.f32(u.COLORFEATUREATTRIBUTE):e.vec4f(u.COLOR),this.parameters.vvOpacity&&e.f32(u.OPACITYFEATUREATTRIBUTE),e}createBufferWriter(){return new O(this._layout,this.parameters)}canRender(e,t){if(t===a.Color||t===a.Alpha||t===a.Highlight||t===a.Depth){if(e===c.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===h.OccludeAndTransparentStencil)return e===c.OPAQUE_MATERIAL||e===c.OCCLUDER_MATERIAL||e===c.TRANSPARENT_OCCLUDER_MATERIAL;if(t===a.Color||t===a.Alpha){return e===(this.parameters.writeDepth?c.TRANSPARENT_MATERIAL:c.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return e===c.OPAQUE_MATERIAL}return!1}createGLMaterial(e){return new f(e)}}class f extends n{constructor(){super(...arguments),this._markerPrimitive=null}dispose(){super.dispose(),this._markerTextureRepository.release(this._markerPrimitive),this._markerPrimitive=null}_updateParameters(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextureRepository.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(l,e)}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output!==a.Color&&this._output!==a.Alpha||this._updateOccludeeState(e),this._updateParameters(e)}}class E extends p{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=_.BUTT,this.anchor=T.Center,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.hasOccludees=!1,this.markerTexture=null}}class O{constructor(e,t){this.vertexBufferLayout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,s,a,n,o){const h=a.vertexAttributes.get(u.POSITION).data,c=h.length/3;let p=[1,0,0];const m=a.vertexAttributes.get(u.NORMAL);this._parameters.worldSpace&&null!=m&&(p=m.data);let l=1,d=0;this._parameters.vvSize?d=a.vertexAttributes.get(u.SIZEFEATUREATTRIBUTE).data[0]:a.vertexAttributes.has(u.SIZE)&&(l=a.vertexAttributes.get(u.SIZE).data[0]);let A=[1,1,1,1],T=0;this._parameters.vvColor?T=a.vertexAttributes.get(u.COLORFEATUREATTRIBUTE).data[0]:a.vertexAttributes.has(u.COLOR)&&(A=a.vertexAttributes.get(u.COLOR).data);let _=0;this._parameters.vvOpacity&&(_=a.vertexAttributes.get(u.OPACITYFEATUREATTRIBUTE).data[0]);const v=new Float32Array(n.buffer);let f=o*(this.vertexBufferLayout.stride/4);const E=(e,t,r,i)=>{if(v[f++]=e[0],v[f++]=e[1],v[f++]=e[2],v[f++]=r[0],v[f++]=r[1],v[f++]=t[0],v[f++]=t[1],v[f++]=t[2],this._parameters.worldSpace&&(v[f++]=p[0],v[f++]=p[1],v[f++]=p[2]),this._parameters.vvSize?v[f++]=d:v[f++]=l,this._parameters.vvColor)v[f++]=T;else{const e=Math.min(4*i,A.length-4);v[f++]=A[e],v[f++]=A[e+1],v[f++]=A[e+2],v[f++]=A[e+3]}this._parameters.vvOpacity&&(v[f++]=_)};let O;!function(e){e[e.ASCENDING=1]="ASCENDING",e[e.DESCENDING=-1]="DESCENDING"}(O||(O={}));const g=(s,a)=>{const n=e(S,h[3*s],h[3*s+1],h[3*s+2]),o=R;let u=s+a;do{e(o,h[3*u],h[3*u+1],h[3*u+2]),u+=a}while(t(n,o)&&u>=0&&u<c);i&&(r(n,n,i),r(o,o,i)),E(n,o,[-1,-1],s),E(n,o,[1,-1],s),E(n,o,[1,1],s),E(n,o,[-1,-1],s),E(n,o,[1,1],s),E(n,o,[-1,1],s)},I=this._parameters.placement;"begin"!==I&&"begin-end"!==I||g(0,O.ASCENDING),"end"!==I&&"begin-end"!==I||g(c-1,O.DESCENDING)}}const S=i(),R=i();export{v as LineMarkerMaterial,E as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{s as t,n as e,b as r,f as s,i as o,m as n}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{newLayout as c}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import f from"../lib/GLMaterial.js";import{Material as l,MaterialParameters as p}from"../lib/Material.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{MeasurementArrowTechniqueConfiguration as d,MeasurementArrowTechnique as g}from"../shaders/MeasurementArrowTechnique.js";class O extends l{constructor(t){super(t,new T),this._configuration=new d}getConfiguration(t,e){return this._configuration.polygonOffsetEnabled=this.parameters.polygonOffset,this._configuration.transparent=this._transparent,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration}dispose(){}intersect(){}requiresSlot(t,e){if(e===u.Color||e===u.Alpha){return t===(this._transparent?h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:h.OPAQUE_MATERIAL)}return!1}createGLMaterial(t){return new A(t)}createBufferWriter(){return new j}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class A extends f{beginSlot(t){return this.ensureTechnique(g,t)}}class T extends p{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1,this.polygonOffset=!1}}const v=c().vec3f(m.POSITION).vec3f(m.NORMAL).vec2f(m.UV0).f32(m.AUXPOS1),I=i(),_=i(),b=i(),S=i(),L=i();class j{constructor(){this.vertexBufferLayout=v}elementCount(t){return 2*(t.indices.get(m.POSITION).length/2+1)}write(i,a,c,u,f){const l=c.vertexAttributes.get(m.POSITION).data,p=c.vertexAttributes.get(m.NORMAL).data,h=l.length/3,d=c&&c.indices&&c.indices.get(m.POSITION);d&&d.length!==2*(h-1)&&console.warn("MeasurementArrowMaterial does not support indices");const g=I,O=_,A=b,T=S,v=L,j=u.position,y=u.normal,E=u.uv0;let M=0;for(let m=0;m<h;++m){const c=3*m;if(t(g,l[c],l[c+1],l[c+2]),m<h-1){const o=3*(m+1);t(O,l[o],l[o+1],l[o+2]),t(v,p[o],p[o+1],p[o+2]),e(v,v),r(A,O,g),e(A,A),s(T,v,A),e(T,T)}const u=o(g,O);i&&a&&(n(g,g,i),n(O,O,i),n(T,T,a));const d=f+2*m,I=d+1;j.setVec(d,g),j.setVec(I,g),y.setVec(d,T),y.setVec(I,T),E.set(d,0,M),E.set(d,1,-1),E.set(I,0,M),E.set(I,1,1),m<h-1&&(M+=u)}const P=u.auxpos1;for(let t=0;t<2*h;++t)P.set(f+t,M)}}export{O as MeasurementArrowMaterial,T as Parameters};
5
+ import{s as t,n as e,b as r,f as s,i as o,m as n}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{newLayout as c}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import f from"../lib/GLMaterial.js";import{Material as p,MaterialParameters as l}from"../lib/Material.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{MeasurementArrowTechniqueConfiguration as d,MeasurementArrowTechnique as g}from"../shaders/MeasurementArrowTechnique.js";class O extends p{constructor(t){super(t,new T),this._configuration=new d}getConfiguration(t,e){return this._configuration.polygonOffsetEnabled=this.parameters.polygonOffset,this._configuration.transparent=this._transparent,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration}dispose(){}intersect(){}canRender(t,e){if(e===u.Color||e===u.Alpha){return t===(this._transparent?h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL:h.OPAQUE_MATERIAL)}return!1}createGLMaterial(t){return new A(t)}createBufferWriter(){return new j}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class A extends f{beginSlot(t){return this.ensureTechnique(g,t)}}class T extends l{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1,this.polygonOffset=!1}}const v=c().vec3f(m.POSITION).vec3f(m.NORMAL).vec2f(m.UV0).f32(m.AUXPOS1),I=i(),_=i(),b=i(),L=i(),S=i();class j{constructor(){this.vertexBufferLayout=v}elementCount(t){return 2*(t.indices.get(m.POSITION).length/2+1)}write(i,a,c,u,f){const p=c.vertexAttributes.get(m.POSITION).data,l=c.vertexAttributes.get(m.NORMAL).data,h=p.length/3,d=c&&c.indices&&c.indices.get(m.POSITION);d&&d.length!==2*(h-1)&&console.warn("MeasurementArrowMaterial does not support indices");const g=I,O=_,A=b,T=L,v=S,j=u.position,y=u.normal,E=u.uv0;let M=0;for(let m=0;m<h;++m){const c=3*m;if(t(g,p[c],p[c+1],p[c+2]),m<h-1){const o=3*(m+1);t(O,p[o],p[o+1],p[o+2]),t(v,l[o],l[o+1],l[o+2]),e(v,v),r(A,O,g),e(A,A),s(T,v,A),e(T,T)}const u=o(g,O);i&&a&&(n(g,g,i),n(O,O,i),n(T,T,a));const d=f+2*m,I=d+1;j.setVec(d,g),j.setVec(I,g),y.setVec(d,T),y.setVec(I,T),E.set(d,0,M),E.set(d,1,-1),E.set(I,0,M),E.set(I,1,1),m<h-1&&(M+=u)}const P=u.auxpos1;for(let t=0;t<2*h;++t)P.set(f+t,M)}}export{O as MeasurementArrowMaterial,T as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{j as s}from"../../../../chunks/vec2.js";import{s as i,b as o,e as n,g as a,a as l,c as u,l as c,i as p,m as f}from"../../../../chunks/vec3.js";import{c as m}from"../../../../chunks/vec3f64.js";import{O as h}from"../../../../chunks/vec4f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as g,distance2 as A,fromPoints as _,closestLineSegmentPoint as O}from"../../../../geometry/support/lineSegment.js";import{create as S,fromPoints as T,signedDistance as P,normal as j}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as b,BufferViewVec2f as x}from"../../../../geometry/support/buffer/BufferView.js";import{ShaderOutput as y}from"../core/shaderLibrary/ShaderOutput.js";import R from"../lib/GLMaterial.js";import{Material as v,MaterialParameters as E}from"../lib/Material.js";import{RenderSlot as N}from"../lib/RenderSlot.js";import{isTranslationMatrix as I}from"../lib/Util.js";import{VertexAttribute as L}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as w}from"./DefaultBufferWriter.js";import{PositionColorLayout as C,PositionLayout as U}from"./DefaultLayouts.js";import{writeDefaultAttributes as V}from"./internal/bufferWriterUtils.js";import{NativeLineTechnique as M}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as D}from"../shaders/NativeLineTechniqueConfiguration.js";var B;!function(e){e[e.START=0]="START",e[e.END=1]="END"}(B||(B={}));class X extends v{constructor(e){super(e,new W),this._configuration=new D}getConfiguration(e,t){this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.draped=t.slot===N.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.stipplePreferContinuous=this.parameters.stipplePreferContinuous,this._configuration}intersect(t,r,f,m,h,g){if(!f.options.selectionMode||!t.visible)return;if(!I(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const S=t.vertexAttributes.get(L.POSITION).data,b=f.camera,x=ee;s(x,f.point);const y=2;i(te[0],x[0]-y,x[1]+y,0),i(te[1],x[0]+y,x[1]+y,0),i(te[2],x[0]+y,x[1]-y,0),i(te[3],x[0]-y,x[1]-y,0);for(let e=0;e<4;e++)if(!b.unprojectFromRenderScreen(te[e],re[e]))return;T(b.eye,re[0],re[1],se),T(b.eye,re[1],re[2],ie),T(b.eye,re[2],re[3],oe),T(b.eye,re[3],re[0],ne);let R=Number.MAX_VALUE,v=0;for(let e=0;e<S.length-5;e+=3){if(F[0]=S[e]+r[12],F[1]=S[e+1]+r[13],F[2]=S[e+2]+r[14],G[0]=S[e+3]+r[12],G[1]=S[e+4]+r[13],G[2]=S[e+5]+r[14],P(se,F)<0&&P(se,G)<0||P(ie,F)<0&&P(ie,G)<0||P(oe,F)<0&&P(oe,G)<0||P(ne,F)<0&&P(ne,G)<0)continue;if(b.projectToRenderScreen(F,Z),b.projectToRenderScreen(G,z),Z[2]<0&&z[2]>0){o(H,F,G);const e=b.frustum,t=-P(e[d.NEAR],F)/n(H,j(e[d.NEAR]));a(H,H,t),l(F,F,H),b.projectToRenderScreen(F,Z)}else if(Z[2]>0&&z[2]<0){o(H,G,F);const e=b.frustum,t=-P(e[d.NEAR],G)/n(H,j(e[d.NEAR]));a(H,H,t),l(G,G,H),b.projectToRenderScreen(G,z)}else if(Z[2]<0&&z[2]<0)continue;Z[2]=0,z[2]=0;const t=A(_(Z,z,Y),x);t<R&&(R=t,u(J,F),u(K,G),v=e/3)}const E=f.rayBegin,N=f.rayEnd;if(R<y*y){let e=Number.MAX_VALUE;if(O(_(J,K,Y),_(E,N,$),Q)){o(Q,Q,E);const t=c(Q);a(Q,Q,1/t),e=t/p(E,N)}g(e,Q,v,!1)}}intersectDraped(e,r,s,i,o,n){if(!s.options.selectionMode)return;const a=e.vertexAttributes.get(L.POSITION).data,l=e.vertexAttributes.get(L.SIZE),u=l?l.data[0]:0,c=i[0],p=i[1],f=((u+1)/2+4)*e.screenToWorldRatio;let m=Number.MAX_VALUE,h=0;for(let d=0;d<a.length-5;d+=3){const e=a[d],r=a[d+1],s=c-e,i=p-r,o=a[d+3]-e,n=a[d+4]-r,l=t((o*s+n*i)/(o*o+n*n),0,1),u=o*l-s,f=n*l-i,g=u*u+f*f;g<m&&(m=g,h=d/3)}m<f*f&&o(n.dist,n.normal,h,!1)}requiresSlot(e,t){return!(t!==y.Color&&t!==y.Highlight&&t!==y.ObjectAndLayerIdColor||e!==N.OPAQUE_MATERIAL&&e!==N.DRAPED_MATERIAL)}createGLMaterial(e){return new k(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?C:U;return null==this.parameters.stipplePattern?new w(e):new q(e.clone().vec3f(L.AUXPOS1).vec2f(L.UV0))}}class k extends R{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output===y.Color&&this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextureRepository.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(M,e)}}class q{constructor(e){this.vertexBufferLayout=e}elementCount(e){return e.indices.get(L.POSITION).length}write(e,t,r,s,i){V(r,this.vertexBufferLayout,e,t,s,i),this._writeAuxpos1(e,r,s,i),this._writeUV0(e,r,s,i)}_writeAuxpos1(e,t,r,s){const i=r.getField(L.AUXPOS1,b),o=t.indices.get(L.POSITION),n=t.vertexAttributes.get(L.POSITION).data,a=e,l=i.typedBufferStride,u=i.typedBuffer;s*=l;for(let c=0;c<o.length-1;c+=2)for(const e of[1,0]){const t=3*o[c+e],r=n[t],i=n[t+1],p=n[t+2],f=a[0]*r+a[4]*i+a[8]*p+a[12],m=a[1]*r+a[5]*i+a[9]*p+a[13],h=a[2]*r+a[6]*i+a[10]*p+a[14];u[s]=f,u[s+1]=m,u[s+2]=h,s+=l}}_writeUV0(e,t,r,s){const o=r.getField(L.UV0,x),n=t.indices.get(L.POSITION),a=t.vertexAttributes.get(L.POSITION).data,l=t.vertexAttributes.get(L.DISTANCETOSTART)?.data,c=o.typedBufferStride,m=o.typedBuffer;let h=0;m[s*=c]=B.START,m[s+1]=h,s+=c;const d=3*n[0],g=i(F,a[d],a[d+1],a[d+2]);e&&f(g,g,e);const A=G,_=n.length-1;let O=1;const S=l?(e,t,r)=>h=l[r]:(e,t,r)=>h+=p(e,t);for(let p=1;p<_;p+=2){const t=3*n[p];i(A,a[t],a[t+1],a[t+2]),e&&f(A,A,e),S(g,A,O++);for(let e=0;e<2;++e)m[s]=1-e,m[s+1]=h,s+=c;u(g,A)}const T=3*n[_];i(A,a[T],a[T+1],a[T+2]),e&&f(A,A,e),S(g,A,O),m[s]=B.END,m[s+1]=h}}class W extends E{constructor(){super(...arguments),this.color=h,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1,this.stipplePreferContinuous=!0,this.hasOccludees=!1,this.stippleTexture=null}}const F=m(),G=m(),H=m(),Q=m(),Z=r(),z=r(),J=m(),K=m(),Y=g(),$=g(),ee=m(),te=[r(),r(),r(),r()],re=[m(),m(),m(),m()],se=S(),ie=S(),oe=S(),ne=S();export{X as NativeLineMaterial,W as Parameters};
5
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{j as s}from"../../../../chunks/vec2.js";import{s as i,b as o,e as n,g as a,a as l,c,l as u,i as p,m as f}from"../../../../chunks/vec3.js";import{c as m}from"../../../../chunks/vec3f64.js";import{O as h}from"../../../../chunks/vec4f64.js";import{PlaneIndex as d}from"../../../../geometry/support/frustum.js";import{create as g,distance2 as A,fromPoints as _,closestLineSegmentPoint as O}from"../../../../geometry/support/lineSegment.js";import{create as T,fromPoints as S,signedDistance as P,normal as j}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as b,BufferViewVec2f as x}from"../../../../geometry/support/buffer/BufferView.js";import{ShaderOutput as R}from"../core/shaderLibrary/ShaderOutput.js";import y from"../lib/GLMaterial.js";import{Material as v,MaterialParameters as E}from"../lib/Material.js";import{RenderSlot as N}from"../lib/RenderSlot.js";import{isTranslationMatrix as I}from"../lib/Util.js";import{VertexAttribute as L}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as w}from"./DefaultBufferWriter.js";import{PositionColorLayout as C,PositionLayout as U}from"./DefaultLayouts.js";import{writeDefaultAttributes as V}from"./internal/bufferWriterUtils.js";import{NativeLineTechnique as M}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as D}from"../shaders/NativeLineTechniqueConfiguration.js";var B;!function(e){e[e.START=0]="START",e[e.END=1]="END"}(B||(B={}));class X extends v{constructor(e){super(e,new q),this._configuration=new D}getConfiguration(e,t){this._configuration.output=e,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.draped=t.slot===N.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.stipplePreferContinuous=this.parameters.stipplePreferContinuous,this._configuration}intersect(t,r,f,m,h,g){if(!f.options.selectionMode||!t.visible)return;if(!I(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const T=t.vertexAttributes.get(L.POSITION).data,b=f.camera,x=ee;s(x,f.point);const R=2;i(te[0],x[0]-R,x[1]+R,0),i(te[1],x[0]+R,x[1]+R,0),i(te[2],x[0]+R,x[1]-R,0),i(te[3],x[0]-R,x[1]-R,0);for(let e=0;e<4;e++)if(!b.unprojectFromRenderScreen(te[e],re[e]))return;S(b.eye,re[0],re[1],se),S(b.eye,re[1],re[2],ie),S(b.eye,re[2],re[3],oe),S(b.eye,re[3],re[0],ne);let y=Number.MAX_VALUE,v=0;for(let e=0;e<T.length-5;e+=3){if(F[0]=T[e]+r[12],F[1]=T[e+1]+r[13],F[2]=T[e+2]+r[14],G[0]=T[e+3]+r[12],G[1]=T[e+4]+r[13],G[2]=T[e+5]+r[14],P(se,F)<0&&P(se,G)<0||P(ie,F)<0&&P(ie,G)<0||P(oe,F)<0&&P(oe,G)<0||P(ne,F)<0&&P(ne,G)<0)continue;if(b.projectToRenderScreen(F,Z),b.projectToRenderScreen(G,z),Z[2]<0&&z[2]>0){o(H,F,G);const e=b.frustum,t=-P(e[d.NEAR],F)/n(H,j(e[d.NEAR]));a(H,H,t),l(F,F,H),b.projectToRenderScreen(F,Z)}else if(Z[2]>0&&z[2]<0){o(H,G,F);const e=b.frustum,t=-P(e[d.NEAR],G)/n(H,j(e[d.NEAR]));a(H,H,t),l(G,G,H),b.projectToRenderScreen(G,z)}else if(Z[2]<0&&z[2]<0)continue;Z[2]=0,z[2]=0;const t=A(_(Z,z,Y),x);t<y&&(y=t,c(J,F),c(K,G),v=e/3)}const E=f.rayBegin,N=f.rayEnd;if(y<R*R){let e=Number.MAX_VALUE;if(O(_(J,K,Y),_(E,N,$),Q)){o(Q,Q,E);const t=u(Q);a(Q,Q,1/t),e=t/p(E,N)}g(e,Q,v,!1)}}intersectDraped(e,r,s,i,o,n){if(!s.options.selectionMode)return;const a=e.vertexAttributes.get(L.POSITION).data,l=e.vertexAttributes.get(L.SIZE),c=l?l.data[0]:0,u=i[0],p=i[1],f=((c+1)/2+4)*e.screenToWorldRatio;let m=Number.MAX_VALUE,h=0;for(let d=0;d<a.length-5;d+=3){const e=a[d],r=a[d+1],s=u-e,i=p-r,o=a[d+3]-e,n=a[d+4]-r,l=t((o*s+n*i)/(o*o+n*n),0,1),c=o*l-s,f=n*l-i,g=c*c+f*f;g<m&&(m=g,h=d/3)}m<f*f&&o(n.dist,n.normal,h,!1)}canRender(e,t){return!(t!==R.Color&&t!==R.Highlight&&t!==R.ObjectAndLayerIdColor||e!==N.OPAQUE_MATERIAL&&e!==N.DRAPED_MATERIAL)}createGLMaterial(e){return new k(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?C:U;return null==this.parameters.stipplePattern?new w(e):new W(e.clone().vec3f(L.AUXPOS1).vec2f(L.UV0))}}class k extends y{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output===R.Color&&this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextureRepository.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(M,e)}}class W{constructor(e){this.vertexBufferLayout=e}elementCount(e){return e.indices.get(L.POSITION).length}write(e,t,r,s,i){V(r,this.vertexBufferLayout,e,t,s,i),this._writeAuxpos1(e,r,s,i),this._writeUV0(e,r,s,i)}_writeAuxpos1(e,t,r,s){const i=r.getField(L.AUXPOS1,b),o=t.indices.get(L.POSITION),n=t.vertexAttributes.get(L.POSITION).data,a=e,l=i.typedBufferStride,c=i.typedBuffer;s*=l;for(let u=0;u<o.length-1;u+=2)for(const e of[1,0]){const t=3*o[u+e],r=n[t],i=n[t+1],p=n[t+2],f=a[0]*r+a[4]*i+a[8]*p+a[12],m=a[1]*r+a[5]*i+a[9]*p+a[13],h=a[2]*r+a[6]*i+a[10]*p+a[14];c[s]=f,c[s+1]=m,c[s+2]=h,s+=l}}_writeUV0(e,t,r,s){const o=r.getField(L.UV0,x),n=t.indices.get(L.POSITION),a=t.vertexAttributes.get(L.POSITION).data,l=t.vertexAttributes.get(L.DISTANCETOSTART)?.data,u=o.typedBufferStride,m=o.typedBuffer;let h=0;m[s*=u]=B.START,m[s+1]=h,s+=u;const d=3*n[0],g=i(F,a[d],a[d+1],a[d+2]);e&&f(g,g,e);const A=G,_=n.length-1;let O=1;const T=l?(e,t,r)=>h=l[r]:(e,t,r)=>h+=p(e,t);for(let p=1;p<_;p+=2){const t=3*n[p];i(A,a[t],a[t+1],a[t+2]),e&&f(A,A,e),T(g,A,O++);for(let e=0;e<2;++e)m[s]=1-e,m[s+1]=h,s+=u;c(g,A)}const S=3*n[_];i(A,a[S],a[S+1],a[S+2]),e&&f(A,A,e),T(g,A,O),m[s]=B.END,m[s+1]=h}}class q extends E{constructor(){super(...arguments),this.color=h,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1,this.stipplePreferContinuous=!0,this.hasOccludees=!1,this.stippleTexture=null}}const F=m(),G=m(),H=m(),Q=m(),Z=r(),z=r(),J=m(),K=m(),Y=g(),$=g(),ee=m(),te=[r(),r(),r(),r()],re=[m(),m(),m(),m()],se=T(),ie=T(),oe=T(),ne=T();export{X as NativeLineMaterial,q as Parameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as e}from"../../../../core/mathUtils.js";import{fromValues as t}from"../../../../geometry/support/aaBoundingBox.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{NormalsDoubleSidedMode as a}from"../core/shaderLibrary/shading/Normals.glsl.js";import s from"../lib/GLMaterial.js";import{Material as o}from"../lib/Material.js";import{isPathGeometry as n}from"../lib/PathGeometry.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{VertexAttribute as c}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as u}from"./DefaultBufferWriter.js";import{vertexAttributeLocations as l,PathTechniqueConfiguration as d,PathTechnique as p,PathPassParameters as m}from"./PathTechnique.js";import{intersectAabbInvDir as f}from"./internal/MaterialUtil.js";class b extends o{constructor(e){super(e,new g),this.supportsEdges=!0,this._vertexAttributeLocations=l,this._configuration=new d,this._vertexBufferLayout=b.getVertexBufferLayout()}getConfiguration(e,t){return this._configuration.output=e,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasOccludees=this.parameters.hasOccludees,e!==i.Color&&e!==i.Alpha||(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?a.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?a.WindingOrder:a.None,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.receiveAmbientOcclusion=!!t.ssaoHelper.active&&this.parameters.receiveSSAO),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}isVisibleForOutput(e){return e!==i.Shadow&&e!==i.ShadowExcludeHighlight&&e!==i.ShadowHighlight||this.parameters.castShadows}isVisible(){return super.isVisible()&&this.parameters.opacity>0}intersect(r,i,a,s,o,h){const c=r;if(!n(c))return;const u=c.path,l=[this.parameters.size[0],this.parameters.size[1]];if(this.parameters.vvSize){const{offset:t,factor:r,minSize:i,maxSize:a}=this.parameters.vvSize,s=u.sizeAttributeValue;l[0]*=e(t[0]+s*r[0],i[0],a[0]),l[1]*=e(t[2]+s*r[2],i[2],a[2])}const d=Math.max(l[0],l[1]),p=r.boundingInfo;if(null==p)return void this._intersectTriangles(u,l,s,o,h);const m=t(p.bbMin[0]-d,p.bbMin[1]-d,p.bbMin[2]-d,p.bbMax[0]+d,p.bbMax[1]+d,p.bbMax[2]+d),b=[o[0]-s[0],o[1]-s[1],o[2]-s[2]],S=Math.sqrt(b[0]*b[0]+b[1]*b[1]+b[2]*b[2]),g=[S/b[0],S/b[1],S/b[2]];f(m,s,g,a.tolerance)&&this._intersectTriangles(u,l,s,o,h)}_intersectTriangles(e,t,r,i,a){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(r,i,a)}createBufferWriter(){return new u(this._vertexBufferLayout)}requiresSlot(e,t){switch(t){case i.Shadow:case i.ShadowHighlight:case i.ShadowExcludeHighlight:if(!this.parameters.castShadows)return!1;case i.Color:case i.Alpha:case i.Depth:case i.Normal:case i.Highlight:case i.ObjectAndLayerIdColor:return e===(this.parameters.transparent?h.TRANSPARENT_MATERIAL:h.OPAQUE_MATERIAL)||e===h.DRAPED_MATERIAL;default:return!1}}createGLMaterial(e){return new S(e)}static getVertexBufferLayout(){return r().vec3f(c.POSITION).vec4f(c.PROFILERIGHT).vec4f(c.PROFILEUP).vec4f(c.PROFILEVERTEXANDNORMAL).vec4f(c.FEATUREVALUE)}}class S extends s{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}_updateShadowState(e){null!=this.technique&&e.shadowMap.enabled===this.technique.configuration.receiveShadows||this._material.setParameters({receiveShadows:e.shadowMap.enabled})}beginSlot(e){return this._output!==i.Color&&this._output!==i.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this.ensureTechnique(p,e)}}class g extends m{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.receiveSSAO=!0,this.receiveShadows=!1,this.castShadows=!0,this.hasSlicePlane=!1,this.transparent=!1,this.hasOccludees=!1}}export{b as PathMaterial,g as PathMaterialParameters};
5
+ import{clamp as e}from"../../../../core/mathUtils.js";import{fromValues as t}from"../../../../geometry/support/aaBoundingBox.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{NormalsDoubleSidedMode as a}from"../core/shaderLibrary/shading/Normals.glsl.js";import s from"../lib/GLMaterial.js";import{Material as o}from"../lib/Material.js";import{isPathGeometry as n}from"../lib/PathGeometry.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{VertexAttribute as c}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as u}from"./DefaultBufferWriter.js";import{vertexAttributeLocations as l,PathTechniqueConfiguration as d,PathTechnique as p,PathPassParameters as m}from"./PathTechnique.js";import{intersectAabbInvDir as f}from"./internal/MaterialUtil.js";class b extends o{constructor(e){super(e,new g),this.supportsEdges=!0,this._vertexAttributeLocations=l,this._configuration=new d,this._vertexBufferLayout=b.getVertexBufferLayout()}getConfiguration(e,t){return this._configuration.output=e,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasOccludees=this.parameters.hasOccludees,e!==i.Color&&e!==i.Alpha||(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?a.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?a.WindingOrder:a.None,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.receiveAmbientOcclusion=!!t.ssaoHelper.active&&this.parameters.receiveSSAO),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}isVisibleForOutput(e){return e!==i.Shadow&&e!==i.ShadowExcludeHighlight&&e!==i.ShadowHighlight||this.parameters.castShadows}isVisible(){return super.isVisible()&&this.parameters.opacity>0}intersect(r,i,a,s,o,h){const c=r;if(!n(c))return;const u=c.path,l=[this.parameters.size[0],this.parameters.size[1]];if(this.parameters.vvSize){const{offset:t,factor:r,minSize:i,maxSize:a}=this.parameters.vvSize,s=u.sizeAttributeValue;l[0]*=e(t[0]+s*r[0],i[0],a[0]),l[1]*=e(t[2]+s*r[2],i[2],a[2])}const d=Math.max(l[0],l[1]),p=r.boundingInfo;if(null==p)return void this._intersectTriangles(u,l,s,o,h);const m=t(p.bbMin[0]-d,p.bbMin[1]-d,p.bbMin[2]-d,p.bbMax[0]+d,p.bbMax[1]+d,p.bbMax[2]+d),b=[o[0]-s[0],o[1]-s[1],o[2]-s[2]],S=Math.sqrt(b[0]*b[0]+b[1]*b[1]+b[2]*b[2]),g=[S/b[0],S/b[1],S/b[2]];f(m,s,g,a.tolerance)&&this._intersectTriangles(u,l,s,o,h)}_intersectTriangles(e,t,r,i,a){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(r,i,a)}createBufferWriter(){return new u(this._vertexBufferLayout)}canRender(e,t){switch(t){case i.Shadow:case i.ShadowHighlight:case i.ShadowExcludeHighlight:if(!this.parameters.castShadows)return!1;case i.Color:case i.Alpha:case i.Depth:case i.Normal:case i.Highlight:case i.ObjectAndLayerIdColor:return e===(this.parameters.transparent?h.TRANSPARENT_MATERIAL:h.OPAQUE_MATERIAL)||e===h.DRAPED_MATERIAL;default:return!1}}createGLMaterial(e){return new S(e)}static getVertexBufferLayout(){return r().vec3f(c.POSITION).vec4f(c.PROFILERIGHT).vec4f(c.PROFILEUP).vec4f(c.PROFILEVERTEXANDNORMAL).vec4f(c.FEATUREVALUE)}}class S extends s{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}_updateShadowState(e){null!=this.technique&&e.shadowMap.enabled===this.technique.configuration.receiveShadows||this._material.setParameters({receiveShadows:e.shadowMap.enabled})}beginSlot(e){return this._output!==i.Color&&this._output!==i.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this.ensureTechnique(p,e)}}class g extends m{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.receiveSSAO=!0,this.receiveShadows=!1,this.castShadows=!0,this.hasSlicePlane=!1,this.transparent=!1,this.hasOccludees=!1}}export{b as PathMaterial,g as PathMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{f as t}from"../../../../chunks/vec4f64.js";import{BufferViewMat3f as e,BufferViewVec4f as r}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as s}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as a}from"../lib/basicInterfaces.js";import o from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as n}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{assert as l}from"../lib/Util.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as c}from"./DefaultBufferWriter.js";import{Style as p}from"./PatternStyle.js";import{TriangleMaterial as f}from"./TriangleMaterial.js";import{VisualVariablePassParameters as m}from"./VisualVariablePassParameters.js";import{writeDefaultAttribute as d,writeBufferVec4 as g}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as _,PatternTechniqueConfiguration as A,PatternTechnique as T}from"../shaders/PatternTechnique.js";class b extends f{constructor(t){super(t,new P),this.supportsEdges=!0,this._vertexAttributeLocations=_,this._configuration=new A}getConfiguration(t,e){return this._configuration.output=t,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.style=this.parameters.style,this._configuration.patternSpacing=this.parameters.patternSpacing,this._configuration.lineWidth=this.parameters.lineWidth,this._configuration.draped=this.parameters.draped,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration.enableOffset=e.camera.relativeElevation<n,this._configuration.multipassEnabled=e.multipassEnabled,this._configuration.cullAboveGround=e.multipassTerrain.cullAboveGround,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration}requiresSlot(t,e){if(e===s.Color||e===s.Alpha||e===s.Highlight||e===s.Depth&&this.parameters.writeLinearDepth){if(t===h.DRAPED_MATERIAL)return!0;if(e===s.Highlight)return t===h.OPAQUE_MATERIAL;return t===(this.parameters.writeDepth?h.TRANSPARENT_MATERIAL:h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return!1}createGLMaterial(t){return new E(t)}createBufferWriter(){const t=i().vec3f(u.POSITION).vec4f(u.UVMAPSPACE);return this.parameters.draped||t.mat3f(u.BOUNDINGRECT),this.parameters.vvColor?t.f32(u.COLORFEATUREATTRIBUTE):t.vec4u8(u.COLOR),new O(t)}}class E extends o{_updateParameters(t){return this.ensureTechnique(T,t)}_updateOccludeeState(t){t.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:t.hasOccludees})}beginSlot(t){return this._output!==s.Color&&this._output!==s.Alpha||this._updateOccludeeState(t),this._updateParameters(t)}}class O extends c{write(t,i,s,a,o){for(const n of this.vertexBufferLayout.fields.keys()){const h=s.vertexAttributes.get(n),c=s.indices.get(n);if(h&&c)switch(n){case u.UVMAPSPACE:{l(4===h.size);const t=a.getField(n,r);t&&g(c,h.data,t,o);break}case u.BOUNDINGRECT:{l(9===h.size);const r=a.getField(n,e);r&&this.writeBoundingRect(c,h.data,t,r,o);break}default:d(n,h,c,t,i,a,o)}}}writeBoundingRect(t,e,r,i,s){const a=r,o=i.typedBuffer,n=i.typedBufferStride,h=t.length;s*=n;for(let l=0;l<h;++l){const r=9*t[l],i=e[r],h=e[r+1],u=e[r+2];o[s]=a[0]*i+a[4]*h+a[8]*u+a[12],o[s+1]=a[1]*i+a[5]*h+a[9]*u+a[13],o[s+2]=a[2]*i+a[6]*h+a[10]*u+a[14];for(let t=3;t<9;++t)o[s+t]=e[r+t];s+=n}}}class P extends m{constructor(){super(...arguments),this.color=t(1,1,1,1),this.writeDepth=!0,this.writeLinearDepth=!1,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=a.None,this.hasOccludees=!1,this.style=p.Cross,this.patternSpacing=10,this.lineWidth=1,this.draped=!0}}export{P as Parameters,b as PatternMaterial};
5
+ import{f as t}from"../../../../chunks/vec4f64.js";import{BufferViewMat3f as e,BufferViewVec4f as r}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as s}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as a}from"../lib/basicInterfaces.js";import o from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as n}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{assert as l}from"../lib/Util.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as c}from"./DefaultBufferWriter.js";import{Style as p}from"./PatternStyle.js";import{TriangleMaterial as f}from"./TriangleMaterial.js";import{VisualVariablePassParameters as m}from"./VisualVariablePassParameters.js";import{writeDefaultAttribute as d,writeBufferVec4 as g}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as _,PatternTechniqueConfiguration as A,PatternTechnique as T}from"../shaders/PatternTechnique.js";class b extends f{constructor(t){super(t,new P),this.supportsEdges=!0,this._vertexAttributeLocations=_,this._configuration=new A}getConfiguration(t,e){return this._configuration.output=t,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.style=this.parameters.style,this._configuration.patternSpacing=this.parameters.patternSpacing,this._configuration.lineWidth=this.parameters.lineWidth,this._configuration.draped=this.parameters.draped,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration.enableOffset=e.camera.relativeElevation<n,this._configuration.multipassEnabled=e.multipassEnabled,this._configuration.cullAboveGround=e.multipassTerrain.cullAboveGround,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration}canRender(t,e){if(e===s.Color||e===s.Alpha||e===s.Highlight||e===s.Depth&&this.parameters.writeLinearDepth){if(t===h.DRAPED_MATERIAL)return!0;if(e===s.Highlight)return t===h.OPAQUE_MATERIAL;return t===(this.parameters.writeDepth?h.TRANSPARENT_MATERIAL:h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return!1}createGLMaterial(t){return new E(t)}createBufferWriter(){const t=i().vec3f(u.POSITION).vec4f(u.UVMAPSPACE);return this.parameters.draped||t.mat3f(u.BOUNDINGRECT),this.parameters.vvColor?t.f32(u.COLORFEATUREATTRIBUTE):t.vec4u8(u.COLOR),new O(t)}}class E extends o{_updateParameters(t){return this.ensureTechnique(T,t)}_updateOccludeeState(t){t.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:t.hasOccludees})}beginSlot(t){return this._output!==s.Color&&this._output!==s.Alpha||this._updateOccludeeState(t),this._updateParameters(t)}}class O extends c{write(t,i,s,a,o){for(const n of this.vertexBufferLayout.fields.keys()){const h=s.vertexAttributes.get(n),c=s.indices.get(n);if(h&&c)switch(n){case u.UVMAPSPACE:{l(4===h.size);const t=a.getField(n,r);t&&g(c,h.data,t,o);break}case u.BOUNDINGRECT:{l(9===h.size);const r=a.getField(n,e);r&&this.writeBoundingRect(c,h.data,t,r,o);break}default:d(n,h,c,t,i,a,o)}}}writeBoundingRect(t,e,r,i,s){const a=r,o=i.typedBuffer,n=i.typedBufferStride,h=t.length;s*=n;for(let l=0;l<h;++l){const r=9*t[l],i=e[r],h=e[r+1],u=e[r+2];o[s]=a[0]*i+a[4]*h+a[8]*u+a[12],o[s+1]=a[1]*i+a[5]*h+a[9]*u+a[13],o[s+2]=a[2]*i+a[6]*h+a[10]*u+a[14];for(let t=3;t<9;++t)o[s+t]=e[r+t];s+=n}}}class P extends m{constructor(){super(...arguments),this.color=t(1,1,1,1),this.writeDepth=!0,this.writeLinearDepth=!1,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=a.None,this.hasOccludees=!1,this.style=p.Cross,this.patternSpacing=10,this.lineWidth=1,this.draped=!0}}export{P as Parameters,b as PatternMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{j as i}from"../../../../chunks/vec2.js";import{s,b as a,e as n,g as o,a as l,c,l as h,i as u,m as p}from"../../../../chunks/vec3.js";import{c as m}from"../../../../chunks/vec3f64.js";import{O as f}from"../../../../chunks/vec4f64.js";import{PlaneIndex as T}from"../../../../geometry/support/frustum.js";import{create as _,distance2 as d,fromPoints as A,closestLineSegmentPoint as E}from"../../../../geometry/support/lineSegment.js";import{create as v,fromPoints as R,signedDistance as S,normal as g}from"../../../../geometry/support/plane.js";import{newLayout as I}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as O}from"../core/shaderLibrary/ShaderOutput.js";import b from"../lib/GLMaterial.js";import{Material as P,RenderOccludedFlag as L}from"../lib/Material.js";import{RenderSlot as N}from"../lib/RenderSlot.js";import{isTranslationMatrix as C}from"../lib/Util.js";import{VertexAttribute as y}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as j}from"./VisualVariablePassParameters.js";import{LineMarkerAnchor as D}from"../shaders/LineMarkerTechniqueConfiguration.js";import{R as U}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as x,RibbonLineTechnique as F}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as w,CapType as J}from"../shaders/RibbonLineTechniqueConfiguration.js";var M;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(M||(M={}));class B extends P{constructor(e){super(e,new G),this._configuration=new w,this._vertexAttributeLocations=x}isClosed(e,t){return V(this.parameters,e,t)}getConfiguration(e,t){this._configuration.output=e,this._configuration.draped=t.slot===N.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==O.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stippleScaleWithLineWidth=r&&this.parameters.stippleScaleWithLineWidth,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&Z(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.occluder=this.parameters.renderOccluded===L.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.wireframe=this.parameters.wireframe,this._configuration}intersectDraped(e,r,i,s,a,n){if(!i.options.selectionMode)return;const o=e.vertexAttributes.get(y.POSITION).data,l=e.vertexAttributes.get(y.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const r=e.vertexAttributes.get(y.SIZEFEATUREATTRIBUTE).data[0];c*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const h=s[0],u=s[1],p=(c/2+4)*e.screenToWorldRatio;let m=Number.MAX_VALUE,f=0;for(let T=0;T<o.length-5;T+=3){const e=o[T],r=o[T+1],i=h-e,s=u-r,a=o[T+3]-e,n=o[T+4]-r,l=t((a*i+n*s)/(a*a+n*n),0,1),c=a*l-i,p=n*l-s,_=c*c+p*p;_<m&&(m=_,f=T/3)}m<p*p&&a(n.dist,n.normal,f,!1)}intersect(r,p,m,f,_,v){if(!m.options.selectionMode||!r.visible)return;if(!C(p))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const I=r.vertexAttributes,O=I.get(y.POSITION).data;let b=this.parameters.width;if(this.parameters.vvSize){const e=I.get(y.SIZEFEATUREATTRIBUTE).data[0];b*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else I.has(y.SIZE)&&(b*=I.get(y.SIZE).data[0]);const P=m.camera,L=K;i(L,m.point);const N=b*P.pixelRatio/2+4*P.pixelRatio;s(le[0],L[0]-N,L[1]+N,0),s(le[1],L[0]+N,L[1]+N,0),s(le[2],L[0]+N,L[1]-N,0),s(le[3],L[0]-N,L[1]-N,0);for(let e=0;e<4;e++)if(!P.unprojectFromRenderScreen(le[e],ce[e]))return;R(P.eye,ce[0],ce[1],he),R(P.eye,ce[1],ce[2],ue),R(P.eye,ce[2],ce[3],pe),R(P.eye,ce[3],ce[0],me);let j=Number.MAX_VALUE,D=0;const U=W(this.parameters,I,r.indices)?O.length-2:O.length-5;for(let e=0;e<U;e+=3){q[0]=O[e]+p[12],q[1]=O[e+1]+p[13],q[2]=O[e+2]+p[14];const t=(e+3)%O.length;if(X[0]=O[t]+p[12],X[1]=O[t+1]+p[13],X[2]=O[t+2]+p[14],S(he,q)<0&&S(he,X)<0||S(ue,q)<0&&S(ue,X)<0||S(pe,q)<0&&S(pe,X)<0||S(me,q)<0&&S(me,X)<0)continue;if(P.projectToRenderScreen(q,$),P.projectToRenderScreen(X,ee),$[2]<0&&ee[2]>0){a(Y,q,X);const e=P.frustum,t=-S(e[T.NEAR],q)/n(Y,g(e[T.NEAR]));o(Y,Y,t),l(q,q,Y),P.projectToRenderScreen(q,$)}else if($[2]>0&&ee[2]<0){a(Y,X,q);const e=P.frustum,t=-S(e[T.NEAR],X)/n(Y,g(e[T.NEAR]));o(Y,Y,t),l(X,X,Y),P.projectToRenderScreen(X,ee)}else if($[2]<0&&ee[2]<0)continue;$[2]=0,ee[2]=0;const r=d(A($,ee,ie),L);r<j&&(j=r,c(te,q),c(re,X),D=e/3)}const x=m.rayBegin,F=m.rayEnd;if(j<N*N){let e=Number.MAX_VALUE;if(E(A(te,re,ie),A(x,F,se),Q)){a(Q,Q,x);const t=h(Q);o(Q,Q,1/t),e=t/u(x,F)}v(e,Q,D,!1)}}get _layout(){const e=I().vec3f(y.POSITION).f32(y.SUBDIVISIONFACTOR).vec2f(y.UV0).vec3f(y.AUXPOS1).vec3f(y.AUXPOS2);return this.parameters.vvSize?e.f32(y.SIZEFEATUREATTRIBUTE):e.f32(y.SIZE),this.parameters.vvColor?e.f32(y.COLORFEATUREATTRIBUTE):e.vec4f(y.COLOR),this.parameters.vvOpacity&&e.f32(y.OPACITYFEATUREATTRIBUTE),has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(y.OBJECTANDLAYERIDCOLOR),e}createBufferWriter(){return new H(this._layout,this.parameters)}requiresSlot(e,t){if(t===O.Color||t===O.Alpha||t===O.Highlight||t===O.Depth||t===O.ObjectAndLayerIdColor){if(e===N.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===L.OccludeAndTransparentStencil)return e===N.OPAQUE_MATERIAL||e===N.OCCLUDER_MATERIAL||e===N.TRANSPARENT_OCCLUDER_MATERIAL;if(t===O.Color||t===O.Alpha){return e===(this.parameters.writeDepth?N.TRANSPARENT_MATERIAL:N.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return e===N.OPAQUE_MATERIAL}return!1}createGLMaterial(e){return new z(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class z extends b{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output!==O.Color&&this._output!==O.Alpha||this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextureRepository.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(F,e)}}class G extends j{constructor(){super(...arguments),this.width=0,this.color=f,this.join="miter",this.cap=J.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stippleScaleWithLineWidth=!1,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.hasOccludees=!1,this.wireframe=!1}}class H{constructor(e,t){this._parameters=t,this.numJoinSubdivisions=0,this.vertexBufferLayout=e;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=U+r}}_isClosed(e){return W(this._parameters,e.vertexAttributes,e.indices)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.indices.get(y.POSITION).length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,a){const n=ae,o=ne,l=oe,h=r.vertexAttributes.get(y.POSITION).data,m=r.indices&&r.indices.get(y.POSITION),f=r.vertexAttributes.get(y.DISTANCETOSTART)?.data;m&&m.length!==2*(h.length/3-1)&&console.warn("RibbonLineMaterial does not support indices");let T=1,_=0;this._parameters.vvSize?_=r.vertexAttributes.get(y.SIZEFEATUREATTRIBUTE).data[0]:r.vertexAttributes.has(y.SIZE)&&(T=r.vertexAttributes.get(y.SIZE).data[0]);let d=[1,1,1,1],A=0;this._parameters.vvColor?A=r.vertexAttributes.get(y.COLORFEATUREATTRIBUTE).data[0]:r.vertexAttributes.has(y.COLOR)&&(d=r.vertexAttributes.get(y.COLOR).data);const E=has("enable-feature:objectAndLayerId-rendering")?r.objectAndLayerIdColor:null;let v=0;this._parameters.vvOpacity&&(v=r.vertexAttributes.get(y.OPACITYFEATUREATTRIBUTE).data[0]);const R=h.length/3,S=new Float32Array(i.buffer),g=has("enable-feature:objectAndLayerId-rendering")?new Uint8Array(i.buffer):null,I=this.vertexBufferLayout.stride/4;let O=a*I;const b=O;let P=0;const L=f?(e,t,r)=>P=f[r]:(e,t,r)=>P+=u(e,t),N=has("enable-feature:objectAndLayerId-rendering"),C=(e,t,r,i,s,a,n)=>{if(S[O++]=t[0],S[O++]=t[1],S[O++]=t[2],S[O++]=i,S[O++]=n,S[O++]=s,S[O++]=e[0],S[O++]=e[1],S[O++]=e[2],S[O++]=r[0],S[O++]=r[1],S[O++]=r[2],S[O++]=this._parameters.vvSize?_:T,this._parameters.vvColor)S[O++]=A;else{const e=Math.min(4*a,d.length-4);S[O++]=d[e],S[O++]=d[e+1],S[O++]=d[e+2],S[O++]=d[e+3]}this._parameters.vvOpacity&&(S[O++]=v),N&&(null!=E&&(g[4*O]=E[0],g[4*O+1]=E[1],g[4*O+2]=E[2],g[4*O+3]=E[3]),O++)};O+=I,s(o,h[0],h[1],h[2]),e&&p(o,o,e);const j=this._isClosed(r);if(j){const t=h.length-3;s(n,h[t],h[t+1],h[t+2]),e&&p(n,n,e)}else s(l,h[3],h[4],h[5]),e&&p(l,l,e),C(o,o,l,1,M.LEFT_CAP_START,0,0),C(o,o,l,1,M.RIGHT_CAP_START,0,0),c(n,o),c(o,l);const D=j?0:1,U=j?R:R-1;for(let u=D;u<U;u++){const t=(u+1)%R*3;s(l,h[t],h[t+1],h[t+2]),e&&p(l,l,e),L(n,o,u),C(n,o,l,0,M.LEFT_JOIN_END,u,P),C(n,o,l,0,M.RIGHT_JOIN_END,u,P);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);C(n,o,l,t,M.LEFT_JOIN_END,u,P),C(n,o,l,t,M.RIGHT_JOIN_END,u,P)}C(n,o,l,1,M.LEFT_JOIN_START,u,P),C(n,o,l,1,M.RIGHT_JOIN_START,u,P),c(n,o),c(o,l)}j?(s(l,h[3],h[4],h[5]),e&&p(l,l,e),P=L(n,o,U),C(n,o,l,0,M.LEFT_JOIN_END,D,P),C(n,o,l,0,M.RIGHT_JOIN_END,D,P)):(P=L(n,o,U),C(n,o,o,0,M.LEFT_CAP_END,U,P),C(n,o,o,0,M.RIGHT_CAP_END,U,P)),k(S,b+I,S,b,I);O=k(S,O-I,S,O,I),this._parameters.wireframe&&this._addWireframeVertices(i,b,O,I)}_addWireframeVertices(e,t,r,i){const s=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=k(a,e,s,n,i);for(let l=0;l<a.length-1;l+=2*i)o(l),o(l+2*i),o(l+1*i),o(l+2*i),o(l+1*i),o(l+3*i)}}function k(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function W(e,t,r){return V(e,t.get(y.POSITION).data,r?r.get(y.POSITION):null)}function V(e,t,r){return!!e.isClosed&&(r?r.length>2:t.length>6)}function Z(e){return e.anchor===D.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const q=m(),X=m(),Y=m(),Q=m(),K=m(),$=r(),ee=r(),te=m(),re=m(),ie=_(),se=_(),ae=m(),ne=m(),oe=m(),le=[r(),r(),r(),r()],ce=[m(),m(),m(),m()],he=v(),ue=v(),pe=v(),me=v();export{G as Parameters,B as RibbonLineMaterial};
5
+ import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{j as i}from"../../../../chunks/vec2.js";import{s,b as a,e as n,g as o,a as l,c,l as h,i as u,m as p}from"../../../../chunks/vec3.js";import{c as m}from"../../../../chunks/vec3f64.js";import{O as f}from"../../../../chunks/vec4f64.js";import{PlaneIndex as T}from"../../../../geometry/support/frustum.js";import{create as _,distance2 as d,fromPoints as A,closestLineSegmentPoint as E}from"../../../../geometry/support/lineSegment.js";import{create as v,fromPoints as R,signedDistance as S,normal as g}from"../../../../geometry/support/plane.js";import{newLayout as I}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as O}from"../core/shaderLibrary/ShaderOutput.js";import b from"../lib/GLMaterial.js";import{Material as P,RenderOccludedFlag as L}from"../lib/Material.js";import{RenderSlot as N}from"../lib/RenderSlot.js";import{isTranslationMatrix as C}from"../lib/Util.js";import{VertexAttribute as y}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as j}from"./VisualVariablePassParameters.js";import{LineMarkerAnchor as D}from"../shaders/LineMarkerTechniqueConfiguration.js";import{R as U}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as x,RibbonLineTechnique as F}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as w,CapType as J}from"../shaders/RibbonLineTechniqueConfiguration.js";var M;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(M||(M={}));class B extends P{constructor(e){super(e,new G),this._configuration=new w,this._vertexAttributeLocations=x}isClosed(e,t){return V(this.parameters,e,t)}getConfiguration(e,t){this._configuration.output=e,this._configuration.draped=t.slot===N.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==O.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stippleScaleWithLineWidth=r&&this.parameters.stippleScaleWithLineWidth,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&Z(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.occluder=this.parameters.renderOccluded===L.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.wireframe=this.parameters.wireframe,this._configuration}intersectDraped(e,r,i,s,a,n){if(!i.options.selectionMode)return;const o=e.vertexAttributes.get(y.POSITION).data,l=e.vertexAttributes.get(y.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const r=e.vertexAttributes.get(y.SIZEFEATUREATTRIBUTE).data[0];c*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const h=s[0],u=s[1],p=(c/2+4)*e.screenToWorldRatio;let m=Number.MAX_VALUE,f=0;for(let T=0;T<o.length-5;T+=3){const e=o[T],r=o[T+1],i=h-e,s=u-r,a=o[T+3]-e,n=o[T+4]-r,l=t((a*i+n*s)/(a*a+n*n),0,1),c=a*l-i,p=n*l-s,_=c*c+p*p;_<m&&(m=_,f=T/3)}m<p*p&&a(n.dist,n.normal,f,!1)}intersect(r,p,m,f,_,v){if(!m.options.selectionMode||!r.visible)return;if(!C(p))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const I=r.vertexAttributes,O=I.get(y.POSITION).data;let b=this.parameters.width;if(this.parameters.vvSize){const e=I.get(y.SIZEFEATUREATTRIBUTE).data[0];b*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else I.has(y.SIZE)&&(b*=I.get(y.SIZE).data[0]);const P=m.camera,L=K;i(L,m.point);const N=b*P.pixelRatio/2+4*P.pixelRatio;s(le[0],L[0]-N,L[1]+N,0),s(le[1],L[0]+N,L[1]+N,0),s(le[2],L[0]+N,L[1]-N,0),s(le[3],L[0]-N,L[1]-N,0);for(let e=0;e<4;e++)if(!P.unprojectFromRenderScreen(le[e],ce[e]))return;R(P.eye,ce[0],ce[1],he),R(P.eye,ce[1],ce[2],ue),R(P.eye,ce[2],ce[3],pe),R(P.eye,ce[3],ce[0],me);let j=Number.MAX_VALUE,D=0;const U=W(this.parameters,I,r.indices)?O.length-2:O.length-5;for(let e=0;e<U;e+=3){X[0]=O[e]+p[12],X[1]=O[e+1]+p[13],X[2]=O[e+2]+p[14];const t=(e+3)%O.length;if(Y[0]=O[t]+p[12],Y[1]=O[t+1]+p[13],Y[2]=O[t+2]+p[14],S(he,X)<0&&S(he,Y)<0||S(ue,X)<0&&S(ue,Y)<0||S(pe,X)<0&&S(pe,Y)<0||S(me,X)<0&&S(me,Y)<0)continue;if(P.projectToRenderScreen(X,$),P.projectToRenderScreen(Y,ee),$[2]<0&&ee[2]>0){a(q,X,Y);const e=P.frustum,t=-S(e[T.NEAR],X)/n(q,g(e[T.NEAR]));o(q,q,t),l(X,X,q),P.projectToRenderScreen(X,$)}else if($[2]>0&&ee[2]<0){a(q,Y,X);const e=P.frustum,t=-S(e[T.NEAR],Y)/n(q,g(e[T.NEAR]));o(q,q,t),l(Y,Y,q),P.projectToRenderScreen(Y,ee)}else if($[2]<0&&ee[2]<0)continue;$[2]=0,ee[2]=0;const r=d(A($,ee,ie),L);r<j&&(j=r,c(te,X),c(re,Y),D=e/3)}const x=m.rayBegin,F=m.rayEnd;if(j<N*N){let e=Number.MAX_VALUE;if(E(A(te,re,ie),A(x,F,se),Q)){a(Q,Q,x);const t=h(Q);o(Q,Q,1/t),e=t/u(x,F)}v(e,Q,D,!1)}}get _layout(){const e=I().vec3f(y.POSITION).f32(y.SUBDIVISIONFACTOR).vec2f(y.UV0).vec3f(y.AUXPOS1).vec3f(y.AUXPOS2);return this.parameters.vvSize?e.f32(y.SIZEFEATUREATTRIBUTE):e.f32(y.SIZE),this.parameters.vvColor?e.f32(y.COLORFEATUREATTRIBUTE):e.vec4f(y.COLOR),this.parameters.vvOpacity&&e.f32(y.OPACITYFEATUREATTRIBUTE),has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(y.OBJECTANDLAYERIDCOLOR),e}createBufferWriter(){return new H(this._layout,this.parameters)}canRender(e,t){if(t===O.Color||t===O.Alpha||t===O.Highlight||t===O.Depth||t===O.ObjectAndLayerIdColor){if(e===N.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===L.OccludeAndTransparentStencil)return e===N.OPAQUE_MATERIAL||e===N.OCCLUDER_MATERIAL||e===N.TRANSPARENT_OCCLUDER_MATERIAL;if(t===O.Color||t===O.Alpha){return e===(this.parameters.writeDepth?N.TRANSPARENT_MATERIAL:N.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return e===N.OPAQUE_MATERIAL}return!1}createGLMaterial(e){return new z(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class z extends b{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output!==O.Color&&this._output!==O.Alpha||this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextureRepository.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(F,e)}}class G extends j{constructor(){super(...arguments),this.width=0,this.color=f,this.join="miter",this.cap=J.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stippleScaleWithLineWidth=!1,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.hasOccludees=!1,this.wireframe=!1}}class H{constructor(e,t){this._parameters=t,this.numJoinSubdivisions=0,this.vertexBufferLayout=e;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=U+r}}_isClosed(e){return W(this._parameters,e.vertexAttributes,e.indices)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.indices.get(y.POSITION).length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,a){const n=ae,o=ne,l=oe,h=r.vertexAttributes.get(y.POSITION).data,m=r.indices&&r.indices.get(y.POSITION),f=r.vertexAttributes.get(y.DISTANCETOSTART)?.data;m&&m.length!==2*(h.length/3-1)&&console.warn("RibbonLineMaterial does not support indices");let T=1,_=0;this._parameters.vvSize?_=r.vertexAttributes.get(y.SIZEFEATUREATTRIBUTE).data[0]:r.vertexAttributes.has(y.SIZE)&&(T=r.vertexAttributes.get(y.SIZE).data[0]);let d=[1,1,1,1],A=0;this._parameters.vvColor?A=r.vertexAttributes.get(y.COLORFEATUREATTRIBUTE).data[0]:r.vertexAttributes.has(y.COLOR)&&(d=r.vertexAttributes.get(y.COLOR).data);const E=has("enable-feature:objectAndLayerId-rendering")?r.objectAndLayerIdColor:null;let v=0;this._parameters.vvOpacity&&(v=r.vertexAttributes.get(y.OPACITYFEATUREATTRIBUTE).data[0]);const R=h.length/3,S=new Float32Array(i.buffer),g=has("enable-feature:objectAndLayerId-rendering")?new Uint8Array(i.buffer):null,I=this.vertexBufferLayout.stride/4;let O=a*I;const b=O;let P=0;const L=f?(e,t,r)=>P=f[r]:(e,t,r)=>P+=u(e,t),N=has("enable-feature:objectAndLayerId-rendering"),C=(e,t,r,i,s,a,n)=>{if(S[O++]=t[0],S[O++]=t[1],S[O++]=t[2],S[O++]=i,S[O++]=n,S[O++]=s,S[O++]=e[0],S[O++]=e[1],S[O++]=e[2],S[O++]=r[0],S[O++]=r[1],S[O++]=r[2],S[O++]=this._parameters.vvSize?_:T,this._parameters.vvColor)S[O++]=A;else{const e=Math.min(4*a,d.length-4);S[O++]=d[e],S[O++]=d[e+1],S[O++]=d[e+2],S[O++]=d[e+3]}this._parameters.vvOpacity&&(S[O++]=v),N&&(null!=E&&(g[4*O]=E[0],g[4*O+1]=E[1],g[4*O+2]=E[2],g[4*O+3]=E[3]),O++)};O+=I,s(o,h[0],h[1],h[2]),e&&p(o,o,e);const j=this._isClosed(r);if(j){const t=h.length-3;s(n,h[t],h[t+1],h[t+2]),e&&p(n,n,e)}else s(l,h[3],h[4],h[5]),e&&p(l,l,e),C(o,o,l,1,M.LEFT_CAP_START,0,0),C(o,o,l,1,M.RIGHT_CAP_START,0,0),c(n,o),c(o,l);const D=j?0:1,U=j?R:R-1;for(let u=D;u<U;u++){const t=(u+1)%R*3;s(l,h[t],h[t+1],h[t+2]),e&&p(l,l,e),L(n,o,u),C(n,o,l,0,M.LEFT_JOIN_END,u,P),C(n,o,l,0,M.RIGHT_JOIN_END,u,P);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);C(n,o,l,t,M.LEFT_JOIN_END,u,P),C(n,o,l,t,M.RIGHT_JOIN_END,u,P)}C(n,o,l,1,M.LEFT_JOIN_START,u,P),C(n,o,l,1,M.RIGHT_JOIN_START,u,P),c(n,o),c(o,l)}j?(s(l,h[3],h[4],h[5]),e&&p(l,l,e),P=L(n,o,U),C(n,o,l,0,M.LEFT_JOIN_END,D,P),C(n,o,l,0,M.RIGHT_JOIN_END,D,P)):(P=L(n,o,U),C(n,o,o,0,M.LEFT_CAP_END,U,P),C(n,o,o,0,M.RIGHT_CAP_END,U,P)),k(S,b+I,S,b,I);O=k(S,O-I,S,O,I),this._parameters.wireframe&&this._addWireframeVertices(i,b,O,I)}_addWireframeVertices(e,t,r,i){const s=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=k(a,e,s,n,i);for(let l=0;l<a.length-1;l+=2*i)o(l),o(l+2*i),o(l+1*i),o(l+2*i),o(l+1*i),o(l+3*i)}}function k(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function W(e,t,r){return V(e,t.get(y.POSITION).data,r?r.get(y.POSITION):null)}function V(e,t,r){return!!e.isClosed&&(r?r.length>2:t.length>6)}function Z(e){return e.anchor===D.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const X=m(),Y=m(),q=m(),Q=m(),K=m(),$=r(),ee=r(),te=m(),re=m(),ie=_(),se=_(),ae=m(),ne=m(),oe=m(),le=[r(),r(),r(),r()],ce=[m(),m(),m(),m()],he=v(),ue=v(),pe=v(),me=v();export{G as Parameters,B as RibbonLineMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{n as e,s as t,g as r,a as i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{center as n,scale as o}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as h}from"../lib/basicInterfaces.js";import p from"../lib/GLMaterial.js";import{Material as f,MaterialParameters as m}from"../lib/Material.js";import{RenderSlot as d}from"../lib/RenderSlot.js";import{assert as S}from"../lib/Util.js";import{VertexAttribute as b}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as E,writePosition as g}from"./internal/bufferWriterUtils.js";import{intersectTriangleGeometry as A}from"./internal/MaterialUtil.js";import{ShadedColorMaterialTechniqueConfiguration as T,vertexAttributeLocations as _,ShadedColorMaterialTechnique as F}from"../shaders/ShadedColorMaterialTechnique.js";class v extends f{constructor(e){super(e,new O),this.supportsEdges=!0,this._configuration=new T,this._vertexAttributeLocations=_}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,a,c,l,u){if(this.parameters.screenSizeEnabled){const s=e.vertexAttributes.get(b.OFFSET),h={applyToVertex:(e,n,o,c)=>{const l=t(w,s.data[3*c],s.data[3*c+1],s.data[3*c+2]),u=t(z,e,n,o);return r(l,l,this.parameters.screenSizeScale*a.camera.computeRenderPixelSizeAt(l)),i(u,u,l),[u[0],u[1],u[2]]},applyToAabb:e=>{const t=n(e,w);return o(e,this.parameters.screenSizeScale*a.camera.computeRenderPixelSizeAt(t))}};A(e,a,c,l,h,u)}else A(e,a,c,l,void 0,u)}requiresSlot(e,t){if(t===u.Highlight)return e===d.OPAQUE_MATERIAL;if(t===u.Color||t===u.Alpha||t===u.ObjectAndLayerIdColor){let t=d.OPAQUE_MATERIAL;return this.parameters.transparent&&(t=this.parameters.writeDepth?d.TRANSPARENT_MATERIAL:d.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===t||e===d.DRAPED_MATERIAL}return!1}createGLMaterial(e){return new j(e)}createBufferWriter(){return new x(this.parameters.screenSizeEnabled)}}class j extends p{beginSlot(e){return this.ensureTechnique(F,e)}}class O extends m{constructor(){super(...arguments),this.color=a(1,1,1,1),this.shadingTint=a(0,0,0,.25),this.shadingDirection=e(s(),[.5,-.5,-.5]),this.screenSizeScale=14,this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=h.None,this.screenSizeEnabled=!1,this.shadingEnabled=!0}}class x{constructor(e){this.screenSizeEnabled=e;const t=l().vec3f(b.POSITION).vec3f(b.NORMAL);this.screenSizeEnabled&&t.vec3f(b.OFFSET),this.vertexBufferLayout=t}elementCount(e){return e.indices.get(b.POSITION).length}write(e,t,r,i,s){if(E(r,this.vertexBufferLayout,e,t,i,s),this.screenSizeEnabled){if(!r.vertexAttributes.has(b.OFFSET))throw new Error(`${b.OFFSET} vertex attribute required for screenSizeEnabled ShadedColorMaterial`);{const e=r.vertexAttributes.get(b.OFFSET),a=r.indices.get(b.OFFSET);S(3===e.size);const n=i.getField(b.OFFSET,c);if(!n)throw new Error("unable to acquire view for "+b.OFFSET);g(a,e.data,t,n,s)}}}}const w=s(),z=s();export{v as ShadedColorMaterial,O as ShadedColorMaterialParameters};
5
+ import{n as e,s as t,g as r,a as i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{center as n,scale as o}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as h}from"../lib/basicInterfaces.js";import p from"../lib/GLMaterial.js";import{Material as f,MaterialParameters as m}from"../lib/Material.js";import{RenderSlot as d}from"../lib/RenderSlot.js";import{assert as b}from"../lib/Util.js";import{VertexAttribute as E}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as S,writePosition as g}from"./internal/bufferWriterUtils.js";import{intersectTriangleGeometry as A}from"./internal/MaterialUtil.js";import{ShadedColorMaterialTechniqueConfiguration as T,vertexAttributeLocations as _,ShadedColorMaterialTechnique as F}from"../shaders/ShadedColorMaterialTechnique.js";class v extends f{constructor(e){super(e,new O),this.supportsEdges=!0,this._configuration=new T,this._vertexAttributeLocations=_}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,a,c,l,u){if(this.parameters.screenSizeEnabled){const s=e.vertexAttributes.get(E.OFFSET),h={applyToVertex:(e,n,o,c)=>{const l=t(R,s.data[3*c],s.data[3*c+1],s.data[3*c+2]),u=t(w,e,n,o);return r(l,l,this.parameters.screenSizeScale*a.camera.computeRenderPixelSizeAt(l)),i(u,u,l),[u[0],u[1],u[2]]},applyToAabb:e=>{const t=n(e,R);return o(e,this.parameters.screenSizeScale*a.camera.computeRenderPixelSizeAt(t))}};A(e,a,c,l,h,u)}else A(e,a,c,l,void 0,u)}canRender(e,t){if(t===u.Highlight)return e===d.OPAQUE_MATERIAL;if(t===u.Color||t===u.Alpha||t===u.ObjectAndLayerIdColor){let t=d.OPAQUE_MATERIAL;return this.parameters.transparent&&(t=this.parameters.writeDepth?d.TRANSPARENT_MATERIAL:d.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===t||e===d.DRAPED_MATERIAL}return!1}createGLMaterial(e){return new j(e)}createBufferWriter(){return new x(this.parameters.screenSizeEnabled)}}class j extends p{beginSlot(e){return this.ensureTechnique(F,e)}}class O extends m{constructor(){super(...arguments),this.color=a(1,1,1,1),this.shadingTint=a(0,0,0,.25),this.shadingDirection=e(s(),[.5,-.5,-.5]),this.screenSizeScale=14,this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=h.None,this.screenSizeEnabled=!1,this.shadingEnabled=!0}}class x{constructor(e){this.screenSizeEnabled=e;const t=l().vec3f(E.POSITION).vec3f(E.NORMAL);this.screenSizeEnabled&&t.vec3f(E.OFFSET),this.vertexBufferLayout=t}elementCount(e){return e.indices.get(E.POSITION).length}write(e,t,r,i,s){if(S(r,this.vertexBufferLayout,e,t,i,s),this.screenSizeEnabled){if(!r.vertexAttributes.has(E.OFFSET))throw new Error(`${E.OFFSET} vertex attribute required for screenSizeEnabled ShadedColorMaterial`);{const e=r.vertexAttributes.get(E.OFFSET),a=r.indices.get(E.OFFSET);b(3===e.size);const n=i.getField(E.OFFSET,c);if(!n)throw new Error("unable to acquire view for "+E.OFFSET);g(a,e.data,t,n,s)}}}}const R=s(),w=s();export{v as ShadedColorMaterial,O as ShadedColorMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutput.js";import{ShaderTechniqueConfiguration as e}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import t from"../lib/GLMaterial.js";import{RenderOccludedFlag as i}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{DefaultBufferWriter as s}from"./DefaultBufferWriter.js";import{PositionUVLayout as n}from"./DefaultLayouts.js";import{TriangleMaterial as u}from"./TriangleMaterial.js";import{SlicePlaneMaterialTechnique as a,SlicePlaneMaterialPassParameters as c}from"../shaders/SlicePlaneMaterialTechnique.js";class l extends u{constructor(r){super(r,new m),this._configuration=new e}createBufferWriter(){return new s(n)}requiresSlot(e,t){return t===r.Color&&e===o.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL}createGLMaterial(r){return new f(r)}getConfiguration(){return this._configuration}}class f extends t{constructor(r){super(r),this.ensureTechnique(a,null)}beginSlot(){return this.technique}}class m extends c{constructor(){super(...arguments),this.renderOccluded=i.Occlude,this.isDecoration=!1}}export{m as Parameters,l as SlicePlaneMaterial};
5
+ import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutput.js";import{ShaderTechniqueConfiguration as e}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import t from"../lib/GLMaterial.js";import{RenderOccludedFlag as i}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{DefaultBufferWriter as n}from"./DefaultBufferWriter.js";import{PositionUVLayout as s}from"./DefaultLayouts.js";import{TriangleMaterial as a}from"./TriangleMaterial.js";import{SlicePlaneMaterialTechnique as u,SlicePlaneMaterialPassParameters as c}from"../shaders/SlicePlaneMaterialTechnique.js";class l extends a{constructor(r){super(r,new m),this._configuration=new e}createBufferWriter(){return new n(s)}canRender(e,t){return t===r.Color&&e===o.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL}createGLMaterial(r){return new f(r)}getConfiguration(){return this._configuration}}class f extends t{constructor(r){super(r),this.ensureTechnique(u,null)}beginSlot(){return this.technique}}class m extends c{constructor(){super(...arguments),this.renderOccluded=i.Occlude,this.isDecoration=!1}}export{m as Parameters,l as SlicePlaneMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{secondsFromMilliseconds as e}from"../../../../core/time.js";import{f as t}from"../../../../chunks/vec2f64.js";import{c as r}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{AnimationTimer as s}from"../lib/AnimationTimer.js";import{MaterialParameters as n}from"../lib/Material.js";import{OITPolygonOffsetLimit as o}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{DefaultBufferWriter as c}from"./DefaultBufferWriter.js";import{PositionUVLayoutObjectAndLayerId as m,PositionUVLayout as p}from"./DefaultLayouts.js";import{TriangleMaterial as l}from"./TriangleMaterial.js";import{WaterGLMaterial as u}from"./WaterGLMaterial.js";import{WaterTechniqueConfiguration as f}from"./WaterTechnique.js";class d extends l{constructor(e){super(e,new A),this._configuration=new f,this.animation=new s}getConfiguration(e,t){return this._configuration.output=e,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasScreenSpaceReflections=this.parameters.hasScreenSpaceReflections,this._configuration.hasCloudsReflections=this.parameters.hasCloudsReflections,this._configuration.isDraped=this.parameters.isDraped,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<o,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}update(t){const r=Math.min(t.camera.relativeElevation,t.camera.distance);this.animation.enabled=Math.sqrt(this.parameters.waveTextureRepeat/this.parameters.waveStrength)*r<g;const a=this.animation.advance(t);return this.setParameters({timeElapsed:e(this.animation.time)*this.parameters.animationSpeed},!1),this.animation.enabled&&a}requiresSlot(e,t){switch(t){case i.Normal:return e===h.DRAPED_WATER;case i.Color:if(this.parameters.isDraped)return e===h.DRAPED_MATERIAL;break;case i.Alpha:break;case i.Highlight:case i.ObjectAndLayerIdColor:return e===h.OPAQUE_MATERIAL||e===h.DRAPED_MATERIAL;default:return!1}let r=h.OPAQUE_MATERIAL;return this.parameters.transparent&&(r=this.parameters.writeDepth?h.TRANSPARENT_MATERIAL:h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===r}createGLMaterial(e){return new u(e)}createBufferWriter(){return new c(has("enable-feature:objectAndLayerId-rendering")?m:p)}}class A extends n{constructor(){super(...arguments),this.waveStrength=.06,this.waveTextureRepeat=32,this.waveDirection=t(1,0),this.waveVelocity=.05,this.flowStrength=.015,this.flowOffset=-.5,this.animationSpeed=.35,this.timeElapsed=0,this.color=a(0,0,0,0),this.transparent=!0,this.writeDepth=!0,this.hasSlicePlane=!1,this.isDraped=!1,this.receiveShadows=!0,this.hasScreenSpaceReflections=!1,this.hasCloudsReflections=!1,this.origin=r(),this.modelTransformation=null}}const g=35e3;export{d as WaterMaterial,A as WaterMaterialParameters};
5
+ import has from"../../../../core/has.js";import{secondsFromMilliseconds as e}from"../../../../core/time.js";import{f as t}from"../../../../chunks/vec2f64.js";import{c as r}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{AnimationTimer as s}from"../lib/AnimationTimer.js";import{MaterialParameters as n}from"../lib/Material.js";import{OITPolygonOffsetLimit as o}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{DefaultBufferWriter as c}from"./DefaultBufferWriter.js";import{PositionUVLayoutObjectAndLayerId as m,PositionUVLayout as p}from"./DefaultLayouts.js";import{TriangleMaterial as l}from"./TriangleMaterial.js";import{WaterGLMaterial as f}from"./WaterGLMaterial.js";import{WaterTechniqueConfiguration as u}from"./WaterTechnique.js";class d extends l{constructor(e){super(e,new A),this._configuration=new u,this.animation=new s}getConfiguration(e,t){return this._configuration.output=e,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasScreenSpaceReflections=this.parameters.hasScreenSpaceReflections,this._configuration.hasCloudsReflections=this.parameters.hasCloudsReflections,this._configuration.isDraped=this.parameters.isDraped,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<o,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}update(t){const r=Math.min(t.camera.relativeElevation,t.camera.distance);this.animation.enabled=Math.sqrt(this.parameters.waveTextureRepeat/this.parameters.waveStrength)*r<R;const a=this.animation.advance(t);return this.setParameters({timeElapsed:e(this.animation.time)*this.parameters.animationSpeed},!1),this.animation.enabled&&a}canRender(e,t){switch(t){case i.Normal:return e===h.DRAPED_WATER;case i.Color:if(this.parameters.isDraped)return e===h.DRAPED_MATERIAL;break;case i.Alpha:break;case i.Highlight:case i.ObjectAndLayerIdColor:return e===h.OPAQUE_MATERIAL||e===h.DRAPED_MATERIAL;default:return!1}let r=h.OPAQUE_MATERIAL;return this.parameters.transparent&&(r=this.parameters.writeDepth?h.TRANSPARENT_MATERIAL:h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===r}createGLMaterial(e){return new f(e)}createBufferWriter(){return new c(has("enable-feature:objectAndLayerId-rendering")?m:p)}}class A extends n{constructor(){super(...arguments),this.waveStrength=.06,this.waveTextureRepeat=32,this.waveDirection=t(1,0),this.waveVelocity=.05,this.flowStrength=.015,this.flowOffset=-.5,this.animationSpeed=.35,this.timeElapsed=0,this.color=a(0,0,0,0),this.transparent=!0,this.writeDepth=!0,this.hasSlicePlane=!1,this.isDraped=!1,this.receiveShadows=!0,this.hasScreenSpaceReflections=!1,this.hasCloudsReflections=!1,this.origin=r(),this.modelTransformation=null}}const R=35e3;export{d as WaterMaterial,A as WaterMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{removeUnordered as e,filterInPlace as t}from"../../../../../core/arrayUtils.js";import{someMap as r}from"../../../../../core/MapUtils.js";import{NestedMap as s}from"../../../../../core/NestedMap.js";import i from"../../../../../core/PooledArray.js";import{m as a,a as o,t as n}from"../../../../../chunks/mat4.js";import{c as l}from"../../../../../chunks/mat4f64.js";import{glLayout as u}from"../../../support/buffer/glUtil.js";import{ShaderOutput as h}from"../../core/shaderLibrary/ShaderOutput.js";import{GLMaterials as f}from"../../lib/GLMaterials.js";import{RenderOccludedFlag as c}from"../../lib/Material.js";import{DirtyState as d}from"../../lib/ModelDirtyTypes.js";import{assert as m,setMatrixTranslation3 as g}from"../../lib/Util.js";import{DrawParameters as p}from"../DrawParameters.js";import{WaterMaterial as y}from"../WaterMaterial.js";import{BufferRange as _,mergeAdjacentRanges as w}from"./BufferRange.js";import{Instance as b}from"./Instance.js";import{PerBufferData as v,hasVao as O}from"./PerBufferData.js";import{PerOriginData as B}from"./PerOriginData.js";import{VaoCache as C}from"./VaoCache.js";class E{constructor(e,t,r){this._rctx=e,this.material=r,this._dataByOrigin=new Map,this._hasHighlights=!1,this._hasOccludees=!1,this._glMaterials=new f(this.material,t),this._bufferWriter=r.createBufferWriter(),this._vaoCache=new C(e,r.vertexAttributeLocations,u(this._bufferWriter.vertexBufferLayout))}dispose(){this._glMaterials.destroy(),this._dataByOrigin.forEach((e=>e.dispose())),this._dataByOrigin.clear(),this._vaoCache.dispose()}get isEmpty(){return 0===this._dataByOrigin.size}get hasHighlights(){return this._hasHighlights}get hasOccludees(){return this._hasOccludees}get hasWater(){return!this.isEmpty&&this.material instanceof y}get isDecoration(){return this.material.isDecoration}get rendersOccluded(){return!this.isEmpty&&this.material.renderOccluded!==c.Occlude}get numGeometries(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.instances.size),0))),e}get usedMemory(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.vao.memoryUsage),0))),e}forEachGeometry(e){this._dataByOrigin.forEach((t=>t.buffers.forEach((t=>t.instances.forEach((t=>e(t.geometry)))))))}modify(e){this._updateGeometries(e.updates),this._addAndRemoveGeometries(e.adds,e.removes),this._updateDrawCommands()}_updateGeometries(e){const t=this._bufferWriter,r=t.vertexBufferLayout.stride/4;for(const s of e){const e=s.renderGeometry,i=this._dataByOrigin.get(e.localOrigin.id),a=i?.findBuffer(e.id);if(null==a)return;const o=a.instances.get(e.id);if(s.updateType&(d.GEOMETRY|d.TRANSFORMATION)){const s=W(t.elementCount(o.geometry.geometry)*r),i=t.vertexBufferLayout.createView(s.buffer);this._writeGeometry(e,i,0),a.vao.vertexBuffers.geometry.setSubData(s,o.from*r,0,o.numElements*r),P()}s.updateType&(d.HIGHLIGHT|d.OCCLUDEE|d.VISIBILITY)&&(a.drawCommandsDirty=!0)}}_computeDeltas(e,t){const r=new s;for(const s of e){const e=s.localOrigin;if(null==e)continue;let t=r.get(e.id,null);null==t&&(t=new A(e.vec3),r.set(e.id,null,t)),t.changes.push(s)}for(const s of t){const e=s.localOrigin;if(null==e)continue;const t=this._dataByOrigin.get(e.id),i=t?.findBuffer(s.id);if(null==i)continue;let a=r.get(e.id,i);null==a&&(a=new A(e.vec3),r.set(e.id,i,a)),a.changes.push(s)}return r}_addAndRemoveGeometries(t,r){const{_bufferWriter:s,_dataByOrigin:i}=this,a=s.vertexBufferLayout.stride/4,o=this._computeDeltas(t,r);o.forEach(((t,r)=>{const n=t.get(null),l=null!=n?n.changes:[];o.delete(r,null);let u=i.get(r);if(t.forEach(((t,n)=>{if(o.delete(r,n),null==n)return void m(!1,"No VAO for removed geometries");if(n.instances.size===t.changes.length)return this._vaoCache.deleteVao(n.vao),e(u.buffers,n),void(0===u.buffers.length&&0===l.length&&i.delete(r));const h=n.numElements,f=n.vao.byteSize/4,c=l.reduce(((e,t)=>e+s.elementCount(t.geometry)),0),d=t.changes.reduce(((e,t)=>e+s.elementCount(t.geometry)),0),g=Math.min((h+c-d)*a,R),p=g>f;g>j&&g<f/2?(t.changes.forEach((({id:e})=>n.deleteInstance(e))),n.instances.forEach((({geometry:e})=>l.push(e))),this._vaoCache.deleteVao(n.vao),e(u.buffers,n)):p?this._applyAndRebuild(n,l,t):this._applyRemoves(n,t)})),l.length>0)for(null==u&&(u=new B(n.origin),i.set(r,u)),u.buffers.forEach((e=>this._applyAdds(e,l)));l.length>0;)u.buffers.push(this._applyAndRebuild(new v,l,null))}))}_updateDrawCommands(){this._hasHighlights=!1,this._hasOccludees=!1,this._dataByOrigin.forEach((e=>{e.buffers.forEach((e=>{e.drawCommandsDirty&&(e.hasHiddenInstances=!1,e.hasHighlights=!1,e.hasOccludees=!1,r(e.instances,(t=>(e.updateDrawState(t),e.hasHiddenInstances&&e.hasHighlights&&e.hasOccludees))),e.updateDrawCommands(this._bufferWriter.vertexBufferLayout.stride)),this._hasHighlights=this._hasHighlights||e.hasHighlights,this._hasOccludees=this._hasOccludees||e.hasOccludees}))}))}_applyAndRebuild(e,t,r){if(null!=r)for(const d of r.changes)e.deleteInstance(d.id);const s=this._bufferWriter,i=s.vertexBufferLayout.stride,a=i/4,o=Math.floor(R/a);let n=e.numElements;for(;t.length>0;){const r=t.pop(),i=s.elementCount(r.geometry);if(n+i>o&&n>0){t.push(r);break}n+=i;const a=new b(r,0,0);m(null==e.instances.get(r.id)),e.addInstance(r.id,a)}const l=n*a,u=W(l),h=s.vertexBufferLayout.createView(u.buffer);let f=0;e.hasHiddenInstances=!1,e.hasHighlights=!1,e.hasOccludees=!1,e.instances.forEach(((t,r)=>{this._writeGeometry(t.geometry,h,f);const i=f;f+=s.elementCount(t.geometry.geometry),e.updateInstance(r,i,f),e.updateDrawState(t)})),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(V(l)),e.vao.vertexBuffers.geometry.setSubData(u,0,0,f*a),P(),e.holes.clear();const c=e.holes.pushNew();return c.from=f,c.to=Math.floor(e.vao.byteSize/i),e.updateDrawCommands(i),e}_applyRemoves(e,t){if(0===t.changes.length)return;for(const o of t.changes){const t=o.id,r=e.instances.get(t);if(!r)continue;e.deleteInstance(t);const s=x.back();if(s){if(s.to===r.from){s.to=r.to;continue}if(s.from===r.to){s.from=r.from;continue}}const i=x.pushNew();i.from=r.from,i.to=r.to}w(x);const r=this._bufferWriter.vertexBufferLayout.stride/4,s=x.reduce(((e,t)=>Math.max(e,t.numElements)),0)*r,i=W(s);i.fill(0,0,s);const a=e.vao.vertexBuffers.geometry;x.forAll((e=>a.setSubData(i,e.from*r,0,e.numElements*r))),P(),e.holes.pushArray(x.data,x.length),x.forAll(((e,t)=>x.data[t]=null)),x.clear(),e.drawCommandsDirty=!0}_applyAdds(e,r){if(0===r.length)return;if(!O(e))return void this._applyAndRebuild(e,r,null);const s=this._bufferWriter,i=s.vertexBufferLayout.stride/4,a=e.numElements,o=r.reduce(((e,t)=>e+s.elementCount(t.geometry)),0),n=Math.min((a+o)*i,R),l=4*n;if(e.vao.byteSize<V(R-j)&&l>e.vao.byteSize)return void this._applyAndRebuild(e,r,null);w(e.holes);const u=new Array;for(const t of r){const r=s.elementCount(t.geometry),i=H(e.holes,r);u.push(i)}const h=e.vao.vertexBuffers.geometry;let f=0,c=0,d=0;const g=W(n),p=s.vertexBufferLayout.createView(g.buffer);r.forEach(((t,r)=>{const a=u[r];if(null==a)return;if(!(d===a)){const e=d-c;e>0&&h.setSubData(g,c*i,0,e*i),c=a,f=0}const o=s.elementCount(t.geometry);this._writeGeometry(t,p,f),f+=o,d=a+o;const n=new b(t,a,a+o);m(null==e.instances.get(t.id)),e.addInstance(t.id,n),e.drawCommandsDirty=!0}));const y=d-c;y>0&&h.setSubData(g,c*i,0,y*i),t(r,((e,t)=>null==u[t])),P()}_writeGeometry(e,t,r){const s=e.localOrigin.vec3;g(D,-s[0],-s[1],-s[2]);const i=a(S,D,e.transformation);o(M,i),n(M,M),this._bufferWriter.write(i,M,e.geometry,t,r)}updateAnimation(e){return this.material.update(e)}requiresSlot(e,t){return this.material.requiresSlot(e,t)}prepareTechnique(e){const{output:t,bindParameters:r}=e;if(!this.requiresSlot(r.slot,t))return null;const s=t===h.Highlight||t===h.ShadowHighlight;if(s&&!this._hasHighlights)return null;const i=t===h.ShadowExcludeHighlight,a=!(s||i);for(const o of this._dataByOrigin.values())for(const n of o.buffers){if(s&&!n.hasHighlights)continue;const o=(s?n.drawCommandsHighlight:i&&n.needsMultipleCommands()?n.drawCommandsShadowHighlightRest:n.drawCommandsDefault)||null,l=a&&n.drawCommandsOccludees||null;if(o?.length||l?.length){const s=this._glMaterials.load(e.rctx,r.slot,t),i=null!=s?s.beginSlot(r):null;if(null!=i)return i}}return null}render(e,t){const{output:r,bindParameters:s}=e,i=r===h.Highlight||r===h.ShadowHighlight,a=r===h.ShadowExcludeHighlight,o=!(i||a),n=this._rctx;n.appleAmdDriverHelper?.resetIndicesType(),n.bindTechnique(t,this.material.parameters,s);for(const l of this._dataByOrigin.values())for(const e of l.buffers){if(i&&!e.hasHighlights)continue;const r=(i?e.drawCommandsHighlight:a&&e.needsMultipleCommands()?e.drawCommandsShadowHighlightRest:e.drawCommandsDefault)||null,u=o&&e.drawCommandsOccludees||null;if(r?.length||u?.length){t.program.bindDraw(new p(l.origin),s,this.material.parameters),t.ensureAttributeLocations(e.vao),n.bindVAO(e.vao),r?.length&&(t.bindPipelineState(n,s.slot,!1),r.forAll((e=>n.drawArrays(t.primitiveType,e.first,e.count)))),u?.length&&(t.bindPipelineState(n,s.slot,!0),u.forAll((e=>n.drawArrays(t.primitiveType,e.first,e.count))))}}}get test(){return{material:this.material,glMaterials:this._glMaterials,dataByOrigin:this._dataByOrigin}}}class A{constructor(e){this.origin=e,this.changes=new Array}}function H(e,t){let r;if(!e.some((e=>!(e.numElements<t)&&(r=e,!0))))return null;const s=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),s}const D=l(),S=l(),M=l(),x=new i({allocator:e=>e||new _,deallocator:null}),j=65536,I=4*j,L=1024,G=16777216,R=G/4;let T=new Float32Array(j);function W(e){return T.length<e&&(T=new Float32Array(e)),T}function V(e){const t=4*e;return t<=L?L:t<I?I:Math.max(Math.min(Math.ceil(1.5*t/I)*I,G),t)}function P(){T=new Float32Array(2)}export{E as MergedRenderer};
5
+ import{removeUnordered as e,filterInPlace as t}from"../../../../../core/arrayUtils.js";import{someMap as r}from"../../../../../core/MapUtils.js";import{NestedMap as s}from"../../../../../core/NestedMap.js";import i from"../../../../../core/PooledArray.js";import{m as a,a as n,t as o}from"../../../../../chunks/mat4.js";import{c as l}from"../../../../../chunks/mat4f64.js";import{glLayout as h}from"../../../support/buffer/glUtil.js";import{ShaderOutput as u}from"../../core/shaderLibrary/ShaderOutput.js";import{GLMaterials as c}from"../../lib/GLMaterials.js";import{RenderOccludedFlag as f}from"../../lib/Material.js";import{DirtyState as d}from"../../lib/ModelDirtyTypes.js";import{assert as m,setMatrixTranslation3 as g}from"../../lib/Util.js";import{DrawParameters as p}from"../DrawParameters.js";import{WaterMaterial as y}from"../WaterMaterial.js";import{BufferRange as _,mergeAdjacentRanges as w}from"./BufferRange.js";import{Instance as b}from"./Instance.js";import{PerBufferData as v,hasVao as O}from"./PerBufferData.js";import{PerOriginData as B}from"./PerOriginData.js";import{VaoCache as C}from"./VaoCache.js";class E{constructor(e,t,r){this._rctx=e,this.material=r,this._dataByOrigin=new Map,this._hasHighlights=!1,this._hasOccludees=!1,this._glMaterials=new c(this.material,t),this._bufferWriter=r.createBufferWriter(),this._vaoCache=new C(e,r.vertexAttributeLocations,h(this._bufferWriter.vertexBufferLayout))}dispose(){this._glMaterials.destroy(),this._dataByOrigin.forEach((e=>e.dispose())),this._dataByOrigin.clear(),this._vaoCache.dispose()}get isEmpty(){return 0===this._dataByOrigin.size}get hasHighlights(){return this._hasHighlights}get hasOccludees(){return this._hasOccludees}get hasWater(){return!this.isEmpty&&this.material instanceof y}get isDecoration(){return this.material.isDecoration}get rendersOccluded(){return!this.isEmpty&&this.material.renderOccluded!==f.Occlude}get numGeometries(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.instances.size),0))),e}get usedMemory(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.vao.memoryUsage),0))),e}forEachGeometry(e){this._dataByOrigin.forEach((t=>t.buffers.forEach((t=>t.instances.forEach((t=>e(t.geometry)))))))}modify(e){this._updateGeometries(e.updates),this._addAndRemoveGeometries(e.adds,e.removes),this._updateDrawCommands()}_updateGeometries(e){const t=this._bufferWriter,r=t.vertexBufferLayout.stride/4;for(const s of e){const e=s.renderGeometry,i=this._dataByOrigin.get(e.localOrigin.id),a=i?.findBuffer(e.id);if(null==a)return;const n=a.instances.get(e.id);if(s.updateType&(d.GEOMETRY|d.TRANSFORMATION)){const s=W(t.elementCount(n.geometry.geometry)*r),i=t.vertexBufferLayout.createView(s.buffer);this._writeGeometry(e,i,0),a.vao.vertexBuffers.geometry.setSubData(s,n.from*r,0,n.numElements*r),P()}s.updateType&(d.HIGHLIGHT|d.OCCLUDEE|d.VISIBILITY)&&(a.drawCommandsDirty=!0)}}_computeDeltas(e,t){const r=new s;for(const s of e){const e=s.localOrigin;if(null==e)continue;let t=r.get(e.id,null);null==t&&(t=new A(e.vec3),r.set(e.id,null,t)),t.changes.push(s)}for(const s of t){const e=s.localOrigin;if(null==e)continue;const t=this._dataByOrigin.get(e.id),i=t?.findBuffer(s.id);if(null==i)continue;let a=r.get(e.id,i);null==a&&(a=new A(e.vec3),r.set(e.id,i,a)),a.changes.push(s)}return r}_addAndRemoveGeometries(t,r){const{_bufferWriter:s,_dataByOrigin:i}=this,a=s.vertexBufferLayout.stride/4,n=this._computeDeltas(t,r);n.forEach(((t,r)=>{const o=t.get(null),l=null!=o?o.changes:[];n.delete(r,null);let h=i.get(r);if(t.forEach(((t,o)=>{if(n.delete(r,o),null==o)return void m(!1,"No VAO for removed geometries");if(o.instances.size===t.changes.length)return this._vaoCache.deleteVao(o.vao),e(h.buffers,o),void(0===h.buffers.length&&0===l.length&&i.delete(r));const u=o.numElements,c=o.vao.byteSize/4,f=l.reduce(((e,t)=>e+s.elementCount(t.geometry)),0),d=t.changes.reduce(((e,t)=>e+s.elementCount(t.geometry)),0),g=Math.min((u+f-d)*a,G),p=g>c;g>j&&g<c/2?(t.changes.forEach((({id:e})=>o.deleteInstance(e))),o.instances.forEach((({geometry:e})=>l.push(e))),this._vaoCache.deleteVao(o.vao),e(h.buffers,o)):p?this._applyAndRebuild(o,l,t):this._applyRemoves(o,t)})),l.length>0)for(null==h&&(h=new B(o.origin),i.set(r,h)),h.buffers.forEach((e=>this._applyAdds(e,l)));l.length>0;)h.buffers.push(this._applyAndRebuild(new v,l,null))}))}_updateDrawCommands(){this._hasHighlights=!1,this._hasOccludees=!1,this._dataByOrigin.forEach((e=>{e.buffers.forEach((e=>{e.drawCommandsDirty&&(e.hasHiddenInstances=!1,e.hasHighlights=!1,e.hasOccludees=!1,r(e.instances,(t=>(e.updateDrawState(t),e.hasHiddenInstances&&e.hasHighlights&&e.hasOccludees))),e.updateDrawCommands(this._bufferWriter.vertexBufferLayout.stride)),this._hasHighlights=this._hasHighlights||e.hasHighlights,this._hasOccludees=this._hasOccludees||e.hasOccludees}))}))}_applyAndRebuild(e,t,r){if(null!=r)for(const d of r.changes)e.deleteInstance(d.id);const s=this._bufferWriter,i=s.vertexBufferLayout.stride,a=i/4,n=Math.floor(G/a);let o=e.numElements;for(;t.length>0;){const r=t.pop(),i=s.elementCount(r.geometry);if(o+i>n&&o>0){t.push(r);break}o+=i;const a=new b(r,0,0);m(null==e.instances.get(r.id)),e.addInstance(r.id,a)}const l=o*a,h=W(l),u=s.vertexBufferLayout.createView(h.buffer);let c=0;e.hasHiddenInstances=!1,e.hasHighlights=!1,e.hasOccludees=!1,e.instances.forEach(((t,r)=>{this._writeGeometry(t.geometry,u,c);const i=c;c+=s.elementCount(t.geometry.geometry),e.updateInstance(r,i,c),e.updateDrawState(t)})),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(V(l)),e.vao.vertexBuffers.geometry.setSubData(h,0,0,c*a),P(),e.holes.clear();const f=e.holes.pushNew();return f.from=c,f.to=Math.floor(e.vao.byteSize/i),e.updateDrawCommands(i),e}_applyRemoves(e,t){if(0===t.changes.length)return;for(const n of t.changes){const t=n.id,r=e.instances.get(t);if(!r)continue;e.deleteInstance(t);const s=S.back();if(s){if(s.to===r.from){s.to=r.to;continue}if(s.from===r.to){s.from=r.from;continue}}const i=S.pushNew();i.from=r.from,i.to=r.to}w(S);const r=this._bufferWriter.vertexBufferLayout.stride/4,s=S.reduce(((e,t)=>Math.max(e,t.numElements)),0)*r,i=W(s);i.fill(0,0,s);const a=e.vao.vertexBuffers.geometry;S.forAll((e=>a.setSubData(i,e.from*r,0,e.numElements*r))),P(),e.holes.pushArray(S.data,S.length),S.forAll(((e,t)=>S.data[t]=null)),S.clear(),e.drawCommandsDirty=!0}_applyAdds(e,r){if(0===r.length)return;if(!O(e))return void this._applyAndRebuild(e,r,null);const s=this._bufferWriter,i=s.vertexBufferLayout.stride/4,a=e.numElements,n=r.reduce(((e,t)=>e+s.elementCount(t.geometry)),0),o=Math.min((a+n)*i,G),l=4*o;if(e.vao.byteSize<V(G-j)&&l>e.vao.byteSize)return void this._applyAndRebuild(e,r,null);w(e.holes);const h=new Array;for(const t of r){const r=s.elementCount(t.geometry),i=H(e.holes,r);h.push(i)}const u=e.vao.vertexBuffers.geometry;let c=0,f=0,d=0;const g=W(o),p=s.vertexBufferLayout.createView(g.buffer);r.forEach(((t,r)=>{const a=h[r];if(null==a)return;if(!(d===a)){const e=d-f;e>0&&u.setSubData(g,f*i,0,e*i),f=a,c=0}const n=s.elementCount(t.geometry);this._writeGeometry(t,p,c),c+=n,d=a+n;const o=new b(t,a,a+n);m(null==e.instances.get(t.id)),e.addInstance(t.id,o),e.drawCommandsDirty=!0}));const y=d-f;y>0&&u.setSubData(g,f*i,0,y*i),t(r,((e,t)=>null==h[t])),P()}_writeGeometry(e,t,r){const s=e.localOrigin.vec3;g(D,-s[0],-s[1],-s[2]);const i=a(M,D,e.transformation);n(x,i),o(x,x),this._bufferWriter.write(i,x,e.geometry,t,r)}updateAnimation(e){return this.material.update(e)}canRender(e,t){return this.material.canRender(e,t)}prepareTechnique(e){const{output:t,bindParameters:r}=e;if(!this.canRender(r.slot,t))return null;const s=t===u.Highlight||t===u.ShadowHighlight;if(s&&!this._hasHighlights)return null;const i=t===u.ShadowExcludeHighlight,a=!(s||i);for(const n of this._dataByOrigin.values())for(const o of n.buffers){if(s&&!o.hasHighlights)continue;const n=(s?o.drawCommandsHighlight:i&&o.needsMultipleCommands()?o.drawCommandsShadowHighlightRest:o.drawCommandsDefault)||null,l=a&&o.drawCommandsOccludees||null;if(n?.length||l?.length){const s=this._glMaterials.load(e.rctx,r.slot,t),i=null!=s?s.beginSlot(r):null;if(null!=i)return i}}return null}render(e,t){const{output:r,bindParameters:s}=e,i=r===u.Highlight||r===u.ShadowHighlight,a=r===u.ShadowExcludeHighlight,n=!(i||a),o=this._rctx;o.appleAmdDriverHelper?.resetIndicesType(),o.bindTechnique(t,this.material.parameters,s);for(const l of this._dataByOrigin.values())for(const e of l.buffers){if(i&&!e.hasHighlights)continue;const r=(i?e.drawCommandsHighlight:a&&e.needsMultipleCommands()?e.drawCommandsShadowHighlightRest:e.drawCommandsDefault)||null,h=n&&e.drawCommandsOccludees||null;if(r?.length||h?.length){t.program.bindDraw(new p(l.origin),s,this.material.parameters),t.ensureAttributeLocations(e.vao),o.bindVAO(e.vao),r?.length&&(t.bindPipelineState(o,s.slot,!1),r.forAll((e=>o.drawArrays(t.primitiveType,e.first,e.count)))),h?.length&&(t.bindPipelineState(o,s.slot,!0),h.forAll((e=>o.drawArrays(t.primitiveType,e.first,e.count))))}}}get test(){return{material:this.material,glMaterials:this._glMaterials,dataByOrigin:this._dataByOrigin}}}class A{constructor(e){this.origin=e,this.changes=new Array}}function H(e,t){let r;if(!e.some((e=>!(e.numElements<t)&&(r=e,!0))))return null;const s=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),s}const D=l(),M=l(),x=l(),S=new i({allocator:e=>e||new _,deallocator:null}),j=65536,I=4*j,R=1024,L=16777216,G=L/4;let T=new Float32Array(j);function W(e){return T.length<e&&(T=new Float32Array(e)),T}function V(e){const t=4*e;return t<=R?R:t<I?I:Math.max(Math.min(Math.ceil(1.5*t/I)*I,L),t)}function P(){T=new Float32Array(2)}export{E as MergedRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{packFloatRGBA as t}from"../../../../core/floatRGBA.js";import{ProceduralTextureRepository as e}from"./ProceduralTextureRepository.js";import{PixelFormat as r,TextureWrapMode as o}from"../../../webgl/enums.js";import{Texture as n}from"../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../webgl/TextureDescriptor.js";function a(t,a){return new e((e=>{const{encodedData:a,paddedPixels:u}=c(e),s=new i;return s.internalFormat=r.RGBA,s.width=u,s.height=1,s.wrapMode=o.CLAMP_TO_EDGE,new n(t,s,a)}),(t=>`${t.pattern.join(",")}-r${t.pixelRatio}`),a)}function c(e){const r=u(e),o=1/e.pixelRatio,n=s(e),i=l(e),a=(Math.floor(.5*(i-1))+.5)*o,c=[];let f=1;for(const t of r){for(let e=0;e<t;e++){const r=f*(Math.min(e,t-1-e)+.5)*o/a*.5+.5;c.push(r)}f=-f}const d=Math.round(r[0]/2),m=[...c.slice(d),...c.slice(0,d)],h=n+p,x=new Uint8Array(4*h);let w=4;for(const u of m)t(u,x,w),w+=4;return x.copyWithin(0,w-4,w),x.copyWithin(w,4,8),{encodedData:x,paddedPixels:h}}function u(t){return t.pattern.map((e=>Math.round(e*t.pixelRatio)))}function s(t){if(null==t)return 1;const e=u(t);return Math.floor(e.reduce(((t,e)=>t+e)))}function l(t){return u(t).reduce(((t,e)=>Math.max(t,e)))}const p=2;export{p as STIPPLE_TEXTURE_PADDING,l as computeLongestPattern,s as computeTextureSize,a as createStippleTextureRepository};
5
+ import{packFloatRGBA as t}from"../../../../core/floatRGBA.js";import{ProceduralTextureRepository as e}from"./ProceduralTextureRepository.js";import{PixelFormat as r,TextureWrapMode as o}from"../../../webgl/enums.js";import{Texture as n}from"../../../webgl/Texture.js";import{TextureDescriptor as i}from"../../../webgl/TextureDescriptor.js";function u(t,u){return new e((e=>{const{encodedData:u,textureSize:c}=a(e),f=new i;return f.internalFormat=r.RGBA,f.width=c,f.height=1,f.wrapMode=o.REPEAT,new n(t,f,u)}),(t=>`${t.pattern.join(",")}-r${t.pixelRatio}`),u)}function a(e){const r=c(e),o=1/e.pixelRatio,n=f(e),i=s(e),u=(Math.floor(.5*(i-1))+.5)*o,a=[];let l=1;for(const t of r){for(let e=0;e<t;e++){const r=l*(Math.min(e,t-1-e)+.5)*o/u*.5+.5;a.push(r)}l=-l}const p=Math.round(r[0]/2),m=[...a.slice(p),...a.slice(0,p)],d=new Uint8Array(4*n);let x=0;for(const c of m)t(c,d,x),x+=4;return{encodedData:d,textureSize:n}}function c(t){return t.pattern.map((e=>Math.round(e*t.pixelRatio)))}function f(t){if(null==t)return 1;const e=c(t);return Math.floor(e.reduce(((t,e)=>t+e)))}function s(t){return c(t).reduce(((t,e)=>Math.max(t,e)))}export{s as computeLongestPattern,f as computeTextureSize,u as createStippleTextureRepository};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- const e="ProfileGenerationError";var o;!function(e){e.TooComplex="too-complex",e.InvalidGeometry="invalid-geometry",e.InvalidElevationInfo="invalid-elevation-info",e.ElevationQueryError="elevation-query-error"}(o||(o={}));class r extends Error{constructor(o){super("profile could not be generated"),this.cause=o,this.type=e}}function n(o){return o.type===e}export{r as ProfileGenerationError,o as ProfileGenerationErrorCause,n as isProfileGenerationError};
5
+ const e="ProfileGenerationError";var o;!function(e){e.TooComplex="too-complex",e.InvalidGeometry="invalid-geometry",e.InvalidElevationInfo="invalid-elevation-info",e.ElevationQueryError="elevation-query-error"}(o||(o={}));class r extends Error{constructor(o){super("profile could not be generated",{cause:o}),this.type=e}}function n(o){return o.type===e}export{r as ProfileGenerationError,o as ProfileGenerationErrorCause,n as isProfileGenerationError};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{r as t,d as i}from"../../../chunks/Responsive.js";import"../../../intl.js";import{binaryFindClosest as e}from"../../../core/arrayUtils.js";import{handlesGroup as n,makeHandle as o}from"../../../core/handleUtils.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{signal as a}from"../../../core/signal.js";import{formatDecimal as l,unitName as r}from"../../../core/unitFormatUtils.js";import{convertUnit as d}from"../../../core/unitUtils.js";import{g as c}from"../../../chunks/common.js";import{getConfig as p,NOT_AVAILABLE as u}from"./constants.js";import{getTranslatedLineTitle as m}from"./intlUtils.js";import{niceScale as x}from"./niceScale.js";import{c as f,N as g}from"../../../chunks/chartUtilsAm5.js";import{isRTL as h}from"../../support/widgetUtils.js";import{isDarkTheme as A}from"../../../support/themeUtils.js";import{X as v,V as b,A as T,a as y,b as L,L as M}from"../../../chunks/LineSeries.js";import{aq as S,a6 as P,a4 as k,C as X}from"../../../chunks/Theme.js";import{T as Y}from"../../../chunks/Tooltip.js";import{substitute as z}from"../../../intl/substitute.js";import{formatNumber as F}from"../../../intl/number.js";const C="#f8f8f8",j="#a9a9a9",w="#323232",H="line",B="fill",U=15,D=12,R=.001,O=.5,W=.1,G=.02,V={paddingBottom:D/2,paddingLeft:0,paddingRight:0,paddingTop:0,axisGridStroke:"#f4f4f4",axisLabelsFontSize:9,axisLabelsFontWeight:"400",axisLabelsColor:j,axisTooltipFontSize:12,axisTooltipBackgroundColor:w,axisTooltipLabelColor:C,axisTooltipPaddingTop:Math.round(D/4),axisTooltipPaddingBottom:Math.round(D/4),axisTooltipPaddingHorizontal:Math.round(U/4),xAxisMinGridDistance:50,xAxisLabelsSpacing:Math.round(D/2),xAxisMinLabelPosition:.05,xAxisMaxLabelPosition:.9,yAxisMinGridDistance:30,yAxisLabelSpacing:Math.round(U/4),yAxisMinLabelPosition:0,yAxisMaxLabelPosition:.8,seriesTooltipFontSize:12,seriesTooltipBackgroundColor:C,seriesTooltipLabelColor:w,seriesFillLighten:.9,seriesTooltipSpacing:D/2,seriesTooltipPaddingVertical:Math.round(U/4),seriesTooltipPaddingHorizontal:Math.round(U/4)},E={...V,axisGridStroke:w,axisLabelsColor:j,axisTooltipBackgroundColor:w,axisTooltipLabelColor:C,seriesTooltipBackgroundColor:w,seriesTooltipLabelColor:C,seriesFillLighten:-.75},$={minX:void 0,maxX:void 0,minY:void 0,maxY:void 0};async function I(e){const o=await f(e.container);s(e.abortOptions);const l=A(),r=l?E:V;o.setThemes(l?[t.new(o),i.new(o)]:[t.new(o)]);const d=h(e.container),c=o.container.children.push(v.new(o,{panX:!0,panY:!0,paddingTop:r.paddingTop,paddingBottom:r.paddingBottom,paddingLeft:d?r.paddingRight:r.paddingLeft,paddingRight:d?r.paddingLeft:r.paddingRight,maxTooltipDistance:0}));c.zoomOutButton.set("forceHidden",!0);const p=c.xAxes.push(b.new(o,{renderer:T.new(o,{})})),u=c.yAxes.push(b.new(o,{renderer:y.new(o,{})})),m={params:e,chart:c,xAxis:p,yAxis:u,series:new Map,data:null,messages:null,theme:r,state:a("loading"),pointerIsOver:a(!1)};q(m),N(m),Z(m);const x=n([at(m,e.onRangeChange),rt(m,e.onCursorPositionChange),yt(o.events.once("frameended",(()=>{m.state.value="ready"}))),yt(o)]);return{...m,destroy(){x.remove(),m.state.value="destroyed"},update(t){"destroyed"!==m.state.value&&J(m,t)},zoomOut(){"destroyed"!==m.state.value&&(m.xAxis.zoom(0,1),m.yAxis.zoom(0,1))}}}function Z({chart:t,xAxis:i,yAxis:e}){const n=L.new(t.root,{behavior:"none",xAxis:i,yAxis:e});n.lineY.set("visible",!1),t.set("cursor",n)}function q(t){const{chart:i,xAxis:e,theme:n}=t;e.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:ft(t,"distance"),strictMinMax:!0,strictMinMaxSelection:!0}),e.axisHeader.set("forceHidden",!0);const o=e.get("renderer");o.setAll({inside:!1,minGridDistance:n.xAxisMinGridDistance}),o.labels.template.setAll({centerX:S,centerY:S,fill:P(n.axisLabelsColor),fontSize:n.axisLabelsFontSize,fontWeight:n.axisLabelsFontWeight,maxPosition:n.xAxisMaxLabelPosition,minPosition:n.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:n.xAxisLabelsSpacing});const s=e.set("tooltip",Y.new(i.root,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));s.get("background")?.setAll({fill:P(n.axisTooltipBackgroundColor),stroke:void 0}),s.label.setAll({fill:P(n.axisTooltipLabelColor),fontSize:n.axisTooltipFontSize,paddingBottom:n.axisTooltipPaddingBottom,paddingLeft:n.axisTooltipPaddingHorizontal,paddingRight:n.axisTooltipPaddingHorizontal,paddingTop:n.axisTooltipPaddingTop}),o.grid.template.setAll({strokeOpacity:1,stroke:P(n.axisGridStroke)})}function N(t){const{yAxis:i,theme:e}=t;i.setAll({baseValue:p().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:ft(t,"elevation"),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),i.axisHeader.set("visible",!1);const n=h(t.params.container),o=i.get("renderer");o.setAll({minGridDistance:e.yAxisMinGridDistance,opposite:n,inside:!0}),o.labels.template.setAll({centerX:S,centerY:k,fill:P(e.axisLabelsColor),fontSize:e.axisLabelsFontSize,fontWeight:e.axisLabelsFontWeight,maxPosition:e.yAxisMaxLabelPosition,minPosition:e.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:n?0:e.yAxisLabelSpacing,paddingRight:n?e.yAxisLabelSpacing:0,paddingTop:0,textAlign:"start"}),o.grid.template.setAll({strokeOpacity:1,stroke:P(e.axisGridStroke)})}function J(t,{data:i,messages:e}){if(t.chart.root.isDisposed())return;const n=null!=i&&i.refined;t.chart.get("cursor")?.set("forceHidden",!n);const o=(t.data??null)!==(i??null),s=(t.data?.effectiveUnits??null)!==(i?.effectiveUnits??null);t.data=i,t.messages=e,(o||s)&&(K(t),it(t)),ct(t)}function K(t){const{chart:i,xAxis:e,yAxis:n}=t,{minX:o,maxX:s,minY:a,maxY:l}=Q({data:t.data,pixelWidth:e.width(),pixelHeight:n.height()}),r=t.data?.uniformScaling;i.setAll({panX:!0,panY:r,pinchZoomX:r,pinchZoomY:r,wheelX:"panX",wheelY:r?"zoomXY":"zoomX"}),e.setAll({max:s,min:o,panX:!0,panY:!1,zoomX:!0,zoomY:r}),n.setAll({max:l,min:a,panX:!1,panY:r,zoomX:r,zoomY:r})}function Q({data:t,pixelWidth:i,pixelHeight:e}){if(null==t)return $;const n=t.statistics,o=0,s=n?.maxDistance;let a=n?.minElevation,l=n?.maxElevation;if(null==s||null==a||null==l)return $;const r=Math.max(s-o,R);let c=Math.max(l-a,R);const u=t.effectiveUnits;if(t.dynamicElevationRange){const t=d(r,u.distance,u.elevation);c=Math.max(c,t/p().maxChartRatio)}return a-=G*c,l=a+c+W*c,[a,l]=x(a,l,10),c=l-a,t.uniformScaling?_({data:t,bounds:{minX:o,maxX:s,minY:a,maxY:l},pixelWidth:i,pixelHeight:e,centered:!0}):{minX:o,maxX:o+r,minY:a,maxY:a+c}}function _({data:t,bounds:i,pixelWidth:e,pixelHeight:n,centered:o}){if(null==t)return i;let{minX:s,maxX:a,minY:l,maxY:r}=i;if(null==s||null==a||null==l||null==r)return $;const c=a-s,p=r-l,u=t.effectiveUnits,m=d(p,u.elevation,u.distance)/n/(c/e);return m>=1?[s,a]=tt([s,a],m,o):[l,r]=tt([l,r],1/m,o),{minX:s,maxX:a,minY:l,maxY:r}}function tt([t,i],e,n){const o=(i-t)*e;if(n){const e=(t+i)/2-o/2;return[e,e+o]}return[t,t+o]}function it(t){const{chart:i,data:e,series:n,xAxis:o,yAxis:s}=t;if(null==e||0===e.lines.length)return void i.series.clear();const a=new Map,l=new Set(i.series.values),r=e.lines.length;for(let d=0;d<r;d++){const o=e.lines[d];let s=n.get(o.id);s?(s.fill&&l.delete(s.fill),l.delete(s.line)):(s=nt(t,o),s.fill&&i.series.push(s.fill),i.series.push(s.line)),a.set(s.id,s);const c=r-d-1;s.fill?.set("layer",c),s.line.set("layer",r+c),et(t,s,o)}t.series=a;for(const d of l)i.series.removeValue(d);o.set("layer",r+1),s.set("layer",r+2)}function et(t,{line:i,fill:e},n){const{theme:o}=t,s=P(n.color.toCss()),a=n.samples??[],l=a.length>0;if(i.setAll({stroke:s,visible:l}),i.data.setAll(a),e){const t=X.lighten(s,o.seriesFillLighten);e.setAll({visible:l,fill:t}),e.data.setAll(a)}}function nt(t,i){const{id:e}=i,n=ot(t,`${H}-${e}`);n.setAll({dy:i.chartStrokeOffsetY,tooltip:st(t)}),n.strokes.template.setAll({strokeWidth:i.chartStrokeWidth});let o=null;return i.chartFillEnabled&&(o=ot(t,`${B}-${e}`),o.fills.template.setAll({fillOpacity:1,visible:!0})),{id:e,line:n,fill:o}}function ot(t,i){return M.new(t.chart.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:i,minDistance:O,stroke:void 0,valueXField:"distance",valueYField:"elevation",xAxis:t.xAxis,yAxis:t.yAxis})}function st({theme:t,chart:i}){const e=Y.new(i.root,{forceHidden:!0,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:"vertical",visible:!1}),n=t.seriesTooltipPaddingHorizontal,o=t.seriesTooltipPaddingVertical;return e.label.setAll({fill:P(t.seriesTooltipLabelColor),fontSize:t.seriesTooltipFontSize,paddingBottom:o,paddingLeft:n,paddingRight:n,paddingTop:o,textAlign:"start"}),e.get("background")?.setAll({stroke:void 0,fill:P(t.seriesTooltipBackgroundColor)}),e.adapters.add("dy",(i=>{const n=t.seriesTooltipSpacing,o=e.get("pointTo")?.y??0;return(i??0)+(e.y()>o?n:-n)})),e}function at(t,i){const{xAxis:e,yAxis:n}=t,o=()=>{i(lt(e),lt(n))},s=t=>[t.on("start",o),t.on("end",o)];return Tt([...s(e),...s(n)])}function lt(t){const i=Math.abs((t.get("end")??0)-(t.get("start")??0)),e=0!==i?1/i:1;return Math.abs(1-e)<c()?1:e}function rt(t,i){const{chart:e,xAxis:n,yAxis:o}=t,s=e.get("cursor"),a=e.plotContainer.events,l=i=>{t.pointerIsOver.value=i,ct(t)},r=()=>{l(!1),i(null,null)};return Tt([s?.events.on("cursormoved",(()=>{if(!t.pointerIsOver.value)return;ct(t);let e=ht(n,s),a=At(o,s);const l=t.data;if(null!=l&&null!=l.statistics){const{maxDistance:t,minElevation:i,maxElevation:s}=l.statistics;if(null!=t){e=dt(e,vt(n)??0,bt(n)??0,0,t)}if(null!=i&&null!=s){a=dt(a,vt(o)??0,bt(o)??0,i,s)}}i(e,a)})),a.on("pointerover",(()=>l(!0))),a.on("pointerout",r),a.on("blur",r)])}function dt(t,i,e,n,o){return(i+t*(e-i)-n)/(o-n)}function ct(t){const i=pt(t);if(!i)return void t.series.forEach((t=>{t.line.get("tooltip")?.set("forceHidden",!0)}));t.series.forEach((t=>{const e=t.line.get("tooltip");e.set("forceHidden",!1),e.label.set("text",i)}));t.xAxis.getTooltip().setAll({tooltipText:xt(t)})}function pt(t){const{data:i}=t,e=i?.lines.map((i=>({line:i,y:gt(t,i)?.elevation}))).sort(ut);return e&&0!==e.length&&null!=e[0].y?e.map((({y:i,line:e})=>mt(t,e,i))).join("\n"):null}function ut({y:t},{y:i}){return null==t?1:null==i?-1:i-t}function mt(t,i,e){const{data:n,messages:o}=t;if(null==n||null==o)return"";const s=p().formatPrecision,a=z(o.chartTooltip,{name:m(i,o),elevation:null!=e?l(o,e,n.effectiveUnits.elevation,s):u});return`[${i.color.toHex()}]●[/] ${a}`}function xt(t){const{data:i,messages:e}=t;if(null==i||null==e)return"";const n=i.lines[0],o=n?gt(t,n):null,s=p().formatPrecision;return null!=o?l(e,o.distance,i.effectiveUnits.distance,s):"-"}function ft(t,i){const e=g.new(t.chart.root,{});return e.format=(e,n,o)=>{const{messages:s,data:a}=t;if(null==s||null==a||"string"==typeof e)return"";return`${F(e,{maximumFractionDigits:o})} ${r(s,a.effectiveUnits[i],"abbr")}`},e}function gt({chart:t,xAxis:i},n){const o=n.samples??[];if(0===o.length)return null;const s=ht(i,t.get("cursor")),a=i.positionToValue(s);return e(o,a,(t=>t.distance))}function ht(t,i){return t.toAxisPosition(i?.getPrivate("positionX")??0)}function At(t,i){return t.toAxisPosition(i?.getPrivate("positionY")??0)}function vt(t){const i=t.get("start");return null!=i?t.positionToValue(t.toAxisPosition(i)):void 0}function bt(t){const i=t.get("end");return null!=i?t.positionToValue(t.toAxisPosition(i)):void 0}function Tt(t){return n(t.map(yt))}function yt(t){return o((()=>{t?.dispose()}))}export{I as createChart,Q as getAdjustedBounds};
5
+ import{r as t,d as i}from"../../../chunks/Responsive.js";import"../../../intl.js";import{binaryFindClosest as e}from"../../../core/arrayUtils.js";import{handlesGroup as n,makeHandle as o}from"../../../core/handleUtils.js";import{throwIfAborted as s}from"../../../core/promiseUtils.js";import{signal as a}from"../../../core/signal.js";import{formatDecimal as l,unitName as r}from"../../../core/unitFormatUtils.js";import{convertUnit as d}from"../../../core/unitUtils.js";import{g as c}from"../../../chunks/common.js";import{getConfig as p,NOT_AVAILABLE as u}from"./constants.js";import{getTranslatedLineTitle as m}from"./intlUtils.js";import{niceScale as x}from"./niceScale.js";import{c as f,N as g}from"../../../chunks/chartUtilsAm5.js";import{isRTL as h}from"../../support/widgetUtils.js";import{isDarkTheme as A}from"../../../support/themeUtils.js";import{X as v,V as b,A as T,a as y,b as L,L as M}from"../../../chunks/LineSeries.js";import{aq as S,a6 as k,a4 as P,C as X}from"../../../chunks/Theme.js";import{T as Y}from"../../../chunks/Tooltip.js";import{substitute as z}from"../../../intl/substitute.js";import{formatNumber as F}from"../../../intl/number.js";const C="#f8f8f8",j="#a9a9a9",w="#323232",H="line",B="fill",U=15,D=12,R=.001,O=.5,W=.1,G=.02,V={paddingBottom:D/2,paddingLeft:0,paddingRight:0,paddingTop:0,axisGridStroke:"#f4f4f4",axisLabelsFontSize:9,axisLabelsFontWeight:"400",axisLabelsColor:j,axisTooltipFontSize:12,axisTooltipBackgroundColor:w,axisTooltipLabelColor:C,axisTooltipPaddingTop:Math.round(D/4),axisTooltipPaddingBottom:Math.round(D/4),axisTooltipPaddingHorizontal:Math.round(U/4),xAxisMinGridDistance:50,xAxisLabelsSpacing:Math.round(D/2),xAxisMinLabelPosition:.05,xAxisMaxLabelPosition:.9,yAxisMinGridDistance:30,yAxisLabelSpacing:Math.round(U/4),yAxisMinLabelPosition:0,yAxisMaxLabelPosition:.8,seriesTooltipFontSize:12,seriesTooltipBackgroundColor:C,seriesTooltipLabelColor:w,seriesFillLighten:.9,seriesTooltipSpacing:D/2,seriesTooltipPaddingVertical:Math.round(U/4),seriesTooltipPaddingHorizontal:Math.round(U/4)},E={...V,axisGridStroke:w,axisLabelsColor:j,axisTooltipBackgroundColor:w,axisTooltipLabelColor:C,seriesTooltipBackgroundColor:w,seriesTooltipLabelColor:C,seriesFillLighten:-.75},$={minX:void 0,maxX:void 0,minY:void 0,maxY:void 0};async function I(e){const o=await f(e.container);s(e.abortOptions);const l=A(),r=l?E:V;o.setThemes(l?[t.new(o),i.new(o)]:[t.new(o)]);const d=h(e.container),c=o.container.children.push(v.new(o,{panX:!0,panY:!0,paddingTop:r.paddingTop,paddingBottom:r.paddingBottom,paddingLeft:d?r.paddingRight:r.paddingLeft,paddingRight:d?r.paddingLeft:r.paddingRight,maxTooltipDistance:0}));c.zoomOutButton.set("forceHidden",!0);const p=c.xAxes.push(b.new(o,{renderer:T.new(o,{})})),u=c.yAxes.push(b.new(o,{renderer:y.new(o,{})})),m={params:e,chart:c,xAxis:p,yAxis:u,series:new Map,data:null,messages:null,theme:r,state:a("loading"),pointerIsOver:a(!1)};q(m),N(m),Z(m);const x=n([at(m,e.onRangeChange),rt(m,e.onCursorPositionChange),bt(o.events.once("frameended",(()=>{m.state.value="ready"}))),bt(o)]);return{...m,destroy(){x.remove(),m.state.value="destroyed"},update(t){"destroyed"!==m.state.value&&J(m,t)},zoomOut(){"destroyed"!==m.state.value&&(m.xAxis.zoom(0,1),m.yAxis.zoom(0,1))}}}function Z({chart:t,xAxis:i,yAxis:e}){const n=L.new(t.root,{behavior:"none",xAxis:i,yAxis:e});n.lineY.set("visible",!1),t.set("cursor",n)}function q(t){const{chart:i,xAxis:e,theme:n}=t;e.setAll({extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:ft(t,"distance"),strictMinMax:!0,strictMinMaxSelection:!0}),e.axisHeader.set("forceHidden",!0);const o=e.get("renderer");o.setAll({inside:!1,minGridDistance:n.xAxisMinGridDistance}),o.labels.template.setAll({centerX:S,centerY:S,fill:k(n.axisLabelsColor),fontSize:n.axisLabelsFontSize,fontWeight:n.axisLabelsFontWeight,maxPosition:n.xAxisMaxLabelPosition,minPosition:n.xAxisMinLabelPosition,paddingLeft:0,paddingRight:0,paddingTop:n.xAxisLabelsSpacing});const s=e.set("tooltip",Y.new(i.root,{paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0}));s.get("background")?.setAll({fill:k(n.axisTooltipBackgroundColor),stroke:void 0}),s.label.setAll({fill:k(n.axisTooltipLabelColor),fontSize:n.axisTooltipFontSize,paddingBottom:n.axisTooltipPaddingBottom,paddingLeft:n.axisTooltipPaddingHorizontal,paddingRight:n.axisTooltipPaddingHorizontal,paddingTop:n.axisTooltipPaddingTop}),o.grid.template.setAll({strokeOpacity:1,stroke:k(n.axisGridStroke)})}function N(t){const{yAxis:i,theme:e}=t;i.setAll({baseValue:p().noDataValue,extraMax:0,extraMin:0,maxDeviation:0,numberFormatter:ft(t,"elevation"),strictMinMax:!0,strictMinMaxSelection:!0,tooltip:void 0}),i.axisHeader.set("visible",!1);const n=h(t.params.container),o=i.get("renderer");o.setAll({minGridDistance:e.yAxisMinGridDistance,opposite:n,inside:!0}),o.labels.template.setAll({centerX:S,centerY:P,fill:k(e.axisLabelsColor),fontSize:e.axisLabelsFontSize,fontWeight:e.axisLabelsFontWeight,maxPosition:e.yAxisMaxLabelPosition,minPosition:e.yAxisMinLabelPosition,paddingBottom:0,paddingLeft:n?0:e.yAxisLabelSpacing,paddingRight:n?e.yAxisLabelSpacing:0,paddingTop:0,textAlign:"start"}),o.grid.template.setAll({strokeOpacity:1,stroke:k(e.axisGridStroke)})}function J(t,{data:i,messages:e}){if(t.chart.root.isDisposed())return;const n=null!=i&&i.refined;t.chart.get("cursor")?.set("forceHidden",!n);const o=(t.data??null)!==(i??null),s=(t.data?.effectiveUnits??null)!==(i?.effectiveUnits??null);t.data=i,t.messages=e,(o||s)&&(K(t),it(t)),ct(t)}function K(t){const{chart:i,xAxis:e,yAxis:n}=t,{minX:o,maxX:s,minY:a,maxY:l}=Q({data:t.data,pixelWidth:e.width(),pixelHeight:n.height()}),r=t.data?.uniformScaling;i.setAll({panX:!0,panY:r,pinchZoomX:r,pinchZoomY:r,wheelX:"panX",wheelY:r?"zoomXY":"zoomX"}),e.setAll({max:s,min:o,panX:!0,panY:!1,zoomX:!0,zoomY:r}),n.setAll({max:l,min:a,panX:!1,panY:r,zoomX:r,zoomY:r})}function Q({data:t,pixelWidth:i,pixelHeight:e}){if(null==t)return $;const n=t.statistics,o=0,s=n?.maxDistance;let a=n?.minElevation,l=n?.maxElevation;if(null==s||null==a||null==l)return $;const r=Math.max(s-o,R);let c=Math.max(l-a,R);const u=t.effectiveUnits;if(t.dynamicElevationRange){const t=d(r,u.distance,u.elevation);c=Math.max(c,t/p().maxChartRatio)}return a-=G*c,l=a+c+W*c,[a,l]=x(a,l,10),c=l-a,t.uniformScaling?_({data:t,bounds:{minX:o,maxX:s,minY:a,maxY:l},pixelWidth:i,pixelHeight:e,centered:!0}):{minX:o,maxX:o+r,minY:a,maxY:a+c}}function _({data:t,bounds:i,pixelWidth:e,pixelHeight:n,centered:o}){if(null==t)return i;let{minX:s,maxX:a,minY:l,maxY:r}=i;if(null==s||null==a||null==l||null==r)return $;const c=a-s,p=r-l,u=t.effectiveUnits,m=d(p,u.elevation,u.distance)/n/(c/e);return m>=1?[s,a]=tt([s,a],m,o):[l,r]=tt([l,r],1/m,o),{minX:s,maxX:a,minY:l,maxY:r}}function tt([t,i],e,n){const o=(i-t)*e;if(n){const e=(t+i)/2-o/2;return[e,e+o]}return[t,t+o]}function it(t){const{chart:i,data:e,series:n,xAxis:o,yAxis:s}=t;if(null==e||0===e.lines.length)return void i.series.clear();const a=new Map,l=new Set(i.series.values),r=e.lines.length;for(let d=0;d<r;d++){const o=e.lines[d];let s=n.get(o.id);s?(s.fill&&l.delete(s.fill),l.delete(s.line)):(s=nt(t,o),s.fill&&i.series.push(s.fill),i.series.push(s.line)),a.set(s.id,s);const c=r-d-1;s.fill?.set("layer",c),s.line.set("layer",r+c),et(t,s,o)}t.series=a;for(const d of l)i.series.removeValue(d);o.set("layer",r+1),s.set("layer",r+2)}function et(t,{line:i,fill:e},n){const{theme:o}=t,s=k(n.color.toCss()),a=n.samples??[],l=a.length>0;if(i.setAll({stroke:s,visible:l}),i.data.setAll(a),e){const t=X.lighten(s,o.seriesFillLighten);e.setAll({visible:l,fill:t}),e.data.setAll(a)}}function nt(t,i){const{id:e}=i,n=ot(t,`${H}-${e}`);n.setAll({dy:i.chartStrokeOffsetY,tooltip:st(t)}),n.strokes.template.setAll({strokeWidth:i.chartStrokeWidth});let o=null;return i.chartFillEnabled&&(o=ot(t,`${B}-${e}`),o.fills.template.setAll({fillOpacity:1,visible:!0})),{id:e,line:n,fill:o}}function ot(t,i){return M.new(t.chart.root,{connect:!1,excludeFromTotal:!0,fill:void 0,id:i,minDistance:O,stroke:void 0,valueXField:"distance",valueYField:"elevation",xAxis:t.xAxis,yAxis:t.yAxis})}function st({theme:t,chart:i}){const e=Y.new(i.root,{forceHidden:!0,getFillFromSprite:!1,getLabelFillFromSprite:!1,pointerOrientation:"vertical",visible:!1}),n=t.seriesTooltipPaddingHorizontal,o=t.seriesTooltipPaddingVertical;return e.label.setAll({fill:k(t.seriesTooltipLabelColor),fontSize:t.seriesTooltipFontSize,paddingBottom:o,paddingLeft:n,paddingRight:n,paddingTop:o,textAlign:"start"}),e.get("background")?.setAll({stroke:void 0,fill:k(t.seriesTooltipBackgroundColor)}),e.adapters.add("dy",(i=>{const n=t.seriesTooltipSpacing,o=e.get("pointTo")?.y??0;return(i??0)+(e.y()>o?n:-n)})),e}function at(t,i){const{xAxis:e,yAxis:n}=t,o=()=>{i(lt(e),lt(n))},s=t=>[t.on("start",o),t.on("end",o)];return vt([...s(e),...s(n)])}function lt(t){const i=Math.abs((t.get("end")??0)-(t.get("start")??0)),e=0!==i?1/i:1;return Math.abs(1-e)<c()?1:e}function rt(t,i){const{chart:e,xAxis:n,yAxis:o}=t,s=e.get("cursor"),a=e.plotContainer.events,l=i=>{t.pointerIsOver.value=i,ct(t)},r=()=>{l(!1),i(null,null)};return vt([s?.events.on("cursormoved",(()=>{if(!t.pointerIsOver.value)return;ct(t);let e=s?.getPrivate("positionX")??0,a=s?.getPrivate("positionY")??0;const l=t.data;if(null!=l&&null!=l.statistics){const{maxDistance:t,minElevation:i,maxElevation:s}=l.statistics;if(null!=t){e=dt(e,ht(n),At(n),0,t)}if(null!=i&&null!=s){a=dt(a,ht(o),At(o),i,s)}}i(e,a)})),a.on("pointerover",(()=>l(!0))),a.on("pointerout",r),a.on("blur",r)])}function dt(t,i,e,n,o){return(i+t*(e-i)-n)/(o-n)}function ct(t){const i=pt(t);if(!i)return void t.series.forEach((t=>{t.line.get("tooltip")?.set("forceHidden",!0)}));t.series.forEach((t=>{const e=t.line.get("tooltip");e.set("forceHidden",!1),e.label.set("text",i)}));t.xAxis.getTooltip().setAll({tooltipText:xt(t)})}function pt(t){const{data:i}=t,e=i?.lines.map((i=>({line:i,y:gt(t,i)?.elevation}))).sort(ut);return e&&0!==e.length&&null!=e[0].y?e.map((({y:i,line:e})=>mt(t,e,i))).join("\n"):null}function ut({y:t},{y:i}){return null==t?1:null==i?-1:i-t}function mt(t,i,e){const{data:n,messages:o}=t;if(null==n||null==o)return"";const s=p().formatPrecision,a=z(o.chartTooltip,{name:m(i,o),elevation:null!=e?l(o,e,n.effectiveUnits.elevation,s):u});return`[${i.color.toHex()}]●[/] ${a}`}function xt(t){const{data:i,messages:e}=t;if(null==i||null==e)return"";const n=i.lines[0],o=n?gt(t,n):null,s=p().formatPrecision;return null!=o?l(e,o.distance,i.effectiveUnits.distance,s):"-"}function ft(t,i){const e=g.new(t.chart.root,{});return e.format=(e,n,o)=>{const{messages:s,data:a}=t;if(null==s||null==a||"string"==typeof e)return"";return`${F(e,{maximumFractionDigits:o})} ${r(s,a.effectiveUnits[i],"abbr")}`},e}function gt({chart:t,xAxis:i},n){const o=n.samples??[];if(0===o.length)return null;const s=t.get("cursor"),a=s?.getPrivate("positionX")??0,l=i.toAxisPosition(a),r=i.positionToValue(l);return e(o,r,(t=>t.distance))}function ht(t){return t.positionToValue(t.get("start")??0)}function At(t){return t.positionToValue(t.get("end")??1)}function vt(t){return n(t.map(bt))}function bt(t){return o((()=>{t?.dispose()}))}export{I as createChart,Q as getAdjustedBounds};