@arcgis/core 5.2.0-next.160 → 5.2.0-next.162

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 (152) hide show
  1. package/arcgisGlobal.d.ts +1 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{0a5a9885ee6f5b5f99f0.js → 167b057ad50e6aef54de.js} +1 -1
  4. package/assets/esri/core/workers/chunks/17c6d66b47aa690df0d4.js +1 -0
  5. package/assets/esri/core/workers/chunks/{15bcf7cfe603f2ee1a24.js → 28104681ba161967039f.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{842893e75696428d536f.js → 3b0808ee3c4facfaca3d.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{eebbde81e56d69dc602f.js → 44f90e75c1dc3d726a95.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{77ebacfdf8e57f2e03f1.js → 46c5371c7a627537098c.js} +11 -11
  9. package/assets/esri/core/workers/chunks/5daa9429808ca31279f2.js +1 -0
  10. package/assets/esri/core/workers/chunks/{60737732ce495bbdd0fc.js → 5f4feca26102088ea565.js} +1 -1
  11. package/assets/esri/core/workers/chunks/6da7229433105a69eb3f.js +1 -0
  12. package/assets/esri/core/workers/chunks/83f29a159b8b5197e76a.js +1 -0
  13. package/assets/esri/core/workers/chunks/849879c8aed16315194c.js +1 -0
  14. package/assets/esri/core/workers/chunks/{1d77c8c59b0118c7e77b.js → 85bba551057366cd00ae.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{9401cc22373566e1171e.js → 8a7b02037151767542f1.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{4eae066673484986d4c1.js → 8e4a7027d171fb60e51e.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{32b351b047ce1eb58146.js → 9ce8b9b80da146a5bbf5.js} +1 -1
  18. package/assets/esri/core/workers/chunks/a2fcbc494333376192aa.js +1 -0
  19. package/assets/esri/core/workers/chunks/a6f969851d4278865cc5.js +1 -0
  20. package/assets/esri/core/workers/chunks/{f1df76f098a3cc924832.js → b5df193c93e9c19f9700.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{28b74bc77f7c13080074.js → be97a629e2ae4d13ceb3.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{d33360c4f85203edafff.js → bf4d913e523eae2fda28.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{172cfeb5f415e4662432.js → d7429b58c90e015263ad.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{612104dff305ff062dfa.js → dfc81e66196c402f39b4.js} +2 -2
  25. package/assets/esri/core/workers/chunks/{02f8654852d389583891.js → e04fb83ab2634bc15cc7.js} +1 -1
  26. package/assets/esri/core/workers/chunks/f74ae0eff3f08978e607.js +1 -0
  27. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +2 -5
  28. package/assets/esri/themes/dark/main.css +1 -1
  29. package/assets/esri/themes/light/main.css +1 -1
  30. package/assets/esri/themes/light/view.css +1 -1
  31. package/chunks/DefaultMaterial.glsl.js +1 -1
  32. package/chunks/RealisticTree.glsl.js +1 -1
  33. package/chunks/RibbonLine.glsl.js +125 -133
  34. package/config.d.ts +62 -34
  35. package/config.js +1 -1
  36. package/core/has.js +1 -1
  37. package/core/mapCollectionUtils.js +1 -1
  38. package/core/workers/Connection.d.ts +58 -89
  39. package/core/workers.d.ts +45 -54
  40. package/geometry/support/Indices.js +1 -1
  41. package/geometry/support/aaBoundingRect.js +1 -1
  42. package/geometry/support/ray.js +1 -1
  43. package/kernel.js +1 -1
  44. package/layers/FeatureLayer.d.ts +7 -5
  45. package/layers/FeatureLayer.js +1 -1
  46. package/layers/GeospatialPDFLayer.js +1 -1
  47. package/layers/MapImageLayer.d.ts +9 -3
  48. package/layers/MapNotesLayer.d.ts +2 -2
  49. package/layers/SubtypeGroupLayer.d.ts +1 -1
  50. package/layers/SubtypeGroupLayer.js +1 -1
  51. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -1
  52. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  53. package/layers/graphics/sources/support/QueryTask.js +1 -1
  54. package/layers/knowledgeGraph/KnowledgeGraphSublayer.d.ts +16 -16
  55. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  56. package/layers/mixins/ArcGISMapService.js +1 -1
  57. package/layers/ogc/ogcFeatureUtils.js +1 -1
  58. package/layers/support/Sublayer.d.ts +29 -15
  59. package/layers/support/Sublayer.js +1 -1
  60. package/layers/support/commonProperties.js +1 -1
  61. package/package.json +2 -2
  62. package/rest/layerSources/DynamicDataLayer.d.ts +4 -2
  63. package/rest/layerSources/DynamicDataLayer.js +1 -1
  64. package/rest/layerSources/DynamicMapLayer.d.ts +1 -1
  65. package/rest/layerSources/DynamicWorkspaceLayer.d.ts +45 -0
  66. package/rest/layerSources/DynamicWorkspaceLayer.js +2 -0
  67. package/rest/layerSources/typeUtils.js +2 -0
  68. package/rest/print.js +1 -1
  69. package/rest/query/operations/queryRelatedRecords.js +1 -1
  70. package/rest/query/operations/queryUtils.js +1 -1
  71. package/rest/support/Query.js +1 -1
  72. package/rest/support/RelationshipQuery.js +1 -1
  73. package/symbols/LineSymbol3D.d.ts +5 -3
  74. package/views/2d/analysis/ElevationProfileAnalysisView2D.d.ts +6 -0
  75. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
  76. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  77. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  78. package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
  79. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  80. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  81. package/views/3d/analysis/ElevationProfileAnalysisView3D.d.ts +6 -0
  82. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  83. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  84. package/views/3d/analysis/LineOfSight/LineOfSightObserverPlugin.js +1 -1
  85. package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
  86. package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
  87. package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +1 -1
  88. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  89. package/views/3d/input/SceneInputManager.js +1 -1
  90. package/views/3d/input/handlers/DragZoom.js +1 -1
  91. package/views/3d/input/handlers/MouseWheelFov.js +1 -1
  92. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  93. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  94. package/views/3d/interactive/manipulators/ResizeManipulator.js +1 -1
  95. package/views/3d/interactive/manipulators/RotateManipulator.js +1 -1
  96. package/views/3d/interactive/manipulators/ShiftManipulator.js +1 -1
  97. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  98. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  99. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  100. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  101. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  102. package/views/3d/layers/FlowSubView3D.js +1 -1
  103. package/views/3d/layers/I3SMeshView3D.js +1 -1
  104. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  105. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  106. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  107. package/views/3d/layers/graphics/extrudePolygon.js +1 -1
  108. package/views/3d/layers/graphics/tessellationUtils.js +1 -1
  109. package/views/3d/state/controllers/FovController.js +1 -1
  110. package/views/3d/state/controllers/GroundNavigationController.js +1 -1
  111. package/views/3d/state/controllers/momentum/GroundNavigationMomentumController.js +1 -1
  112. package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
  113. package/views/3d/support/elevationUpdateUtils.js +1 -1
  114. package/views/3d/terrain/PatchRenderData.js +1 -1
  115. package/views/3d/terrain/TerrainData.js +1 -1
  116. package/views/3d/terrain/TextureReference.js +1 -1
  117. package/views/3d/terrain/terrainUtils.js +1 -1
  118. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +2 -2
  119. package/views/3d/webgl-engine/core/shaderLibrary/attributes/SymbolColor.glsl.js +3 -3
  120. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialExternalColor.glsl.js +2 -2
  121. package/views/3d/webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js +2 -2
  122. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  123. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  124. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  125. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  126. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  127. package/views/BreakpointsOwner.d.ts +6 -0
  128. package/views/SceneView.js +1 -1
  129. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  130. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  131. package/views/interactive/editGeometry/operations/RotateVertex.js +1 -1
  132. package/views/interactive/editGeometry/operations/ScaleVertex.js +1 -1
  133. package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
  134. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  135. package/views/types.d.ts +3 -0
  136. package/views/webgl/ShaderBuilder.js +1 -1
  137. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  138. package/widgets/Search/LocatorSearchSource.d.ts +22 -1
  139. package/widgets/support/SelectionList/GroupLayerItem.d.ts +2 -0
  140. package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
  141. package/widgets/support/SelectionList/ItemBase.d.ts +2 -0
  142. package/widgets/support/SelectionList/ItemBase.js +1 -1
  143. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  144. package/widgets/support/SelectionList.js +1 -1
  145. package/assets/esri/core/workers/chunks/3e3e076fa5e8d5d5f33f.js +0 -1
  146. package/assets/esri/core/workers/chunks/510502a4c9a2ba8d3f7b.js +0 -1
  147. package/assets/esri/core/workers/chunks/7d212c415f2709037408.js +0 -1
  148. package/assets/esri/core/workers/chunks/abb9e820d2871fa7acae.js +0 -1
  149. package/assets/esri/core/workers/chunks/ade5fdcd08dcbac74740.js +0 -1
  150. package/assets/esri/core/workers/chunks/b390b9cde2884755e8be.js +0 -1
  151. package/assets/esri/core/workers/chunks/e8bf653376a607f00897.js +0 -1
  152. package/assets/esri/core/workers/chunks/f4a7aa3cdbc0c429c359.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as n,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as i,Seconds as a}from"../../../../core/time.js";import{copy as o,set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as l,subtract as u,dot as d,scale as f,add as p,copy as m,length as h,distance as g,lerp as _,transformMat4 as v,normalize as y}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPoints as S,distance2 as C,closestLineSegmentPoint as w,projectPoint as T,projectPointFraction as E,create as D}from"../../../../geometry/support/lineSegment.js";import{fromPoints as O,signedDistance as k,getNormal as ee,create as A}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as j,BufferViewFloat as M,BufferViewVec4Unorm8 as N,BufferViewVec4f16 as te,BufferViewUint32 as ne}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as re,isColor as ie,isDepth as ae,isColorHighlightOLIDOrDepth as oe,is2DGeometryOutput as se}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as ce}from"../effects/geometry/olidUtils.js";import le from"../lib/GLMaterial.js";import{LineMaterial as ue}from"../lib/LineMaterial.js";import{projectWorldLineSegmentToRenderScreen as de,screenPolygonIntersectsBufferedSegment as fe}from"../lib/screenPolygonOverlapUtils.js";import{Hit as pe,DrapedHit as me}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as he}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as ge,assert as P}from"../lib/Util.js";import{isImagePattern as _e}from"./lineStippleUtils.js";import{VisualVariablePassParameters as ve}from"./VisualVariablePassParameters.js";import{writeColor as ye}from"./internal/bufferWriterUtils.js";import{n as be}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as xe,getTextureBufferLayout as Se}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as Ce}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as we}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as Te}from"../../../../webscene/support/AlphaCutoff.js";class Ee extends ue{constructor(e,t){super(e,Oe),this.produces=new Map([[2,e=>re(e)||ie(e)&&this.parameters.renderOccluded===8],[3,e=>ae(e)],[10,e=>oe(e)&&this.parameters.renderOccluded===8],[11,e=>oe(e)&&this.parameters.renderOccluded===8],[4,e=>ie(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[8,e=>ie(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[18,e=>se(e)]]),this._configuration=new we(t)}updateConfiguration(e){super.updateConfiguration(e);let t=this.parameters.stipplePattern!=null&&this.parameters.stippleTexture!=null&&e.output!==10,n=t&&this.parameters.isImagePattern()&&this._configuration.draped,r=this.parameters.usesWorldSizedWidth(n);this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=t,this._configuration.stippleOffColorEnabled=t&&this.parameters.stippleOffColor!=null,this._configuration.stipplePreferContinuous=t&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=Ne(this.parameters.join,t),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins=this.parameters.join===`round`,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=this.parameters.markerParameters!=null&&Me(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&this.parameters.innerColor!=null,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=+!!this.emissions,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSized=r,this._configuration.imagePattern=n}get visible(){return this.parameters.color[3]>=Te||this.parameters.stipplePattern!=null&&(this.parameters.stippleOffColor?.[3]??0)>Te}get emissions(){return this.parameters.emissiveStrength>0?this.parameters.renderOccluded===8?1:2:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e},n,r,i,a,o,s){if(!n.options.selectionMode)return;let c=this._getLineSize(e,!0),l=r[0],u=r[1],d=Ae(c,o,s,this.parameters.usesWorldSizedWidth()),f=Number.MAX_VALUE,p=0;for(let n of je(z,B,this.parameters,e)){let e=l-z[0],r=u-z[1],i=B[0]-z[0],a=B[1]-z[1],o=i*e+a*r,s=i*i+a*a,c=t(o/s,0,1),d=i*c-e,m=a*c-r,h=d*d+m*m;h<f&&(f=h,p=n)}f<d*d&&i(a.distance,a.renderDistance,a.normal,p)}intersectRay(t,n,r,i,a,s){let{options:c,camera:_,rayBegin:v,rayEnd:y}=r;if(!c.selectionMode||!t.visible||!_)return;if(!ge(n)){e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`);return}let b=t.attributes,x=b.get(`position`).data,T=this._getLineSize(b),E=Ie;o(E,r.point);let D=T*_.pixelRatio,A=$*_.pixelRatio,j=D/2+A;l(X[0],E[0]-j,E[1]+j,0),l(X[1],E[0]+j,E[1]+j,0),l(X[2],E[0]+j,E[1]-j,0),l(X[3],E[0]-j,E[1]-j,0);for(let e=0;e<4;e++)if(!_.unprojectFromRenderScreen(X[e],Z[e]))return;O(_.eye,Z[0],Z[1],He),O(_.eye,Z[1],Z[2],Ue),O(_.eye,Z[2],Z[3],We),O(_.eye,Z[3],Z[0],Q);let M=Number.MAX_VALUE,N=0;for(let e of this._forEachTransformedLineSegment(L,R,x,n,I(this.parameters,b))){if(k(He,L)<0&&k(He,R)<0||k(Ue,L)<0&&k(Ue,R)<0||k(We,L)<0&&k(We,R)<0||k(Q,L)<0&&k(Q,R)<0)continue;let t=_.projectToRenderScreen(L,G),n=_.projectToRenderScreen(R,K);if(t==null||n==null)continue;if(t[2]<0&&n[2]>0){u(U,L,R);let e=_.frustum,n=-k(e[4],L)/d(U,ee(e[4]));if(f(U,U,n),p(L,L,U),!_.projectToRenderScreen(L,t))continue}else if(t[2]>0&&n[2]<0){u(U,R,L);let e=_.frustum,t=-k(e[4],R)/d(U,ee(e[4]));if(f(U,U,t),p(R,R,U),!_.projectToRenderScreen(R,n))continue}else if(t[2]<0&&n[2]<0)continue;t[2]=0,n[2]=0;let r=S(t,n,q),i=C(r,E);if(!(i>=M)){if(this.parameters.screenSizePerspective){let e=this.computeScreenSizePerspectiveWidth(r,L,R,E,_,T,A);if(i>=e*e)continue}M=i,m(ze,L),m(Be,R),N=e}}if(M<j*j){let e=Number.MAX_VALUE;if(w(S(ze,Be,q),S(v,y,Ve),W)){u(W,W,v);let t=h(W);f(W,W,1/t),e=t/g(v,y)}s(e,e,W,N)}}intersectScreenPolygon(t,n,r,i){let{options:a,camera:o,screenPolygonPrimitiveProcessor:s}=r;if(!a.selectionMode||!t.visible)return null;if(!ge(n))return e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`),null;let c=t.attributes,l=c.get(`position`).data,u=this._getLineSize(c),d=$,f=d*o.pixelRatio,p=new pe(4);for(let e of this._forEachTransformedLineSegment(L,R,l,n,I(this.parameters,c)))for(let[t,n]of s.processLineSegment(Ke,L,R)){if(!de(o,t,n,G,K))continue;let r=S(G,K,q),a=u/2+d;this.parameters.screenSizePerspective&&(_(Ie,G,K,.5),a=Math.max(a,this.computeScreenSizePerspectiveWidth(r,t,n,Ie,o,u,f)/o.pixelRatio)),o.renderToScreen(G,Le),o.renderToScreen(K,Re),fe(i,Le,Re,a)&&(T(S(t,n,Ve),o.eye,V),p.updateIfCloserFromValues(g(o.eye,V),e,V,null))}return p}intersectScreenPolygonDraped({attributes:e},t,n,r,i,a){if(!n.options.selectionMode)return null;let o=Ae(this._getLineSize(e,!0),i,a,this.parameters.usesWorldSizedWidth());for(let n of je(z,B,this.parameters,e,t))if(fe(r,z,B,o))return new me(n);return null}createBufferWriter(){return new ke(xe(this.parameters),Se(this.parameters),this.parameters)}createGLMaterial(e){return new De(e)}validateParameters(e){e.join!==`miter`&&(e.miterLimit=0),e.markerParameters!=null&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return this.parameters.hasAnimation?(this.setParameters({timeElapsed:i(e.time)},!1),e.dt!==0):!1}computeScreenSizePerspectiveWidth(e,t,n,r,i,a,o){let s=E(e,r);_(V,t,n,s),v(Fe,V,i.viewMatrix);let c=h(Fe),l=this.computeCameraAbsCosAngle(V,i,this._configuration.spherical);return Pe.update(l,c,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize),Pe.apply(a)*i.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,n){return n?y(W,e):l(W,0,0,1),u(H,e,t.eye),y(H,H),Math.abs(d(W,H))}_getLineSize(e,n=!1){let r=this.parameters.width;if(this.parameters.vvSize){let i=e.get(`sizeFeatureAttribute`).data[0];Number.isNaN(i)?n&&(r*=this.parameters.vvSize.fallback[0]):r*=t(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has(`size`)&&(r*=e.get(`size`).data[0]);return r}*_forEachTransformedLineSegment(e,t,n,r,i){let a=i?n.length-2:n.length-5;for(let i=0;i<a;i+=3){e[0]=n[i]+r[12],e[1]=n[i+1]+r[13],e[2]=n[i+2]+r[14];let a=(i+3)%n.length;t[0]=n[a]+r[12],t[1]=n[a+1]+r[13],t[2]=n[a+2]+r[14],yield i/3}}}class De extends le{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){let{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(Ce,e)}}class Oe extends ve{constructor(){super(...arguments),this._width=0,this.color=x,this.join=`miter`,this.cap=0,this.miterLimit=5,this.shadingEnabled=!1,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=a(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=a(0),this.endTime=a(1/0),this.worldSized=!1}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||this.stipplePattern!=null&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return this.animation!==0}usesWorldSizedWidth(e=this.isImagePattern()){return this.worldSized||e}isImagePattern(){return _e(this.stipplePattern)&&this.stippleTexture!=null}}class ke{constructor(e,t,n){this.layout=e,this.textureBufferLayout=t,this._parameters=n,this.numJoinSubdivisions=Ne(this._parameters.join,this._parameters.stipplePattern!=null)}_isClosed(e){return I(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get(`position`).data.length/3+(this._isClosed(e)?3:2)}elementCount(e){let t=e.get(`position`).indices.length/2+1,n=this._isClosed(e),r=n?2:4,i=+!n,a=n?t:t-1,o=this.numJoinSubdivisions*2+4;return r+=(a-i)*o,r+=2,this._parameters.wireframe&&(r=2+(r-2)*4),r}write(e,t,n,r,i,a){a!=null&&this._writeTextureBuffer(e,n,a),r!=null&&this._writeVertexBuffer(e,n,r,i)}_writeTextureBuffer(e,t,n){let r=t.get(`position`),i=r.data.length/3,a=this._isClosed(t),{buffer:o,offset:s}=n,c=o.getField(`position`,j),l=o.getField(`u0`,M),u=o.getField(`sizeFeatureAttribute`,M),d=o.getField(`size`,M),f=o.getField(`colorFeatureAttribute`,M),p=o.getField(`color`,N),h=o.getField(`olidColor`,N),_=o.getField(`timeStamps`,te),v=o.getField(`opacityFeatureAttribute`,M),y=t.get(`sizeFeatureAttribute`)?.data,b=t.get(`size`)?.data,x=t.get(`colorFeatureAttribute`)?.data,S=t.get(`color`)?.data,C=t.get(`opacityFeatureAttribute`)?.data,w=t.get(`distanceToStart`)?.data,T=t.get(`timeStamps`);P(c!==null,`Expected valid position field in texture buffer`),P(l!==null,`Expected valid u0 field in texture buffer`);let E=0;for(let t=0;t<i;++t){this._getTransformedPosition(Y,r.data,t,e),t>0&&(w==null?E+=g(J,Y):E=w[t]??E);let n=s+t+1;if(c.setVec(n,Y),l.set(n,E),m(J,Y),u&&u.set(n,y?.length===1?y[0]:y?.[t]??0),d&&d.set(n,b?.length===1?b[0]:b?.[t]??1),f&&f.set(n,x?.length===1?x[0]:x?.[t]??0),p){if(S!=null){let e=Math.min(t*4,S.length-4);p.setValues(n,S[e],S[e+1],S[e+2],S[e+3])}else p.setValues(n,1,1,1,1)}v&&v.set(n,C?.length===1?C[0]:C?.[t]??0)}if(_!=null&&T!=null){P(T.size===4);let e=T.data;for(let t=0;t<i;++t){let n=t*4,r=s+t+1;_.set(r,0,e[n]),_.set(r,1,e[n+1]),_.set(r,2,e[n+2]),_.set(r,3,e[n+3])}}if(a){let e=s,t=s+1,n=s+2,r=s+i,a=r+1,u=r+2;o.copyItem(r,e),o.copyItem(t,a),o.copyItem(n,u),c.getVec(r,J),c.getVec(t,Y);let d=w?.[i]??E+g(J,Y);l.set(a,d)}else{let e=s,t=s+1,n=s+i,r=n+1;o.copyItem(t,e),o.copyItem(n,r)}let D=t.get(`olidColor`);ce()&&D!=null&&h!=null&&ye(D,4,h,s)}_writeVertexBuffer(e,t,n,r){let{buffer:i,offset:a}=n,{layout:o}=this,s=t.get(`position`),c=s.indices,l=s.data.length/3,u=this._isClosed(t),d=l+(u?3:2);c&&c.length!==2*(l-1)&&console.warn(`RibbonLineMaterial does not support indices`);let f=i.getField(`textureElementIndex`,ne);P(f!=null,`Missing texture buffer index field`),P(r!=null,`Using a texture layout, but the texture range for this instance was not provided`);let p=r.from;P(r.numElements===d,`Expected number of elements in TextureBuffer to equal number of points`);let m=new Float32Array(i.buffer),h=new Float16Array(i.buffer),g=new Uint32Array(i.buffer),_=o.stride/4,v=a*_,y=v,b=m.BYTES_PER_ELEMENT/h.BYTES_PER_ELEMENT,x=(e,t,n)=>{let r=n+1;g[v]=p+r,v++;let i=v*b;h[i++]=e,h[i++]=t,v=Math.ceil(i/b)};v+=_;let S=0,C=0;u?(S=0,C=l):(x(1,-4,0),x(1,4,0),S=1,C=l-1);for(let e=S;e<C;e++){x(0,-1,e),x(0,1,e);let t=this.numJoinSubdivisions;for(let n=0;n<t;++n){let r=(n+1)/(t+1);x(r,-1,e),x(r,1,e)}x(1,-2,e),x(1,2,e)}u?(x(0,-1,C),x(0,1,C)):(x(0,-5,C),x(0,5,C)),F(m,y+_,m,y,_),v=F(m,v-_,m,v,_),this._parameters.wireframe&&this._addWireframeVertices(i,y,v,_)}_getTransformedPosition(e,t,n,r){let i=n*3;l(e,t[i+0],t[i+1],t[i+2]),r&&v(e,e,r)}_addWireframeVertices(e,t,n,r){let i=new Uint8Array(e.buffer,n*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(n-t)*Float32Array.BYTES_PER_ELEMENT),o=r*Float32Array.BYTES_PER_ELEMENT,s=0,c=e=>s=F(a,e,i,s,o);for(let e=0;e<=a.length-4*o;e+=o*2)c(e),c(e+2*o),c(e+1*o),c(e+2*o),c(e+1*o),c(e+3*o)}}function F(e,t,n,r,i){for(let a=0;a<i;a++)n[r++]=e[t++];return r}function I(e,t){return e.isClosed?t.get(`position`).indices.length>2:!1}function Ae(e,t,n,r){return r?e/(2*n)+$*t:(e/2+$)*t}function*je(e,t,n,r,i){let a=r.get(`position`).data,c=I(n,r)?a.length-2:a.length-5,l=i?.[0]??0,u=i?.[1]??0;s(e,a[0]+l,a[1]+u);for(let n=3;n<c+3;n+=3){let r=n%a.length;s(t,a[r]+l,a[r+1]+u),yield n/3,o(e,t)}}function Me(e){return e.anchor===1&&e.hideOnShortSegments&&e.placement===`begin-end`&&e.worldSpace}function Ne(e,t){let n=+!!t;switch(e){case`miter`:case`bevel`:return n;case`round`:return be+n}}const Pe=new he,L=b(),R=b(),z=c(),B=c(),V=b(),Fe=b(),H=b(),U=b(),W=b(),Ie=b(),G=n(),K=n(),Le=r(),Re=r(),ze=b(),Be=b(),q=D(),Ve=D(),J=b(),Y=b(),X=[n(),n(),n(),n()],Z=[b(),b(),b(),b()],He=A(),Ue=A(),We=A(),Q=A(),$=4,Ge={getDrapedRibbonLineMaxDistance:Ae},Ke=[b(),b()];export{Oe as Parameters,Ee as RibbonLineMaterial,Ge as test};
2
+ import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as n,createScreenPointArray as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as i,Seconds as a}from"../../../../core/time.js";import{copy as o,set as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as l,subtract as u,dot as d,scale as f,add as p,copy as m,length as h,distance as g,lerp as _,transformMat4 as v,normalize as y}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as x}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromPoints as S,distance2 as C,closestLineSegmentPoint as w,projectPoint as T,projectPointFraction as E,create as D}from"../../../../geometry/support/lineSegment.js";import{fromPoints as O,signedDistance as k,getNormal as ee,create as A}from"../../../../geometry/support/plane.js";import{BufferViewVec3f as j,BufferViewFloat as M,BufferViewVec4Unorm8 as N,BufferViewVec4f16 as te,BufferViewUint32 as ne}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as re,isColor as ie,isDepth as ae,isColorHighlightOLIDOrDepth as oe,is2DGeometryOutput as se}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as ce}from"../effects/geometry/olidUtils.js";import le from"../lib/GLMaterial.js";import{LineMaterial as ue}from"../lib/LineMaterial.js";import{projectWorldLineSegmentToRenderScreen as de,screenPolygonIntersectsBufferedSegment as fe}from"../lib/screenPolygonOverlapUtils.js";import{Hit as pe,DrapedHit as me}from"../lib/screenPolygonTriangleIntersections.js";import{ScreenSizePerspectiveEvaluator as he}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as ge,assert as P}from"../lib/Util.js";import{isImagePattern as _e}from"./lineStippleUtils.js";import{VisualVariablePassParameters as ve}from"./VisualVariablePassParameters.js";import{writeColor as ye}from"./internal/bufferWriterUtils.js";import{n as be}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as xe,getTextureBufferLayout as Se}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as Ce}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as we}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as Te}from"../../../../webscene/support/AlphaCutoff.js";class Ee extends ue{constructor(e,t){super(e,Oe),this.produces=new Map([[2,e=>re(e)||ie(e)&&this.parameters.renderOccluded===8],[3,e=>ae(e)],[10,e=>oe(e)&&this.parameters.renderOccluded===8],[11,e=>oe(e)&&this.parameters.renderOccluded===8],[4,e=>ie(e)&&this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[8,e=>ie(e)&&!this.parameters.writeDepth&&this.parameters.renderOccluded!==8],[18,e=>se(e)]]),this._configuration=new we(t.state.isGlobal),this._isAssumedMetalDriver=t.stage.renderer.renderContext.rctx.isAssumedMetalDriver}updateConfiguration(e){super.updateConfiguration(e),this._configuration.useFlatJoinVarying=!this._isAssumedMetalDriver;let t=this.parameters.stipplePattern!=null&&this.parameters.stippleTexture!=null&&e.output!==10,n=t&&this.parameters.isImagePattern()&&this._configuration.draped,r=this.parameters.usesWorldSizedWidth(n);this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=t,this._configuration.stippleOffColorEnabled=t&&this.parameters.stippleOffColor!=null,this._configuration.stipplePreferContinuous=t&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=Ne(this.parameters.join,t),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins=this.parameters.join===`round`,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=this.parameters.markerParameters!=null&&Me(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&this.parameters.innerColor!=null,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=+!!this.emissions,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!r,this._configuration.worldSized=r,this._configuration.imagePattern=n}get visible(){return this.parameters.color[3]>=Te||this.parameters.stipplePattern!=null&&(this.parameters.stippleOffColor?.[3]??0)>Te}get emissions(){return this.parameters.emissiveStrength>0?this.parameters.renderOccluded===8?1:2:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectRayDraped({attributes:e},n,r,i,a,o,s){if(!n.options.selectionMode)return;let c=this._getLineSize(e,!0),l=r[0],u=r[1],d=Ae(c,o,s,this.parameters.usesWorldSizedWidth()),f=Number.MAX_VALUE,p=0;for(let n of je(z,B,this.parameters,e)){let e=l-z[0],r=u-z[1],i=B[0]-z[0],a=B[1]-z[1],o=i*e+a*r,s=i*i+a*a,c=t(o/s,0,1),d=i*c-e,m=a*c-r,h=d*d+m*m;h<f&&(f=h,p=n)}f<d*d&&i(a.distance,a.renderDistance,a.normal,p)}intersectRay(t,n,r,i,a,s){let{options:c,camera:_,rayBegin:v,rayEnd:y}=r;if(!c.selectionMode||!t.visible||!_)return;if(!ge(n)){e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`);return}let b=t.attributes,x=b.get(`position`).data,T=this._getLineSize(b),E=Ie;o(E,r.point);let D=T*_.pixelRatio,A=$*_.pixelRatio,j=D/2+A;l(X[0],E[0]-j,E[1]+j,0),l(X[1],E[0]+j,E[1]+j,0),l(X[2],E[0]+j,E[1]-j,0),l(X[3],E[0]-j,E[1]-j,0);for(let e=0;e<4;e++)if(!_.unprojectFromRenderScreen(X[e],Z[e]))return;O(_.eye,Z[0],Z[1],He),O(_.eye,Z[1],Z[2],Ue),O(_.eye,Z[2],Z[3],We),O(_.eye,Z[3],Z[0],Q);let M=Number.MAX_VALUE,N=0;for(let e of this._forEachTransformedLineSegment(L,R,x,n,I(this.parameters,b))){if(k(He,L)<0&&k(He,R)<0||k(Ue,L)<0&&k(Ue,R)<0||k(We,L)<0&&k(We,R)<0||k(Q,L)<0&&k(Q,R)<0)continue;let t=_.projectToRenderScreen(L,G),n=_.projectToRenderScreen(R,K);if(t==null||n==null)continue;if(t[2]<0&&n[2]>0){u(U,L,R);let e=_.frustum,n=-k(e[4],L)/d(U,ee(e[4]));if(f(U,U,n),p(L,L,U),!_.projectToRenderScreen(L,t))continue}else if(t[2]>0&&n[2]<0){u(U,R,L);let e=_.frustum,t=-k(e[4],R)/d(U,ee(e[4]));if(f(U,U,t),p(R,R,U),!_.projectToRenderScreen(R,n))continue}else if(t[2]<0&&n[2]<0)continue;t[2]=0,n[2]=0;let r=S(t,n,q),i=C(r,E);if(!(i>=M)){if(this.parameters.screenSizePerspective){let e=this.computeScreenSizePerspectiveWidth(r,L,R,E,_,T,A);if(i>=e*e)continue}M=i,m(ze,L),m(Be,R),N=e}}if(M<j*j){let e=Number.MAX_VALUE;if(w(S(ze,Be,q),S(v,y,Ve),W)){u(W,W,v);let t=h(W);f(W,W,1/t),e=t/g(v,y)}s(e,e,W,N)}}intersectScreenPolygon(t,n,r,i){let{options:a,camera:o,screenPolygonPrimitiveProcessor:s}=r;if(!a.selectionMode||!t.visible)return null;if(!ge(n))return e.getLogger(`esri.views.3d.webgl-engine.materials.RibbonLineMaterial`).error(`intersection assumes a translation-only matrix`),null;let c=t.attributes,l=c.get(`position`).data,u=this._getLineSize(c),d=$,f=d*o.pixelRatio,p=new pe(4);for(let e of this._forEachTransformedLineSegment(L,R,l,n,I(this.parameters,c)))for(let[t,n]of s.processLineSegment(Ke,L,R)){if(!de(o,t,n,G,K))continue;let r=S(G,K,q),a=u/2+d;this.parameters.screenSizePerspective&&(_(Ie,G,K,.5),a=Math.max(a,this.computeScreenSizePerspectiveWidth(r,t,n,Ie,o,u,f)/o.pixelRatio)),o.renderToScreen(G,Le),o.renderToScreen(K,Re),fe(i,Le,Re,a)&&(T(S(t,n,Ve),o.eye,V),p.updateIfCloserFromValues(g(o.eye,V),e,V,null))}return p}intersectScreenPolygonDraped({attributes:e},t,n,r,i,a){if(!n.options.selectionMode)return null;let o=Ae(this._getLineSize(e,!0),i,a,this.parameters.usesWorldSizedWidth());for(let n of je(z,B,this.parameters,e,t))if(fe(r,z,B,o))return new me(n);return null}createBufferWriter(){return new ke(xe(this.parameters),Se(this.parameters),this.parameters,this._isAssumedMetalDriver)}createGLMaterial(e){return new De(e)}validateParameters(e){e.join!==`miter`&&(e.miterLimit=0),e.markerParameters!=null&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return this.parameters.hasAnimation?(this.setParameters({timeElapsed:i(e.time)},!1),e.dt!==0):!1}computeScreenSizePerspectiveWidth(e,t,n,r,i,a,o){let s=E(e,r);_(V,t,n,s),v(Fe,V,i.viewMatrix);let c=h(Fe),l=this.computeCameraAbsCosAngle(V,i,this._configuration.spherical);return Pe.update(l,c,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize),Pe.apply(a)*i.pixelRatio/2+o}computeCameraAbsCosAngle(e,t,n){return n?y(W,e):l(W,0,0,1),u(H,e,t.eye),y(H,H),Math.abs(d(W,H))}_getLineSize(e,n=!1){let r=this.parameters.width;if(this.parameters.vvSize){let i=e.get(`sizeFeatureAttribute`).data[0];Number.isNaN(i)?n&&(r*=this.parameters.vvSize.fallback[0]):r*=t(this.parameters.vvSize.offset[0]+i*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else e.has(`size`)&&(r*=e.get(`size`).data[0]);return r}*_forEachTransformedLineSegment(e,t,n,r,i){let a=i?n.length-2:n.length-5;for(let i=0;i<a;i+=3){e[0]=n[i]+r[12],e[1]=n[i+1]+r[13],e[2]=n[i+2]+r[14];let a=(i+3)%n.length;t[0]=n[a]+r[12],t[1]=n[a+1]+r[13],t[2]=n[a+2]+r[14],yield i/3}}}class De extends le{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){let{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(Ce,e)}}class Oe extends ve{constructor(){super(...arguments),this._width=0,this.color=x,this.join=`miter`,this.cap=0,this.miterLimit=5,this.shadingEnabled=!1,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=a(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=a(0),this.endTime=a(1/0),this.worldSized=!1}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||this.stipplePattern!=null&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return this.animation!==0}usesWorldSizedWidth(e=this.isImagePattern()){return this.worldSized||e}isImagePattern(){return _e(this.stipplePattern)&&this.stippleTexture!=null}}class ke{constructor(e,t,n,r){this.layout=e,this.textureBufferLayout=t,this._parameters=n,this._isAssumedMetalDriver=r,this.numJoinSubdivisions=Ne(this._parameters.join,this._parameters.stipplePattern!=null)}_isClosed(e){return I(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get(`position`).data.length/3+(this._isClosed(e)?3:2)}elementCount(e){let t=e.get(`position`).indices.length/2+1,n=this._isClosed(e),r=n?2:4,i=+!n,a=n?t:t-1,o=this.numJoinSubdivisions*2+(this._isAssumedMetalDriver?8:4);return r+=(a-i)*o,r+=2,this._parameters.wireframe&&(r=2+(r-2)*4),r}write(e,t,n,r,i,a){a!=null&&this._writeTextureBuffer(e,n,a),r!=null&&this._writeVertexBuffer(e,n,r,i)}_writeTextureBuffer(e,t,n){let r=t.get(`position`),i=r.data.length/3,a=this._isClosed(t),{buffer:o,offset:s}=n,c=o.getField(`position`,j),l=o.getField(`u0`,M),u=o.getField(`sizeFeatureAttribute`,M),d=o.getField(`size`,M),f=o.getField(`colorFeatureAttribute`,M),p=o.getField(`color`,N),h=o.getField(`olidColor`,N),_=o.getField(`timeStamps`,te),v=o.getField(`opacityFeatureAttribute`,M),y=t.get(`sizeFeatureAttribute`)?.data,b=t.get(`size`)?.data,x=t.get(`colorFeatureAttribute`)?.data,S=t.get(`color`)?.data,C=t.get(`opacityFeatureAttribute`)?.data,w=t.get(`distanceToStart`)?.data,T=t.get(`timeStamps`);P(c!==null,`Expected valid position field in texture buffer`),P(l!==null,`Expected valid u0 field in texture buffer`);let E=0;for(let t=0;t<i;++t){this._getTransformedPosition(Y,r.data,t,e),t>0&&(w==null?E+=g(J,Y):E=w[t]??E);let n=s+t+1;if(c.setVec(n,Y),l.set(n,E),m(J,Y),u&&u.set(n,y?.length===1?y[0]:y?.[t]??0),d&&d.set(n,b?.length===1?b[0]:b?.[t]??1),f&&f.set(n,x?.length===1?x[0]:x?.[t]??0),p){if(S!=null){let e=Math.min(t*4,S.length-4);p.setValues(n,S[e],S[e+1],S[e+2],S[e+3])}else p.setValues(n,1,1,1,1)}v&&v.set(n,C?.length===1?C[0]:C?.[t]??0)}if(_!=null&&T!=null){P(T.size===4);let e=T.data;for(let t=0;t<i;++t){let n=t*4,r=s+t+1;_.set(r,0,e[n]),_.set(r,1,e[n+1]),_.set(r,2,e[n+2]),_.set(r,3,e[n+3])}}if(a){let e=s,t=s+1,n=s+2,r=s+i,a=r+1,u=r+2;o.copyItem(r,e),o.copyItem(t,a),o.copyItem(n,u),c.getVec(r,J),c.getVec(t,Y);let d=w?.[i]??E+g(J,Y);l.set(a,d)}else{let e=s,t=s+1,n=s+i,r=n+1;o.copyItem(t,e),o.copyItem(n,r)}let D=t.get(`olidColor`);ce()&&D!=null&&h!=null&&ye(D,4,h,s)}_writeVertexBuffer(e,t,n,r){let{buffer:i,offset:a}=n,{layout:o}=this,s=t.get(`position`),c=s.indices,l=s.data.length/3,u=this._isClosed(t),d=l+(u?3:2);c&&c.length!==2*(l-1)&&console.warn(`RibbonLineMaterial does not support indices`);let f=i.getField(`textureElementIndex`,ne);P(f!=null,`Missing texture buffer index field`),P(r!=null,`Using a texture layout, but the texture range for this instance was not provided`);let p=r.from;P(r.numElements===d,`Expected number of elements in TextureBuffer to equal number of points`);let m=new Float32Array(i.buffer),h=new Float16Array(i.buffer),g=new Uint32Array(i.buffer),_=o.stride/4,v=a*_,y=v,b=m.BYTES_PER_ELEMENT/h.BYTES_PER_ELEMENT,x=(e,t,n,r=!1)=>{let i=n+1;g[v]=p+i,v++;let a=v*b;h[a++]=e,h[a++]=t+(r?Math.sign(t)*8:0),v=Math.ceil(a/b)};v+=_;let S=0,C=0;u?(S=0,C=l):(x(1,-4,0),x(1,4,0),S=1,C=l-1);let w=this._isAssumedMetalDriver;for(let e=S;e<C;e++){x(0,-1,e),x(0,1,e),w&&(x(0,-1,e,!0),x(0,1,e,!0));let t=this.numJoinSubdivisions;for(let n=0;n<t;++n){let r=(n+1)/(t+1);x(r,-1,e,w),x(r,1,e,w)}x(1,-2,e,w),x(1,2,e,w),w&&(x(1,-2,e),x(1,2,e))}u?(x(0,-1,C),x(0,1,C)):(x(0,-5,C),x(0,5,C)),F(m,y+_,m,y,_),v=F(m,v-_,m,v,_),this._parameters.wireframe&&this._addWireframeVertices(i,y,v,_)}_getTransformedPosition(e,t,n,r){let i=n*3;l(e,t[i+0],t[i+1],t[i+2]),r&&v(e,e,r)}_addWireframeVertices(e,t,n,r){let i=new Uint8Array(e.buffer,n*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(n-t)*Float32Array.BYTES_PER_ELEMENT),o=r*Float32Array.BYTES_PER_ELEMENT,s=0,c=e=>s=F(a,e,i,s,o);for(let e=0;e<=a.length-4*o;e+=o*2)c(e),c(e+2*o),c(e+1*o),c(e+2*o),c(e+1*o),c(e+3*o)}}function F(e,t,n,r,i){for(let a=0;a<i;a++)n[r++]=e[t++];return r}function I(e,t){return e.isClosed?t.get(`position`).indices.length>2:!1}function Ae(e,t,n,r){return r?e/(2*n)+$*t:(e/2+$)*t}function*je(e,t,n,r,i){let a=r.get(`position`).data,c=I(n,r)?a.length-2:a.length-5,l=i?.[0]??0,u=i?.[1]??0;s(e,a[0]+l,a[1]+u);for(let n=3;n<c+3;n+=3){let r=n%a.length;s(t,a[r]+l,a[r+1]+u),yield n/3,o(e,t)}}function Me(e){return e.anchor===1&&e.hideOnShortSegments&&e.placement===`begin-end`&&e.worldSpace}function Ne(e,t){let n=+!!t;switch(e){case`miter`:case`bevel`:return n;case`round`:return be+n}}const Pe=new he,L=b(),R=b(),z=c(),B=c(),V=b(),Fe=b(),H=b(),U=b(),W=b(),Ie=b(),G=n(),K=n(),Le=r(),Re=r(),ze=b(),Be=b(),q=D(),Ve=D(),J=b(),Y=b(),X=[n(),n(),n(),n()],Z=[b(),b(),b(),b()],He=A(),Ue=A(),We=A(),Q=A(),$=4,Ge={getDrapedRibbonLineMaxDistance:Ae},Ke=[b(),b()];export{Oe as Parameters,Ee as RibbonLineMaterial,Ge as test};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{LineTechniqueConfiguration as n}from"./LineTechniqueConfiguration.js";const r=16,i=8;class a extends n{constructor(){super(...arguments),this.capType=0,this.animation=2,this.polygonOffsetIndex=0,this.numJoinSubdivisions=1,this.polygonOffset=0,this.writeDepth=!1,this.transparent=!1,this.enableOITOffset=!0,this.stippleEnabled=!1,this.stippleOffColorEnabled=!1,this.stipplePreferContinuous=!0,this.roundJoins=!1,this.applyMarkerOffset=!1,this.falloffEnabled=!1,this.innerColorEnabled=!1,this.wireframe=!1,this.imagePattern=!1}get hasAnimation(){return this.animation!==0}get usePerspectiveCorrectStipple(){return this.worldSized&&!this.draped}}e([t({count:3})],a.prototype,`capType`,void 0),e([t({count:4})],a.prototype,`animation`,void 0),e([t({count:16})],a.prototype,`polygonOffsetIndex`,void 0),e([t({count:8})],a.prototype,`numJoinSubdivisions`,void 0),e([t({count:5})],a.prototype,`polygonOffset`,void 0),e([t()],a.prototype,`writeDepth`,void 0),e([t()],a.prototype,`transparent`,void 0),e([t()],a.prototype,`enableOITOffset`,void 0),e([t()],a.prototype,`stippleEnabled`,void 0),e([t()],a.prototype,`stippleOffColorEnabled`,void 0),e([t()],a.prototype,`stipplePreferContinuous`,void 0),e([t()],a.prototype,`roundJoins`,void 0),e([t()],a.prototype,`applyMarkerOffset`,void 0),e([t()],a.prototype,`falloffEnabled`,void 0),e([t()],a.prototype,`innerColorEnabled`,void 0),e([t()],a.prototype,`wireframe`,void 0),e([t()],a.prototype,`imagePattern`,void 0);export{i as NUM_JOIN_SUBDIVISION_COUNT,r as POLYGON_OFFSET_INDEX_COUNT,a as RibbonLineTechniqueConfiguration};
2
+ import{__decorate as e}from"tslib";import{parameter as t}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{LineTechniqueConfiguration as n}from"./LineTechniqueConfiguration.js";const r=16,i=8;class a extends n{constructor(){super(...arguments),this.capType=0,this.animation=2,this.polygonOffsetIndex=0,this.numJoinSubdivisions=1,this.polygonOffset=0,this.writeDepth=!1,this.transparent=!1,this.enableOITOffset=!0,this.stippleEnabled=!1,this.stippleOffColorEnabled=!1,this.stipplePreferContinuous=!0,this.roundJoins=!1,this.applyMarkerOffset=!1,this.falloffEnabled=!1,this.innerColorEnabled=!1,this.wireframe=!1,this.imagePattern=!1,this.useFlatJoinVarying=!1}get hasAnimation(){return this.animation!==0}get usePerspectiveCorrectStipple(){return this.worldSized&&!this.draped}}e([t({count:3})],a.prototype,`capType`,void 0),e([t({count:4})],a.prototype,`animation`,void 0),e([t({count:16})],a.prototype,`polygonOffsetIndex`,void 0),e([t({count:8})],a.prototype,`numJoinSubdivisions`,void 0),e([t({count:5})],a.prototype,`polygonOffset`,void 0),e([t()],a.prototype,`writeDepth`,void 0),e([t()],a.prototype,`transparent`,void 0),e([t()],a.prototype,`enableOITOffset`,void 0),e([t()],a.prototype,`stippleEnabled`,void 0),e([t()],a.prototype,`stippleOffColorEnabled`,void 0),e([t()],a.prototype,`stipplePreferContinuous`,void 0),e([t()],a.prototype,`roundJoins`,void 0),e([t()],a.prototype,`applyMarkerOffset`,void 0),e([t()],a.prototype,`falloffEnabled`,void 0),e([t()],a.prototype,`innerColorEnabled`,void 0),e([t()],a.prototype,`wireframe`,void 0),e([t()],a.prototype,`imagePattern`,void 0),e([t()],a.prototype,`useFlatJoinVarying`,void 0);export{i as NUM_JOIN_SUBDIVISION_COUNT,r as POLYGON_OFFSET_INDEX_COUNT,a as RibbonLineTechniqueConfiguration};
@@ -6,6 +6,7 @@ export interface BreakpointsOwnerProperties extends Partial<Pick<BreakpointsOwne
6
6
  * A mixin that adds [breakpoints](https://developers.arcgis.com/javascript/latest/references/core/views/BreakpointsOwner/#breakpoints), [heightBreakpoint](https://developers.arcgis.com/javascript/latest/references/core/views/BreakpointsOwner/#heightBreakpoint), [orientation](https://developers.arcgis.com/javascript/latest/references/core/views/BreakpointsOwner/#orientation) and
7
7
  * [widthBreakpoint](https://developers.arcgis.com/javascript/latest/references/core/views/BreakpointsOwner/#widthBreakpoint) properties to [View2D](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#breakpoints) and [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/#breakpoints) classes.
8
8
  *
9
+ * @deprecated since 5.2. Use alternative responsive design techniques such as a [ResizeObserver](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) instead.
9
10
  * @since 4.0
10
11
  */
11
12
  export abstract class BreakpointsOwner {
@@ -28,6 +29,7 @@ export abstract class BreakpointsOwner {
28
29
  * > Please refer to the [styling guide](https://developers.arcgis.com/javascript/latest/styling/#view-size-css-classes) for additional
29
30
  * > information on working with this.
30
31
  *
32
+ * @deprecated since 5.2. Use alternative responsive design techniques such as a [ResizeObserver](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) instead.
31
33
  * @see [Sample: Responsive apps using CSS](https://developers.arcgis.com/javascript/latest/sample-code/view-breakpoints-css/)
32
34
  * @see [MDN Web docs: Media Queries](https://developer.mozilla.org/docs/Web/CSS/Media_Queries)
33
35
  * @example
@@ -75,6 +77,7 @@ export abstract class BreakpointsOwner {
75
77
  * large | The [height](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#height) of the view is between the values set in the `medium` and `large` [breakpoints](https://developers.arcgis.com/javascript/latest/references/core/views/BreakpointsOwner/#breakpoints). | 993 - 1200
76
78
  * xlarge | The [height](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#height) of the view is larger than the value set in the `large` [breakpoint](https://developers.arcgis.com/javascript/latest/references/core/views/BreakpointsOwner/#breakpoints). | > 1200
77
79
  *
80
+ * @deprecated since 5.2. Use alternative responsive design techniques such as a [ResizeObserver](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) instead.
78
81
  * @see [Sample: Responsive apps using CSS](https://developers.arcgis.com/javascript/latest/sample-code/view-breakpoints-css/)
79
82
  * @example
80
83
  * reactiveUtils.watch(
@@ -99,6 +102,8 @@ export abstract class BreakpointsOwner {
99
102
  * ---------------|------------
100
103
  * landscape | The [width](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#width) of the view is greater than its [height](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#height).
101
104
  * portrait | The [width](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#width) of the view is equal to or smaller than its [height](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#height).
105
+ *
106
+ * @deprecated since 5.2. Use alternative responsive design techniques such as a [ResizeObserver](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) instead.
102
107
  */
103
108
  get orientation(): BreakpointOrientation;
104
109
  /**
@@ -121,6 +126,7 @@ export abstract class BreakpointsOwner {
121
126
  * large | The [width](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#width) of the view is between the values set in the `medium` and `large` [breakpoints](https://developers.arcgis.com/javascript/latest/references/core/views/BreakpointsOwner/#breakpoints). | 993 - 1200
122
127
  * xlarge | The [width](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#width) of the view is larger than the value set in the `large` [breakpoint](https://developers.arcgis.com/javascript/latest/references/core/views/BreakpointsOwner/#breakpoints). | > 1200
123
128
  *
129
+ * @deprecated since 5.2. Use alternative responsive design techniques such as a [ResizeObserver](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) instead.
124
130
  * @see [Sample: Responsive apps using CSS](https://developers.arcgis.com/javascript/latest/sample-code/view-breakpoints-css/)
125
131
  * @example
126
132
  * reactiveUtils.when(
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../Camera.js";import n from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as i}from"../core/domUtils.js";import a from"../core/Error.js";import{on as o}from"../core/events.js";import{destroyHandle as s,makeHandle as c}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{mapCollectionAsync as ee}from"../core/mapCollectionUtils.js";import{destroyMaybe as u,maybeProperty as te}from"../core/maybe.js";import{throwIfDestroyed as ne,throwIfAborted as d,createAbortError as re}from"../core/promiseUtils.js";import ie from"../core/ReactiveSet.js";import{on as f,watch as p,initial as m,sync as h,whenOnce as ae,syncAndInitial as g}from"../core/reactiveUtils.js";import{setFrameDuration as oe,cleanupScheduling as se}from"../core/scheduling.js";import{createScreenPoint as ce,createScreenPointArray as le}from"../core/screenUtils.js";import{cleanupWhereClauseCache as ue}from"../core/sql.js";import{getDefaultVerticalUnitStringForSR as de,getMetersPerUnitForSR as fe}from"../core/units.js";import{property as _,cast as v,subclass as pe}from"../core/accessorSupport/decorators.js";import{ensureType as y,ensureClass as b}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as me}from"../core/accessorSupport/overrideDefaultsFrom.js";import{runUntracked as he}from"../core/accessorSupport/tracking.js";import{drainNotificationQueue as ge}from"../core/accessorSupport/trackingUtils.js";import{create as _e}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as ve}from"../core/libs/rbush/PooledRBush.js";import{initialize as ye}from"../core/workers/workers.js";import x from"../geometry/Extent.js";import be from"../geometry/HeightModelInfo.js";import S from"../geometry/Point.js";import{project as C,canProjectWithoutEngine as xe}from"../geometry/projectionUtils.js";import w from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as Se}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as Ce}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as T}from"../geometry/projection/projectPointToVector.js";import{toExtent as we,create as Te}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as Ee}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as De}from"../geometry/support/scaleUtils.js";import{wgs84 as Oe,webMercator as ke}from"../geometry/support/spatialReferenceUtils.js";import{makeDehydratedPoint as Ae}from"../layers/graphics/dehydratedPoint.js";import{isImageryTileLayer as E,isTiledLayer as D,isVoxelLayer as O,isIntegratedMeshLayer as k,isGaussianSplatLayer as je}from"../layers/support/layerUtils.js";import{TilemapCache as Me}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as Ne}from"../portal/portalDefault.js";import{WebSceneTag as Pe}from"../support/tagSymbols.js";import{BreakpointsOwner as Fe}from"./BreakpointsOwner.js";import{DOMContainer as Ie}from"./DOMContainer.js";import{PopupView as Le}from"./PopupView.js";import A from"./View.js";import Re from"./ViewAnimation.js";import{stringFromViewingMode as j,viewingModeFromString as M}from"./ViewingMode.js";import{GroundView3D as ze}from"./3d/GroundView3D.js";import{layerView3DImporter as N}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as Be}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as Ve}from"./3d/camera/intersectionUtils.js";import P from"./3d/constraints/Constraints.js";import F from"./3d/environment/Environment.js";import{EnvironmentManager as He}from"./3d/environment/EnvironmentManager.js";import Ue from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as We}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as Ge}from"./3d/layers/graphics/Labeler.js";import Ke from"./3d/layers/i3s/I3SLodHandling.js";import{Navigation3D as qe}from"./3d/navigation/Navigation3D.js";import{ScreenSizePerspective as Je}from"./3d/state/ScreenSizePerspective.js";import I from"./3d/state/ViewState.js";import{ViewStateManager as Ye,cleanupViewStateManager as Xe}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as Ze}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Qe}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as $e}from"./3d/state/utils/navigationUtils.js";import et from"./3d/support/Attribution3D.js";import{CombinedElevationProvider as tt}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as L}from"./3d/support/debugFlags.js";import{getElevationAtPoint as nt}from"./3d/support/ElevationProvider.js";import{GroundAndIMSurface as rt}from"./3d/support/GroundAndIMSurface.js";import{toMap as it,hitTest as at}from"./3d/support/hitTest.js";import{popupHitTest as ot}from"./3d/support/popupHitTest.js";import{getDefaultQualityProfileName as st,getQualityProfileSettings as R}from"./3d/support/QualityProfile.js";import z from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as ct}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as lt}from"./3d/support/ResourceController.js";import ut from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as dt}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as ft}from"./3d/support/ViewSlice.js";import{PointsOfInterest as B}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import V from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as pt,getTiledLayerInfo as mt,checkIfTileInfoSupportedForView as ht}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as gt}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as _t}from"./3d/terrain/TileRenderer.js";import{Stage as vt}from"./3d/webgl-engine/Stage.js";import{olidEnabled as yt}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as bt}from"./3d/webgl-engine/effects/geometry/RenderOccluded.js";import{defaultTolerance as H}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as xt}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as U}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as St}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import W from"./interactive/options/ViewOptions.js";import Ct from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as wt}from"./support/drapedUtils.js";import{occludeesSupported as Tt}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as G,createScreenPointFromSupportedEvent as K}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Et}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as Dt,destroyTextureCompressionWorker as Ot}from"./support/TextureCompressionHelper.js";import kt from"./ui/DefaultUI.js";import At from"./ui/3d/DefaultUI3D.js";import jt from"../webscene/Environment.js";import{clearVNodeCache as Mt}from"../widgets/support/vnodeCache.js";var q;const Nt=Symbol(),J=Symbol();function Pt(e){let t=b(W,e);return t!==e&&e.snapping?.enabled==null&&(t.snapping.enabled=!0),t}let Y=class extends Fe(Le(Ie(A))){static{q=this}get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this.options=new W({snapping:{enabled:!0}}),this._userClippingArea=null,this._clippingArea=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=lt(this),this.deconflictor=new We({view:this}),this.attribution3D=new et({view:this}),this.labeler=new Ge({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.navigation=new qe({view:this}),this.basemapTerrain=null,this.elevationProvider=new tt({view:this}),this._canvas=null,this.constraints=new P,this._environment=new F,this.environmentManager=new He,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new Ct({importAnalysisViewModule:e=>Be(e),view:this}),this.groundView=null,this.groundAndIMSurface=null,this.map=null,this._featureTileTreeClients=new ie,this._featureTiles=null,this._featureTreeDebugger=null,this.state=new I({view:this}),this.slice=new ft,this.spatialReference=null,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type=`3d`,this.ui=new At,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,ye();let t=()=>this._updatingChanged();this.addHandles(s(ee(()=>this.map?.allLayers,async e=>{try{await e.when()}catch{}finally{t()}}))),this.addHandles([f(()=>this.map?.allLayers,`after-changes`,t,{onListenerAdd:t,onListenerRemove:t,sync:!0}),this.allLayerViews.on(`after-changes`,e=>this._updateUpdatingMonitors(e)),p(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new Ue({view:this}),this.stateManager=new Ye({view:this}),this.screenSizePerspective=new Je({view:this})}initialize(){if(has(`enable-feature:esri-compress-textures`)&&has(`wasm-simd`)){let e=Dt(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new ze({view:this}),this.groundAndIMSurface=new rt({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},m),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},m),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>oe(e>0?1e3/Math.ceil(e):0),m),this.addHandles([p(()=>this.spatialReference,()=>this.notifyChange(`clippingArea`),h),p(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),h)])}destroy(){this.destroyed||(Ot(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.elevationProvider.destroy(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.layerViewManager.clear(),this._set(`analysisViewManager`,u(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=u(this.sharedSymbolResources),this._set(`labeler`,u(this.labeler)),this._set(`deconflictor`,u(this.deconflictor)),this._resourceController=u(this._resourceController),this._set(`stateManager`,u(this.stateManager)),this._set(`inputManager`,u(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles(`updatingMonitors`),this._set(`environmentManager`,u(this.environmentManager)),this._set(`environment`,u(this.environment)),this.groundView=u(this.groundView),this.groundAndIMSurface.destroy(),this.slice.destroy(),this._updatingObjectsWithProgress.length=0,this._updatingObjects.length=0,this.ui?.destroy(),this._set(`ui`,null),this._set(`renderCanvas`,null),this._set(`canvas`,null),this._canvas=null,this.screenSizePerspective.destroy(),this.attribution3D.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get groundSpatialReference(){return this.groundView?.spatialReference}get analyses(){return super.analyses}set analyses(e){super.analyses=e}get animation(){return this.state?.animation}get overlayManager(){return this.basemapTerrain?.overlayManager}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get canvas(){return this._canvas}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=y(S,e))}get clippingArea(){if(this.viewingMode===`global`)return null;let e=this.map,t=this._userClippingArea||te(e,`clippingArea`);return!(this._userClippingArea||te(e,`clippingEnabled`))||t==null?(this._clippingArea=null,null):t instanceof x?this.spatialReference&&(t=X(t,this.spatialReference),t==null)?(l.getLogger(this).error(`#clippingArea`,`setting clippingArea with incompatible SpatialReference`),this._clippingArea):(t=t.clone(),t.intersection(this._groundAndLayersExtent)??(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error(`#clippingArea`,`only clippingArea geometries of type Extent are supported`),this._clippingArea)}set clippingArea(e){if(this.ready&&this.viewingMode===`global`&&e!=null){l.getLogger(this).error(`#clippingArea=`,`Clipping area is only supported in local viewingMode`);return}this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===1)return null;let e=this.renderSpatialReference,t=this.dataExtent;return t==null||e==null||t.spatialReference.equals(e)?t:X(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent,t=this.spatialReference||w.WGS84,n=X(this.clippingArea,t);n!=null&&(e=e==null?n:e.intersection(n));let r=this._get(`dataExtent`);return e!=null&&e.equals(r)?r:e}get _groundAndLayersExtent(){let e=this.spatialReference||w.WGS84,t,n=n=>{let r=X(n,e);r!=null&&(t==null?t=r.clone():t.union(r))},{groundView:r}=this,i=r?.spatialReference,a=r?.fullGroundExtent;i&&a&&n(new x({xmin:a[0],ymin:a[1],zmin:0,xmax:a[2],ymax:a[3],zmax:0,spatialReference:i}));let o=e=>{e.fullExtent!=null&&(e.type!==`graphics`||!e.internal)&&n(e.fullExtent)};if(this.map?.allLayers.forEach(e=>o(e)),t==null)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);let s=this._get(`_groundAndLayersExtent`);return t.equals(s)?s:t}get environment(){return this._environment}set environment(e){if(this._environment===e)return;let{_environment:t}=this;this._environment=null,t?.destroy(),this._environment=e,this.notifyChange(`environment`)}castEnvironment(e){return e?e instanceof F?e:e instanceof jt?this.environment?.cloneWithWebsceneEnvironment(e)??F.fromWebsceneEnvironment(e):y(F,e):new F}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get _layerToLayerviewMapping(){return q._layerToLayerview}static{this._layerToLayerview=A._layerToLayerview.concat([[`view.map.ground.layers`,`view.groundView.layerViews`]])}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get scene(){return this.map&&Pe in this.map?this.map:null}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get featureTiles(){return this._featureTiles}set qualityProfile(e){let t=R(e);t&&this._get(`qualityProfile`)!==e&&(this.qualitySettings=new z(t),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set(`qualityProfile`,e))}get qualityProfile(){return this._get(`qualityProfile`)||st()}_updateSlice(){this.stage!=null&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return this.viewingMode?!!this.stateManager?.preinit(this.spatialReference):!1}get resolution(){let{scale:e,spatialReference:t}=this;return t?he(()=>De(e,t)):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get terrainLevel(){let e=this.basemapTerrain?.tilingScheme,t=this.scale;if(!e||!t)return null;let n=e.levelAtScale(t)+this.qualitySettings.tiledSurface.lodBias,r=e.getMaxLod();return n<=0?null:Math.max(0,Math.min(n,r||1/0))}get heightModelInfo(){let e=this.getDefaultHeightModelInfo();if(!e)return null;let t=de(this.spatialReference);if(t&&e.heightUnit!==t)return new be({heightModel:e.heightModel,heightUnit:t,vertCRS:e.vertCRS,associatedSpatialReference:e.associatedSpatialReference});if(!e.associatedSpatialReference){let t=e.clone();return t.associatedSpatialReference=this.spatialReference,t}return e}get alphaCompositingEnabled(){return this._get(`alphaCompositingEnabled`)}set alphaCompositingEnabled(e){this._stage&&l.getLogger(this).warn(`alphaCompositingEnabled cannot be changed after the view has become ready`),this._set(`alphaCompositingEnabled`,e)}get updating(){if(this.destroying||this.destroyed)return!1;if(!this.initialized)return!0;let e=0,t=this.layerViewManager.updating,n=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach(r=>{if(!r.isFulfilled())++n;else if(r.updating){if(t=!0,r.suspended||pt(r))return;++n,e+=r.updatingProgress}});let r=.1;for(let t of this._updatingObjects)t?.updating&&(n+=r,e+=.5*r);for(let t of this._updatingObjectsWithProgress)t?.updating&&(++n,e+=t.updatingProgress);let i=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||n>0||this.updatingHandles.updating||!this.ready||!this.stationary||i||this._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some(e=>!e.isFulfilled())),t?(this._numUpdating=Math.max(n,this._numUpdating),e+=this._numUpdating-n):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=+!t,this._get(`updatingProgress`)!==e){let n=performance.now();if(e<1){let t=Math.min((n-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set(`updatingProgress`,e),this._lastUpdateTime=t&&e<1?n:0}return L.UPDATING&&console.log(`Updating:`,this._updatingObjectsToDebug.filter(e=>e!=null&&e.updating).map(({declaredClass:e})=>e)),t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager,this.focusAreasView]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get _updatingObjectsToDebug(){return L.UPDATING?this._updatingObjects.concat(this._updatingObjectsWithProgress).concat(this.allLayerViews.toArray()):[]}get viewingMode(){let e=this._predeterminedViewingMode;if(e!=null)return j(e);let t=this.spatialReference;return t?this.defaultsFromMap?.viewingMode!=null&&t.equals(this.defaultsFromMap.spatialReference)?j(this.defaultsFromMap.viewingMode):Et(t,1)?`global`:`local`:`global`}set viewingMode(e){this.ready?l.getLogger(this).error(`#viewingMode`,`viewingMode cannot be set once view is ready`):this._overrideIfSome(`viewingMode`,e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new ut(this)}on(e,t,n,r){return this.viewEvents.on(e,t,n,r)||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error(`#toMap()`,`Scene view cannot be used before it is ready`),null;let n=G(e)?K(this,e):e;return it(this,n,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error(`#toScreen()`,`Scene view cannot be used before it is ready`),null;let t=e;return e.z??(t=Ft,t.x=e.x,t.y=e.y,t.z=nt(this.elevationProvider,e)??0,t.spatialReference=e.spatialReference),T(t,Z,this.renderSpatialReference),this.state.camera.projectToScreen(Z,Q),ce(Q[0],Q[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error(`#pixelSizeAt()`,`Scene view cannot be used before it is ready`),null;if(!e)return 0;let n=this.renderSpatialReference;T(e,Z,n);let r=this.state.camera.computeScreenPixelSizeAt(Z);return t&&n!==t?r*fe(n)/fe(t):r}overlayPixelSizeInMapUnits(e){return this.overlayManager?.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e))??1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error(`#hitTest()`,`Scene view cannot be used before it is ready`),null;let n=G(e)?K(this,e):e;return at(this,n,t,this._defaultHitTestOptions)}async popupHitTest(e){return ot(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async zoomIn(){if(this.canZoomIn)return this.navigation.zoom(!0)}async zoomOut(){if(this.canZoomOut)return this.navigation.zoom(!1)}async whenAnalysisView(e){if(e.parent==null)throw new a(`view:no-analysisview-for-analysis`,`The analysis does not exist in view.analyses`,{analysis:e});switch(e.parent.type){case`line-of-sight`:case`dimension`:case`viewshed`:return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){let t=await this._completeSettings(e);await this.whenReady();let n=(await this.stage.renderView.takeScreenshot(t))[0];return(await import(`./support/screenshotUtils.js`)).encode(n,t,this._pixelFormat())}async _takeScreenshot(e){let t=await this._completeSettings(e);await this.whenReady();let n=(await this.stage.renderView.takeScreenshot(t))[0];return(await import(`./support/screenshotUtils.js`)).encodeData(n,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){let t=await this._completeSettings(e);t.olidColor=!0,await this.whenReady();let n=await this.stage.renderView.takeScreenshot(t),{encodeData:r}=await import(`./support/screenshotUtils.js`);return[r(n[0],this._pixelFormat()),r(n[1],this._pixelFormat())]}async _completeSettings(e){let{toRenderSettings:t,screenshotSuperSampleSettings:n}=await import(`./support/screenshotUtils.js`),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,n(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!yt())throw new a(`360vr:objectAndLayerId-rendering-disabled`,`has enable-feature:objectAndLayerId-rendering must be true`);let{encode:t}=await import(`./support/screenshotUtils.js`),n=await this._completeSettings(e);n.olidColor=!0,await this.whenReady();let r=await this.stage.renderView.takeScreenshot(n),i=t(r[0],n,this._pixelFormat()),o=await this._completeSettings(e);return o.format=`png`,[i,t(r[1],o,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){let e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new a(`360vr:objectAndLayerId-rendering-disabled`,`has enable-feature:objectAndLayerId-rendering must be true`)}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}getAttributionItems(){return super.getAttributionItems().concat(this.attribution3D.attributionItems)}importLayerView(e){return N.importLayerView(e)}hasLayerViewModule(e){return N.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getWebDocumentSpatialReference(){return this.scene?.initialViewProperties?.spatialReference}getDefaultTimeZone(){return this.scene?.initialViewProperties?.timeZone??null}getSurface(){return this.surface}get _predeterminedViewingMode(){let e=this._isOverridden(`viewingMode`)?this._get(`viewingMode`):this.scene?.initialViewProperties?.viewingMode;return e==null?null:M(e)}getSpatialReferenceSupport(e,t){let n=this._predeterminedViewingMode,r=r=>this._validateSpatialReferenceForViewingMode(e,t,r)?this._makeSpatialReferenceConstraints(e,t,r,n):null,i=n?r(n):[...r(1)??[],...r(2)??[]];return i?.length?{constraints:i}:null}_validateSpatialReferenceForViewingMode(e,t,n){return Et(e,n)?t==null||E(t)?!0:!(D(t)&&mt(t,e,n)==null||O(t)&&n===1):!1}_makeSpatialReferenceConstraints(e,t,n,r){if(t==null)return[{spatialReference:e,viewingMode:n}];let{isWebMercator:i,isWGS84:a,vcsWkid:o,latestVcsWkid:s}=e,c=()=>o==null?i?w.WGS84:w.WebMercator:new w({...i?Oe:ke,vcsWkid:o,latestVcsWkid:s});return E(t)&&(i||a)?!(a&&r!==2)||ht(t.tileInfo,t.fullExtent,e,1)===null?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:n}]:[{spatialReference:c(),viewingMode:n}]:!D(t)&&!O(t)&&(i||a)?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:n}]:D(t)&&i&&n!==1?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:2}]:[{spatialReference:e,viewingMode:n}]}_validateSpatialReference(e){let t=this.getSpatialReferenceSupport(e)!=null,n=this._predeterminedViewingMode;return t||(n==null?e.isGeographic&&l.getLogger(this).warnOnce(`Spatial reference is geographic but not supported.`):l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${j(n)} viewing mode.`)),t}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error(`trackGraphicState`,`GraphicState.graphic must not be null or undefined to start tracking`),null;let t=this.getViewForGraphic(e.graphic),n=null,r=!1,i=t=>{!r&&t!=null&&`processor`in t&&t.processor?.type===`graphics-3d`&&t.processor.graphicsCore&&(n=t.processor.graphicsCore.trackGraphicState(e))};return t==null?this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then(e=>i(e),()=>{}).catch(()=>{}):i(t),c(()=>{r=!0,n!=null&&(n.remove(),n=null)})}maskOccludee(e){if(!e)return l.getLogger(this).error(`maskOccludee`,`GraphicState.graphic must not be null or undefined to mask an occludee`),null;let t=this.getViewForGraphic(e),n=null,r=!1,i=t=>{!r&&t!=null&&Tt(t)&&(n=t.maskOccludee(e))};return t==null?this.whenViewForGraphic(e,{waitForLayer:!0}).then(e=>i(e),()=>{}).catch(()=>{}):i(t),c(()=>{r=!0,n!=null&&(n.remove(),n=null)})}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter(e=>e.type!==`media-3d`).find(t=>t.layer===e.layer):null}graphicChanged(e){this.graphicsView!=null&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await ae(()=>this.graphicsView),this.graphicsView):!e.layer||!this.map?null:!t||!t.waitForLayer||this.map.allLayers.includes(e.layer)?this.whenLayerView(e.layer):new Promise((t,n)=>{let r=this.map.allLayers.on(`change`,i=>{i.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,n))})})}enableFeatureTiles(){let e=Symbol();return this._featureTileTreeClients.add(e),c(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){let n=new AbortController;this._importControllers.set(e,n),this._updatingChanged();try{let r=await It[e]();if(t&&(ne(this),d(n.signal),await t(n.signal)),this.destroyed)throw re();return d(n.signal),r}catch{return null}finally{this._importControllers.delete(e),this._updatingChanged()}}_abortImport(e){this._importControllers.get(e)?.abort(),this._importControllers.delete(e),this._updatingChanged()}_initBasemapTerrain(){this._set(`basemapTerrain`,new V({view:this})),this.elevationProvider.register(0,this.basemapTerrain)}_exitBasemapTerrain(){let{basemapTerrain:e,elevationProvider:t}=this;e&&(this._set(`basemapTerrain`,null),t.unregister(e),e.destroy())}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set(`pointsOfInterest`,new B({view:this})),this.addHandles([this.updatingHandles.add(()=>L.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import(`./3d/layers/support/FeatureTileTree3DDebugger.js`)).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&L.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=u(this._featureTreeDebugger))},g),this.updatingHandles.add(()=>({basemapExtent:this.groundView?.groundExtent,basemapSpatialReference:this.groundView?.spatialReference,clippingArea:this.clippingArea,featureTiles:this._featureTiles}),({basemapExtent:e,basemapSpatialReference:t,clippingArea:n,featureTiles:r})=>{if(!r)return;let i=!!e;if(!n&&!i)r.filterExtent=null;else if(!i||!t)r.filterExtent=n;else{let i=e&&t?C(we(e,t),this.spatialReference):null;r.filterExtent=n?n.intersection(i):i}},g),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this.updatingHandles.consumePromise(this._ensureFeatureTileTree()):this._featureTiles=u(this._featureTiles)},h)],Nt),this.stateManager.init()}async _ensureFeatureTileTree(){if(this._featureTiles||this._importControllers.has(`FeatureTileTree3D`))return;let e=(await this.updatingHandles.addPromise(this._importModule(`FeatureTileTree3D`)))?.FeatureTileTree3D;e&&(this._featureTiles=new e({renderCoordsHelper:this.renderCoordsHelper,pointsOfInterest:this.pointsOfInterest,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}),this._updatingChanged())}_exitTerrain(){this.stateManager.exit(),this.removeHandles(J),this.removeHandles(Nt),this._featureTiles=u(this.featureTiles),this._set(`pointsOfInterest`,u(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){let e=this.spatialReference,t=this.state.isGlobal,n=Ee(t,e);n!==this.renderSpatialReference&&(this._set(`renderCoordsHelper`,ct.create(this.state.viewingMode,n)),t||this.addHandles(p(()=>this.groundView?.groundExtent,e=>{let t=this.renderCoordsHelper.spatialReference;e!=null&&(e[0]!==0||e[1]!==0||e[2]!==0||e[3]!==0)&&Ce(e,this.groundView.spatialReference,$,t)&&(this.renderCoordsHelper.extent=$)},h),J),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(H/this.renderCoordsHelper.unitInMeters))}else this._set(`renderCoordsHelper`,null)}_exitCoordinateSystem(){this.removeHandles(J),this._set(`renderCoordsHelper`,null)}_updatingChanged(){this.notifyChange(`updating`)}_updateUpdatingMonitors(e=null){(e==null||e.type!==4)&&(this.removeHandles(`updatingMonitors`),this.allLayerViews.forEach(e=>{e.destroyed||(this.addHandles(p(()=>[e.updating,e.updatingProgress],()=>this._updatingChanged(),h),`updatingMonitors`),e.when(()=>this._updatingChanged(),()=>this._updatingChanged()))}),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,n){if(!this.overlay||!this.overlay.hasVisibleItems)return n;let r=e.getContext(`2d`,{willReadFrequently:!0});return r.putImageData(n,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,n.width,n.height)}_initStage(){let e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,n)=>this._renderScreenshotOverlay(e,t,n)}},t=new Qe(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set(`sceneIntersectionHelper`,t);let n=i(this.surface);this._stage=new vt({view:this,options:e,container:n}),this.notifyChange(`stage`),this._updateSlice(),this.addHandles([this.on(`pointer-move`,()=>this.stage?.renderer.resetAnimation()),o(this.stage.renderView.canvas,`webglcontextlost`,e=>{this.fatalError=new a(`webgl-context-lost`,e.statusMessage||`WebGL context lost`)})],`stage`),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(H/this.renderCoordsHelper.unitInMeters),this._set(`canvas`,this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set(`sceneIntersectionHelper`,null),this._stage=u(this.stage),this._set(`stage`,null),this.removeHandles(`stage`),this._set(`canvas`,null)}_initSurface(){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new dt({view:this,resourceController:this._resourceController})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitTerrain(),this._exitStage())}async _ensureGraphicsView(){if(this.graphicsView||this._importControllers.has(`GraphicsView3D`)||this.graphics.length===0)return;this.removeHandles(`GraphicsView3D`);let e=(await this.updatingHandles.addPromise(this._importModule(`GraphicsView3D`,e=>ae(()=>this.groundView?.ready,e))))?.default;e&&this._set(`graphicsView`,new e({view:this,getGraphics:()=>this.graphics})),this._updatingChanged()}_disposeGraphicsView(){this._abortImport(`GraphicsView3D`),this.removeHandles(`GraphicsView3D`),this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set(`graphicsView`,null))}_disposeFocusAreasView(){this._abortImport(`FocusAreasView`),this.removeHandles(`FocusAreasView`),this.focusAreasView=u(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has(`FocusAreasView`)||e===0)return;this.removeHandles(`FocusAreasView`);let t=(await this.updatingHandles.addPromise(this._importModule(`FocusAreasView`)))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){M(this.viewingMode)===1&&(this._clippingArea=null),this._initSurface(),this._set(`ready`,!0),this.addHandles(f(()=>this.graphics,`after-changes`,()=>this._ensureGraphicsView()),`GraphicsView3D`),this._ensureGraphicsView(),this.addHandles(this.updatingHandles.add(()=>this.map?.focusAreas?.areas.length??0,e=>this._ensureFocusAreasView(e),{initial:!0}),`FocusAreasView`);let e=this.scene?.initialViewProperties??null,t=e?.environment;t&&(this._overrideDefaultEnvironmentOnly?me(this.environment,t):this.environment=this.environment.cloneWithWebsceneEnvironment(t)),this.timeExtent=e?.timeExtent,e?.analyses.applyTo(this),this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();let n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach(e=>e(this))}_teardown(){this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set(`ready`,!1)}get _defaultToMapOptions(){let e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(U);for(let t of this.allLayerViews)(k(t.layer)&&(!has(`enable-feature:im-as-ground`)||t.layer.isUsedAsGroundLayer)||je(t.layer))&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){let e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(U);for(let t of this.allLayerViews)(has(`enable-feature:im-as-ground`)?k(t.layer)&&t.layer.isUsedAsGroundLayer:k(t.layer))&&t.fullOpacity<1&&e.exclude.add(t.uid);return e}static{this.type=`3d`}static clearStatics(){Mt(),ge(),ue(),St(),Xe(),Ve(),Se(),wt(),Ne(),_t(),xt(),Ze(),$e(),ve(),se(),bt(),gt(),Ke.cleanupI3SLodHandling(),Me.cleanupTilemapCache(),I.cleanupViewstate(),V.cleanupTerrainSurface()}};e([_({nonNullable:!0}),v(Pt)],Y.prototype,`options`,void 0),e([_()],Y.prototype,`_userClippingArea`,void 0),e([_()],Y.prototype,`_resourceController`,void 0),e([_()],Y.prototype,`stage`,null),e([_({readOnly:!0})],Y.prototype,`deconflictor`,void 0),e([_({readOnly:!0})],Y.prototype,`labeler`,void 0),e([_()],Y.prototype,`navigation`,void 0),e([_({type:Re,readOnly:!0})],Y.prototype,`animation`,null),e([_({readOnly:!0})],Y.prototype,`basemapTerrain`,void 0),e([_({readOnly:!0})],Y.prototype,`overlayManager`,null),e([_({readOnly:!0})],Y.prototype,`elevationProvider`,void 0),e([_()],Y.prototype,`camera`,null),e([_({type:t})],Y.prototype,`contentCamera`,null),e([_({readOnly:!0})],Y.prototype,`canvas`,null),e([_({type:S,useTypeForAutocast:!1})],Y.prototype,`center`,null),e([_({type:x})],Y.prototype,`clippingArea`,null),e([_({type:P,nonNullable:!0})],Y.prototype,`constraints`,void 0),e([_({type:x,readOnly:!0})],Y.prototype,`renderDataExtent`,null),e([_({readOnly:!0})],Y.prototype,`tileInfo`,null),e([_({type:x,readOnly:!0})],Y.prototype,`dataExtent`,null),e([_({type:x,readOnly:!0})],Y.prototype,`_groundAndLayersExtent`,null),e([_({type:F})],Y.prototype,`environment`,null),e([v(`environment`)],Y.prototype,`castEnvironment`,null),e([_({readOnly:!0})],Y.prototype,`environmentManager`,void 0),e([_({type:x})],Y.prototype,`extent`,null),e([_({type:r})],Y.prototype,`floors`,void 0),e([_()],Y.prototype,`screenCenter`,null),e([_()],Y.prototype,`frustum`,null),e([_({type:Number,readOnly:!0})],Y.prototype,`fullOpacity`,void 0),e([_({readOnly:!0})],Y.prototype,`graphicsView`,void 0),e([_()],Y.prototype,`analysisViewManager`,void 0),e([_()],Y.prototype,`groundView`,void 0),e([_({readOnly:!0})],Y.prototype,`layerviewCollections`,null),e([_({type:Boolean})],Y.prototype,`initialExtentRequired`,null),e([_()],Y.prototype,`defaultsFromMapSettings`,null),e([_()],Y.prototype,`interacting`,null),e([_()],Y.prototype,`stationary`,null),e([_()],Y.prototype,`navigating`,null),e([_()],Y.prototype,`map`,void 0),e([_()],Y.prototype,`padding`,null),e([_({type:B,readOnly:!0})],Y.prototype,`pointsOfInterest`,void 0),e([_()],Y.prototype,`_featureTiles`,void 0),e([_()],Y.prototype,`featureTiles`,null),e([_()],Y.prototype,`_featureTreeDebugger`,void 0),e([_({constructOnly:!0})],Y.prototype,`deactivatedWebGLExtensions`,void 0),e([_({constructOnly:!0})],Y.prototype,`debugWebGLExtensions`,void 0),e([_({constructOnly:!0})],Y.prototype,`renderCanvas`,void 0),e([_({constructOnly:!0})],Y.prototype,`state`,void 0),e([_()],Y.prototype,`screenSizePerspective`,void 0),e([_({readOnly:!0})],Y.prototype,`inputManager`,void 0),e([_({readOnly:!0})],Y.prototype,`stateManager`,void 0),e([_({type:[`low`,`medium`,`high`]})],Y.prototype,`qualityProfile`,null),e([_({type:z,get(){let e=this._get(`qualitySettings`);if(!e){let t=R(this.qualityProfile);e=new z(t)}return e}})],Y.prototype,`qualitySettings`,void 0),e([_()],Y.prototype,`slice`,void 0),e([_({readOnly:!0})],Y.prototype,`typeSpecificPreconditionsReady`,null),e([_({readOnly:!0})],Y.prototype,`renderCoordsHelper`,void 0),e([_({readOnly:!0})],Y.prototype,`sceneIntersectionHelper`,void 0),e([_({type:Number,readOnly:!0})],Y.prototype,`resolution`,null),e([_({type:Number})],Y.prototype,`scale`,null),e([_({readOnly:!0,type:Number})],Y.prototype,`terrainLevel`,null),e([_()],Y.prototype,`heightModelInfo`,null),e([_({type:w})],Y.prototype,`spatialReference`,void 0),e([_({type:Boolean,value:!1})],Y.prototype,`alphaCompositingEnabled`,null),e([_({constructOnly:!0})],Y.prototype,`preserveDrawingBufferEnabled`,void 0),e([_({type:Boolean})],Y.prototype,`supersampleScreenshotsEnabled`,void 0),e([_({readOnly:!0})],Y.prototype,`type`,void 0),e([_(),v(e=>e instanceof kt?e:b(At,e))],Y.prototype,`ui`,void 0),e([_({type:Boolean,readOnly:!0})],Y.prototype,`updating`,null),e([_()],Y.prototype,`_updatingObjects`,null),e([_()],Y.prototype,`_updatingObjectsWithProgress`,null),e([_()],Y.prototype,`_updatingObjectsToDebug`,null),e([_({type:Number,readOnly:!0})],Y.prototype,`updatingProgress`,void 0),e([_({type:[`global`,`local`]})],Y.prototype,`viewingMode`,null),e([_({type:n})],Y.prototype,`viewpoint`,null),e([_({readOnly:!0})],Y.prototype,`visibleArea`,null),e([_({type:Number})],Y.prototype,`zoom`,null),e([_({readOnly:!0})],Y.prototype,`quality`,null),e([_({readOnly:!0})],Y.prototype,`resolutionScale`,null),e([_()],Y.prototype,`focusAreasView`,void 0),e([_()],Y.prototype,`_defaultToMapOptions`,null),e([_()],Y.prototype,`_defaultHitTestOptions`,null),Y=q=e([pe(`esri.views.SceneView`)],Y);function X(e,t){return e!=null&&xe(e.spatialReference,t)?C(e,t):null}const Z=_e(),Q=le(),$=Te(),Ft=Ae(0,0,0,w.WebMercator),It={GraphicsView3D:()=>import(`./3d/layers/GraphicsView3D.js`),FocusAreasView:()=>import(`./3d/FocusAreasView.js`),FeatureTileTree3D:()=>import(`./3d/layers/support/FeatureTileTree3D.js`)},Lt=Y;export{Lt as default};
2
+ import{__decorate as e}from"tslib";import t from"../Camera.js";import n from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as i}from"../core/domUtils.js";import a from"../core/Error.js";import{on as o}from"../core/events.js";import{destroyHandle as s,makeHandle as c}from"../core/handleUtils.js";import has from"../core/has.js";import l from"../core/Logger.js";import{mapCollectionAsync as ee}from"../core/mapCollectionUtils.js";import{destroyMaybe as u,maybeProperty as te}from"../core/maybe.js";import{throwIfDestroyed as ne,throwIfAborted as d,createAbortError as re}from"../core/promiseUtils.js";import ie from"../core/ReactiveSet.js";import{on as f,watch as p,initial as m,sync as h,whenOnce as ae,syncAndInitial as g}from"../core/reactiveUtils.js";import{setFrameDuration as oe,cleanupScheduling as se}from"../core/scheduling.js";import{createScreenPoint as ce,createScreenPointArray as le}from"../core/screenUtils.js";import{cleanupWhereClauseCache as ue}from"../core/sql.js";import{getDefaultVerticalUnitStringForSR as de,getMetersPerUnitForSR as fe}from"../core/units.js";import{property as _,cast as v,subclass as pe}from"../core/accessorSupport/decorators.js";import{ensureType as y,ensureClass as b}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as me}from"../core/accessorSupport/overrideDefaultsFrom.js";import{runUntracked as he}from"../core/accessorSupport/tracking.js";import{drainNotificationQueue as ge}from"../core/accessorSupport/trackingUtils.js";import{create as _e}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as ve}from"../core/libs/rbush/PooledRBush.js";import{initialize as ye}from"../core/workers/workers.js";import x from"../geometry/Extent.js";import be from"../geometry/HeightModelInfo.js";import S from"../geometry/Point.js";import{project as C,canProjectWithoutEngine as xe}from"../geometry/projectionUtils.js";import w from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as Se}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as Ce}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as T}from"../geometry/projection/projectPointToVector.js";import{toExtent as we,create as Te}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as Ee}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as De}from"../geometry/support/scaleUtils.js";import{wgs84 as Oe,webMercator as ke}from"../geometry/support/spatialReferenceUtils.js";import{makeDehydratedPoint as Ae}from"../layers/graphics/dehydratedPoint.js";import{isImageryTileLayer as E,isTiledLayer as D,isVoxelLayer as O,isIntegratedMeshLayer as k,isGaussianSplatLayer as je}from"../layers/support/layerUtils.js";import{TilemapCache as Me}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as Ne}from"../portal/portalDefault.js";import{WebSceneTag as Pe}from"../support/tagSymbols.js";import{BreakpointsOwner as Fe}from"./BreakpointsOwner.js";import{DOMContainer as Ie}from"./DOMContainer.js";import{PopupView as Le}from"./PopupView.js";import A from"./View.js";import Re from"./ViewAnimation.js";import{stringFromViewingMode as j,viewingModeFromString as M}from"./ViewingMode.js";import{GroundView3D as ze}from"./3d/GroundView3D.js";import{layerView3DImporter as N}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as Be}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as Ve}from"./3d/camera/intersectionUtils.js";import P from"./3d/constraints/Constraints.js";import F from"./3d/environment/Environment.js";import{EnvironmentManager as He}from"./3d/environment/EnvironmentManager.js";import Ue from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as We}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as Ge}from"./3d/layers/graphics/Labeler.js";import Ke from"./3d/layers/i3s/I3SLodHandling.js";import{Navigation3D as qe}from"./3d/navigation/Navigation3D.js";import{ScreenSizePerspective as Je}from"./3d/state/ScreenSizePerspective.js";import I from"./3d/state/ViewState.js";import{ViewStateManager as Ye,cleanupViewStateManager as Xe}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as Ze}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Qe}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as $e}from"./3d/state/utils/navigationUtils.js";import et from"./3d/support/Attribution3D.js";import{CombinedElevationProvider as tt}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as L}from"./3d/support/debugFlags.js";import{getElevationAtPoint as nt}from"./3d/support/ElevationProvider.js";import{GroundAndIMSurface as rt}from"./3d/support/GroundAndIMSurface.js";import{toMap as it,hitTest as at}from"./3d/support/hitTest.js";import{popupHitTest as ot}from"./3d/support/popupHitTest.js";import{getDefaultQualityProfileName as st,getQualityProfileSettings as R}from"./3d/support/QualityProfile.js";import z from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as ct}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as lt}from"./3d/support/ResourceController.js";import ut from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as dt}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as ft}from"./3d/support/ViewSlice.js";import{PointsOfInterest as B}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import V from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as pt,getTiledLayerInfo as mt,checkIfTileInfoSupportedForView as ht}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as gt}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as _t}from"./3d/terrain/TileRenderer.js";import{Stage as vt}from"./3d/webgl-engine/Stage.js";import{olidEnabled as yt}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as bt}from"./3d/webgl-engine/effects/geometry/RenderOccluded.js";import{defaultTolerance as H}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as xt}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as U}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as St}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import W from"./interactive/options/ViewOptions.js";import Ct from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as wt}from"./support/drapedUtils.js";import{occludeesSupported as Tt}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as G,createScreenPointFromSupportedEvent as K}from"./support/screenUtils.js";import{isSpatialReferenceSupported as Et}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as Dt,destroyTextureCompressionWorker as Ot}from"./support/TextureCompressionHelper.js";import kt from"./ui/DefaultUI.js";import At from"./ui/3d/DefaultUI3D.js";import jt from"../webscene/Environment.js";import{clearVNodeCache as Mt}from"../widgets/support/vnodeCache.js";var q;const Nt=Symbol(),J=Symbol();function Pt(e){let t=b(W,e);return t!==e&&e.snapping?.enabled==null&&(t.snapping.enabled=!0),t}let Y=class extends Fe(Le(Ie(A))){static{q=this}get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this.options=new W({snapping:{enabled:!0}}),this._userClippingArea=null,this._clippingArea=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=lt(this),this.deconflictor=new We({view:this}),this.attribution3D=new et({view:this}),this.labeler=new Ge({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.navigation=new qe({view:this}),this.basemapTerrain=null,this.elevationProvider=new tt({view:this}),this._canvas=null,this.constraints=new P,this._environment=new F,this.environmentManager=new He,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new Ct({importAnalysisViewModule:e=>Be(e),view:this}),this.groundView=null,this.groundAndIMSurface=null,this.map=null,this._featureTileTreeClients=new ie,this._featureTiles=null,this._featureTreeDebugger=null,this.state=new I({view:this}),this.slice=new ft,this.spatialReference=null,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type=`3d`,this.ui=new At,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,ye();let t=()=>this._updatingChanged();this.addHandles(s(ee(()=>this.map?.allLayers,async e=>{try{await e.when()}catch{}finally{t()}}))),this.addHandles([f(()=>this.map?.allLayers,`after-changes`,t,{onListenerAdd:t,onListenerRemove:t,sync:!0}),this.allLayerViews.on(`after-changes`,e=>this._updateUpdatingMonitors(e)),p(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new Ue({view:this}),this.stateManager=new Ye({view:this}),this.screenSizePerspective=new Je({view:this})}initialize(){if(!has(`disable-feature:esri-compress-textures`)&&has(`wasm-simd`)){let e=Dt(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new ze({view:this}),this.groundAndIMSurface=new rt({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},m),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},m),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>oe(e>0?1e3/Math.ceil(e):0),m),this.addHandles([p(()=>this.spatialReference,()=>this.notifyChange(`clippingArea`),h),p(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),h)])}destroy(){this.destroyed||(Ot(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.elevationProvider.destroy(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.layerViewManager.clear(),this._set(`analysisViewManager`,u(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=u(this.sharedSymbolResources),this._set(`labeler`,u(this.labeler)),this._set(`deconflictor`,u(this.deconflictor)),this._resourceController=u(this._resourceController),this._set(`stateManager`,u(this.stateManager)),this._set(`inputManager`,u(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles(`updatingMonitors`),this._set(`environmentManager`,u(this.environmentManager)),this._set(`environment`,u(this.environment)),this.groundView=u(this.groundView),this.groundAndIMSurface.destroy(),this.slice.destroy(),this._updatingObjectsWithProgress.length=0,this._updatingObjects.length=0,this.ui?.destroy(),this._set(`ui`,null),this._set(`renderCanvas`,null),this._set(`canvas`,null),this._canvas=null,this.screenSizePerspective.destroy(),this.attribution3D.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get groundSpatialReference(){return this.groundView?.spatialReference}get analyses(){return super.analyses}set analyses(e){super.analyses=e}get animation(){return this.state?.animation}get overlayManager(){return this.basemapTerrain?.overlayManager}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get canvas(){return this._canvas}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=y(S,e))}get clippingArea(){if(this.viewingMode===`global`)return null;let e=this.map,t=this._userClippingArea||te(e,`clippingArea`);return!(this._userClippingArea||te(e,`clippingEnabled`))||t==null?(this._clippingArea=null,null):t instanceof x?this.spatialReference&&(t=X(t,this.spatialReference),t==null)?(l.getLogger(this).error(`#clippingArea`,`setting clippingArea with incompatible SpatialReference`),this._clippingArea):(t=t.clone(),t.intersection(this._groundAndLayersExtent)??(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(l.getLogger(this).error(`#clippingArea`,`only clippingArea geometries of type Extent are supported`),this._clippingArea)}set clippingArea(e){if(this.ready&&this.viewingMode===`global`&&e!=null){l.getLogger(this).error(`#clippingArea=`,`Clipping area is only supported in local viewingMode`);return}this._userClippingArea=e}get renderDataExtent(){if(this.state.viewingMode===1)return null;let e=this.renderSpatialReference,t=this.dataExtent;return t==null||e==null||t.spatialReference.equals(e)?t:X(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent,t=this.spatialReference||w.WGS84,n=X(this.clippingArea,t);n!=null&&(e=e==null?n:e.intersection(n));let r=this._get(`dataExtent`);return e!=null&&e.equals(r)?r:e}get _groundAndLayersExtent(){let e=this.spatialReference||w.WGS84,t,n=n=>{let r=X(n,e);r!=null&&(t==null?t=r.clone():t.union(r))},{groundView:r}=this,i=r?.spatialReference,a=r?.fullGroundExtent;i&&a&&n(new x({xmin:a[0],ymin:a[1],zmin:0,xmax:a[2],ymax:a[3],zmax:0,spatialReference:i}));let o=e=>{e.fullExtent!=null&&(e.type!==`graphics`||!e.internal)&&n(e.fullExtent)};if(this.map?.allLayers.forEach(e=>o(e)),t==null)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);let s=this._get(`_groundAndLayersExtent`);return t.equals(s)?s:t}get environment(){return this._environment}set environment(e){if(this._environment===e)return;let{_environment:t}=this;this._environment=null,t?.destroy(),this._environment=e,this.notifyChange(`environment`)}castEnvironment(e){return e?e instanceof F?e:e instanceof jt?this.environment?.cloneWithWebsceneEnvironment(e)??F.fromWebsceneEnvironment(e):y(F,e):new F}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get _layerToLayerviewMapping(){return q._layerToLayerview}static{this._layerToLayerview=A._layerToLayerview.concat([[`view.map.ground.layers`,`view.groundView.layerViews`]])}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get scene(){return this.map&&Pe in this.map?this.map:null}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get featureTiles(){return this._featureTiles}set qualityProfile(e){let t=R(e);t&&this._get(`qualityProfile`)!==e&&(this.qualitySettings=new z(t),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set(`qualityProfile`,e))}get qualityProfile(){return this._get(`qualityProfile`)||st()}_updateSlice(){this.stage!=null&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return this.viewingMode?!!this.stateManager?.preinit(this.spatialReference):!1}get resolution(){let{scale:e,spatialReference:t}=this;return t?he(()=>De(e,t)):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get terrainLevel(){let e=this.basemapTerrain?.tilingScheme,t=this.scale;if(!e||!t)return null;let n=e.levelAtScale(t)+this.qualitySettings.tiledSurface.lodBias,r=e.getMaxLod();return n<=0?null:Math.max(0,Math.min(n,r||1/0))}get heightModelInfo(){let e=this.getDefaultHeightModelInfo();if(!e)return null;let t=de(this.spatialReference);if(t&&e.heightUnit!==t)return new be({heightModel:e.heightModel,heightUnit:t,vertCRS:e.vertCRS,associatedSpatialReference:e.associatedSpatialReference});if(!e.associatedSpatialReference){let t=e.clone();return t.associatedSpatialReference=this.spatialReference,t}return e}get alphaCompositingEnabled(){return this._get(`alphaCompositingEnabled`)}set alphaCompositingEnabled(e){this._stage&&l.getLogger(this).warn(`alphaCompositingEnabled cannot be changed after the view has become ready`),this._set(`alphaCompositingEnabled`,e)}get updating(){if(this.destroying||this.destroyed)return!1;if(!this.initialized)return!0;let e=0,t=this.layerViewManager.updating,n=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach(r=>{if(!r.isFulfilled())++n;else if(r.updating){if(t=!0,r.suspended||pt(r))return;++n,e+=r.updatingProgress}});let r=.1;for(let t of this._updatingObjects)t?.updating&&(n+=r,e+=.5*r);for(let t of this._updatingObjectsWithProgress)t?.updating&&(++n,e+=t.updatingProgress);let i=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||n>0||this.updatingHandles.updating||!this.ready||!this.stationary||i||this._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some(e=>!e.isFulfilled())),t?(this._numUpdating=Math.max(n,this._numUpdating),e+=this._numUpdating-n):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=+!t,this._get(`updatingProgress`)!==e){let n=performance.now();if(e<1){let t=Math.min((n-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set(`updatingProgress`,e),this._lastUpdateTime=t&&e<1?n:0}return L.UPDATING&&console.log(`Updating:`,this._updatingObjectsToDebug.filter(e=>e!=null&&e.updating).map(({declaredClass:e})=>e)),t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager,this.focusAreasView]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get _updatingObjectsToDebug(){return L.UPDATING?this._updatingObjects.concat(this._updatingObjectsWithProgress).concat(this.allLayerViews.toArray()):[]}get viewingMode(){let e=this._predeterminedViewingMode;if(e!=null)return j(e);let t=this.spatialReference;return t?this.defaultsFromMap?.viewingMode!=null&&t.equals(this.defaultsFromMap.spatialReference)?j(this.defaultsFromMap.viewingMode):Et(t,1)?`global`:`local`:`global`}set viewingMode(e){this.ready?l.getLogger(this).error(`#viewingMode`,`viewingMode cannot be set once view is ready`):this._overrideIfSome(`viewingMode`,e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new ut(this)}on(e,t,n,r){return this.viewEvents.on(e,t,n,r)||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return l.getLogger(this).error(`#toMap()`,`Scene view cannot be used before it is ready`),null;let n=G(e)?K(this,e):e;return it(this,n,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return l.getLogger(this).error(`#toScreen()`,`Scene view cannot be used before it is ready`),null;let t=e;return e.z??(t=Ft,t.x=e.x,t.y=e.y,t.z=nt(this.elevationProvider,e)??0,t.spatialReference=e.spatialReference),T(t,Z,this.renderSpatialReference),this.state.camera.projectToScreen(Z,Q),ce(Q[0],Q[1])}pixelSizeAt(e,t){if(!this.ready)return l.getLogger(this).error(`#pixelSizeAt()`,`Scene view cannot be used before it is ready`),null;if(!e)return 0;let n=this.renderSpatialReference;T(e,Z,n);let r=this.state.camera.computeScreenPixelSizeAt(Z);return t&&n!==t?r*fe(n)/fe(t):r}overlayPixelSizeInMapUnits(e){return this.overlayManager?.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e))??1}hitTest(e,t){if(!this.ready)return l.getLogger(this).error(`#hitTest()`,`Scene view cannot be used before it is ready`),null;let n=G(e)?K(this,e):e;return at(this,n,t,this._defaultHitTestOptions)}async popupHitTest(e){return ot(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async zoomIn(){if(this.canZoomIn)return this.navigation.zoom(!0)}async zoomOut(){if(this.canZoomOut)return this.navigation.zoom(!1)}async whenAnalysisView(e){if(e.parent==null)throw new a(`view:no-analysisview-for-analysis`,`The analysis does not exist in view.analyses`,{analysis:e});switch(e.parent.type){case`line-of-sight`:case`dimension`:case`viewshed`:return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){let t=await this._completeSettings(e);await this.whenReady();let n=(await this.stage.renderView.takeScreenshot(t))[0];return(await import(`./support/screenshotUtils.js`)).encode(n,t,this._pixelFormat())}async _takeScreenshot(e){let t=await this._completeSettings(e);await this.whenReady();let n=(await this.stage.renderView.takeScreenshot(t))[0];return(await import(`./support/screenshotUtils.js`)).encodeData(n,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){let t=await this._completeSettings(e);t.olidColor=!0,await this.whenReady();let n=await this.stage.renderView.takeScreenshot(t),{encodeData:r}=await import(`./support/screenshotUtils.js`);return[r(n[0],this._pixelFormat()),r(n[1],this._pixelFormat())]}async _completeSettings(e){let{toRenderSettings:t,screenshotSuperSampleSettings:n}=await import(`./support/screenshotUtils.js`),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,n(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!yt())throw new a(`360vr:objectAndLayerId-rendering-disabled`,`has enable-feature:objectAndLayerId-rendering must be true`);let{encode:t}=await import(`./support/screenshotUtils.js`),n=await this._completeSettings(e);n.olidColor=!0,await this.whenReady();let r=await this.stage.renderView.takeScreenshot(n),i=t(r[0],n,this._pixelFormat()),o=await this._completeSettings(e);return o.format=`png`,[i,t(r[1],o,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){let e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new a(`360vr:objectAndLayerId-rendering-disabled`,`has enable-feature:objectAndLayerId-rendering must be true`)}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}getAttributionItems(){return super.getAttributionItems().concat(this.attribution3D.attributionItems)}importLayerView(e){return N.importLayerView(e)}hasLayerViewModule(e){return N.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getWebDocumentSpatialReference(){return this.scene?.initialViewProperties?.spatialReference}getDefaultTimeZone(){return this.scene?.initialViewProperties?.timeZone??null}getSurface(){return this.surface}get _predeterminedViewingMode(){let e=this._isOverridden(`viewingMode`)?this._get(`viewingMode`):this.scene?.initialViewProperties?.viewingMode;return e==null?null:M(e)}getSpatialReferenceSupport(e,t){let n=this._predeterminedViewingMode,r=r=>this._validateSpatialReferenceForViewingMode(e,t,r)?this._makeSpatialReferenceConstraints(e,t,r,n):null,i=n?r(n):[...r(1)??[],...r(2)??[]];return i?.length?{constraints:i}:null}_validateSpatialReferenceForViewingMode(e,t,n){return Et(e,n)?t==null||E(t)?!0:!(D(t)&&mt(t,e,n)==null||O(t)&&n===1):!1}_makeSpatialReferenceConstraints(e,t,n,r){if(t==null)return[{spatialReference:e,viewingMode:n}];let{isWebMercator:i,isWGS84:a,vcsWkid:o,latestVcsWkid:s}=e,c=()=>o==null?i?w.WGS84:w.WebMercator:new w({...i?Oe:ke,vcsWkid:o,latestVcsWkid:s});return E(t)&&(i||a)?!(a&&r!==2)||ht(t.tileInfo,t.fullExtent,e,1)===null?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:n}]:[{spatialReference:c(),viewingMode:n}]:!D(t)&&!O(t)&&(i||a)?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:n}]:D(t)&&i&&n!==1?[{spatialReference:e,viewingMode:n},{spatialReference:c(),viewingMode:2}]:[{spatialReference:e,viewingMode:n}]}_validateSpatialReference(e){let t=this.getSpatialReferenceSupport(e)!=null,n=this._predeterminedViewingMode;return t||(n==null?e.isGeographic&&l.getLogger(this).warnOnce(`Spatial reference is geographic but not supported.`):l.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${j(n)} viewing mode.`)),t}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}trackGraphicState(e){if(!e.graphic)return l.getLogger(this).error(`trackGraphicState`,`GraphicState.graphic must not be null or undefined to start tracking`),null;let t=this.getViewForGraphic(e.graphic),n=null,r=!1,i=t=>{!r&&t!=null&&`processor`in t&&t.processor?.type===`graphics-3d`&&t.processor.graphicsCore&&(n=t.processor.graphicsCore.trackGraphicState(e))};return t==null?this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then(e=>i(e),()=>{}).catch(()=>{}):i(t),c(()=>{r=!0,n!=null&&(n.remove(),n=null)})}maskOccludee(e){if(!e)return l.getLogger(this).error(`maskOccludee`,`GraphicState.graphic must not be null or undefined to mask an occludee`),null;let t=this.getViewForGraphic(e),n=null,r=!1,i=t=>{!r&&t!=null&&Tt(t)&&(n=t.maskOccludee(e))};return t==null?this.whenViewForGraphic(e,{waitForLayer:!0}).then(e=>i(e),()=>{}).catch(()=>{}):i(t),c(()=>{r=!0,n!=null&&(n.remove(),n=null)})}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter(e=>e.type!==`media-3d`).find(t=>t.layer===e.layer):null}graphicChanged(e){this.graphicsView!=null&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await ae(()=>this.graphicsView),this.graphicsView):!e.layer||!this.map?null:!t||!t.waitForLayer||this.map.allLayers.includes(e.layer)?this.whenLayerView(e.layer):new Promise((t,n)=>{let r=this.map.allLayers.on(`change`,i=>{i.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,n))})})}enableFeatureTiles(){let e=Symbol();return this._featureTileTreeClients.add(e),c(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){let n=new AbortController;this._importControllers.set(e,n),this._updatingChanged();try{let r=await It[e]();if(t&&(ne(this),d(n.signal),await t(n.signal)),this.destroyed)throw re();return d(n.signal),r}catch{return null}finally{this._importControllers.delete(e),this._updatingChanged()}}_abortImport(e){this._importControllers.get(e)?.abort(),this._importControllers.delete(e),this._updatingChanged()}_initBasemapTerrain(){this._set(`basemapTerrain`,new V({view:this})),this.elevationProvider.register(0,this.basemapTerrain)}_exitBasemapTerrain(){let{basemapTerrain:e,elevationProvider:t}=this;e&&(this._set(`basemapTerrain`,null),t.unregister(e),e.destroy())}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set(`pointsOfInterest`,new B({view:this})),this.addHandles([this.updatingHandles.add(()=>L.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import(`./3d/layers/support/FeatureTileTree3DDebugger.js`)).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&L.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=u(this._featureTreeDebugger))},g),this.updatingHandles.add(()=>({basemapExtent:this.groundView?.groundExtent,basemapSpatialReference:this.groundView?.spatialReference,clippingArea:this.clippingArea,featureTiles:this._featureTiles}),({basemapExtent:e,basemapSpatialReference:t,clippingArea:n,featureTiles:r})=>{if(!r)return;let i=!!e;if(!n&&!i)r.filterExtent=null;else if(!i||!t)r.filterExtent=n;else{let i=e&&t?C(we(e,t),this.spatialReference):null;r.filterExtent=n?n.intersection(i):i}},g),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this.updatingHandles.consumePromise(this._ensureFeatureTileTree()):this._featureTiles=u(this._featureTiles)},h)],Nt),this.stateManager.init()}async _ensureFeatureTileTree(){if(this._featureTiles||this._importControllers.has(`FeatureTileTree3D`))return;let e=(await this.updatingHandles.addPromise(this._importModule(`FeatureTileTree3D`)))?.FeatureTileTree3D;e&&(this._featureTiles=new e({renderCoordsHelper:this.renderCoordsHelper,pointsOfInterest:this.pointsOfInterest,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}),this._updatingChanged())}_exitTerrain(){this.stateManager.exit(),this.removeHandles(J),this.removeHandles(Nt),this._featureTiles=u(this.featureTiles),this._set(`pointsOfInterest`,u(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){let e=this.spatialReference,t=this.state.isGlobal,n=Ee(t,e);n!==this.renderSpatialReference&&(this._set(`renderCoordsHelper`,ct.create(this.state.viewingMode,n)),t||this.addHandles(p(()=>this.groundView?.groundExtent,e=>{let t=this.renderCoordsHelper.spatialReference;e!=null&&(e[0]!==0||e[1]!==0||e[2]!==0||e[3]!==0)&&Ce(e,this.groundView.spatialReference,$,t)&&(this.renderCoordsHelper.extent=$)},h),J),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(H/this.renderCoordsHelper.unitInMeters))}else this._set(`renderCoordsHelper`,null)}_exitCoordinateSystem(){this.removeHandles(J),this._set(`renderCoordsHelper`,null)}_updatingChanged(){this.notifyChange(`updating`)}_updateUpdatingMonitors(e=null){(e==null||e.type!==4)&&(this.removeHandles(`updatingMonitors`),this.allLayerViews.forEach(e=>{e.destroyed||(this.addHandles(p(()=>[e.updating,e.updatingProgress],()=>this._updatingChanged(),h),`updatingMonitors`),e.when(()=>this._updatingChanged(),()=>this._updatingChanged()))}),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,n){if(!this.overlay||!this.overlay.hasVisibleItems)return n;let r=e.getContext(`2d`,{willReadFrequently:!0});return r.putImageData(n,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,n.width,n.height)}_initStage(){let e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,n)=>this._renderScreenshotOverlay(e,t,n)}},t=new Qe(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set(`sceneIntersectionHelper`,t);let n=i(this.surface);this._stage=new vt({view:this,options:e,container:n}),this.notifyChange(`stage`),this._updateSlice(),this.addHandles([this.on(`pointer-move`,()=>this.stage?.renderer.resetAnimation()),o(this.stage.renderView.canvas,`webglcontextlost`,e=>{this.fatalError=new a(`webgl-context-lost`,e.statusMessage||`WebGL context lost`)})],`stage`),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(H/this.renderCoordsHelper.unitInMeters),this._set(`canvas`,this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set(`sceneIntersectionHelper`,null),this._stage=u(this.stage),this._set(`stage`,null),this.removeHandles(`stage`),this._set(`canvas`,null)}_initSurface(){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new dt({view:this,resourceController:this._resourceController})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitTerrain(),this._exitStage())}async _ensureGraphicsView(){if(this.graphicsView||this._importControllers.has(`GraphicsView3D`)||this.graphics.length===0)return;this.removeHandles(`GraphicsView3D`);let e=(await this.updatingHandles.addPromise(this._importModule(`GraphicsView3D`,e=>ae(()=>this.groundView?.ready,e))))?.default;e&&this._set(`graphicsView`,new e({view:this,getGraphics:()=>this.graphics})),this._updatingChanged()}_disposeGraphicsView(){this._abortImport(`GraphicsView3D`),this.removeHandles(`GraphicsView3D`),this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set(`graphicsView`,null))}_disposeFocusAreasView(){this._abortImport(`FocusAreasView`),this.removeHandles(`FocusAreasView`),this.focusAreasView=u(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has(`FocusAreasView`)||e===0)return;this.removeHandles(`FocusAreasView`);let t=(await this.updatingHandles.addPromise(this._importModule(`FocusAreasView`)))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){M(this.viewingMode)===1&&(this._clippingArea=null),this._initSurface(),this._set(`ready`,!0),this.addHandles(f(()=>this.graphics,`after-changes`,()=>this._ensureGraphicsView()),`GraphicsView3D`),this._ensureGraphicsView(),this.addHandles(this.updatingHandles.add(()=>this.map?.focusAreas?.areas.length??0,e=>this._ensureFocusAreasView(e),{initial:!0}),`FocusAreasView`);let e=this.scene?.initialViewProperties??null,t=e?.environment;t&&(this._overrideDefaultEnvironmentOnly?me(this.environment,t):this.environment=this.environment.cloneWithWebsceneEnvironment(t)),this.timeExtent=e?.timeExtent,e?.analyses.applyTo(this),this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();let n=this._resolveWhenReady;this._resolveWhenReady=[],n.forEach(e=>e(this))}_teardown(){this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set(`ready`,!1)}get _defaultToMapOptions(){let e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(U);for(let t of this.allLayerViews)(k(t.layer)&&(!has(`enable-feature:im-as-ground`)||t.layer.isUsedAsGroundLayer)||je(t.layer))&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){let e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(U);for(let t of this.allLayerViews)(has(`enable-feature:im-as-ground`)?k(t.layer)&&t.layer.isUsedAsGroundLayer:k(t.layer))&&t.fullOpacity<1&&e.exclude.add(t.uid);return e}static{this.type=`3d`}static clearStatics(){Mt(),ge(),ue(),St(),Xe(),Ve(),Se(),wt(),Ne(),_t(),xt(),Ze(),$e(),ve(),se(),bt(),gt(),Ke.cleanupI3SLodHandling(),Me.cleanupTilemapCache(),I.cleanupViewstate(),V.cleanupTerrainSurface()}};e([_({nonNullable:!0}),v(Pt)],Y.prototype,`options`,void 0),e([_()],Y.prototype,`_userClippingArea`,void 0),e([_()],Y.prototype,`_resourceController`,void 0),e([_()],Y.prototype,`stage`,null),e([_({readOnly:!0})],Y.prototype,`deconflictor`,void 0),e([_({readOnly:!0})],Y.prototype,`labeler`,void 0),e([_()],Y.prototype,`navigation`,void 0),e([_({type:Re,readOnly:!0})],Y.prototype,`animation`,null),e([_({readOnly:!0})],Y.prototype,`basemapTerrain`,void 0),e([_({readOnly:!0})],Y.prototype,`overlayManager`,null),e([_({readOnly:!0})],Y.prototype,`elevationProvider`,void 0),e([_()],Y.prototype,`camera`,null),e([_({type:t})],Y.prototype,`contentCamera`,null),e([_({readOnly:!0})],Y.prototype,`canvas`,null),e([_({type:S,useTypeForAutocast:!1})],Y.prototype,`center`,null),e([_({type:x})],Y.prototype,`clippingArea`,null),e([_({type:P,nonNullable:!0})],Y.prototype,`constraints`,void 0),e([_({type:x,readOnly:!0})],Y.prototype,`renderDataExtent`,null),e([_({readOnly:!0})],Y.prototype,`tileInfo`,null),e([_({type:x,readOnly:!0})],Y.prototype,`dataExtent`,null),e([_({type:x,readOnly:!0})],Y.prototype,`_groundAndLayersExtent`,null),e([_({type:F})],Y.prototype,`environment`,null),e([v(`environment`)],Y.prototype,`castEnvironment`,null),e([_({readOnly:!0})],Y.prototype,`environmentManager`,void 0),e([_({type:x})],Y.prototype,`extent`,null),e([_({type:r})],Y.prototype,`floors`,void 0),e([_()],Y.prototype,`screenCenter`,null),e([_()],Y.prototype,`frustum`,null),e([_({type:Number,readOnly:!0})],Y.prototype,`fullOpacity`,void 0),e([_({readOnly:!0})],Y.prototype,`graphicsView`,void 0),e([_()],Y.prototype,`analysisViewManager`,void 0),e([_()],Y.prototype,`groundView`,void 0),e([_({readOnly:!0})],Y.prototype,`layerviewCollections`,null),e([_({type:Boolean})],Y.prototype,`initialExtentRequired`,null),e([_()],Y.prototype,`defaultsFromMapSettings`,null),e([_()],Y.prototype,`interacting`,null),e([_()],Y.prototype,`stationary`,null),e([_()],Y.prototype,`navigating`,null),e([_()],Y.prototype,`map`,void 0),e([_()],Y.prototype,`padding`,null),e([_({type:B,readOnly:!0})],Y.prototype,`pointsOfInterest`,void 0),e([_()],Y.prototype,`_featureTiles`,void 0),e([_()],Y.prototype,`featureTiles`,null),e([_()],Y.prototype,`_featureTreeDebugger`,void 0),e([_({constructOnly:!0})],Y.prototype,`deactivatedWebGLExtensions`,void 0),e([_({constructOnly:!0})],Y.prototype,`debugWebGLExtensions`,void 0),e([_({constructOnly:!0})],Y.prototype,`renderCanvas`,void 0),e([_({constructOnly:!0})],Y.prototype,`state`,void 0),e([_()],Y.prototype,`screenSizePerspective`,void 0),e([_({readOnly:!0})],Y.prototype,`inputManager`,void 0),e([_({readOnly:!0})],Y.prototype,`stateManager`,void 0),e([_({type:[`low`,`medium`,`high`]})],Y.prototype,`qualityProfile`,null),e([_({type:z,get(){let e=this._get(`qualitySettings`);if(!e){let t=R(this.qualityProfile);e=new z(t)}return e}})],Y.prototype,`qualitySettings`,void 0),e([_()],Y.prototype,`slice`,void 0),e([_({readOnly:!0})],Y.prototype,`typeSpecificPreconditionsReady`,null),e([_({readOnly:!0})],Y.prototype,`renderCoordsHelper`,void 0),e([_({readOnly:!0})],Y.prototype,`sceneIntersectionHelper`,void 0),e([_({type:Number,readOnly:!0})],Y.prototype,`resolution`,null),e([_({type:Number})],Y.prototype,`scale`,null),e([_({readOnly:!0,type:Number})],Y.prototype,`terrainLevel`,null),e([_()],Y.prototype,`heightModelInfo`,null),e([_({type:w})],Y.prototype,`spatialReference`,void 0),e([_({type:Boolean,value:!1})],Y.prototype,`alphaCompositingEnabled`,null),e([_({constructOnly:!0})],Y.prototype,`preserveDrawingBufferEnabled`,void 0),e([_({type:Boolean})],Y.prototype,`supersampleScreenshotsEnabled`,void 0),e([_({readOnly:!0})],Y.prototype,`type`,void 0),e([_(),v(e=>e instanceof kt?e:b(At,e))],Y.prototype,`ui`,void 0),e([_({type:Boolean,readOnly:!0})],Y.prototype,`updating`,null),e([_()],Y.prototype,`_updatingObjects`,null),e([_()],Y.prototype,`_updatingObjectsWithProgress`,null),e([_()],Y.prototype,`_updatingObjectsToDebug`,null),e([_({type:Number,readOnly:!0})],Y.prototype,`updatingProgress`,void 0),e([_({type:[`global`,`local`]})],Y.prototype,`viewingMode`,null),e([_({type:n})],Y.prototype,`viewpoint`,null),e([_({readOnly:!0})],Y.prototype,`visibleArea`,null),e([_({type:Number})],Y.prototype,`zoom`,null),e([_({readOnly:!0})],Y.prototype,`quality`,null),e([_({readOnly:!0})],Y.prototype,`resolutionScale`,null),e([_()],Y.prototype,`focusAreasView`,void 0),e([_()],Y.prototype,`_defaultToMapOptions`,null),e([_()],Y.prototype,`_defaultHitTestOptions`,null),Y=q=e([pe(`esri.views.SceneView`)],Y);function X(e,t){return e!=null&&xe(e.spatialReference,t)?C(e,t):null}const Z=_e(),Q=le(),$=Te(),Ft=Ae(0,0,0,w.WebMercator),It={GraphicsView3D:()=>import(`./3d/layers/GraphicsView3D.js`),FocusAreasView:()=>import(`./3d/FocusAreasView.js`),FeatureTileTree3D:()=>import(`./3d/layers/support/FeatureTileTree3D.js`)},Lt=Y;export{Lt as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Accessor.js";import{createTask as r}from"../../../core/asyncUtils.js";import i from"../../../core/Collection.js";import{makeHandle as a}from"../../../core/handleUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{ignoreAbortErrors as s,isAborted as c,throwIfAborted as l}from"../../../core/promiseUtils.js";import{pausable as u,sync as d,watch as f,syncAndInitial as p}from"../../../core/reactiveUtils.js";import{property as m,subclass as h}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as g}from"../../../core/support/UpdatingHandles.js";import _ from"../../../layers/GraphicsLayer.js";import v from"../../../symbols/CIMSymbol.js";import y from"../../../symbols/SimpleLineSymbol.js";import b from"../../../symbols/support/ElevationInfo.js";import{ExclusiveOperationManager as x}from"../ExclusiveOperationManager.js";import{isPolyline as S,isValidInputGraphic as C,isInternalGraphic as w}from"./elevationProfileGeometryUtils.js";import{ViewEventPriorities as T}from"../../input/InputManager.js";import{isCancelEvent as E}from"../../interactive/interactiveToolUtils.js";import{makeGeometryAnalysisSnappingOptions as D}from"../../interactive/snapping/allLayerSnapping.js";import O from"../../../widgets/Sketch/SketchViewModel.js";let k=class extends n{constructor(e){super(e),this._sketchViewModels=new i,this._updatingHandles=new g,this._operationManager=new x}initialize(){let{view:e}=this;this._allLayerSnappingOptions=D(e),this._graphicsLayer=new _({listMode:`hide`,internal:!0}),this._externalGeometryChangeHandle=u(()=>this._analysis.geometry,()=>this._ensureUpdatedSketchGraphic(),d),this.addHandles([f(()=>({map:e.map,internalGraphicsLayer:this._graphicsLayer,state:this.state,geometryVisualizationVisible:this._analysis.viewOptions.geometryVisualizationVisible,visible:this.analysisViewData.visible}),({map:e,internalGraphicsLayer:t,state:n,geometryVisualizationVisible:r,visible:i})=>{j(e,t);let a=this.sketchGraphic;switch(a&&(a.visible=i),n){case`idle`:case`reshaping-disabled`:a&&!r&&(a.visible=!1),this._operationManager.stop(),this._ensureUpdatedSketchGraphic();break;case`reshaping`:s(this._startReshape());break;case`awaiting-sketch`:this.analysisViewData.interactive=!0}},p),f(()=>this._analysis.elevationInfo,e=>{this._graphicsLayer.elevationInfo=e},p),this._allLayerSnappingOptions,this._externalGeometryChangeHandle])}destroy(){this._operationManager.destroy(),this._sketchViewModels.drain(e=>o(e));let e=this._graphicsLayer;this.view.map?.remove(e),e.destroy()}get sketchGraphic(){return this._get(`sketchGraphic`)}set sketchGraphic(e){e!==this._get(`sketchGraphic`)&&(this._set(`sketchGraphic`,e),this._updateAnalysisFromSketchGraphic())}get state(){let{visible:e,interactive:t}=this.analysisViewData;if(!e)return`idle`;switch(this._operationManager.currentOperationType){case`place`:return this._sketching?`sketching`:`awaiting-sketch`;case`pick-feature`:return`picking`;default:return this._analysis.geometry?t?`reshaping`:`reshaping-disabled`:`idle`}}get updating(){return this._sketchViewModels.some(e=>e.updating)||this._updatingHandles.updating}get _sketching(){return this._sketchViewModels.some(e=>e.createGraphic===this.sketchGraphic)}get _analysis(){return this.analysisViewData.analysis}get _lineSymbol(){return A(this.view.type)}place(e){return this._operationManager.start(`place`,async t=>{let n=this._createSketchViewModel(),r=this._analysis.clone();this._ensureUpdatedSketchGraphic();let i=this.sketchGraphic,o=this._analysis.elevationInfo,l=a(()=>{this.sketchGraphic===i&&(this._graphicsLayer.elevationInfo=o)}),u=n.on(`create`,e=>{switch(e.state){case`start`:this._graphicsLayer.removeAll(),this.sketchGraphic=e.graphic,this._analysis.elevationInfo=this._graphicsLayer.elevationInfo;break;case`active`:this._updateAnalysisFromSketchGraphic();break;case`complete`:this.sketchGraphic&&(this._updateAnalysisFromSketchGraphic(),this._addSketchGraphic(this.sketchGraphic)),t.stop();break;case`cancel`:t.stop()}});t.handles.push(u,a(()=>{if(u.remove(),n.destroy(),this._sketchViewModels.remove(n),this._updateAnalysisFromSketchGraphic(),!this._analysis.valid)return this._clear(),t.reject();if(c(e)||r.equals(this._analysis))return t.reject();t.resolve({})}),l),this._graphicsLayer.elevationInfo=M,await this._updatingHandles.addPromise(s(n.create(`polyline`)))},e)}async pickFeature(e){return this._operationManager.start(`pick-feature`,async e=>{let{view:t}=this;t.closePopup();let n=null;e.handles.push(t.on(`immediate-click`,i=>{i.defer(async()=>{n?.abort(),n=r(async n=>{let{results:r}=await t.hitTest(i);l(n);let a=null;for(let e of r)if(e.type===`graphic`&&C(e.graphic)&&!w(e.graphic)){a=e.graphic;break}a&&(i.preventDefault(),i.stopPropagation(),this._externalGeometryChangeHandle.pause(),this.sketchGraphic=null,this._analysis.setGeometryFromFeature(a),this._externalGeometryChangeHandle.resume(),e.resolve({feature:a}),e.stop())}),await n.promise})},T.TOOL),t.on(`key-down`,t=>{E(t)&&(e.reject(),e.stop())},T.TOOL),t.acquireCursor(`crosshair`,`high`),a(()=>{n?.abort(),e.reject()})),t.focus()},e)}_startReshape(){let e=this._createSketchViewModel();return this._sketchViewModels.add(e),this._operationManager.start(`reshape`,async t=>{let n=()=>{let t=this._ensureUpdatedSketchGraphic();return t?this._updatingHandles.addPromise(e.update(t,{tool:`reshape`})):Promise.resolve()};if(!this._ensureUpdatedSketchGraphic())return;let r=e.on(`update`,e=>{this._updateAnalysisFromSketchGraphic(),e.state===`complete`&&(this.state===`reshaping`?s(n()):t.resolve())});t.handles.push(r,a(()=>{r.remove(),this._sketchViewModels.remove(e),e.destroy(),t.resolve()})),await n()})}_createSketchViewModel(){return new O({layer:this._graphicsLayer,view:this.view,defaultCreateOptions:{mode:`click`,hasZ:!0},updateOnGraphicClick:!1,defaultUpdateOptions:{enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,enableZ:!1,highlightOptions:{enabled:!1},multipleSelectionEnabled:!1,reshapeOptions:{shapeOperation:`none`},toggleToolOnClick:!1,tool:`reshape`},polylineSymbol:this._lineSymbol,activeLineSymbol:this._lineSymbol,snappingOptions:this._allLayerSnappingOptions.options})}_ensureUpdatedSketchGraphic(){let{geometry:e}=this._analysis;if(!e)return this.sketchGraphic=null,this._graphicsLayer.removeAll(),null;let n=this.sketchGraphic??=new t({symbol:this._lineSymbol,geometry:e});return n.geometry=e,this._addSketchGraphic(n),n}_addSketchGraphic(e){let{graphics:t}=this._graphicsLayer;t.includes(e)||t.add(e),t.length!==1&&t.removeMany(t.filter(t=>t!==e))}_clear(){this.sketchGraphic=null,this._analysis.clear()}_updateAnalysisFromSketchGraphic(){this._externalGeometryChangeHandle.pause();let e=this.sketchGraphic?.geometry;S(e)||(e=null);let t=this._analysis;t.geometry!==e&&(t.geometry=e),this._externalGeometryChangeHandle.resume()}};e([m({constructOnly:!0})],k.prototype,`analysisViewData`,void 0),e([m({constructOnly:!0})],k.prototype,`view`,void 0),e([m()],k.prototype,`sketchGraphic`,null),e([m({nonNullable:!0})],k.prototype,`state`,null),e([m()],k.prototype,`updating`,null),e([m()],k.prototype,`_sketching`,null),e([m()],k.prototype,`_analysis`,null),e([m()],k.prototype,`_lineSymbol`,null),k=e([h(`esri.views.analysis.ElevationProfile.ElevationProfileTool`)],k);function A(e){if(e===`2d`){let e={type:`CIMSolidStroke`,enable:!0,capStyle:`Butt`,joinStyle:`Round`,width:1.5};return new v({data:{type:`CIMSymbolReference`,symbol:{type:`CIMLineSymbol`,symbolLayers:[{...e,effects:[{type:`CIMGeometricEffectDashes`,dashTemplate:[5,4],lineDashEnding:`FullGap`,controlPointEnding:`NoConstraint`}],color:[0,0,0,255]},{...e,color:[255,255,255,255]}]}}})}return new y({color:[0,0,0,0]})}function j(e,t){t&&(t.removeFromParent(),e?.add(t))}const M=new b({mode:`on-the-ground`,offset:0});export{k as ElevationProfileTool};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import n from"../../../core/Accessor.js";import{createTask as r}from"../../../core/asyncUtils.js";import i from"../../../core/Collection.js";import{makeHandle as a}from"../../../core/handleUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{ignoreAbortErrors as s,isAborted as c,throwIfAborted as l}from"../../../core/promiseUtils.js";import{pausable as u,sync as d,watch as f,syncAndInitial as p}from"../../../core/reactiveUtils.js";import{property as m,subclass as h}from"../../../core/accessorSupport/decorators.js";import{UpdatingHandles as g}from"../../../core/support/UpdatingHandles.js";import _ from"../../../layers/GraphicsLayer.js";import v from"../../../symbols/CIMSymbol.js";import y from"../../../symbols/SimpleLineSymbol.js";import b from"../../../symbols/support/ElevationInfo.js";import{ExclusiveOperationManager as x}from"../ExclusiveOperationManager.js";import{isPolyline as S,isValidInputGraphic as C,isInternalGraphic as w}from"./elevationProfileGeometryUtils.js";import{ViewEventPriorities as T}from"../../input/InputManager.js";import{isCancelEvent as E}from"../../interactive/interactiveToolUtils.js";import{makeGeometryAnalysisSnappingOptions as D}from"../../interactive/snapping/allLayerSnapping.js";import O from"../../../widgets/Sketch/SketchViewModel.js";let k=class extends n{constructor(e){super(e),this.canStopPlacing=!1,this._sketchViewModels=new i,this._updatingHandles=new g,this._operationManager=new x}initialize(){let{view:e}=this;this._allLayerSnappingOptions=D(e),this._graphicsLayer=new _({listMode:`hide`,internal:!0}),this._externalGeometryChangeHandle=u(()=>this._analysis.geometry,()=>this._ensureUpdatedSketchGraphic(),d),this.addHandles([f(()=>({map:e.map,internalGraphicsLayer:this._graphicsLayer,state:this.state,geometryVisualizationVisible:this._analysis.viewOptions.geometryVisualizationVisible,visible:this.analysisViewData.visible}),({map:e,internalGraphicsLayer:t,state:n,geometryVisualizationVisible:r,visible:i})=>{j(e,t);let a=this.sketchGraphic;switch(a&&(a.visible=i),n){case`idle`:case`reshaping-disabled`:a&&!r&&(a.visible=!1),this._operationManager.stop(),this._ensureUpdatedSketchGraphic();break;case`reshaping`:s(this._startReshape());break;case`awaiting-sketch`:this.analysisViewData.interactive=!0}},p),f(()=>this._analysis.elevationInfo,e=>{this._graphicsLayer.elevationInfo=e},p),this._allLayerSnappingOptions,this._externalGeometryChangeHandle])}destroy(){this._operationManager.destroy(),this._sketchViewModels.drain(e=>o(e));let e=this._graphicsLayer;this.view.map?.remove(e),e.destroy()}get sketchGraphic(){return this._get(`sketchGraphic`)}set sketchGraphic(e){e!==this._get(`sketchGraphic`)&&(this._set(`sketchGraphic`,e),this._updateAnalysisFromSketchGraphic())}get state(){let{visible:e,interactive:t}=this.analysisViewData;if(!e)return`idle`;switch(this._operationManager.currentOperationType){case`place`:return this._sketching?`sketching`:`awaiting-sketch`;case`pick-feature`:return`picking`;default:return this._analysis.geometry?t?`reshaping`:`reshaping-disabled`:`idle`}}get updating(){return this._sketchViewModels.some(e=>e.updating)||this._updatingHandles.updating}get _sketching(){return this._sketchViewModels.some(e=>e.createGraphic===this.sketchGraphic)}get _analysis(){return this.analysisViewData.analysis}get _lineSymbol(){return A(this.view.type)}place(e){return this._operationManager.start(`place`,async t=>{let n=this._createSketchViewModel(),r=this._analysis.clone();this._ensureUpdatedSketchGraphic();let i=this.sketchGraphic,o=this._analysis.elevationInfo,l=a(()=>{this.sketchGraphic===i&&(this._graphicsLayer.elevationInfo=o)}),u=()=>{let{activeComponent:e}=n;this.canStopPlacing=(e?.type===`draw-2d`||e?.type===`draw-3d`)&&e.drawOperation.numCommittedVertices>=2},d=n.on(`create`,e=>{switch(u(),e.state){case`start`:this._graphicsLayer.removeAll(),this.sketchGraphic=e.graphic,this._analysis.elevationInfo=this._graphicsLayer.elevationInfo;break;case`active`:this._updateAnalysisFromSketchGraphic();break;case`complete`:this.sketchGraphic&&(this._updateAnalysisFromSketchGraphic(),this._addSketchGraphic(this.sketchGraphic)),t.stop();break;case`cancel`:t.stop()}});t.handles.push(d,n.on([`undo`,`redo`],u),a(()=>{if(d.remove(),this.canStopPlacing=!1,n.destroy(),this._sketchViewModels.remove(n),this._updateAnalysisFromSketchGraphic(),!this._analysis.valid)return this._clear(),t.reject();if(c(e)||r.equals(this._analysis))return t.reject();t.resolve({})}),l),this._graphicsLayer.elevationInfo=M,await this._updatingHandles.addPromise(s(n.create(`polyline`)))},e)}async pickFeature(e){return this._operationManager.start(`pick-feature`,async e=>{let{view:t}=this;t.closePopup();let n=null;e.handles.push(t.on(`immediate-click`,i=>{i.defer(async()=>{n?.abort(),n=r(async n=>{let{results:r}=await t.hitTest(i);l(n);let a=null;for(let e of r)if(e.type===`graphic`&&C(e.graphic)&&!w(e.graphic)){a=e.graphic;break}a&&(i.preventDefault(),i.stopPropagation(),this._externalGeometryChangeHandle.pause(),this.sketchGraphic=null,this._analysis.setGeometryFromFeature(a),this._externalGeometryChangeHandle.resume(),e.resolve({feature:a}),e.stop())}),await n.promise})},T.TOOL),t.on(`key-down`,t=>{E(t)&&(e.reject(),e.stop())},T.TOOL),t.acquireCursor(`crosshair`,`high`),a(()=>{n?.abort(),e.reject()})),t.focus()},e)}_startReshape(){let e=this._createSketchViewModel();return this._sketchViewModels.add(e),this._operationManager.start(`reshape`,async t=>{let n=()=>{let t=this._ensureUpdatedSketchGraphic();return t?this._updatingHandles.addPromise(e.update(t,{tool:`reshape`})):Promise.resolve()};if(!this._ensureUpdatedSketchGraphic())return;let r=e.on(`update`,e=>{this._updateAnalysisFromSketchGraphic(),e.state===`complete`&&(this.state===`reshaping`?s(n()):t.resolve())});t.handles.push(r,a(()=>{r.remove(),this._sketchViewModels.remove(e),e.destroy(),t.resolve()})),await n()})}_createSketchViewModel(){return new O({layer:this._graphicsLayer,view:this.view,defaultCreateOptions:{mode:`click`,hasZ:!0},updateOnGraphicClick:!1,defaultUpdateOptions:{enableMoveAllGraphics:!1,enableRotation:!1,enableScaling:!1,enableZ:!1,highlightOptions:{enabled:!1},multipleSelectionEnabled:!1,reshapeOptions:{shapeOperation:`none`},toggleToolOnClick:!1,tool:`reshape`},polylineSymbol:this._lineSymbol,activeLineSymbol:this._lineSymbol,snappingOptions:this._allLayerSnappingOptions.options})}_ensureUpdatedSketchGraphic(){let{geometry:e}=this._analysis;if(!e)return this.sketchGraphic=null,this._graphicsLayer.removeAll(),null;let n=this.sketchGraphic??=new t({symbol:this._lineSymbol,geometry:e});return n.geometry=e,this._addSketchGraphic(n),n}_addSketchGraphic(e){let{graphics:t}=this._graphicsLayer;t.includes(e)||t.add(e),t.length!==1&&t.removeMany(t.filter(t=>t!==e))}_clear(){this.sketchGraphic=null,this._analysis.clear()}_updateAnalysisFromSketchGraphic(){this._externalGeometryChangeHandle.pause();let e=this.sketchGraphic?.geometry;S(e)||(e=null);let t=this._analysis;t.geometry!==e&&(t.geometry=e),this._externalGeometryChangeHandle.resume()}};e([m({constructOnly:!0})],k.prototype,`analysisViewData`,void 0),e([m({constructOnly:!0})],k.prototype,`view`,void 0),e([m()],k.prototype,`canStopPlacing`,void 0),e([m()],k.prototype,`sketchGraphic`,null),e([m({nonNullable:!0})],k.prototype,`state`,null),e([m()],k.prototype,`updating`,null),e([m()],k.prototype,`_sketching`,null),e([m()],k.prototype,`_analysis`,null),e([m()],k.prototype,`_lineSymbol`,null),k=e([h(`esri.views.analysis.ElevationProfile.ElevationProfileTool`)],k);function A(e){if(e===`2d`){let e={type:`CIMSolidStroke`,enable:!0,capStyle:`Butt`,joinStyle:`Round`,width:1.5};return new v({data:{type:`CIMSymbolReference`,symbol:{type:`CIMLineSymbol`,symbolLayers:[{...e,effects:[{type:`CIMGeometricEffectDashes`,dashTemplate:[5,4],lineDashEnding:`FullGap`,controlPointEnding:`NoConstraint`}],color:[0,0,0,255]},{...e,color:[255,255,255,255]}]}}})}return new y({color:[0,0,0,0]})}function j(e,t){t&&(t.removeFromParent(),e?.add(t))}const M=new b({mode:`on-the-ground`,offset:0});export{k as ElevationProfileTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{equals as e,pushIfSome as t}from"../../../core/arrayUtils.js";import{Evented as n}from"../../../core/Evented.js";import r from"../../../geometry/Multipoint.js";import i from"../../../geometry/Polygon.js";import a from"../../../geometry/Polyline.js";import{getEndpoint as o,isCoordinate as s,isBezierCurve as c,isCircularArc as l,isEllipticArc4 as u}from"../../../geometry/support/curves/curveUtils.js";import{createCoordinateHelper as d}from"../coordinateHelper.js";import{unnormalize as f}from"../../support/unnormalizationUtils.js";class p{constructor(e){this.part=e,this.leftSegment=null,this.rightSegment=null,this.type=`vertex`,this.index=null}get pos(){return this._pos}set pos(e){this._pos=e,this.part.unnormalizeVertexPositions()}}class m{constructor(e,t,n){this.part=e,this.leftVertex=t,this.rightVertex=n,this.type=`line`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){return[...this.rightVertex.pos]}}class h{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`bezier`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){return{b:[[...this.rightVertex.pos],[...this.curveDefinition.controlPoint1],[...this.curveDefinition.controlPoint2]]}}}class g{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`circular-arc`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{interiorPoint:t}=this.curveDefinition;return{c:[[...e],[...t]]}}}class _{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`elliptic-arc-4`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{centerPoint:t,sweep:n,orientation:r}=this.curveDefinition;return{a:[[...e],[...t],n,r]}}}class v{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`elliptic-arc-7`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{centerPoint:t,sweep:n,orientation:r,rotation:i,semiMajorAxisLength:a,minorMajorAxisRatio:o}=this.curveDefinition;return{a:[[...e],t,n,r,i,a,o]}}}class y{constructor(e,t,n=!1){this._spatialReference=e,this._viewingMode=t,this.autoClose=n,this.vertices=[],this.segments=[],this.index=null}unnormalizeVertexPositions(){this.vertices.length<=1||this._viewingMode===1&&f(this.vertices,this._spatialReference)}updateVertexIndex(e,t){let{vertices:n}=this;if(n.length===0)return;let r=n[0],i=null,a=e,o=t;do i=a,i.index=o++,a=i.rightSegment?i.rightSegment.rightVertex:null;while(a!=null&&a!==r);i.leftSegment&&i!==n[n.length-1]&&this.swapVertices(n.indexOf(i),n.length-1)}getFirstVertex(){return this.vertices.at(0)}getLastVertex(){return this.vertices.at(-1)}isClosed(){return this.getFirstVertex()?.leftSegment!=null}swapVertices(e,t){let{vertices:n}=this,r=n[e];n[e]=n[t],n[t]=r}*iterateVertices(){let e=this.getFirstVertex(),t=e;if(t)do yield t,t=t.rightSegment?.rightVertex;while(t!==e&&t!=null)}}class b extends n{constructor(e,t){super(),this.type=e,this.coordinateHelper=t,this._geometry=null,this._dirty=!0,this.parts=[]}get geometry(){if(this._dirty){switch(this.type){case`point`:this._geometry=this._toPoint();break;case`multipoint`:this._geometry=this._toMultipoint();break;case`polyline`:this._geometry=this._toPolyline();break;case`polygon`:this._geometry=this._toPolygon();break;case`mesh`:break;default:this.type}this._dirty=!1}return this._geometry}get spatialReference(){return this.coordinateHelper.spatialReference}get allVerticesUnordered(){return Array.from(this.iterateVerticesUnordered())}*iterateVerticesUnordered(){for(let e of this.parts)for(let t of e.vertices)yield t}get allVertices(){return Array.from(this.iterateVertices())}*iterateVertices(){for(let e of this.parts)yield*e.iterateVertices()}notifyChanges(e){this._dirty=!0,this.emit(`change`,e)}getPartialGeometry(e,t,n){let{parts:r,hasCurves:i}=w(this,{startingVertex:e,endingVertexInclusive:t,geometryType:n});return C(r,i,n,this.coordinateHelper)}_toPoint(){let{parts:e,coordinateHelper:t}=this;return e.at(0)?.vertices.length?t.vectorToPoint(e[0].vertices[0].pos):null}_toMultipoint(){let e=[],{coordinateHelper:t,parts:n,spatialReference:i}=this;for(let r of n){let n=r.getFirstVertex();n&&e.push(t.arrayToVector(n.pos))}return new r({hasM:t.hasM(),hasZ:t.hasZ(),spatialReference:i,points:e})}_toPolyline(){let e=[],t=!1;for(let n of this.parts){if(n.vertices.length<1)continue;let r=n.vertices[0],i=[];i.push(r.pos);let a=r.rightSegment;for(;a;)t||=a.type!==`line`,i.push(a.toCurveOrCoordinate()),a=a.rightVertex.rightSegment;e.push(i)}return new a({paths:t?void 0:e,curvePaths:t?e:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}_toPolygon(){let t=[],n=!1;for(let r of this.parts){if(r.vertices.length<1)continue;let i=r.vertices[0],a=[];a.push(i.pos);let c=i.rightSegment;for(;c&&(n||=c.type!==`line`,a.push(c.toCurveOrCoordinate()),c=c.rightVertex.rightSegment,c?.leftVertex!==i););if(r.autoClose&&a.length>1){let t=a.at(-1),n=o(a[0]),r=o(t);(a.length!==2||!s(t))&&!e(n,r)&&a.push(n)}t.push(a)}return new i({rings:n?void 0:t,curveRings:n?t:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}static fromGeometry(e,t,n){let r=e.spatialReference,i=d(e.hasZ,e.hasM,r),a=new b(e.type,i);switch(e.type){case`polygon`:T(a,e,t,n?.allowCurves??!1);break;case`polyline`:E(a,e,t,n?.allowCurves??!1);break;case`point`:D(a,e,t);break;case`multipoint`:O(a,e,t);break;case`mesh`:D(a,e.origin,t),a._geometry=e,a._dirty=!1}return a}}function x(e,t,n,r){let i=new p(e);e.vertices.push(i);let a=o(r);return i.pos=t.arrayToVector(a),i.index=e.vertices.length-1,n&&e.segments.push(S(e,n,i,r)),i}function S(e,t,n,r){if(s(r))return new m(e,t,n);if(c(r)){let[,i,a]=r.b;return new h(e,t,n,{controlPoint1:[...i],controlPoint2:[...a]})}if(l(r)){let[,i]=r.c;return new g(e,t,n,{interiorPoint:[...i]})}if(u(r)){let[,i,a,o]=r.a;return new _(e,t,n,{centerPoint:[...i],sweep:a,orientation:o})}let[,i,a,o,d,f,p]=r.a;return new v(e,t,n,{centerPoint:[...i],sweep:a,orientation:o,rotation:d,semiMajorAxisLength:f,minorMajorAxisRatio:p})}function C(e,t,n,s){let{spatialReference:c}=s;if(n===`point`){let t=e.at(0)?.at(0);return t?s.arrayToPoint(o(t)):null}return n===`polygon`?new i({rings:t?void 0:e,curveRings:t?e:void 0,spatialReference:c,hasZ:s.hasZ(),hasM:s.hasM()}):n===`multipoint`?new r({spatialReference:c,points:e.flatMap(e=>e.map(e=>o(e))),hasM:s.hasM(),hasZ:s.hasZ()}):new a({paths:t?void 0:e,curvePaths:t?e:void 0,spatialReference:c,hasZ:s.hasZ(),hasM:s.hasM()})}function w(n,r){let i=(r?.geometryType??n.type)===`polygon`,a=[],c=!1,l=!1,u=!1;for(let d of n.parts){let n=null;if(u)break;if(d.vertices.length<1)continue;if(r?.startingVertex){if(d!==r.startingVertex.part&&!l)continue;l=!0}let f=d===r?.startingVertex?.part?r.startingVertex:d.vertices.at(0),p=[];if(t(p,f?.pos),f===r?.endingVertexInclusive){u=!0,n=f,a.push(p);break}let m=f?.rightSegment;for(;m;){if(c||=m.type!==`line`,p.push(m.toCurveOrCoordinate()),n=m.rightVertex,m.rightVertex===r?.endingVertexInclusive){u=!0;break}if(m=m.rightVertex.rightSegment,m?.leftVertex===f)break}let h=p.at(-1),g=d.getFirstVertex(),_=d.getLastVertex();i&&d.autoClose&&h&&n===_&&f===g&&(p.length>2||p.length===2&&!s(h))&&f?.pos&&!e(o(h),f.pos)&&p.push([...f.pos]),a.push(p)}return{parts:a,hasCurves:c}}function T(t,n,r,i){let a=n.spatialReference,s=t.coordinateHelper,{rings:c,curveRings:l}=n,u=l&&i?l:c;for(let n=0;n<u.length;++n){let i=u[n],c=new y(a,r);if(c.index=n,t.parts.push(c),i.length<1)continue;let l=null,d=null;for(let e=0;e<i.length-1;++e)d=x(c,s,d,i[e]),l??=d;i.length>1&&e(o(i[i.length-1]),l?.pos)?d&&l&&c.segments.push(S(c,d,l,i[i.length-1])):d=x(c,s,d,i[i.length-1])}}function E(e,t,n,r){let i=t.spatialReference,a=e.coordinateHelper,{curvePaths:o,paths:s}=t,c=o&&r?o:s;for(let t=0;t<c.length;++t){let r=c[t],o=new y(i,n);if(o.index=t,e.parts.push(o),r.length<1)continue;let s=null;for(let e=0;e<r.length;++e)s=x(o,a,s,r[e])}}function D(e,t,n){let r=t.spatialReference,i=e.coordinateHelper,a=new y(r,n);a.index=0;let o=new p(a);o.index=0,o.pos=i.pointToVector(t),a.vertices.push(o),e.parts.push(a)}function O(e,t,n){let r=t.spatialReference,{coordinateHelper:i,parts:a}=e,o=t.points.map(e=>i.arrayToVector(e));for(let e=0;e<o.length;e++){let t=new y(r,n);t.index=e,a.push(t);let i=new p(t);i.pos=o[e],i.index=0,t.vertices.push(i)}}function k(e){return e.type===`mesh`}function A(e,t){if(e.type!==t.type||e.parts.length!==t.parts.length)return!1;for(let n=0;n<e.parts.length;n++){let r=e.parts[n],i=t.parts[n];if(r.vertices.length!==i.vertices.length)return!1}let n=e.allVertices,r=t.allVertices;for(let e=0;e<n.length;e++)if(n[e].leftSegment?.type!==r[e].leftSegment?.type)return!1;return!0}export{h as BezierSegment,g as CircularArcSegment,b as EditGeometry,_ as EllipticArc4Segment,v as EllipticArc7Segment,m as LineSegment,y as Part,p as Vertex,x as addVertexAndConnectingSegment,S as createConnectingSegment,A as haveCompatibleTopologies,k as isMeshEditGeometry,C as partialCoordsToGeometry,w as toPartialCoords};
2
+ import{numbersEquals as e,pushIfSome as t}from"../../../core/arrayUtils.js";import{Evented as n}from"../../../core/Evented.js";import r from"../../../geometry/Multipoint.js";import i from"../../../geometry/Polygon.js";import a from"../../../geometry/Polyline.js";import{getEndpoint as o,isCoordinate as s,isBezierCurve as c,isCircularArc as l,isEllipticArc4 as u}from"../../../geometry/support/curves/curveUtils.js";import{createCoordinateHelper as d}from"../coordinateHelper.js";import{unnormalize as f}from"../../support/unnormalizationUtils.js";class p{constructor(e){this.part=e,this.leftSegment=null,this.rightSegment=null,this.type=`vertex`,this.index=null}get pos(){return this._pos}set pos(e){this._pos=e,this.part.unnormalizeVertexPositions()}}class m{constructor(e,t,n){this.part=e,this.leftVertex=t,this.rightVertex=n,this.type=`line`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){return[...this.rightVertex.pos]}}class h{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`bezier`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){return{b:[[...this.rightVertex.pos],[...this.curveDefinition.controlPoint1],[...this.curveDefinition.controlPoint2]]}}}class g{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`circular-arc`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{interiorPoint:t}=this.curveDefinition;return{c:[[...e],[...t]]}}}class _{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`elliptic-arc-4`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{centerPoint:t,sweep:n,orientation:r}=this.curveDefinition;return{a:[[...e],[...t],n,r]}}}class v{constructor(e,t,n,r){this.part=e,this.leftVertex=t,this.rightVertex=n,this.curveDefinition=r,this.type=`elliptic-arc-7`,t.rightSegment=this,n.leftSegment=this}toCurveOrCoordinate(){let e=this.rightVertex.pos,{centerPoint:t,sweep:n,orientation:r,rotation:i,semiMajorAxisLength:a,minorMajorAxisRatio:o}=this.curveDefinition;return{a:[[...e],t,n,r,i,a,o]}}}class y{constructor(e,t,n=!1){this._spatialReference=e,this._viewingMode=t,this.autoClose=n,this.vertices=[],this.segments=[],this.index=null}unnormalizeVertexPositions(){this.vertices.length<=1||this._viewingMode===1&&f(this.vertices,this._spatialReference)}updateVertexIndex(e,t){let{vertices:n}=this;if(n.length===0)return;let r=n[0],i=null,a=e,o=t;do i=a,i.index=o++,a=i.rightSegment?i.rightSegment.rightVertex:null;while(a!=null&&a!==r);i.leftSegment&&i!==n[n.length-1]&&this.swapVertices(n.indexOf(i),n.length-1)}getFirstVertex(){return this.vertices.at(0)}getLastVertex(){return this.vertices.at(-1)}isClosed(){return this.getFirstVertex()?.leftSegment!=null}swapVertices(e,t){let{vertices:n}=this,r=n[e];n[e]=n[t],n[t]=r}*iterateVertices(){let e=this.getFirstVertex(),t=e;if(t)do yield t,t=t.rightSegment?.rightVertex;while(t!==e&&t!=null)}}class b extends n{constructor(e,t){super(),this.type=e,this.coordinateHelper=t,this._geometry=null,this._dirty=!0,this.parts=[]}get geometry(){if(this._dirty){switch(this.type){case`point`:this._geometry=this._toPoint();break;case`multipoint`:this._geometry=this._toMultipoint();break;case`polyline`:this._geometry=this._toPolyline();break;case`polygon`:this._geometry=this._toPolygon();break;case`mesh`:break;default:this.type}this._dirty=!1}return this._geometry}get spatialReference(){return this.coordinateHelper.spatialReference}get allVerticesUnordered(){return Array.from(this.iterateVerticesUnordered())}*iterateVerticesUnordered(){for(let e of this.parts)for(let t of e.vertices)yield t}get allVertices(){return Array.from(this.iterateVertices())}*iterateVertices(){for(let e of this.parts)yield*e.iterateVertices()}notifyChanges(e){this._dirty=!0,this.emit(`change`,e)}getPartialGeometry(e,t,n){let{parts:r,hasCurves:i}=w(this,{startingVertex:e,endingVertexInclusive:t,geometryType:n});return C(r,i,n,this.coordinateHelper)}_toPoint(){let{parts:e,coordinateHelper:t}=this;return e.at(0)?.vertices.length?t.vectorToPoint(e[0].vertices[0].pos):null}_toMultipoint(){let e=[],{coordinateHelper:t,parts:n,spatialReference:i}=this;for(let r of n){let n=r.getFirstVertex();n&&e.push(t.arrayToVector(n.pos))}return new r({hasM:t.hasM(),hasZ:t.hasZ(),spatialReference:i,points:e})}_toPolyline(){let e=[],t=!1;for(let n of this.parts){if(n.vertices.length<1)continue;let r=n.vertices[0],i=[];i.push(r.pos);let a=r.rightSegment;for(;a;)t||=a.type!==`line`,i.push(a.toCurveOrCoordinate()),a=a.rightVertex.rightSegment;e.push(i)}return new a({paths:t?void 0:e,curvePaths:t?e:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}_toPolygon(){let t=[],n=!1;for(let r of this.parts){if(r.vertices.length<1)continue;let i=r.vertices[0],a=[];a.push(i.pos);let c=i.rightSegment;for(;c&&(n||=c.type!==`line`,a.push(c.toCurveOrCoordinate()),c=c.rightVertex.rightSegment,c?.leftVertex!==i););if(r.autoClose&&a.length>1){let t=a.at(-1),n=o(a[0]),r=o(t);(a.length!==2||!s(t))&&!e(n,r)&&a.push(n)}t.push(a)}return new i({rings:n?void 0:t,curveRings:n?t:void 0,spatialReference:this.spatialReference,hasZ:this.coordinateHelper.hasZ(),hasM:this.coordinateHelper.hasM()})}static fromGeometry(e,t,n){let r=e.spatialReference,i=d(e.hasZ,e.hasM,r),a=new b(e.type,i);switch(e.type){case`polygon`:T(a,e,t,n?.allowCurves??!1);break;case`polyline`:E(a,e,t,n?.allowCurves??!1);break;case`point`:D(a,e,t);break;case`multipoint`:O(a,e,t);break;case`mesh`:D(a,e.origin,t),a._geometry=e,a._dirty=!1}return a}}function x(e,t,n,r){let i=new p(e);e.vertices.push(i);let a=o(r);return i.pos=t.arrayToVector(a),i.index=e.vertices.length-1,n&&e.segments.push(S(e,n,i,r)),i}function S(e,t,n,r){if(s(r))return new m(e,t,n);if(c(r)){let[,i,a]=r.b;return new h(e,t,n,{controlPoint1:[...i],controlPoint2:[...a]})}if(l(r)){let[,i]=r.c;return new g(e,t,n,{interiorPoint:[...i]})}if(u(r)){let[,i,a,o]=r.a;return new _(e,t,n,{centerPoint:[...i],sweep:a,orientation:o})}let[,i,a,o,d,f,p]=r.a;return new v(e,t,n,{centerPoint:[...i],sweep:a,orientation:o,rotation:d,semiMajorAxisLength:f,minorMajorAxisRatio:p})}function C(e,t,n,s){let{spatialReference:c}=s;if(n===`point`){let t=e.at(0)?.at(0);return t?s.arrayToPoint(o(t)):null}return n===`polygon`?new i({rings:t?void 0:e,curveRings:t?e:void 0,spatialReference:c,hasZ:s.hasZ(),hasM:s.hasM()}):n===`multipoint`?new r({spatialReference:c,points:e.flatMap(e=>e.map(e=>o(e))),hasM:s.hasM(),hasZ:s.hasZ()}):new a({paths:t?void 0:e,curvePaths:t?e:void 0,spatialReference:c,hasZ:s.hasZ(),hasM:s.hasM()})}function w(n,r){let i=(r?.geometryType??n.type)===`polygon`,a=[],c=!1,l=!1,u=!1;for(let d of n.parts){let n=null;if(u)break;if(d.vertices.length<1)continue;if(r?.startingVertex){if(d!==r.startingVertex.part&&!l)continue;l=!0}let f=d===r?.startingVertex?.part?r.startingVertex:d.vertices.at(0),p=[];if(t(p,f?.pos),f===r?.endingVertexInclusive){u=!0,n=f,a.push(p);break}let m=f?.rightSegment;for(;m;){if(c||=m.type!==`line`,p.push(m.toCurveOrCoordinate()),n=m.rightVertex,m.rightVertex===r?.endingVertexInclusive){u=!0;break}if(m=m.rightVertex.rightSegment,m?.leftVertex===f)break}let h=p.at(-1),g=d.getFirstVertex(),_=d.getLastVertex();i&&d.autoClose&&h&&n===_&&f===g&&(p.length>2||p.length===2&&!s(h))&&f?.pos&&!e(o(h),f.pos)&&p.push([...f.pos]),a.push(p)}return{parts:a,hasCurves:c}}function T(t,n,r,i){let a=n.spatialReference,s=t.coordinateHelper,{rings:c,curveRings:l}=n,u=l&&i?l:c;for(let n=0;n<u.length;++n){let i=u[n],c=new y(a,r);if(c.index=n,t.parts.push(c),i.length<1)continue;let l=null,d=null;for(let e=0;e<i.length-1;++e)d=x(c,s,d,i[e]),l??=d;i.length>1&&e(o(i[i.length-1]),l?.pos)?d&&l&&c.segments.push(S(c,d,l,i[i.length-1])):d=x(c,s,d,i[i.length-1])}}function E(e,t,n,r){let i=t.spatialReference,a=e.coordinateHelper,{curvePaths:o,paths:s}=t,c=o&&r?o:s;for(let t=0;t<c.length;++t){let r=c[t],o=new y(i,n);if(o.index=t,e.parts.push(o),r.length<1)continue;let s=null;for(let e=0;e<r.length;++e)s=x(o,a,s,r[e])}}function D(e,t,n){let r=t.spatialReference,i=e.coordinateHelper,a=new y(r,n);a.index=0;let o=new p(a);o.index=0,o.pos=i.pointToVector(t),a.vertices.push(o),e.parts.push(a)}function O(e,t,n){let r=t.spatialReference,{coordinateHelper:i,parts:a}=e,o=t.points.map(e=>i.arrayToVector(e));for(let e=0;e<o.length;e++){let t=new y(r,n);t.index=e,a.push(t);let i=new p(t);i.pos=o[e],i.index=0,t.vertices.push(i)}}function k(e){return e.type===`mesh`}function A(e,t){if(e.type!==t.type||e.parts.length!==t.parts.length)return!1;for(let n=0;n<e.parts.length;n++){let r=e.parts[n],i=t.parts[n];if(r.vertices.length!==i.vertices.length)return!1}let n=e.allVertices,r=t.allVertices;for(let e=0;e<n.length;e++)if(n[e].leftSegment?.type!==r[e].leftSegment?.type)return!1;return!0}export{h as BezierSegment,g as CircularArcSegment,b as EditGeometry,_ as EllipticArc4Segment,v as EllipticArc7Segment,m as LineSegment,y as Part,p as Vertex,x as addVertexAndConnectingSegment,S as createConnectingSegment,A as haveCompatibleTopologies,k as isMeshEditGeometry,C as partialCoordsToGeometry,w as toPartialCoords};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{equals as e}from"../../../../core/arrayUtils.js";import{rotate as t}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{rotateEllipticArc as n}from"../../../../geometry/support/curves/rotate.js";class r{constructor(e,t,n=0){this.origin=e,this.angle=t,this._accumulationType=n}_rotate(e,n){t(e.pos,e.pos,this.origin,n),i(e.leftSegment,this.origin,n)}apply(e){this._rotate(e,this.angle)}undo(e){this._rotate(e,-this.angle)}canAccumulate(t){return t instanceof r&&e(this.origin,t.origin)}accumulate(e,t){let n=t._accumulationType===1;this._rotate(e,n?t.angle-this.angle:t.angle)}accumulateParams(e){let t=e._accumulationType===1;this.angle=t?e.angle:this.angle+e.angle}}function i(e,r,i){switch(e?.type){case null:case void 0:case`line`:return;case`bezier`:{let{controlPoint1:n,controlPoint2:a}=e.curveDefinition;t(n,n,r,i),t(a,a,r,i);return}case`circular-arc`:{let{interiorPoint:n}=e.curveDefinition;t(n,n,r,i);return}case`elliptic-arc-4`:case`elliptic-arc-7`:{let a=e.leftVertex.pos,o=t([0,0],[a[0],a[1]],r,-i),s=e.toCurveOrCoordinate(),[,c,l,u,d,f,p]=n(o,s,r,i).a;if(e.type===`elliptic-arc-4`){let t=e.curveDefinition;t.centerPoint=[...c],t.sweep=l,t.orientation=u}else{let t=e.curveDefinition;t.centerPoint=[...c],t.sweep=l,t.orientation=u,t.rotation=d,t.semiMajorAxisLength=f,t.minorMajorAxisRatio=p}}}}export{r as RotateVertex};
2
+ import{rotate as e,exactEquals as t}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{rotateEllipticArc as n}from"../../../../geometry/support/curves/rotate.js";class r{constructor(e,t,n=0){this.origin=e,this.angle=t,this._accumulationType=n}_rotate(t,n){e(t.pos,t.pos,this.origin,n),i(t.leftSegment,this.origin,n)}apply(e){this._rotate(e,this.angle)}undo(e){this._rotate(e,-this.angle)}canAccumulate(e){return e instanceof r&&t(this.origin,e.origin)}accumulate(e,t){let n=t._accumulationType===1;this._rotate(e,n?t.angle-this.angle:t.angle)}accumulateParams(e){let t=e._accumulationType===1;this.angle=t?e.angle:this.angle+e.angle}}function i(t,r,i){switch(t?.type){case null:case void 0:case`line`:return;case`bezier`:{let{controlPoint1:n,controlPoint2:a}=t.curveDefinition;e(n,n,r,i),e(a,a,r,i);return}case`circular-arc`:{let{interiorPoint:n}=t.curveDefinition;e(n,n,r,i);return}case`elliptic-arc-4`:case`elliptic-arc-7`:{let a=t.leftVertex.pos,o=e([0,0],[a[0],a[1]],r,-i),s=t.toCurveOrCoordinate(),[,c,l,u,d,f,p]=n(o,s,r,i).a;if(t.type===`elliptic-arc-4`){let e=t.curveDefinition;e.centerPoint=[...c],e.sweep=l,e.orientation=u}else{let e=t.curveDefinition;e.centerPoint=[...c],e.sweep=l,e.orientation=u,e.rotation=d,e.semiMajorAxisLength=f,e.minorMajorAxisRatio=p}}}}export{r as RotateVertex};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{equals as e}from"../../../../core/arrayUtils.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{projectAndScale as n,transformMat3 as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{invert as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{EllipticArc7Segment as s}from"../EditGeometry.js";import{getScaleTransform as c,scaleArc as l}from"./curveOperationUtils.js";class u{constructor(e,t,n,r,a=0){this.origin=e,this.axis1=t,this.factor1=n,this.factor2=r,this._accumulationType=a,this.axis2=i(t[1],-t[0])}_scale({pos:e,leftSegment:t},r,i){let a=t?.toCurveOrCoordinate(),{origin:o,axis1:s,axis2:c}=this;n(e,e,o,s,r),n(e,e,o,c,i),d(t,o,s,c,r,i,a)}apply(e){this._scale(e,this.factor1,this.factor2)}undo(e){this._scale(e,1/this.factor1,1/this.factor2)}canAccumulate(t){return t instanceof u&&e(this.origin,t.origin)&&e(this.axis1,t.axis1)}accumulate(e,t){t._accumulationType===1?this._scale(e,t.factor1/this.factor1,t.factor2/this.factor2):this._scale(e,t.factor1,t.factor2)}accumulateParams(e){let t=e._accumulationType===1;this.factor1=t?e.factor1:this.factor1*e.factor1,this.factor2=t?e.factor2:this.factor2*e.factor2}}function d(e,i,u,d,f,p,m){switch(e?.type){case null:case void 0:case`line`:return;case`bezier`:{let{controlPoint1:t,controlPoint2:r}=e.curveDefinition;n(t,t,i,u,f),n(t,t,i,d,p),n(r,r,i,u,f),n(r,r,i,d,p);break}case`circular-arc`:case`elliptic-arc-4`:case`elliptic-arc-7`:{if(!m)return;let n=e.leftVertex.pos,h=c(i[0],i[1],u[0],u[1],d[0],d[1],f,p),g=o(t(),h),_=g?r(a(),[n[0],n[1]],g):n,[,v,y,b,x,S,C]=l(m,[_[0],_[1]],e,i,u,d,f,p).a;if(e.type===`elliptic-arc-7`){let t=e.curveDefinition;t.centerPoint=v,t.sweep=y,t.orientation=b,t.rotation=x,t.semiMajorAxisLength=S,t.minorMajorAxisRatio=C}else{let t=new s(e.part,e.leftVertex,e.rightVertex,{centerPoint:v,sweep:y,orientation:b,rotation:x,semiMajorAxisLength:S,minorMajorAxisRatio:C});e.part.segments.splice(e.part.segments.indexOf(e),1,t)}return}}}export{u as ScaleVertex};
2
+ import{create as e}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{projectAndScale as t,exactEquals as n,transformMat3 as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{invert as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{EllipticArc7Segment as s}from"../EditGeometry.js";import{getScaleTransform as c,scaleArc as l}from"./curveOperationUtils.js";class u{constructor(e,t,n,r,a=0){this.origin=e,this.axis1=t,this.factor1=n,this.factor2=r,this._accumulationType=a,this.axis2=i(t[1],-t[0])}_scale({pos:e,leftSegment:n},r,i){let a=n?.toCurveOrCoordinate(),{origin:o,axis1:s,axis2:c}=this;t(e,e,o,s,r),t(e,e,o,c,i),d(n,o,s,c,r,i,a)}apply(e){this._scale(e,this.factor1,this.factor2)}undo(e){this._scale(e,1/this.factor1,1/this.factor2)}canAccumulate(e){return e instanceof u&&n(this.origin,e.origin)&&n(this.axis1,e.axis1)}accumulate(e,t){t._accumulationType===1?this._scale(e,t.factor1/this.factor1,t.factor2/this.factor2):this._scale(e,t.factor1,t.factor2)}accumulateParams(e){let t=e._accumulationType===1;this.factor1=t?e.factor1:this.factor1*e.factor1,this.factor2=t?e.factor2:this.factor2*e.factor2}}function d(n,i,u,d,f,p,m){switch(n?.type){case null:case void 0:case`line`:return;case`bezier`:{let{controlPoint1:e,controlPoint2:r}=n.curveDefinition;t(e,e,i,u,f),t(e,e,i,d,p),t(r,r,i,u,f),t(r,r,i,d,p);break}case`circular-arc`:case`elliptic-arc-4`:case`elliptic-arc-7`:{if(!m)return;let t=n.leftVertex.pos,h=c(i[0],i[1],u[0],u[1],d[0],d[1],f,p),g=o(e(),h),_=g?r(a(),[t[0],t[1]],g):t,[,v,y,b,x,S,C]=l(m,[_[0],_[1]],n,i,u,d,f,p).a;if(n.type===`elliptic-arc-7`){let e=n.curveDefinition;e.centerPoint=v,e.sweep=y,e.orientation=b,e.rotation=x,e.semiMajorAxisLength=S,e.minorMajorAxisRatio=C}else{let e=new s(n.part,n.leftVertex,n.rightVertex,{centerPoint:v,sweep:y,orientation:b,rotation:x,semiMajorAxisLength:S,minorMajorAxisRatio:C});n.part.segments.splice(n.part.segments.indexOf(n),1,e)}return}}}export{u as ScaleVertex};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{equals as e}from"../../../../core/arrayUtils.js";import{notDeepEqual as t}from"../../../../core/object.js";class n{constructor(e,t){this._editGeometry=e,this._newPositions=[],this._newSegments=[];for(let{pos:e,leftSegment:n}of t.allVertices)this._newPositions.push(e),this._newSegments.push(r(n))}apply(){let e=this._originalPositions==null?`apply`:`redo`;if(!this._originalPositions){let e=this._editGeometry.coordinateHelper;this._originalPositions=[],this._originalSegments=[];for(let{pos:t,leftSegment:n}of this._editGeometry.iterateVertices())this._originalPositions.push(e.clone(t)),this._originalSegments.push(r(n))}this._apply(e,this._newPositions,this._newSegments)}undo(){this._originalPositions&&this._originalSegments&&this._apply(`undo`,this._originalPositions,this._originalSegments)}accumulate(e){return e instanceof n&&(this._newPositions=e._newPositions,this._newSegments=e._newSegments,this._apply(`apply`,this._newPositions,this._newSegments),!0)}_apply(t,n,a){let o=this._editGeometry.coordinateHelper,s=this._editGeometry.allVertices,c=[];for(let t=0;t<s.length;t++){let l=s[t],u=n[t],d=a[t];(!e(l.pos,u)||!i(r(l.leftSegment),d))&&(c.push(s[t]),o.copy(u,l.pos),l.leftSegment&&`curveDefinition`in l.leftSegment&&d&&(l.leftSegment.curveDefinition={...d}))}this._editGeometry.parts.forEach(e=>e.unnormalizeVertexPositions()),c.length&&this._editGeometry.notifyChanges({operation:t,updatedVertices:c})}}function r(e){if(e&&e.type!==`line`)return{...e.curveDefinition}}function i(e,n){return e==null&&n==null||!!e&&!!n&&!t(e,n)}export{n as SetAllVertexPositions};
2
+ import{numbersEquals as e}from"../../../../core/arrayUtils.js";import{notDeepEqual as t}from"../../../../core/object.js";class n{constructor(e,t){this._editGeometry=e,this._newPositions=[],this._newSegments=[];for(let{pos:e,leftSegment:n}of t.allVertices)this._newPositions.push(e),this._newSegments.push(r(n))}apply(){let e=this._originalPositions==null?`apply`:`redo`;if(!this._originalPositions){let e=this._editGeometry.coordinateHelper;this._originalPositions=[],this._originalSegments=[];for(let{pos:t,leftSegment:n}of this._editGeometry.iterateVertices())this._originalPositions.push(e.clone(t)),this._originalSegments.push(r(n))}this._apply(e,this._newPositions,this._newSegments)}undo(){this._originalPositions&&this._originalSegments&&this._apply(`undo`,this._originalPositions,this._originalSegments)}accumulate(e){return e instanceof n&&(this._newPositions=e._newPositions,this._newSegments=e._newSegments,this._apply(`apply`,this._newPositions,this._newSegments),!0)}_apply(t,n,a){let o=this._editGeometry.coordinateHelper,s=this._editGeometry.allVertices,c=[];for(let t=0;t<s.length;t++){let l=s[t],u=n[t],d=a[t];(!e(l.pos,u)||!i(r(l.leftSegment),d))&&(c.push(s[t]),o.copy(u,l.pos),l.leftSegment&&`curveDefinition`in l.leftSegment&&d&&(l.leftSegment.curveDefinition={...d}))}this._editGeometry.parts.forEach(e=>e.unnormalizeVertexPositions()),c.length&&this._editGeometry.notifyChanges({operation:t,updatedVertices:c})}}function r(e){if(e&&e.type!==`line`)return{...e.curveDefinition}}function i(e,n){return e==null&&n==null||!!e&&!!n&&!t(e,n)}export{n as SetAllVertexPositions};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{isSome as n}from"../../../core/arrayUtils.js";import{destroyHandle as r}from"../../../core/handleUtils.js";import"../../../core/has.js";import{mapCollectionAsync as i}from"../../../core/mapCollectionUtils.js";import{allSettledValues as a,throwIfAborted as o}from"../../../core/promiseUtils.js";import{watch as s,sync as c}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as l,getMetersPerVerticalUnitForSR as u}from"../../../core/units.js";import{property as d,subclass as f}from"../../../core/accessorSupport/decorators.js";import{squaredDistance as p}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as m,squaredDistance as h}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEpsilon as _}from"../../../core/libs/gl-matrix-2/math/common.js";import{UpdatingHandles as v}from"../../../core/support/UpdatingHandles.js";import{absoluteHeightElevationInfo as y}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as b,isLine as x,isDrapedLine as S}from"../sketch/constraints.js";import{fromAnyMapPoint as C,asVec2 as w,markAsTarget as T}from"../sketch/normalizedPoint.js";import{FeatureSnappingSourceInfo as E}from"./FeatureSnappingSourceInfo.js";import{sortCandidatesInPlace as D}from"./snappingUtils.js";import{DrapedEdgeSnappingCandidate as O}from"./candidates/DrapedEdgeSnappingCandidate.js";import{EdgeSnappingCandidate as k}from"./candidates/EdgeSnappingCandidate.js";import{FeatureSnappingCandidate as A}from"./candidates/FeatureSnappingCandidate.js";import{RightAngleSnappingCandidate as j}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as M}from"../support/viewUtils.js";import{screenDistance as N}from"../../../core/screenUtils.js";let P=class extends t{get updating(){return this._snappingSources.some(e=>e?.valid==null||e.valid===!0&&e.snappingSource?.updating===!0)||this._updatingHandles.updating}constructor(e){super(e),this.options=null,this._domain=1,this._updatingHandles=new v,this._sourceModules={featureService:{module:null,loader:null},featureCollection:{module:null,loader:null},graphics:{module:null,loader:null},notes:{module:null,loader:null},scene:{module:null,loader:null}}}initialize(){let e=i(()=>this.options?._effectiveFeatureSources,(e,t)=>this._createSourceInfo(e,t));this._snappingSources=e,this.addHandles([r(e),s(()=>({rulesEnabled:!!this.options?.attributeRulesEnabled,sources:this._snappingSources.filter(n)}),({rulesEnabled:e,sources:t})=>{for(let n of t)n.attributeRulesEnabled=e},c)])}destroy(){this._set(`options`,null),this._updatingHandles.destroy()}async fetchCandidates(e,t,n,r){if(!(t&this._domain)||this.options==null||!this.options.effectiveFeatureEnabled)return[];let i=[],s=this._computeScreenSizeDistanceParameters(e,n);for(let t of this._snappingSources){if(!t?.valid||!t.snappingSource?.layerSource?.enabled||t.layerView?.suspended)continue;let a=t.getFetchCandidatesParameters(e,n,s);for(let e of a)i.push(t.snappingSource.fetchCandidates(e,r).then(e=>this._processCandidatesFromSource(t,e,n)))}let c=(await a(i)).flat();return this._addRightAngleCandidates(c,e,s,n),o(r),D(e,c),c}_addRightAngleCandidates(e,t,n,r){let i=r.vertexHandle==null?r.editGeometryOperations!=null&&r.editGeometryOperations.data.type===`polygon`?r.editGeometryOperations.data.parts[0]?.getFirstVertex()?.pos:null:r.vertexHandle.rightSegment?.rightVertex?.pos,a=r.vertexHandle==null?r.editGeometryOperations==null?null:r.editGeometryOperations.data.parts[0]?.getLastVertex()?.pos:r.vertexHandle.leftSegment?.leftVertex?.pos,{view:o}=this,s=C(i,o,r),c=C(a,o,r),l=e.length;for(let r=0;r<l;r++)this._addRightAngleCandidate(e[r],c,t,n,e),this._addRightAngleCandidate(e[r],s,t,n,e)}_addRightAngleCandidate(e,t,n,r,i){if(t==null||!F(e))return;let a=e.constraint.closestTo(t),o=(a[0]-n[0])/r.x,s=(a[1]-n[1])/r.y,{start:c,end:l}=e.constraint;if(o*o+s*s<=1){let n=p(w(a),w(c))>p(w(a),w(l))?c:l,r=new j({targetPoint:T(a),otherVertex:t,otherVertexType:0,previousVertex:n,constraint:new b(t,a),objectId:e.objectId,isDraped:e.isDraped,domain:1});i.push(r)}}_computeScreenSizeDistanceParameters(e,t){let n=this.options==null?0:this.options.distance*(t.pointer===`touch`?this.options.touchSensitivityMultiplier:1);return this.view==null?{x:n,y:n,z:n,distance:n}:this.view.type===`2d`?(n*=this.view.resolution,{x:n,y:n,z:n,distance:n}):this._computeScreenSizeDistanceParameters3D(e,n,this.view,t)}_computeScreenSizeDistanceParameters3D(e,t,n,r){let{spatialReference:i}=r;n.renderCoordsHelper.toRenderCoords(e,i,R);let a=n.state.camera.computeScreenPixelSizeAt(R),o=a*n.renderCoordsHelper.unitInMeters,s=o/l(i),c=o/u(i),d=t*s,f=t*c,p=M(e,i,y,n),m=p?L(p,e,s,0,0,n,r):0,h=p?L(p,e,0,s,0,n,r):0,g=p?L(p,e,0,0,c,n,r):0;return{x:m===0?0:d/m,y:h===0?0:d/h,z:g===0?0:f/g,distance:a*t}}_processCandidatesFromSource(e,t,n){let r=[];for(let i of t)e.snappingSource&&!this._candidateIsExcluded(e.snappingSource,i,n.excludeFeature)&&(i instanceof A&&(i.layer=e.layer),r.push(i));return r}_candidateIsExcluded(e,t,n){if(n==null)return!1;let r=this._getCandidateObjectId(t);if(r==null)return!1;let i=e.layerSource.layer;return i.type===`graphics`?n.uid===r:n.sourceLayer!==i||!n.attributes||!(`objectIdField`in i)?!1:n.attributes[i.objectIdField]===r}_getCandidateObjectId(e){return e instanceof A?e.objectId:null}async _createSourceInfo(e,t){let n=e.layer;n.loaded||(await n.load(),o(t));let{view:r}=this,i=await this._createFeatureSnappingSourceType(e);return o(t),i==null?new E({}):new E({snappingSource:i,view:r,layer:n})}async _createFeatureSnappingSourceType(e){switch(e.layer.type){case`feature`:case`geojson`:case`csv`:case`oriented-imagery`:case`subtype-group`:case`wfs`:return this._createFeatureSnappingSourceFeatureLayer(e);case`graphics`:case`sketch`:return this._createFeatureSnappingSourceGraphicsLayer(e);case`map-notes`:return this._createFeatureSnappingSourceMapNotesLayer(e);case`scene`:case`building-scene`:return this._createFeatureSnappingSourceSceneLayer(e)}return null}async _createFeatureSnappingSourceSceneLayer(e){let{view:t}=this;return t==null||t.type!==`3d`?null:new(await(this._getSourceModule(`scene`))).SceneLayerSnappingSource({layerSource:e,view:t})}async _createFeatureSnappingSourceFeatureLayer(e){switch(e.layer.source?.type){case`feature-layer`:case`oriented-imagery`:return new(await(this._getSourceModule(`featureService`))).FeatureServiceSnappingSource({spatialReference:this.spatialReference,view:this.view,layerSource:e});case`memory`:case`csv`:case`geojson`:case`wfs`:return e.layer.geometryType===`mesh`?null:new(await(this._getSourceModule(`featureCollection`))).FeatureCollectionSnappingSource({layerSource:e,view:this.view})}return null}async _createFeatureSnappingSourceGraphicsLayer(e){return new(await(this._getSourceModule(`graphics`))).GraphicsSnappingSource({getGraphicsLayers:()=>[e.layer],spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _createFeatureSnappingSourceMapNotesLayer(e){return new(await(this._getSourceModule(`notes`))).GraphicsSnappingSource({getGraphicsLayers:()=>e.layer.sublayers?.toArray()??[],spatialReference:this.spatialReference,view:this.view,layerSource:e})}async _getSourceModule(e){let t=this._sourceModules[e];if(t.loader==null){let t=this._loadSourceModule(e),n={module:null,loader:t};this._sourceModules[e]=n;let r=await t,i={module:r,loader:t};return this._sourceModules[e]=i,r}return t.module==null?t.loader:t.module}_loadSourceModule(e){let t=this._updatingHandles;switch(e){case`featureService`:return t.addPromise(import(`./featureSources/FeatureServiceSnappingSource.js`));case`featureCollection`:return t.addPromise(import(`./featureSources/FeatureCollectionSnappingSource.js`));case`graphics`:return t.addPromise(import(`./featureSources/GraphicsSnappingSource.js`));case`notes`:return t.addPromise(import(`./featureSources/GraphicsSnappingSource.js`));case`scene`:return t.addPromise(import(`./featureSources/SceneLayerSnappingSource.js`))}}get test(){}};e([d({constructOnly:!0})],P.prototype,`spatialReference`,void 0),e([d({constructOnly:!0})],P.prototype,`view`,void 0),e([d()],P.prototype,`options`,void 0),e([d({readOnly:!0})],P.prototype,`updating`,null),e([d()],P.prototype,`_snappingSources`,void 0),P=e([f(`esri.views.interactive.snapping.FeatureSnappingEngine`)],P);function F(e){let t=e instanceof k||e instanceof O,n=x(e.constraint)||S(e.constraint);return t&&n&&!I(e.constraint)}function I({start:e,end:t}){let n=h(e,t),r=p(w(e),w(t));return n<_()||r/n<B}function L(e,t,n,r,i,a,{spatialReference:o}){let s=m(z,t);s[0]+=n,s[1]+=r,s[2]+=i;let c=M(s,o,y,a);return c?N(c,e):1/0}const R=g(),z=g(),B=1e-4;export{P as FeatureSnappingEngine};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{isSome as n}from"../../../core/arrayUtils.js";import{destroyHandle as r}from"../../../core/handleUtils.js";import"../../../core/has.js";import{mapCollectionAsync as i}from"../../../core/mapCollectionUtils.js";import{allSettledValues as a,throwIfAborted as o,onAbort as s}from"../../../core/promiseUtils.js";import{watch as c,sync as l}from"../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as u,getMetersPerVerticalUnitForSR as d}from"../../../core/units.js";import{property as f,subclass as p}from"../../../core/accessorSupport/decorators.js";import{squaredDistance as m}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as h,squaredDistance as g}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEpsilon as v}from"../../../core/libs/gl-matrix-2/math/common.js";import{UpdatingHandles as y}from"../../../core/support/UpdatingHandles.js";import{absoluteHeightElevationInfo as b}from"../../../support/elevationInfoUtils.js";import{VerticalHalfPlaneConstraint as x,isLine as S,isDrapedLine as C}from"../sketch/constraints.js";import{fromAnyMapPoint as w,asVec2 as T,markAsTarget as E}from"../sketch/normalizedPoint.js";import{FeatureSnappingSourceInfo as D}from"./FeatureSnappingSourceInfo.js";import{sortCandidatesInPlace as O}from"./snappingUtils.js";import{DrapedEdgeSnappingCandidate as k}from"./candidates/DrapedEdgeSnappingCandidate.js";import{EdgeSnappingCandidate as A}from"./candidates/EdgeSnappingCandidate.js";import{FeatureSnappingCandidate as j}from"./candidates/FeatureSnappingCandidate.js";import{RightAngleSnappingCandidate as M}from"./candidates/RightAngleSnappingCandidate.js";import{vectorToScreenPoint as N}from"../support/viewUtils.js";import{screenDistance as P}from"../../../core/screenUtils.js";let F=class extends t{get updating(){return this._snappingSources.some(e=>e?.valid==null||e.valid===!0&&e.snappingSource?.updating===!0)||this._updatingHandles.updating}constructor(e){super(e),this.options=null,this._domain=1,this._updatingHandles=new y,this._sourceModules={featureService:{module:null,loader:null},featureCollection:{module:null,loader:null},graphics:{module:null,loader:null},notes:{module:null,loader:null},scene:{module:null,loader:null}}}initialize(){let e=i(()=>this.options?._effectiveFeatureSources,(e,t)=>this._createSourceInfo(e,t));this._snappingSources=e,this.addHandles([r(e),c(()=>({rulesEnabled:!!this.options?.attributeRulesEnabled,sources:this._snappingSources.filter(n)}),({rulesEnabled:e,sources:t})=>{for(let n of t)n.attributeRulesEnabled=e},l)])}destroy(){this._set(`options`,null),this._updatingHandles.destroy()}async fetchCandidates(e,t,n,r){if(!(t&this._domain)||this.options==null||!this.options.effectiveFeatureEnabled)return[];let i=[],s=this._computeScreenSizeDistanceParameters(e,n);for(let t of this._snappingSources){if(!t?.valid||!t.snappingSource?.layerSource?.enabled||t.layerView?.suspended)continue;let a=t.getFetchCandidatesParameters(e,n,s);for(let e of a)i.push(t.snappingSource.fetchCandidates(e,r).then(e=>this._processCandidatesFromSource(t,e,n)))}let c=(await a(i)).flat();return this._addRightAngleCandidates(c,e,s,n),o(r),O(e,c),c}_addRightAngleCandidates(e,t,n,r){let i=r.vertexHandle==null?r.editGeometryOperations!=null&&r.editGeometryOperations.data.type===`polygon`?r.editGeometryOperations.data.parts[0]?.getFirstVertex()?.pos:null:r.vertexHandle.rightSegment?.rightVertex?.pos,a=r.vertexHandle==null?r.editGeometryOperations==null?null:r.editGeometryOperations.data.parts[0]?.getLastVertex()?.pos:r.vertexHandle.leftSegment?.leftVertex?.pos,{view:o}=this,s=w(i,o,r),c=w(a,o,r),l=e.length;for(let r=0;r<l;r++)this._addRightAngleCandidate(e[r],c,t,n,e),this._addRightAngleCandidate(e[r],s,t,n,e)}_addRightAngleCandidate(e,t,n,r,i){if(t==null||!I(e))return;let a=e.constraint.closestTo(t),o=(a[0]-n[0])/r.x,s=(a[1]-n[1])/r.y,{start:c,end:l}=e.constraint;if(o*o+s*s<=1){let n=m(T(a),T(c))>m(T(a),T(l))?c:l,r=new M({targetPoint:E(a),otherVertex:t,otherVertexType:0,previousVertex:n,constraint:new x(t,a),objectId:e.objectId,isDraped:e.isDraped,domain:1});i.push(r)}}_computeScreenSizeDistanceParameters(e,t){let n=this.options==null?0:this.options.distance*(t.pointer===`touch`?this.options.touchSensitivityMultiplier:1);return this.view==null?{x:n,y:n,z:n,distance:n}:this.view.type===`2d`?(n*=this.view.resolution,{x:n,y:n,z:n,distance:n}):this._computeScreenSizeDistanceParameters3D(e,n,this.view,t)}_computeScreenSizeDistanceParameters3D(e,t,n,r){let{spatialReference:i}=r;n.renderCoordsHelper.toRenderCoords(e,i,z);let a=n.state.camera.computeScreenPixelSizeAt(z),o=a*n.renderCoordsHelper.unitInMeters,s=o/u(i),c=o/d(i),l=t*s,f=t*c,p=N(e,i,b,n),m=p?R(p,e,s,0,0,n,r):0,h=p?R(p,e,0,s,0,n,r):0,g=p?R(p,e,0,0,c,n,r):0;return{x:m===0?0:l/m,y:h===0?0:l/h,z:g===0?0:f/g,distance:a*t}}_processCandidatesFromSource(e,t,n){let r=[];for(let i of t)e.snappingSource&&!this._candidateIsExcluded(e.snappingSource,i,n.excludeFeature)&&(i instanceof j&&(i.layer=e.layer),r.push(i));return r}_candidateIsExcluded(e,t,n){if(n==null)return!1;let r=this._getCandidateObjectId(t);if(r==null)return!1;let i=e.layerSource.layer;return i.type===`graphics`?n.uid===r:n.sourceLayer!==i||!n.attributes||!(`objectIdField`in i)?!1:n.attributes[i.objectIdField]===r}_getCandidateObjectId(e){return e instanceof j?e.objectId:null}async _createSourceInfo(e,t){let n=e.layer;n.loaded||(await n.load(),o(t));let{view:r}=this,i=await this._createFeatureSnappingSourceType(e,t);return o(t),i==null?new D({}):new D({snappingSource:i,view:r,layer:n})}_handleSourceAbort(e,t){let n=s(t,()=>e.destroy());return n&&e.addHandles(n),e}async _createFeatureSnappingSourceType(e,t){switch(e.layer.type){case`feature`:case`geojson`:case`csv`:case`oriented-imagery`:case`subtype-group`:case`wfs`:return this._createFeatureSnappingSourceFeatureLayer(e,t);case`graphics`:case`sketch`:return this._createFeatureSnappingSourceGraphicsLayer(e,t);case`map-notes`:return this._createFeatureSnappingSourceMapNotesLayer(e,t);case`scene`:case`building-scene`:return this._createFeatureSnappingSourceSceneLayer(e,t)}return null}async _createFeatureSnappingSourceSceneLayer(e,t){let{view:n}=this;if(n==null||n.type!==`3d`)return null;let r=await this._getSourceModule(`scene`);return o(t),this._handleSourceAbort(new r.SceneLayerSnappingSource({layerSource:e,view:n}),t)}async _createFeatureSnappingSourceFeatureLayer(e,t){switch(e.layer.source?.type){case`feature-layer`:case`oriented-imagery`:{let n=await this._getSourceModule(`featureService`);return o(t),this._handleSourceAbort(new n.FeatureServiceSnappingSource({spatialReference:this.spatialReference,view:this.view,layerSource:e}),t)}case`memory`:case`csv`:case`geojson`:case`wfs`:{if(e.layer.geometryType===`mesh`)return null;let n=await this._getSourceModule(`featureCollection`);return o(t),this._handleSourceAbort(new n.FeatureCollectionSnappingSource({layerSource:e,view:this.view}),t)}}return null}async _createFeatureSnappingSourceGraphicsLayer(e,t){let n=await this._getSourceModule(`graphics`);return o(t),this._handleSourceAbort(new n.GraphicsSnappingSource({getGraphicsLayers:()=>[e.layer],spatialReference:this.spatialReference,view:this.view,layerSource:e}),t)}async _createFeatureSnappingSourceMapNotesLayer(e,t){let n=await this._getSourceModule(`notes`);return o(t),this._handleSourceAbort(new n.GraphicsSnappingSource({getGraphicsLayers:()=>e.layer.sublayers?.toArray()??[],spatialReference:this.spatialReference,view:this.view,layerSource:e}),t)}async _getSourceModule(e){let t=this._sourceModules[e];if(t.loader==null){let t=this._loadSourceModule(e),n={module:null,loader:t};this._sourceModules[e]=n;let r=await t,i={module:r,loader:t};return this._sourceModules[e]=i,r}return t.module==null?t.loader:t.module}_loadSourceModule(e){let t=this._updatingHandles;switch(e){case`featureService`:return t.addPromise(import(`./featureSources/FeatureServiceSnappingSource.js`));case`featureCollection`:return t.addPromise(import(`./featureSources/FeatureCollectionSnappingSource.js`));case`graphics`:return t.addPromise(import(`./featureSources/GraphicsSnappingSource.js`));case`notes`:return t.addPromise(import(`./featureSources/GraphicsSnappingSource.js`));case`scene`:return t.addPromise(import(`./featureSources/SceneLayerSnappingSource.js`))}}get test(){}};e([f({constructOnly:!0})],F.prototype,`spatialReference`,void 0),e([f({constructOnly:!0})],F.prototype,`view`,void 0),e([f()],F.prototype,`options`,void 0),e([f({readOnly:!0})],F.prototype,`updating`,null),e([f()],F.prototype,`_snappingSources`,void 0),F=e([p(`esri.views.interactive.snapping.FeatureSnappingEngine`)],F);function I(e){let t=e instanceof A||e instanceof k,n=S(e.constraint)||C(e.constraint);return t&&n&&!L(e.constraint)}function L({start:e,end:t}){let n=g(e,t),r=m(T(e),T(t));return n<v()||r/n<V}function R(e,t,n,r,i,a,{spatialReference:o}){let s=h(B,t);s[0]+=n,s[1]+=r,s[2]+=i;let c=N(s,o,b,a);return c?P(c,e):1/0}const z=_(),B=_(),V=1e-4;export{F as FeatureSnappingEngine};
package/views/types.d.ts CHANGED
@@ -870,6 +870,7 @@ export interface HitTestOptions3D {
870
870
  * > Please refer to the [styling guide](https://developers.arcgis.com/javascript/latest/styling/#view-size-css-classes) for additional
871
871
  * > information on working with this.
872
872
  *
873
+ * @deprecated since 5.2. Use alternative responsive design techniques such as a [ResizeObserver](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) instead.
873
874
  * @since 5.0
874
875
  * @see [BreakpointsOwner.breakpoints](https://developers.arcgis.com/javascript/latest/references/core/views/BreakpointsOwner/#breakpoints)
875
876
  */
@@ -941,6 +942,7 @@ export interface Breakpoints {
941
942
  * landscape | The [width](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#width) of the view is greater than its [height](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#height).
942
943
  * portrait | The [width](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#width) of the view is equal to or smaller than its [height](https://developers.arcgis.com/javascript/latest/references/core/views/View2D/#height).
943
944
  *
945
+ * @deprecated since 5.2. Use alternative responsive design techniques such as a [ResizeObserver](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) instead.
944
946
  * @since 5.0
945
947
  */
946
948
  export type BreakpointOrientation = "landscape" | "portrait";
@@ -960,6 +962,7 @@ export type BreakpointOrientation = "landscape" | "portrait";
960
962
  * large | The width or height of the view is between the values set in the `medium` and `large` [breakpoints](https://developers.arcgis.com/javascript/latest/references/core/views/BreakpointsOwner/#breakpoints). | 993 - 1200
961
963
  * xlarge | The width or height of the view is larger than the value set in the `large` [breakpoint](https://developers.arcgis.com/javascript/latest/references/core/views/BreakpointsOwner/#breakpoints). | > 1200
962
964
  *
965
+ * @deprecated since 5.2. Use alternative responsive design techniques such as a [ResizeObserver](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver) instead.
963
966
  * @since 5.0
964
967
  * @see [widthBreakpoint](https://developers.arcgis.com/javascript/latest/references/core/views/BreakpointsOwner/#widthBreakpoint)
965
968
  * @see [heightBreakpoint](https://developers.arcgis.com/javascript/latest/references/core/views/BreakpointsOwner/#heightBreakpoint)
@@ -16,7 +16,7 @@ ${o.join(`
16
16
  `)}
17
17
  ${s.join(`
18
18
  `)}`}generateBind(e){let t=new Map;this.vertex.uniforms.entries.forEach(e=>{let n=e.bind[0];n&&t.set(e.name,n)}),this.fragment.uniforms.entries.forEach(e=>{let n=e.bind[0];n&&t.set(e.name,n)});let n=Array.from(t.values()),r=n.length;return t=>{for(let i=0;i<r;++i)n[i](e,t)}}generateBindPass(e){let t=new Map;this.vertex.uniforms.entries.forEach(e=>{let n=e.bind[1];n&&t.set(e.name,n)}),this.fragment.uniforms.entries.forEach(e=>{let n=e.bind[1];n&&t.set(e.name,n)});let n=Array.from(t.values()),r=n.length;return(t,i)=>{for(let a=0;a<r;++a)n[a](e,i,t)}}generateBindDraw(e){let t=new Map;this.vertex.uniforms.entries.forEach(e=>{let n=e.bind[2];n&&t.set(e.name,n)}),this.fragment.uniforms.entries.forEach(e=>{let n=e.bind[2];n&&t.set(e.name,n)});let n=Array.from(t.values()),r=n.length;return(t,i,a)=>{for(let o=0;o<r;++o)n[o](e,a,t,i)}}}class a{constructor(e){this._stage=e,this._entries=new Map}add(...e){for(let t of e)this._add(t);return this._stage}get(e){return this._entries.get(e)}_add(t){if(t==null){n().error(`Trying to add null Uniform from ${Error().stack}.`);return}if(this._entries.has(t.name)&&!this._entries.get(t.name).equals(t))throw new e(`shaderbuilder:duplicate-uniform`,`Duplicate uniform name ${t.name} for different uniform type`);this._entries.set(t.name,t)}generateSource(){return Array.from(this._entries.values()).map(({name:e,arraySize:t,type:n})=>t==null?`uniform ${n} ${e};`:`uniform ${n} ${e}[${t}];`)}get entries(){return Array.from(this._entries.values())}}class o{constructor(){this._entries=new Map}add(t,n){if(this._entries.has(t))throw new e(`shaderbuilder:duplicate-input`,`Duplicate input for ${t}`);this._entries.set(t,n)}get(t){let n=this._entries.get(t);if(n==null)throw new e(`shaderbuilder:input-resolver-error`,`No resolver for input ${t} found.`);return n()}}class s{constructor(e){this._stage=e,this._bodies=[]}add(e){return this._bodies.push(e),this._stage}generateSource(t){if(this._bodies.length>0){let e=[];for(let t of this._bodies)typeof t==`string`?e.push(t):e.push(...t());return[`void main() {\n ${e.join(`
19
- `)||``} \n}`]}if(t)throw new e(`shaderbuilder:missing-main`,`Shader does not contain main function body.`);return[]}}class c{constructor(e){this._stage=e,this._entries=[]}add(e){return this._entries.push(e),this._stage}generateSource(){let e=[];for(let t of this._entries)typeof t==`string`?e.push(t):e.push(...t());return e}}class l extends r{constructor(){super(...arguments),this.uniforms=new a(this),this.main=new s(this),this.code=new c(this),this.constants=new p(this),this.inputs=new o}get builder(){return this}}class u{constructor(){this._entries=[]}add(e,t){this._entries.push([e,t])}generateSource(e){return e===`fragment`?[]:this._entries.map(e=>`in ${e[1]} ${e[0]};`)}get names(){return this._entries.map(([e])=>e)}}class d{constructor(){this._entries=new Map}add(e,t,r){if(this._entries.has(e)){n().warn(`Ignoring duplicate varying ${t} ${e}`);return}this._entries.set(e,{type:t,invariant:r?.invariant??!1})}generateSource(e){let t=[];return this._entries.forEach((n,r)=>t.push((n.invariant&&e===`vertex`?`invariant `:``)+(n.type===`int`?`flat `:``)+(e===`vertex`?`out`:`in`)+` ${n.type} ${r};`)),t}}class f{constructor(){this._entries=new Map}add(e,t,r=0){let i=this._entries.get(r);if(i?.name===e&&i?.type===t){n().warn(`Fragment shader output location ${r} occupied`);return}this._entries.set(r,{name:e,type:t})}static{this.DEFAULT_TYPE=`vec4`}static{this.DEFAULT_NAME=`fragColor`}generateSource(e){if(e===`vertex`)return[];this._entries.size===0&&this._entries.set(0,{name:f.DEFAULT_NAME,type:f.DEFAULT_TYPE});let t=[];return this._entries.forEach((e,n)=>t.push(`layout(location = ${n}) out ${e.type} ${e.name};`)),t}}class p{constructor(e){this._stage=e,this._entries=new Set}add(e,t,n){let r=`ERROR_CONSTRUCTOR_STRING`;switch(t){case`float`:r=p._numberToFloatStr(n);break;case`int`:r=p._numberToIntStr(n);break;case`uint`:r=p._numberToUintStr(n);break;case`bool`:r=n.toString();break;case`vec2`:r=`vec2(${p._numberToFloatStr(n[0])},\
19
+ `)||``} \n}`]}if(t)throw new e(`shaderbuilder:missing-main`,`Shader does not contain main function body.`);return[]}}class c{constructor(e){this._stage=e,this._entries=[]}add(e){return this._entries.push(e),this._stage}generateSource(){let e=[];for(let t of this._entries)typeof t==`string`?e.push(t):e.push(...t());return e}}class l extends r{constructor(){super(...arguments),this.uniforms=new a(this),this.main=new s(this),this.code=new c(this),this.constants=new p(this),this.inputs=new o}get builder(){return this}}class u{constructor(){this._entries=[]}add(e,t){this._entries.push([e,t])}generateSource(e){return e===`fragment`?[]:this._entries.map(e=>`in ${e[1]} ${e[0]};`)}get names(){return this._entries.map(([e])=>e)}}class d{constructor(){this._entries=new Map}add(e,t,r){if(this._entries.has(e)){n().warn(`Ignoring duplicate varying ${t} ${e}`);return}this._entries.set(e,{type:t,flat:r?.flat??!1,invariant:r?.invariant??!1})}generateSource(e){let t=[];return this._entries.forEach((n,r)=>t.push((n.invariant&&e===`vertex`?`invariant `:``)+(n.flat?`flat `:``)+(e===`vertex`?`out`:`in`)+` ${n.type} ${r};`)),t}}class f{constructor(){this._entries=new Map}add(e,t,r=0){let i=this._entries.get(r);if(i?.name===e&&i?.type===t){n().warn(`Fragment shader output location ${r} occupied`);return}this._entries.set(r,{name:e,type:t})}static{this.DEFAULT_TYPE=`vec4`}static{this.DEFAULT_NAME=`fragColor`}generateSource(e){if(e===`vertex`)return[];this._entries.size===0&&this._entries.set(0,{name:f.DEFAULT_NAME,type:f.DEFAULT_TYPE});let t=[];return this._entries.forEach((e,n)=>t.push(`layout(location = ${n}) out ${e.type} ${e.name};`)),t}}class p{constructor(e){this._stage=e,this._entries=new Set}add(e,t,n){let r=`ERROR_CONSTRUCTOR_STRING`;switch(t){case`float`:r=p._numberToFloatStr(n);break;case`int`:r=p._numberToIntStr(n);break;case`uint`:r=p._numberToUintStr(n);break;case`bool`:r=n.toString();break;case`vec2`:r=`vec2(${p._numberToFloatStr(n[0])},\
20
20
  ${p._numberToFloatStr(n[1])})`;break;case`vec3`:r=`vec3(${p._numberToFloatStr(n[0])},\
21
21
  ${p._numberToFloatStr(n[1])},\
22
22
  ${p._numberToFloatStr(n[2])})`;break;case`vec4`:r=`vec4(${p._numberToFloatStr(n[0])},\