@arcgis/core 4.33.0-next.20250430 → 4.33.0-next.20250501

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 (94) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/02b38423276536596aba.js +1 -0
  3. package/assets/esri/core/workers/chunks/3cee3ff926f47aae476f.js +1 -0
  4. package/assets/esri/core/workers/chunks/{cb25b45a6b385e60c68d.js → 653ff3e631fea8ad393a.js} +122 -121
  5. package/assets/esri/core/workers/chunks/6d89d42bcba213be2d9d.js +1 -0
  6. package/assets/esri/core/workers/chunks/6ecc3a3737ae8622dfa4.js +1 -0
  7. package/assets/esri/core/workers/chunks/6fef5a07f75b2a5736ad.js +1 -0
  8. package/assets/esri/core/workers/chunks/6ff46126c82354e6c78e.js +1 -0
  9. package/assets/esri/core/workers/chunks/71dc9d78dec981078a1a.js +1 -0
  10. package/assets/esri/core/workers/chunks/{ab6ecd8eeec5ff761b34.js → 73bca519c93920bc8c9f.js} +1 -1
  11. package/assets/esri/core/workers/chunks/7a282674d77875c58acd.js +1 -0
  12. package/assets/esri/core/workers/chunks/9652cfd4668b95036c87.js +39 -0
  13. package/assets/esri/core/workers/chunks/9f07919ade6707b103da.js +1 -0
  14. package/assets/esri/core/workers/chunks/{d3174ff4dd5acd16485a.js → c041f4a1d18d42e27ad7.js} +1 -1
  15. package/assets/esri/core/workers/chunks/c9a2c4fd169b943db4b4.js +1 -0
  16. package/chunks/SSAO.glsl.js +43 -42
  17. package/core/NestedMap.js +1 -1
  18. package/core/deprecate.js +1 -1
  19. package/interfaces.d.ts +232 -39
  20. package/layers/MapImageLayer.js +1 -1
  21. package/layers/RouteLayer.js +1 -1
  22. package/layers/mixins/operationalLayers.js +1 -1
  23. package/layers/save/mapImageLayerUtils.js +5 -0
  24. package/package.json +1 -1
  25. package/portal/support/portalItemUtils.js +1 -1
  26. package/support/revision.js +1 -1
  27. package/views/3d/environment/EnvironmentManager.js +1 -1
  28. package/views/3d/glTF/LoaderResult.js +1 -1
  29. package/views/3d/glTF/loader.js +1 -1
  30. package/views/3d/interactive/Manipulator3D.js +1 -1
  31. package/views/3d/interactive/visualElements/Object3DVisualElement.js +1 -1
  32. package/views/3d/interactive/visualElements/VisualElementResources.js +1 -1
  33. package/views/3d/layers/I3SMeshView3D.js +1 -1
  34. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  35. package/views/3d/layers/graphics/DeconflictAABR.js +5 -0
  36. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  37. package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayer.js +1 -1
  38. package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
  39. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  40. package/views/3d/layers/graphics/Labeler.js +1 -1
  41. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  42. package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
  43. package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
  44. package/views/3d/webgl-engine/Stage.js +1 -1
  45. package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
  46. package/views/3d/webgl-engine/core/renderPasses/AllRenderPasses.js +1 -1
  47. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +2 -2
  48. package/views/3d/webgl-engine/lib/ContentObjectType.js +1 -1
  49. package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +5 -0
  50. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  51. package/views/3d/webgl-engine/lib/Intersector.js +1 -1
  52. package/views/3d/webgl-engine/lib/IntersectorTarget.js +1 -1
  53. package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
  54. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  55. package/views/3d/webgl-engine/lib/Octree.js +1 -1
  56. package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
  57. package/views/3d/webgl-engine/lib/RendererBase.js +1 -1
  58. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  59. package/views/3d/webgl-engine/lib/WebGLLayer.js +1 -1
  60. package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
  61. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  62. package/views/3d/webgl-engine/materials/WaterTechnique.js +1 -1
  63. package/views/3d/webgl-engine/parts/Model.js +1 -1
  64. package/views/3d/webgl-engine/shaders/ColorMaterialTechnique.js +1 -1
  65. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  66. package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
  67. package/views/3d/webgl-engine/shaders/PatternTechnique.js +1 -1
  68. package/views/SelectionManager.js +1 -1
  69. package/views/ui/DefaultUI.js +1 -1
  70. package/views/webgl/Sync.js +5 -0
  71. package/widgets/Directions/DirectionsViewModel.js +1 -1
  72. package/widgets/Directions.js +1 -1
  73. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  74. package/widgets/FeatureTable/support/AttachmentsViewOptions.d.ts +4 -0
  75. package/widgets/FeatureTable.js +1 -1
  76. package/widgets/Fullscreen/FullscreenViewModel.js +1 -1
  77. package/widgets/Fullscreen.js +1 -1
  78. package/widgets/LayerList/LayerListItem.js +1 -1
  79. package/widgets/LayerList/ListItemPanel.js +1 -1
  80. package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
  81. package/widgets/NavigationToggle.js +1 -1
  82. package/widgets/TableList/ListItemPanel.js +1 -1
  83. package/widgets/Weather/WeatherViewModel.js +1 -1
  84. package/widgets/Weather.js +1 -1
  85. package/assets/esri/core/workers/chunks/25142d431dd1e5e82234.js +0 -1
  86. package/assets/esri/core/workers/chunks/2c92f6f268aa2de5432c.js +0 -1
  87. package/assets/esri/core/workers/chunks/7fce62ef3f0b011e0d35.js +0 -1
  88. package/assets/esri/core/workers/chunks/8c8d812a7f2d29c29676.js +0 -1
  89. package/assets/esri/core/workers/chunks/b780c7062b1b18a5ae19.js +0 -1
  90. package/assets/esri/core/workers/chunks/b8248939373e25a8d6db.js +0 -1
  91. package/assets/esri/core/workers/chunks/baa9fd23414f03ef90bc.js +0 -1
  92. package/assets/esri/core/workers/chunks/c819535525e9a27bae1f.js +0 -39
  93. package/assets/esri/core/workers/chunks/e08bff9f8247909776a4.js +0 -1
  94. package/assets/esri/core/workers/chunks/f2bc75a718a10065011d.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{isColorEmission as r}from"../core/shaderLibrary/ShaderOutput.js";import{OITPass as e}from"./OITPass.js";import{BlendFactor as n,CompareFunction as t,ColorAttachment0 as o,ColorAttachment1 as u,ColorAttachment2 as s}from"../../../webgl/enums.js";import{separateBlendingParams as c,unpremultipliedAlphaToPremultipliedAlpha as a,defaultDepthWrite as l}from"../../../webgl/renderState.js";const f=c(n.ONE,n.ZERO,n.ONE,n.ONE_MINUS_SRC_ALPHA);function i(r){return r===e.FrontFace?null:f}function N(r){switch(r){case e.NONE:return a;case e.ColorAlpha:return f;case e.FrontFace:case e.COUNT:return null}}function p(r){if(r.draped)return null;switch(r.oitPass){case e.NONE:case e.FrontFace:return r.writeDepth?l:null;case e.ColorAlpha:case e.COUNT:return null}}const O=5e5,m={factor:-1,units:-2};function E(r){return r?m:null}function h(r,n=t.LESS){return r===e.NONE||r===e.FrontFace?n:t.LEQUAL}function F(n,t){const c=r(t);return n===e.ColorAlpha?c?{buffers:[o,u,s]}:{buffers:[o,u]}:c?{buffers:[o,u]}:null}export{m as OITPolygonOffset,O as OITPolygonOffsetLimit,N as blending,f as blendingColorAlpha,p as depthWrite,F as getDrawBuffers,E as getOITPolygonOffset,i as oitBlending,h as oitDepthTest};
