@arcgis/core 5.1.0-next.88 → 5.1.0-next.89

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 (82) hide show
  1. package/arcade/validation/arcadeValidator.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/0840e7dd62643c56ae9e.js +1 -0
  4. package/assets/esri/core/workers/chunks/{500be1fb7cc9efec875c.js → 0e3dcf99382478181366.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{aae40d70eb01249c1bab.js → 1e4e7111d43f01c149b3.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{2549a07f403447482f4e.js → 2dcfc4d7e76c922bcbf9.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{4dc91c2208201ba34c90.js → 3397eae416622c64e628.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{b9e163f4a898e50cc854.js → 39d6032d79720935910d.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{d05a7ce6c1d4b883ed4c.js → 41cbde4738ae4adf973d.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{a401d44a5b45c05072c2.js → 4b9b9e6136c11d5d7901.js} +1 -1
  11. package/assets/esri/core/workers/chunks/5409369d0d637cb30257.js +1 -0
  12. package/assets/esri/core/workers/chunks/{defac06f9e2b43090677.js → 73af4c947e8151d411c1.js} +2 -2
  13. package/assets/esri/core/workers/chunks/{01bd1b86ba899c6aa4c0.js → 75c09a2fa4c34b4844c5.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{b2983f521d8c96becd8a.js → 7ed5b669010db58845f8.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{8178e9ba3c568d406a87.js → 81d761c837b7456ec99f.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{7185486c6dc28fc367a1.js → 90a8dfb03a437fe8a6e7.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{c9065cee85eb8dde6a42.js → a2159df718a7f2f59271.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{7f34fa9f154f5101cb13.js → a232d05c0a055f398c6e.js} +1 -1
  19. package/assets/esri/core/workers/chunks/a508104179e08f0f268c.js +2 -0
  20. package/assets/esri/core/workers/chunks/{4baf66314f82cfa76beb.js → adfa5c136c72c1e65770.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{004af103a94d21cb4889.js → aefeb5a17bb481c95da3.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{164ee62f2211987ad850.js → bb8d596f15fd3a0d783a.js} +1 -1
  23. package/assets/esri/core/workers/chunks/bea2fd831d7a864e5995.js +596 -0
  24. package/assets/esri/core/workers/chunks/{3cf77b7a61f78f9bcd62.js → ceff78c9e31e3572a082.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{5cc38ac051d3d0557920.js → cfaa6e205bfc0c94a1b1.js} +1 -1
  26. package/assets/esri/core/workers/chunks/d5ad036d282df54b9ddc.js +1 -0
  27. package/assets/esri/core/workers/chunks/{475394218caaa4cd3e86.js → d7e7f3efd1d28617b808.js} +1 -1
  28. package/assets/esri/core/workers/chunks/{f37e4ae0e9be80210db0.js → f2c11f54255fd506655e.js} +1 -1
  29. package/assets/esri/libs/lyr3d/lyr3DMain.wasm +0 -0
  30. package/assets/esri/libs/lyr3d/lyr3DWorker.wasm +0 -0
  31. package/chunks/ComponentShader.glsl.js +3 -3
  32. package/chunks/index.js +1 -1
  33. package/config.js +1 -1
  34. package/interfaces.d.ts +7 -0
  35. package/kernel.js +1 -1
  36. package/layers/Lyr3DWasmPerSceneView.js +1 -1
  37. package/package.json +2 -2
  38. package/support/revision.js +1 -1
  39. package/views/3d/input/handlers/KeyboardNavigation.js +1 -1
  40. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  41. package/views/3d/layers/support/IntegratedMesh3DTilesVertexProcessing.js +1 -1
  42. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  43. package/views/3d/webgl-engine/core/shaderLibrary/TextureBackedBufferFields.glsl.js +3 -3
  44. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +22 -16
  45. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
  46. package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
  47. package/views/3d/webgl-engine/effects/glow/Glow.js +1 -1
  48. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBackedBufferFieldCreation.js +1 -1
  49. package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +1 -1
  50. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  51. package/views/3d/webgl-engine/materials/DefaultBufferWriter.js +1 -1
  52. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  53. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  54. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  55. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  56. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  57. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  58. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  59. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  60. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  61. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  62. package/views/3d/webgl-engine/materials/renderers/TextureBufferCache.js +1 -1
  63. package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
  64. package/views/3d/webgl-engine/shaders/RibbonLineLayouts.js +2 -0
  65. package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
  66. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  67. package/widgets/BatchAttributeForm/batchAttributeFormUtils.js +1 -1
  68. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.d.ts +64 -0
  69. package/widgets/BatchAttributeForm/inputs/AttachmentElementInput.js +2 -0
  70. package/widgets/BatchAttributeForm/inputs/BatchFormInputs.d.ts +3 -0
  71. package/widgets/BatchAttributeForm/inputs/BatchFormInputs.js +1 -1
  72. package/widgets/BatchAttributeForm/inputs/GroupInput.d.ts +2 -1
  73. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  74. package/widgets/BatchAttributeForm/inputs/support/inputUtils.js +1 -1
  75. package/widgets/BatchAttributeForm/inputs/types.d.ts +4 -2
  76. package/assets/esri/core/workers/chunks/3e72bd6dbfc52d956c06.js +0 -1
  77. package/assets/esri/core/workers/chunks/a429355534bf6cbd8304.js +0 -1
  78. package/assets/esri/core/workers/chunks/d00dddc3881fa29446e1.js +0 -1
  79. package/assets/esri/core/workers/chunks/f9fe3c9867b0bdb2aec6.js +0 -596
  80. package/assets/esri/core/workers/chunks/fe30e61652716fcccf16.js +0 -2
  81. /package/assets/esri/core/workers/chunks/{defac06f9e2b43090677.js.LICENSE.txt → 73af4c947e8151d411c1.js.LICENSE.txt} +0 -0
  82. /package/assets/esri/core/workers/chunks/{fe30e61652716fcccf16.js.LICENSE.txt → a508104179e08f0f268c.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{BufferViewFloat as e}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as t,isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{isUpdatableTexture as s}from"../lib/IManagedTexture.js";import{assert as a}from"../lib/Util.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{TriangleMaterialParameters as n,TriangleMaterial as p}from"./TriangleMaterial.js";import{writeBufferFloat as u,writeAttribute as h}from"./internal/bufferWriterUtils.js";import{getLayout as c,ImageMaterialTechnique as l}from"../shaders/ImageMaterialTechnique.js";import{ImageMaterialTechniqueConfiguration as m}from"../shaders/ImageMaterialTechniqueConfiguration.js";class f extends p{constructor(e){super(e,x),this.supportsEdges=!0,this.transparent=!0,this.visible=!0,this.produces=new Map([[2,e=>t(e)],[4,e=>r(e)&&this.parameters.writeDepth],[8,e=>r(e)&&!this.parameters.writeDepth],[18,e=>r(e)||t(e)]]),this._configuration=new m(e.draped)}updateConfiguration(e){super.updateConfiguration(e),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=e.hasOccludees,this._configuration.perspectiveInterpolation=this.parameters.perspectiveInterpolation}createGLMaterial(e){return new d(e)}createBufferWriter(){return new g(c(this.parameters))}}class d extends i{constructor(e){super({...e,...e.material.parameters}),this.parameters=e;const t=this._material.parameters.managedTexture;s(t)&&e.textures.updater.add(t)}dispose(){this.parameters.textures.updater.remove(this._material.parameters.managedTexture)}beginSlot(e){return this.getTechnique(l,e)}}class g extends o{write(t,r,i,s,o,n){for(const p of this.layout.fields.keys()){const s=i.get(p);if(s)if("perspectiveDivide"===p){a(1===s.size);const t=o.getField(p,e);t&&u(s,t,n)}else h(p,s,t,r,o,n)}return null}}class x extends n{constructor(e,t){super(),this.managedTexture=e,this.draped=t,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=0,this.opacity=1,this.perspectiveInterpolation=!1}get texture(){return this.managedTexture.texture}}export{f as ImageMaterial,x as Parameters};
2
+ import{BufferViewFloat as e}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as t,isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{isUpdatableTexture as s}from"../lib/IManagedTexture.js";import{assert as a}from"../lib/Util.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{TriangleMaterialParameters as n,TriangleMaterial as p}from"./TriangleMaterial.js";import{writeBufferFloat as u,writeAttribute as h}from"./internal/bufferWriterUtils.js";import{getLayout as c,ImageMaterialTechnique as l}from"../shaders/ImageMaterialTechnique.js";import{ImageMaterialTechniqueConfiguration as m}from"../shaders/ImageMaterialTechniqueConfiguration.js";class f extends p{constructor(e){super(e,x),this.supportsEdges=!0,this.transparent=!0,this.visible=!0,this.produces=new Map([[2,e=>t(e)],[4,e=>r(e)&&this.parameters.writeDepth],[8,e=>r(e)&&!this.parameters.writeDepth],[18,e=>r(e)||t(e)]]),this._configuration=new m(e.draped)}updateConfiguration(e){super.updateConfiguration(e),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=e.hasOccludees,this._configuration.perspectiveInterpolation=this.parameters.perspectiveInterpolation}createGLMaterial(e){return new d(e)}createBufferWriter(){return new g(c(this.parameters))}}class d extends i{constructor(e){super({...e,...e.material.parameters}),this.parameters=e;const t=this._material.parameters.managedTexture;s(t)&&e.textures.updater.add(t)}dispose(){this.parameters.textures.updater.remove(this._material.parameters.managedTexture)}beginSlot(e){return this.getTechnique(l,e)}}class g extends o{write(t,r,i,s,o){const{buffer:n,offset:p}=o;for(const c of this.layout.fields.keys()){const s=i.get(c);if(s)if("perspectiveDivide"===c){a(1===s.size);const t=n.getField(c,e);t&&u(s,t,p)}else h(c,s,t,r,n,p)}}}class x extends n{constructor(e,t){super(),this.managedTexture=e,this.draped=t,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=0,this.opacity=1,this.perspectiveInterpolation=!1}get texture(){return this.managedTexture.texture}}export{f as ImageMaterial,x as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as s,MaterialParameters as n}from"../lib/Material.js";import{writeBufferVec2 as a,writePosition as o,writeNormal as l,writeBufferVec3 as c,writeBufferFloat as u}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h,layout as f,baseLayout as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as d}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class m extends s{constructor(e,t){super(e,$),this.intersectDraped=void 0,this.produces=new Map([[15,e=>r(e)],[16,e=>r(e)]]),this._configuration=new d(t),this._uniqueMaterialIdentifier=S(this.parameters)}passParameters(){return this.parameters}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=16===e.slot,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane}get visible(){return this.parameters.color[3]>=g||(this.parameters.borderColor?.[3]??0)>=g}intersect(){}createGLMaterial(e){return new O(e)}createBufferWriter(){return new b}validateParameters(e){this._uniqueMaterialIdentifier=S(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function S({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,shaderPolygonOffset:a,hudDepthAlignStart:o,centerOffsetUnits:l,hasSlicePlane:c,screenSizePerspective:u,verticalOffset:h,borderColor:f}){return e`${t}:${r}:${i}:[${s}]:${n}:${a}:${o}:${l}:${c}:${null!=u}:{${h?.screenLength}:${h?.minWorldLength}:${h?.maxWorldLength}}:[${f}]`}class O extends i{beginSlot(e){return this.getTechnique(h,e)}}class $ extends n{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=t(0,0,0,1),this.size=1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}class b{constructor(){this.layout=f,this.baseInstanceLayout=p}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}writeBaseInstance(e,t){const{uv0:r}=t;a(e.get("uv0"),r,0)}write(e,t,r,i,s,n){return o(r.get("position"),e,s.position,n),l(r.get("normal"),t,s.normal,n),c(r.get("centerOffset"),s.centerOffset,n),u(r.get("groundDistance"),s.groundDistance,n),null}}export{m as LineCalloutMaterial,$ as Parameters,S as uniqueMaterialIdentifier};
2
+ import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as s,MaterialParameters as n}from"../lib/Material.js";import{writeBufferVec2 as a,writePosition as o,writeNormal as c,writeBufferVec3 as l,writeBufferFloat as u}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h,layout as f,baseLayout as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as d}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class m extends s{constructor(e,t){super(e,$),this.intersectDraped=void 0,this.produces=new Map([[15,e=>r(e)],[16,e=>r(e)]]),this._configuration=new d(t),this._uniqueMaterialIdentifier=S(this.parameters)}passParameters(){return this.parameters}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=16===e.slot,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane}get visible(){return this.parameters.color[3]>=g||(this.parameters.borderColor?.[3]??0)>=g}intersect(){}createGLMaterial(e){return new O(e)}createBufferWriter(){return new b}validateParameters(e){this._uniqueMaterialIdentifier=S(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function S({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,shaderPolygonOffset:a,hudDepthAlignStart:o,centerOffsetUnits:c,hasSlicePlane:l,screenSizePerspective:u,verticalOffset:h,borderColor:f}){return e`${t}:${r}:${i}:[${s}]:${n}:${a}:${o}:${c}:${l}:${null!=u}:{${h?.screenLength}:${h?.minWorldLength}:${h?.maxWorldLength}}:[${f}]`}class O extends i{beginSlot(e){return this.getTechnique(h,e)}}class $ extends n{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=t(0,0,0,1),this.size=1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}class b{constructor(){this.layout=f,this.baseInstanceLayout=p}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}writeBaseInstance(e,t){const{uv0:r}=t;a(e.get("uv0"),r,0)}write(e,t,r,i,s){const{buffer:n,offset:a}=s;o(r.get("position"),e,n.position,a),c(r.get("normal"),t,n.normal,a),l(r.get("centerOffset"),n.centerOffset,a),u(r.get("groundDistance"),n.groundDistance,a)}}export{m as LineCalloutMaterial,$ as Parameters,S as uniqueMaterialIdentifier};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{set as e,equals as t,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as s}from"../../../../geometry/support/float16.js";import{isColor as a,isDepth as o,isColorHighlightOLIDOrDepth as h}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{Material as c}from"../lib/Material.js";import{VisualVariablePassParameters as p}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as m}from"./internal/bufferWriterUtils.js";import{getLayout as l,LineMarkerTechnique as u}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d}from"../shaders/LineMarkerTechniqueConfiguration.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";class g extends c{constructor(e,t){super(e,v),this.produces=new Map([[2,e=>10===e||a(e)&&8===this.parameters.renderOccluded],[3,e=>o(e)],[10,e=>h(e)&&8===this.parameters.renderOccluded],[11,e=>h(e)&&8===this.parameters.renderOccluded],[4,e=>a(e)&&this.parameters.writeDepth],[8,e=>a(e)&&!this.parameters.writeDepth],[18,e=>a(e)||10===e]]),this.intersectDraped=void 0,this._configuration=new d(t)}updateConfiguration(e){super.updateConfiguration(e),this._configuration.space=18===e.slot?0:this.parameters.worldSpace?2:1,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=0!==this.parameters.cap,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=e.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective}get visible(){return this.parameters.color[3]>=f}intersect(){}createBufferWriter(){return new S(l(this.parameters),this.parameters)}createGLMaterial(e){return new _(e)}}class _ extends n{dispose(){super.dispose(),this._markerTextures?.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(u,e)}}class v extends p{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=0,this.anchor=0,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.stipplePattern=null,this.markerTexture=null}}class S{constructor(e,t){this.layout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,a,o,h,n,c){const p=o.get("position").data,l=p.length/3;let u=[1,0,0];const d=o.get("normal");this._parameters.worldSpace&&null!=d&&(u=d.data);let f=1,g=0;this._parameters.vvSize?g=o.get("sizeFeatureAttribute").data[0]:o.has("size")&&(f=o.get("size").data[0]);let _=[1,1,1,1],v=0;this._parameters.vvColor?v=o.get("colorFeatureAttribute").data[0]:o.has("color")&&(_=o.get("color").data);let S=0;this._parameters.vvOpacity&&(S=o.get("opacityFeatureAttribute").data[0]);const P=new Float32Array(n.buffer),O=s(n.buffer),T=new Uint8Array(n.buffer);let V=c*(this.layout.stride/4);const k=P.BYTES_PER_ELEMENT/O.BYTES_PER_ELEMENT,j=4/k,y=(e,t,r,i)=>{P[V++]=e[0],P[V++]=e[1],P[V++]=e[2],m(t,e,O,V*k),V+=j;let s=V*k;if(O[s++]=r[0],O[s++]=r[1],V=Math.ceil(s/k),this._parameters.vvColor)P[V++]=v;else{const e=Math.min(4*i,_.length-4),t=4*V++;T[t]=255*_[e],T[t+1]=255*_[e+1],T[t+2]=255*_[e+2],T[t+3]=255*_[e+3]}this._parameters.vvOpacity&&(P[V++]=S),s=V*k,this._parameters.vvSize?(P[V++]=g,s+=2):O[s++]=f,this._parameters.worldSpace&&(O[s++]=u[0],O[s++]=u[1],O[s++]=u[2]),V=Math.ceil(s/k)},M=(s,a)=>{const o=e(w,p[3*s],p[3*s+1],p[3*s+2]),h=b;let n=s+a;do{e(h,p[3*n],p[3*n+1],p[3*n+2]),n+=a}while(t(o,h)&&n>=0&&n<l);i&&(r(o,o,i),r(h,h,i)),y(o,h,[-1,-1],s),y(o,h,[1,-1],s),y(o,h,[1,1],s),y(o,h,[-1,-1],s),y(o,h,[1,1],s),y(o,h,[-1,1],s)},x=this._parameters.placement;return"begin"!==x&&"begin-end"!==x||M(0,1),"end"!==x&&"begin-end"!==x||M(l-1,-1),null}}const w=i(),b=i();export{g as LineMarkerMaterial,v as Parameters};
2
+ import{set as e,equals as t,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as s}from"../../../../geometry/support/float16.js";import{isColor as a,isDepth as o,isColorHighlightOLIDOrDepth as h}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{Material as c}from"../lib/Material.js";import{VisualVariablePassParameters as p}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as m}from"./internal/bufferWriterUtils.js";import{getLayout as l,LineMarkerTechnique as u}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d}from"../shaders/LineMarkerTechniqueConfiguration.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";class g extends c{constructor(e,t){super(e,v),this.produces=new Map([[2,e=>10===e||a(e)&&8===this.parameters.renderOccluded],[3,e=>o(e)],[10,e=>h(e)&&8===this.parameters.renderOccluded],[11,e=>h(e)&&8===this.parameters.renderOccluded],[4,e=>a(e)&&this.parameters.writeDepth],[8,e=>a(e)&&!this.parameters.writeDepth],[18,e=>a(e)||10===e]]),this.intersectDraped=void 0,this._configuration=new d(t)}updateConfiguration(e){super.updateConfiguration(e),this._configuration.space=18===e.slot?0:this.parameters.worldSpace?2:1,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=0!==this.parameters.cap,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=e.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective}get visible(){return this.parameters.color[3]>=f}intersect(){}createBufferWriter(){return new S(l(this.parameters),this.parameters)}createGLMaterial(e){return new _(e)}}class _ extends n{dispose(){super.dispose(),this._markerTextures?.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(u,e)}}class v extends p{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=0,this.anchor=0,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.stipplePattern=null,this.markerTexture=null}}class S{constructor(e,t){this.layout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,a,o,h,n){const{buffer:c,offset:p}=n,l=o.get("position").data,u=l.length/3;let d=[1,0,0];const f=o.get("normal");this._parameters.worldSpace&&null!=f&&(d=f.data);let g=1,_=0;this._parameters.vvSize?_=o.get("sizeFeatureAttribute").data[0]:o.has("size")&&(g=o.get("size").data[0]);let v=[1,1,1,1],S=0;this._parameters.vvColor?S=o.get("colorFeatureAttribute").data[0]:o.has("color")&&(v=o.get("color").data);let P=0;this._parameters.vvOpacity&&(P=o.get("opacityFeatureAttribute").data[0]);const O=new Float32Array(c.buffer),T=s(c.buffer),V=new Uint8Array(c.buffer);let k=p*(this.layout.stride/4);const j=O.BYTES_PER_ELEMENT/T.BYTES_PER_ELEMENT,y=4/j,M=(e,t,r,i)=>{O[k++]=e[0],O[k++]=e[1],O[k++]=e[2],m(t,e,T,k*j),k+=y;let s=k*j;if(T[s++]=r[0],T[s++]=r[1],k=Math.ceil(s/j),this._parameters.vvColor)O[k++]=S;else{const e=Math.min(4*i,v.length-4),t=4*k++;V[t]=255*v[e],V[t+1]=255*v[e+1],V[t+2]=255*v[e+2],V[t+3]=255*v[e+3]}this._parameters.vvOpacity&&(O[k++]=P),s=k*j,this._parameters.vvSize?(O[k++]=_,s+=2):T[s++]=g,this._parameters.worldSpace&&(T[s++]=d[0],T[s++]=d[1],T[s++]=d[2]),k=Math.ceil(s/j)},x=(s,a)=>{const o=e(b,l[3*s],l[3*s+1],l[3*s+2]),h=w;let n=s+a;do{e(h,l[3*n],l[3*n+1],l[3*n+2]),n+=a}while(t(o,h)&&n>=0&&n<u);i&&(r(o,o,i),r(h,h,i)),M(o,h,[-1,-1],s),M(o,h,[1,-1],s),M(o,h,[1,1],s),M(o,h,[-1,-1],s),M(o,h,[1,1],s),M(o,h,[-1,1],s)},C=this._parameters.placement;"begin"!==C&&"begin-end"!==C||x(0,1),"end"!==C&&"begin-end"!==C||x(u-1,-1)}}const b=i(),w=i();export{g as LineMarkerMaterial,v as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{set as t,normalize as e,subtract as r,cross as s,distance as o,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as c}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as u,MaterialParameters as p}from"../lib/Material.js";import{MeasurementArrowTechnique as h,layout as f}from"../shaders/MeasurementArrowTechnique.js";import{MeasurementArrowTechniqueConfiguration as m}from"../shaders/MeasurementArrowTechniqueConfiguration.js";import{alphaCutoff as d}from"../../../../webscene/support/AlphaCutoff.js";class g extends u{constructor(t){super(t,w),this._configuration=new m,this.intersectDraped=void 0,this.produces=new Map([[2,t=>!this._transparent&&c(t)],[8,t=>this._transparent&&c(t)]])}updateConfiguration(t){super.updateConfiguration(t),this._configuration.enableOITOffset=t.enableOITOffset,this._configuration.transparent=this._transparent,this._configuration.writeDepth=2===t.slot}get visible(){const{outlineColor:t,stripeEvenColor:e,stripeOddColor:r}=this.parameters;return t[3]>=d||e[3]>=d||r[3]>=d}intersect(){}createGLMaterial(t){return new C(t)}createBufferWriter(){return new _}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class C extends l{beginSlot(t){return this.getTechnique(h,t)}}class w 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}}const b=n(),j=n(),v=n(),M=n(),O=n();class _{constructor(){this.layout=f}elementCount(t){return 2*(t.get("position").indices.length/2+1)}write(n,a,c,l,u,p){const{data:h,indices:f}=c.get("position"),m=c.get("normal").data,d=h.length/3;f&&f.length!==2*(d-1)&&console.warn("MeasurementArrowMaterial does not support indices");const g=b,C=j,w=v,_=M,x=O,T=u.position,A=u.normal,L=u.uv0;let V=0;for(let b=0;b<d;++b){const c=3*b;if(t(g,h[c],h[c+1],h[c+2]),b<d-1){const o=3*(b+1);t(C,h[o],h[o+1],h[o+2]),t(x,m[o],m[o+1],m[o+2]),e(x,x),r(w,C,g),e(w,w),s(_,x,w),e(_,_)}const l=o(g,C);n&&a&&(i(g,g,n),i(C,C,n),i(_,_,a));const u=p+2*b,f=u+1;T.setVec(u,g),T.setVec(f,g),A.setVec(u,_),A.setVec(f,_),L.set(u,0,V),L.set(u,1,-1),L.set(f,0,V),L.set(f,1,1),b<d-1&&(V+=l)}const q=u.length;for(let t=0;t<2*d;++t)q.set(p+t,V);return null}}export{g as MeasurementArrowMaterial,w as Parameters};
2
+ import{set as t,normalize as e,subtract as r,cross as s,distance as o,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as c}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as p,MaterialParameters as u}from"../lib/Material.js";import{MeasurementArrowTechnique as f,layout as h}from"../shaders/MeasurementArrowTechnique.js";import{MeasurementArrowTechniqueConfiguration as m}from"../shaders/MeasurementArrowTechniqueConfiguration.js";import{alphaCutoff as d}from"../../../../webscene/support/AlphaCutoff.js";class g extends p{constructor(t){super(t,b),this._configuration=new m,this.intersectDraped=void 0,this.produces=new Map([[2,t=>!this._transparent&&c(t)],[8,t=>this._transparent&&c(t)]])}updateConfiguration(t){super.updateConfiguration(t),this._configuration.enableOITOffset=t.enableOITOffset,this._configuration.transparent=this._transparent,this._configuration.writeDepth=2===t.slot}get visible(){const{outlineColor:t,stripeEvenColor:e,stripeOddColor:r}=this.parameters;return t[3]>=d||e[3]>=d||r[3]>=d}intersect(){}createGLMaterial(t){return new C(t)}createBufferWriter(){return new _}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class C extends l{beginSlot(t){return this.getTechnique(f,t)}}class b extends u{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}}const w=n(),j=n(),v=n(),M=n(),O=n();class _{constructor(){this.layout=h}elementCount(t){return 2*(t.get("position").indices.length/2+1)}write(n,a,c,l,p){const{buffer:u,offset:f}=p,{data:h,indices:m}=c.get("position"),d=c.get("normal").data,g=h.length/3;m&&m.length!==2*(g-1)&&console.warn("MeasurementArrowMaterial does not support indices");const C=w,b=j,_=v,x=M,T=O,A=u.position,L=u.normal,V=u.uv0;let q=0;for(let w=0;w<g;++w){const c=3*w;if(t(C,h[c],h[c+1],h[c+2]),w<g-1){const o=3*(w+1);t(b,h[o],h[o+1],h[o+2]),t(T,d[o],d[o+1],d[o+2]),e(T,T),r(_,b,C),e(_,_),s(x,T,_),e(x,x)}const l=o(C,b);n&&a&&(i(C,C,n),i(b,b,n),i(x,x,a));const p=f+2*w,u=p+1;A.setVec(p,C),A.setVec(u,C),L.setVec(p,x),L.setVec(u,x),V.set(p,0,q),V.set(p,1,-1),V.set(u,0,q),V.set(u,1,1),w<g-1&&(q+=l)}const E=u.length;for(let t=0;t<2*g;++t)E.set(f+t,q)}}export{g as MeasurementArrowMaterial,b as Parameters};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{IDENTITY as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{BufferViewVec4f as r,BufferViewUint32 as s,BufferViewMat3f as i,BufferViewVec4u8 as o,BufferViewFloat as n}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as a,isColor as u,isDepth as l,isColorHighlightOrOLID as c}from"../core/shaderLibrary/ShaderOutput.js";import f from"../lib/GLMaterial.js";import{assert as h}from"../lib/Util.js";import{DefaultBufferWriter as m}from"./DefaultBufferWriter.js";import{TriangleMaterial as p}from"./TriangleMaterial.js";import{VisualVariablePassParameters as d}from"./VisualVariablePassParameters.js";import{writeAttributes as g,writeBufferVec4 as x,writeColor as b,writeVVFeatureAttribute as y}from"./internal/bufferWriterUtils.js";import{getLayout as j,getTextureLayout as v}from"../shaders/PatternLayouts.js";import{PatternTechnique as C}from"../shaders/PatternTechnique.js";import{PatternTechniqueConfiguration as w}from"../shaders/PatternTechniqueConfiguration.js";import{alphaCutoff as B}from"../../../../webscene/support/AlphaCutoff.js";class F extends p{constructor(e){super(e,_),this._configuration=new w,this.supportsEdges=!0,this.transparent=!0,this.produces=new Map([[2,e=>a(e)],[4,e=>u(e)],[5,e=>l(e)],[18,e=>this.parameters.draped&&c(e)]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.style=this.parameters.style,this._configuration.draped=this.parameters.draped,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.emissionSource=this.hasEmissions?1:0}get visible(){return this.parameters.color[3]>=B}get hasEmissions(){return this.parameters.emissiveStrength>0?2:0}createGLMaterial(e){return new S(e)}createBufferWriter(){return new P(j(this.parameters),v(this.parameters))}}class S extends f{beginSlot(e){return this.getTechnique(C,e)}}class P extends m{constructor(e,t){super(e),this.textureBufferLayout=t}elementCountTextureBuffer(e){return e.get("boundingRect")?.indices.length??0}write(e,t,i,o,n,a,u){const l=g(i,o,this.layout,e,t,n,a);for(const s of this.layout.fields.keys()){const e=i.get(s),t=e?.indices;if(e&&t)switch(s){case"uvMapSpace":{h(4===e.size);const t=n.getField(s,r);t&&x(e,t,a);break}}}const{textureBufferLayout:c}=this;if(null==c)return l;h(null!=u,"Using a texture layout, but the texture range for this instance was not provided");const f=u.from;h(1===u.numElements,"Provided more than one texture buffer element per polygon");const m=n.getField("textureElementIndex",s);h(null!=m,"Missing component index field");const p=i.get("position")?.indices.length??0;for(let r=0;r<p;++r)m.set(a+r,f);return l}writeTextureBuffer(t,r,s,a,u){const{textureBufferLayout:l}=this;if(null==l)return;const c=a.getField("boundingRect",i),f=s.get("boundingRect");c&&f&&(h(9===f.size),V(f,t??e,c,u));const m=a.getField("color",o),p=s.get("color");m&&p&&(h(3===p.size||4===p.size),b(p,p.size,m,u));const d=a.getField("colorFeatureAttribute",n),g=s.get("colorFeatureAttribute");d&&g&&(h(1===g.size),y(g,d,u))}}function V(e,t,r,s){const{data:i,indices:o}=e,n=t,a=r.typedBuffer,u=r.typedBufferStride,l=o.length;s*=u;for(let c=0;c<l;++c){const e=9*o[c],t=i[e],r=i[e+1],l=i[e+2];a[s]=n[0]*t+n[4]*r+n[8]*l+n[12],a[s+1]=n[1]*t+n[5]*r+n[9]*l+n[13],a[s+2]=n[2]*t+n[6]*r+n[10]*l+n[14];for(let o=3;o<9;++o)a[s+o]=i[e+o];s+=u}}class _ extends d{constructor(){super(...arguments),this.color=t(1,1,1,1),this.emissiveStrength=0,this.hasVertexColors=!1,this.polygonOffset=0,this.hasSlicePlane=!1,this.cullFace=0,this.hasOccludees=!1,this.style=2,this.draped=!0,this.useIndexing=!0}}export{_ as Parameters,F as PatternMaterial};
2
+ import{IDENTITY as e}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{BufferViewVec4f as r,BufferViewUint32 as s,BufferViewMat3f as i,BufferViewVec4u8 as o,BufferViewFloat as n}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as a,isColor as u,isDepth as f,isColorHighlightOrOLID as l}from"../core/shaderLibrary/ShaderOutput.js";import c from"../lib/GLMaterial.js";import{assert as h}from"../lib/Util.js";import{DefaultBufferWriter as m}from"./DefaultBufferWriter.js";import{TriangleMaterial as p}from"./TriangleMaterial.js";import{VisualVariablePassParameters as d}from"./VisualVariablePassParameters.js";import{writeAttributes as g,writeBufferVec4 as x,writeColor as b,writeVVFeatureAttribute as y}from"./internal/bufferWriterUtils.js";import{getLayout as j,getTextureLayout as B}from"../shaders/PatternLayouts.js";import{PatternTechnique as v}from"../shaders/PatternTechnique.js";import{PatternTechniqueConfiguration as w}from"../shaders/PatternTechniqueConfiguration.js";import{alphaCutoff as C}from"../../../../webscene/support/AlphaCutoff.js";class F extends p{constructor(e){super(e,V),this._configuration=new w,this.supportsEdges=!0,this.transparent=!0,this.produces=new Map([[2,e=>a(e)],[4,e=>u(e)],[5,e=>f(e)],[18,e=>this.parameters.draped&&l(e)]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.style=this.parameters.style,this._configuration.draped=this.parameters.draped,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.emissionSource=this.hasEmissions?1:0}get visible(){return this.parameters.color[3]>=C}get hasEmissions(){return this.parameters.emissiveStrength>0?2:0}createGLMaterial(e){return new S(e)}createBufferWriter(){return new _(j(this.parameters),B(this.parameters))}}class S extends c{beginSlot(e){return this.getTechnique(v,e)}}class _ extends m{constructor(e,t){super(e),this.textureBufferLayout=t}elementCountTextureBuffer(e){return e.get("boundingRect")?.indices.length??0}write(e,t,i,o,n,a){const{buffer:u,offset:f}=n,l=a?.textureBufferRange;g(i,o,this.layout,e,t,n);for(const s of this.layout.fields.keys()){const e=i.get(s),t=e?.indices;if(e&&t)switch(s){case"uvMapSpace":{h(4===e.size);const t=u.getField(s,r);t&&x(e,t,f);break}}}const{textureBufferLayout:c}=this;if(null==c)return;h(null!=l,"Using a texture layout, but the texture range for this instance was not provided");const m=l.from;h(1===l.numElements,"Provided more than one texture buffer element per polygon");const p=u.getField("textureElementIndex",s);h(null!=p,"Missing component index field");const d=i.get("position")?.indices.length??0;for(let r=0;r<d;++r)p.set(f+r,m);this._writeTextureBuffer(e,i,a)}_writeTextureBuffer(t,r,s){const{textureBufferLayout:a}=this;if(null==a||null==s)return;const{buffer:u,offset:f}=s,l=u.getField("boundingRect",i),c=r.get("boundingRect");l&&c&&(h(9===c.size),P(c,t??e,l,f));const m=u.getField("color",o),p=r.get("color");m&&p&&(h(3===p.size||4===p.size),b(p,p.size,m,f));const d=u.getField("colorFeatureAttribute",n),g=r.get("colorFeatureAttribute");d&&g&&(h(1===g.size),y(g,d,f))}}function P(e,t,r,s){const{data:i,indices:o}=e,n=t,a=r.typedBuffer,u=r.typedBufferStride,f=o.length;s*=u;for(let l=0;l<f;++l){const e=9*o[l],t=i[e],r=i[e+1],f=i[e+2];a[s]=n[0]*t+n[4]*r+n[8]*f+n[12],a[s+1]=n[1]*t+n[5]*r+n[9]*f+n[13],a[s+2]=n[2]*t+n[6]*r+n[10]*f+n[14];for(let o=3;o<9;++o)a[s+o]=i[e+o];s+=u}}class V extends d{constructor(){super(...arguments),this.color=t(1,1,1,1),this.emissiveStrength=0,this.hasVertexColors=!1,this.polygonOffset=0,this.hasSlicePlane=!1,this.cullFace=0,this.hasOccludees=!1,this.style=2,this.draped=!0,this.useIndexing=!0}}export{V as Parameters,F as PatternMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as p,add as h,copy as c,length as m,distance as u,lerp as f,transformMat4 as d,normalize as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as S}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as _,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as P}from"../../../../geometry/support/float16.js";import{create as w,fromPoints as y,distance2 as z,closestLineSegmentPoint as j,projectPointFraction as E}from"../../../../geometry/support/lineSegment.js";import{create as A,fromPoints as x,signedDistance as T,getNormal as C}from"../../../../geometry/support/plane.js";import{isHighlightOrOLID as O,isColor as M,isDepth as L,isColorHighlightOLIDOrDepth as R,is2DGeometryOutput as V}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as F}from"../effects/geometry/olidUtils.js";import N from"../lib/GLMaterial.js";import{Material as U}from"../lib/Material.js";import{ScreenSizePerspectiveEvaluator as k}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as W}from"../lib/Util.js";import{isImagePattern as B}from"./lineStippleUtils.js";import{VisualVariablePassParameters as I}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as D}from"./internal/bufferWriterUtils.js";import{r as J}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as Y,RibbonLineTechnique as q}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as X}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as G}from"../../../../webscene/support/AlphaCutoff.js";class H extends U{constructor(e,t){super(e,Q),this.produces=new Map([[2,e=>O(e)||M(e)&&8===this.parameters.renderOccluded],[3,e=>L(e)],[10,e=>R(e)&&8===this.parameters.renderOccluded],[11,e=>R(e)&&8===this.parameters.renderOccluded],[4,e=>M(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>M(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>V(e)]]),this._configuration=new X(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,r=i&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&te(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=G||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>G}get hasEmissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectDraped({attributes:e,screenToWorldRatio:i},r,s,a,n){if(!r.options.selectionMode)return;const o=e.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=e.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=t(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const p=s[0],h=s[1],c=(l/2+4)*i;let m=Number.MAX_VALUE,u=0;const f=e.get("position").data,d=ee(this.parameters,e)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const e=f[g],i=f[g+1],r=(g+3)%f.length,s=p-e,a=h-i,n=f[r]-e,o=f[r+1]-i,l=t((n*s+o*a)/(n*n+o*o),0,1),c=n*l-s,d=o*l-a,b=c*c+d*d;b<m&&(m=b,u=g/3)}m<c*c&&a(n.distance,n.normal,u)}intersect(i,r,s,f,d,g){const{options:b,camera:S,rayBegin:_,rayEnd:v}=s;if(!b.selectionMode||!i.visible||!S)return;if(!W(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=i.attributes,w=P.get("position").data;let E=this.parameters.width;if(this.parameters.vvSize){const e=P.get("sizeFeatureAttribute").data[0];Number.isNaN(e)||(E*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else P.has("size")&&(E*=P.get("size").data[0]);const A=he;a(A,s.point);const O=E*S.pixelRatio,M=4*S.pixelRatio,L=O/2+M;n(Pe[0],A[0]-L,A[1]+L,0),n(Pe[1],A[0]+L,A[1]+L,0),n(Pe[2],A[0]+L,A[1]-L,0),n(Pe[3],A[0]-L,A[1]-L,0);for(let e=0;e<4;e++)if(!S.unprojectFromRenderScreen(Pe[e],we[e]))return;x(S.eye,we[0],we[1],ye),x(S.eye,we[1],we[2],ze),x(S.eye,we[2],we[3],je),x(S.eye,we[3],we[0],Ee);let R=Number.MAX_VALUE,V=0;const F=ee(this.parameters,P)?w.length-2:w.length-5;for(let e=0;e<F;e+=3){re[0]=w[e]+r[12],re[1]=w[e+1]+r[13],re[2]=w[e+2]+r[14];const t=(e+3)%w.length;if(se[0]=w[t]+r[12],se[1]=w[t+1]+r[13],se[2]=w[t+2]+r[14],T(ye,re)<0&&T(ye,se)<0||T(ze,re)<0&&T(ze,se)<0||T(je,re)<0&&T(je,se)<0||T(Ee,re)<0&&T(Ee,se)<0)continue;const i=S.projectToRenderScreen(re,ce),s=S.projectToRenderScreen(se,me);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){o(le,re,se);const e=S.frustum,t=-T(e[4],re)/l(le,C(e[4]));if(p(le,le,t),h(re,re,le),!S.projectToRenderScreen(re,i))continue}else if(i[2]>0&&s[2]<0){o(le,se,re);const e=S.frustum,t=-T(e[4],se)/l(le,C(e[4]));if(p(le,le,t),h(se,se,le),!S.projectToRenderScreen(se,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=y(i,s,de),n=z(a,A);if(!(n>=R)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(a,re,se,A,S,E,M);if(n>=e*e)continue}R=n,c(ue,re),c(fe,se),V=e/3}}if(R<L*L){let e=Number.MAX_VALUE;if(j(y(ue,fe,de),y(_,v,ge),pe)){o(pe,pe,_);const t=m(pe);p(pe,pe,1/t),e=t/u(_,v)}g(e,pe,V)}}createBufferWriter(){return new Z(Y(this.parameters),this.parameters)}createGLMaterial(e){return new K(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:r(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,i,r,s,a,n){const o=E(e,r);f(ae,t,i,o),d(ne,ae,s.viewMatrix);const l=m(ne),p=this.computeCameraAbsCosAngle(ae,s,this._configuration.spherical);ie.update(p,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return ie.apply(a)*s.pixelRatio/2+n}computeCameraAbsCosAngle(e,t,i){return i?g(pe,e):n(pe,0,0,1),o(oe,e,t.eye),g(oe,oe),Math.abs(l(pe,oe))}}class K extends N{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(q,e)}}class Q extends I{constructor(){super(...arguments),this._width=0,this.color=_,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,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.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return B(this.stipplePattern)&&null!=this.stippleTexture}}class Z{constructor(e,t){this.layout=e,this._parameters=t;const i=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=i;break;case"round":this.numJoinSubdivisions=J+i}}_isClosed(e){return ee(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCount(e){const t=2,i=e.get("position").indices.length/2+1,r=this._isClosed(e);let s=r?2:2*t;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,i,r,s,a){const o=this.layout,l=i.get("position"),p=l.indices,h=l.data.length/3,m=i.get("distanceToStart")?.data;p&&p.length!==2*(h-1)&&console.warn("RibbonLineMaterial does not support indices");const f=o.fields.has("sizeFeatureAttribute");let g=1,b=null;if(f){const e=i.get("sizeFeatureAttribute");1===e.data.length?g=e.data[0]:b=e.data}else g=i.get("size")?.data[0]??1;let _=[1,1,1,1],v=0,w=null;const y=o.fields.has("colorFeatureAttribute");if(y){const e=i.get("colorFeatureAttribute");1===e.data.length?v=e.data[0]:w=e.data}else _=i.get("color")?.data??_;const z=i.get("timeStamps")?.data,j=z&&o.fields.has("timeStamps"),E=o.fields.has("opacityFeatureAttribute");let A=0,x=null;if(E){const e=i.get("opacityFeatureAttribute");1===e.data.length?A=e.data[0]:x=e.data}const T=new Float32Array(s.buffer),C=P(s.buffer),O=new Uint8Array(s.buffer),M=o.stride/4;let L=a*M;const R=L;let V=0;const N=m?(e,t,i)=>V=m[i]:(e,t,i)=>V+=u(e,t),U=T.BYTES_PER_ELEMENT/C.BYTES_PER_ELEMENT,k=4/U,W=F(),B=(e,t,i,s,a,n,o,l)=>{T[L++]=t[0],T[L++]=t[1],T[L++]=t[2],D(e,t,C,L*U),L+=k,D(i,t,C,L*U),L+=k,T[L++]=l;let p=L*U;if(C[p++]=a,C[p++]=n,L=Math.ceil(p/U),y)T[L]=w?.[o]??v;else{const e=Math.min(4*o,_.length-4),t=4*L;O[t]=255*_[e],O[t+1]=255*_[e+1],O[t+2]=255*_[e+2],O[t+3]=255*_[e+3]}if(L++,T[L++]=b?.[o]??g,E&&(T[L++]=x?.[o]??A),W){let e=4*L;r?(O[e++]=r[0],O[e++]=r[1],O[e++]=r[2],O[e++]=r[3]):(O[e++]=0,O[e++]=0,O[e++]=0,O[e++]=0),L=Math.ceil(.25*e)}j&&(p=L*U,C[p++]=s[0],C[p++]=s[1],C[p++]=s[2],C[p++]=s[3],L=Math.ceil(p/U))};L+=M,n(Se,l.data[0],l.data[1],l.data[2]),j&&S(ve,z[0],z[1],z[2],z[3]),e&&d(Se,Se,e);const I=this._isClosed(i);if(I){const t=l.data.length-3;n(be,l.data[t],l.data[t+1],l.data[t+2]),e&&d(be,be,e)}else n(_e,l.data[3],l.data[4],l.data[5]),e&&d(_e,_e,e),B(Se,Se,_e,ve,1,-4,0,0),B(Se,Se,_e,ve,1,4,0,0),c(be,Se),c(Se,_e),j&&S(ve,z[4],z[5],z[6],z[7]);const J=I?0:1,Y=I?h:h-1;for(let u=J;u<Y;u++){const t=(u+1)%h*3;n(_e,l.data[t],l.data[t+1],l.data[t+2]),e&&d(_e,_e,e),N(be,Se,u),B(be,Se,_e,ve,0,-1,u,V),B(be,Se,_e,ve,0,1,u,V);const i=this.numJoinSubdivisions;for(let e=0;e<i;++e){const t=(e+1)/(i+1);B(be,Se,_e,ve,t,-1,u,V),B(be,Se,_e,ve,t,1,u,V)}if(B(be,Se,_e,ve,1,-2,u,V),B(be,Se,_e,ve,1,2,u,V),c(be,Se),c(Se,_e),j){const e=(u+1)%h*4;S(ve,z[e],z[e+1],z[e+2],z[e+3])}}I?(n(_e,l.data[3],l.data[4],l.data[5]),e&&d(_e,_e,e),V=N(be,Se,Y),B(be,Se,_e,ve,0,-1,J,V),B(be,Se,_e,ve,0,1,J,V)):(V=N(be,Se,Y),B(be,Se,Se,ve,0,-5,Y,V),B(be,Se,Se,ve,0,5,Y,V)),$(T,R+M,T,R,M);return L=$(T,L-M,T,L,M),this._parameters.wireframe&&this._addWireframeVertices(s,R,L,M),null}_addWireframeVertices(e,t,i,r){const s=new Float32Array(e.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,i-t);let n=0;const o=e=>n=$(a,e,s,n,r);for(let l=0;l<a.length-1;l+=2*r)o(l),o(l+2*r),o(l+1*r),o(l+2*r),o(l+1*r),o(l+3*r)}}function $(e,t,i,r,s){for(let a=0;a<s;a++)i[r++]=e[t++];return r}function ee(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function te(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const ie=new k,re=b(),se=b(),ae=b(),ne=b(),oe=b(),le=b(),pe=b(),he=b(),ce=i(),me=i(),ue=b(),fe=b(),de=w(),ge=w(),be=b(),Se=b(),_e=b(),ve=v(),Pe=[i(),i(),i(),i()],we=[b(),b(),b(),b()],ye=A(),ze=A(),je=A(),Ee=A();export{Q as Parameters,H as RibbonLineMaterial};
2
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as r,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as p,add as h,copy as c,length as m,distance as u,lerp as f,transformMat4 as d,normalize as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as S}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as _,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as P}from"../../../../geometry/support/float16.js";import{create as w,fromPoints as y,distance2 as j,closestLineSegmentPoint as z,projectPointFraction as E}from"../../../../geometry/support/lineSegment.js";import{create as A,fromPoints as x,signedDistance as T,getNormal as C}from"../../../../geometry/support/plane.js";import{isHighlightOrOLID as O,isColor as M,isDepth as L,isColorHighlightOLIDOrDepth as R,is2DGeometryOutput as V}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as F}from"../effects/geometry/olidUtils.js";import N from"../lib/GLMaterial.js";import{Material as U}from"../lib/Material.js";import{ScreenSizePerspectiveEvaluator as k}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as W}from"../lib/Util.js";import{isImagePattern as B}from"./lineStippleUtils.js";import{VisualVariablePassParameters as I}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as D}from"./internal/bufferWriterUtils.js";import{r as J}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as Y}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as q}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as X}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as G}from"../../../../webscene/support/AlphaCutoff.js";class H extends U{constructor(e,t){super(e,Q),this.produces=new Map([[2,e=>O(e)||M(e)&&8===this.parameters.renderOccluded],[3,e=>L(e)],[10,e=>R(e)&&8===this.parameters.renderOccluded],[11,e=>R(e)&&8===this.parameters.renderOccluded],[4,e=>M(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>M(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>V(e)]]),this._configuration=new X(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,i=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,r=i&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=i,this._configuration.stippleOffColorEnabled=i&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=i&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&te(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.hasEmissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSizedImagePattern=r}get visible(){return this.parameters.color[3]>=G||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>G}get hasEmissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectDraped({attributes:e,screenToWorldRatio:i},r,s,a,n){if(!r.options.selectionMode)return;const o=e.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const i=e.get("sizeFeatureAttribute").data[0];Number.isNaN(i)?l*=this.parameters.vvSize.fallback[0]:l*=t(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const p=s[0],h=s[1],c=(l/2+4)*i;let m=Number.MAX_VALUE,u=0;const f=e.get("position").data,d=ee(this.parameters,e)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const e=f[g],i=f[g+1],r=(g+3)%f.length,s=p-e,a=h-i,n=f[r]-e,o=f[r+1]-i,l=t((n*s+o*a)/(n*n+o*o),0,1),c=n*l-s,d=o*l-a,b=c*c+d*d;b<m&&(m=b,u=g/3)}m<c*c&&a(n.distance,n.normal,u)}intersect(i,r,s,f,d,g){const{options:b,camera:S,rayBegin:_,rayEnd:v}=s;if(!b.selectionMode||!i.visible||!S)return;if(!W(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=i.attributes,w=P.get("position").data;let E=this.parameters.width;if(this.parameters.vvSize){const e=P.get("sizeFeatureAttribute").data[0];Number.isNaN(e)||(E*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else P.has("size")&&(E*=P.get("size").data[0]);const A=he;a(A,s.point);const O=E*S.pixelRatio,M=4*S.pixelRatio,L=O/2+M;n(Pe[0],A[0]-L,A[1]+L,0),n(Pe[1],A[0]+L,A[1]+L,0),n(Pe[2],A[0]+L,A[1]-L,0),n(Pe[3],A[0]-L,A[1]-L,0);for(let e=0;e<4;e++)if(!S.unprojectFromRenderScreen(Pe[e],we[e]))return;x(S.eye,we[0],we[1],ye),x(S.eye,we[1],we[2],je),x(S.eye,we[2],we[3],ze),x(S.eye,we[3],we[0],Ee);let R=Number.MAX_VALUE,V=0;const F=ee(this.parameters,P)?w.length-2:w.length-5;for(let e=0;e<F;e+=3){re[0]=w[e]+r[12],re[1]=w[e+1]+r[13],re[2]=w[e+2]+r[14];const t=(e+3)%w.length;if(se[0]=w[t]+r[12],se[1]=w[t+1]+r[13],se[2]=w[t+2]+r[14],T(ye,re)<0&&T(ye,se)<0||T(je,re)<0&&T(je,se)<0||T(ze,re)<0&&T(ze,se)<0||T(Ee,re)<0&&T(Ee,se)<0)continue;const i=S.projectToRenderScreen(re,ce),s=S.projectToRenderScreen(se,me);if(null==i||null==s)continue;if(i[2]<0&&s[2]>0){o(le,re,se);const e=S.frustum,t=-T(e[4],re)/l(le,C(e[4]));if(p(le,le,t),h(re,re,le),!S.projectToRenderScreen(re,i))continue}else if(i[2]>0&&s[2]<0){o(le,se,re);const e=S.frustum,t=-T(e[4],se)/l(le,C(e[4]));if(p(le,le,t),h(se,se,le),!S.projectToRenderScreen(se,s))continue}else if(i[2]<0&&s[2]<0)continue;i[2]=0,s[2]=0;const a=y(i,s,de),n=j(a,A);if(!(n>=R)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(a,re,se,A,S,E,M);if(n>=e*e)continue}R=n,c(ue,re),c(fe,se),V=e/3}}if(R<L*L){let e=Number.MAX_VALUE;if(z(y(ue,fe,de),y(_,v,ge),pe)){o(pe,pe,_);const t=m(pe);p(pe,pe,1/t),e=t/u(_,v)}g(e,pe,V)}}createBufferWriter(){return new Z(Y(this.parameters),this.parameters)}createGLMaterial(e){return new K(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:r(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,i,r,s,a,n){const o=E(e,r);f(ae,t,i,o),d(ne,ae,s.viewMatrix);const l=m(ne),p=this.computeCameraAbsCosAngle(ae,s,this._configuration.spherical);ie.update(p,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return ie.apply(a)*s.pixelRatio/2+n}computeCameraAbsCosAngle(e,t,i){return i?g(pe,e):n(pe,0,0,1),o(oe,e,t.eye),g(oe,oe),Math.abs(l(pe,oe))}}class K extends N{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(q,e)}}class Q extends I{constructor(){super(...arguments),this._width=0,this.color=_,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,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.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return B(this.stipplePattern)&&null!=this.stippleTexture}}class Z{constructor(e,t){this.layout=e,this._parameters=t;const i=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=i;break;case"round":this.numJoinSubdivisions=J+i}}_isClosed(e){return ee(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCount(e){const t=2,i=e.get("position").indices.length/2+1,r=this._isClosed(e);let s=r?2:2*t;return s+=((r?i:i-1)-(r?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,i,r,s,a){const{buffer:o,offset:l}=s,p=this.layout,h=i.get("position"),m=h.indices,f=h.data.length/3,g=i.get("distanceToStart")?.data;m&&m.length!==2*(f-1)&&console.warn("RibbonLineMaterial does not support indices");const b=p.fields.has("sizeFeatureAttribute");let _=1,v=null;if(b){const e=i.get("sizeFeatureAttribute");1===e.data.length?_=e.data[0]:v=e.data}else _=i.get("size")?.data[0]??1;let w=[1,1,1,1],y=0,j=null;const z=p.fields.has("colorFeatureAttribute");if(z){const e=i.get("colorFeatureAttribute");1===e.data.length?y=e.data[0]:j=e.data}else w=i.get("color")?.data??w;const E=i.get("timeStamps")?.data,A=E&&p.fields.has("timeStamps"),x=p.fields.has("opacityFeatureAttribute");let T=0,C=null;if(x){const e=i.get("opacityFeatureAttribute");1===e.data.length?T=e.data[0]:C=e.data}const O=new Float32Array(o.buffer),M=P(o.buffer),L=new Uint8Array(o.buffer),R=p.stride/4;let V=l*R;const N=V;let U=0;const k=g?(e,t,i)=>U=g[i]:(e,t,i)=>U+=u(e,t),W=O.BYTES_PER_ELEMENT/M.BYTES_PER_ELEMENT,B=4/W,I=F(),J=(e,t,i,s,a,n,o,l)=>{O[V++]=t[0],O[V++]=t[1],O[V++]=t[2],D(e,t,M,V*W),V+=B,D(i,t,M,V*W),V+=B,O[V++]=l;let p=V*W;if(M[p++]=a,M[p++]=n,V=Math.ceil(p/W),z)O[V]=j?.[o]??y;else{const e=Math.min(4*o,w.length-4),t=4*V;L[t]=255*w[e],L[t+1]=255*w[e+1],L[t+2]=255*w[e+2],L[t+3]=255*w[e+3]}if(V++,O[V++]=v?.[o]??_,x&&(O[V++]=C?.[o]??T),I){let e=4*V;r?(L[e++]=r[0],L[e++]=r[1],L[e++]=r[2],L[e++]=r[3]):(L[e++]=0,L[e++]=0,L[e++]=0,L[e++]=0),V=Math.ceil(.25*e)}A&&(p=V*W,M[p++]=s[0],M[p++]=s[1],M[p++]=s[2],M[p++]=s[3],V=Math.ceil(p/W))};V+=R,n(Se,h.data[0],h.data[1],h.data[2]),A&&S(ve,E[0],E[1],E[2],E[3]),e&&d(Se,Se,e);const Y=this._isClosed(i);if(Y){const t=h.data.length-3;n(be,h.data[t],h.data[t+1],h.data[t+2]),e&&d(be,be,e)}else n(_e,h.data[3],h.data[4],h.data[5]),e&&d(_e,_e,e),J(Se,Se,_e,ve,1,-4,0,0),J(Se,Se,_e,ve,1,4,0,0),c(be,Se),c(Se,_e),A&&S(ve,E[4],E[5],E[6],E[7]);const q=Y?0:1,X=Y?f:f-1;for(let u=q;u<X;u++){const t=(u+1)%f*3;n(_e,h.data[t],h.data[t+1],h.data[t+2]),e&&d(_e,_e,e),k(be,Se,u),J(be,Se,_e,ve,0,-1,u,U),J(be,Se,_e,ve,0,1,u,U);const i=this.numJoinSubdivisions;for(let e=0;e<i;++e){const t=(e+1)/(i+1);J(be,Se,_e,ve,t,-1,u,U),J(be,Se,_e,ve,t,1,u,U)}if(J(be,Se,_e,ve,1,-2,u,U),J(be,Se,_e,ve,1,2,u,U),c(be,Se),c(Se,_e),A){const e=(u+1)%f*4;S(ve,E[e],E[e+1],E[e+2],E[e+3])}}Y?(n(_e,h.data[3],h.data[4],h.data[5]),e&&d(_e,_e,e),U=k(be,Se,X),J(be,Se,_e,ve,0,-1,q,U),J(be,Se,_e,ve,0,1,q,U)):(U=k(be,Se,X),J(be,Se,Se,ve,0,-5,X,U),J(be,Se,Se,ve,0,5,X,U)),$(O,N+R,O,N,R);V=$(O,V-R,O,V,R),this._parameters.wireframe&&this._addWireframeVertices(o,N,V,R)}_addWireframeVertices(e,t,i,r){const s=new Float32Array(e.buffer,i*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,i-t);let n=0;const o=e=>n=$(a,e,s,n,r);for(let l=0;l<a.length-1;l+=2*r)o(l),o(l+2*r),o(l+1*r),o(l+2*r),o(l+1*r),o(l+3*r)}}function $(e,t,i,r,s){for(let a=0;a<s;a++)i[r++]=e[t++];return r}function ee(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function te(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const ie=new k,re=b(),se=b(),ae=b(),ne=b(),oe=b(),le=b(),pe=b(),he=b(),ce=i(),me=i(),ue=b(),fe=b(),de=w(),ge=w(),be=b(),Se=b(),_e=b(),ve=v(),Pe=[i(),i(),i(),i()],we=[b(),b(),b(),b()],ye=A(),je=A(),ze=A(),Ee=A();export{Q as Parameters,H as RibbonLineMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{normalize as e,set as t,scale as r,add as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as n,scale as p}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{isColorOrOLID as h}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as m,MaterialParameters as f}from"../lib/Material.js";import{intersectTriangleGeometry as u}from"../lib/RayIntersections.js";import{assert as d}from"../lib/Util.js";import{intersectWithPolygonOffset as g}from"./PolygonOffset.js";import{writeAttributes as b,writePosition as S}from"./internal/bufferWriterUtils.js";import{getLayout as _,ShadedColorMaterialTechnique as j}from"../shaders/ShadedColorMaterialTechnique.js";import{ShadedColorMaterialTechniqueConfiguration as w}from"../shaders/ShadedColorMaterialTechniqueConfiguration.js";import{alphaCutoff as x}from"../../../../webscene/support/AlphaCutoff.js";class z extends m{constructor(e){super(e,E),this._configuration=new w,this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,e=>10===e||h(e)&&!this.parameters.transparent],[4,e=>h(e)&&this.parameters.transparent&&this.parameters.writeDepth],[8,e=>h(e)&&this.parameters.transparent&&!this.parameters.writeDepth]])}updateConfiguration(e){super.updateConfiguration(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}get visible(){return this.parameters.color[3]>=x}intersect(e,t,r,s,i,a){this._intersect(e,r,s,i,a)}intersectDraped(e,t,r,s){return this._pp0[0]=this._pp1[0]=r[0],this._pp0[1]=this._pp1[1]=r[1],this._intersect(e,t,this._pp0,this._pp1,s)}_intersect(e,i,a,o,c){const h=g(c,this._configuration,a,o);if(this.parameters.screenSizeEnabled){const c=e.attributes.get("offset"),l={applyToVertex:(e,a,o,n)=>{const p=t(T,c.data[3*n],c.data[3*n+1],c.data[3*n+2]),h=t(C,e,a,o);return r(p,p,this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(p)??1)),s(h,h,p),[h[0],h[1],h[2]]},applyToAabb:e=>{const t=n(e,T);return p(e,this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(t)??1))}};u(e,i,a,o,l,h)}else u(e,i,a,o,void 0,h)}createGLMaterial(e){return new y(e)}createBufferWriter(){return new M(_(this.parameters))}}class y extends l{beginSlot(e){return this.getTechnique(j,e)}}class E extends f{constructor(){super(...arguments),this.color=o(1,1,1,1),this.shadingTint=o(0,0,0,.25),this.shadingDirection=e(a(),[.5,-.5,-.5]),this.screenSizeScale=14,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=0,this.screenSizeEnabled=!1,this.shadingEnabled=!0}get transparent(){return this.color[3]<1||this.forceTransparentMode}}class M{constructor(e){this.layout=e}elementCount(e){return e.get("position").indices.length}write(e,t,r,s,i,a){const o=b(r,s,this.layout,e,t,i,a),n=i.getField("offset",c);if(n&&r.has("offset")){const e=r.get("offset");d(3===e.size),S(e,t,n,a)}return o}}const T=a(),C=a();export{E as Parameters,z as ShadedColorMaterial};
2
+ import{normalize as e,set as t,scale as r,add as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as n,scale as p}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{isColorOrOLID as h}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as f,MaterialParameters as m}from"../lib/Material.js";import{intersectTriangleGeometry as u}from"../lib/RayIntersections.js";import{assert as d}from"../lib/Util.js";import{intersectWithPolygonOffset as g}from"./PolygonOffset.js";import{writeAttributes as b,writePosition as S}from"./internal/bufferWriterUtils.js";import{getLayout as _,ShadedColorMaterialTechnique as j}from"../shaders/ShadedColorMaterialTechnique.js";import{ShadedColorMaterialTechniqueConfiguration as w}from"../shaders/ShadedColorMaterialTechniqueConfiguration.js";import{alphaCutoff as x}from"../../../../webscene/support/AlphaCutoff.js";class z extends f{constructor(e){super(e,E),this._configuration=new w,this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,e=>10===e||h(e)&&!this.parameters.transparent],[4,e=>h(e)&&this.parameters.transparent&&this.parameters.writeDepth],[8,e=>h(e)&&this.parameters.transparent&&!this.parameters.writeDepth]])}updateConfiguration(e){super.updateConfiguration(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}get visible(){return this.parameters.color[3]>=x}intersect(e,t,r,s,i,a){this._intersect(e,r,s,i,a)}intersectDraped(e,t,r,s){return this._pp0[0]=this._pp1[0]=r[0],this._pp0[1]=this._pp1[1]=r[1],this._intersect(e,t,this._pp0,this._pp1,s)}_intersect(e,i,a,o,c){const h=g(c,this._configuration,a,o);if(this.parameters.screenSizeEnabled){const c=e.attributes.get("offset"),l={applyToVertex:(e,a,o,n)=>{const p=t(T,c.data[3*n],c.data[3*n+1],c.data[3*n+2]),h=t(C,e,a,o);return r(p,p,this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(p)??1)),s(h,h,p),[h[0],h[1],h[2]]},applyToAabb:e=>{const t=n(e,T);return p(e,this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(t)??1))}};u(e,i,a,o,l,h)}else u(e,i,a,o,void 0,h)}createGLMaterial(e){return new y(e)}createBufferWriter(){return new M(_(this.parameters))}}class y extends l{beginSlot(e){return this.getTechnique(j,e)}}class E extends m{constructor(){super(...arguments),this.color=o(1,1,1,1),this.shadingTint=o(0,0,0,.25),this.shadingDirection=e(a(),[.5,-.5,-.5]),this.screenSizeScale=14,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=0,this.screenSizeEnabled=!1,this.shadingEnabled=!0}get transparent(){return this.color[3]<1||this.forceTransparentMode}}class M{constructor(e){this.layout=e}elementCount(e){return e.get("position").indices.length}write(e,t,r,s,i){const{buffer:a,offset:o}=i;b(r,s,this.layout,e,t,i);const n=a.getField("offset",c);if(n&&r.has("offset")){const e=r.get("offset");d(3===e.size),S(e,t,n,o)}}}const T=a(),C=a();export{E as Parameters,z as ShadedColorMaterial};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{subtract as e,length as t,scale as f}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isOrthoNormal as r,hasIdentityRotation as i}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{BufferViewVec4u8 as n,BufferViewVec3f16 as s,BufferViewVec3f as c,BufferViewVec4f16 as l,BufferViewVec4f as d,BufferViewFloat as u,BufferViewVec2i16 as a,BufferViewVec2f16 as p,BufferViewVec2f as g}from"../../../../../geometry/support/buffer/BufferView.js";import{assert as m}from"../../lib/Util.js";function y(e,t,f,o=1){const{data:r,indices:i}=e,n=t.typedBuffer,s=t.typedBufferStride,c=i.length;if(f*=s,1===o)for(let l=0;l<c;++l)n[f]=r[i[l]],f+=s;else for(let l=0;l<c;++l){const e=r[i[l]];for(let t=0;t<o;t++)n[f]=e,f+=s}}function b(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length;f*=n;for(let c=0;c<s;++c){const e=2*r[c];i[f]=o[e],i[f+1]=o[e+1],f+=n}}function B(e,t,f,o=1){const{data:r,indices:i}=e,n=t.typedBuffer,s=t.typedBufferStride,c=i.length;if(f*=s,1===o)for(let l=0;l<c;++l){const e=3*i[l];n[f]=r[e],n[f+1]=r[e+1],n[f+2]=r[e+2],f+=s}else for(let l=0;l<c;++l){const e=3*i[l];for(let t=0;t<o;++t)n[f]=r[e],n[f+1]=r[e+1],n[f+2]=r[e+2],f+=s}}function h(e,t,f,o=1){const{data:r,indices:i}=e,n=t.typedBuffer,s=t.typedBufferStride,c=i.length;if(f*=s,1===o)for(let l=0;l<c;++l){const e=4*i[l];n[f]=r[e],n[f+1]=r[e+1],n[f+2]=r[e+2],n[f+3]=r[e+3],f+=s}else for(let l=0;l<c;++l){const e=4*i[l];for(let t=0;t<o;++t)n[f]=r[e],n[f+1]=r[e+1],n[f+2]=r[e+2],n[f+3]=r[e+3],f+=s}}function F(e,t,f){const o=e.typedBuffer,r=e.typedBufferStride,i=e.elementCount;t*=r;for(let n=0;n<f;++n){for(let e=0;e<i;++e)o[t+e]=0;t+=r}}function v(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length;f*=n;for(let c=0;c<s;++c){const e=9*r[c];for(let t=0;t<9;++t)i[f+t]=o[e+t];f+=n}}function w(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length;f*=n;for(let c=0;c<s;++c){const e=16*r[c];for(let t=0;t<16;++t)i[f+t]=o[e+t];f+=n}}function z(e,t,f,o,r=1){if(!t)return void B(e,f,o,r);const{data:n,indices:s}=e,c=f.typedBuffer,l=f.typedBufferStride,d=s.length,u=t[0],a=t[1],p=t[2],g=t[4],m=t[5],y=t[6],b=t[8],h=t[9],F=t[10],v=t[12],w=t[13],z=t[14];o*=l;let S=0,k=0,N=0;const $=i(t)?e=>{S=n[e]+v,k=n[e+1]+w,N=n[e+2]+z}:e=>{const t=n[e],f=n[e+1],o=n[e+2];S=u*t+g*f+b*o+v,k=a*t+m*f+h*o+w,N=p*t+y*f+F*o+z};if(1===r)for(let i=0;i<d;++i)$(3*s[i]),c[o]=S,c[o+1]=k,c[o+2]=N,o+=l;else for(let i=0;i<d;++i){$(3*s[i]);for(let e=0;e<r;++e)c[o]=S,c[o+1]=k,c[o+2]=N,o+=l}}function S(e,t,f,o,n=1){if(!t)return void B(e,f,o,n);const{data:s,indices:c}=e,l=t,d=f.typedBuffer,u=f.typedBufferStride,a=c.length,p=l[0],g=l[1],m=l[2],y=l[4],b=l[5],h=l[6],F=l[8],v=l[9],w=l[10],z=!r(l),S=1e-6,k=1-S;o*=u;let N=0,$=0,x=0;const A=i(l)?e=>{N=s[e],$=s[e+1],x=s[e+2]}:e=>{const t=s[e],f=s[e+1],o=s[e+2];N=p*t+y*f+F*o,$=g*t+b*f+v*o,x=m*t+h*f+w*o};if(1===n)if(z)for(let r=0;r<a;++r){A(3*c[r]);const e=N*N+$*$+x*x;if(e<k&&e>S){const t=1/Math.sqrt(e);d[o]=N*t,d[o+1]=$*t,d[o+2]=x*t}else d[o]=N,d[o+1]=$,d[o+2]=x;o+=u}else for(let r=0;r<a;++r)A(3*c[r]),d[o]=N,d[o+1]=$,d[o+2]=x,o+=u;else for(let r=0;r<a;++r){if(A(3*c[r]),z){const e=N*N+$*$+x*x;if(e<k&&e>S){const t=1/Math.sqrt(e);N*=t,$*=t,x*=t}}for(let e=0;e<n;++e)d[o]=N,d[o+1]=$,d[o+2]=x,o+=u}}function k(e,t,f,o,i=1){if(!t)return void h(e,f,o,i);const{data:n,indices:s}=e,c=t,l=f.typedBuffer,d=f.typedBufferStride,u=s.length,a=c[0],p=c[1],g=c[2],m=c[4],y=c[5],b=c[6],B=c[8],F=c[9],v=c[10],w=!r(c),z=1e-6,S=1-z;if(o*=d,1===i)for(let r=0;r<u;++r){const e=4*s[r],t=n[e],f=n[e+1],i=n[e+2],c=n[e+3];let u=a*t+m*f+B*i,h=p*t+y*f+F*i,k=g*t+b*f+v*i;if(w){const e=u*u+h*h+k*k;if(e<S&&e>z){const t=1/Math.sqrt(e);u*=t,h*=t,k*=t}}l[o]=u,l[o+1]=h,l[o+2]=k,l[o+3]=c,o+=d}else for(let r=0;r<u;++r){const e=4*s[r],t=n[e],f=n[e+1],c=n[e+2],u=n[e+3];let h=a*t+m*f+B*c,k=p*t+y*f+F*c,N=g*t+b*f+v*c;if(w){const e=h*h+k*k+N*N;if(e<S&&e>z){const t=1/Math.sqrt(e);h*=t,k*=t,N*=t}}for(let r=0;r<i;++r)l[o]=h,l[o+1]=k,l[o+2]=N,l[o+3]=u,o+=d}}function N(e,t,f,o,r=1){const{data:i,indices:n}=e,s=f.typedBuffer,c=f.typedBufferStride,l=n.length;if(o*=c,t===i.length&&4===t){s[o]=i[0],s[o+1]=i[1],s[o+2]=i[2],s[o+3]=i[3];const e=new Uint32Array(f.typedBuffer.buffer,f.start),t=c/4,n=e[o/=4];o+=t;const d=l*r;for(let f=1;f<d;++f)e[o]=n,o+=t;return}if(1!==r)if(4!==t)for(let d=0;d<l;++d){const e=3*n[d];for(let t=0;t<r;++t)s[o]=i[e],s[o+1]=i[e+1],s[o+2]=i[e+2],s[o+3]=255,o+=c}else for(let d=0;d<l;++d){const e=4*n[d];for(let t=0;t<r;++t)s[o]=i[e],s[o+1]=i[e+1],s[o+2]=i[e+2],s[o+3]=i[e+3],o+=c}else{if(4===t){for(let e=0;e<l;++e){const t=4*n[e];s[o]=i[t],s[o+1]=i[t+1],s[o+2]=i[t+2],s[o+3]=i[t+3],o+=c}return}for(let e=0;e<l;++e){const t=3*n[e];s[o]=i[t],s[o+1]=i[t+1],s[o+2]=i[t+2],s[o+3]=255,o+=c}}}function $(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,n=t.typedBufferStride,s=r.length,c=o[0];f*=n;for(let l=0;l<s;++l)i[f]=c,f+=n}function x(o,r,i,n){e(A,o,r);const s=Math.max(Math.sqrt(t(A)),1e-4);f(A,A,1/s),i[n++]=A[0],i[n++]=A[1],i[n++]=A[2],i[n++]=s}const A=o();function M(e,t,f,o,r=1){const i=t.typedBuffer,n=t.typedBufferStride;if(o*=n,1===r)for(let s=0;s<f;++s)i[o]=e[0],i[o+1]=e[1],i[o+2]=e[2],i[o+3]=e[3],o+=n;else for(let s=0;s<f;++s)for(let t=0;t<r;++t)i[o]=e[0],i[o+1]=e[1],i[o+2]=e[2],i[o+3]=e[3],o+=n}function j(e,t,f,o,r,i,s){let c={numItems:0,numVerticesPerItem:0};for(const l of f.fields.keys()){const f=e.get(l),d=f?.indices;if(f&&d)"position"===l&&(c={numItems:1,numVerticesPerItem:d.length}),q(l,f,o,r,i,s);else if("olidColor"===l&&null!=t){const f=e.get("position")?.indices;if(f){const e=f.length;M(t,i.getField(l,n),e,s)}}}return c}function q(e,t,f,o,r,i){switch(e){case"position":{m(3===t.size);const o=r.getField(e,c);m(!!o,`No buffer view for ${e}`),z(t,f,o,i);break}case"normal":{m(3===t.size);const f=r.getField(e,c);m(!!f,`No buffer view for ${e}`),S(t,o,f,i);break}case"normalCompressed":case"profileRight":case"profileUp":{m(2===t.size);const f=r.getField(e,a);m(!!f,`No buffer view for ${e}`),b(t,f,i);break}case"uv0":{m(2===t.size);const f=r.getField(e,p)??r.getField(e,g);m(!!f,`No buffer view for ${e}`),b(t,f,i);break}case"uvi":{m(2===t.size);const f=r.getField(e,a);m(!!f,`No buffer view for ${e}`),b(t,f,i);break}case"color":case"symbolColor":{const f=r.getField(e,n);m(!!f,`No buffer view for ${e}`),m(3===t.size||4===t.size),N(t,t.size,f,i);break}case"colorFeatureAttribute":case"opacityFeatureAttribute":case"sizeFeatureAttribute":{const f=r.getField(e,u)??r.getField(e,u);m(!!f,`No buffer view for ${e}`),m(1===t.size),$(t,f,i);break}case"tangent":{m(4===t.size);const o=r.getField(e,d);m(!!o,`No buffer view for ${e}`),k(t,f,o,i);break}case"profileVertexAndNormal":{m(4===t.size);const f=r.getField(e,l)??r.getField(e,d);m(!!f,`No buffer view for ${e}`),h(t,f,i);break}case"profileAuxData":{m(3===t.size);const f=r.getField(e,s)??r.getField(e,c);m(!!f,`No buffer view for ${e}`),B(t,f,i);break}}}export{q as writeAttribute,j as writeAttributes,y as writeBufferFloat,v as writeBufferMat3f,w as writeBufferMat4f,b as writeBufferVec2,B as writeBufferVec3,h as writeBufferVec4,F as writeBufferZeros,N as writeColor,x as writeDeltaF16Vector,S as writeNormal,M as writeOlidColor,z as writePosition,k as writeTangent,$ as writeVVFeatureAttribute};
2
+ import{subtract as e,length as t,scale as f}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isOrthoNormal as r,hasIdentityRotation as i}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{BufferViewVec4u8 as s,BufferViewVec3f16 as n,BufferViewVec3f as c,BufferViewVec4f16 as l,BufferViewVec4f as d,BufferViewFloat as u,BufferViewVec2i16 as a,BufferViewVec2f16 as p,BufferViewVec2f as g}from"../../../../../geometry/support/buffer/BufferView.js";import{assert as y}from"../../lib/Util.js";function b(e,t,f,o=1){const{data:r,indices:i}=e,s=t.typedBuffer,n=t.typedBufferStride,c=i.length;if(f*=n,1===o)for(let l=0;l<c;++l)s[f]=r[i[l]],f+=n;else for(let l=0;l<c;++l){const e=r[i[l]];for(let t=0;t<o;t++)s[f]=e,f+=n}}function B(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,s=t.typedBufferStride,n=r.length;f*=s;for(let c=0;c<n;++c){const e=2*r[c];i[f]=o[e],i[f+1]=o[e+1],f+=s}}function m(e,t,f,o=1){const{data:r,indices:i}=e,s=t.typedBuffer,n=t.typedBufferStride,c=i.length;if(f*=n,1===o)for(let l=0;l<c;++l){const e=3*i[l];s[f]=r[e],s[f+1]=r[e+1],s[f+2]=r[e+2],f+=n}else for(let l=0;l<c;++l){const e=3*i[l];for(let t=0;t<o;++t)s[f]=r[e],s[f+1]=r[e+1],s[f+2]=r[e+2],f+=n}}function h(e,t,f,o=1){const{data:r,indices:i}=e,s=t.typedBuffer,n=t.typedBufferStride,c=i.length;if(f*=n,1===o)for(let l=0;l<c;++l){const e=4*i[l];s[f]=r[e],s[f+1]=r[e+1],s[f+2]=r[e+2],s[f+3]=r[e+3],f+=n}else for(let l=0;l<c;++l){const e=4*i[l];for(let t=0;t<o;++t)s[f]=r[e],s[f+1]=r[e+1],s[f+2]=r[e+2],s[f+3]=r[e+3],f+=n}}function F(e,t,f){const o=e.typedBuffer,r=e.typedBufferStride,i=e.elementCount;t*=r;for(let s=0;s<f;++s){for(let e=0;e<i;++e)o[t+e]=0;t+=r}}function v(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,s=t.typedBufferStride,n=r.length;f*=s;for(let c=0;c<n;++c){const e=9*r[c];for(let t=0;t<9;++t)i[f+t]=o[e+t];f+=s}}function w(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,s=t.typedBufferStride,n=r.length;f*=s;for(let c=0;c<n;++c){const e=16*r[c];for(let t=0;t<16;++t)i[f+t]=o[e+t];f+=s}}function z(e,t,f,o,r=1){if(!t)return void m(e,f,o,r);const{data:s,indices:n}=e,c=f.typedBuffer,l=f.typedBufferStride,d=n.length,u=t[0],a=t[1],p=t[2],g=t[4],y=t[5],b=t[6],B=t[8],h=t[9],F=t[10],v=t[12],w=t[13],z=t[14];o*=l;let S=0,k=0,N=0;const $=i(t)?e=>{S=s[e]+v,k=s[e+1]+w,N=s[e+2]+z}:e=>{const t=s[e],f=s[e+1],o=s[e+2];S=u*t+g*f+B*o+v,k=a*t+y*f+h*o+w,N=p*t+b*f+F*o+z};if(1===r)for(let i=0;i<d;++i)$(3*n[i]),c[o]=S,c[o+1]=k,c[o+2]=N,o+=l;else for(let i=0;i<d;++i){$(3*n[i]);for(let e=0;e<r;++e)c[o]=S,c[o+1]=k,c[o+2]=N,o+=l}}function S(e,t,f,o,s=1){if(!t)return void m(e,f,o,s);const{data:n,indices:c}=e,l=t,d=f.typedBuffer,u=f.typedBufferStride,a=c.length,p=l[0],g=l[1],y=l[2],b=l[4],B=l[5],h=l[6],F=l[8],v=l[9],w=l[10],z=!r(l),S=1e-6,k=1-S;o*=u;let N=0,$=0,x=0;const A=i(l)?e=>{N=n[e],$=n[e+1],x=n[e+2]}:e=>{const t=n[e],f=n[e+1],o=n[e+2];N=p*t+b*f+F*o,$=g*t+B*f+v*o,x=y*t+h*f+w*o};if(1===s)if(z)for(let r=0;r<a;++r){A(3*c[r]);const e=N*N+$*$+x*x;if(e<k&&e>S){const t=1/Math.sqrt(e);d[o]=N*t,d[o+1]=$*t,d[o+2]=x*t}else d[o]=N,d[o+1]=$,d[o+2]=x;o+=u}else for(let r=0;r<a;++r)A(3*c[r]),d[o]=N,d[o+1]=$,d[o+2]=x,o+=u;else for(let r=0;r<a;++r){if(A(3*c[r]),z){const e=N*N+$*$+x*x;if(e<k&&e>S){const t=1/Math.sqrt(e);N*=t,$*=t,x*=t}}for(let e=0;e<s;++e)d[o]=N,d[o+1]=$,d[o+2]=x,o+=u}}function k(e,t,f,o,i=1){if(!t)return void h(e,f,o,i);const{data:s,indices:n}=e,c=t,l=f.typedBuffer,d=f.typedBufferStride,u=n.length,a=c[0],p=c[1],g=c[2],y=c[4],b=c[5],B=c[6],m=c[8],F=c[9],v=c[10],w=!r(c),z=1e-6,S=1-z;if(o*=d,1===i)for(let r=0;r<u;++r){const e=4*n[r],t=s[e],f=s[e+1],i=s[e+2],c=s[e+3];let u=a*t+y*f+m*i,h=p*t+b*f+F*i,k=g*t+B*f+v*i;if(w){const e=u*u+h*h+k*k;if(e<S&&e>z){const t=1/Math.sqrt(e);u*=t,h*=t,k*=t}}l[o]=u,l[o+1]=h,l[o+2]=k,l[o+3]=c,o+=d}else for(let r=0;r<u;++r){const e=4*n[r],t=s[e],f=s[e+1],c=s[e+2],u=s[e+3];let h=a*t+y*f+m*c,k=p*t+b*f+F*c,N=g*t+B*f+v*c;if(w){const e=h*h+k*k+N*N;if(e<S&&e>z){const t=1/Math.sqrt(e);h*=t,k*=t,N*=t}}for(let r=0;r<i;++r)l[o]=h,l[o+1]=k,l[o+2]=N,l[o+3]=u,o+=d}}function N(e,t,f,o,r=1){const{data:i,indices:s}=e,n=f.typedBuffer,c=f.typedBufferStride,l=s.length;if(o*=c,t===i.length&&4===t){n[o]=i[0],n[o+1]=i[1],n[o+2]=i[2],n[o+3]=i[3];const e=new Uint32Array(f.typedBuffer.buffer,f.start),t=c/4,s=e[o/=4];o+=t;const d=l*r;for(let f=1;f<d;++f)e[o]=s,o+=t;return}if(1!==r)if(4!==t)for(let d=0;d<l;++d){const e=3*s[d];for(let t=0;t<r;++t)n[o]=i[e],n[o+1]=i[e+1],n[o+2]=i[e+2],n[o+3]=255,o+=c}else for(let d=0;d<l;++d){const e=4*s[d];for(let t=0;t<r;++t)n[o]=i[e],n[o+1]=i[e+1],n[o+2]=i[e+2],n[o+3]=i[e+3],o+=c}else{if(4===t){for(let e=0;e<l;++e){const t=4*s[e];n[o]=i[t],n[o+1]=i[t+1],n[o+2]=i[t+2],n[o+3]=i[t+3],o+=c}return}for(let e=0;e<l;++e){const t=3*s[e];n[o]=i[t],n[o+1]=i[t+1],n[o+2]=i[t+2],n[o+3]=255,o+=c}}}function $(e,t,f){const{data:o,indices:r}=e,i=t.typedBuffer,s=t.typedBufferStride,n=r.length,c=o[0];f*=s;for(let l=0;l<n;++l)i[f]=c,f+=s}function x(o,r,i,s){e(A,o,r);const n=Math.max(Math.sqrt(t(A)),1e-4);f(A,A,1/n),i[s++]=A[0],i[s++]=A[1],i[s++]=A[2],i[s++]=n}const A=o();function M(e,t,f,o,r=1){const i=t.typedBuffer,s=t.typedBufferStride;if(o*=s,1===r)for(let n=0;n<f;++n)i[o]=e[0],i[o+1]=e[1],i[o+2]=e[2],i[o+3]=e[3],o+=s;else for(let n=0;n<f;++n)for(let t=0;t<r;++t)i[o]=e[0],i[o+1]=e[1],i[o+2]=e[2],i[o+3]=e[3],o+=s}function j(e,t,f,o,r,i){const{buffer:n,offset:c}=i;for(const l of f.fields.keys()){const f=e.get(l),i=f?.indices;if(f&&i)q(l,f,o,r,n,c);else if("olidColor"===l&&null!=t){const f=e.get("position")?.indices;if(f){const e=f.length;M(t,n.getField(l,s),e,c)}}}}function q(e,t,f,o,r,i){switch(e){case"position":{y(3===t.size);const o=r.getField(e,c);y(!!o,`No buffer view for ${e}`),z(t,f,o,i);break}case"normal":{y(3===t.size);const f=r.getField(e,c);y(!!f,`No buffer view for ${e}`),S(t,o,f,i);break}case"normalCompressed":case"profileRight":case"profileUp":{y(2===t.size);const f=r.getField(e,a);y(!!f,`No buffer view for ${e}`),B(t,f,i);break}case"uv0":{y(2===t.size);const f=r.getField(e,p)??r.getField(e,g);y(!!f,`No buffer view for ${e}`),B(t,f,i);break}case"uvi":{y(2===t.size);const f=r.getField(e,a);y(!!f,`No buffer view for ${e}`),B(t,f,i);break}case"color":case"symbolColor":{const f=r.getField(e,s);y(!!f,`No buffer view for ${e}`),y(3===t.size||4===t.size),N(t,t.size,f,i);break}case"colorFeatureAttribute":case"opacityFeatureAttribute":case"sizeFeatureAttribute":{const f=r.getField(e,u)??r.getField(e,u);y(!!f,`No buffer view for ${e}`),y(1===t.size),$(t,f,i);break}case"tangent":{y(4===t.size);const o=r.getField(e,d);y(!!o,`No buffer view for ${e}`),k(t,f,o,i);break}case"profileVertexAndNormal":{y(4===t.size);const f=r.getField(e,l)??r.getField(e,d);y(!!f,`No buffer view for ${e}`),h(t,f,i);break}case"profileAuxData":{y(3===t.size);const f=r.getField(e,n)??r.getField(e,c);y(!!f,`No buffer view for ${e}`),m(t,f,i);break}}}export{q as writeAttribute,j as writeAttributes,b as writeBufferFloat,v as writeBufferMat3f,w as writeBufferMat4f,B as writeBufferVec2,m as writeBufferVec3,h as writeBufferVec4,F as writeBufferZeros,N as writeColor,x as writeDeltaF16Vector,S as writeNormal,M as writeOlidColor,z as writePosition,k as writeTangent,$ as writeVVFeatureAttribute};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{TextureBuffer as e}from"../../lib/TextureBackedBuffer/TextureBuffer.js";import{BufferCache as r}from"./BufferCache.js";class f{constructor(f,t){this._cache=new r(f.newCache,r=>new e(f,t,r),"TextureBufferCache")}dispose(){this._cache.dispose()}newTextureBuffer(e){return this._cache.newBuffer(e)}deleteTextureBuffer(e){return this._cache.deleteBuffer(e)}}export{f as TextureBufferCache};
2
+ import{TextureBuffer as e}from"../../lib/TextureBackedBuffer/TextureBuffer.js";import{BufferCache as t}from"./BufferCache.js";class r{constructor(r,f){this._layout=f,this._cache=new t(r.newCache,t=>new e(r,f,Math.floor(t/this._layout.byteStride)),"TextureBufferCache")}dispose(){this._cache.dispose()}newTextureBuffer(e){return this._cache.newBuffer(e*this._layout.byteStride)}deleteTextureBuffer(e){return this._cache.deleteBuffer(e)}}export{r as TextureBufferCache};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{nextHighestPowerOfTwo as e,roundUpToNearest as t}from"../../../../../core/mathUtils.js";import{copy as r,invert as s,transpose as o}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as a}from"../../../support/buffer/glUtil.js";import{assert as i}from"../../lib/Util.js";import{VertexArrayObject as f}from"../../lib/VertexArrayObject.js";import{getMaxItemCount as u,getMaxByteSize as c}from"../../lib/TextureBackedBuffer/TextureBackedBufferUtils.js";import{bufferRangePool as l}from"./BufferRange.js";import{DrawCommand as h}from"./DrawCommand.js";import{getIndexLayoutForMaxIndex as g,getIndexLayoutForDataType as m}from"./IndexLayout.js";import{BaseInstanceData as y}from"./PerBaseInstanceData.js";import{VertexBuffer as d}from"../../../../webgl/VertexBuffer.js";class x{constructor(e,t){this._rctx=t,this._vaoCacheValue=null,this._instanceVboCacheValue=null,this._textureBufferCacheValue=null,this._vboCacheValue=null;const r=e.createBufferWriter();this._bufferWriter=r;const s=["geometry"],o="textureBufferLayout"in r&&null!=r.textureBufferLayout;this.useTextureBuffer=o,o&&s.push("texture"),this.useIndexing=e.useIndexing,this.useIndexing&&s.push("index"),this.targetBuffers=s}get _vaoCache(){return this._vaoCacheValue??=this._rctx.getVaoCache(a(this._bufferWriter.layout)),this._vaoCacheValue}get _instanceVboCache(){return this._instanceVboCacheValue??=this._rctx.getVboCache(a(this._bufferWriter.layout,1)),this._instanceVboCacheValue}get _textureBufferCache(){return this.useTextureBuffer?(this._textureBufferCacheValue??=this._rctx.getTextureBufferCache(this._bufferWriter.textureBufferLayout),this._textureBufferCacheValue):null}get _vboCache(){return this._vboCacheValue??=this._rctx.getVboCache(a(this._bufferWriter.layout)),this._vboCacheValue}maxElements(e){if("texture"===e){const e=this._targetLayout("texture");return null==e?0:u(this._rctx,e)}const t=Math.floor(C/this._targetStrideBytes("geometry"));if("index"===e){const e=g(t-1).dataType;return Math.floor(C/this._targetStrideBytes("index",e))}return t}_targetStrideBytes(e,t){return this._targetLayout(e,t)?.stride??0}_targetLayout(e,t){return"geometry"===e?this._bufferWriter.layout:"baseInstance"===e?this._bufferWriter.baseInstanceLayout:"index"===e?m(t):this._bufferWriter.textureBufferLayout}evaluateBufferAllocation(e,t,r,s){const o=this._targetStrideBytes("geometry"),n=t.reduce((e,{geometry:t})=>e+this.vertexElementCount(t),0),a=r.reduce((e,{geometry:t})=>e+this.vertexElementCount(t),0),i=Math.min((e+n-a)*o,C),f=s.vao?.buffer("geometry"),u=f?.sizeBytes??0;return i>b&&i<u/2?0:i>u?1:2}deleteBuffer(e){e.isInstanced?(e.instancedCommandVAOs?.dispose(),this._instanceVboCache.deleteVbo(e.vao?.mutableBuffer("geometry")),e.vao?.disposeVAOOnly()):this.useIndexing?(this._vboCache.deleteVbo(e.vao?.mutableBuffer("geometry")),this._rctx.indexBufferCache.deleteIndexBuffer(e.vao?.indexBuffer),e.vao?.disposeVAOOnly()):this._vaoCache.deleteVao(e.vao),this._textureBufferCache?.deleteTextureBuffer(e.textureBuffer),e.vao=null,e.textureBuffer=null,e.endElements.geometry=0,e.endElements.texture=0,e.endElements.index=0}createBaseInstanceData(e){const{_bufferWriter:t}=this;if(null==e||null==t.baseInstanceLayout||null==t.writeBaseInstance||null==t.elementCountBaseInstance)return null;const r=this._targetLayout("baseInstance"),s=t.elementCountBaseInstance(e.attributes),o=s*r.stride,n=new d(this._rctx,a(r));n.setSize(Math.ceil(o));const i=V(o),f=r.createView(i.buffer);t.writeBaseInstance(e.attributes,f),n.setSubData(i,0,0,o);const u=new h;return u.first=0,u.count=s,new y(e,n,u)}reallocateBuffer(e,t,r){if(this.deleteBuffer(t),null!=e){i(!this.useIndexing,"Instanced indexed rendering is not supported");const s=e.baseInstanceBuffer,o=r.geometry*this._targetStrideBytes("geometry"),n=this._instanceVboCache.newVbo(I(o));t.vao=new f(this._rctx,new Map([["baseInstance",s],["geometry",n]]))}else if(this.useIndexing){const e=r.geometry*this._targetStrideBytes("geometry"),s=this._vboCache.newVbo(I(e)),o=Math.floor(s.sizeBytes/this._bufferWriter.layout.stride)-1,n=g(o),a=r.index*n.stride,i=Math.ceil(I(a)/n.stride),u=this._rctx.indexBufferCache.newIndexBuffer(i,n.dataType);t.vao=new f(this._rctx,s,u)}else{const e=r.geometry*this._targetStrideBytes("geometry");t.vao=this._vaoCache.newVao(I(e))}const s=this._targetLayout("texture"),o=this._textureBufferCache;if(null!=s&&null!=o){const e=I(r.texture*s.stride),n=Math.ceil(e/s.stride);t.textureBuffer=o.newTextureBuffer(n)}t.endElements.geometry=Math.floor((t.vao?.getByteLength("geometry")??0)/this._targetStrideBytes("geometry")),t.endElements.texture=t.textureBuffer?.itemCount??0,t.endElements.index=t.vao?.indexBuffer?.size??0}elementCount(e,t){const{attributes:r}=e;return"geometry"===t?this._bufferWriter.elementCount(r):"baseInstance"===t?this._bufferWriter.elementCountBaseInstance?.(r)??0:"index"===t?e.drawIndices?.length??0:this._bufferWriter.elementCountTextureBuffer?.(r)??0}vertexElementCount(e){return this._bufferWriter.elementCount(e.attributes)}canGrow(e,t){const r=this.targetBuffers.map(r=>this._evaluateTargetBufferGrowth(r,e,t));return r.every(({canGrow:e})=>e)&&r.some(({needsToGrow:e})=>e)}_evaluateTargetBufferGrowth(e,t,r){const s=this._targetLayout(e,t.indexType),o=t.getTargetBuffer(e);if(null==s||null==o)return{needsToGrow:null!=s,canGrow:!0};return{needsToGrow:r[e]*s.stride>o.sizeBytes,canGrow:"geometry"===e||"index"===e?o.sizeBytes<I(C-b):o.sizeBytes<c(this._rctx,s)}}clearHoles(e,t){const{indexType:r}=t;for(const s of this.targetBuffers){const o=this._targetStrideBytes(s,r),n=e[s],a=n.reduce((e,t)=>Math.max(e,t.numElements),0)*o,i=V(a);i.fill(0,0,a);for(const e of n)this._setTargetSubData(s,t,o,e,i)}}clearHolesMetal(e,t,r){const{indexType:s}=r,{targetBuffers:o}=this,n={};let a=0;for(const u of o){const e=t[u].numElements*this._targetStrideBytes(u,s);n[u]=a,a+=p(e)}const i=V(a);i.fill(0,0,a);const f={};for(const u of o)f[u]=this._targetLayout(u,s)?.createView(i.buffer,n[u]);for(const u of e){const e=u.targetRanges.geometry;if(!(e.from>=t.geometry.from&&e.to<=t.geometry.to))continue;const r={};for(const s of o)r[s]=u.targetRanges[s].from-t[s].from;this._writeGeometry(u.geometry,f,r,u.targetRanges)}for(const u of o)this._setTargetSubData(u,r,this._targetStrideBytes(u,s),t[u],i,n[u])}writeRandomInstances(e,t,r){const{indexType:s}=r,{targetBuffers:o}=this,n={},a={},i={},f={};let u=0;for(const g of o)n[g]=e[g]*this._targetStrideBytes(g,s),a[g]=u,i[g]=0,f[g]=l.acquire(0,0),u+=p(n[g]);const c=V(u),h={};for(const l of o)h[l]=this._targetLayout(l,s)?.createView(c.buffer,a[l]);for(const l of t){for(const e of o){const t=l.targetRanges[e],o=f[e];o.to===t.from||(o.numElements>0&&this._setTargetSubData(e,r,this._targetStrideBytes(e,s),f[e],c,a[e]),o.from=t.from,i[e]=0)}this._writeGeometry(l.geometry,h,i,l.targetRanges);for(const e of o){const t=l.targetRanges[e];i[e]+=t.numElements,f[e].to=t.to}}for(const g of o){const e=f[g];e.numElements>0&&this._setTargetSubData(g,r,this._targetStrideBytes(g,s),e,c,a[g]),l.release(f[g])}}writeInstanceRangeMetal(e,t,r){const{indexType:s}=r,{targetBuffers:o}=this,n={},a={};let i=0;for(const c of o)n[c]=e[c].numElements*this._targetStrideBytes(c,s),a[c]=i,i+=p(n[c]);const f=V(i),u={};for(const c of o)u[c]=this._targetLayout(c,s)?.createView(f.buffer,a[c]);f.fill(0,0,i);for(const c of t){const t=c.targetRanges.geometry;if(!(t.from>=e.geometry.from&&t.to<=e.geometry.to))continue;const r={},s={};for(const n of o){const t=c.targetRanges[n];r[n]=t.from-e[n].from,s[n]=t}this._writeGeometry(c.geometry,u,r,s)}for(const c of o)e[c].numElements>0&&this._setTargetSubData(c,r,this._targetStrideBytes(c,s),e[c],f,a[c])}rebuildInstances(e,t,r){const{indexType:s}=r,{targetBuffers:o}=this,n={},a={},i={};let f=0;for(const l of o)n[l]=e[l]*this._targetStrideBytes(l,s),a[l]=f,f+=p(n[l]),i[l]=0;const u=V(f),c={};for(const l of o)c[l]=this._targetLayout(l,s)?.createView(u.buffer,a[l]);for(const l of t){const e={},t={};for(const r of o){e[r]=i[r],i[r]+=this.elementCount(l.geometry.geometry,r);const s=l.targetRanges[r];s.from=e[r],s.to=i[r],t[r]=s}this._writeGeometry(l.geometry,c,e,t)}for(const h of o){const e=l.acquire(0,i[h]);this._setTargetSubData(h,r,this._targetStrideBytes(h,s),e,u,a[h]),l.release(e)}return i}updateInstance(e,t){const{indexType:r}=t,{targetBuffers:s}=this,o={},n={};let a=0;for(const c of s){const t=this._targetStrideBytes(c,r);o[c]=this.elementCount(e.geometry.geometry,c)*t,n[c]=a,a+=p(o[c])}const i=V(a),f={},u={};for(const c of s)u[c]=0,f[c]=this._targetLayout(c,r)?.createView(i.buffer,n[c]);this._writeGeometry(e.geometry,f,u,e.targetRanges);for(const c of s)this._setTargetSubData(c,t,this._targetStrideBytes(c,r),e.targetRanges[c],i,n[c])}updateInstancesMetal(e){const{targetBuffers:t}=this;for(const[r,s]of e){const e={};for(const r of t)e[r]=l.acquire(1/0,-1/0);for(const r of s)for(const s of t){const t=e[s],o=r.targetRanges[s];t.from=Math.min(t.from,o.from),t.to=Math.max(t.to,o.to)}this.writeInstanceRangeMetal(e,r.instances.values(),r);for(const r of t)l.release(e[r])}}_writeGeometry(e,t,n,a){const{_bufferWriter:f}=this;if(null!=f&&(r(_,e.transformation),_[12]-=e.localOrigin.vec3[0],_[13]-=e.localOrigin.vec3[1],_[14]-=e.localOrigin.vec3[2],s(B,_),o(B,B),f.write(_,B,e.geometry.attributes,e.geometry.olidColor,t.geometry,n.geometry,a.texture),null!=t.texture&&f.writeTextureBuffer&&f.writeTextureBuffer(_,B,e.geometry.attributes,t.texture,n.texture),this.useIndexing)){const r=e.geometry.drawIndices;i(null!=t.index,"Should have an indexed view when using indexing"),i(null!=r,"Material requires vertex indices"),this._writeIndexBuffer(a.geometry,t.index,n,r)}}_writeIndexBuffer(e,t,r,s){const o=e.from,n=t,a=r.index;for(let i=0;i<s.length;++i)n[a+i]=s[i]+o}_setTargetSubData(e,t,r,s,o,n=0){if("geometry"===e){const a=t.getTargetBuffer(e);a?.setSubData(o,s.from*r,n,n+s.numElements*r)}else if("texture"===e){const r=t.getTargetBuffer(e);r?.setSubData(o.buffer,s.from,n,s.numElements)}else if("index"===e){const a=t.getTargetBuffer(e);a?.setSubData(o,s.from*r,n,n+s.numElements*r)}}static prune(){v=new Uint8Array(b)}}const _=n(),B=n(),b=262144,w=1024,C=16777216;let v=new Uint8Array(b);function V(e){return v.byteLength<e&&(v=new Uint8Array(e)),v}function p(e){return t(e,4)}function I(t){return t<=w?w:t<b?e(t):Math.max(Math.min(Math.ceil(1.5*t/b)*b,C),t)}export{x as VaoWriter};
2
+ import{nextHighestPowerOfTwo as e,roundUpToNearest as t}from"../../../../../core/mathUtils.js";import{copy as r,invert as s,transpose as o}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as a}from"../../../support/buffer/glUtil.js";import{assert as i}from"../../lib/Util.js";import{VertexArrayObject as f}from"../../lib/VertexArrayObject.js";import{getMaxItemCount as u,getMaxByteSize as c}from"../../lib/TextureBackedBuffer/TextureBackedBufferUtils.js";import{bufferRangePool as l}from"./BufferRange.js";import{DrawCommand as h}from"./DrawCommand.js";import{getIndexLayoutForMaxIndex as g,getIndexLayoutForDataType as m}from"./IndexLayout.js";import{BaseInstanceData as d}from"./PerBaseInstanceData.js";import{VertexBuffer as y}from"../../../../webgl/VertexBuffer.js";class x{constructor(e,t){this._rctx=t,this._vaoCacheValue=null,this._instanceVboCacheValue=null,this._textureBufferCacheValue=null,this._vboCacheValue=null;const r=e.createBufferWriter();this._bufferWriter=r;const s=["geometry"],o="textureBufferLayout"in r&&null!=r.textureBufferLayout;this.useTextureBuffer=o,o&&s.push("texture"),this.useIndexing=e.useIndexing,this.useIndexing&&s.push("index"),this.targetBuffers=s}get _vaoCache(){return this._vaoCacheValue??=this._rctx.getVaoCache(a(this._bufferWriter.layout)),this._vaoCacheValue}get _instanceVboCache(){return this._instanceVboCacheValue??=this._rctx.getVboCache(a(this._bufferWriter.layout,1)),this._instanceVboCacheValue}get _textureBufferCache(){return this.useTextureBuffer?(this._textureBufferCacheValue??=this._rctx.getTextureBufferCache(this._bufferWriter.textureBufferLayout),this._textureBufferCacheValue):null}get _vboCache(){return this._vboCacheValue??=this._rctx.getVboCache(a(this._bufferWriter.layout)),this._vboCacheValue}maxElements(e){if("texture"===e){const e=this._targetLayout("texture");return null==e?0:u(this._rctx,e)}const t=Math.floor(C/this._targetStrideBytes("geometry"));if("index"===e){const e=g(t-1).dataType;return Math.floor(C/this._targetStrideBytes("index",e))}return t}_targetStrideBytes(e,t){return this._targetLayout(e,t)?.stride??0}_targetLayout(e,t){return"geometry"===e?this._bufferWriter.layout:"baseInstance"===e?this._bufferWriter.baseInstanceLayout:"index"===e?m(t):this._bufferWriter.textureBufferLayout}evaluateBufferAllocation(e,t,r,s){const o=this._targetStrideBytes("geometry"),n=t.reduce((e,{geometry:t})=>e+this.vertexElementCount(t),0),a=r.reduce((e,{geometry:t})=>e+this.vertexElementCount(t),0),i=Math.min((e+n-a)*o,C),f=s.vao?.buffer("geometry"),u=f?.sizeBytes??0;return i>b&&i<u/2?0:i>u?1:2}deleteBuffer(e){e.isInstanced?(e.instancedCommandVAOs?.dispose(),this._instanceVboCache.deleteVbo(e.vao?.mutableBuffer("geometry")),e.vao?.disposeVAOOnly()):this.useIndexing?(this._vboCache.deleteVbo(e.vao?.mutableBuffer("geometry")),this._rctx.indexBufferCache.deleteIndexBuffer(e.vao?.indexBuffer),e.vao?.disposeVAOOnly()):this._vaoCache.deleteVao(e.vao),this._textureBufferCache?.deleteTextureBuffer(e.textureBuffer),e.vao=null,e.textureBuffer=null,e.endElements.geometry=0,e.endElements.texture=0,e.endElements.index=0}createBaseInstanceData(e){const{_bufferWriter:t}=this;if(null==e||null==t.baseInstanceLayout||null==t.writeBaseInstance||null==t.elementCountBaseInstance)return null;const r=this._targetLayout("baseInstance"),s=t.elementCountBaseInstance(e.attributes),o=s*r.stride,n=new y(this._rctx,a(r));n.setSize(Math.ceil(o));const i=V(o),f=r.createView(i.buffer);t.writeBaseInstance(e.attributes,f),n.setSubData(i,0,0,o);const u=new h;return u.first=0,u.count=s,new d(e,n,u)}reallocateBuffer(e,t,r){if(this.deleteBuffer(t),null!=e){i(!this.useIndexing,"Instanced indexed rendering is not supported");const s=e.baseInstanceBuffer,o=r.geometry*this._targetStrideBytes("geometry"),n=this._instanceVboCache.newVbo(I(o));t.vao=new f(this._rctx,new Map([["baseInstance",s],["geometry",n]]))}else if(this.useIndexing){const e=r.geometry*this._targetStrideBytes("geometry"),s=this._vboCache.newVbo(I(e)),o=Math.floor(s.sizeBytes/this._bufferWriter.layout.stride)-1,n=g(o),a=r.index*n.stride,i=Math.ceil(I(a)/n.stride),u=this._rctx.indexBufferCache.newIndexBuffer(i,n.dataType);t.vao=new f(this._rctx,s,u)}else{const e=r.geometry*this._targetStrideBytes("geometry");t.vao=this._vaoCache.newVao(I(e))}const s=this._targetLayout("texture"),o=this._textureBufferCache;if(null!=s&&null!=o){const e=I(r.texture*s.stride),n=Math.ceil(e/s.stride);t.textureBuffer=o.newTextureBuffer(n)}t.endElements.geometry=Math.floor((t.vao?.getByteLength("geometry")??0)/this._targetStrideBytes("geometry")),t.endElements.texture=t.textureBuffer?.itemCount??0,t.endElements.index=t.vao?.indexBuffer?.size??0}elementCount(e,t){const{attributes:r}=e;switch(t){case"geometry":return this._bufferWriter.elementCount(r);case"baseInstance":return this._bufferWriter.elementCountBaseInstance?.(r)??0;case"index":return e.drawIndices?.length??0;case"texture":return this._bufferWriter.elementCountTextureBuffer?.(r)??0;default:throw new Error(`Unhandled target: ${t}`)}}vertexElementCount(e){return this._bufferWriter.elementCount(e.attributes)}canGrow(e,t){const r=this.targetBuffers.map(r=>this._evaluateTargetBufferGrowth(r,e,t));return r.every(({canGrow:e})=>e)&&r.some(({needsToGrow:e})=>e)}_evaluateTargetBufferGrowth(e,t,r){const s=this._targetLayout(e,t.indexType),o=t.getTargetBuffer(e);if(null==s||null==o)return{needsToGrow:null!=s,canGrow:!0};return{needsToGrow:r[e]*s.stride>o.sizeBytes,canGrow:"geometry"===e||"index"===e?o.sizeBytes<I(C-b):o.sizeBytes<c(this._rctx,s)}}clearHoles(e,t){const{indexType:r}=t;for(const s of this.targetBuffers){const o=this._targetStrideBytes(s,r),n=e[s],a=n.reduce((e,t)=>Math.max(e,t.numElements),0)*o,i=V(a);i.fill(0,0,a);for(const e of n)this._setTargetSubData(s,t,o,e,i)}}clearHolesMetal(e,t,r){const{indexType:s}=r,{targetBuffers:o}=this,n={};let a=0;for(const u of o){const e=t[u].numElements*this._targetStrideBytes(u,s);n[u]=a,a+=p(e)}const i=V(a);i.fill(0,0,a);const f={};for(const u of o)f[u]=this._targetLayout(u,s)?.createView(i.buffer,n[u]);for(const u of e){const e=u.targetRanges.geometry;if(!(e.from>=t.geometry.from&&e.to<=t.geometry.to))continue;const r={};for(const s of o)r[s]=u.targetRanges[s].from-t[s].from;this._writeGeometry(u.geometry,f,r,u.targetRanges)}for(const u of o)this._setTargetSubData(u,r,this._targetStrideBytes(u,s),t[u],i,n[u])}writeRandomInstances(e,t,r){const{indexType:s}=r,{targetBuffers:o}=this,n={},a={},i={},f={};let u=0;for(const g of o)n[g]=e[g]*this._targetStrideBytes(g,s),a[g]=u,i[g]=0,f[g]=l.acquire(0,0),u+=p(n[g]);const c=V(u),h={};for(const l of o)h[l]=this._targetLayout(l,s)?.createView(c.buffer,a[l]);for(const l of t){for(const e of o){const t=l.targetRanges[e],o=f[e];o.to===t.from||(o.numElements>0&&this._setTargetSubData(e,r,this._targetStrideBytes(e,s),f[e],c,a[e]),o.from=t.from,i[e]=0)}this._writeGeometry(l.geometry,h,i,l.targetRanges);for(const e of o){const t=l.targetRanges[e];i[e]+=t.numElements,f[e].to=t.to}}for(const g of o){const e=f[g];e.numElements>0&&this._setTargetSubData(g,r,this._targetStrideBytes(g,s),e,c,a[g]),l.release(f[g])}}writeInstanceRangeMetal(e,t,r){const{indexType:s}=r,{targetBuffers:o}=this,n={},a={};let i=0;for(const c of o)n[c]=e[c].numElements*this._targetStrideBytes(c,s),a[c]=i,i+=p(n[c]);const f=V(i),u={};for(const c of o)u[c]=this._targetLayout(c,s)?.createView(f.buffer,a[c]);f.fill(0,0,i);for(const c of t){const t=c.targetRanges.geometry;if(!(t.from>=e.geometry.from&&t.to<=e.geometry.to))continue;const r={},s={};for(const n of o){const t=c.targetRanges[n];r[n]=t.from-e[n].from,s[n]=t}this._writeGeometry(c.geometry,u,r,s)}for(const c of o)e[c].numElements>0&&this._setTargetSubData(c,r,this._targetStrideBytes(c,s),e[c],f,a[c])}rebuildInstances(e,t,r){const{indexType:s}=r,{targetBuffers:o}=this,n={},a={},i={};let f=0;for(const l of o)n[l]=e[l]*this._targetStrideBytes(l,s),a[l]=f,f+=p(n[l]),i[l]=0;const u=V(f),c={};for(const l of o)c[l]=this._targetLayout(l,s)?.createView(u.buffer,a[l]);for(const l of t){const e={},t={};for(const r of o){e[r]=i[r],i[r]+=this.elementCount(l.geometry.geometry,r);const s=l.targetRanges[r];s.from=e[r],s.to=i[r],t[r]=s}this._writeGeometry(l.geometry,c,e,t)}for(const h of o){const e=l.acquire(0,i[h]);this._setTargetSubData(h,r,this._targetStrideBytes(h,s),e,u,a[h]),l.release(e)}return i}updateInstance(e,t){const{indexType:r}=t,{targetBuffers:s}=this,o={},n={};let a=0;for(const c of s){const t=this._targetStrideBytes(c,r);o[c]=this.elementCount(e.geometry.geometry,c)*t,n[c]=a,a+=p(o[c])}const i=V(a),f={},u={};for(const c of s)u[c]=0,f[c]=this._targetLayout(c,r)?.createView(i.buffer,n[c]);this._writeGeometry(e.geometry,f,u,e.targetRanges);for(const c of s)this._setTargetSubData(c,t,this._targetStrideBytes(c,r),e.targetRanges[c],i,n[c])}updateInstancesMetal(e){const{targetBuffers:t}=this;for(const[r,s]of e){const e={};for(const r of t)e[r]=l.acquire(1/0,-1/0);for(const r of s)for(const s of t){const t=e[s],o=r.targetRanges[s];t.from=Math.min(t.from,o.from),t.to=Math.max(t.to,o.to)}this.writeInstanceRangeMetal(e,r.instances.values(),r);for(const r of t)l.release(e[r])}}_writeGeometry(e,t,n,a){const{_bufferWriter:f}=this;if(null==f)return;r(_,e.transformation),_[12]-=e.localOrigin.vec3[0],_[13]-=e.localOrigin.vec3[1],_[14]-=e.localOrigin.vec3[2],s(B,_),o(B,B);const u={buffer:t.geometry,offset:n.geometry},c=null!=t.texture?{buffer:t.texture,offset:n.texture,textureBufferRange:a.texture}:null;if(f.write(_,B,e.geometry.attributes,e.geometry.olidColor,u,c),this.useIndexing){const r=e.geometry.drawIndices;i(null!=t.index,"Should have an indexed view when using indexing"),i(null!=r,"Material requires vertex indices"),this._writeIndexBuffer(a.geometry,t.index,n,r)}}_writeIndexBuffer(e,t,r,s){const o=e.from,n=t,a=r.index;for(let i=0;i<s.length;++i)n[a+i]=s[i]+o}_setTargetSubData(e,t,r,s,o,n=0){if("geometry"===e){const a=t.getTargetBuffer(e);a?.setSubData(o,s.from*r,n,n+s.numElements*r)}else if("texture"===e){const r=t.getTargetBuffer(e);r?.setSubData(o.buffer,s.from,n,s.numElements)}else if("index"===e){const a=t.getTargetBuffer(e);a?.setSubData(o,s.from*r,n,n+s.numElements*r)}}static prune(){v=new Uint8Array(b)}}const _=n(),B=n(),b=262144,w=1024,C=16777216;let v=new Uint8Array(b);function V(e){return v.byteLength<e&&(v=new Uint8Array(e)),v}function p(e){return t(e,4)}function I(t){return t<=w?w:t<b?e(t):Math.max(Math.min(Math.ceil(1.5*t/b)*b,C),t)}export{x as VaoWriter};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{newLayout as e}from"../../support/buffer/InterleavedLayout.js";import{olidEnabled as t}from"../effects/geometry/olidUtils.js";function o(o){const r=e().vec3f("position").vec4f16("previousDelta").vec4f16("nextDelta").f32("u0").vec2f16("lineParameters");return o.hasVVColor?r.f32("colorFeatureAttribute"):r.vec4u8("color",{glNormalized:!0}),o.hasVVSize?r.f32("sizeFeatureAttribute"):r.f32("size"),o.hasVVOpacity&&r.f32("opacityFeatureAttribute"),t()&&r.vec4u8("olidColor"),o.hasAnimation&&r.vec4f16("timeStamps"),r}export{o as getLayout};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{subclass as t}from"../../../../core/accessorSupport/decorators.js";import{glLayout as i}from"../../support/buffer/glUtil.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ReloadableShader as l}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as s}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as n}from"../effects/geometry/olidUtils.js";import{depthWrite as o,depthTest as c,blending as u}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBase as p,stencilBaseAllZeros as a,stencilWriteMaskOn as d,stencilToolTransparentOccluder as f,depthCompareAlways as m,stencilToolMaskOccluder as h,stencilWriteMaskOff as g,depthCompareLess as b}from"../lib/StencilUtils.js";import{getRibbonLineLayerPolygonOffset as P}from"../materials/PolygonOffset.js";import{R as T}from"../../../../chunks/RibbonLine.glsl.js";import{PrimitiveType as W}from"../../../webgl/enums.js";import{makePipelineState as j,defaultColorWrite as v,unpremultipliedAlphaToPremultipliedAlpha as S}from"../../../webgl/renderState.js";let _=class extends s{constructor(e,t){super(e,t,i(y(t))),this.shader=new l(T,()=>import("./RibbonLine.glsl.js")),this.ignoreUnused=!0,this.primitiveType=t.wireframe?W.LINES:W.TRIANGLE_STRIP}_makePipelineState(e,t){const{output:i,hasOccludees:r}=e;return j({blending:u(i,!1,e.emissionDimmingPass),depthTest:c(i),depthWrite:o(e),colorWrite:v,stencilWrite:r?d:null,stencilTest:r?t?p:a:null,polygonOffset:P(e)})}initializePipeline(e){if(e.occluder){const{hasOccludees:t}=e;this._occluderPipelineTransparent=j({blending:S,polygonOffset:P(e),depthTest:m,depthWrite:null,colorWrite:v,stencilWrite:null,stencilTest:t?f:null}),this._occluderPipelineOpaque=j({blending:S,polygonOffset:P(e),depthTest:t?m:b,depthWrite:null,colorWrite:v,stencilWrite:t?g:null,stencilTest:t?h:null}),this._occluderPipelineMaskWrite=j({blending:null,polygonOffset:P(e),depthTest:b,depthWrite:null,colorWrite:null,stencilWrite:t?d:null,stencilTest:t?p:null})}return this._occludeePipeline=this._makePipelineState(e,!0),this._makePipelineState(e,!1)}getPipeline(e,t){if(t)return this._occludeePipeline;switch(e.occluder){case 11:return this._occluderPipelineTransparent??super.getPipeline(e);case 10:return this._occluderPipelineOpaque??super.getPipeline(e);default:e.occluder;case void 0:case null:return this._occluderPipelineMaskWrite??super.getPipeline(e)}}};function y(e){const t=r().vec3f("position").vec4f16("previousDelta").vec4f16("nextDelta").f32("u0").vec2f16("lineParameters");return e.hasVVColor?t.f32("colorFeatureAttribute"):t.vec4u8("color",{glNormalized:!0}),e.hasVVSize?t.f32("sizeFeatureAttribute"):t.f32("size"),e.hasVVOpacity&&t.f32("opacityFeatureAttribute"),n()&&t.vec4u8("olidColor"),e.hasAnimation&&t.vec4f16("timeStamps"),t}_=e([t("esri.views.3d.webgl-engine.shaders.RibbonLineTechnique")],_);export{_ as RibbonLineTechnique,y as getLayout};
2
+ import{__decorate as e}from"tslib";import{subclass as i}from"../../../../core/accessorSupport/decorators.js";import{glLayout as t}from"../../support/buffer/glUtil.js";import{ReloadableShader as r}from"../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as l}from"../core/shaderTechnique/ShaderTechnique.js";import{depthWrite as s,depthTest as n,blending as o}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBase as c,stencilBaseAllZeros as p,stencilWriteMaskOn as u,stencilToolTransparentOccluder as a,depthCompareAlways as d,stencilToolMaskOccluder as h,stencilWriteMaskOff as m,depthCompareLess as f}from"../lib/StencilUtils.js";import{getRibbonLineLayerPolygonOffset as g}from"../materials/PolygonOffset.js";import{R as b}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as P}from"./RibbonLineLayouts.js";import{PrimitiveType as T}from"../../../webgl/enums.js";import{makePipelineState as W,defaultColorWrite as j,unpremultipliedAlphaToPremultipliedAlpha as _}from"../../../webgl/renderState.js";let O=class extends l{constructor(e,i){super(e,i,t(P(i))),this.shader=new r(b,()=>import("./RibbonLine.glsl.js")),this.ignoreUnused=!0,this.primitiveType=i.wireframe?T.LINES:T.TRIANGLE_STRIP}_makePipelineState(e,i){const{output:t,hasOccludees:r}=e;return W({blending:o(t,!1,e.emissionDimmingPass),depthTest:n(t),depthWrite:s(e),colorWrite:j,stencilWrite:r?u:null,stencilTest:r?i?c:p:null,polygonOffset:g(e)})}initializePipeline(e){if(e.occluder){const{hasOccludees:i}=e;this._occluderPipelineTransparent=W({blending:_,polygonOffset:g(e),depthTest:d,depthWrite:null,colorWrite:j,stencilWrite:null,stencilTest:i?a:null}),this._occluderPipelineOpaque=W({blending:_,polygonOffset:g(e),depthTest:i?d:f,depthWrite:null,colorWrite:j,stencilWrite:i?m:null,stencilTest:i?h:null}),this._occluderPipelineMaskWrite=W({blending:null,polygonOffset:g(e),depthTest:f,depthWrite:null,colorWrite:null,stencilWrite:i?u:null,stencilTest:i?c:null})}return this._occludeePipeline=this._makePipelineState(e,!0),this._makePipelineState(e,!1)}getPipeline(e,i){if(i)return this._occludeePipeline;switch(e.occluder){case 11:return this._occluderPipelineTransparent??super.getPipeline(e);case 10:return this._occluderPipelineOpaque??super.getPipeline(e);default:e.occluder;case void 0:case null:return this._occluderPipelineMaskWrite??super.getPipeline(e)}}};O=e([i("esri.views.3d.webgl-engine.shaders.RibbonLineTechnique")],O);export{O as RibbonLineTechnique};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{createTask as t}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import i from"../../core/Error.js";import{EventedAccessor as r}from"../../core/Evented.js";import a from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{abortMaybe as n,destroyMaybe as p}from"../../core/maybe.js";import{throwIfAborted as l,isAbortError as u}from"../../core/promiseUtils.js";import h from"../../core/ReactiveMap.js";import{on as m,sync as c,watch as d,whenOnce as f}from"../../core/reactiveUtils.js";import{property as y,subclass as v}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as g}from"../../core/support/UpdatingHandles.js";import F from"../../geometry/SpatialReference.js";import{getGraphicLayer as _}from"../../graphic/graphicOriginUtils.js";import{system as x}from"../../time/constants.js";import{createReactiveGraphic as w,isAttributeFormSupportedLayerWithAttachments as I,layerSupportsQueryAttachments as b,queryAttachmentsForElements as A}from"./batchAttributeFormUtils.js";import{ArcadeExecutorProvider as M}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as E}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as k}from"./expressions/ExpressionsModel.js";import C from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as T}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as V,isFieldInput as j}from"./inputs/support/inputUtils.js";import H from"./templates/BatchFormTemplate.js";import{getLayerContingentValuesMetaData as L}from"./templates/support/contingentValuesUtils.js";import{createBatchFormTemplate as B}from"./templates/support/createBatchFormTemplate.js";import{isExcludedFromSharedForm as G,isGroupElementTemplate as R,isAttachmentElementTemplate as U}from"./templates/support/templateUtils.js";function Z(e,t){return e?.find(e=>e.layer===t)}let S=class extends r{constructor(e){super(e),this._attachmentCache=new h,this.activeFeatureIndex=-1,this.disabled=!1,this.editType="NA",this.features=new s,this._hasAsyncArcadeExpressions=!1,this.maximumFeatureCount=2e3,this.maximumFeatureCountWithComplexForms=50,this.map=null,this.readOnly=!1,this.spatialReference=null,this.submitHasBeenAttempted=!1,this.timeZone=null,this.userHasChangedValues=!1,this.layerInfos=null,this._arcadeExecutorProvider=new M,this._activeFormInputsByElementId=new Map,this._emptyForm=new C({inputs:[]}),this._emptyFormTemplate=new H({elements:[]}),this._featureFormMap=new Map,this._prepareTask=null,this._reactiveGraphicLookup=new h,this._updatingHandles=new g,this._layerTemplateMap=new h,this._layerContingentValuesMap=new h,this._workingFeatures=new s,this._expressionsManager=new E({arcadeContext:{editType:"NA",spatialReference:null,map:null,timeZone:x}}),this.sharedForm=this._emptyForm,this.sharedFormTemplate=this._emptyFormTemplate}initialize(){this.addHandles([m(()=>this.features,"after-changes",()=>{this.notifyChange("layers"),this._prepare()},c),d(()=>[this.features,this.map,this.timeZone,this.editType],()=>this._prepare(),c),d(()=>this.activeForm,()=>this._activeFormInputsByElementId.clear(),c),d(()=>[this.activeFeature,this.activeLayer,this.activeForm],()=>{this._syncAttachments()},c)]),this._prepare()}destroy(){this._prepareTask=n(this._prepareTask),this._workingFeatures.destroyAll(),p(this._expressionsManager),this._updatingHandles.destroy(),this._reactiveGraphicLookup=new h,this._emptyForm.destroy(),this._emptyFormTemplate.destroy()}get _effectiveTimeZone(){return this.timeZone??"system"}get activeFeature(){const e=this.activeFeatureIndex;return e<0?null:this.features.at(e)}get activeForm(){if("batch"===this.mode)return this.sharedForm;const e=this._workingFeatures.at(this.activeFeatureIndex);if(!e)return this._emptyForm;const t=this._featureFormMap.get(e);if(t)return t;const s=this._makeBatchFormInputsForFeature(e);return s!==this._emptyForm&&this._featureFormMap.set(e,s),s}get activeLayer(){const{activeFeature:e}=this;if(!e)return null;return _(e)??null}get calculating(){return this._expressionsManager.calculating}get expressionEvaluationFailed(){return this._expressionsManager.expressionEvaluationFailed}get hasNonActiveInvalidFeatures(){if("batch"===this.mode)return!1;const{activeFeature:e}=this;return this.invalidFeatures.some(t=>t!==e)}get hasAsyncArcadeExpressions(){return this._hasAsyncArcadeExpressions}get hasTooManyFeatures(){return this._workingFeatures.length>this.maximumFeatureCount}get hasTooManyComplexFeatures(){return this._workingFeatures.length>this.maximumFeatureCountWithComplexForms&&this.hasAsyncArcadeExpressions}get invalidFeatures(){return this.sharedForm.invalidFeatures}get hasVisibleInputs(){return this.visibleInputs.length>0}get hasLayersWithContingentValues(){for(const e of this.layers){const t=this._layerContingentValuesMap.get(e);if(t&&t.size>0)return!0}return!1}get visibleInputs(){return this.activeForm.inputs.filter(e=>e.visible)}get noVisibleElementsReason(){if(this.hasVisibleInputs)return null;if(0===this.activeForm.inputs.length)return"noElements";const e=new Set;for(const t of this.activeForm.inputs)switch(t.visibilityCode){case"hidden:not-in-all-layers":case"hidden:no-domain-in-common":e.add("noElementsInCommon");break;case"hidden:field-definition":case"hidden:group-visibility-expression:all-features":case"hidden:visibility-expression:all-features":e.add("allElementsHidden");break;case"hidden:group-visibility-expression:some-features":case"hidden:visibility-expression:some-features":return"elementsHiddenInSome"}return e.has("allElementsHidden")?"allElementsHidden":"noElementsInCommon"}get status(){const e=this._prepareTask;return null==e?"not-loaded":e.finished?null!=e.error?"failed":"loaded":"loading"}get submittable(){return this.valid,!0}get updating(){return this._updatingHandles.updating||this.calculating}get valid(){return this.sharedForm.valid}get layers(){const e=new Set;return this.features.forEach(t=>{const s=_(t);s&&e.add(s)}),Array.from(e)}get mode(){return this.activeFeatureIndex>-1?"single":"batch"}submit(){this.submitHasBeenAttempted=!0,this.emit("submit",{name:"submit",results:this._makeSubmitResults(),valid:this.valid})}findFieldInput(e){if(null==e)return;const t=this._activeFormInputsByElementId;if(t.has(e))return t.get(e);const s=this.activeForm.allFieldInputs.find(t=>t.template.elementId===e);return void 0!==s?(t.set(e,s),s):void 0}getFirstVisibleInvalidFieldInput(){if(this.hasVisibleInputs&&!this.activeForm.valid)for(const e of this.visibleInputs){if(V(e)){const t=e.inputs.find(e=>j(e)&&!e.valid);if(t)return{input:t,groupInput:e}}if(j(e)&&!e.valid)return{input:e}}}getFieldInputValue(e){return this.findFieldInput(e)?.value}getValues(e){const t=this._reactiveGraphicLookup.get(e);if(!t)throw new i("feature-not-found","The given feature is not present in the BatchAttributeForm");return{...t.attributes}}notifyGeometriesChanged(e){const t=[];for(const s of e){const e=this._reactiveGraphicLookup.get(s);e&&(t.push(e),e.geometry=s.geometry)}this._expressionsManager.runGeometryDependentExpressions(t)}async setFieldInputValue(e,t){const s=new Set(this.invalidFeatures);await e.setValueFromUser(t),this.userHasChangedValues=!0,this._trackValidityChange(s),this.emit("value-change",{features:e.features.toArray().map(e=>e.source),fieldName:e.fieldName,name:"value-change",value:t})}async setValue(e,t){const s=this.findFieldInput(e);if(null==s)throw new i("no-FieldInput-found",`Cannot set the value of FieldInput with ID: ${e} because none was found in the active form`);await this.setFieldInputValue(s,t)}userChangesHaveMadeFeatureInvalid(e){return!!this._reactiveGraphicLookup.get(e)?.userChangesHaveMadeInvalid}async _trackValidityChange(e){await f(()=>!1===this.calculating);const t=this.invalidFeatures;for(const s of t)!1===e.has(s)&&this._reactiveGraphicLookup.has(s)&&(this._reactiveGraphicLookup.get(s).userChangesHaveMadeInvalid=!0)}validate(){return!1}_makeBatchFormInputsForFeature(e){const t=this._layerTemplateMap.get(e.layer);return t?T(t,new s([e]),this._expressionsManager):this._emptyForm}_makeSubmitResults(){const e=new Map;for(const[t,s]of this._reactiveGraphicLookup)e.set(t,{feature:t,values:{...s.attributes},invalidFields:[]});for(const t of this.sharedForm.allFieldInputs)for(const s of t.invalidFeatures)e.get(s)?.invalidFields.push(t.fieldName);return Array.from(e.values())}_prepare(){this._hasAsyncArcadeExpressions=!1,this._prepareTask=n(this._prepareTask),this._updateWorkingFeatures(),p(this._expressionsManager),this.userHasChangedValues=!1,this._expressionsManager=new E({arcadeContext:{editType:this.editType,spatialReference:this.spatialReference??F.WebMercator,map:this.map,timeZone:this._effectiveTimeZone}});const{layers:e}=this;if(0===e.length)return;const s=t(async t=>{try{l(t);const s=new Map;for(const i of e){const e=await L(i);if(l(t),e){const t=e.fieldGroups.flatMap(e=>e.fields);this._layerContingentValuesMap.set(i,new Set(t))}else this._layerContingentValuesMap.set(i,new Set);const r=Z(this.layerInfos,i),a=await B(i,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this._effectiveTimeZone},r?.formTemplate);l(t),this._layerTemplateMap.set(i,a);const o=a.getExpressionExecutorsForLayer(i);if(this._expressionsManager.layerExpressionsModelMap.set(i,new k({preserveFieldValuesWhenHidden:a.preserveFieldValuesWhenHidden,executorMap:o})),!this._hasAsyncArcadeExpressions)for(const t of o.keys()){const e=o.get(t);if(this._hasAsyncArcadeExpressions=!0===(e.editableExpression?.isAsync||e.requiredExpression?.isAsync||e.valueExpression?.isAsync||e.visibilityExpression?.isAsync),this._hasAsyncArcadeExpressions)break}for(const t of a.elements){if(G(t))continue;const e=t.clone();R(e)&&(e.elements=e.elements.filter(e=>!G(e)));const{elementId:i}=e;s.has(i)?s.get(i).foldIn(e):s.set(i,e)}}if(this.hasTooManyComplexFeatures)throw new i("too-many-features-with-complex-forms","There are too many features to load into the form with the configured complexity");if(this.hasTooManyFeatures)throw new i("too-many-features","There are too many features to load into the form.");const r=new H({elements:Array.from(s.values())});this.sharedFormTemplate=r,this.sharedForm=T(r,this._workingFeatures,this._expressionsManager),await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray())}catch(s){throw u(s)||a.getLogger(this).error("Failed preparing form",s),s}});this._updatingHandles.consumePromise(s.promise),this._prepareTask=s}_updateWorkingFeatures(){this._workingFeatures.destroyAll();const{features:e}=this;if(this._reactiveGraphicLookup=new h,0!==e.length){this._workingFeatures.addMany(e.map(w));for(const e of this._workingFeatures)this._reactiveGraphicLookup.set(e.source,e)}}async _syncAttachments(){const{activeFeature:e,activeLayer:t,activeForm:s}=this;if(!(e&&s&&I(t)&&b(t)))return;const i=e.getObjectId();if(null==i)return;const r=this._attachmentCache.get(t);if(r){if(r.get(i))return}const a=s.template?.elements.filter(U)??[];if(!a.length)return;const n=await A(t,i,a);o(this._attachmentCache,t,()=>new h).set(i,n)}};e([y()],S.prototype,"_effectiveTimeZone",null),e([y()],S.prototype,"_attachmentCache",void 0),e([y({readOnly:!0})],S.prototype,"activeFeature",null),e([y()],S.prototype,"activeFeatureIndex",void 0),e([y({readOnly:!0})],S.prototype,"activeForm",null),e([y({readOnly:!0})],S.prototype,"activeLayer",null),e([y()],S.prototype,"disabled",void 0),e([y()],S.prototype,"calculating",null),e([y()],S.prototype,"editType",void 0),e([y()],S.prototype,"features",void 0),e([y()],S.prototype,"expressionEvaluationFailed",null),e([y()],S.prototype,"hasNonActiveInvalidFeatures",null),e([y()],S.prototype,"hasAsyncArcadeExpressions",null),e([y()],S.prototype,"_hasAsyncArcadeExpressions",void 0),e([y()],S.prototype,"invalidFeatures",null),e([y()],S.prototype,"hasVisibleInputs",null),e([y()],S.prototype,"hasLayersWithContingentValues",null),e([y()],S.prototype,"maximumFeatureCount",void 0),e([y()],S.prototype,"maximumFeatureCountWithComplexForms",void 0),e([y()],S.prototype,"visibleInputs",null),e([y()],S.prototype,"map",void 0),e([y()],S.prototype,"noVisibleElementsReason",null),e([y()],S.prototype,"readOnly",void 0),e([y()],S.prototype,"spatialReference",void 0),e([y()],S.prototype,"submitHasBeenAttempted",void 0),e([y()],S.prototype,"timeZone",void 0),e([y()],S.prototype,"updating",null),e([y()],S.prototype,"valid",null),e([y()],S.prototype,"layers",null),e([y()],S.prototype,"mode",null),e([y()],S.prototype,"sharedForm",void 0),e([y()],S.prototype,"sharedFormTemplate",void 0),e([y()],S.prototype,"userHasChangedValues",void 0),e([y()],S.prototype,"layerInfos",void 0),e([y()],S.prototype,"_arcadeExecutorProvider",void 0),e([y()],S.prototype,"_prepareTask",void 0),e([y()],S.prototype,"_reactiveGraphicLookup",void 0),e([y()],S.prototype,"_layerTemplateMap",void 0),e([y()],S.prototype,"_layerContingentValuesMap",void 0),e([y()],S.prototype,"_workingFeatures",void 0),e([y()],S.prototype,"_expressionsManager",void 0),S=e([v("esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel")],S);const W=S;export{W as default};
2
+ import{__decorate as e}from"tslib";import{createTask as t}from"../../core/asyncUtils.js";import s from"../../core/Collection.js";import r from"../../core/Error.js";import{EventedAccessor as i}from"../../core/Evented.js";import a from"../../core/Logger.js";import{getOrCreateMapValue as o}from"../../core/MapUtils.js";import{abortMaybe as n,destroyMaybe as p}from"../../core/maybe.js";import{throwIfAborted as l,isAbortError as u}from"../../core/promiseUtils.js";import h from"../../core/ReactiveMap.js";import{on as m,sync as c,watch as d,whenOnce as f}from"../../core/reactiveUtils.js";import{property as y,subclass as v}from"../../core/accessorSupport/decorators.js";import{UpdatingHandles as g}from"../../core/support/UpdatingHandles.js";import F from"../../geometry/SpatialReference.js";import{getGraphicLayer as _}from"../../graphic/graphicOriginUtils.js";import{system as x}from"../../time/constants.js";import{createReactiveGraphic as w,isAttributeFormSupportedLayerWithAttachments as I,layerSupportsQueryAttachments as b,queryAttachmentsForElements as A}from"./batchAttributeFormUtils.js";import{ArcadeExecutorProvider as M}from"./expressions/ArcadeExecutorProvider.js";import{ExpressionsManager as k}from"./expressions/ExpressionsManager.js";import{ExpressionsModel as C}from"./expressions/ExpressionsModel.js";import E from"./inputs/BatchFormInputs.js";import{createBatchFormInputsFromBatchFormTemplate as T}from"./inputs/support/createBatchFormInputs.js";import{isGroupInput as V,isFieldInput as j}from"./inputs/support/inputUtils.js";import L from"./templates/BatchFormTemplate.js";import{getLayerContingentValuesMetaData as H}from"./templates/support/contingentValuesUtils.js";import{createBatchFormTemplate as B}from"./templates/support/createBatchFormTemplate.js";import{isExcludedFromSharedForm as G,isGroupElementTemplate as R}from"./templates/support/templateUtils.js";function U(e,t){return e?.find(e=>e.layer===t)}let Z=class extends i{constructor(e){super(e),this._attachmentCache=new h,this.activeFeatureIndex=-1,this.disabled=!1,this.editType="NA",this.features=new s,this._hasAsyncArcadeExpressions=!1,this.maximumFeatureCount=2e3,this.maximumFeatureCountWithComplexForms=50,this.map=null,this.readOnly=!1,this.spatialReference=null,this.submitHasBeenAttempted=!1,this.timeZone=null,this.userHasChangedValues=!1,this.layerInfos=null,this._arcadeExecutorProvider=new M,this._activeFormInputsByElementId=new Map,this._emptyForm=new E({inputs:[]}),this._emptyFormTemplate=new L({elements:[]}),this._featureFormMap=new Map,this._prepareTask=null,this._reactiveGraphicLookup=new h,this._updatingHandles=new g,this._layerTemplateMap=new h,this._layerContingentValuesMap=new h,this._workingFeatures=new s,this._expressionsManager=new k({arcadeContext:{editType:"NA",spatialReference:null,map:null,timeZone:x}}),this.sharedForm=this._emptyForm,this.sharedFormTemplate=this._emptyFormTemplate}initialize(){this.addHandles([m(()=>this.features,"after-changes",()=>{this.notifyChange("layers"),this._prepare()},c),d(()=>[this.features,this.map,this.timeZone,this.editType],()=>this._prepare(),c),d(()=>this.activeForm,()=>this._activeFormInputsByElementId.clear(),c),d(()=>[this.activeFeature,this.activeLayer,this.activeForm],()=>{this._syncAttachments()},c)]),this._prepare()}destroy(){this._prepareTask=n(this._prepareTask),this._workingFeatures.destroyAll(),p(this._expressionsManager),this._updatingHandles.destroy(),this._reactiveGraphicLookup=new h,this._emptyForm.destroy(),this._emptyFormTemplate.destroy()}get _effectiveTimeZone(){return this.timeZone??"system"}get activeFeature(){const e=this.activeFeatureIndex;return e<0?null:this.features.at(e)}get activeForm(){if("batch"===this.mode)return this.sharedForm;const e=this._workingFeatures.at(this.activeFeatureIndex);if(!e)return this._emptyForm;const t=this._featureFormMap.get(e);if(t)return t;const s=this._makeBatchFormInputsForFeature(e);return s!==this._emptyForm&&this._featureFormMap.set(e,s),s}get activeLayer(){const{activeFeature:e}=this;if(!e)return null;return _(e)??null}get calculating(){return this._expressionsManager.calculating}get expressionEvaluationFailed(){return this._expressionsManager.expressionEvaluationFailed}get hasNonActiveInvalidFeatures(){if("batch"===this.mode)return!1;const{activeFeature:e}=this;return this.invalidFeatures.some(t=>t!==e)}get hasAsyncArcadeExpressions(){return this._hasAsyncArcadeExpressions}get hasTooManyFeatures(){return this._workingFeatures.length>this.maximumFeatureCount}get hasTooManyComplexFeatures(){return this._workingFeatures.length>this.maximumFeatureCountWithComplexForms&&this.hasAsyncArcadeExpressions}get invalidFeatures(){return this.sharedForm.invalidFeatures}get hasVisibleInputs(){return this.visibleInputs.length>0}get hasLayersWithContingentValues(){for(const e of this.layers){const t=this._layerContingentValuesMap.get(e);if(t&&t.size>0)return!0}return!1}get visibleInputs(){return this.activeForm.inputs.filter(e=>e.visible)}get noVisibleElementsReason(){if(this.hasVisibleInputs)return null;if(0===this.activeForm.inputs.length)return"noElements";const e=new Set;for(const t of this.activeForm.inputs)switch(t.visibilityCode){case"hidden:not-in-all-layers":case"hidden:no-domain-in-common":e.add("noElementsInCommon");break;case"hidden:field-definition":case"hidden:group-visibility-expression:all-features":case"hidden:visibility-expression:all-features":e.add("allElementsHidden");break;case"hidden:group-visibility-expression:some-features":case"hidden:visibility-expression:some-features":return"elementsHiddenInSome"}return e.has("allElementsHidden")?"allElementsHidden":"noElementsInCommon"}get status(){const e=this._prepareTask;return null==e?"not-loaded":e.finished?null!=e.error?"failed":"loaded":"loading"}get submittable(){return this.valid,!0}get updating(){return this._updatingHandles.updating||this.calculating}get valid(){return this.sharedForm.valid}get layers(){const e=new Set;return this.features.forEach(t=>{const s=_(t);s&&e.add(s)}),Array.from(e)}get mode(){return this.activeFeatureIndex>-1?"single":"batch"}submit(){this.submitHasBeenAttempted=!0,this.emit("submit",{name:"submit",results:this._makeSubmitResults(),valid:this.valid})}findFieldInput(e){if(null==e)return;const t=this._activeFormInputsByElementId;if(t.has(e))return t.get(e);const s=this.activeForm.allFieldInputs.find(t=>t.template.elementId===e);return void 0!==s?(t.set(e,s),s):void 0}getFirstVisibleInvalidFieldInput(){if(this.hasVisibleInputs&&!this.activeForm.valid)for(const e of this.visibleInputs){if(V(e)){const t=e.inputs.find(e=>j(e)&&!e.valid);if(t)return{input:t,groupInput:e}}if(j(e)&&!e.valid)return{input:e}}}getFieldInputValue(e){return this.findFieldInput(e)?.value}getValues(e){const t=this._reactiveGraphicLookup.get(e);if(!t)throw new r("feature-not-found","The given feature is not present in the BatchAttributeForm");return{...t.attributes}}notifyGeometriesChanged(e){const t=[];for(const s of e){const e=this._reactiveGraphicLookup.get(s);e&&(t.push(e),e.geometry=s.geometry)}this._expressionsManager.runGeometryDependentExpressions(t)}async setFieldInputValue(e,t){const s=new Set(this.invalidFeatures);await e.setValueFromUser(t),this.userHasChangedValues=!0,this._trackValidityChange(s),this.emit("value-change",{features:e.features.toArray().map(e=>e.source),fieldName:e.fieldName,name:"value-change",value:t})}async setValue(e,t){const s=this.findFieldInput(e);if(null==s)throw new r("no-FieldInput-found",`Cannot set the value of FieldInput with ID: ${e} because none was found in the active form`);await this.setFieldInputValue(s,t)}userChangesHaveMadeFeatureInvalid(e){return!!this._reactiveGraphicLookup.get(e)?.userChangesHaveMadeInvalid}async _trackValidityChange(e){await f(()=>!1===this.calculating);const t=this.invalidFeatures;for(const s of t)!1===e.has(s)&&this._reactiveGraphicLookup.has(s)&&(this._reactiveGraphicLookup.get(s).userChangesHaveMadeInvalid=!0)}validate(){return!1}_makeBatchFormInputsForFeature(e){const t=this._layerTemplateMap.get(e.layer);return t?T(t,new s([e]),this._expressionsManager):this._emptyForm}_makeSubmitResults(){const e=new Map;for(const[t,s]of this._reactiveGraphicLookup)e.set(t,{feature:t,values:{...s.attributes},invalidFields:[]});for(const t of this.sharedForm.allFieldInputs)for(const s of t.invalidFeatures)e.get(s)?.invalidFields.push(t.fieldName);return Array.from(e.values())}_prepare(){this._hasAsyncArcadeExpressions=!1,this._prepareTask=n(this._prepareTask),this._updateWorkingFeatures(),p(this._expressionsManager),this.userHasChangedValues=!1,this._expressionsManager=new k({arcadeContext:{editType:this.editType,spatialReference:this.spatialReference??F.WebMercator,map:this.map,timeZone:this._effectiveTimeZone}});const{layers:e}=this;if(0===e.length)return;const s=t(async t=>{try{l(t);const s=new Map;for(const r of e){const e=await H(r);if(l(t),e){const t=e.fieldGroups.flatMap(e=>e.fields);this._layerContingentValuesMap.set(r,new Set(t))}else this._layerContingentValuesMap.set(r,new Set);const i=U(this.layerInfos,r),a=await B(r,{arcadeExecutorProvider:this._arcadeExecutorProvider,formTimeZone:this._effectiveTimeZone},i?.formTemplate);l(t),this._layerTemplateMap.set(r,a);const o=a.getExpressionExecutorsForLayer(r);if(this._expressionsManager.layerExpressionsModelMap.set(r,new C({preserveFieldValuesWhenHidden:a.preserveFieldValuesWhenHidden,executorMap:o})),!this._hasAsyncArcadeExpressions)for(const t of o.keys()){const e=o.get(t);if(this._hasAsyncArcadeExpressions=!0===(e.editableExpression?.isAsync||e.requiredExpression?.isAsync||e.valueExpression?.isAsync||e.visibilityExpression?.isAsync),this._hasAsyncArcadeExpressions)break}for(const t of a.elements){if(G(t))continue;const e=t.clone();R(e)&&(e.elements=e.elements.filter(e=>!G(e)));const{elementId:r}=e;s.has(r)?s.get(r).foldIn(e):s.set(r,e)}}if(this.hasTooManyComplexFeatures)throw new r("too-many-features-with-complex-forms","There are too many features to load into the form with the configured complexity");if(this.hasTooManyFeatures)throw new r("too-many-features","There are too many features to load into the form.");const i=new L({elements:Array.from(s.values())});this.sharedFormTemplate=i,this.sharedForm=T(i,this._workingFeatures,this._expressionsManager),await this._expressionsManager.runAllExpressions(this._workingFeatures.toArray())}catch(s){throw u(s)||a.getLogger(this).error("Failed preparing form",s),s}});this._updatingHandles.consumePromise(s.promise),this._prepareTask=s}_updateWorkingFeatures(){this._workingFeatures.destroyAll();const{features:e}=this;if(this._reactiveGraphicLookup=new h,0!==e.length){this._workingFeatures.addMany(e.map(w));for(const e of this._workingFeatures)this._reactiveGraphicLookup.set(e.source,e)}}async _syncAttachments(){const{activeFeature:e,activeLayer:t,activeForm:s}=this;if(!(e&&s&&I(t)&&b(t)))return;const r=e.getObjectId();if(null==r)return;const i=this._attachmentCache.get(t),a=s.allAttachmentElementInputs;if(!a.length)return;let n;if(i){const e=i.get(r);e&&(n=e)}if(!n){n=await A(t,r,a);o(this._attachmentCache,t,()=>new h).set(r,n)}for(const o of a)o.attachments=W(o,n)}};e([y()],Z.prototype,"_effectiveTimeZone",null),e([y()],Z.prototype,"_attachmentCache",void 0),e([y({readOnly:!0})],Z.prototype,"activeFeature",null),e([y()],Z.prototype,"activeFeatureIndex",void 0),e([y({readOnly:!0})],Z.prototype,"activeForm",null),e([y({readOnly:!0})],Z.prototype,"activeLayer",null),e([y()],Z.prototype,"disabled",void 0),e([y()],Z.prototype,"calculating",null),e([y()],Z.prototype,"editType",void 0),e([y()],Z.prototype,"features",void 0),e([y()],Z.prototype,"expressionEvaluationFailed",null),e([y()],Z.prototype,"hasNonActiveInvalidFeatures",null),e([y()],Z.prototype,"hasAsyncArcadeExpressions",null),e([y()],Z.prototype,"_hasAsyncArcadeExpressions",void 0),e([y()],Z.prototype,"invalidFeatures",null),e([y()],Z.prototype,"hasVisibleInputs",null),e([y()],Z.prototype,"hasLayersWithContingentValues",null),e([y()],Z.prototype,"maximumFeatureCount",void 0),e([y()],Z.prototype,"maximumFeatureCountWithComplexForms",void 0),e([y()],Z.prototype,"visibleInputs",null),e([y()],Z.prototype,"map",void 0),e([y()],Z.prototype,"noVisibleElementsReason",null),e([y()],Z.prototype,"readOnly",void 0),e([y()],Z.prototype,"spatialReference",void 0),e([y()],Z.prototype,"submitHasBeenAttempted",void 0),e([y()],Z.prototype,"timeZone",void 0),e([y()],Z.prototype,"updating",null),e([y()],Z.prototype,"valid",null),e([y()],Z.prototype,"layers",null),e([y()],Z.prototype,"mode",null),e([y()],Z.prototype,"sharedForm",void 0),e([y()],Z.prototype,"sharedFormTemplate",void 0),e([y()],Z.prototype,"userHasChangedValues",void 0),e([y()],Z.prototype,"layerInfos",void 0),e([y()],Z.prototype,"_arcadeExecutorProvider",void 0),e([y()],Z.prototype,"_prepareTask",void 0),e([y()],Z.prototype,"_reactiveGraphicLookup",void 0),e([y()],Z.prototype,"_layerTemplateMap",void 0),e([y()],Z.prototype,"_layerContingentValuesMap",void 0),e([y()],Z.prototype,"_workingFeatures",void 0),e([y()],Z.prototype,"_expressionsManager",void 0),Z=e([v("esri.widgets.BatchAttributeForm.BatchAttributeFormViewModel")],Z);const S=Z;function W(e,t){const s="attachment"===e.input?.type?e.input.attachmentAssociationType:"exact",r=e.attachmentKeyword,i=null!=r&&r.length>0;if("any"===s)return t;if("exactOrNone"===s){if(!i)return t.filter(e=>O(e.keywords));const e=r.toLowerCase();return t.filter(t=>O(t.keywords)||P(t,e))}if(!i)return t;const a=r.toLowerCase();return t.filter(e=>P(e,a))}function N(e){return null!=e&&e.trim().length>0}function O(e){return!N(e)}function P(e,t){const s=e.keywords;return null!=s&&s.toLowerCase()===t.toLowerCase()}export{S as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{substitute as e}from"../../intl.js";import t from"../../rest/support/AttachmentQuery.js";import{ReactiveGraphic as i}from"./ReactiveGraphic.js";import{getIntlOptionsForField as n}from"../support/dateUtils.js";import{isEmptyValue as r,getRangeErrorMessage as o,shouldUseScientificNotation as a,scientificNumberFormatOptions as s,numberFormatOptions as l}from"../support/forms/formUtils.js";const d=(e,t)=>null!=e&&e.input?.type===t;function u(e){return new i({source:e})}function c(t,i,r,d){const{dataType:u,minLength:c}=t,f=r?.validationErrors;if(!f||!i)return null;if("batch-attribute-form-validation::features-have-different-errors"===i)return f.invalidBatchFormType;if("input-validation-error::cannot-be-empty"===i)return f.cannotBeNull;if("domain-validation-error::value-out-of-range"===i||"numeric-range-validation-error::out-of-range"===i){const{field:i,range:r}=t,c={type:"date",intlOptions:{timeZone:"date"===i.type&&d?d:void 0,...n(i)}},p=o(r,f);return e(p,r,{format:{max:"date"===u?c:null!=r.max&&a(r.max)?s:l,min:"date"===u?c:null!=r.min&&a(r.min)?s:l}})}return"domain-validation-error::invalid-coded-value"===i?f.invalidCodedValue:"type-validation-error::invalid-type"===i?f.invalidType:"length-validation-error::too-short"===i?e(f.tooShort,{min:c}):null}function f(e,t,i){const n=i?.validationErrors;if(!n)return null;let r=null;for(const o of e.invalidHiddenInputs)switch(o.effectiveVisibilityCode){case"hidden:visibility-expression:all-features":case"hidden:group-visibility-expression:all-features":case"hidden:field-definition":return"single"===t?n.nonVisibleError_changeValues:n.nonVisibleError_checkIndividualFeatures;case"hidden:no-domain-in-common":case"hidden:visibility-expression:some-features":case"hidden:group-visibility-expression:some-features":case"hidden:not-in-all-layers":r=n.nonVisibleError_checkIndividualFeatures;break;case"visible":continue;default:o.effectiveVisibilityCode}return r}function p(e){return null!=e&&"object"==typeof e&&"type"in e&&("feature"===e.type||"geojson"===e.type||"knowledge-graph-sublayer"===e.type||"oriented-imagery"===e.type||"scene"===e.type||"subtype-sublayer"===e.type)}function m(e){return!!p(e)||!!(null!=e&&"object"==typeof e&&"type"in e&&e.type&&"id"in e&&e.id&&"fields"in e&&e.fields&&"fieldsIndex"in e&&e.fieldsIndex&&"objectIdField"in e&&e.objectIdField&&"capabilities"in e&&"getField"in e&&e.getField)}function y(e){return m(e)&&"queryAttachments"in e}function h(e){if(!y(e))return!1;const t=e?.effectiveCapabilities??e?.capabilities;return!(!t?.data?.supportsAttachment||!t.operations.supportsQueryAttachments)}async function v(e,i,n){const o=new Set;let a=!1;for(const t of n){if(r(t.attachmentKeyword)){a=!0;break}o.add(t.attachmentKeyword)}const s=o.size&&!a?Array.from(o):void 0,l=new t({objectIds:[i],where:"1=1",returnMetadata:!0,keywords:s});e.capabilities?.query?.supportsCacheHint&&(l.cacheHint=!0);return(await e.queryAttachments(l))[i]??[]}function b(e,t,i,n){const r=e.get(t)?.get(i)??[];if(!n?.length)return r;const o=new Set(n.map(e=>e.toLowerCase()));return r.filter(e=>o.has(e.keywords.toLowerCase()))}export{u as createReactiveGraphic,b as getAttachmentsForKeywords,f as getHiddenFieldsValidationErrorMessage,c as getVisibleFieldInputValidationErrorMessage,m as isAttributeFormSupportedLayer,p as isAttributeFormSupportedLayerUnion,y as isAttributeFormSupportedLayerWithAttachments,d as isElementTemplateWithInputType,h as layerSupportsQueryAttachments,v as queryAttachmentsForElements};
2
+ import{substitute as e}from"../../intl.js";import t from"../../rest/support/AttachmentQuery.js";import{ReactiveGraphic as i}from"./ReactiveGraphic.js";import{getIntlOptionsForField as n}from"../support/dateUtils.js";import{isEmptyValue as r,getRangeErrorMessage as o,shouldUseScientificNotation as a,scientificNumberFormatOptions as s,numberFormatOptions as l}from"../support/forms/formUtils.js";const d=(e,t)=>null!=e&&e.input?.type===t;function u(e){return new i({source:e})}function c(t,i,r,d){const{dataType:u,minLength:c}=t,p=r?.validationErrors;if(!p||!i)return null;if("batch-attribute-form-validation::features-have-different-errors"===i)return p.invalidBatchFormType;if("input-validation-error::cannot-be-empty"===i)return p.cannotBeNull;if("domain-validation-error::value-out-of-range"===i||"numeric-range-validation-error::out-of-range"===i){const{field:i,range:r}=t,c={type:"date",intlOptions:{timeZone:"date"===i.type&&d?d:void 0,...n(i)}},f=o(r,p);return e(f,r,{format:{max:"date"===u?c:null!=r.max&&a(r.max)?s:l,min:"date"===u?c:null!=r.min&&a(r.min)?s:l}})}return"domain-validation-error::invalid-coded-value"===i?p.invalidCodedValue:"type-validation-error::invalid-type"===i?p.invalidType:"length-validation-error::too-short"===i?e(p.tooShort,{min:c}):null}function p(e,t,i){const n=i?.validationErrors;if(!n)return null;let r=null;for(const o of e.invalidHiddenInputs)switch(o.effectiveVisibilityCode){case"hidden:visibility-expression:all-features":case"hidden:group-visibility-expression:all-features":case"hidden:field-definition":return"single"===t?n.nonVisibleError_changeValues:n.nonVisibleError_checkIndividualFeatures;case"hidden:no-domain-in-common":case"hidden:visibility-expression:some-features":case"hidden:group-visibility-expression:some-features":case"hidden:not-in-all-layers":r=n.nonVisibleError_checkIndividualFeatures;break;case"visible":continue;default:o.effectiveVisibilityCode}return r}function f(e){return null!=e&&"object"==typeof e&&"type"in e&&("feature"===e.type||"geojson"===e.type||"knowledge-graph-sublayer"===e.type||"oriented-imagery"===e.type||"scene"===e.type||"subtype-sublayer"===e.type)}function m(e){return!!f(e)||!!(null!=e&&"object"==typeof e&&"type"in e&&e.type&&"id"in e&&e.id&&"fields"in e&&e.fields&&"fieldsIndex"in e&&e.fieldsIndex&&"objectIdField"in e&&e.objectIdField&&"capabilities"in e&&"getField"in e&&e.getField)}function y(e){return m(e)&&"queryAttachments"in e}function h(e){if(!y(e))return!1;const t=e?.effectiveCapabilities??e?.capabilities;return!(!t?.data?.supportsAttachment||!t.operations.supportsQueryAttachments)}async function v(e,i,n){const o=new Set;let a=!1;for(const t of n){if("attachment"===t.input?.type&&("any"===t.input.attachmentAssociationType||"exactOrNone"===t.input.attachmentAssociationType)){a=!0;break}if(r(t.attachmentKeyword)){a=!0;break}o.add(t.attachmentKeyword)}const s=o.size&&!a?Array.from(o):void 0,l=new t({objectIds:[i],where:"1=1",returnMetadata:!0,keywords:s});e.capabilities?.query?.supportsCacheHint&&(l.cacheHint=!0);return(await e.queryAttachments(l))[i]??[]}function b(e,t,i,n){const r=e.get(t)?.get(i)??[];if(!n?.length)return r;const o=new Set(n.map(e=>e.toLowerCase()));return r.filter(e=>o.has(e.keywords.toLowerCase()))}export{u as createReactiveGraphic,b as getAttachmentsForKeywords,p as getHiddenFieldsValidationErrorMessage,c as getVisibleFieldInputValidationErrorMessage,m as isAttributeFormSupportedLayer,f as isAttributeFormSupportedLayerUnion,y as isAttributeFormSupportedLayerWithAttachments,d as isElementTemplateWithInputType,h as layerSupportsQueryAttachments,v as queryAttachmentsForElements};
@@ -0,0 +1,64 @@
1
+ import type Graphic from "../../../Graphic.js";
2
+ import type AttachmentInfo from "../../../rest/query/support/AttachmentInfo.js";
3
+ import type EditableInput from "./EditableInput.js";
4
+ import type GroupInput from "./GroupInput.js";
5
+ import type { AttachmentInputUnion } from "../../../form/elements/inputs/attachments/types.js";
6
+ import type { AttributeFormSupportedLayerUnion } from "../types.js";
7
+ import type { EditableInputProperties } from "./EditableInput.js";
8
+
9
+ /** @since 5.1 */
10
+ export interface AttachmentElementInputProperties extends EditableInputProperties, Partial<Pick<AttachmentElementInput, "attachments">> {}
11
+
12
+ /**
13
+ * This is a read-only support class that represents an [attachment element](https://developers.arcgis.com/javascript/latest/references/core/form/elements/AttachmentElement/) in a [BatchAttributeForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/).
14
+ *
15
+ * @since 5.1
16
+ * @see [BatchAttributeForm](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/)
17
+ * @see [BatchAttributeFormViewModel](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/BatchAttributeFormViewModel/)
18
+ * @see [BatchFormInputs](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/BatchFormInputs/)
19
+ */
20
+ export default class AttachmentElementInput extends EditableInput<any> {
21
+ constructor(properties: AttachmentElementInputProperties);
22
+ /** Indicates if the input allows users to rename attachments. */
23
+ get allowUserRename(): boolean | null | undefined;
24
+ /** The input's attachment keyword. This is used to filter attachments associated with the active feature. */
25
+ get attachmentKeyword(): string | null | undefined;
26
+ /** The attachments applicable to this input. */
27
+ accessor attachments: AttachmentInfo[];
28
+ /** Indicates if the attachment filename should be displayed. */
29
+ get displayFilename(): boolean | null | undefined;
30
+ /**
31
+ * The single feature associated with this attachment element.
32
+ *
33
+ * @since 5.1
34
+ * @see [BatchAttributeFormViewModel.features](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/BatchAttributeFormViewModel/#features)
35
+ */
36
+ get feature(): Graphic | null | undefined;
37
+ /** The group containing the attachment element input. */
38
+ get group(): GroupInput | null;
39
+ /** The configured attachment input for this element. */
40
+ get input(): AttachmentInputUnion | null | undefined;
41
+ /**
42
+ * Identifies the single feature layer associated with this attachment element. The layer must support feature editing and field access.
43
+ *
44
+ * The following layer types are supported:
45
+ * - [FeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/FeatureLayer/)
46
+ * - [GeoJSONLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GeoJSONLayer/)
47
+ * - [SceneLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/SceneLayer/) (with `featureLayer` property)
48
+ * - [SubtypeSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/support/SubtypeSublayer/)
49
+ * - [OrientedImageryLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/OrientedImageryLayer/)
50
+ * - [KnowledgeGraphSublayer](https://developers.arcgis.com/javascript/latest/references/core/layers/knowledgeGraph/KnowledgeGraphSublayer/)
51
+ *
52
+ * @since 5.1
53
+ * @see [BatchAttributeFormViewModel.layers](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/BatchAttributeFormViewModel/#layers)
54
+ */
55
+ get layer(): AttributeFormSupportedLayerUnion | null | undefined;
56
+ /** The maximum number of attachments allowed. */
57
+ get maxAttachmentCount(): number | null | undefined;
58
+ /** The minimum number of attachments required. */
59
+ get minAttachmentCount(): number | null | undefined;
60
+ /** The type of input. */
61
+ get type(): "attachment";
62
+ /** Indicates if the original filename should be used when creating attachments. */
63
+ get useOriginalFilename(): boolean | null | undefined;
64
+ }
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{__decorate as t}from"tslib";import{property as e,subclass as n}from"../../../core/accessorSupport/decorators.js";import r from"./EditableInput.js";import a from"./SingleFeatureInputAdapter.js";let o=class extends r{constructor(t){super(t),this.attachments=[],this.group=null,this.single=new a({input:this}),this.type="attachment"}get allowUserRename(){return this.template.allowUserRename}get attachmentKeyword(){return this.template.attachmentKeyword?.trim()}get displayFilename(){return this.template.displayFilename}get feature(){return this.single.feature}get input(){return this.template.input}get layer(){return this.single.layer}get maxAttachmentCount(){return this.template.maxAttachmentCount}get minAttachmentCount(){return this.template.minAttachmentCount}get useOriginalFilename(){return this.template.useOriginalFilename}};t([e()],o.prototype,"allowUserRename",null),t([e()],o.prototype,"attachmentKeyword",null),t([e()],o.prototype,"attachments",void 0),t([e()],o.prototype,"displayFilename",null),t([e()],o.prototype,"feature",null),t([e()],o.prototype,"group",void 0),t([e()],o.prototype,"input",null),t([e()],o.prototype,"layer",null),t([e()],o.prototype,"maxAttachmentCount",null),t([e()],o.prototype,"minAttachmentCount",null),t([e({readOnly:!0})],o.prototype,"single",void 0),t([e({readOnly:!0})],o.prototype,"type",void 0),t([e()],o.prototype,"useOriginalFilename",null),o=t([n("esri.widgets.BatchAttributeForm.inputs.AttachmentElementInput")],o);const l=o;export{l as default};
@@ -1,5 +1,6 @@
1
1
  import type Graphic from "../../../Graphic.js";
2
2
  import type Accessor from "../../../core/Accessor.js";
3
+ import type AttachmentElementInput from "./AttachmentElementInput.js";
3
4
  import type FieldInput from "./FieldInput.js";
4
5
  import type { FormInput } from "./types.js";
5
6
 
@@ -12,6 +13,8 @@ export interface BatchFormInputsProperties {}
12
13
  */
13
14
  export default class BatchFormInputs extends Accessor {
14
15
  constructor(properties?: BatchFormInputsProperties);
16
+ /** Returns an array of all the attachment element inputs in the form, including those in groups. */
17
+ get allAttachmentElementInputs(): AttachmentElementInput[];
15
18
  /** Returns an array of all the field inputs in the form, including those in groups. */
16
19
  get allFieldInputs(): FieldInput[];
17
20
  /** The description for the form. */
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{property as i,subclass as l}from"../../../core/accessorSupport/decorators.js";import{isFieldInput as r,isGroupInput as s}from"./support/inputUtils.js";let n=class extends e{constructor(t){super(t),this.inputs=[],this.template=null}get allFieldInputs(){const t=[];for(const e of this.inputs)r(e)?t.push(e):s(e)&&t.push(...e.inputs.filter(r));return t}get description(){return this.template?.description??null}get hasInvalidHiddenInputs(){return this.invalidHiddenInputs.length>0}get invalidFeatures(){return Array.from(new Set(this.allFieldInputs.flatMap(t=>t.invalidFeatures)))}get invalidHiddenInputs(){return this.allFieldInputs.filter(t=>!t.valid&&!t.effectiveVisible)}get title(){return this.template?.title??null}get valid(){return this.allFieldInputs.every(t=>t.valid)}};t([i()],n.prototype,"allFieldInputs",null),t([i()],n.prototype,"description",null),t([i()],n.prototype,"inputs",void 0),t([i()],n.prototype,"hasInvalidHiddenInputs",null),t([i()],n.prototype,"invalidFeatures",null),t([i()],n.prototype,"invalidHiddenInputs",null),t([i()],n.prototype,"template",void 0),t([i()],n.prototype,"title",null),t([i()],n.prototype,"valid",null),n=t([l("esri.widgets.BatchAttributeForm.inputs.BatchFormInputs")],n);const p=n;export{p as default};
2
+ import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import{property as l,subclass as i}from"../../../core/accessorSupport/decorators.js";import{isFieldInput as n,isGroupInput as s,isAttachmentElementInput as r}from"./support/inputUtils.js";let p=class extends e{constructor(t){super(t),this.inputs=[],this.template=null}get allFieldInputs(){const t=[];for(const e of this.inputs)n(e)?t.push(e):s(e)&&t.push(...e.inputs.filter(n));return t}get allAttachmentElementInputs(){const t=[];for(const e of this.inputs)r(e)?t.push(e):s(e)&&t.push(...e.inputs.filter(r));return t}get description(){return this.template?.description??null}get hasInvalidHiddenInputs(){return this.invalidHiddenInputs.length>0}get invalidFeatures(){return Array.from(new Set(this.allFieldInputs.flatMap(t=>t.invalidFeatures)))}get invalidHiddenInputs(){return this.allFieldInputs.filter(t=>!t.valid&&!t.effectiveVisible)}get title(){return this.template?.title??null}get valid(){return this.allFieldInputs.every(t=>t.valid)}};t([l()],p.prototype,"allFieldInputs",null),t([l()],p.prototype,"allAttachmentElementInputs",null),t([l()],p.prototype,"description",null),t([l()],p.prototype,"inputs",void 0),t([l()],p.prototype,"hasInvalidHiddenInputs",null),t([l()],p.prototype,"invalidFeatures",null),t([l()],p.prototype,"invalidHiddenInputs",null),t([l()],p.prototype,"template",void 0),t([l()],p.prototype,"title",null),t([l()],p.prototype,"valid",null),p=t([i("esri.widgets.BatchAttributeForm.inputs.BatchFormInputs")],p);const o=p;export{o as default};
@@ -13,10 +13,11 @@ export interface GroupInputProperties extends InputBaseProperties {}
13
13
  * @see [FieldInput](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/FieldInput/)
14
14
  * @see [RelationshipElementInput](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/RelationshipElementInput/)
15
15
  * @see [TextElementInput](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/TextElementInput/)
16
+ * @see [AttachmentElementInput](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/AttachmentElementInput/)
16
17
  */
17
18
  export default class GroupInput extends InputBase<any> {
18
19
  constructor(properties: GroupInputProperties);
19
- /** An array of [field inputs](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/FieldInput/), [relationship element inputs](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/RelationshipElementInput/), and [text element inputs](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/TextElementInput/) contained within the group. */
20
+ /** An array of [field inputs](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/FieldInput/), [relationship element inputs](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/RelationshipElementInput/), [text element inputs](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/TextElementInput/), and [attachment element inputs](https://developers.arcgis.com/javascript/latest/references/core/widgets/BatchAttributeForm/inputs/AttachmentElementInput/) contained within the group. */
20
21
  get inputs(): ReadonlyArray<GroupableInput>;
21
22
  /**
22
23
  * Indicates whether the group should be expanded or collapsed.