5
+ import{isColorEmission as r}from"../core/shaderLibrary/ShaderOutput.js";import{OITPass as e}from"./OITPass.js";import{BlendFactor as t,CompareFunction as n,ColorAttachment0 as o,ColorAttachment1 as s,ColorAttachment2 as u}from"../../../webgl/enums.js";import{separateBlendingParams as a,unpremultipliedAlphaToPremultipliedAlpha as c,defaultDepthWrite as l}from"../../../webgl/renderState.js";const f=a(t.ONE,t.ZERO,t.ONE,t.ONE_MINUS_SRC_ALPHA);function i(r){return r===e.FrontFace?null:f}function p(r){switch(r){case e.NONE:return c;case e.ColorAlpha:return f;case e.FrontFace:case e.COUNT:return null}}function N(r){if(r.draped)return null;switch(r.oitPass){case e.NONE:case e.FrontFace:return r.writeDepth?l:null;case e.ColorAlpha:case e.COUNT:return null}}const O=5e5,h={factor:-1,units:-2};function m({oitPass:r,enableOffset:t}){return t&&r===e.ColorAlpha?h:null}function E(r,t=n.LESS){return r===e.NONE||r===e.FrontFace?t:n.LEQUAL}function F(t,n){const a=r(n);return t===e.ColorAlpha?a?{buffers:[o,s,u]}:{buffers:[o,s]}:a?{buffers:[o,s]}:null}export{h as OITPolygonOffset,O as OITPolygonOffsetLimit,p as blending,f as blendingColorAlpha,N as depthWrite,F as getDrawBuffers,i as oitBlending,E as oitDepthTest,m as oitPolygonOffset};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{splitRenderGeometryChangeSetByMaterial as o}from"./rendererUtils.js";import{MergedRenderer as a}from"../materials/renderers/MergedRenderer.js";let d=class extends r{constructor(e){super(e),this._renderers=new Map}destroy(){this._renderers.forEach((e=>e.destroy())),this._renderers.clear()}initialize(){this.addHandles(t((()=>this.stage.view.state.highlights),(()=>this.updateHighlights())))}getMaterialRenderer(e){return this._renderers.get(e)}updateHighlights(){this.renderers.forEach((e=>e.updateHighlights(this.stage.view.state.highlightOrderMap)))}commit(e,r,t){const{adds:s,removes:i,updates:d}=e;if(0===s.length&&0===i.length&&0===d.length)return!1;o(e).forEach(((e,s)=>{if(r.done)return;let i=this._renderers.get(s);null==i&&e.adds.length>0&&(i=new a({material:s,highlightOrderMap:this.stage.view.state.highlightOrderMap}),i.initializeRenderContext(t),this.rendererAdded(i),this._renderers.set(s,i)),i?(i.modify(e,r),i.updateHighlights(this.stage.view.state.highlightOrderMap),0===i.numGeometries&&(this._renderers.delete(i.material),this.rendererRemoved(i),i.destroy())):(e.clear(),r.madeProgress())}));let n=0;for(const o of this._renderers.values())o.drapedPriority=n++;return!0}get canCompact(){for(const e of this._renderers.values())if(e.canCompact)return!0;return!1}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)return r;r=t.compact(e)||r}return r}get renderers(){return this._renderers}};e([s({constructOnly:!0})],d.prototype,"stage",void 0),d=e([i("esri.views.3d.webgl-engine.lib.RendererBase")],d);export{d as RendererBase};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import r from"../../../../core/Accessor.js";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{splitRenderGeometryChangeSetByMaterial as o}from"./rendererUtils.js";import{MergedRenderer as a}from"../materials/renderers/MergedRenderer.js";let d=class extends r{constructor(e){super(e),this._renderers=new Map}destroy(){this._renderers.forEach((e=>e.destroy())),this._renderers.clear()}initialize(){this.addHandles(t((()=>this.stage.view.state.highlights),(()=>this.updateHighlights())))}getMaterialRenderer(e){return this._renderers.get(e)}updateHighlights(){this._renderers.forEach((e=>e.updateHighlights(this.stage.view.state.highlightOrderMap)))}commit(e,r,t){const{adds:s,removes:i,updates:d}=e;if(0===s.length&&0===i.length&&0===d.length)return!1;o(e).forEach(((e,s)=>{if(r.done)return;let i=this._renderers.get(s);null==i&&e.adds.length>0&&(i=new a({material:s,highlightOrderMap:this.stage.view.state.highlightOrderMap}),i.initializeRenderContext(t),this.rendererAdded(i),this._renderers.set(s,i)),i?(i.modify(e,r),i.updateHighlights(this.stage.view.state.highlightOrderMap),0===i.numGeometries&&(this._renderers.delete(i.material),this.rendererRemoved(i),i.destroy())):(e.clear(),r.madeProgress())}));let n=0;for(const o of this._renderers.values())o.drapedPriority=n++;return!0}get canCompact(){for(const e of this._renderers.values())if(e.canCompact)return!0;return!1}compact(e){let r=!1;for(const t of this._renderers.values()){if(e.done)return r;r=t.compact(e)||r}return r}get renderers(){return this._renderers}};e([s({constructOnly:!0})],d.prototype,"stage",void 0),d=e([i("esri.views.3d.webgl-engine.lib.RendererBase")],d);export{d as RendererBase};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as o,lookAt as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as m,scale as u,lerp as _,squaredDistance as f,subtract as g,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as C,c as j,v as T,t as y,i as D}from"../../../../chunks/vec32.js";import{create as H}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as v,t as S}from"../../../../chunks/vec42.js";import{create as O}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as R}from"../../../ViewingMode.js";import{ColorFormat as E,DepthRenderbufferFormat as U}from"../core/FBOCacheFormats.js";import{CascadeCamera as F}from"./CascadeCamera.js";import{applyTextureResizeModulo as L}from"./textureUtils.js";import{assert as N,logWithBase as Q,verify as V,rayRay2D as A}from"./Util.js";import{TextureType as B,FramebufferBit as I}from"../../../webgl/enums.js";import{Texture as W}from"../../../webgl/Texture.js";var z;!function(t){t[t.Highlight=0]="Highlight",t[t.ExcludeHighlight=1]="ExcludeHighlight"}(z||(z={}));class P{constructor(){this.camera=new F,this.lightMat=l()}}class q{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class G{constructor(t,s){this._fbos=t,this._viewingMode=s,this._enabled=!1,this._snapshots=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new q,this._projectionView=l(),this._projectionViewInverse=l(),this._modelViewLight=l(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=O(),this._cascades=[new P,new P,new P,new P],this._lastOrigin=null,this._maxTextureWidth=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}get depthTexture(){return this._handle?.getTexture()}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return v(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}disposeOffscreenBuffers(){this._handle=i(this._handle),this._discardSnapshots()}set maxCascades(s){this.settings.maxNumCascadesHighQuality=t(Math.floor(s),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||this.disposeOffscreenBuffers()}get enabled(){return this._enabled}get ready(){return this._enabled&&null!=this.depthTexture}get cascades(){for(let t=0;t<this._numCascades;++t)et[t]=this._cascades[t];return et.length=this._numCascades,et}start(t,s,e,i,a){N(this.enabled);const{near:r,far:h}=jt(e);this._computeCascadeDistances(r,h,i),this._textureHeight=this._computeTextureHeight(t,a,i),this._setupMatrices(t,s);const{viewMatrix:o,projectionMatrix:n}=t;for(let c=0;c<this._numCascades;++c)this._constructCascade(c,n,o,s);this._lastOrigin=null,this.clear()}finish(){N(this.enabled),this._handle?.detachDepth()}getShadowMapMatrices(t){if(!this._lastOrigin||!C(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||H(),j(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(it,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)at[16*s+t]=it[t]}}return at}moveSnapshot(t){N(this.enabled),this._handle?.detachDepth(),this._snapshots[t]?.release(),this._snapshots[t]=this._handle,this._handle=null,this.clear()}copySnapshot(t){const s=this._handle?.getTexture()?.descriptor;if(!this.enabled||!s)return;this._snapshots[t]?.release();const{width:e,height:i}=s,a=t===z.Highlight?"shadow highlight snapshot":"shadow no highlight snapshot";this._snapshots[t]=this._fbos.acquire(e,i,a,E.RGBA4UNORM);const r=this._fbos.rctx;this._bindFbo();const h=r.bindTexture(this._snapshots[t]?.getTexture(),W.TEXTURE_UNIT_FOR_UPDATES);r.gl.copyTexSubImage2D(B.TEXTURE_2D,0,0,0,0,0,e,i),r.bindTexture(h,W.TEXTURE_UNIT_FOR_UPDATES)}getSnapshot(t){return this.enabled?this._snapshots[t]?.getTexture():null}clear(){const t=this._fbos.rctx;this._ensureFbo(),this._bindFbo(),t.setClearColor(1,1,1,1),t.clear(I.COLOR|I.DEPTH)}_computeTextureHeight({pixelRatio:t,fullWidth:s,fullHeight:e},i,a){const r=Math.min(window.devicePixelRatio,i)/t,h=a?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality;return L(Math.max(s,e)*r*h,this._maxTextureWidth/this._numCascades)}_ensureFbo(){this._handle?.fbo?.width===this._textureWidth&&this._handle?.fbo.height===this._textureHeight||(this._handle?.release(),this._handle=this._fbos.acquire(this._textureWidth,this._textureHeight,"shadow map",E.RGBA4UNORM)),this._handle?.acquireDepth(U.DEPTH16)}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}_bindFbo(){this._fbos.rctx.bindFramebuffer(this._handle?.fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],o=-this._cascadeDistances[t],n=-this._cascadeDistances[t+1],c=(s[10]*o+s[14])/Math.abs(s[11]*o+s[15]),l=(s[10]*n+s[14])/Math.abs(s[11]*n+s[15]);N(c<l);for(let r=0;r<8;++r){v(k,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?c:l,1);const t=J[r];S(t,k,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}T(st,J[0]),a.camera.viewMatrix=r(X,this._modelViewLight,st);for(let r=0;r<8;++r)y(J[r],J[r],a.camera.viewMatrix);let d=J[0][2],m=J[0][2];for(let r=1;r<8;++r)d=Math.min(d,J[r][2]),m=Math.max(m,J[r][2]);d-=200,m+=200,a.camera.near=-m,a.camera.far=-d,Ct(e,i,d,m,a.camera),h(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const u=this._textureHeight;a.camera.viewport=[t*u,0,u,u]}_setupMatrices(t,s){h(this._projectionView,t.projectionMatrix,t.viewMatrix),o(this._projectionViewInverse,this._projectionView);const e=this._viewingMode===R.Global?t.eye:D(st,0,0,1);n(this._modelViewLight,[0,0,0],[-s[0],-s[1],-s[2]],e)}_computeCascadeDistances(t,e,i){const a=i?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(Q(e/t,4)),a);const r=(e-t)/this._numCascades,h=(e/t)**(1/this._numCascades);let o=t,n=t;for(let c=0;c<this._numCascades+1;++c)this._cascadeDistances[c]=s(o,n,this.settings.splitSchemeLambda),o*=h,n+=r}get test(){}}const X=l(),k=O(),J=[];for(let Tt=0;Tt<8;++Tt)J.push(O());const K=M(),Y=M(),Z=M(),$=M(),tt=M(),st=H(),et=[],it=l(),at=c.concat(c,c,c,c),rt=M(),ht=M(),ot=[M(),M(),M(),M()],nt=M(),ct=M(),lt=M(),dt=M(),mt=M(),ut=M(),_t=M();function ft(t,s,e,i,a,r,h,o){d(rt,0,0);for(let d=0;d<4;++d)m(rt,rt,t[d]);u(rt,rt,.25),d(ht,0,0);for(let d=4;d<8;++d)m(ht,ht,t[d]);u(ht,ht,.25),_(ot[0],t[4],t[5],.5),_(ot[1],t[5],t[6],.5),_(ot[2],t[6],t[7],.5),_(ot[3],t[7],t[4],.5);let n=0,c=f(ot[0],rt);for(let d=1;d<4;++d){const t=f(ot[d],rt);t<c&&(c=t,n=d)}g(nt,ot[n],t[n+4]);const l=nt[0];let M,C;nt[0]=-nt[1],nt[1]=l,g(ct,ht,rt),p(ct,nt)<0&&x(nt,nt),_(nt,nt,ct,e),b(nt,nt),M=C=p(g(lt,t[0],rt),nt);for(let d=1;d<8;++d){const s=p(g(lt,t[d],rt),nt);s<M?M=s:s>C&&(C=s)}w(i,rt),u(lt,nt,M-s),m(i,i,lt);let j=-1,T=1,y=0,D=0;for(let d=0;d<8;++d){g(dt,t[d],i),b(dt,dt);const s=nt[0]*dt[1]-nt[1]*dt[0];s>0?s>j&&(j=s,y=d):s<T&&(T=s,D=d)}V(j>0,"leftArea"),V(T<0,"rightArea"),u(mt,nt,M),m(mt,mt,rt),u(ut,nt,C),m(ut,ut,rt),_t[0]=-nt[1],_t[1]=nt[0];const H=A(i,t[D],ut,m(lt,ut,_t),1,a),v=A(i,t[y],ut,lt,1,r),S=A(i,t[y],mt,m(lt,mt,_t),1,h),O=A(i,t[D],mt,lt,1,o);V(H,"rayRay"),V(v,"rayRay"),V(S,"rayRay"),V(O,"rayRay")}function gt(t,s){return 3*s+t}const pt=M();function xt(t,s){return d(pt,t[s],t[s+3]),pt}const bt=M(),wt=a();function Mt(t,s,e,i,a){g(bt,e,i),u(bt,bt,.5),wt[0]=bt[0],wt[1]=bt[1],wt[2]=0,wt[3]=bt[1],wt[4]=-bt[0],wt[5]=0,wt[6]=bt[0]*bt[0]+bt[1]*bt[1],wt[7]=bt[0]*bt[1]-bt[1]*bt[0],wt[8]=1,wt[gt(0,2)]=-p(xt(wt,0),t),wt[gt(1,2)]=-p(xt(wt,1),t);let r=p(xt(wt,0),e)+wt[gt(0,2)],h=p(xt(wt,1),e)+wt[gt(1,2)],o=p(xt(wt,0),i)+wt[gt(0,2)],n=p(xt(wt,1),i)+wt[gt(1,2)];r=-(r+o)/(h+n),wt[gt(0,0)]+=wt[gt(1,0)]*r,wt[gt(0,1)]+=wt[gt(1,1)]*r,wt[gt(0,2)]+=wt[gt(1,2)]*r,r=1/(p(xt(wt,0),e)+wt[gt(0,2)]),h=1/(p(xt(wt,1),e)+wt[gt(1,2)]),wt[gt(0,0)]*=r,wt[gt(0,1)]*=r,wt[gt(0,2)]*=r,wt[gt(1,0)]*=h,wt[gt(1,1)]*=h,wt[gt(1,2)]*=h,wt[gt(2,0)]=wt[gt(1,0)],wt[gt(2,1)]=wt[gt(1,1)],wt[gt(2,2)]=wt[gt(1,2)],wt[gt(1,2)]+=1,r=p(xt(wt,1),s)+wt[gt(1,2)],h=p(xt(wt,2),s)+wt[gt(2,2)],o=p(xt(wt,1),e)+wt[gt(1,2)],n=p(xt(wt,2),e)+wt[gt(2,2)],r=-.5*(r/h+o/n),wt[gt(1,0)]+=wt[gt(2,0)]*r,wt[gt(1,1)]+=wt[gt(2,1)]*r,wt[gt(1,2)]+=wt[gt(2,2)]*r,r=p(xt(wt,1),s)+wt[gt(1,2)],h=p(xt(wt,2),s)+wt[gt(2,2)],o=-h/r,wt[gt(1,0)]*=o,wt[gt(1,1)]*=o,wt[gt(1,2)]*=o,a[0]=wt[0],a[1]=wt[1],a[2]=0,a[3]=wt[2],a[4]=wt[3],a[5]=wt[4],a[6]=0,a[7]=wt[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=wt[6],a[13]=wt[7],a[14]=0,a[15]=wt[8]}function Ct(t,s,i,a,r){const h=1/J[0][3],o=1/J[4][3];N(h<o);let n=h+Math.sqrt(h*o);const c=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));n/=c,ft(J,n,c,K,Y,Z,$,tt),Mt(K,Y,$,tt,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}function jt(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}export{G as ShadowMap,z as SnapshotSlot};
5
+ import has from"../../../../core/has.js";import{clamp as t,lerp as s,acosClamped as e}from"../../../../core/mathUtils.js";import{releaseMaybe as i}from"../../../../core/maybe.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as r,multiply as h,invert as o,lookAt as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as c,create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as d,add as m,scale as u,lerp as _,squaredDistance as f,subtract as g,dot as p,negate as x,normalize as b,copy as w}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as M}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{p as C,c as j,v as T,t as y,i as D}from"../../../../chunks/vec32.js";import{create as H}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as v,t as S}from"../../../../chunks/vec42.js";import{create as O}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as R}from"../../../ViewingMode.js";import{ColorFormat as E,DepthRenderbufferFormat as U}from"../core/FBOCacheFormats.js";import{CascadeCamera as F}from"./CascadeCamera.js";import{applyTextureResizeModulo as L}from"./textureUtils.js";import{assert as N,logWithBase as Q,verify as V,rayRay2D as A}from"./Util.js";import{TextureType as B,FramebufferBit as I}from"../../../webgl/enums.js";import{Texture as W}from"../../../webgl/Texture.js";var z;!function(t){t[t.Highlight=0]="Highlight",t[t.ExcludeHighlight=1]="ExcludeHighlight"}(z||(z={}));class P{constructor(){this.camera=new F,this.lightMat=l()}}class q{constructor(){this.maxNumCascadesHighQuality=4,this.maxNumCascadesLowQuality=4,this.textureSizeModHighQuality=1.3,this.textureSizeModLowQuality=.9,this.splitSchemeLambda=0}}class G{constructor(t,s){this._fbos=t,this._viewingMode=s,this._snapshots=new Array,this._textureHeight=0,this._numCascades=1,this.settings=new q,this._projectionView=l(),this._projectionViewInverse=l(),this._modelViewLight=l(),this._cascadeDistances=[0,0,0,0,0],this._usedCascadeDistances=O(),this._cascades=[new P,new P,new P,new P],this._lastOrigin=null,this._enabled=!1,this._maxTextureWidth=Math.min(has("esri-mobile")?4096:16384,t.rctx.parameters.maxTextureSize)}dispose(){this.enabled=!1,this.disposeOffscreenBuffers()}get depthTexture(){return this._handle?.getTexture()}get _textureWidth(){return this._textureHeight*this._numCascades}get numCascades(){return this._numCascades}get cascadeDistances(){return v(this._usedCascadeDistances,this._cascadeDistances[0],this._numCascades>1?this._cascadeDistances[1]:1/0,this._numCascades>2?this._cascadeDistances[2]:1/0,this._numCascades>3?this._cascadeDistances[3]:1/0)}disposeOffscreenBuffers(){this._handle=i(this._handle),this._discardSnapshots()}set maxCascades(s){this.settings.maxNumCascadesHighQuality=t(Math.floor(s),1,4)}get maxCascades(){return this.settings.maxNumCascadesHighQuality}set enabled(t){this._enabled=t,t||this.disposeOffscreenBuffers()}get enabled(){return this._enabled}get ready(){return this._enabled&&null!=this.depthTexture}get cascades(){for(let t=0;t<this._numCascades;++t)et[t]=this._cascades[t];return et.length=this._numCascades,et}start(t,s,e,i,a){N(this.enabled);const{near:r,far:h}=jt(e);this._computeCascadeDistances(r,h,i),this._textureHeight=this._computeTextureHeight(t,a,i),this._setupMatrices(t,s);const{viewMatrix:o,projectionMatrix:n}=t;for(let c=0;c<this._numCascades;++c)this._constructCascade(c,n,o,s);this._lastOrigin=null,this.clear()}finish(){N(this.enabled),this._handle?.detachDepth()}getShadowMapMatrices(t){if(!this._lastOrigin||!C(t,this._lastOrigin)){this._lastOrigin=this._lastOrigin||H(),j(this._lastOrigin,t);for(let s=0;s<this._numCascades;++s){r(it,this._cascades[s].lightMat,t);for(let t=0;t<16;++t)at[16*s+t]=it[t]}}return at}moveSnapshot(t){N(this.enabled),this._handle?.detachDepth(),this._snapshots[t]?.release(),this._snapshots[t]=this._handle,this._handle=null,this.clear()}copySnapshot(t){const s=this._handle?.getTexture()?.descriptor;if(!this.enabled||!s)return;this._snapshots[t]?.release();const{width:e,height:i}=s,a=t===z.Highlight?"shadow highlight snapshot":"shadow no highlight snapshot";this._snapshots[t]=this._fbos.acquire(e,i,a,E.RGBA4UNORM);const r=this._fbos.rctx;this._bindFbo();const h=r.bindTexture(this._snapshots[t]?.getTexture(),W.TEXTURE_UNIT_FOR_UPDATES);r.gl.copyTexSubImage2D(B.TEXTURE_2D,0,0,0,0,0,e,i),r.bindTexture(h,W.TEXTURE_UNIT_FOR_UPDATES)}getSnapshot(t){return this.enabled?this._snapshots[t]?.getTexture():null}clear(){const t=this._fbos.rctx;this._ensureFbo(),this._bindFbo(),t.setClearColor(1,1,1,1),t.clear(I.COLOR|I.DEPTH)}_computeTextureHeight({pixelRatio:t,fullWidth:s,fullHeight:e},i,a){const r=Math.min(window.devicePixelRatio,i)/t,h=a?this.settings.textureSizeModHighQuality:this.settings.textureSizeModLowQuality;return L(Math.max(s,e)*r*h,this._maxTextureWidth/this._numCascades)}_ensureFbo(){this._handle?.fbo?.width===this._textureWidth&&this._handle?.fbo.height===this._textureHeight||(this._handle?.release(),this._handle=this._fbos.acquire(this._textureWidth,this._textureHeight,"shadow map",E.RGBA4UNORM)),this._handle?.acquireDepth(U.DEPTH16)}_discardSnapshot(t){this._snapshots[t]=i(this._snapshots[t])}_discardSnapshots(){for(let t=0;t<this._snapshots.length;++t)this._discardSnapshot(t);this._snapshots.length=0}_bindFbo(){this._fbos.rctx.bindFramebuffer(this._handle?.fbo)}_constructCascade(t,s,e,i){const a=this._cascades[t],o=-this._cascadeDistances[t],n=-this._cascadeDistances[t+1],c=(s[10]*o+s[14])/Math.abs(s[11]*o+s[15]),l=(s[10]*n+s[14])/Math.abs(s[11]*n+s[15]);N(c<l);for(let r=0;r<8;++r){v(k,r%4==0||r%4==3?-1:1,r%4==0||r%4==1?-1:1,r<4?c:l,1);const t=J[r];S(t,k,this._projectionViewInverse),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]}T(st,J[0]),a.camera.viewMatrix=r(X,this._modelViewLight,st);for(let r=0;r<8;++r)y(J[r],J[r],a.camera.viewMatrix);let d=J[0][2],m=J[0][2];for(let r=1;r<8;++r)d=Math.min(d,J[r][2]),m=Math.max(m,J[r][2]);d-=200,m+=200,a.camera.near=-m,a.camera.far=-d,Ct(e,i,d,m,a.camera),h(a.lightMat,a.camera.projectionMatrix,a.camera.viewMatrix);const u=this._textureHeight;a.camera.viewport=[t*u,0,u,u]}_setupMatrices(t,s){h(this._projectionView,t.projectionMatrix,t.viewMatrix),o(this._projectionViewInverse,this._projectionView);const e=this._viewingMode===R.Global?t.eye:D(st,0,0,1);n(this._modelViewLight,[0,0,0],[-s[0],-s[1],-s[2]],e)}_computeCascadeDistances(t,e,i){const a=i?this.settings.maxNumCascadesHighQuality:this.settings.maxNumCascadesLowQuality;this._numCascades=Math.min(1+Math.floor(Q(e/t,4)),a);const r=(e-t)/this._numCascades,h=(e/t)**(1/this._numCascades);let o=t,n=t;for(let c=0;c<this._numCascades+1;++c)this._cascadeDistances[c]=s(o,n,this.settings.splitSchemeLambda),o*=h,n+=r}get test(){}}const X=l(),k=O(),J=[];for(let Tt=0;Tt<8;++Tt)J.push(O());const K=M(),Y=M(),Z=M(),$=M(),tt=M(),st=H(),et=[],it=l(),at=c.concat(c,c,c,c),rt=M(),ht=M(),ot=[M(),M(),M(),M()],nt=M(),ct=M(),lt=M(),dt=M(),mt=M(),ut=M(),_t=M();function ft(t,s,e,i,a,r,h,o){d(rt,0,0);for(let d=0;d<4;++d)m(rt,rt,t[d]);u(rt,rt,.25),d(ht,0,0);for(let d=4;d<8;++d)m(ht,ht,t[d]);u(ht,ht,.25),_(ot[0],t[4],t[5],.5),_(ot[1],t[5],t[6],.5),_(ot[2],t[6],t[7],.5),_(ot[3],t[7],t[4],.5);let n=0,c=f(ot[0],rt);for(let d=1;d<4;++d){const t=f(ot[d],rt);t<c&&(c=t,n=d)}g(nt,ot[n],t[n+4]);const l=nt[0];let M,C;nt[0]=-nt[1],nt[1]=l,g(ct,ht,rt),p(ct,nt)<0&&x(nt,nt),_(nt,nt,ct,e),b(nt,nt),M=C=p(g(lt,t[0],rt),nt);for(let d=1;d<8;++d){const s=p(g(lt,t[d],rt),nt);s<M?M=s:s>C&&(C=s)}w(i,rt),u(lt,nt,M-s),m(i,i,lt);let j=-1,T=1,y=0,D=0;for(let d=0;d<8;++d){g(dt,t[d],i),b(dt,dt);const s=nt[0]*dt[1]-nt[1]*dt[0];s>0?s>j&&(j=s,y=d):s<T&&(T=s,D=d)}V(j>0,"leftArea"),V(T<0,"rightArea"),u(mt,nt,M),m(mt,mt,rt),u(ut,nt,C),m(ut,ut,rt),_t[0]=-nt[1],_t[1]=nt[0];const H=A(i,t[D],ut,m(lt,ut,_t),1,a),v=A(i,t[y],ut,lt,1,r),S=A(i,t[y],mt,m(lt,mt,_t),1,h),O=A(i,t[D],mt,lt,1,o);V(H,"rayRay"),V(v,"rayRay"),V(S,"rayRay"),V(O,"rayRay")}function gt(t,s){return 3*s+t}const pt=M();function xt(t,s){return d(pt,t[s],t[s+3]),pt}const bt=M(),wt=a();function Mt(t,s,e,i,a){g(bt,e,i),u(bt,bt,.5),wt[0]=bt[0],wt[1]=bt[1],wt[2]=0,wt[3]=bt[1],wt[4]=-bt[0],wt[5]=0,wt[6]=bt[0]*bt[0]+bt[1]*bt[1],wt[7]=bt[0]*bt[1]-bt[1]*bt[0],wt[8]=1,wt[gt(0,2)]=-p(xt(wt,0),t),wt[gt(1,2)]=-p(xt(wt,1),t);let r=p(xt(wt,0),e)+wt[gt(0,2)],h=p(xt(wt,1),e)+wt[gt(1,2)],o=p(xt(wt,0),i)+wt[gt(0,2)],n=p(xt(wt,1),i)+wt[gt(1,2)];r=-(r+o)/(h+n),wt[gt(0,0)]+=wt[gt(1,0)]*r,wt[gt(0,1)]+=wt[gt(1,1)]*r,wt[gt(0,2)]+=wt[gt(1,2)]*r,r=1/(p(xt(wt,0),e)+wt[gt(0,2)]),h=1/(p(xt(wt,1),e)+wt[gt(1,2)]),wt[gt(0,0)]*=r,wt[gt(0,1)]*=r,wt[gt(0,2)]*=r,wt[gt(1,0)]*=h,wt[gt(1,1)]*=h,wt[gt(1,2)]*=h,wt[gt(2,0)]=wt[gt(1,0)],wt[gt(2,1)]=wt[gt(1,1)],wt[gt(2,2)]=wt[gt(1,2)],wt[gt(1,2)]+=1,r=p(xt(wt,1),s)+wt[gt(1,2)],h=p(xt(wt,2),s)+wt[gt(2,2)],o=p(xt(wt,1),e)+wt[gt(1,2)],n=p(xt(wt,2),e)+wt[gt(2,2)],r=-.5*(r/h+o/n),wt[gt(1,0)]+=wt[gt(2,0)]*r,wt[gt(1,1)]+=wt[gt(2,1)]*r,wt[gt(1,2)]+=wt[gt(2,2)]*r,r=p(xt(wt,1),s)+wt[gt(1,2)],h=p(xt(wt,2),s)+wt[gt(2,2)],o=-h/r,wt[gt(1,0)]*=o,wt[gt(1,1)]*=o,wt[gt(1,2)]*=o,a[0]=wt[0],a[1]=wt[1],a[2]=0,a[3]=wt[2],a[4]=wt[3],a[5]=wt[4],a[6]=0,a[7]=wt[5],a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=wt[6],a[13]=wt[7],a[14]=0,a[15]=wt[8]}function Ct(t,s,i,a,r){const h=1/J[0][3],o=1/J[4][3];N(h<o);let n=h+Math.sqrt(h*o);const c=Math.sin(e(t[2]*s[0]+t[6]*s[1]+t[10]*s[2]));n/=c,ft(J,n,c,K,Y,Z,$,tt),Mt(K,Y,$,tt,r.projectionMatrix),r.projectionMatrix[10]=2/(i-a),r.projectionMatrix[14]=-(i+a)/(i-a)}function jt(t){let{near:s,far:e}=t;return s<2&&(s=2),e<2&&(e=2),s>=e&&(s=2,e=4),{near:s,far:e}}export{G as ShadowMap,z as SnapshotSlot};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Evented.js";import t from"../../../../core/Handles.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import i from"../../../../core/PooledArray.js";import{ContentObject as r}from"./ContentObject.js";import{ContentObjectType as o}from"./ContentObjectType.js";import{DirtyEventNames as h}from"./DirtyEvents.js";import d from"./Octree.js";import{UpdatePolicy as c}from"./UpdatePolicy.js";class a extends r{constructor(s,r,d=""){super(),this.stage=s,this.apiLayerViewUid=d,this.type=o.Layer,this.events=new e,this.visible=!0,this.sliceable=!1,this._objectsAdded=new i,this._handles=new t,this._objects=new i,this._pickable=!0,this.visible=r?.visible??!0,this._pickable=r?.pickable??!0,this.updatePolicy=r?.updatePolicy??c.ASYNC,s.add(this);for(const e of h)this._handles.add(this.events.on(e,(t=>s.handleEvent(e,t))))}destroy(){this._handles.size&&(this._handles.destroy(),this.stage.remove(this),this.invalidateSpatialQueryAccelerator())}get objects(){return this._objects}set pickable(e){this._pickable=e}get pickable(){return this._pickable&&this.visible}add(e){this._objects.push(e),e.parentLayer=this,this.events.emit("layerObjectAdded",{layer:this,object:e}),null!=this._octree&&this._objectsAdded.push(e)}remove(e){this._objects.removeUnordered(e)&&(e.parentLayer=null,this.events.emit("layerObjectRemoved",{layer:this,object:e}),null!=this._octree&&(this._objectsAdded.removeUnordered(e)||this._octree.remove([e])))}addMany(e){this._objects.pushArray(e);for(const t of e)t.parentLayer=this;this.events.emit("layerObjectsAdded",{layer:this,objects:e}),null!=this._octree&&this._objectsAdded.pushArray(e)}removeMany(e){const t=new Array;if(this._objects.removeUnorderedMany(e,e.length,t),0!==t.length){for(const e of t)e.parentLayer=null;if(this.events.emit("layerObjectsRemoved",{layer:this,objects:t}),null!=this._octree){for(let e=0;e<t.length;)this._objectsAdded.removeUnordered(t[e])?(t[e]=t[t.length-1],t.length-=1):++e;this._octree.remove(t)}}}sync(){this.updatePolicy!==c.SYNC&&this.stage.syncLayer(this.id)}notifyObjectBBChanged(e,t){null==this._octree||this._objectsAdded.includes(e)||this._octree.update(e,t)}getSpatialQueryAccelerator(){return null==this._octree&&this._objects.length>50?(this._octree=new d((e=>e.boundingVolumeWorldSpace.bounds)),this._octree.add(this._objects.data,this._objects.length)):null!=this._octree&&this._objectsAdded.length>0&&(this._octree.add(this._objectsAdded.data,this._objectsAdded.length),this._objectsAdded.clear()),this._octree}invalidateSpatialQueryAccelerator(){this._octree=s(this._octree),this._objectsAdded.clear()}}function n(e){return e?.type===o.Layer}export{a as WebGLLayer,n as isWebGLLayer};
5
+ import{removeUnordered as e}from"../../../../core/arrayUtils.js";import{toConst as t}from"../../../../core/compilerUtils.js";import s from"../../../../core/Evented.js";import i from"../../../../core/Handles.js";import"../../../../core/has.js";import{destroyMaybe as o}from"../../../../core/maybe.js";import{ContentObject as r}from"./ContentObject.js";import{ContentObjectType as h}from"./ContentObjectType.js";import{DirtyEventNames as c}from"./DirtyEvents.js";import d from"./Octree.js";import{UpdatePolicy as l}from"./UpdatePolicy.js";class a extends r{constructor(e,t,o=""){super(),this.stage=e,this.apiLayerViewUid=o,this.type=h.Layer,this.events=new s,this.visible=!0,this.sliceable=!1,this._objectsAdded=new Array,this._handles=new i,this._objects=new Map,this._pickable=!0,this.visible=t?.visible??!0,this._pickable=t?.pickable??!0,this.updatePolicy=t?.updatePolicy??l.ASYNC,e.add(this);for(const s of c)this._handles.add(this.events.on(s,(t=>e.handleEvent(s,t))))}destroy(){this._handles.size&&(this._handles.destroy(),this.stage.remove(this),this.invalidateSpatialQueryAccelerator())}get objects(){return this._objects}getObject(e){return t(this._objects.get(e))}set pickable(e){this._pickable=e}get pickable(){return this._pickable&&this.visible}add(e){this._objects.set(e.id,e),e.layer=this,this.events.emit("layerObjectAdded",e),null!=this._octree&&this._objectsAdded.push(e)}remove(t){this._objects.delete(t.id)&&(this.events.emit("layerObjectRemoved",t),t.layer=null,null!=this._octree&&(e(this._objectsAdded,t)||this._octree.remove([t])))}addMany(e){for(const t of e)this._objects.set(t.id,t),t.layer=this;this.events.emit("layerObjectsAdded",e),null!=this._octree&&this._objectsAdded.push(...e)}removeMany(t){const s=new Array;for(const e of t)this._objects.delete(e.id)&&s.push(e);if(0!==s.length&&(this.events.emit("layerObjectsRemoved",s),s.forEach((e=>e.layer=null)),null!=this._octree)){for(let t=0;t<s.length;)e(this._objectsAdded,s[t])?(s[t]=s[s.length-1],s.length-=1):++t;this._octree.remove(s)}}sync(){this.updatePolicy!==l.SYNC&&this.stage.syncLayer(this.id)}notifyObjectBBChanged(e,t){null==this._octree||this._objectsAdded.includes(e)||this._octree.update(e,t)}getSpatialQueryAccelerator(){return null==this._octree&&this._objects.size>50?(this._octree=new d((e=>e.boundingVolumeWorldSpace.bounds)),this._octree.add(this._objects.values())):null!=this._octree&&this._objectsAdded.length>0&&(this._octree.add(this._objectsAdded),this._objectsAdded.length=0),this._octree}invalidateSpatialQueryAccelerator(){this._octree=o(this._octree),this._objectsAdded.length=0}get test(){}}function n(e){return e?.type===h.Layer}export{a as WebGLLayer,n as isWebGLLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/PooledArray.js";import{multiply as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{t as n}from"../../../../chunks/vec32.js";import{l as i}from"../../../../chunks/vec42.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{intersectsSphere as a}from"../../../../geometry/support/frustum.js";import{a as o,g as h,c as f}from"../../../../chunks/sphere.js";import{maxScale as c}from"../../support/mathUtils.js";import{DepthRange as l}from"./DepthRange.js";import u from"./Octree.js";import{assert as d}from"./Util.js";var _;!function(e){e[e.SHADOW_CASTERS=0]="SHADOW_CASTERS",e[e.FULL_SCENE=1]="FULL_SCENE"}(_||(_={}));const m=1e4,g=100,p=500,b=500,C=.1;function R(e,t,r,n){let i=0;if(!t.some((e=>!!e.material&&(i+=e.numGeometries,i>=m))))return W.compute(e,t,n);const s=new l;return r.forAll((t=>s.union(w(e,t)))),s}function w(e,t){if(!t.visible)return;const r=new l,n=t.getSpatialQueryAccelerator();return n?A(r,e,n):O(r,e,t.objects),r}function A(e,t,r){const{eye:n,viewForward:i,frustum:s}=t,a=e=>e.visible,o=r.objectCount;if(o<p)P.set(t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(n,i,u.DepthOrder.FRONT_TO_BACK,P,((r,n)=>{j(e,t,r),P.far=e.near,n.setRange(P)}),s,a),P.set(Math.max(e.far,t.near),t.far),r.forEachInDepthRange(n,i,u.DepthOrder.BACK_TO_FRONT,P,((r,n)=>{j(e,t,r),P.near=e.far,n.setRange(P)}),s,a);else{const n=Math.max(Math.min(o,b),Math.ceil(o*C)),h=r.findClosest(i,u.DepthOrder.FRONT_TO_BACK,s,a,n),f=r.findClosest(i,u.DepthOrder.BACK_TO_FRONT,s,a,n);h&&f&&(v(e,t,h.boundingVolumeWorldSpace.bounds),v(e,t,f.boundingVolumeWorldSpace.bounds))}}function O(e,t,r){y.clear(),r.forAll((e=>{e.visible&&0!==e.geometries.length&&y.add(e)})),y.empty||(y.sort(t),P.set(t.near,Math.min(e.near,t.far)),y.forEachInDepthRange(P,u.DepthOrder.FRONT_TO_BACK,((r,n)=>{n<e.near&&j(e,t,r)})),P.set(Math.max(e.far,t.near),t.far),y.forEachInDepthRange(P,u.DepthOrder.BACK_TO_FRONT,((t,r,n)=>{e.far=Math.max(e.far,n)})))}function j(e,r,n){if(!n.visible)return;if(!a(r.frustum,n.boundingVolumeWorldSpace.bounds))return;const i=n.transformation,s=N;n.geometries.forEach((n=>{t(s,i,n.transformation);const a=c(s);M(e,r,n.boundingInfo,s,a)}))}function M(e,t,r,i,s){if(null==r)return;n(o(I),r.center,i);const{eye:h,viewForward:f}=t,c=f[0]*(I[0]-h[0])+f[1]*(I[1]-h[1])+f[2]*(I[2]-h[2]);if(I[3]=r.radius*s,!(c-I[3]>e.near&&c+I[3]<e.far)&&a(t.frustum,I))if(r.radius>g&&r.getChildren())for(const n of r.getChildren())M(e,t,n,i,s);else K.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,i,r.bbMin,r.bbMax)}function v(e,t,r){const n=t.eye,i=t.viewForward,s=(r[0]-n[0])*i[0]+(r[1]-n[1])*i[1]+(r[2]-n[2])*i[2];e.near=Math.min(e.near,s-r[3]),e.far=Math.max(e.far,s+r[3])}class B{constructor(){this._items=new e({allocator:e=>e||{object:null,distance:0,near:0,far:0},deallocator:e=>(e.object=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e){this._items.pushNew().object=e}sort(e){const t=e.eye,r=e.viewForward;this._items.forAll((e=>{const n=e.object.boundingVolumeWorldSpace.bounds,i=(n[0]-t[0])*r[0]+(n[1]-t[1])*r[1]+(n[2]-t[2])*r[2];e.distance=i,e.near=i-n[3],e.far=i+n[3]})),this._items.sort(((e,t)=>e.distance-t.distance))}forEachInDepthRange(e,t,r){if(t===u.DepthOrder.FRONT_TO_BACK)for(let n=0;n<this._items.length;++n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}else for(let n=this._items.length-1;n>=0;--n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}}}class S{constructor(){this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange=new l(0,0)}compute(e,t,r){this._reset();const{viewMatrix:n}=e;t.forAll((e=>{e.forEachGeometry((e=>{if(!e.visible||r===_.SHADOW_CASTERS&&!e.castShadow)return;const t=e.boundingSphere,i=n[2]*t[0]+n[6]*t[1]+n[10]*t[2]+n[14],s=i-t[3],a=i+t[3];this._geometries.push(e),this._near.push(-a),this._far.push(-s)}))}));const i=new l;if(0===this._geometries.length)return i;for(let h=0;h<this._geometries.length;++h)this._near[h]>i.far&&(i.far=this._near[h]),this._near[h]>2&&this._far[h]<i.near&&(i.near=this._far[h]);const s=this._looseRange;s.near=Math.max(.5*i.near,2),s.far=2*i.far;let a=0,o=0;for(let h=0;h<this._geometries.length;++h)this._near[h]<i.near&&(this._near[h]>=s.near?i.near=this._near[h]:this._nearCandidates[a++]=h),this._far[h]>i.far&&(this._far[h]<=s.far?i.far=this._far[h]:this._farCandidates[o++]=h);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return i;this._nearCandidates.sort(((e,t)=>this._near[e]<this._near[t]?-1:this._near[e]>this._near[t]?1:0)),this._farCandidates.sort(((e,t)=>this._far[e]<this._far[t]?1:this._far[e]>this._far[t]?-1:0));for(let h=0;h<this._nearCandidates.length;++h){const t=this._nearCandidates[h];if(this._near[t]<i.near){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:s}=r;this._includeNearBoundingInfoRec(e,n,s,i)}}for(let h=0;h<this._farCandidates.length;++h){const t=this._farCandidates[h];if(this._far[t]>i.far){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:s}=r;this._includeFarBoundingInfoRec(e,n,s,i)}}return this._reset(),i}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_isOutsideSidePlanes(e,t){const r=o(e),n=h(e);return t[0][0]*r[0]+t[0][1]*r[1]+t[0][2]*r[2]+t[0][3]>n||t[1][0]*r[0]+t[1][1]*r[1]+t[1][2]*r[2]+t[1][3]>n||t[2][0]*r[0]+t[2][1]*r[1]+t[2][2]*r[2]+t[2][3]>n||t[3][0]*r[0]+t[3][1]*r[1]+t[3][2]*r[2]+t[3][3]>n}_includeNearBoundingInfoRec(e,t,r,i){if(null==t)return;const s=t.center;n(o(I),s,r),I[3]=t.radius*c(r);const{frustum:a}=e;if(this._isOutsideSidePlanes(I,a))return;const h=I[0],f=I[1],l=I[2],u=I[3],{viewMatrix:d}=e,_=d[2]*h+d[6]*f+d[10]*l+d[14],m=_+u;if(!(-(_-u)<2||-m>=i.near))if(-m>this._looseRange.near)i.near=-m;else{if(u>g){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeNearBoundingInfoRec(e,t,r,i);return}}K.unionDepthRangeWithAABB(i,e.viewProjectionMatrix,r,t.bbMin,t.bbMax)}}_includeFarBoundingInfoRec(e,t,r,i){if(null==t)return;const s=t.center;n(o(I),s,r),I[3]=t.radius*c(r);const{frustum:a}=e;if(this._isOutsideSidePlanes(I,a))return;const[h,f,l,u]=I,{viewMatrix:d}=e,_=d[2]*h+d[6]*f+d[10]*l+d[14]-u;if(!(-_<=i.far))if(-_<this._looseRange.far)i.far=-_;else{if(u>g){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeFarBoundingInfoRec(e,t,r,i);return}}K.unionDepthRangeWithAABB(i,e.viewProjectionMatrix,r,t.bbMin,t.bbMax)}}}class x{constructor(){this._modelViewProj=r(),this._clipPosition=[s(),s(),s(),s(),s(),s(),s(),s()]}unionDepthRangeWithAABB(e,r,n,i,s){const a=this._modelViewProj;t(a,r,n);let o=!1;for(let t=0;t<8;++t){const e=this._clipPosition[t],r=0===t||3===t||4===t||7===t?i[0]:s[0],n=0===t||1===t||4===t||5===t?i[1]:s[1],o=t<4?i[2]:s[2];e[0]=a[0]*r+a[4]*n+a[8]*o+a[12],e[1]=a[1]*r+a[5]*n+a[9]*o+a[13],e[2]=a[2]*r+a[6]*n+a[10]*o+a[14],e[3]=a[3]*r+a[7]*n+a[11]*o+a[15]}for(let t=0;t<12;++t){const r=D(this._clipPosition[E[t][0]],this._clipPosition[E[t][1]],this._clipPosition[E[t][2]]);let n=!0;for(let e=0;e<r.length;++e){if(r[e][3]>=2){n=!1;break}}if(!n){o=!0;for(let t=0;t<r.length;++t){const n=r[t][3];Number.isFinite(n)&&(e.near=Math.min(n,e.near),e.far=Math.max(n,e.far))}}}return o}}function D(e,t,r){let n=[e,t,r];for(let i=0;i<4;++i){const e=n;n=[];for(let t=0;t<e.length;++t){const r=e[t],s=e[(t+1)%e.length];T(s,i)?(T(r,i)||n.push(F(r,s,i)),n.push(s)):T(r,i)&&n.push(F(r,s,i))}}return n}function T(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void d(!1)}function F(e,t,r){let n=0;return 0===r?n=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?n=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?n=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(n=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),i(s(),e,t,n)}const E=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],I=f(),N=r(),P=new l,y=new B,W=new S,K=new x;export{S as DepthRangeFromRenderGeometries,_ as DepthRangeMode,R as depthRangeFromScene};
5
+ import e from"../../../../core/PooledArray.js";import{multiply as t}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{t as n}from"../../../../chunks/vec32.js";import{l as i}from"../../../../chunks/vec42.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{intersectsSphere as a}from"../../../../geometry/support/frustum.js";import{a as o,g as h,c as f}from"../../../../chunks/sphere.js";import{maxScale as c}from"../../support/mathUtils.js";import{DepthRange as l}from"./DepthRange.js";import u from"./Octree.js";import{assert as d}from"./Util.js";var _;!function(e){e[e.SHADOW_CASTERS=0]="SHADOW_CASTERS",e[e.FULL_SCENE=1]="FULL_SCENE"}(_||(_={}));const m=1e4,g=100,p=500,b=500,C=.1;function R(e,t,r,n){let i=0;if(!t.some((e=>!!e.material&&(i+=e.numGeometries,i>=m))))return W.compute(e,t,n);const s=new l;return r.forAll((t=>s.union(w(e,t)))),s}function w(e,t){if(!t.visible)return;const r=new l,n=t.getSpatialQueryAccelerator();return n?O(r,e,n):A(r,e,t.objects),r}function O(e,t,r){const{eye:n,viewForward:i,frustum:s}=t,a=e=>e.visible,o=r.objectCount;if(o<p)P.set(t.near,Math.min(e.near,t.far)),r.forEachInDepthRange(n,i,u.DepthOrder.FRONT_TO_BACK,P,((r,n)=>{j(e,t,r),P.far=e.near,n.setRange(P)}),s,a),P.set(Math.max(e.far,t.near),t.far),r.forEachInDepthRange(n,i,u.DepthOrder.BACK_TO_FRONT,P,((r,n)=>{j(e,t,r),P.near=e.far,n.setRange(P)}),s,a);else{const n=Math.max(Math.min(o,b),Math.ceil(o*C)),h=r.findClosest(i,u.DepthOrder.FRONT_TO_BACK,s,a,n),f=r.findClosest(i,u.DepthOrder.BACK_TO_FRONT,s,a,n);h&&f&&(v(e,t,h.boundingVolumeWorldSpace.bounds),v(e,t,f.boundingVolumeWorldSpace.bounds))}}function A(e,t,r){y.clear(),r.forEach((e=>{e.visible&&0!==e.geometries.length&&y.add(e)})),y.empty||(y.sort(t),P.set(t.near,Math.min(e.near,t.far)),y.forEachInDepthRange(P,u.DepthOrder.FRONT_TO_BACK,((r,n)=>{n<e.near&&j(e,t,r)})),P.set(Math.max(e.far,t.near),t.far),y.forEachInDepthRange(P,u.DepthOrder.BACK_TO_FRONT,((t,r,n)=>{e.far=Math.max(e.far,n)})))}function j(e,r,n){if(!n.visible)return;if(!a(r.frustum,n.boundingVolumeWorldSpace.bounds))return;const i=n.transformation,s=N;n.geometries.forEach((n=>{t(s,i,n.transformation);const a=c(s);M(e,r,n.boundingInfo,s,a)}))}function M(e,t,r,i,s){if(null==r)return;n(o(I),r.center,i);const{eye:h,viewForward:f}=t,c=f[0]*(I[0]-h[0])+f[1]*(I[1]-h[1])+f[2]*(I[2]-h[2]);if(I[3]=r.radius*s,!(c-I[3]>e.near&&c+I[3]<e.far)&&a(t.frustum,I))if(r.radius>g&&r.getChildren())for(const n of r.getChildren())M(e,t,n,i,s);else K.unionDepthRangeWithAABB(e,t.viewProjectionMatrix,i,r.bbMin,r.bbMax)}function v(e,t,r){const n=t.eye,i=t.viewForward,s=(r[0]-n[0])*i[0]+(r[1]-n[1])*i[1]+(r[2]-n[2])*i[2];e.near=Math.min(e.near,s-r[3]),e.far=Math.max(e.far,s+r[3])}class B{constructor(){this._items=new e({allocator:e=>e||{object:null,distance:0,near:0,far:0},deallocator:e=>(e.object=null,e.distance=0,e.near=0,e.far=0,e)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(e){this._items.pushNew().object=e}sort(e){const t=e.eye,r=e.viewForward;this._items.forAll((e=>{const n=e.object.boundingVolumeWorldSpace.bounds,i=(n[0]-t[0])*r[0]+(n[1]-t[1])*r[1]+(n[2]-t[2])*r[2];e.distance=i,e.near=i-n[3],e.far=i+n[3]})),this._items.sort(((e,t)=>e.distance-t.distance))}forEachInDepthRange(e,t,r){if(t===u.DepthOrder.FRONT_TO_BACK)for(let n=0;n<this._items.length;++n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}else for(let n=this._items.length-1;n>=0;--n){const t=this._items.data[n];t.far<e.near||t.near>e.far||r(t.object,t.near,t.far)}}}class S{constructor(){this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange=new l(0,0)}compute(e,t,r){this._reset();const{viewMatrix:n}=e;t.forAll((e=>{e.forEachGeometry((e=>{if(!e.visible||r===_.SHADOW_CASTERS&&!e.castShadow)return;const t=e.boundingSphere,i=n[2]*t[0]+n[6]*t[1]+n[10]*t[2]+n[14],s=i-t[3],a=i+t[3];this._geometries.push(e),this._near.push(-a),this._far.push(-s)}))}));const i=new l;if(0===this._geometries.length)return i;for(let h=0;h<this._geometries.length;++h)this._near[h]>i.far&&(i.far=this._near[h]),this._near[h]>2&&this._far[h]<i.near&&(i.near=this._far[h]);const s=this._looseRange;s.near=Math.max(.5*i.near,2),s.far=2*i.far;let a=0,o=0;for(let h=0;h<this._geometries.length;++h)this._near[h]<i.near&&(this._near[h]>=s.near?i.near=this._near[h]:this._nearCandidates[a++]=h),this._far[h]>i.far&&(this._far[h]<=s.far?i.far=this._far[h]:this._farCandidates[o++]=h);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return i;this._nearCandidates.sort(((e,t)=>this._near[e]<this._near[t]?-1:this._near[e]>this._near[t]?1:0)),this._farCandidates.sort(((e,t)=>this._far[e]<this._far[t]?1:this._far[e]>this._far[t]?-1:0));for(let h=0;h<this._nearCandidates.length;++h){const t=this._nearCandidates[h];if(this._near[t]<i.near){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:s}=r;this._includeNearBoundingInfoRec(e,n,s,i)}}for(let h=0;h<this._farCandidates.length;++h){const t=this._farCandidates[h];if(this._far[t]>i.far){const r=this._geometries[t],{boundingInfo:n,shaderTransformation:s}=r;this._includeFarBoundingInfoRec(e,n,s,i)}}return this._reset(),i}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_isOutsideSidePlanes(e,t){const r=o(e),n=h(e);return t[0][0]*r[0]+t[0][1]*r[1]+t[0][2]*r[2]+t[0][3]>n||t[1][0]*r[0]+t[1][1]*r[1]+t[1][2]*r[2]+t[1][3]>n||t[2][0]*r[0]+t[2][1]*r[1]+t[2][2]*r[2]+t[2][3]>n||t[3][0]*r[0]+t[3][1]*r[1]+t[3][2]*r[2]+t[3][3]>n}_includeNearBoundingInfoRec(e,t,r,i){if(null==t)return;const s=t.center;n(o(I),s,r),I[3]=t.radius*c(r);const{frustum:a}=e;if(this._isOutsideSidePlanes(I,a))return;const h=I[0],f=I[1],l=I[2],u=I[3],{viewMatrix:d}=e,_=d[2]*h+d[6]*f+d[10]*l+d[14],m=_+u;if(!(-(_-u)<2||-m>=i.near))if(-m>this._looseRange.near)i.near=-m;else{if(u>g){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeNearBoundingInfoRec(e,t,r,i);return}}K.unionDepthRangeWithAABB(i,e.viewProjectionMatrix,r,t.bbMin,t.bbMax)}}_includeFarBoundingInfoRec(e,t,r,i){if(null==t)return;const s=t.center;n(o(I),s,r),I[3]=t.radius*c(r);const{frustum:a}=e;if(this._isOutsideSidePlanes(I,a))return;const[h,f,l,u]=I,{viewMatrix:d}=e,_=d[2]*h+d[6]*f+d[10]*l+d[14]-u;if(!(-_<=i.far))if(-_<this._looseRange.far)i.far=-_;else{if(u>g){const n=t.getChildren();if(void 0!==n){for(const t of n)this._includeFarBoundingInfoRec(e,t,r,i);return}}K.unionDepthRangeWithAABB(i,e.viewProjectionMatrix,r,t.bbMin,t.bbMax)}}}class x{constructor(){this._modelViewProj=r(),this._clipPosition=[s(),s(),s(),s(),s(),s(),s(),s()]}unionDepthRangeWithAABB(e,r,n,i,s){const a=this._modelViewProj;t(a,r,n);let o=!1;for(let t=0;t<8;++t){const e=this._clipPosition[t],r=0===t||3===t||4===t||7===t?i[0]:s[0],n=0===t||1===t||4===t||5===t?i[1]:s[1],o=t<4?i[2]:s[2];e[0]=a[0]*r+a[4]*n+a[8]*o+a[12],e[1]=a[1]*r+a[5]*n+a[9]*o+a[13],e[2]=a[2]*r+a[6]*n+a[10]*o+a[14],e[3]=a[3]*r+a[7]*n+a[11]*o+a[15]}for(let t=0;t<12;++t){const r=D(this._clipPosition[E[t][0]],this._clipPosition[E[t][1]],this._clipPosition[E[t][2]]);let n=!0;for(let e=0;e<r.length;++e){if(r[e][3]>=2){n=!1;break}}if(!n){o=!0;for(let t=0;t<r.length;++t){const n=r[t][3];Number.isFinite(n)&&(e.near=Math.min(n,e.near),e.far=Math.max(n,e.far))}}}return o}}function D(e,t,r){let n=[e,t,r];for(let i=0;i<4;++i){const e=n;n=[];for(let t=0;t<e.length;++t){const r=e[t],s=e[(t+1)%e.length];T(s,i)?(T(r,i)||n.push(F(r,s,i)),n.push(s)):T(r,i)&&n.push(F(r,s,i))}}return n}function T(e,t){return 0===t?e[0]>=-e[3]:1===t?e[1]>=-e[3]:2===t?e[0]<=e[3]:3===t?e[1]<=e[3]:void d(!1)}function F(e,t,r){let n=0;return 0===r?n=(-e[3]-e[0])/(t[0]-e[0]+t[3]-e[3]):1===r?n=(-e[3]-e[1])/(t[1]-e[1]+t[3]-e[3]):2===r?n=(e[3]-e[0])/(t[0]-e[0]-t[3]+e[3]):3===r&&(n=(e[3]-e[1])/(t[1]-e[1]-t[3]+e[3])),i(s(),e,t,n)}const E=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],I=f(),N=r(),P=new l,y=new B,W=new S,K=new x;export{S as DepthRangeFromRenderGeometries,_ as DepthRangeMode,R as depthRangeFromScene};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{p as e,i as r,c as t,n as s,d as a,l as i,h as o,f as n,q as l}from"../../../../chunks/vec32.js";import{ZEROS as c,create as m,fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{EmissiveSourceMode as h}from"../../../../symbols/support/materialUtils.js";import{ViewingMode as p}from"../../../ViewingMode.js";import{newLayout as d}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutputMRT as f,isShadowRelatedOutput as T,is3DGeometryOutput as v,ShaderOutput as x,isColorOrColorEmission as g,isColorEmission as b}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as S}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as O}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as M}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as y}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{CullFaceOptions as R,AlphaDiscardMode as A}from"../lib/basicInterfaces.js";import{GLTextureMaterial as I}from"../lib/GLTextureMaterial.js";import{Material as w}from"../lib/Material.js";import{OITPolygonOffsetLimit as P}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as j}from"../lib/RayIntersections.js";import{RenderSlot as E}from"../lib/RenderSlot.js";import{VertexAttribute as L}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as D}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as N}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as B}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as _,DefaultMaterialPassParameters as V}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as z}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as U}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as q}from"../../../../webscene/support/AlphaCutoff.js";class k extends w{constructor(e,r){super(e,G),this.materialType="default",this.supportsEdges=!0,this.produces=new Map([[E.OPAQUE_MATERIAL,e=>(f(e)||T(e))&&!this.transparent],[E.TRANSPARENT_MATERIAL,e=>(f(e)||T(e))&&this.transparent&&this.parameters.writeDepth],[E.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>(v(e)||T(e))&&this.transparent&&!this.parameters.writeDepth]]),this._vertexBufferLayout=H(this.parameters),this._configuration=new z(r.spherical)}isVisibleForOutput(e){return e!==x.Shadow&&e!==x.ShadowExcludeHighlight&&e!==x.ShadowHighlight||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:r,opacity:t,externalColor:s}=this.parameters;return e*("replace"===r?1:t)*("ignore"===r?1:s[3])>=q}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,c)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(this.parameters.emissiveSource===h.Emissive&&this._hasEmissiveBase||this.parameters.emissiveSource===h.Color)}getConfiguration(e,r){const{parameters:t,_configuration:s}=this,{treeRendering:a,doubleSided:i,doubleSidedType:o}=t;return super.getConfiguration(e,r,this._configuration),s.hasNormalTexture=!a&&!!t.normalTextureId,s.hasColorTexture=!!t.textureId,s.hasVertexTangents=!a&&t.hasVertexTangents,s.instanced=t.isInstanced,s.instancedDoublePrecision=t.instancedDoublePrecision,s.vvSize=!!t.vvSize,s.hasVerticalOffset=null!=t.verticalOffset,s.hasScreenSizePerspective=null!=t.screenSizePerspective,s.hasSlicePlane=t.hasSlicePlane,s.alphaDiscardMode=t.textureAlphaMode,s.normalType=a?S.Attribute:t.normalType,s.transparent=this.transparent,s.writeDepth=t.writeDepth,null!=t.customDepthTest&&(s.customDepthTest=t.customDepthTest),s.hasOccludees=r.hasOccludees,s.cullFace=t.hasSlicePlane?R.None:t.cullFace,s.cullAboveTerrain=r.cullAboveTerrain,s.hasModelTransformation=!a&&null!=t.modelTransformation,s.hasVertexColors=t.hasVertexColors,s.hasSymbolColors=t.hasSymbolColors,s.doubleSidedMode=a?M.WindingOrder:i&&"normal"===o?M.View:i&&"winding-order"===o?M.WindingOrder:M.None,s.instancedColor=t.hasInstancedColor,g(e)?(s.terrainDepthTest=r.terrainDepthTest,s.receiveShadows=t.receiveShadows,s.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=r.ssao):(s.terrainDepthTest=!1,s.receiveShadows=s.receiveAmbientOcclusion=!1),s.vvColor=!!t.vvColor,s.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,s.pbrMode=t.usePBR?t.isSchematic?y.Schematic:y.Normal:y.Disabled,s.hasMetallicRoughnessTexture=!a&&!!t.metallicRoughnessTextureId,s.emissionSource=a?O.None:null!=t.emissiveTextureId&&t.emissiveSource===h.Emissive?O.Texture:t.usePBR?t.emissiveSource===h.Emissive?O.EmissiveColor:O.SymbolColor:O.None,s.hasOcclusionTexture=!a&&!!t.occlusionTextureId,s.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),s.oitPass=r.oitPass,s.enableOffset=r.camera.relativeElevation<P,s.snowCover=r.snowCover,s.hasBloom=b(e),s.hasColorTextureTransform=!!t.colorTextureTransformMatrix,s.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,s.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,s.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,s.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix,s}intersect(e,c,m,u,h,d){if(null!=this.parameters.verticalOffset){const e=m.camera;r(Z,c[12],c[13],c[14]);let d=null;switch(m.viewingMode){case p.Global:d=s(K,Z);break;case p.Local:d=t(K,J)}let f=0;const T=a($,Z,e.eye),v=i(T),x=o(T,T,1/v);let g=null;this.parameters.screenSizePerspective&&(g=n(d,x)),f+=B(e,v,this.parameters.verticalOffset,g??0,this.parameters.screenSizePerspective),o(d,d,f),l(X,d,m.transform.inverseRotation),u=a(Q,u,X),h=a(Y,h,X)}j(e,m,u,h,D(m.verticalOffset),d)}createGLMaterial(e){return new W(e)}createBufferWriter(){return new N(this._vertexBufferLayout)}get transparent(){return F(this.parameters)}}class W extends I{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const s=e.camera.viewInverseTransposeMatrix;return r(t.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?U:_,e)}}class G extends V{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}}function H(e){const r=d().vec3f(L.POSITION);e.normalType===S.Compressed?r.vec2i16(L.NORMALCOMPRESSED,{glNormalized:!0}):r.vec3f(L.NORMAL),e.hasVertexTangents&&r.vec4f(L.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&r.vec2f16(L.UV0),e.hasVertexColors&&r.vec4u8(L.COLOR),e.hasSymbolColors&&r.vec4u8(L.SYMBOLCOLOR),C()&&r.vec4u8(L.OLIDCOLOR),r}function F(e){const{drivenOpacity:r,opacity:t,externalColor:[s,a,i,o],layerOpacity:n,texture:l,textureId:c,textureAlphaMode:m,colorMixMode:u}=e;return r||t<1&&"replace"!==u||o<1&&"ignore"!==u||n<1||(null!=l||null!=c)&&m!==A.Opaque&&m!==A.Mask&&"replace"!==u}const Q=m(),Y=m(),J=u(0,0,1),K=m(),X=m(),Z=m(),$=m();export{W as DefaultGLMaterial,k as DefaultMaterial,G as DefaultMaterialParameters,F as isTransparent};
5
+ import{p as e,i as r,c as t,n as s,d as a,l as i,h as o,f as n,q as l}from"../../../../chunks/vec32.js";import{ZEROS as c,create as m,fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{EmissiveSourceMode as h}from"../../../../symbols/support/materialUtils.js";import{ViewingMode as p}from"../../../ViewingMode.js";import{newLayout as d}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutputMRT as f,isShadowRelatedOutput as T,is3DGeometryOutput as v,ShaderOutput as x,isColorOrColorEmission as g,isColorEmission as b}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as S}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{EmissionSource as O}from"../core/shaderLibrary/output/Emissions.glsl.js";import{NormalsDoubleSidedMode as M}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as y}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{olidEnabled as C}from"../effects/geometry/olidUtils.js";import{DepthTestFunction as R,CullFaceOptions as A,AlphaDiscardMode as I}from"../lib/basicInterfaces.js";import{GLTextureMaterial as w}from"../lib/GLTextureMaterial.js";import{Material as P}from"../lib/Material.js";import{OITPolygonOffsetLimit as j}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as E}from"../lib/RayIntersections.js";import{RenderSlot as L}from"../lib/RenderSlot.js";import{VertexAttribute as D}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as N}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as B}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as _}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as V,DefaultMaterialPassParameters as z}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as U}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as q}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as k}from"../../../../webscene/support/AlphaCutoff.js";class W extends P{constructor(e,r){super(e,H),this.materialType="default",this.supportsEdges=!0,this.produces=new Map([[L.OPAQUE_MATERIAL,e=>(f(e)||T(e))&&!this.transparent],[L.TRANSPARENT_MATERIAL,e=>(f(e)||T(e))&&this.transparent&&this.parameters.writeDepth],[L.TRANSPARENT_MATERIAL_WITHOUT_DEPTH,e=>(v(e)||T(e))&&this.transparent&&!this.parameters.writeDepth]]),this._vertexBufferLayout=F(this.parameters),this._configuration=new U(r.spherical)}isVisibleForOutput(e){return e!==x.Shadow&&e!==x.ShadowExcludeHighlight&&e!==x.ShadowHighlight||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:r,opacity:t,externalColor:s}=this.parameters;return e*("replace"===r?1:t)*("ignore"===r?1:s[3])>=k}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,c)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(this.parameters.emissiveSource===h.Emissive&&this._hasEmissiveBase||this.parameters.emissiveSource===h.Color)}getConfiguration(e,r){const{parameters:t,_configuration:s}=this,{treeRendering:a,doubleSided:i,doubleSidedType:o}=t;return super.getConfiguration(e,r,this._configuration),s.hasNormalTexture=!a&&!!t.normalTextureId,s.hasColorTexture=!!t.textureId,s.hasVertexTangents=!a&&t.hasVertexTangents,s.instanced=t.isInstanced,s.instancedDoublePrecision=t.instancedDoublePrecision,s.vvSize=!!t.vvSize,s.hasVerticalOffset=null!=t.verticalOffset,s.hasScreenSizePerspective=null!=t.screenSizePerspective,s.hasSlicePlane=t.hasSlicePlane,s.alphaDiscardMode=t.textureAlphaMode,s.normalType=a?S.Attribute:t.normalType,s.transparent=this.transparent,s.writeDepth=t.writeDepth,s.customDepthTest=t.customDepthTest??R.Less,s.hasOccludees=r.hasOccludees,s.cullFace=t.hasSlicePlane?A.None:t.cullFace,s.cullAboveTerrain=r.cullAboveTerrain,s.hasModelTransformation=!a&&null!=t.modelTransformation,s.hasVertexColors=t.hasVertexColors,s.hasSymbolColors=t.hasSymbolColors,s.doubleSidedMode=a?M.WindingOrder:i&&"normal"===o?M.View:i&&"winding-order"===o?M.WindingOrder:M.None,s.instancedColor=t.hasInstancedColor,g(e)?(s.terrainDepthTest=r.terrainDepthTest,s.receiveShadows=t.receiveShadows,s.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=r.ssao):(s.terrainDepthTest=!1,s.receiveShadows=s.receiveAmbientOcclusion=!1),s.vvColor=!!t.vvColor,s.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,s.pbrMode=t.usePBR?t.isSchematic?y.Schematic:y.Normal:y.Disabled,s.hasMetallicRoughnessTexture=!a&&!!t.metallicRoughnessTextureId,s.emissionSource=a?O.None:null!=t.emissiveTextureId&&t.emissiveSource===h.Emissive?O.Texture:t.usePBR?t.emissiveSource===h.Emissive?O.EmissiveColor:O.SymbolColor:O.None,s.hasOcclusionTexture=!a&&!!t.occlusionTextureId,s.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),s.oitPass=r.oitPass,s.enableOffset=r.camera.relativeElevation<j,s.snowCover=r.snowCover,s.hasBloom=b(e),s.hasColorTextureTransform=!!t.colorTextureTransformMatrix,s.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,s.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,s.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,s.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix,s}intersect(e,c,m,u,h,d){if(null!=this.parameters.verticalOffset){const e=m.camera;r($,c[12],c[13],c[14]);let d=null;switch(m.viewingMode){case p.Global:d=s(X,$);break;case p.Local:d=t(X,K)}let f=0;const T=a(ee,$,e.eye),v=i(T),x=o(T,T,1/v);let g=null;this.parameters.screenSizePerspective&&(g=n(d,x)),f+=_(e,v,this.parameters.verticalOffset,g??0,this.parameters.screenSizePerspective),o(d,d,f),l(Z,d,m.transform.inverseRotation),u=a(Y,u,Z),h=a(J,h,Z)}E(e,m,u,h,N(m.verticalOffset),d)}createGLMaterial(e){return new G(e)}createBufferWriter(){return new B(this._vertexBufferLayout)}get transparent(){return Q(this.parameters)}}class G extends w{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const s=e.camera.viewInverseTransposeMatrix;return r(t.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?q:V,e)}}class H extends z{constructor(){super(...arguments),this.treeRendering=!1,this.hasVertexTangents=!1}}function F(e){const r=d().vec3f(D.POSITION);e.normalType===S.Compressed?r.vec2i16(D.NORMALCOMPRESSED,{glNormalized:!0}):r.vec3f(D.NORMAL),e.hasVertexTangents&&r.vec4f(D.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&r.vec2f16(D.UV0),e.hasVertexColors&&r.vec4u8(D.COLOR),e.hasSymbolColors&&r.vec4u8(D.SYMBOLCOLOR),C()&&r.vec4u8(D.OLIDCOLOR),r}function Q(e){const{drivenOpacity:r,opacity:t,externalColor:[s,a,i,o],layerOpacity:n,texture:l,textureId:c,textureAlphaMode:m,colorMixMode:u}=e;return r||t<1&&"replace"!==u||o<1&&"ignore"!==u||n<1||(null!=l||null!=c)&&m!==I.Opaque&&m!==I.Mask&&"replace"!==u}const Y=m(),J=m(),K=u(0,0,1),X=m(),Z=m(),$=m(),ee=m();export{G as DefaultGLMaterial,W as DefaultMaterial,H as DefaultMaterialParameters,Q as isTransparent};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutput.js";import{WaterDistortionPassParameters as e}from"../core/shaderLibrary/shading/WaterDistortion.glsl.js";import{ReloadableShaderModule as t}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as s}from"../core/shaderTechnique/ShaderTechnique.js";import{OITPass as o}from"../lib/OITPass.js";import{blending as a,oitDepthTest as n,depthWrite as i,getDrawBuffers as l,getOITPolygonOffset as d}from"../lib/OrderIndependentTransparency.js";import{W as p}from"../../../../chunks/WaterSurface.glsl.js";import{makePipelineState as c,defaultColorWrite as u}from"../../../webgl/renderState.js";class m extends e{}class f extends s{constructor(r,e){super(r,e,new t(p,(()=>import("../shaders/WaterSurface.glsl.js"))))}initializePipeline(e){const{oitPass:t,output:s,transparent:p,draped:m,enableOffset:f}=e,h=t===o.NONE,j=t===o.FrontFace;return c({blending:s!==r.Normal&&s!==r.Highlight&&s!==r.ObjectAndLayerIdColor&&p?a(t):null,depthTest:m?null:{func:n(t)},depthWrite:i(e),drawBuffers:l(t,s),colorWrite:u,polygonOffset:h||j?null:d(f)})}}export{m as WaterMaterialPassParameters,f as WaterTechnique};
5
+ import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutput.js";import{WaterDistortionPassParameters as e}from"../core/shaderLibrary/shading/WaterDistortion.glsl.js";import{ReloadableShaderModule as t}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as s}from"../core/shaderTechnique/ShaderTechnique.js";import{blending as o,oitDepthTest as a,depthWrite as i,getDrawBuffers as n,oitPolygonOffset as d}from"../lib/OrderIndependentTransparency.js";import{W as l}from"../../../../chunks/WaterSurface.glsl.js";import{makePipelineState as p,defaultColorWrite as c}from"../../../webgl/renderState.js";class u extends e{}class h extends s{constructor(r,e){super(r,e,new t(l,(()=>import("../shaders/WaterSurface.glsl.js"))))}initializePipeline(e){const{oitPass:t,output:s,transparent:l,draped:u}=e;return p({blending:s!==r.Normal&&s!==r.Highlight&&s!==r.ObjectAndLayerIdColor&&l?o(t):null,depthTest:u?null:{func:a(t)},depthWrite:i(e),drawBuffers:n(t,s),colorWrite:c,polygonOffset:d(e)})}}export{u as WaterMaterialPassParameters,h as WaterTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import"../../../../core/has.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as n}from"../../../../chunks/sphere.js";import{ContentObjectType as s}from"../lib/ContentObjectType.js";import{GridLocalOriginFactory as a}from"../lib/GridLocalOriginFactory.js";import c from"../lib/ModelDirtySet.js";import{RenderGeometry as d}from"../lib/RenderGeometry.js";import{assert as m}from"../lib/Util.js";import{isWebGLLayer as l}from"../lib/WebGLLayer.js";let h=class extends e{constructor(){super(...arguments),this.dirtySet=new c({model:this}),this._content=new Map,this._originFactory=new a(null)}getObject(t){return this._content.get(t)}add(t){const e=t.id;m(!this._content.has(e),"Model/Stage already contains object to be added"),this._content.set(e,t),l(t)&&this.dirtySet.layerAdded(t)}remove(t){return!!this._content.has(t.id)&&(this._content.delete(t.id),l(t)&&this.dirtySet.layerRemoved(t),!0)}addMany(t){for(const e of t)e&&(m(!this._content.has(e.id),"Model/Stage already contains object to be added"),this._content.set(e.id,e))}removeMany(t){for(const e of t)e&&(m(this._content.has(e.id),"Model/Stage doesn't contain object to be removed"),this._content.delete(e.id))}has(t){return this._content.has(t.id)}forEachOfType(t,e){this._content.forEach((o=>{o.type===t&&e(o)}))}getRenderGeometry(t,e){const o=new d(e,{castShadow:t.castShadow,objectShaderTransformation:t.shaderTransformation}),r=e.localOrigin;return o.transformation=t.getCombinedStaticTransformation(e,p),o.localOrigin=r??this._originFactory.getOrigin(n(o.boundingSphere)),o}updateRenderGeometryTransformation(t,e,o){if(null==t)return!1;o.transformation=t.getCombinedStaticTransformation(e,p);const r=this._originFactory.getOrigin(n(o.boundingSphere));return o.localOrigin!==r}getStats(){const t={},e=Array.from(this._content.values());for(let o=0;o<s.COUNT;++o)t[o]=e.filter((t=>t.type===o)).length;return{contentTypes:t,dirtySet:this.dirtySet.formatDebugInfo()}}get test(){}};t([o({constructOnly:!0})],h.prototype,"dirtySet",void 0),h=t([r("esri.views.3d.webgl-engine.parts.Model")],h);const p=i();export{h as Model};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../core/Accessor.js";import"../../../../core/has.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as i}from"../../../../chunks/sphere.js";import{ContentObjectType as s}from"../lib/ContentObjectType.js";import{GridLocalOriginFactory as a}from"../lib/GridLocalOriginFactory.js";import c from"../lib/ModelDirtySet.js";import{RenderGeometry as d}from"../lib/RenderGeometry.js";import{assert as m}from"../lib/Util.js";let l=class extends e{constructor(){super(...arguments),this.dirtySet=new c({model:this}),this._content=new Map,this._originFactory=new a(null)}getObject(t){return null==t?null:this._content.get(t)}add(t){const e=t.id;m(!this._content.has(e),"Model/Stage already contains object to be added"),this._content.set(e,t)}remove(t){return this._content.delete(t.id)}addMany(t){for(const e of t)e&&(m(!this._content.has(e.id),"Model/Stage already contains object to be added"),this._content.set(e.id,e))}removeMany(t){for(const e of t)e&&(m(this._content.has(e.id),"Model/Stage doesn't contain object to be removed"),this._content.delete(e.id))}has(t){return this._content.has(t.id)}forEachOfType(t,e){this._content.forEach((o=>{o.type===t&&e(o)}))}getRenderGeometry(t,e){const o=new d(e,{castShadow:t.castShadow,objectShaderTransformation:t.shaderTransformation}),r=e.localOrigin;return o.transformation=t.getCombinedStaticTransformation(e,h),o.localOrigin=r??this._originFactory.getOrigin(i(o.boundingSphere)),o}updateRenderGeometryTransformation(t,e,o){if(null==t)return!1;o.transformation=t.getCombinedStaticTransformation(e,h);const r=this._originFactory.getOrigin(i(o.boundingSphere));return o.localOrigin!==r}getStats(){const t={},e=Array.from(this._content.values());for(let o=0;o<s.COUNT;++o)t[o]=e.filter((t=>t.type===o)).length;return{contentTypes:t,dirtySet:this.dirtySet.formatDebugInfo()}}get test(){}};t([o({constructOnly:!0})],l.prototype,"dirtySet",void 0),l=t([r("esri.views.3d.webgl-engine.parts.Model")],l);const h=n();export{l as Model};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{ZEROS as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColorOrColorEmission as r,ShaderOutput as t}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShaderModule as s}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as i}from"../core/shaderTechnique/ShaderTechnique.js";import{OITPass as l}from"../lib/OITPass.js";import{blending as o,oitDepthTest as n,depthWrite as a,getDrawBuffers as c,getOITPolygonOffset as p}from"../lib/OrderIndependentTransparency.js";import{stencilWriteMaskOn as u,stencilToolMaskBaseParams as m,stencilBaseAllZerosParams as f}from"../lib/StencilUtils.js";import{VisualVariablePassParameters as d}from"../materials/VisualVariablePassParameters.js";import{C as h}from"../../../../chunks/ColorMaterial.glsl.js";import{SpecialDrawBuffers as b}from"../../../webgl/enums.js";import{makePipelineState as j,cullingParams as P,defaultColorWrite as g}from"../../../webgl/renderState.js";class O extends d{constructor(){super(...arguments),this.color=e}}class S extends i{constructor(e,r){super(e,r,new s(h,(()=>import("./ColorMaterial.glsl.js"))))}_createPipeline(e,s){const{oitPass:i,output:d,transparent:h,cullFace:O,draped:S,hasOccludees:_,polygonOffset:w,enableOffset:x}=e,y=i===l.NONE,N=i===l.FrontFace;return j({blending:r(d)&&h?o(i):null,culling:P(O),depthTest:S?null:{func:n(i)},depthWrite:a(e),drawBuffers:d===t.Depth?{buffers:[b.NONE]}:c(i,d),colorWrite:g,stencilWrite:_?u:null,stencilTest:_?s?m:f:null,polygonOffset:y||N?w?T:null:p(x)})}initializePipeline(e){return this._occludeePipelineState=this._createPipeline(e,!0),this._createPipeline(e,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}}const T={factor:1,units:1};export{O as ColorMaterialPassParameters,S as ColorMaterialTechnique};
5
+ import{ZEROS as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColorOrColorEmission as r,ShaderOutput as t}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShaderModule as i}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as s}from"../core/shaderTechnique/ShaderTechnique.js";import{OITPass as l}from"../lib/OITPass.js";import{blending as o,oitDepthTest as n,depthWrite as a,getDrawBuffers as c,oitPolygonOffset as p}from"../lib/OrderIndependentTransparency.js";import{stencilWriteMaskOn as u,stencilToolMaskBaseParams as m,stencilBaseAllZerosParams as d}from"../lib/StencilUtils.js";import{VisualVariablePassParameters as f}from"../materials/VisualVariablePassParameters.js";import{C as h}from"../../../../chunks/ColorMaterial.glsl.js";import{SpecialDrawBuffers as j}from"../../../webgl/enums.js";import{makePipelineState as P,cullingParams as b,defaultColorWrite as g}from"../../../webgl/renderState.js";class O extends f{constructor(){super(...arguments),this.color=e}}class S extends s{constructor(e,r){super(e,r,new i(h,(()=>import("./ColorMaterial.glsl.js"))))}_createPipeline(e,i){const{oitPass:s,output:f,transparent:h,cullFace:O,draped:S,hasOccludees:_,polygonOffset:w}=e,x=s===l.NONE;return P({blending:r(f)&&h?o(s):null,culling:b(O),depthTest:S?null:{func:n(s)},depthWrite:a(e),drawBuffers:f===t.Depth?{buffers:[j.NONE]}:c(s,f),colorWrite:g,stencilWrite:_?u:null,stencilTest:_?i?m:d:null,polygonOffset:x?w?T:null:p(e)})}initializePipeline(e){return this._occludeePipelineState=this._createPipeline(e,!0),this._createPipeline(e,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}}const T={factor:1,units:1};export{O as ColorMaterialPassParameters,S as ColorMaterialTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{ZEROS as e,freeze as t,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{EmissiveSourceMode as r}from"../../../../symbols/support/materialUtils.js";import{isColorOrColorEmission as l,ShaderOutput as o}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as a}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{VertexNormalPassParameters as n,VertexNormalDrawParameters as c}from"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import{ReloadableShaderModule as h}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as u}from"../core/shaderTechnique/ShaderTechnique.js";import{CullFaceOptions as m,DepthTestFunction as p,AlphaDiscardMode as d}from"../lib/basicInterfaces.js";import{RenderOccludedFlag as f}from"../lib/Material.js";import{OITPass as b}from"../lib/OITPass.js";import{blending as S,oitDepthTest as j,depthWrite as g,getDrawBuffers as v,getOITPolygonOffset as y}from"../lib/OrderIndependentTransparency.js";import{stencilWriteMaskOn as P,stencilToolMaskBaseParams as O,stencilBaseAllZerosParams as x}from"../lib/StencilUtils.js";import{advancedMRRFactors as T}from"../materials/pbrUtils.js";import{D}from"../../../../chunks/DefaultMaterial.glsl.js";import{SpecialDrawBuffers as M,CompareFunction as A}from"../../../webgl/enums.js";import{makePipelineState as C,cullingParams as L,defaultColorWrite as w}from"../../../webgl/renderState.js";import{alphaCutoff as N}from"../../../../webscene/support/AlphaCutoff.js";class k extends n{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=T,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=m.Back,this.isInstanced=!1,this.hasInstancedColor=!1,this.emissiveStrength=0,this.emissiveSource=r.Color,this.emissiveBaseColor=e,this.instancedDoublePrecision=!1,this.normalType=a.Attribute,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.ambient=t(.2,.2,.2),this.diffuse=t(.8,.8,.8),this.externalColor=s(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=i(),this.hasSlicePlane=!1,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.modelTransformation=null,this.drivenOpacity=!1,this.writeDepth=!0,this.customDepthTest=p.Less,this.textureAlphaMode=d.Blend,this.textureAlphaCutoff=N,this.textureAlphaPremultiplied=!1,this.renderOccluded=f.Occlude,this.isDecoration=!1}}class B extends c{constructor(){super(...arguments),this.origin=i(),this.slicePlaneLocalOrigin=this.origin}}class F extends u{constructor(e,t,i=new h(D,(()=>import("./DefaultMaterial.glsl.js")))){super(e,t,i),this.type="DefaultMaterialTechnique"}_makePipeline(e,t){const{oitPass:i,output:s,transparent:r,cullFace:a,customDepthTest:n,hasOccludees:c,enableOffset:h}=e,u=i===b.NONE,m=i===b.FrontFace;return C({blending:l(s)&&r?S(i):null,culling:I(e)?L(a):null,depthTest:{func:j(i,q(n))},depthWrite:g(e),drawBuffers:s===o.Depth?{buffers:[M.NONE]}:v(i,s),colorWrite:w,stencilWrite:c?P:null,stencilTest:c?t?O:x:null,polygonOffset:u||m?null:y(h)})}initializePipeline(e){return this._occludeePipelineState=this._makePipeline(e,!0),this._makePipeline(e,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}}function q(e){return e===p.Lequal?A.LEQUAL:A.LESS}function I(e){return e.cullFace!==m.None||!e.hasSlicePlane&&(!e.transparent&&!e.doubleSidedMode)}export{B as DefaultMaterialDrawParameters,k as DefaultMaterialPassParameters,F as DefaultMaterialTechnique};
5
+ import{ZEROS as e,freeze as t,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{EmissiveSourceMode as r}from"../../../../symbols/support/materialUtils.js";import{isColorOrColorEmission as l,ShaderOutput as o}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as a}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{VertexNormalPassParameters as n,VertexNormalDrawParameters as c}from"../core/shaderLibrary/attributes/VertexNormal.glsl.js";import{ReloadableShaderModule as h}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as u}from"../core/shaderTechnique/ShaderTechnique.js";import{CullFaceOptions as m,DepthTestFunction as p,AlphaDiscardMode as d}from"../lib/basicInterfaces.js";import{RenderOccludedFlag as f}from"../lib/Material.js";import{blending as b,oitDepthTest as S,depthWrite as g,getDrawBuffers as j,oitPolygonOffset as v}from"../lib/OrderIndependentTransparency.js";import{stencilWriteMaskOn as y,stencilToolMaskBaseParams as P,stencilBaseAllZerosParams as x}from"../lib/StencilUtils.js";import{advancedMRRFactors as T}from"../materials/pbrUtils.js";import{D as O}from"../../../../chunks/DefaultMaterial.glsl.js";import{SpecialDrawBuffers as D,CompareFunction as M}from"../../../webgl/enums.js";import{makePipelineState as A,cullingParams as C,defaultColorWrite as L}from"../../../webgl/renderState.js";import{alphaCutoff as w}from"../../../../webscene/support/AlphaCutoff.js";class k extends n{constructor(){super(...arguments),this.isSchematic=!1,this.usePBR=!1,this.mrrFactors=T,this.hasVertexColors=!1,this.hasSymbolColors=!1,this.doubleSided=!1,this.doubleSidedType="normal",this.cullFace=m.Back,this.isInstanced=!1,this.hasInstancedColor=!1,this.emissiveStrength=0,this.emissiveSource=r.Color,this.emissiveBaseColor=e,this.instancedDoublePrecision=!1,this.normalType=a.Attribute,this.receiveShadows=!0,this.receiveAmbientOcclusion=!0,this.castShadows=!0,this.ambient=t(.2,.2,.2),this.diffuse=t(.8,.8,.8),this.externalColor=s(1,1,1,1),this.colorMixMode="multiply",this.opacity=1,this.layerOpacity=1,this.origin=i(),this.hasSlicePlane=!1,this.offsetTransparentBackfaces=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.modelTransformation=null,this.drivenOpacity=!1,this.writeDepth=!0,this.customDepthTest=p.Less,this.textureAlphaMode=d.Blend,this.textureAlphaCutoff=w,this.textureAlphaPremultiplied=!1,this.renderOccluded=f.Occlude,this.isDecoration=!1}}class B extends c{constructor(){super(...arguments),this.origin=i(),this.slicePlaneLocalOrigin=this.origin}}class q extends u{constructor(e,t,i=new h(O,(()=>import("./DefaultMaterial.glsl.js")))){super(e,t,i),this.type="DefaultMaterialTechnique"}_makePipeline(e,t){const{oitPass:i,output:s,transparent:r,cullFace:a,customDepthTest:n,hasOccludees:c}=e;return A({blending:l(s)&&r?b(i):null,culling:_(e)?C(a):null,depthTest:{func:S(i,N(n))},depthWrite:g(e),drawBuffers:s===o.Depth?{buffers:[D.NONE]}:j(i,s),colorWrite:L,stencilWrite:c?y:null,stencilTest:c?t?P:x:null,polygonOffset:v(e)})}initializePipeline(e){return this._occludeePipelineState=this._makePipeline(e,!0),this._makePipeline(e,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}}function N(e){return e===p.Lequal?M.LEQUAL:M.LESS}function _(e){return e.cullFace!==m.None||!e.hasSlicePlane&&(!e.transparent&&!e.doubleSidedMode)}export{B as DefaultMaterialDrawParameters,k as DefaultMaterialPassParameters,q as DefaultMaterialTechnique};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{isColorOrColorEmission as e}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShaderModule as t}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../core/shaderTechnique/ShaderTechnique.js";import{OITPass as i}from"../lib/OITPass.js";import{oitBlending as l,oitDepthTest as s,depthWrite as n,getDrawBuffers as o,getOITPolygonOffset as a}from"../lib/OrderIndependentTransparency.js";import{stencilWriteMaskOn as p,stencilToolMaskBaseParams as c,stencilBaseAllZerosParams as u}from"../lib/StencilUtils.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{I as d}from"../../../../chunks/ImageMaterial.glsl.js";import{makePipelineState as h,premultipliedAlpha as f,cullingParams as g,defaultColorWrite as P}from"../../../webgl/renderState.js";class b extends r{constructor(e,r){super(e,r,new t(d,(()=>import("./ImageMaterial.glsl.js"))),j)}_getPipelineState(t,r){const{oitPass:m,output:d,hasOccludees:b,enableOffset:j,cullFace:I}=t,S=m===i.NONE,O=m===i.FrontFace;return h({blending:e(d)?S?f:l(m):null,culling:g(I),depthTest:{func:s(m)},depthWrite:n(t),drawBuffers:o(m,d),colorWrite:P,stencilWrite:b?p:null,stencilTest:b?r?c:u:null,polygonOffset:S||O?null:a(j)})}initializePipeline(e){return this._occludeePipeline=this._getPipelineState(e,!0),this._getPipelineState(e,!1)}getPipeline(e){return e?this._occludeePipeline:super.getPipeline()}}const j=new Map([[m.POSITION,0],[m.UV0,2],[m.PERSPECTIVEDIVIDE,3]]);export{b as ImageMaterialTechnique,j as vertexAttributeLocations};
5
+ import{isColorOrColorEmission as e}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShaderModule as t}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as r}from"../core/shaderTechnique/ShaderTechnique.js";import{OITPass as i}from"../lib/OITPass.js";import{oitBlending as l,oitDepthTest as s,depthWrite as n,getDrawBuffers as o,oitPolygonOffset as a}from"../lib/OrderIndependentTransparency.js";import{stencilWriteMaskOn as p,stencilToolMaskBaseParams as c,stencilBaseAllZerosParams as u}from"../lib/StencilUtils.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{I as d}from"../../../../chunks/ImageMaterial.glsl.js";import{makePipelineState as h,premultipliedAlpha as f,cullingParams as g,defaultColorWrite as P}from"../../../webgl/renderState.js";class j extends r{constructor(e,r){super(e,r,new t(d,(()=>import("./ImageMaterial.glsl.js"))),I)}_getPipelineState(t,r){const{oitPass:m,output:d,hasOccludees:j,cullFace:I}=t,S=m===i.NONE;return h({blending:e(d)?S?f:l(m):null,culling:g(I),depthTest:{func:s(m)},depthWrite:n(t),drawBuffers:o(m,d),colorWrite:P,stencilWrite:j?p:null,stencilTest:j?r?c:u:null,polygonOffset:a(t)})}initializePipeline(e){return this._occludeePipeline=this._getPipelineState(e,!0),this._getPipelineState(e,!1)}getPipeline(e){return e?this._occludeePipeline:super.getPipeline()}}const I=new Map([[m.POSITION,0],[m.UV0,2],[m.PERSPECTIVEDIVIDE,3]]);export{j as ImageMaterialTechnique,I as vertexAttributeLocations};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{isColorOrColorEmission as e,ShaderOutput as t}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShaderModule as r}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as i}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as s}from"../effects/geometry/olidUtils.js";import{OITPass as l}from"../lib/OITPass.js";import{blending as n,oitDepthTest as o,depthWrite as p,getDrawBuffers as a,getOITPolygonOffset as u}from"../lib/OrderIndependentTransparency.js";import{stencilWriteMaskOn as c,stencilToolMaskBaseParams as O,stencilBaseAllZerosParams as f}from"../lib/StencilUtils.js";import{VertexAttribute as m}from"../lib/VertexAttribute.js";import{P as d}from"../../../../chunks/Pattern.glsl.js";import{SpecialDrawBuffers as P}from"../../../webgl/enums.js";import{makePipelineState as T,cullingParams as h,defaultColorWrite as S}from"../../../webgl/renderState.js";class b extends i{constructor(e,t){super(e,t,new r(d,(()=>import("./Pattern.glsl.js"))),s()?R:E)}_setPipelineState(r,i){const{oitPass:s,output:m,cullFace:d,draped:b,hasOccludees:E,polygonOffset:R,enableOffset:g}=r,I=s===l.NONE,N=s===l.FrontFace;return T({blending:e(m)?n(s):null,culling:h(d),depthTest:b?null:{func:o(s)},depthWrite:p(r),drawBuffers:m===t.Depth?{buffers:[P.NONE]}:a(s,m),colorWrite:S,stencilWrite:E?c:null,stencilTest:E?i?O:f:null,polygonOffset:I||N?R?j:null:u(g)})}initializePipeline(e){return this._occludeePipelineState=this._setPipelineState(e,!0),this._setPipelineState(e,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}}const j={factor:1,units:1},E=new Map([[m.POSITION,0],[m.COLOR,3],[m.UVMAPSPACE,4],[m.COLORFEATUREATTRIBUTE,5],[m.BOUNDINGRECT,6]]),R=new Map([[m.POSITION,0],[m.COLOR,3],[m.UVMAPSPACE,4],[m.COLORFEATUREATTRIBUTE,5],[m.BOUNDINGRECT,6],[m.OLIDCOLOR,9]]);export{b as PatternTechnique,E as vertexAttributeLocations,R as vertexAttributeLocationsOID};
5
+ import{isColorOrColorEmission as e,ShaderOutput as t}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShaderModule as r}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as i}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as s}from"../effects/geometry/olidUtils.js";import{OITPass as l}from"../lib/OITPass.js";import{blending as n,oitDepthTest as o,depthWrite as p,getDrawBuffers as a,oitPolygonOffset as u}from"../lib/OrderIndependentTransparency.js";import{stencilWriteMaskOn as c,stencilToolMaskBaseParams as m,stencilBaseAllZerosParams as O}from"../lib/StencilUtils.js";import{VertexAttribute as d}from"../lib/VertexAttribute.js";import{P as f}from"../../../../chunks/Pattern.glsl.js";import{SpecialDrawBuffers as P}from"../../../webgl/enums.js";import{makePipelineState as T,cullingParams as h,defaultColorWrite as S}from"../../../webgl/renderState.js";class j extends i{constructor(e,t){super(e,t,new r(f,(()=>import("./Pattern.glsl.js"))),s()?b:R)}_setPipelineState(r,i){const{oitPass:s,output:d,cullFace:f,draped:j,hasOccludees:R,polygonOffset:b}=r,g=s===l.NONE;return T({blending:e(d)?n(s):null,culling:h(f),depthTest:j?null:{func:o(s)},depthWrite:p(r),drawBuffers:d===t.Depth?{buffers:[P.NONE]}:a(s,d),colorWrite:S,stencilWrite:R?c:null,stencilTest:R?i?m:O:null,polygonOffset:g?b?E:null:u(r)})}initializePipeline(e){return this._occludeePipelineState=this._setPipelineState(e,!0),this._setPipelineState(e,!1)}getPipeline(e){return e?this._occludeePipelineState:super.getPipeline()}}const E={factor:1,units:1},R=new Map([[d.POSITION,0],[d.COLOR,3],[d.UVMAPSPACE,4],[d.COLORFEATUREATTRIBUTE,5],[d.BOUNDINGRECT,6]]),b=new Map([[d.POSITION,0],[d.COLOR,3],[d.UVMAPSPACE,4],[d.COLORFEATUREATTRIBUTE,5],[d.BOUNDINGRECT,6],[d.OLIDCOLOR,9]]);export{j as PatternTechnique,R as vertexAttributeLocations,b as vertexAttributeLocationsOID};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../chunks/tslib.es6.js";import{difference as t,isSome as s}from"../core/arrayUtils.js";import o from"../core/Collection.js";import{referenceSetter as i}from"../core/collectionUtils.js";import n from"../core/Evented.js";import{getOrCreateMapValue as r}from"../core/MapUtils.js";import{removeMaybe as l}from"../core/maybe.js";import c from"../core/ReactiveMap.js";import{watch as a,on as h}from"../core/reactiveUtils.js";import{symmetricDifference as u}from"../core/SetUtils.js";import{property as d}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import"../core/Logger.js";import{subclass as p}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeSublayer as f,isKnowledgeGraphLayer as g,isMapImageLayer as m,isSubtypeGroupLayer as _}from"../layers/support/layerUtils.js";import y from"../rest/support/Query.js";import{isSelectableLayer as v}from"./support/selectionUtils.js";let w=class extends n.EventedAccessor{constructor(e){super(e),this._selectionMap=new c,this._sources=new o,this._trashCan=[],this._layerEditHandles=new o,this._vizTaskId=0,this.showHighlight=!0,this.highlightName="default"}initialize(){this.addHandles([a((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),h((()=>this.sources),"change",(e=>{const t=this._selectionMap;for(const s of e.removed)t.delete(s);this._refreshListeners(),this._refreshVisualization()}),{onListenerAdd:()=>this._refreshListeners()})]),this.view.when().then((()=>this.syncSources()))}destroy(){this._layerEditHandles.drain(l)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._sources}set sources(e){i(e,this._sources)}syncSources(){const e=new Set,{map:t}=this.view;if(!t)return;const s=t=>{g(t)?(t.layers?.forEach(s),t.tables?.forEach(s)):m(t)?(t.sublayers?.forEach(s),t.subtables?.forEach(s)):_(t)?t.sublayers?.forEach(s):v(t)&&e.add(t)};t.allLayers.forEach(s),t.allTables.forEach(s),this.sources=[...e]}async getSelectedFeatures(e,t={},s="layerView"){const{view:o,selections:i}=this,n=(void 0!==e?i.filter((t=>e.includes(t.layer))):i).filter((e=>e.selection.length>0)).map((async e=>{const{layer:i,selection:n}=e,r=f(i)?i.parent:i;if(null==r||!b(r))return null;if("layer"===s)return E(r,n,t);if(S(r))return null;const l=await o.whenLayerView(r).catch((()=>null));return l?E(l,n,t):null}));return(await Promise.all(n)).filter((e=>null!=e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let o=!1;const i=e.current.concat(e.added);for(const t of i){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(v(e)||f(e))&&null!==i){const t=r(s,e,(()=>[]));t.includes(i)||(t.push(i),o=!0)}}for(const t of e.removed){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(v(e)||f(e))&&null!==i){const t=s.get(e),n=t?.indexOf(i);void 0!==n&&n>=0&&(t?.splice(n,1),o=!0)}}if(o){const{_selectionMap:e,_trashCan:o}=this,i=[];for(const[n,r]of s){const s=e.get(n);void 0!==s&&o.push(s),e.set(n,{selection:r}),i.push({layer:n,selection:r,...t(void 0!==s?s.selection:[],r)})}this._onSelectionChange(i)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),o=void 0!==s?[...s.selection]:[];for(const i of t)o.includes(i)||o.push(i);this._setSelection(e,o)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const o=[];for(const i of s.selection)t.includes(i)||o.push(i);this._setSelection(e,o)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const o=new Set(s.selection),i=new Set(t),n=u(o,i);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,o]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...o.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){if(null==this.view||null==this.sources)return;for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{sources:e,view:t,_selectionMap:s,showHighlight:o}=this,i=this._vizTaskId;for(const n of e){const e=s.get(n),r=f(n)?n.parent:n;if(null!=r&&b(r)){if(S(r))continue;t.whenLayerView(r).then((t=>{e?.highlightHandle?.remove(),null!=e&&o&&i===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,this.highlightName))})).catch((()=>{e?.highlightHandle?.remove()}))}}}_refreshListeners(){this._layerEditHandles.drain(l);for(const e of this.sources){const t=f(e)?e.parent:e;if(null!=t&&v(t)&&"on"in t&&t.on){const s=t.on("edits",(t=>{this._handleEditChanges(t,e)}));this._layerEditHandles.push(s)}}}_handleEditChanges(e,t){if(void 0!==e.deletedFeatures&&e.deletedFeatures.length>0&&this._selectionMap.has(t)){const o=e.deletedFeatures.filter((e=>null==e.error)).map((e=>e.objectId)).filter(s);this.removeFromSelection(t,o)}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const o=this._selectionMap.get(e);if(void 0===o||!M(o,{selection:s})){void 0!==o&&this._trashCan.push(o),this._selectionMap.set(e,{selection:[...s]});const i={layer:e,selection:[...s],...t(void 0!==o?o.selection:[],s)};this._onSelectionChange([i])}}};e([d({readOnly:!0,nonNullable:!0})],w.prototype,"selections",null),e([d({readOnly:!0,nonNullable:!0})],w.prototype,"count",null),e([d({constructOnly:!0,nonNullable:!0})],w.prototype,"view",void 0),e([d({readOnly:!0,nonNullable:!0})],w.prototype,"hasSelection",null),e([d()],w.prototype,"showHighlight",void 0),e([d()],w.prototype,"sources",null),e([d()],w.prototype,"highlightName",void 0),w=e([p("esri.views.SelectionManager")],w);const S=e=>f(e)?!0===e.parent?.isTable:e.isTable,j=e=>void 0!==e.layer,b=e=>void 0!==e?.when,M=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],o=[...t.selection];if(s.length!==o.length)return!1;s.sort(),o.sort();for(let e=0;e<s.length;e++)if(s[e]!==o[e])return!1}return!0},E=async(e,t,s={})=>{let o;if(j(e)){const i=e;o=void 0===i?null:await i.queryFeatures(new y({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const i=e;o=void 0===i?null:await i.queryFeatures(new y({...s,objectIds:t})).then((e=>({data:e,layer:i})))}return o},C=w;export{C as default};
5
+ import{_ as e}from"../chunks/tslib.es6.js";import{difference as t,isSome as s}from"../core/arrayUtils.js";import o from"../core/Collection.js";import{referenceSetter as i}from"../core/collectionUtils.js";import n from"../core/Evented.js";import r from"../core/Logger.js";import{getOrCreateMapValue as l}from"../core/MapUtils.js";import{removeMaybe as c}from"../core/maybe.js";import a from"../core/ReactiveMap.js";import{watch as h,on as u,initial as d}from"../core/reactiveUtils.js";import{symmetricDifference as f}from"../core/SetUtils.js";import{property as p}from"../core/accessorSupport/decorators/property.js";import"../core/has.js";import{subclass as g}from"../core/accessorSupport/decorators/subclass.js";import{isSubtypeSublayer as y,isKnowledgeGraphLayer as m,isMapImageLayer as _,isSubtypeGroupLayer as v}from"../layers/support/layerUtils.js";import w from"../rest/support/Query.js";import{isSelectableLayer as S}from"./support/selectionUtils.js";let j=class extends n.EventedAccessor{constructor(e){super(e),this._selectionMap=new a,this._sources=new o,this._trashCan=[],this._layerEditHandles=new o,this._vizTaskId=0,this.view=null,this.showHighlight=!0,this.highlightName="default"}initialize(){this.addHandles([h((()=>[this.view,this.showHighlight]),(()=>this._refreshVisualization())),h((()=>this.view),(e=>{e?.when().then((()=>this.syncSources()))}),d),u((()=>this.sources),"change",(e=>{const t=this._selectionMap;for(const s of e.removed)t.delete(s);this._refreshListeners(),this._refreshVisualization()}),{onListenerAdd:()=>this._refreshListeners()})])}destroy(){this._layerEditHandles.drain(c)}get selections(){return Array.from(this._selectionMap.entries()).map((e=>{const[t,s]=e;return{layer:t,selection:[...s.selection]}}))}get count(){let e=0;for(const t of this._selectionMap.values())e+=t.selection.length;return e}get hasSelection(){return this.count>0}get sources(){return this._sources}set sources(e){i(e,this._sources)}syncSources(){const e=new Set,t=this.view?.map;if(!t)return;const s=t=>{m(t)?(t.layers?.forEach(s),t.tables?.forEach(s)):_(t)?(t.sublayers?.forEach(s),t.subtables?.forEach(s)):v(t)?t.sublayers?.forEach(s):S(t)&&e.add(t)};t.allLayers.forEach(s),t.allTables.forEach(s),this.sources=[...e]}async getSelectedFeatures(e,t={},s="layerView"){const{view:o,selections:i}=this;if(!o&&"layerView"===s)return r.getLogger(this).warn("Cannot query layer views without a view."),[];const n=e?.length?i.filter((t=>e.includes(t.layer))):i,l=[];return n.forEach((async e=>{const{layer:i,selection:n}=e;if(!n.length)return;const r=y(i)?i.parent:i;if(null==r)return;if("layer"===s)return void l.push(H(r,n,t));if(M(r)||!o||!E(r))return;const c=await o.whenLayerView(r).catch((()=>null));c&&l.push(H(c,n,t))})),(await Promise.all(l)).filter((e=>null!=e))}updateSelection(e){const s=new Map;for(const[t,n]of this._selectionMap)s.set(t,[...n.selection]);let o=!1;const i=e.current.concat(e.added);for(const t of i){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(S(e)||y(e))&&null!==i){const t=l(s,e,(()=>[]));t.includes(i)||(t.push(i),o=!0)}}for(const t of e.removed){const e=t.sourceLayer,i=t.getObjectId();if(this.sources.includes(e)&&(S(e)||y(e))&&null!==i){const t=s.get(e),n=t?.indexOf(i);void 0!==n&&n>=0&&(t?.splice(n,1),o=!0)}}if(o){const{_selectionMap:e,_trashCan:o}=this,i=[];for(const[n,r]of s){const s=e.get(n);void 0!==s&&o.push(s),e.set(n,{selection:r}),i.push({layer:n,selection:r,...t(void 0!==s?s.selection:[],r)})}this._onSelectionChange(i)}}setSelection(e,t){this._setSelection(e,t)}getSelection(e){const t=this._selectionMap.get(e);return t?.selection}appendToSelection(e,t){const s=this._selectionMap.get(e),o=void 0!==s?[...s.selection]:[];for(const i of t)o.includes(i)||o.push(i);this._setSelection(e,o)}removeFromSelection(e,t){const s=this._selectionMap.get(e);if(!s)return;const o=[];for(const i of s.selection)t.includes(i)||o.push(i);this._setSelection(e,o)}toggleInSelection(e,t){const s=this._selectionMap.get(e);if(!s||0===s.selection.length)return void this._setSelection(e,t);const o=new Set(s.selection),i=new Set(t),n=f(o,i);this._setSelection(e,Array.from(n))}clear(){const e=this._selectionMap.values();this._trashCan.push(...e);const t=[];for(const[s,o]of this._selectionMap.entries())t.push({layer:s,added:[],removed:[...o.selection],selection:[]});this._selectionMap.clear(),this._onSelectionChange(t)}_onSelectionChange(e){this._refreshVisualization(),this.emit("selection-change",{view:this.view,changes:e})}_refreshVisualization(){if(null==this.view||null==this.sources)return;for(this._vizTaskId++;this._trashCan.length>0;){const e=this._trashCan.pop();e?.highlightHandle?.remove()}const{sources:e,view:t,_selectionMap:s,showHighlight:o}=this,i=this._vizTaskId;for(const n of e){const e=s.get(n),r=y(n)?n.parent:n;if(null!=r&&E(r)){if(M(r))continue;t.whenLayerView(r).then((t=>{e?.highlightHandle?.remove(),null!=e&&o&&i===this._vizTaskId&&"highlight"in t&&"function"==typeof t.highlight&&e.selection.length>0&&(e.highlightHandle=t.highlight(e.selection,this.highlightName))})).catch((()=>{e?.highlightHandle?.remove()}))}}}_refreshListeners(){this._layerEditHandles.drain(c);for(const e of this.sources){const t=y(e)?e.parent:e;if(null!=t&&S(t)&&"on"in t&&t.on){const s=t.on("edits",(t=>{this._handleEditChanges(t,e)}));this._layerEditHandles.push(s)}}}_handleEditChanges(e,t){if(void 0!==e.deletedFeatures&&e.deletedFeatures.length>0&&this._selectionMap.has(t)){const o=e.deletedFeatures.filter((e=>null==e.error)).map((e=>e.objectId)).filter(s);this.removeFromSelection(t,o)}}_setSelection(e,s){if(!this.sources.includes(e))throw new Error(`Cannot set selection on layer ${e.title} because it is not in 'sources'`);const o=this._selectionMap.get(e);if(void 0===o||!C(o,{selection:s})){void 0!==o&&this._trashCan.push(o),this._selectionMap.set(e,{selection:[...s]});const i={layer:e,selection:[...s],...t(void 0!==o?o.selection:[],s)};this._onSelectionChange([i])}}};e([p({readOnly:!0,nonNullable:!0})],j.prototype,"selections",null),e([p({readOnly:!0,nonNullable:!0})],j.prototype,"count",null),e([p()],j.prototype,"view",void 0),e([p({readOnly:!0,nonNullable:!0})],j.prototype,"hasSelection",null),e([p()],j.prototype,"showHighlight",void 0),e([p()],j.prototype,"sources",null),e([p()],j.prototype,"highlightName",void 0),j=e([g("esri.views.SelectionManager")],j);const M=e=>y(e)?!0===e.parent?.isTable:e.isTable,b=e=>void 0!==e.layer,E=e=>void 0!==e?.when,C=(e,t)=>{if(null==e&&null==t)return!0;if(null!=e&&null==t||null==e&&null!=t)return!1;if(null!=e&&null!=t&&null!=e.selection&&null!=t.selection){const s=[...e.selection],o=[...t.selection];if(s.length!==o.length)return!1;s.sort(),o.sort();for(let e=0;e<s.length;e++)if(s[e]!==o[e])return!1}return!0},H=async(e,t,s={})=>{let o;if(b(e)){const i=e;o=void 0===i?null:await i.queryFeatures(new w({...s,objectIds:t})).then((t=>({data:t,layer:e.layer})))}else{const i=e;o=void 0===i?null:await i.queryFeatures(new w({...s,objectIds:t})).then((e=>({data:e,layer:i})))}return o},L=j;export{L as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import"../../core/has.js";import"../../core/Logger.js";import{watch as o,initial as e}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import r from"./Component.js";import n from"./UI.js";import a from"../../widgets/Attribution.js";import d from"../../widgets/Compass.js";import p from"../../widgets/NavigationToggle.js";import c from"../../widgets/Zoom.js";function m(t){return void 0!==t?.view}let h=class extends n{constructor(t){super(t),this._defaultPositionLookup={attribution:"manual",compass:"top-left","navigation-toggle":"top-left",zoom:"top-left"},this.components=[],this._updateViewAwareWidgets=t=>{this.components.forEach((o=>{const e=this._find(o),i=e?.widget;m(i)&&(i.view=t)}))},this._componentsWatcher=(t,o)=>{this._removeComponents(o),this._addComponents(t),this._adjustPadding(t)}}initialize(){this.addHandles([o((()=>this.components),this._componentsWatcher,e),o((()=>this.view),this._updateViewAwareWidgets,e)])}_add(t,o,e,i,s){let r=t;if("string"==typeof t&&this._defaultPositionLookup[t]){if(this._find(t))return;r=this._createComponent(t)}super._add(r,o,e,i,s)}_removeComponents(t){t.forEach((t=>{const o=this._find(t);o&&(this.remove(o),o.destroy())}))}_adjustPadding(t){if(!t.includes("attribution")&&!this._isOverridden("padding")){const{top:t}=this.padding;this.padding=t}}_addComponents(t){this.constructed&&t.forEach((t=>this.add(this._createComponent(t),this._defaultPositionLookup[t])))}_createComponent(t){const o=this._createWidget(t);return new r({id:t,node:o})}_createWidget(t){const o=this.view;switch(t){case"attribution":return new a({view:o});case"compass":return new d({view:o});case"navigation-toggle":return new p({view:o});case"zoom":return new c({view:o})}}};t([i()],h.prototype,"components",void 0),h=t([s("esri.views.ui.DefaultUI")],h);const u=h;export{u as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import"../../core/has.js";import"../../core/Logger.js";import{watch as o,initial as e}from"../../core/reactiveUtils.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import r from"./Component.js";import n from"./UI.js";import a from"../../widgets/Attribution.js";import d from"../../widgets/Compass.js";import p from"../../widgets/NavigationToggle.js";import c from"../../widgets/Zoom.js";function m(t){return void 0!==t?.view}let h=class extends n{constructor(t){super(t),this._defaultPositionLookup={attribution:"manual",compass:"top-left","navigation-toggle":"top-left",zoom:"top-left"},this.components=[],this._updateViewAwareWidgets=t=>{this.components.forEach((o=>{const e=this._find(o),i=e?.widget;m(i)&&(i.view=t)}))},this._componentsWatcher=(t,o)=>{this._removeComponents(o),this._addComponents(t),this._adjustPadding(t)}}initialize(){this.addHandles([o((()=>this.components),this._componentsWatcher,e),o((()=>this.view),this._updateViewAwareWidgets,e)])}_add(t,o,e,i,s){let r=t;if("string"==typeof t&&this._defaultPositionLookup[t]){if(this._find(t))return;r=this._createComponent(t)}super._add(r,o,e,i,s)}_removeComponents(t){t.forEach((t=>{const o=this._find(t);o&&(this.remove(o),o.destroy())}))}_adjustPadding(t){if(!t.includes("attribution")&&!this._isOverridden("padding")){const{top:t}=this.padding;this.padding=t}}_addComponents(t){this.constructed&&t.forEach((t=>this.add(this._createComponent(t),this._defaultPositionLookup[t])))}_createComponent(t){const o=this._createWidget(t);return new r({id:t,node:o})}_createWidget(t){const o=this.view;switch(t){case"attribution":return new a({view:o});case"compass":return new d({view:o});case"navigation-toggle":return new p({view:o,isDefaultUI:!0});case"zoom":return new c({view:o})}}};t([i()],h.prototype,"components",void 0),h=t([s("esri.views.ui.DefaultUI")],h);const u=h;export{u as default};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
+ */
5
+ class t{constructor(t){this._gl=t,this._sync=t.fenceSync(t.SYNC_GPU_COMMANDS_COMPLETE,0)}poll(){const t=this._gl,n=t.clientWaitSync(this._sync,t.SYNC_FLUSH_COMMANDS_BIT,0);if(n===t.WAIT_FAILED)throw new Error("clientWaitSync failed");return n!==t.TIMEOUT_EXPIRED}destroy(){this._gl.deleteSync(this._sync),this._sync=null}}export{t as Sync};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import r from"../../core/Error.js";import i from"../../core/Evented.js";import o from"../../core/Logger.js";import{debounce as s,isAbortError as a}from"../../core/promiseUtils.js";import{watch as l,on as n,syncAndInitial as u,when as d}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{resolveTimeZone as p,convertDateFormatToIntlOptions as m,formatTimestamp as v}from"../../intl/date.js";import{getLocale as y,getLocaleParts as f}from"../../intl/locale.js";import{fetchServiceDescription as g}from"../../rest/networkService.js";import w from"../../rest/support/RouteParameters.js";import _ from"../../rest/support/Stop.js";import T from"../../rest/support/TravelMode.js";import{defaultDatePattern as S,defaultTimePattern as D}from"../../support/dateUtils.js";import{system as C}from"../../time/constants.js";import{shortTimeZoneName as b}from"../../time/timeZoneUtils.js";import{DepartureTimeOption as M}from"./support/directionsUtils.js";import{getDefaultLocaleOptions as A}from"../support/dateUtils.js";import I from"../support/GoTo.js";import{DateTime as j,FixedOffsetZone as L,IANAZone as R}from"luxon";function P(e){return e.map((e=>({locale:e,parts:f(e)}))).filter((({parts:e})=>!!e))}function E(e,t){return e.find((({parts:e})=>F(e.language,t.language)&&e.region===t.region))?.locale??e.find((({parts:e})=>F(e.language,t.language)))?.locale}function U(e){return"esri.Graphic"===e?.declaredClass}function N(e){return"no"===e||"nb"===e}function F(e,t){return e===t||N(e)&&N(t)}function O(e){return"esri.rest.support.Stop"===e?.declaredClass}var k;!function(e){e[e.Active=0]="Active",e[e.Complete=1]="Complete",e[e.Failed=2]="Failed",e[e.Idle=3]="Idle",e[e.Suspended=4]="Suspended"}(k||(k={}));let V=class extends(I(i.EventedAccessor)){constructor(e){super(e),this._debouncedSolveHandler=s((async e=>{switch(e.type){case"create":if("complete"!==e.state)return;break;case"delete":break;case"update":switch(e.state){case"start":return void(this._networkFeatureUpdated=!1);case"active":return void(this._networkFeatureUpdated=!0);case"complete":if(!this._networkFeatureUpdated)return}}if(!((this.layer?.stops.filter((({geometry:e})=>!!e)).length??0)<2)&&this.autoSolve)try{await this.getDirections({zoomToSolvedRoute:!1})}catch(t){o.getLogger(this).error(t)}})),this._highlight=null,this._loadController=null,this._loadPromise=null,this._networkFeatureUpdated=!1,this._layerView=null,this._routeController=null,this._serviceDescriptionStatus=k.Idle,this.apiKey=void 0,this.autoSolve=!0,this.defaultTravelMode=null,this.departureIsoDate=void 0,this.departureIsoTime=void 0,this.departureOption=M.NOW,this.departureTime="now",this.lastError=null,this.lastRoute=null,this.layer=null,this.maxStops=50,this.routeParameters=new w({directionsLengthUnits:"kilometers",findBestSequence:!1,preserveFirstStop:!0,preserveLastStop:!0,returnZ:!0,useTimeWindows:!1}),this.serviceDescription=null,this.view=null}initialize(){this.addHandles([l((()=>this.layer),(e=>{if(null!=e){for(;e.stops.length<2;)e.stops.add(new _);this._set("defaultTravelMode",null),this.addHandles(d((()=>this.serviceDescription?e.routeInfo?.analysisSettings?.travelMode:null),(e=>{this.defaultTravelMode=this._resolveDefaultTravelMode(e)}),{once:!0}))}}),u),l((()=>[this.layer,this.view]),(async()=>{this._layerView=await this._getRouteLayerView()}),u),n((()=>this._layerView),["create","delete","update"],(e=>{this._debouncedSolveHandler(e).catch((e=>{if(!a(e))throw e}))}))]);const e=p(this.view?.timeZone??C),t=j.fromMillis(Date.now());this.departureIsoDate=t.toFormat(S,A(e)),this.departureIsoTime=t.toFormat(D,A(e))}get _directionsLanguage(){const e=this.serviceDescription?.directionsSupportedLanguages;if(!e)return;const t=this.routeParameters.directionsLanguage??y(),r=f(t),i=r?.language,o=r?.region;if(!i)return;return E(P(e),{language:i,region:o})}get formattedEta(){const e=this.layer?.routeInfo?.endTime,t=this.layer?.routeInfo?.endTimeOffset;if(this.departureOption===M.UNSPECIFIED||!e||!t)return null;const r=j.fromJSDate(e,{zone:L.instance(t)}),i=j.fromJSDate(e,{zone:R.create(p(this.view?.timeZone??C))}),o=j.fromJSDate(new Date,{zone:R.create(p(this.view?.timeZone??C))}),s=o.year===i.year&&o.month===i.month&&o.day===i.day,a=i.offset===t?void 0:b,l=s?void 0:m("short-date"),n=m("short-time");return v(r.toISO(),{...l,...n,timeZoneName:a})}get impedanceAttribute(){const e=this.routeParameters.travelMode?.impedanceAttributeName??this.routeParameters.impedanceAttribute??this.serviceDescription?.impedance??null;return this.getCostAttribute(e)}get selectedNetworkFeatures(){return this._layerView?.selectedNetworkFeatures??null}get selectedTravelMode(){return this.serviceDescription?this.defaultTravelMode??this.serviceDescription.defaultTravelMode??this.serviceDescription.supportedTravelModes?.[0]??null:null}set selectedTravelMode(e){this._override("selectedTravelMode",e)}get state(){if(this._routeController)return"routing";if(this.lastError)return"error";switch(this._serviceDescriptionStatus){case k.Suspended:return"unauthenticated";case k.Idle:return"disabled";case k.Active:return"initializing";case k.Failed:return"error";default:return"ready"}}get timeAttribute(){const e=this.routeParameters.travelMode?.timeAttributeName??this.routeParameters.directionsTimeAttribute??this.serviceDescription?.directionsTimeAttribute??null;return this.getCostAttribute(e)}get travelModes(){const e=this.serviceDescription?.supportedTravelModes?.slice()??[];return null==this.defaultTravelMode||e.includes(this.defaultTravelMode)||e.unshift(this.defaultTravelMode),e}async load(){if(this._loadPromise)return this._loadPromise;this._loadPromise=this._load(),await this._loadPromise,this._loadPromise=null}async highlight(e){if(this.clearHighlights(),!this.view||!this.layer)return;const t=await this.view.whenLayerView(this.layer);this._highlight=t.highlight(e)}clearHighlights(){null!=this._highlight&&(this._highlight.remove(),this._highlight=null)}centerAt(e){if(!this.view)return;const t=O(e)||U(e)?e.geometry:e;t&&this.callGoTo({target:t})}clearResults(){this._set("lastRoute",null),this.layer?.removeResult()}async create(e){await(this._layerView?.create(e))}async getDirections(e={zoomToSolvedRoute:!0}){const{apiKey:t,layer:i,state:o}=this;if(!i)throw new r("directions-view-model:missing-route-layer","A route layer must be associated with the view model.");if("unauthenticated"===o||"initializing"===o||"disabled"===o||this._serviceDescriptionStatus===k.Failed)throw new r("directions-view-model:not-loaded","Cannot get directions until view model loads.");null!=this._routeController&&(this._routeController.abort(),this._routeController=null);const{startTime:s,startTimeIsUTC:l}=this._getStartTimeParameters(),n=this.view?.spatialReference??null,u=this.routeParameters.clone();u.set({apiKey:t,directionsLanguage:this._directionsLanguage,outSpatialReference:n,startTime:s,startTimeIsUTC:l}),this.selectedTravelMode&&(u.travelMode=this.selectedTravelMode);if(i.stops.filter((({geometry:e})=>null!=e)).length<2){const e=new r("directions-view-model:not-enough-stops","Not enough stops for routing");throw this._set("lastError",e),e}this._routeController=new AbortController;const{signal:d}=this._routeController;let c=null;try{c=await i.solve(u,{signal:d})}catch(h){if(!a(h)){const e=new r("directions-view-model:unable-to-route","Unable to route to these addresses",{error:h});throw this._set("lastError",e),this.clearResults(),e}}finally{this._routeController=null}this._set("lastError",null);for(const r of c.stops)null==r.geometry&&(r.name=null);return i.update(c),this._set("lastRoute",c),e.zoomToSolvedRoute&&this.zoomToRoute(),c}getCostAttribute(e){return(this.serviceDescription?.networkDataset?.networkAttributes??[]).find((({name:t,usageType:r})=>t===e&&"cost"===r))??null}remove(e){this._layerView?.remove(e)}reset(){this.clearHighlights(),this.clearResults(),null!=this.layer&&(this.layer.removeAll(),this.layer.stops=new t([new _,new _]))}save(){if(!this.layer)throw new r("directions-view-model:missing-layer","save() requires a layer");return this.layer.save()}saveAs(e,t={}){if(!this.layer)throw new r("directions-view-model:missing-layer","saveAs() requires a layer");return this.layer.saveAs(e,t)}async startEditing(){this._layerView&&(this._layerView.interactive=!0)}async stopEditing(){this._layerView&&(this._layerView.interactive=!1)}updateDepartureTime(){if(this.departureIsoDate&&this.departureIsoTime)switch(this.departureOption){case M.NOW:this.departureTime="now";break;case M.DEPART_AT:{const e=j.fromISO(`${this.departureIsoDate}T${this.departureIsoTime}`,{zone:L.instance(0)});this.departureTime=e.toJSDate();break}case M.UNSPECIFIED:this.departureTime=null}}zoomToRoute(){const{view:e,layer:t}=this,r=t?.routeInfo?.geometry?.extent;if(!e||!r)return;const i=r.width>r.height,o=r.clone().expand(i?2:1);this.callGoTo({target:o})}async _getRouteLayerView(){return this.view&&this.layer?this.view.whenLayerView(this.layer):null}_getStartTimeParameters(){if("now"===this.departureTime){return{startTime:this.serviceDescription?.capabilities.supportsNow??!1?"now":new Date,startTimeIsUTC:!0}}return null==this.departureTime?{startTime:void 0,startTimeIsUTC:void 0}:{startTime:this.departureTime,startTimeIsUTC:!1}}async _load(){if(null==this.layer)return;null!=this._loadController&&(this._loadController.abort(),this._loadController=null),this._loadController=new AbortController;const{signal:e}=this._loadController;try{this._serviceDescriptionStatus=k.Active;const t=await g(this.layer.url,this.apiKey,{signal:e});this._set("serviceDescription",t),this._serviceDescriptionStatus=k.Complete}catch(t){if(a(t))return void(this._serviceDescriptionStatus=k.Idle);if("identity-manager:user-aborted"===t.name)return void(this._serviceDescriptionStatus=k.Suspended);const e=new r("directions-view-model:service-metadata-unavailable","Cannot load route service metadata",{error:t});throw this._serviceDescriptionStatus=k.Failed,this._set("lastError",e),e}finally{this._loadController=null}}_resolveDefaultTravelMode(e){if(null==this.serviceDescription)return null;const{defaultTravelMode:t,supportedTravelModes:r}=this.serviceDescription,i=/^<(?<name>.*)>$/i.exec(e.name)?.groups?.name;if(i){const o=r?.find((({name:e})=>e.toLocaleLowerCase()===i.trim().toLocaleLowerCase())),s=o??t;return T.fromJSON({...s?.toJSON(),...e.toJSON()})}const o=r?.find((({name:t})=>t.toLocaleLowerCase()===e.name.toLocaleLowerCase()));return o??t}};e([c()],V.prototype,"_directionsLanguage",null),e([c()],V.prototype,"_layerView",void 0),e([c()],V.prototype,"_routeController",void 0),e([c()],V.prototype,"_serviceDescriptionStatus",void 0),e([c()],V.prototype,"apiKey",void 0),e([c()],V.prototype,"autoSolve",void 0),e([c()],V.prototype,"defaultTravelMode",void 0),e([c()],V.prototype,"departureTime",void 0),e([c()],V.prototype,"formattedEta",null),e([c({readOnly:!0})],V.prototype,"impedanceAttribute",null),e([c()],V.prototype,"lastError",void 0),e([c({readOnly:!0})],V.prototype,"lastRoute",void 0),e([c()],V.prototype,"layer",void 0),e([c({type:Number,range:{min:2,max:50},nonNullable:!0})],V.prototype,"maxStops",void 0),e([c({type:w,nonNullable:!0})],V.prototype,"routeParameters",void 0),e([c({readOnly:!0})],V.prototype,"selectedNetworkFeatures",null),e([c({type:T})],V.prototype,"selectedTravelMode",null),e([c({readOnly:!0})],V.prototype,"serviceDescription",void 0),e([c({readOnly:!0})],V.prototype,"state",null),e([c({readOnly:!0})],V.prototype,"timeAttribute",null),e([c()],V.prototype,"travelModes",null),e([c()],V.prototype,"view",void 0),e([c()],V.prototype,"zoomToRoute",null),V=e([h("esri.widgets.Directions.DirectionsViewModel")],V);const z=V;export{z as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import r from"../../core/Error.js";import i from"../../core/Evented.js";import o from"../../core/Logger.js";import{debounce as s,isAbortError as a}from"../../core/promiseUtils.js";import{watch as l,on as n,syncAndInitial as u,when as d}from"../../core/reactiveUtils.js";import{property as c}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{resolveTimeZone as p,convertDateFormatToIntlOptions as m,formatTimestamp as v}from"../../intl/date.js";import{getLocale as y,getLocaleParts as f}from"../../intl/locale.js";import{fetchServiceDescription as g}from"../../rest/networkService.js";import w from"../../rest/support/RouteParameters.js";import _ from"../../rest/support/Stop.js";import T from"../../rest/support/TravelMode.js";import{defaultDatePattern as S,defaultTimePattern as D}from"../../support/dateUtils.js";import{system as C}from"../../time/constants.js";import{shortTimeZoneName as b}from"../../time/timeZoneUtils.js";import{DepartureTimeOption as M}from"./support/directionsUtils.js";import{getDefaultLocaleOptions as A}from"../support/dateUtils.js";import I from"../support/GoTo.js";import{DateTime as j,FixedOffsetZone as L,IANAZone as R}from"luxon";function E(e){return e.map((e=>({locale:e,parts:f(e)}))).filter((({parts:e})=>!!e))}function P(e,t){return e.find((({parts:e})=>F(e.language,t.language)&&e.region===t.region))?.locale??e.find((({parts:e})=>F(e.language,t.language)))?.locale}function U(e){return"esri.Graphic"===e?.declaredClass}function N(e){return"no"===e||"nb"===e}function F(e,t){return e===t||N(e)&&N(t)}function O(e){return"esri.rest.support.Stop"===e?.declaredClass}var k;!function(e){e[e.Active=0]="Active",e[e.Complete=1]="Complete",e[e.Failed=2]="Failed",e[e.Idle=3]="Idle",e[e.Suspended=4]="Suspended"}(k||(k={}));let V=class extends(I(i.EventedAccessor)){constructor(e){super(e),this._debouncedSolveHandler=s((async e=>{switch(e.type){case"create":if("complete"!==e.state)return;break;case"delete":break;case"update":switch(e.state){case"start":return void(this._networkFeatureUpdated=!1);case"active":return void(this._networkFeatureUpdated=!0);case"complete":if(!this._networkFeatureUpdated)return}}if(!((this.layer?.stops.filter((({geometry:e})=>!!e)).length??0)<2)&&this.autoSolve)try{await this.getDirections({zoomToSolvedRoute:!1})}catch(t){o.getLogger(this).error(t)}})),this._highlight=null,this._loadController=null,this._loadPromise=null,this._networkFeatureUpdated=!1,this._layerView=null,this._routeController=null,this._serviceDescriptionStatus=k.Idle,this.apiKey=void 0,this.autoSolve=!0,this.defaultTravelMode=null,this.departureIsoDate=void 0,this.departureIsoTime=void 0,this.departureOption=M.NOW,this.departureTime="now",this.lastError=null,this.lastRoute=null,this.layer=null,this.maxStops=50,this.routeParameters=new w({directionsLengthUnits:"kilometers",findBestSequence:!1,preserveFirstStop:!0,preserveLastStop:!0,returnZ:!0,useTimeWindows:!1}),this.serviceDescription=null,this.view=null}initialize(){this.addHandles([l((()=>this.layer),(e=>{if(null!=e){for(;e.stops.length<2;)e.stops.add(new _);this._set("defaultTravelMode",null),this.addHandles(d((()=>this.serviceDescription?e.routeInfo?.analysisSettings?.travelMode:null),(e=>{this.defaultTravelMode=this._resolveDefaultTravelMode(e)}),{once:!0}))}}),u),l((()=>[this.layer,this.view]),(async()=>{this._layerView=await this._getRouteLayerView()}),u),n((()=>this._layerView),["create","delete","update"],(e=>{this._debouncedSolveHandler(e).catch((e=>{if(!a(e))throw e}))}))]);const e=p(this.view?.timeZone??C),t=j.fromMillis(Date.now());this.departureIsoDate=t.toFormat(S,A(e)),this.departureIsoTime=t.toFormat(D,A(e))}get _directionsLanguage(){const e=this.serviceDescription?.directionsSupportedLanguages;if(!e)return;const t=this.routeParameters.directionsLanguage??y(),r=f(t),i=r?.language,o=r?.region;if(!i)return;return P(E(e),{language:i,region:o})}get formattedEta(){const e=this.layer?.routeInfo?.endTime,t=this.layer?.routeInfo?.endTimeOffset;if(this.departureOption===M.UNSPECIFIED||!e||!t)return null;const r=j.fromJSDate(e,{zone:L.instance(t)}),i=j.fromJSDate(e,{zone:R.create(p(this.view?.timeZone??C))}),o=j.fromJSDate(new Date,{zone:R.create(p(this.view?.timeZone??C))}),s=o.year===i.year&&o.month===i.month&&o.day===i.day,a=i.offset===t?void 0:b,l=s?void 0:m("short-date"),n=m("short-time");return v(r.toISO(),{...l,...n,timeZoneName:a})}get impedanceAttribute(){const e=this.routeParameters.travelMode?.impedanceAttributeName??this.routeParameters.impedanceAttribute??this.serviceDescription?.impedance??null;return this.getCostAttribute(e)}get selectedNetworkFeatures(){return this._layerView?.selectedNetworkFeatures??null}get selectedTravelMode(){return this.serviceDescription?this.defaultTravelMode??this.serviceDescription.defaultTravelMode??this.serviceDescription.supportedTravelModes?.[0]??null:null}set selectedTravelMode(e){this._override("selectedTravelMode",e)}get state(){if(this._routeController)return"routing";if(this.lastError)return"error";switch(this._serviceDescriptionStatus){case k.Suspended:return"unauthenticated";case k.Idle:return"disabled";case k.Active:return"initializing";case k.Failed:return"error";default:return"ready"}}get timeAttribute(){const e=this.routeParameters.travelMode?.timeAttributeName??this.routeParameters.directionsTimeAttribute??this.serviceDescription?.directionsTimeAttribute??null;return this.getCostAttribute(e)}get travelModes(){const e=this.serviceDescription?.supportedTravelModes?.slice()??[];return null==this.defaultTravelMode||e.includes(this.defaultTravelMode)||e.unshift(this.defaultTravelMode),e}async load(){if(this._loadPromise)return this._loadPromise;this._loadPromise=this._load(),await this._loadPromise,this._loadPromise=null}async highlight(e){if(this.clearHighlights(),!this.view||!this.layer)return;const t=await this.view.whenLayerView(this.layer);this._highlight=t.highlight(e)}clearHighlights(){null!=this._highlight&&(this._highlight.remove(),this._highlight=null)}centerAt(e){if(!this.view)return;const t=O(e)||U(e)?e.geometry:e;t&&this.callGoTo({target:t})}clearResults(){this._set("lastRoute",null),this.layer?.removeResult()}async create(e){await(this._layerView?.create(e))}async getDirections(e={zoomToSolvedRoute:!0}){const{apiKey:t,layer:i,state:o}=this;if(!i)throw new r("directions-view-model:missing-route-layer","A route layer must be associated with the view model.");if("unauthenticated"===o||"initializing"===o||"disabled"===o||this._serviceDescriptionStatus===k.Failed)throw new r("directions-view-model:not-loaded","Cannot get directions until view model loads.");null!=this._routeController&&(this._routeController.abort(),this._routeController=null);const{startTime:s,startTimeIsUTC:l}=this._getStartTimeParameters(),n=this.view?.spatialReference??null,u=this.routeParameters.clone();u.set({apiKey:t,directionsLanguage:this._directionsLanguage,outSpatialReference:n,startTime:s,startTimeIsUTC:l}),this.selectedTravelMode&&(u.travelMode=this.selectedTravelMode);if(i.stops.filter((({geometry:e})=>null!=e)).length<2){const e=new r("directions-view-model:not-enough-stops","Not enough stops for routing");throw this._set("lastError",e),e}i.stops.forEach((e=>e.sequence=null)),this._routeController=new AbortController;const{signal:d}=this._routeController;let c=null;try{c=await i.solve(u,{signal:d})}catch(h){if(!a(h)){const e=new r("directions-view-model:unable-to-route","Unable to route to these addresses",{error:h});throw this._set("lastError",e),this.clearResults(),e}}finally{this._routeController=null}this._set("lastError",null);for(const r of c.stops)null==r.geometry&&(r.name=null);return i.update(c),this._set("lastRoute",c),e.zoomToSolvedRoute&&this.zoomToRoute(),c}getCostAttribute(e){return(this.serviceDescription?.networkDataset?.networkAttributes??[]).find((({name:t,usageType:r})=>t===e&&"cost"===r))??null}remove(e){this._layerView?.remove(e)}reset(){this.clearHighlights(),this.clearResults(),null!=this.layer&&(this.layer.removeAll(),this.layer.stops=new t([new _,new _]))}save(){if(!this.layer)throw new r("directions-view-model:missing-layer","save() requires a layer");return this.layer.save()}saveAs(e,t={}){if(!this.layer)throw new r("directions-view-model:missing-layer","saveAs() requires a layer");return this.layer.saveAs(e,t)}async startEditing(){this._layerView&&(this._layerView.interactive=!0)}async stopEditing(){this._layerView&&(this._layerView.interactive=!1)}updateDepartureTime(){if(this.departureIsoDate&&this.departureIsoTime)switch(this.departureOption){case M.NOW:this.departureTime="now";break;case M.DEPART_AT:{const e=j.fromISO(`${this.departureIsoDate}T${this.departureIsoTime}`,{zone:L.instance(0)});this.departureTime=e.toJSDate();break}case M.UNSPECIFIED:this.departureTime=null}}zoomToRoute(){const{view:e,layer:t}=this,r=t?.routeInfo?.geometry?.extent;if(!e||!r)return;const i=r.width>r.height,o=r.clone().expand(i?2:1);this.callGoTo({target:o})}async _getRouteLayerView(){return this.view&&this.layer?this.view.whenLayerView(this.layer):null}_getStartTimeParameters(){if("now"===this.departureTime){return{startTime:this.serviceDescription?.capabilities.supportsNow??!1?"now":new Date,startTimeIsUTC:!0}}return null==this.departureTime?{startTime:void 0,startTimeIsUTC:void 0}:{startTime:this.departureTime,startTimeIsUTC:!1}}async _load(){if(null==this.layer)return;null!=this._loadController&&(this._loadController.abort(),this._loadController=null),this._loadController=new AbortController;const{signal:e}=this._loadController;try{this._serviceDescriptionStatus=k.Active;const t=await g(this.layer.url,this.apiKey,{signal:e});this._set("serviceDescription",t),this._serviceDescriptionStatus=k.Complete}catch(t){if(a(t))return void(this._serviceDescriptionStatus=k.Idle);if("identity-manager:user-aborted"===t.name)return void(this._serviceDescriptionStatus=k.Suspended);const e=new r("directions-view-model:service-metadata-unavailable","Cannot load route service metadata",{error:t});throw this._serviceDescriptionStatus=k.Failed,this._set("lastError",e),e}finally{this._loadController=null}}_resolveDefaultTravelMode(e){if(null==this.serviceDescription)return null;const{defaultTravelMode:t,supportedTravelModes:r}=this.serviceDescription,i=/^<(?<name>.*)>$/i.exec(e.name)?.groups?.name;if(i){const o=r?.find((({name:e})=>e.toLocaleLowerCase()===i.trim().toLocaleLowerCase())),s=o??t;return T.fromJSON({...s?.toJSON(),...e.toJSON()})}const o=r?.find((({name:t})=>t.toLocaleLowerCase()===e.name.toLocaleLowerCase()));return o??t}};e([c()],V.prototype,"_directionsLanguage",null),e([c()],V.prototype,"_layerView",void 0),e([c()],V.prototype,"_routeController",void 0),e([c()],V.prototype,"_serviceDescriptionStatus",void 0),e([c()],V.prototype,"apiKey",void 0),e([c()],V.prototype,"autoSolve",void 0),e([c()],V.prototype,"defaultTravelMode",void 0),e([c()],V.prototype,"departureTime",void 0),e([c()],V.prototype,"formattedEta",null),e([c({readOnly:!0})],V.prototype,"impedanceAttribute",null),e([c()],V.prototype,"lastError",void 0),e([c({readOnly:!0})],V.prototype,"lastRoute",void 0),e([c()],V.prototype,"layer",void 0),e([c({type:Number,range:{min:2,max:50},nonNullable:!0})],V.prototype,"maxStops",void 0),e([c({type:w,nonNullable:!0})],V.prototype,"routeParameters",void 0),e([c({readOnly:!0})],V.prototype,"selectedNetworkFeatures",null),e([c({type:T})],V.prototype,"selectedTravelMode",null),e([c({readOnly:!0})],V.prototype,"serviceDescription",void 0),e([c({readOnly:!0})],V.prototype,"state",null),e([c({readOnly:!0})],V.prototype,"timeAttribute",null),e([c()],V.prototype,"travelModes",null),e([c()],V.prototype,"view",void 0),e([c()],V.prototype,"zoomToRoute",null),V=e([h("esri.widgets.Directions.DirectionsViewModel")],V);const z=V;export{z as default};