@arcgis/core 4.30.0-next.20240606 → 4.30.0-next.20240607

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 (34) hide show
  1. package/README.md +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/0062b5fc83fc67d813e0.js +1 -0
  4. package/assets/esri/core/workers/chunks/{288fdc4a4746d6b81687.js → 4468c2c3b489782faa5c.js} +1 -1
  5. package/assets/esri/core/workers/chunks/6ad7b5817a9594689716.js +1 -0
  6. package/assets/esri/core/workers/chunks/888ad3cf5eaa472731be.js +1 -0
  7. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core-simd.wasm +0 -0
  8. package/assets/esri/rest/knowledgeGraph/wasmInterface/arcgis-knowledge-client-core.wasm +0 -0
  9. package/interfaces.d.ts +64 -0
  10. package/layers/CatalogLayer.js +1 -1
  11. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  12. package/layers/support/Sublayer.js +1 -1
  13. package/layers/support/arcgisLayers.js +1 -1
  14. package/package.json +1 -1
  15. package/support/elevationInfoUtils.js +1 -1
  16. package/support/revision.js +1 -1
  17. package/views/3d/interactive/editingTools/manipulatorUtils.js +1 -1
  18. package/views/3d/interactive/editingTools/originGeometryVisualElementUtils.js +1 -1
  19. package/views/3d/layers/TiledLayerView3D.js +1 -1
  20. package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
  21. package/views/3d/state/NearFarHeuristic.js +1 -1
  22. package/views/3d/webgl-engine/collections/Component/ElevationAgnosticBVH.js +1 -1
  23. package/webdoc/support/webdocSaveUtils.js +1 -1
  24. package/widgets/BasemapLayerList.js +1 -1
  25. package/widgets/Feature/support/featureUtils.js +1 -1
  26. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  27. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  28. package/widgets/FeatureTable/support/tableUtils.js +1 -1
  29. package/widgets/FeatureTable.js +1 -1
  30. package/widgets/Features/FeaturesViewModel.js +1 -1
  31. package/widgets/LayerList.js +1 -1
  32. package/assets/esri/core/workers/chunks/9f2d8940da48c864b2ca.js +0 -1
  33. package/assets/esri/core/workers/chunks/d03ada1212b13e76bff4.js +0 -1
  34. package/assets/esri/core/workers/chunks/e21d72debf45c5a33520.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{verticalLengthUnitFromSpatialReference as e,convertUnit as n}from"../core/unitUtils.js";import{getMetersPerUnit as t}from"../symbols/support/unitConversionUtils.js";function o(e){return e?$:R}function r(e,n){return n?.mode?n.mode:o(e).mode}function u(e,n){return null!=n?n:o(e)}function i(e,n){return r(null!=e&&e.hasZ,n)}function s(e,n){return u(null!=e&&!!e.hasZ,n)}function l(e){const n=d(e);return i(e.geometry,n)}function a(e){const n=d(e),t=i(e.geometry,n),o=null!=n&&"on-the-ground"!==t?w(n):0,r=n?.featureExpressionInfo;return{mode:t,offset:o,featureExpressionInfo:r}}function c(e){return f(a(e))}function f(e){if(!e)return!1;if("on-the-ground"===e.mode)return!1;const n=e?.featureExpressionInfo?e.featureExpressionInfo.expression:null;return!(!n||"0"===n)}function d(e){return e.layer&&"elevationInfo"in e.layer?e.layer.elevationInfo:null}function v(t,o){if(!t?.offset)return 0;const{offset:r,unit:u}=t;if("decimal-degrees"===u)return 0;const i="unknown"!==u&&u?u:"meters",s=e(o);return s?n(r,i,s):0}function g(e,n,t){if(!t?.mode)return;const o=e.hasZ?e.z:0,r=v(t,e.spatialReference);switch(t.mode){case"absolute-height":return o-r;case"on-the-ground":return 0;case"relative-to-ground":return o-((n.elevationProvider.getElevation(e.x,e.y,o,e.spatialReference,"ground")??0)+r);case"relative-to-scene":return o-((n.elevationProvider.getElevation(e.x,e.y,o,e.spatialReference,"scene")??0)+r)}}function h(e,n,t,o=null){return p(e,n.x,n.y,n.hasZ?n.z:0,n.spatialReference,t,o)}function m(e,n,t,o,r=null){return p(e,n[0],n[1],n.length>2?n[2]:0,t,o,r)}function p(e,n,t,o,r,u,i=null){if(null==u)return;const s=null!=i?i.mode:"absolute-height";if("on-the-ground"===s)return 0;const{absoluteZ:l}=E(n,t,o,r,e,u);return x(l,n,t,o,r,e,i,s)}function E(e,n,t,o,r,u){const i=v(u,o);switch(u.mode){case"absolute-height":return{absoluteZ:t+i,elevation:0};case"on-the-ground":{const t=r.elevationProvider.getElevation(e,n,0,o,"ground")??0;return{absoluteZ:t,elevation:t}}case"relative-to-ground":{const u=r.elevationProvider.getElevation(e,n,t,o,"ground")??0;return{absoluteZ:t+u+i,elevation:u}}case"relative-to-scene":{const u=r.elevationProvider.getElevation(e,n,t,o,"scene")??0;return{absoluteZ:t+u+i,elevation:u}}}}function x(e,n,t,o,r,u,i,s){const l=v(i,r);switch(s){case"absolute-height":return e-l;case"relative-to-ground":return e-((u.elevationProvider.getElevation(n,t,o,r,"ground")??0)+l);case"relative-to-scene":return e-((u.elevationProvider.getElevation(n,t,o,r,"scene")??0)+l)}}function b(e,n){if(null==n)return!1;const{mode:t}=n;return null!=t&&("scene"===e&&"relative-to-scene"===t||"ground"===e&&"absolute-height"!==t)}function y(e,n,t){return t&&t.mode!==n?`${e} only support ${n} elevation mode`:null}function I(e,n,t){return t?.mode===n?`${e} do not support ${n} elevation mode`:null}function Z(e,n){return null!=n?.featureExpressionInfo&&"0"!==n.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function P(e,n){n&&e.warn(".elevationInfo=",n)}function w(e){return(e?.offset??0)*t(e?.unit)}const $={mode:"absolute-height",offset:0},R={mode:"on-the-ground",offset:null};export{$ as absoluteHeightElevationInfo,b as elevationContextAffectsAlignment,y as elevationModeRequiredMessage,I as elevationModeUnsupportedMessage,Z as featureExpressionUnsupportedMessage,h as getConvertedElevation,m as getConvertedElevationFromVector,p as getConvertedElevationFromXYZ,u as getEffectiveElevationInfo,r as getEffectiveElevationMode,v as getElevationOffset,w as getElevationOffsetInMeters,s as getGeometryEffectiveElevationInfo,i as getGeometryEffectiveElevationMode,a as getGraphicEffectiveElevationInfo,l as getGraphicEffectiveElevationMode,g as getZForElevationMode,f as hasEffectiveFeatureExpressionInfo,c as hasGraphicFeatureExpressionInfo,P as logInvalidElevationInfoWarning,R as onTheGroundElevationInfo,E as zValueInAbsoluteHeightMode};
5
+ import{verticalLengthUnitFromSpatialReference as e,convertUnit as n}from"../core/unitUtils.js";import{getMetersPerUnit as t}from"../symbols/support/unitConversionUtils.js";function o(e){return e?j:z}function r(e,n){return n?.mode?n.mode:o(e).mode}function u(e,n){return null!=n?n:o(e)}function i(e,n){return r(null!=e&&e.hasZ,n)}function s(e,n){return u(null!=e&&!!e.hasZ,n)}function l(e){const n=g(e);return i(e.geometry,n)}function a(e){const n=g(e),t=i(e.geometry,n),o=null!=n&&"on-the-ground"!==t?R(n):0,r=n?.featureExpressionInfo;return{mode:t,offset:o,featureExpressionInfo:r}}function f(e){return v(a(e))}function c(e){return v(e)||d(e)}function d(e){return"0"===e?.featureExpressionInfo?.expression}function v(e){if(!e)return!1;if("on-the-ground"===e.mode)return!1;const n=e?.featureExpressionInfo?e.featureExpressionInfo.expression:null;return!(!n||"0"===n)}function g(e){return e.layer&&"elevationInfo"in e.layer?e.layer.elevationInfo:null}function h(t,o){if(!t?.offset)return 0;const{offset:r,unit:u}=t;if("decimal-degrees"===u)return 0;const i="unknown"!==u&&u?u:"meters",s=e(o);return s?n(r,i,s):0}function p(e,n,t){if(!t?.mode)return;const o=e.hasZ?e.z:0,r=h(t,e.spatialReference);switch(t.mode){case"absolute-height":return o-r;case"on-the-ground":return 0;case"relative-to-ground":return o-((n.elevationProvider.getElevation(e.x,e.y,o,e.spatialReference,"ground")??0)+r);case"relative-to-scene":return o-((n.elevationProvider.getElevation(e.x,e.y,o,e.spatialReference,"scene")??0)+r)}}function m(e,n,t,o=null){return E(e,n.x,n.y,n.hasZ?n.z:0,n.spatialReference,t,o)}function x(e,n,t,o,r=null){return E(e,n[0],n[1],n.length>2?n[2]:0,t,o,r)}function E(e,n,t,o,r,u,i=null){if(null==u)return;const s=null!=i?i.mode:"absolute-height";if("on-the-ground"===s)return 0;const{absoluteZ:l}=b(n,t,o,r,e,u);return I(l,n,t,o,r,e,i,s)}function b(e,n,t,o,r,u){const i=h(u,o);switch(u.mode){case"absolute-height":return{absoluteZ:t+i,elevation:0};case"on-the-ground":{const t=r.elevationProvider.getElevation(e,n,0,o,"ground")??0;return{absoluteZ:t,elevation:t}}case"relative-to-ground":{const u=r.elevationProvider.getElevation(e,n,t,o,"ground")??0;return{absoluteZ:t+u+i,elevation:u}}case"relative-to-scene":{const u=r.elevationProvider.getElevation(e,n,t,o,"scene")??0;return{absoluteZ:t+u+i,elevation:u}}}}function I(e,n,t,o,r,u,i,s){const l=h(i,r);switch(s){case"absolute-height":return e-l;case"relative-to-ground":return e-((u.elevationProvider.getElevation(n,t,o,r,"ground")??0)+l);case"relative-to-scene":return e-((u.elevationProvider.getElevation(n,t,o,r,"scene")??0)+l)}}function y(e,n){if(null==n)return!1;const{mode:t}=n;return null!=t&&("scene"===e&&"relative-to-scene"===t||"ground"===e&&"absolute-height"!==t)}function Z(e,n,t){return t&&t.mode!==n?`${e} only support ${n} elevation mode`:null}function P(e,n,t){return t?.mode===n?`${e} do not support ${n} elevation mode`:null}function w(e,n){return null!=n?.featureExpressionInfo&&"0"!==n.featureExpressionInfo.expression?`${e} do not support featureExpressionInfo`:null}function $(e,n){n&&e.warn(".elevationInfo=",n)}function R(e){return(e?.offset??0)*t(e?.unit)}const j={mode:"absolute-height",offset:0},z={mode:"on-the-ground",offset:null};export{j as absoluteHeightElevationInfo,y as elevationContextAffectsAlignment,Z as elevationModeRequiredMessage,P as elevationModeUnsupportedMessage,d as featureExpressionInfoIsZero,w as featureExpressionUnsupportedMessage,m as getConvertedElevation,x as getConvertedElevationFromVector,E as getConvertedElevationFromXYZ,u as getEffectiveElevationInfo,r as getEffectiveElevationMode,h as getElevationOffset,R as getElevationOffsetInMeters,s as getGeometryEffectiveElevationInfo,i as getGeometryEffectiveElevationMode,a as getGraphicEffectiveElevationInfo,l as getGraphicEffectiveElevationMode,p as getZForElevationMode,v as hasEffectiveFeatureExpressionInfo,c as hasFeatureExpressionInfo,f as hasGraphicFeatureExpressionInfo,$ as logInvalidElevationInfoWarning,z as onTheGroundElevationInfo,b as zValueInAbsoluteHeightMode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- const c="20240606",e="63ecc314761055978d71a45d43273828e6fc2c84";export{c as buildDate,e as commitHash};
5
+ const e="20240607",f="00f320ef03ecca2164e326a91f3d219e5bb31bfe";export{e as buildDate,f as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{makeHandle as e}from"../../../../core/handleUtils.js";function n(e,n){return o(e?.data.coordinateHelper.hasZ(),n)}function o(e,n){return!!e&&"on-the-ground"!==n.mode}function r(n,o){let r=null;const t=n.events.on("grab-changed",(e=>{null!=r&&(r.remove(),r=null),"start"===e.action?(r=n.disableDisplay(),o&&o(e)):o&&o(e)}));return e((()=>{r?.remove(),t.remove()}))}export{n as canMoveZOperations,r as disableDisplayOnGrab};
5
+ import{makeHandle as e}from"../../../../core/handleUtils.js";import{hasFeatureExpressionInfo as n}from"../../../../support/elevationInfoUtils.js";function o(e,n){return t(e?.data.coordinateHelper.hasZ(),n)}function t(e,o){return!!e&&"on-the-ground"!==o.mode&&!n(o)}function r(n,o){let t=null;const r=n.events.on("grab-changed",(e=>{null!=t&&(t.remove(),t=null),"start"===e.action?(t=n.disableDisplay(),o&&o(e)):o&&o(e)}));return e((()=>{t?.remove(),r.remove()}))}export{o as canMoveZOperations,r as disableDisplayOnGrab};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{removeHandles as e,destroyHandle as t,refHandle as o}from"../../../../core/handleUtils.js";import{deg2rad as n}from"../../../../core/mathUtils.js";import{watch as i,initial as r}from"../../../../core/reactiveUtils.js";import{signal as a}from"../../../../core/signal.js";import{s}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectPointToVector as c}from"../../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as p}from"../../../../geometry/projection/projectVectorToVector.js";import{create as m,empty as u,getMin as h}from"../../../../geometry/support/aaBoundingBox.js";import{containsXY as f}from"../../../../geometry/support/aaBoundingRect.js";import{GrabbingState as v}from"./GrabbingState.js";import{manipulatedObjectGeometry as d}from"./manipulatedObjectUtils.js";import{ManipulatorState as g}from"./ManipulatorState.js";import{Settings as j}from"./settings.js";import{ExtendedLineVisualElement as b}from"../visualElements/ExtendedLineVisualElement.js";import{LaserlineVisualElement as w}from"../visualElements/LaserlineVisualElement.js";import{PointVisualElement as y}from"../visualElements/PointVisualElement.js";import{evaluateElevationAlignmentAtPoint as E}from"../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as T}from"../../layers/graphics/ElevationContext.js";import{RenderOccludedFlag as x}from"../../webgl-engine/lib/Material.js";function D(t){const o=[],n=S(t,o);return P(t,o,n),{visualElement:n,remove:()=>e(o)}}function P(e,o,l){const{view:c,object:m}=e,f=new j({getTheme:()=>c.effectiveTheme}),y=new b({view:c,extensionType:f.visualElements.zVerticalLine.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:x.OccludeAndTransparent,isDecoration:!0});o.push(i((()=>f.visualElements.zVerticalLine),(e=>e.apply(y)),r));const D=new w({view:c,intersectsLineInfinite:!0,attached:!1,isDecoration:!0}),P=n(f.visualElements.heightPlaneAngleCutoff),S=new w({view:c,attached:!1,angleCutoff:P,isDecoration:!0}),A=m.elevationInfo,L=T.fromElevationInfo(A),M="on-the-ground"===A.mode||!A.offset&&"absolute-height"!==A.mode,U=new g,I=a(1);o.push(i((()=>({heightPlane:f.visualElements.heightPlane,alpha:I.value})),(({heightPlane:e,alpha:t})=>e.apply(S,t)),r));const O=a(1);o.push(i((()=>({shadowStyle:f.visualElements.pointObjects.shadowStyle,alpha:O.value})),(({shadowStyle:e,alpha:t})=>e.apply(D,t)),r));const B=()=>{U.update(e);const t=V(d(m)),o=M&&(m.isDraped||null==t||!t.hasZ);let n=!0;if(o||null==t)n=!1;else{const e=E(t,c.elevationProvider,L,c.renderCoordsHelper);s(C,t.x,t.y,e),p(C,t.spatialReference,C,c.renderCoordsHelper.spatialReference),y.setStartEndFromWorldDownAtLocation(C),D.intersectsWorldUpAtLocation=C}const i=U.grabbingState&v.Z?f.visualElements.laserlineAlphaMultiplier:1;I.value=i;const r=u(R);!o&&m.visible&&l.calculateMapBounds(r)&&p(h(r,C),c.spatialReference,C,c.renderCoordsHelper.spatialReference)?(S.heightManifoldTarget=C,S.attached=!0):S.attached=!1;const a=U.grabbingState&v.XY?f.visualElements.laserlineAlphaMultiplier:1;O.value=a;const g=n&&m.visible&&!o;D.attached=g,y.attached=g};o.push(i((()=>[m.visible,m.isDraped]),B),m.on("committed",B)),e.forEachManipulator((e=>{o.push(e.events.on("grab-changed",B))})),o.push(t(D)),o.push(t(y)),o.push(t(S)),B()}function S(e,o){const{view:n,object:i}=e,r=new y({view:n,geometry:V(d(i)),elevationInfo:i.elevationInfo,isDecoration:!0});return A(e,r,o),o.push(t(r)),r}function V(e){return null==e?null:"point"===e.type?e:"mesh"===e.type?e.anchor.clone():null}function A(e,t,o){const{view:n,object:a}=e,s=()=>{t.attached=a.visible},l=new j({getTheme:()=>n.effectiveTheme});L(e,t,o),l.visualElements.pointObjects.outline.apply(t),o.push(i((()=>a.visible),s,r))}function L(e,t,n){const{view:i,object:r}=e;let a=null;const s=e=>{null!=a&&(a.remove(),a=null),r.isDraped&&null!=e&&(a=M(i,e,(()=>{t.geometry=e})))},l=()=>{const e=V(d(r));s(e),t.geometry=e};n.push(r.on("committed",l),o((()=>a))),l()}function M(e,t,o){const n=e.elevationProvider.spatialReference;c(t,C,n);const i=C[0],r=C[1];return e.elevationProvider.on("elevation-change",(e=>{f(e.extent,i,r)&&o()}))}const C=l(),R=m();export{D as createVisualElements};
5
+ import{removeHandles as e,destroyHandle as t,refHandle as o}from"../../../../core/handleUtils.js";import{deg2rad as n}from"../../../../core/mathUtils.js";import{watch as i,initial as a}from"../../../../core/reactiveUtils.js";import{signal as l}from"../../../../core/signal.js";import{s as r}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectPointToVector as c}from"../../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as p}from"../../../../geometry/projection/projectVectorToVector.js";import{create as m,empty as u,getMin as f}from"../../../../geometry/support/aaBoundingBox.js";import{containsXY as h}from"../../../../geometry/support/aaBoundingRect.js";import{hasFeatureExpressionInfo as v,featureExpressionInfoIsZero as d}from"../../../../support/elevationInfoUtils.js";import{GrabbingState as g}from"./GrabbingState.js";import{manipulatedObjectGeometry as j}from"./manipulatedObjectUtils.js";import{ManipulatorState as b}from"./ManipulatorState.js";import{Settings as w}from"./settings.js";import{ExtendedLineVisualElement as y}from"../visualElements/ExtendedLineVisualElement.js";import{LaserlineVisualElement as E}from"../visualElements/LaserlineVisualElement.js";import{PointVisualElement as T}from"../visualElements/PointVisualElement.js";import{evaluateElevationAlignmentAtPoint as x}from"../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as D}from"../../layers/graphics/ElevationContext.js";import{RenderOccludedFlag as I}from"../../webgl-engine/lib/Material.js";function P(t){const o=[],n=V(t,o);return S(t,o,n),{visualElement:n,remove:()=>e(o)}}function S(e,o,s){const{view:c,object:m}=e,h=new w({getTheme:()=>c.effectiveTheme}),d=new y({view:c,extensionType:h.visualElements.zVerticalLine.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:I.OccludeAndTransparent,isDecoration:!0});o.push(i((()=>h.visualElements.zVerticalLine),(e=>e.apply(d)),a));const T=new E({view:c,intersectsLineInfinite:!0,attached:!1,isDecoration:!0}),P=n(h.visualElements.heightPlaneAngleCutoff),S=new E({view:c,attached:!1,angleCutoff:P,isDecoration:!0}),V=m.elevationInfo,L=D.fromElevationInfo(V),M="on-the-ground"===V.mode||!V.offset&&"absolute-height"!==V.mode,U=new b,O=l(1);o.push(i((()=>({heightPlane:h.visualElements.heightPlane,alpha:O.value})),(({heightPlane:e,alpha:t})=>e.apply(S,t)),a));const B=l(1);o.push(i((()=>({shadowStyle:h.visualElements.pointObjects.shadowStyle,alpha:B.value})),(({shadowStyle:e,alpha:t})=>e.apply(T,t)),a));const z=()=>{U.update(e);const t=A(j(m)),o=M&&(m.isDraped||null==t||!t.hasZ);let n=!0;if(o||null==t)n=!1;else{const e=x(t,c.elevationProvider,L,c.renderCoordsHelper);r(C,t.x,t.y,e),p(C,t.spatialReference,C,c.renderCoordsHelper.spatialReference),d.setStartEndFromWorldDownAtLocation(C),T.intersectsWorldUpAtLocation=C}const i=U.grabbingState&g.Z?h.visualElements.laserlineAlphaMultiplier:1;O.value=i;const a=u(R);!o&&m.visible&&s.calculateMapBounds(a)&&p(f(a,C),c.spatialReference,C,c.renderCoordsHelper.spatialReference)?(S.heightManifoldTarget=C,S.attached=!0):S.attached=!1;const l=U.grabbingState&g.XY?h.visualElements.laserlineAlphaMultiplier:1;B.value=l;const b=n&&m.visible&&!o;T.attached=b,d.attached=b&&!v(m.elevationInfo)};o.push(i((()=>[m.visible,m.isDraped]),z),m.on("committed",z)),e.forEachManipulator((e=>{o.push(e.events.on("grab-changed",z))})),o.push(t(T)),o.push(t(d)),o.push(t(S)),z()}function V(e,o){const{view:n,object:i}=e,a=new T({view:n,geometry:A(j(i)),elevationInfo:i.elevationInfo,isDecoration:!0});return L(e,a,o),o.push(t(a)),a}function A(e){return null==e?null:"point"===e.type?e:"mesh"===e.type?e.anchor.clone():null}function L(e,t,o){const{view:n,object:l}=e,r=()=>{t.attached=l.visible&&!v(l.elevationInfo)},s=new w({getTheme:()=>n.effectiveTheme});M(e,t,o),s.visualElements.pointObjects.outline.apply(t),o.push(i((()=>l.visible),r,a))}function M(e,t,n){const{view:i,object:a}=e;let l=null;const r=e=>{null!=l&&(l.remove(),l=null),a.isDraped&&null!=e&&(l=U(i,e,(()=>{t.geometry=e})))},s=()=>{const e=A(j(a));null!=e&&d(a.elevationInfo)&&(e.z=0),r(e),t.geometry=e};n.push(a.on("committed",s),o((()=>l))),s()}function U(e,t,o){const n=e.elevationProvider.spatialReference;c(t,C,n);const i=C[0],a=C[1];return e.elevationProvider.on("elevation-change",(e=>{h(e.extent,i,a)&&o()}))}const C=s(),R=m();export{P as createVisualElements};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{whenOnce as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerViewPerformanceInfo as l}from"./support/LayerViewPerformanceInfo.js";import{updatingProgress as s,updatingProgressValue as n}from"../support/updatingProperties.js";import{checkIfTileInfoSupportedForView as o}from"../terrain/terrainUtils.js";const c=c=>{let p=class extends c{constructor(){super(...arguments),this.hasMixedImageFormats=!0}get imageFormatIsOpaque(){return!1}get fullExtent(){return this.layer.fullExtent}get isOpaque(){return this.fullOpacity>=1&&this.imageFormatIsOpaque}get dataScaleRange(){const e=this.tileInfo.lods;let t=e[0].scale,i=e[e.length-1].scale;if("tilemapCache"in this.layer&&this.layer.tilemapCache){const{effectiveMinLOD:e,effectiveMaxLOD:a}=this.layer.tilemapCache;t=this.tileInfo.lodAt(e).scale,i=this.tileInfo.lodAt(a).scale}return{minScale:t,maxScale:i}}get dataLevelRange(){const{minScale:e,maxScale:t}=this.dataScaleRange;return this.levelRangeFromScaleRange(e,t)}get displayLevelRange(){const e=this.layer.minScale||this.dataScaleRange.minScale,t=this.layer.maxScale||this.dataScaleRange.maxScale,i=this.levelRangeFromScaleRange(e,t);return this.layer.maxScale&&i.maxLevel++,i}get performanceInfo(){return new l(this.view.basemapTerrain.getUsedMemoryForLayerView(this))}getTileUrl(e){return this.layer.getTileUrl(e[0],e[1],e[2])}_addTilingSchemeMatchPromise(){if(null==this.fullExtent)return this.addResolvingPromise(Promise.reject(new t("tilingscheme:extent-not-defined","This layer doesn't define a fullExtent.")));const e=this._getTileInfoSupportError(this.tileInfo,this.fullExtent);if(e)return this.addResolvingPromise(Promise.reject(e));this.addResolvingPromise(i((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const e=this.view.basemapTerrain.tilingScheme,t="tilemapCache"in this.layer?this.layer.tilemapCache?.effectiveMaxLOD:void 0,i=this._getTileInfoCompatibilityError(this.tileInfo,e,t);if(i)throw i})))}_getTileInfoSupportError(e,i){const a=o(e,i,this.view.spatialReference,this.view.state.viewingMode,"tilemapCache"in this.layer?this.layer.tilemapCache?.effectiveMaxLOD:void 0);if(!a)return;const r={layer:this.layer,error:a};switch(a.name){case"tilingscheme:spatial-reference-mismatch":case"tilingscheme:global-unsupported-spatial-reference":case"tilingscheme:local-unsupported-spatial-reference":return new t("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",r);default:return new t("layerview:tiling-scheme-unsupported","The tiling scheme of this layer is not supported by SceneView",r)}}_getTileInfoCompatibilityError(e,i,a){return null!=e&&i.compatibleWith(e,a)?null:new t("layerview:tiling-scheme-incompatible","The tiling scheme of this layer is incompatible with the tiling scheme of the surface")}levelRangeFromScaleRange(e,t){const i={minLevel:0,maxLevel:1/0},a=this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.tilingScheme;if(!a)return i;const r=a.levels[0],l=e=>{const t=Math.log(r.scale/e)/Math.LN2;return.5-Math.abs(.5-t%1)<1e-9?Math.round(t):Math.ceil(t)};return null!=e&&e>0&&(i.minLevel=Math.max(0,l(e))),null!=t&&t>0&&(i.maxLevel=Math.max(0,l(t))),i}isUpdating(){return!!(this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.updating)}};return e([a({readOnly:!0})],p.prototype,"imageFormatIsOpaque",null),e([a({readOnly:!0})],p.prototype,"updating",void 0),e([a(s)],p.prototype,"updatingProgress",void 0),e([a(n)],p.prototype,"updatingProgressValue",void 0),e([a()],p.prototype,"hasMixedImageFormats",void 0),e([a()],p.prototype,"fullExtent",null),e([a({readOnly:!0})],p.prototype,"isOpaque",null),e([a()],p.prototype,"dataScaleRange",null),e([a({readOnly:!0})],p.prototype,"dataLevelRange",null),e([a({readOnly:!0})],p.prototype,"displayLevelRange",null),e([a()],p.prototype,"layer",void 0),p=e([r("esri.views.3d.layers.TiledLayerView3D")],p),p};export{c as TiledLayerView3D};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{whenOnce as i}from"../../../core/reactiveUtils.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{LayerViewPerformanceInfo as l}from"./support/LayerViewPerformanceInfo.js";import{updatingProgress as s,updatingProgressValue as n}from"../support/updatingProperties.js";import{checkIfTileInfoSupportedForView as o}from"../terrain/terrainUtils.js";import{isScaleRangeActive as c,validateScaleRange as h}from"../../support/layerViewUtils.js";const p=p=>{let m=class extends p{constructor(){super(...arguments),this.hasMixedImageFormats=!0}get imageFormatIsOpaque(){return!1}get fullExtent(){return this.layer.fullExtent}get isOpaque(){return this.fullOpacity>=1&&this.imageFormatIsOpaque}get visibleAtCurrentScale(){if(!c(this.layer.minScale,this.layer.maxScale)||!this.view.terrainScale)return!0;const e=Math.round(this.view.basemapTerrain.tilingScheme.levelAtScale(this.view.terrainScale));return e>=this.displayLevelRange.minLevel&&e<=this.displayLevelRange.maxLevel}get dataScaleRange(){const e=this.tileInfo.lods;let t=e[0].scale,i=e[e.length-1].scale;if("tilemapCache"in this.layer&&this.layer.tilemapCache){const{effectiveMinLOD:e,effectiveMaxLOD:a}=this.layer.tilemapCache;t=this.tileInfo.lodAt(e).scale,i=this.tileInfo.lodAt(a).scale}return{minScale:t,maxScale:i}}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&!this.parent?.suspended&&this.view?.ready&&h(e)&&this.visibleAtCurrentTimeExtent||!1}get dataLevelRange(){const{minScale:e,maxScale:t}=this.dataScaleRange;return this.levelRangeFromScaleRange(e,t)}get displayLevelRange(){const e=this.layer.minScale||this.dataScaleRange.minScale,t=this.layer.maxScale||this.dataScaleRange.maxScale,i=this.levelRangeFromScaleRange(e,t);return this.layer.maxScale&&i.maxLevel++,i}get performanceInfo(){return new l(this.view.basemapTerrain.getUsedMemoryForLayerView(this))}getTileUrl(e){return this.layer.getTileUrl(e[0],e[1],e[2])}_addTilingSchemeMatchPromise(){if(null==this.fullExtent)return this.addResolvingPromise(Promise.reject(new t("tilingscheme:extent-not-defined","This layer doesn't define a fullExtent.")));const e=this._getTileInfoSupportError(this.tileInfo,this.fullExtent);if(e)return this.addResolvingPromise(Promise.reject(e));this.addResolvingPromise(i((()=>this.view?.basemapTerrain?.tilingSchemeLocked)).then((()=>{const e=this.view.basemapTerrain.tilingScheme,t="tilemapCache"in this.layer?this.layer.tilemapCache?.effectiveMaxLOD:void 0,i=this._getTileInfoCompatibilityError(this.tileInfo,e,t);if(i)throw i})))}_getTileInfoSupportError(e,i){const a=o(e,i,this.view.spatialReference,this.view.state.viewingMode,"tilemapCache"in this.layer?this.layer.tilemapCache?.effectiveMaxLOD:void 0);if(!a)return;const r={layer:this.layer,error:a};switch(a.name){case"tilingscheme:spatial-reference-mismatch":case"tilingscheme:global-unsupported-spatial-reference":case"tilingscheme:local-unsupported-spatial-reference":return new t("layerview:spatial-reference-incompatible","The spatial reference of this layer does not meet the requirements of the view",r);default:return new t("layerview:tiling-scheme-unsupported","The tiling scheme of this layer is not supported by SceneView",r)}}_getTileInfoCompatibilityError(e,i,a){return null!=e&&i.compatibleWith(e,a)?null:new t("layerview:tiling-scheme-incompatible","The tiling scheme of this layer is incompatible with the tiling scheme of the surface")}levelRangeFromScaleRange(e,t){const i={minLevel:0,maxLevel:1/0},a=this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.tilingScheme;if(!a)return i;const r=a.levels[0],l=e=>{const t=Math.log(r.scale/e)/Math.LN2;return.5-Math.abs(.5-t%1)<1e-9?Math.round(t):Math.ceil(t)};return null!=e&&e>0&&(i.minLevel=Math.max(0,l(e))),null!=t&&t>0&&(i.maxLevel=Math.max(0,l(t))),i}isUpdating(){return!!(this.view&&this.view.basemapTerrain&&this.view.basemapTerrain.updating)}};return e([a({readOnly:!0})],m.prototype,"imageFormatIsOpaque",null),e([a({readOnly:!0})],m.prototype,"updating",void 0),e([a(s)],m.prototype,"updatingProgress",void 0),e([a(n)],m.prototype,"updatingProgressValue",void 0),e([a()],m.prototype,"hasMixedImageFormats",void 0),e([a()],m.prototype,"fullExtent",null),e([a({readOnly:!0})],m.prototype,"isOpaque",null),e([a({readOnly:!0})],m.prototype,"visibleAtCurrentScale",null),e([a()],m.prototype,"dataScaleRange",null),e([a({readOnly:!0})],m.prototype,"dataLevelRange",null),e([a({readOnly:!0})],m.prototype,"displayLevelRange",null),e([a()],m.prototype,"layer",void 0),m=e([r("esri.views.3d.layers.TiledLayerView3D")],m),m};export{p as TiledLayerView3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import"../../../../renderers/ClassBreaksRenderer.js";import"../../../../renderers/DictionaryRenderer.js";import"../../../../renderers/DotDensityRenderer.js";import"../../../../renderers/HeatmapRenderer.js";import"../../../../renderers/PieChartRenderer.js";import"../../../../renderers/Renderer.js";import"../../../../renderers/SimpleRenderer.js";import t from"../../../../renderers/UniqueValueRenderer.js";import"../../../../renderers/support/jsonUtils.js";import i from"../../../../core/Logger.js";import"../../../../symbols.js";import r from"../../../../core/Accessor.js";import{isSome as s}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import a from"../../../../core/Error.js";import{makeHandle as n}from"../../../../core/handleUtils.js";import{someMap as o,findInMap as l}from"../../../../core/MapUtils.js";import{removeMaybe as h,destroyMaybe as d,disposeMaybe as p}from"../../../../core/maybe.js";import{MinPriority as c}from"../../../../core/MemCache.js";import y from"../../../../core/PooledArray.js";import{throwIfAborted as g,createResolver as u,isAbortError as m,ignoreAbortErrors as b}from"../../../../core/promiseUtils.js";import{watch as _,when as f,on as v,syncAndInitial as C,whenOnce as S}from"../../../../core/reactiveUtils.js";import{schedule as G}from"../../../../core/scheduling.js";import{property as w}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as R}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as x,isEmpty as P}from"../../../../core/accessorSupport/diffUtils.js";import{s as D,g as E,j as I}from"../../../../chunks/vec32.js";import{create as U}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as A}from"../../../../geometry/projection.js";import{projectBuffer as L}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as j}from"../../../../geometry/projection/projectVectorToVector.js";import{projectXYZToVector as O}from"../../../../geometry/projection/projectXYZToVector.js";import{create as V,center as F,fromRect as T,equals as M}from"../../../../geometry/support/aaBoundingBox.js";import{create as z}from"../../../../geometry/support/aaBoundingRect.js";import{equals as k}from"../../../../geometry/support/spatialReferenceUtils.js";import W from"../../../../layers/Layer.js";import{getObjectId as H,computeAABB as N,hasGeometry as B}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as q}from"../../../../layers/graphics/hydratedFeatures.js";import{PromiseQueue as Y}from"../../../../layers/support/PromiseQueue.js";import{isSupportedRenderer3D as Q,validateTo3D as $}from"../../../../renderers/support/rendererConversion.js";import{loadArcade as Z}from"../../../../support/arcadeOnDemand.js";import{isBasemapLayer as J}from"../../../../support/basemapUtils.js";import{getDefaultSymbol3D as X}from"../../../../symbols/support/defaults3D.js";import{to3D as K}from"../../../../symbols/support/symbolConversion.js";import{averageSymbolComplexities as ee,defaultSymbolComplexity as te}from"./defaultSymbolComplexity.js";import{DisplayFeatureLimit as ie}from"./DisplayFeatureLimit.js";import{ViewElevationProvider as re}from"./ElevationQuery.js";import{VisibilityGroup as se,VisibilityFlag as ae}from"./enums.js";import{extractExpressionInfo as ne,createContext as oe}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as le}from"./Graphics3DFeatureStore.js";import{Graphics3DGraphicCreationContext as he}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as de}from"./Graphics3DSymbolCreationContext.js";import{make as pe}from"./Graphics3DSymbolFactory.js";import{Graphics3DWebStyleSymbol as ce}from"./Graphics3DWebStyleSymbol.js";import{GraphicsCorePerformanceInfo as ye}from"./GraphicsCorePerformanceInfo.js";import{GraphicStateTracking as ge}from"./GraphicStateTracking.js";import{computeCentroid as ue}from"./graphicUtils.js";import{ApplyRendererDiffResult as me}from"./interfaces.js";import{LoadStatus as be}from"./Loadable.js";import{SpatialIndex2D as _e}from"./SpatialIndex2D.js";import{getSymbolMemorySize as fe}from"./symbolMemory.js";import{StageLayerElevationProvider as ve}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as Ce}from"../../support/extentUtils.js";import{PropertiesPool as Se}from"../../support/PropertiesPool.js";import{GridLocalOriginFactory as Ge}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{UpdatePolicy as we}from"../../webgl-engine/lib/UpdatePolicy.js";import{affectsGeometry as Re}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as xe}from"../../webgl-engine/lib/WebGLLayer.js";import{hasPopupTemplate as Pe}from"../../../layers/support/popupUtils.js";import{ImmediateTask as De,noBudget as Ee,TaskPriority as Ie}from"../../../support/Scheduler.js";import{Yield as Ue}from"../../../support/Yield.js";import Ae from"../../../../geometry/Extent.js";import Le from"../../../../geometry/Point.js";import je from"../../../../symbols/LabelSymbol3D.js";import Oe from"../../../../symbols/TextSymbol.js";import Ve from"../../../../symbols/WebStyleSymbol.js";var Fe;const Te=U(),Me=V();let ze=Fe=class extends r{get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new _e({objectIdField:this.owner.layer?.objectIdField,spatialReference:this._viewSpatialReference,hasZ:!!this.hasZ,hasM:!!this.hasM}),this._spatialIndex.setup(Array.from(this.graphics3DGraphics.values()))),this._spatialIndex.update(),this._spatialIndex}get deconflictor(){return this._deconflictor}get labeler(){return this._labeler}get numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return null!=this.currentRenderer&&"dictionary"===this.currentRenderer.type?we.ASYNC:this._forcedUpdatePolicy??this.preferredUpdatePolicy}get featureStore(){return this._featureStore}get initializePromise(){return this._initializePromise}get scaleVisibility(){return this._scaleVisibility}get elevationAlignment(){return this._elevationAlignment}get objectStates(){return this._objectStates}get filterVisibility(){return this._filterVisibility}get updating(){return!!(this.dataUpdating||this._elevationAlignment?.updating||this._scaleVisibility?.updating||this._filterVisibility?.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._frameTaskHandle.updating||this.running)}get dataUpdating(){return!!(this._graphicsWaitingForSymbol.size>0||this._pendingUpdates.size>0||this._spatialIndex?.updating||this._updatingPendingLoadedGraphicsChange||this._dataUpdateQueue.running||this._loadingSymbols>0)}get running(){return this._pendingUpdates.size>0||!!this._spatialIndex?.updating||this._dataUpdateQueue.running||this._updateQueue.running}get suspendedOrOutsideOfView(){return this.owner.suspended||!!this.owner.suspendInfo?.outsideOfView}get updatingRemaining(){return this.updating?this._pendingUpdates.size+.1*(this._spatialIndex?.updatingRemaining||0)+.1*(this._elevationAlignment?.updatingRemaining||0):0}get displayFeatureLimit(){const e=this.owner&&this.owner.view&&this.owner.view.qualitySettings,t=e?.graphics3D.minTotalNumberOfFeatures??0,i=e?.graphics3D.maxTotalNumberOfFeatures??0,r=e?.graphics3D.maxNumberOfDrawCalls??0,s=e?.graphics3D.maxTotalNumberOfVertices??0,a=this.averageSymbolComplexity,n=Math.max(1,a?.verticesPerFeature??1),o=a&&a.drawCallsPerFeature>0&&r>0?r/a.drawCallsPerFeature:i,l=Math.ceil(s/n),h=Math.max(t,Math.min(i,l,o)),d=this._get("displayFeatureLimit");return d&&d.maximumTotalNumberOfVertices===s&&d.averageSymbolComplexity===a&&d.maximumNumberOfFeatures===h?d:new ie(s,h,a)}get averageSymbolComplexity(){const e=ee(this._symbolComplexities),t=this._get("averageSymbolComplexity");return 0===e.numComplexities||null!=t&&(e.estimated&&(t.verticesPerFeature>=e.verticesPerFeature||t.verticesPerCoordinate>=e.verticesPerCoordinate||t.drawCallsPerFeature>=e.drawCallsPerFeature)||t.verticesPerFeature===e.verticesPerFeature&&t.verticesPerCoordinate===e.verticesPerCoordinate&&t.drawCallsPerFeature===e.drawCallsPerFeature)?t:e}get usedMemory(){const e=null!=this.averageSymbolComplexity&&this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel*this._numberOfGraphics:0,t=this._getSymbolComplexitiesUsed().reduce(((e,t)=>e+t.memory.resourceBytes),0);if(null==this._symbolMaterials){this._symbolMaterials=[];for(const e of this._symbols.values())if(null!=e)for(const t of e.symbolLayers)if(t)for(const e of t.materials)e&&this._symbolMaterials.push(e)}const i=this.owner.view._stage.renderer.plugins,r=this.owner.view.basemapTerrain.overlayManager.renderer,s=this._symbolMaterials.reduce(((e,t)=>e+((i.getMaterialRenderer(t)||r.getMaterialRenderer(t))?.usedMemory??0)),0);return this._usedMemory+e+t+s}get usedMemoryPerGraphic(){if(this._usedMemory&&this._numberOfGraphics){const e=this._numberOfGraphics/(this._numberOfGraphics+Math.max(this._pendingAdds,this._pendingRemoves));return this._usedMemory/this._numberOfGraphics*e}if(null!=this.averageSymbolComplexity){const e=this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel:0;return this.averageSymbolComplexity.memory.bytesPerFeature+e}return 0}get unprocessedMemoryEstimate(){return(this._pendingAdds-this._pendingRemoves)*this.usedMemoryPerGraphic}get _symbolComplexities(){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(this.currentRenderer):this._getSymbolComplexitiesUsed()}get visible(){return this._visible}_getConvertedSymbol(e){if("web-style"===e.type)return e.clone();const t=this._symbolConversionCache.get(e.id);if(null!=t)return t;const r=K(e,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(e),cimFallbackEnabled:!0}),s=r.symbol||null;return null==s&&r.error&&i.getLogger(this).error(r.error.message),this._symbolConversionCache.set(e.id,s),s}_getSymbolComplexitiesUsedOrRenderer(e){if(null==e)return[];const t=e.getSymbols(),i="backgroundFillSymbol"in e?e.backgroundFillSymbol:null;if(!i&&!t?.length)return[];const r=[],s=this._getSymbolComplexityUsedOrRenderer(i);null!=s&&r.push(s);for(const a of t){const e=this._getSymbolComplexityUsedOrRenderer(a);null!=e&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(null==e)return null;const t=this._symbols.get(e.id);if(null!=t)return t.complexity;const i=this._getConvertedSymbol(e);return null!=i?te(i):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach((t=>{null!=t&&e.push(t.complexity)})),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new Se({computedExtent:Ae},this),this.computedExtent=null,this.currentRenderer=null,this.rendererHasGeometryOperations=!1,this._graphicStateTracking=null,this.graphics3DGraphics=new Map,this.stageLayer=null,this.stage=null,this._graphicsDrapedUids=new Set,this._graphicsBySymbol=new Map,this._symbolConversionCache=new Map,this._symbols=new Map,this._graphicsWithoutSymbol=new Map,this._graphicsWaitingForSymbol=new Map,this._graphicsUpdateId=0,this._frameTaskHandle=De,this._dataUpdateQueue=new Y,this._updateQueue=new Y,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=null,this._elevationAlignment=null,this._scaleVisibility=null,this._filterVisibility=null,this._spatialIndex=null,this.extentPadding=0,this._updatingPendingLoadedGraphicsChange=null,this._featureStore=null,this._deconflictor=null,this._labeler=null,this._objectStates=null,this._viewElevationProvider=null,this._stageLayerElevationProvider=null,this._sharedSymbolResourcesOwnerHandle=null,this._whenGraphics3DGraphicRequests={},this._pendingUpdates=new Map,this._numberOfGraphics=0,this._numberOfGraphicsProvidingElevation=0,this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this._loadingSymbols=0,this._pendingUpdatesPool=new y({allocator:e=>e||new We,deallocator:e=>(e.clear(),e)}),this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new y,this.preferredUpdatePolicy=we.SYNC,this._forcedUpdatePolicy=null,this.elevationFeatureExpressionEnabled=!0,this.owner=null,this.layer=null,this.graphicSymbolSupported=!0,this.getRenderingInfoWithoutRenderer=!1,this.setUidToIdOnAdd=!0,this.hasZ=null,this.hasM=null,this._usedMemory=0,this._visible=!1,this._startCreateGraphics=!1,this._unusedSymbolsCache=e.owner.view.resourceController.memoryController.newCache("graphics-3d-unused-symbols",(e=>e.destroy())),this.symbolCreationContext=new de(e.owner.view.resourceController.scheduler,((e,t)=>this._updateQueue.push(e,t)))}initialize(){this._featureStore=new le({objectIdField:this.owner.layer?.objectIdField,hasZ:!!this.hasZ,hasM:!!this.hasM,viewSpatialReference:this._viewSpatialReference,featureSpatialReference:this.owner.featureSpatialReference,getSpatialIndex:()=>this.spatialIndex,forEach:e=>this.graphics3DGraphics.forEach(e)});const e=(e,t,i)=>this.spatialIndex.queryGraphicUIDsInExtent(e,t,i),{componentFactories:t}=this;this._elevationAlignment=t.elevationAlignment?.(this,e),this._scaleVisibility=t.scaleVisibility?.(this,e),this._filterVisibility=t.filterVisibility?.({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities((t=>t.setVisibilityFlag(se.GRAPHIC,ae.FILTER,e(H(t.graphic,this._objectIdField))))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities((t=>t.setVisibilityFlag(se.GRAPHIC,ae.FILTER,e))),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(se.GRAPHIC,ae.FILTER,!0)))}),this._deconflictor=t.deconflictor?.(this),this._labeler=t.labeler?.(this,this._scaleVisibility),this._objectStates=t.objectStates?.(this),this._initializeAbortController=new AbortController,this._initializePromise=this._initializeAsync()}async _initializeAsync(){const e=this._initializeAbortController?.signal,t=this.owner.view;this._viewElevationProvider=new re(this._viewSpatialReference,t),this._initializeStage(t,this.layer.uid);const r=t.sharedSymbolResources;this.symbolCreationContext.sharedResources=r,this._sharedSymbolResourcesOwnerHandle=r.addGraphicsOwner(this.owner),null!=this.currentRenderer&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.streamDataRequester=r.streamDataRequester,this.symbolCreationContext.renderCoordsHelper=t.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new Ge(t.renderSpatialReference),this.symbolCreationContext.elevationProvider=t.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const s=ne(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await oe(s,this._viewSpatialReference,e,i.getLogger(this)),g(e),this.symbolCreationContext.screenSizePerspectiveEnabled=t.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this.symbolCreationContext.physicalBasedRenderingEnabled=!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled,this.symbolCreationContext.skipHighSymbolLods=!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods,"drapeSourceType"in this.owner){const{owner:e}=this;this.symbolCreationContext.drapeSourceRenderer=t.basemapTerrain.overlayManager.registerGeometryDrapeSource(e),this.addHandles(n((()=>t.basemapTerrain.overlayManager.unregisterDrapeSource(e))))}this.addHandles([_((()=>this.suspendedOrOutsideOfView),(()=>this._updateQueue.unshift((()=>this._updateLayerVisibility()),null).catch(b))),_((()=>[this.layer?.screenSizePerspectiveEnabled,this.owner.view?.screenSizePerspectiveEnabled]),(()=>{const e=t.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled;e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._labeler?.reset(),this.recreateAllGraphicsAndSymbols())})),_((()=>this.owner.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(!!e))),_((()=>this.owner.view.state?.rasterPixelRatio),(()=>this._pixelRatioChange())),_((()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._physicalBasedRenderingChange(e))),_((()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods),(e=>this._skipHighSymbolLoDsChange(e))),f((()=>t.basemapTerrain?.tilingScheme),(e=>{if(e.spatialReference.equals(this.symbolCreationContext.overlaySR)||null==t.basemapTerrain.spatialReference||(this.symbolCreationContext.overlaySR=t.basemapTerrain.spatialReference),this.hasHandles("loaded-graphics"))this.recreateAllGraphics();else{const e=()=>this.owner?.loadedGraphics;this.addHandles([v(e,"change",(e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}),{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}}),{initial:!0}),_((()=>this.effectiveUpdatePolicy),(e=>{null!=this.stageLayer&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===we.ASYNC,e===we.SYNC&&this.runTask(Ee)}),C)]),this._frameTaskHandle=t.resourceController.scheduler.registerTask(Ie.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this.addHandles(_((()=>this.layer.featureReduction),(()=>this._deconflictor?.featureReductionChange()))),this.notifyChange("averageSymbolComplexity"),this.rendererChange(this.owner.renderer).catch((()=>{})),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController&&(this._initializeAbortController.abort(),this._initializeAbortController=null)}destroy(){this._unusedSymbolsCache.destroy(),this._abortInitialize(),this._abortRendererChange(),this._abortElevationInfoChange(),this._frameTaskHandle.remove(),this._frameTaskHandle=De,this._dataUpdateQueue.cancelAll(),this._updateQueue.cancelAll(),this._deconflictor=h(this._deconflictor),this._labeler=h(this._labeler),this._elevationAlignment=d(this._elevationAlignment),this._scaleVisibility=d(this._scaleVisibility),this._filterVisibility=d(this._filterVisibility),this._objectStates=d(this._objectStates),this.clear(),this._featureStore=d(this._featureStore),this._updatingPendingLoadedGraphicsChange=h(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=d(this._graphicStateTracking),this.stage&&(this.stageLayer=d(this.stageLayer),this.stage=null),this._set("owner",null);for(const e in this._whenGraphics3DGraphicRequests)this._whenGraphics3DGraphicRequests[e].reject(new a("graphic:layer-destroyed","Layer has been destroyed"));this._whenGraphics3DGraphicRequests=null,this._sharedSymbolResourcesOwnerHandle=h(this._sharedSymbolResourcesOwnerHandle),this._propertiesPool=d(this._propertiesPool),this._pendingUpdatesPool=null,this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=d(this._spatialIndex)}clear(){this._objectStates?.allGraphicsDeleted(),null!=this._graphicStateTracking&&this._graphicStateTracking.allGraphicsDeleted(),this.graphics3DGraphics.forEach((e=>e.destroy())),this._spatialIndex?.clear(),this.graphics3DGraphics.clear(),this._numberOfGraphics=0,this._usedMemory=0,this._updateLayerVisibility(),this._symbols.forEach(d),this._symbols.clear(),this._symbolMaterials=null,this._graphicsBySymbol.clear(),this._graphicsWithoutSymbol.clear(),this._graphicsWaitingForSymbol.clear(),this._pendingUpdates.clear(),this._pendingUpdatesPool.clear(),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this.notifyChange("dataUpdating"),this.notifyChange("running"),this.notifyChange("updatingRemaining"),this._featureStore.events.emit("changed")}_initializeStage(e,t){this.stage=e._stage,this.stageLayer=new xe(this.stage,{pickable:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},t);const i=this.stageLayer.events;i.on("transformationChanged",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),i.on("shaderTransformationChanged",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),i.on("visibilityChanged",(e=>this.notifyGraphicVisibilityChanged(e.graphicUid))),i.on("geometryAdded",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),i.on("geometryRemoved",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),i.on("attributesChanged",(e=>Re(e.attribute)&&this.notifyGraphicGeometryChanged(e.object.graphicUid)))}notifyGraphicGeometryChanged(e){if(null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicGeometry(t)}notifyGraphicVisibilityChanged(e){if(null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicVisibility(t)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,t=this._numberOfGraphics>e*He,i=!this.suspendedOrOutsideOfView&&!t;i!==this._visible&&(this._visible=i,i?(this.stageLayer.pickable=!0,this.updateAllGraphicsVisibility()):(this.stageLayer.pickable=!1,this._hideAllGraphics()),this._updateStageLayerVisibility())}_updateStageLayerVisibility(){this.stageLayer.visible=this._visible&&(null==this.layer.opacity||this.layer.opacity>0)}getGraphics3DGraphicById(e){return null!=e?this.graphics3DGraphics.get(e):void 0}getGraphics3DGraphicByObjectId(e){return this.owner.layer?.objectIdField?this._findGraphics3DGraphicByObjectId(e):null}_getGraphicObjectID(e,t=this.owner.layer?.objectIdField){return H(e,t)}get graphics3DGraphicsByObjectID(){const e=this.owner.layer?.objectIdField;if(!e)return;const t=new Map;return this.graphics3DGraphics.forEach((i=>{if(!i)return;const r=i.graphic,s=this._getGraphicObjectID(r,e);null!=s&&t.set(s,i)})),t}get labelsEnabled(){return!!this._labeler?.layerLabelsEnabled()}async updateLabelingInfo(e){const t=this._deconflictor?.labelingInfoChange(e),i=this._labeler?.labelingInfoChange(e);await Promise.allSettled([t,i])}updateVisibilityInfo(){this._deconflictor?.labelingInfoChange(),this._labeler?.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let e=0,t=0;return o(this._symbols,((i,r)=>{if(null!=i){const s=i.getFastUpdateStatus();if(s.loading>0)return!0;this._graphicsBySymbol.has(r)&&(t+=s.fast,e+=s.slow)}return!1}))?"unknown":t>=0&&0===e?"fast":e>=0&&0===t?"slow":"mixed"}runTask(e){if(this._dataUpdateQueue.runTask(e),this._updateQueue.runTask(e),this._applyPendingUpdates(e),this.notifyChange("running"),this.running||this.notifyChange("dataUpdating"),this.notifyChange("updatingRemaining"),!e.hasProgressed)return Ue}setObjectIdVisibility(e,t){t?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const i=this._findGraphics3DGraphicByObjectId(e);null!=i&&this._updateUserVisibility(i)}_findGraphics3DGraphicByObjectId(e){return l(this.graphics3DGraphics,(t=>this._getGraphicObjectID(t.graphic)===e))}_updateUserVisibility(e){if(null==e)return!1;const t=e.graphic,i=this._getGraphicObjectID(t),r=t.visible&&!this.owner.suspended&&(null==i||!this._objectIdInvisibleSet.has(i));return e.setVisibilityFlag(se.GRAPHIC,ae.USER,r)}_whenGraphics3DGraphic(e){const t=this.graphics3DGraphics.get(e.uid);if(t)return Promise.resolve(t);const i=this._whenGraphics3DGraphicRequests[e.uid];if(i)return i.promise;const r=u();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,t){const i=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,s=this.owner.view.basemapTerrain.spatialReference,a=(e,t,s)=>L(e,r,t,e,i,t,s),n=(e,t,r)=>L(e,s,t,e,i,t,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:null!=t&&!!t.useViewElevation,minDemResolution:null!=t?t.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,t?.signal);if(!l)return null;const h=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){F(h,Te);const t=e.getElevation(Te[0],Te[1],0,i,"ground")??0;h[2]=Math.min(h[2],t),h[5]=Math.max(h[5],t)}}return{boundingBox:h,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,t){await S((()=>this.owner?.loadedGraphics));const i=this.owner.layer?.objectIdField,r=this.owner.loadedGraphics.find((t=>t===e||null!=i&&null!=t.attributes&&e.attributes&&t.attributes[i]===e.attributes[i]));if(!r)throw new a("internal:graphic-not-part-of-view","Graphic is not part of this view");const s=await this._whenGraphics3DGraphic(r);return this._boundsForGraphics3DGraphic(s,t)}computeAttachmentOrigin(e,t){const i=this.graphics3DGraphics.get(e.uid);if(!i)return null;const r=i.computeAttachmentOrigin();if(0===r.render.num&&0===r.draped.num)return null;D(Ne,0,0,0);let s=0;if(r.render.num>0){if(!j(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,Be,t))return null;E(Ne,Ne,Be),s++}if(r.draped.num>0){const[e,i]=r.draped.origin,a=this._viewElevationProvider.getElevation(e,i,"ground")??0;if(D(Be,e,i,a),!j(Be,this._viewElevationProvider.spatialReference,Be,t))return null;E(Ne,Ne,Be),s++}return s>1&&I(Ne,Ne,1/s),new Le({x:Ne[0],y:Ne[1],z:Ne[2],spatialReference:t})}getSymbolLayerSize(e,t){const i=this._symbols.get(e.id);if(null==i)throw new a("internal:symbol-not-part-of-view","Symbol is not part of this view");const r=e.symbolLayers.indexOf(t);if(-1===r)throw new a("internal:missing-symbol-layer","Symbol layer is not in symbol");const s=i.getSymbolLayerSize(r);if(null==s)throw new a("internal:missing-size","Symbol layer has no valid size");return s}_graphicsCollectionChanged(e){this._startCreateGraphics&&(this.add(e.added),this.remove(e.removed))}graphicUpdateHandler(e){const t=e.graphic.uid,i=this.graphics3DGraphics.get(t);if(null!=i||null!=this._graphicsWithoutSymbol.get(t))switch(e.property){case"visible":this._graphicUpdateVisibleHandler(i);break;case"geometry":this._graphicUpdateGeometryHandler(i,e);break;case"symbol":this._graphicUpdateSymbolHandler(i,e);break;case"attributes":break;case"origin-transform":this._graphicUpdateTransformHandler(i,e)}}_graphicUpdateGeometryHandler(e,t){this._graphicUpdateGeometryOrTransformHandler(e,t,(()=>!(null==t.newValue||null==e||!e.graphics3DSymbol.updateGeometry(e,t.newValue)||!(this._labeler?.updateGraphicGeometry(e)??1))&&(this._labeler?.setDirty(),!0)));const i=t.graphic.geometry;null!=i&&this._expandComputedExtent(i)}_graphicUpdateTransformHandler(e,t){const i=t.graphic.geometry;this._graphicUpdateGeometryOrTransformHandler(e,t,(()=>null!=t.newValue&&null!=e&&null!=i&&e.graphics3DSymbol.updateTransform(e,i.spatialReference,t.newValue,t.action)))}_graphicUpdateGeometryOrTransformHandler(e,t,i){if(null!=t.graphic.geometry)if(null!=e)i()||this._recreateGraphic(e.graphic);else{const e=t.graphic.symbol?.id;if(e){const t=this._symbols.get(e);if(null!=t&&t.loadStatus===be.LOADING)return}this._recreateGraphic(t.graphic)}else this._recreateGraphic(t.graphic)}_graphicUpdateSymbolHandler(e,t){const i=t.graphic,r=null!=e?e.graphics3DSymbol:null!=t.oldValue?this._symbols.get(t.oldValue.id):null;if(null==r||null==t.newValue)return void this._recreateGraphic(i);const s=r.symbol,a=this._getConvertedSymbol(t.newValue);if(null!=a&&(a.type!==s.type||"web-style"===a.type)||"web-style"===s.type)return void this._recreateGraphic(i);const n=this._graphicsBySymbol.get(s.id);if(n&&1!==n.size)return void this._recreateGraphic(i);const o=x(s,a);if(null==o)return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!P(l.diff))return void this._recreateGraphic(i);const h=this._getRenderingInfo(i);if(null==h)return void this._recreateGraphic(i);const d=r.extentPadding;for(const p of l.symbolStatePatches)p();if(d!==r.extentPadding&&this._recomputeExtentPadding(),null!=e)for(const p of l.graphics3DGraphicPatches)p(e,h);this._updateSymbolMapping(s.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,this.effectiveUpdatePolicy===we.SYNC&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){const t=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,t),1===this._graphicsWaitingForSymbol.size&&this.notifyChange("dataUpdating"),t}_endGraphicUpdate(e){e&&(this._graphicsWaitingForSymbol.delete(e.uid),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("dataUpdating")))}_recomputeExtentPadding(){let e=0;this._symbols.forEach((t=>{null!=t&&(e=Math.max(e,t.extentPadding))})),this._set("extentPadding",e)}_expandComputedExtent(e){const t=Me,i=e.spatialReference;N(e,t);const r=this._viewSpatialReference,s=Fe.tmpVec;if(k(i,r)||O(t[0],t[1],0,i,s,r)&&(t[0]=s[0],t[1]=s[1],O(t[3],t[4],0,i,s,r),t[3]=s[0],t[4]=s[1]),!(isFinite(t[0])&&isFinite(t[3])&&isFinite(t[1])&&isFinite(t[4])))return;const a=this.computedExtent;let n=null;const o=isFinite(t[2])&&isFinite(t[5]),l=o&&(null==a?.zmin||t[2]<a.zmin),h=o&&(null==a?.zmax||t[5]>a.zmax);if(a){(t[0]<a.xmin||t[1]<a.ymin||t[3]>a.xmax||t[4]>a.ymax||l||h)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(t[0],a.xmin),n.ymin=Math.min(t[1],a.ymin),n.xmax=Math.max(t[3],a.xmax),n.ymax=Math.max(t[4],a.ymax),n.spatialReference=r)}else n=this._propertiesPool.get("computedExtent"),n.xmin=t[0],n.ymin=t[1],n.xmax=t[3],n.ymax=t[4],n.spatialReference=r;n&&(l&&(n.zmin=t[2]),h&&(n.zmax=t[5]),this._set("computedExtent",n))}_abortElevationInfoChange(){this._elevationInfoChangeAbortController&&(this._elevationInfoChangeAbortController.abort(),this._elevationInfoChangeAbortController=null)}async elevationInfoChange(){this._abortElevationInfoChange();const e=new AbortController;this._elevationInfoChangeAbortController=e;const t=ne(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await oe(t,this._viewSpatialReference,e.signal,i.getLogger(this)),g(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("elevationInfo",t)?t.forEach((e=>{const t=e.graphic,i=e.labelLayers;for(const r of i){r.graphics3DSymbolLayer.updateGraphicElevationContext(t,r)}})):this._recreateSymbol(i)})),this.updateStageLayerElevationProvider(),this._elevationAlignment?.elevationInfoChange()}updateStageLayerElevationProvider(){this._stageLayerElevationProvider?(this.layer.elevationInfo&&"relative-to-scene"===this.layer.elevationInfo.mode||0===this._numberOfGraphicsProvidingElevation)&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=p(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new ve({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register("scene",this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),null!=this._filterVisibility&&this._filterVisibility.clear(),this._labeler?.reset(),this._deconflictor?.clear(),this._elevationAlignment?.clear(),this.stageLayer?.invalidateSpatialQueryAccelerator(),this._stageLayerElevationProvider&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=p(this._stageLayerElevationProvider))}startCreateGraphics(){this._startCreateGraphics=!0,this.recreateAllGraphics()}recreateAllGraphics(){this._recreateAllGraphics(!1)}recreateAllGraphicsAndSymbols(){this._recreateAllGraphics(!0)}_recreateAllGraphics(e=!1){if(!this._startCreateGraphics)return;const{loadedGraphics:t,view:i}=this.owner,r=i.basemapTerrain.tilingScheme&&t?.length?t.toArray():null;!e&&r||this._clearSymbolsAndGraphics(),this.symbolCreationContext.screenSizePerspectiveEnabled=this.owner.view.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this._set("computedExtent",null),r&&(e?this.add(r):this.recreateGraphics(r))}_recreateSymbol(e){const t=this._graphicsBySymbol.get(e),i=[];t&&(t.forEach(((e,t)=>{const r=e.usedMemory;this._conditionalRemove(e,t),this._spatialIndex?.remove(e),i.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(t,r),this._updateLayerVisibility(),this._featureStore.events.emit("changed")})),this._graphicsBySymbol.set(e,new Map));const r=this._symbols.get(e);d(r),this._symbols.delete(e),this._symbolMaterials=null,this.add(i)}_recreateGraphicsForSymbol(e){const t=this._graphicsBySymbol.get(e);if(t){const e=[];t.forEach((t=>e.push(t.graphic))),this.recreateGraphics(e)}}_conditionalRemove(e,t){this._graphicsDrapedUids.delete(t),this._objectStates?.removeGraphic(e),this._labeler?.removeGraphic(e),this._deconflictor?.removeGraphic(e),null!=this._graphicStateTracking&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain?.tilingScheme?(this._updatePolicyForGraphics(e)===we.ASYNC?this._addDelayed(e):this._addImmediate(e),this.notifyChange("dataUpdating")):i.getLogger(this).error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===we.SYNC&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const t of e)if(null!=t.geometry&&"mesh"===t.geometry.type&&!t.geometry.loaded)return we.ASYNC;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const t of e)this._addGraphic(t,this._getRenderingInfo(t,i.getLogger(this)),we.SYNC);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_addDelayed(e){for(const t of e){const e=t.uid;let i=this._pendingUpdates.get(e);i?i.add?i.state!==ke.NEW&&i.abortController?.abort():this._pendingAdds++:(i=this._pendingUpdatesPool.pushNew(),this._pendingAdds++,this._pendingUpdates.set(e,i)),i.add=t}this.notifyChange("running"),this.notifyChange("updatingRemaining"),this.notifyChange("dataUpdating")}remove(e){this.effectiveUpdatePolicy===we.ASYNC?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange("dataUpdating")}_removeImmediate(e){for(const t of e)this._removeGraphic(t);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_removeDelayed(e){for(const t of e){const e=t.uid,i=this._pendingUpdates.get(e);if(i)i.add&&(i.remove?i.add=null:this._pendingUpdates.delete(e),i.state===ke.LOADING&&i.abortController?.abort(),this._pendingAdds--);else{const i=this._pendingUpdatesPool.pushNew();i.remove=t,this._pendingUpdates.set(e,i),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}0===this._pendingUpdates.size&&this._finishPendingUpdates(),this.notifyChange("running"),this.notifyChange("updatingRemaining"),this.notifyChange("dataUpdating")}_finishPendingUpdates(){this._pendingUpdatesPool.clear(),this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&i.getLogger(this).warn("pendingAdds/Removes in inconsistent state!"),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1}_applyPendingUpdates(e){if(this._geometryWarningLogged=!1,this._symbolWarningLogged=!1,0===this._pendingUpdates.size&&this._spatialIndex?.updating)return this._spatialIndex.update(),void e.madeProgress();if(this._applyPendingRemovesFirst){this._applyPendingRemovesFirst=!1;for(const[t,i]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(i.remove&&!i.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,this._pendingUpdates.delete(t),0===this._pendingRemoves))break}}for(const[t,i]of this._pendingUpdates){if(e.done)break;i.add&&i.state===ke.NEW&&this._processPendingUpdateNew(i);let r=this.effectiveUpdatePolicy;if(!i.remove||i.add&&i.state!==ke.READY||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,r=we.SYNC),i.add)switch(i.state){case ke.READY:this._addGraphic(i.add,i.renderingInfo,r),i.add=null,this._pendingAdds--,e.madeProgress();break;case ke.REJECTED:i.add=null,this._pendingAdds--;case ke.LOADING:}null==i.remove&&null==i.add&&this._pendingUpdates.delete(t)}0===this._pendingUpdates.size&&(this._finishPendingUpdates(),this.notifyChange("running"),this.notifyChange("dataUpdating"))}_processPendingUpdateNew(e){if(!e.add)return void(e.state=ke.READY);const t=e.add.geometry;null==t||"mesh"!==t.type||t.loaded?this._processPendingUpdateNewRenderingInfo(e):this._processPendingUpdateNewMesh(e,t)}async _processPendingUpdateNewMesh(e,t){e.state=ke.LOADING,e.abortController=new AbortController;const i=e.abortController.signal;try{await t.load({signal:i})}catch(r){return this._processPendingUpdateNewError(e,r)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,t){e.abortController=null,m(t)?e.state=ke.NEW:e.state=ke.REJECTED}async _processPendingUpdateNewRenderingInfo(e){if(null==this.layer.renderer||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add,i.getLogger(this)),void(e.state=ke.READY);e.state=ke.LOADING,e.abortController=new AbortController;let t=null;try{t=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(r){return e.abortController=null,void(m(r)?e.state=ke.NEW:e.state=ke.REJECTED)}null==t?.symbol?(this._symbolWarningLogged||(this._symbolWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=t,e.state=ke.READY}_addGraphic(e,t,i){if(this._graphicsWithoutSymbol.set(e.uid,e),null==t?.symbol||!B(e))return;if(null!=this.stage.renderView.objectAndLayerIdRenderHelper&&this.setUidToIdOnAdd){const t=J(this.owner.view.map,this.layer.uid);this.stage.renderView.objectAndLayerIdRenderHelper.setUidToObjectAndLayerId(e.objectId,e.uid,this.layer.id,this.layer.uid,!!this.layer.popupEnabled&&!t&&Pe(this.layer,this.owner.view.popup?.defaultPopupTemplateEnabled))}const r=t.symbol,s=this.getOrCreateGraphics3DSymbol(r,t.renderer);if(null==s)return;this._expandComputedExtent(e.geometry);const a=this._beginGraphicUpdate(e),n=new he(e,t,this.layer);let o=!1;const l=e=>{e===s.symbol.id&&(o=!0)};this._whenSymbolRemoved.push(l);const h=()=>{if(--this._loadingSymbols,this.destroyed)return;this._whenSymbolRemoved.removeUnordered(l);if(this._graphicsWaitingForSymbol.get(e.uid)!==a||o||s.destroyed||this.graphicSymbolSupported&&e.symbol&&e.symbol.id!==s.symbol.id)--s.referenced,this._cleanupSymbols();else{const t=this._createGraphics3DGraphic(s,n);this._spatialIndex&&null!=t&&this._spatialIndex.add(t),--s.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this._labeler?.setDirty()},d=t=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),o||(m(t)?this.add([e]):s.destroyed||this._endGraphicUpdate(e)))};++this._loadingSymbols,i===we.ASYNC?s.load((()=>this._dataUpdateQueue.push(h,null).catch(b)),(e=>this._dataUpdateQueue.push((()=>d(e)),null).catch(b))):s.load(h,d)}_removeGraphic(e){const t=e.uid,i=this.graphics3DGraphics.get(t);if(i){i.graphics3DSymbol.onRemoveGraphic(i);const e=i.usedMemory,r=i.isElevationSource;this._conditionalRemove(i,t),this._spatialIndex?.remove(i);const s=i.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(s)?.delete(t),this._graphicsWithoutSymbol.delete(t),this._removeGraphics3DGraphic(t,e,r),i.destroy(),this._featureStore.events.emit("changed")}else this._graphicsWithoutSymbol.delete(t),this._graphicsWaitingForSymbol.delete(t),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("dataUpdating"))}_hasLabelingContext(e){if(e instanceof je||e instanceof Oe){const t=this.symbolCreationContext.layer;return!!t.labelingInfo&&t.labelingInfo.some((t=>t.symbol===e))}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof je&&!this._hasLabelingContext(e))||(i.getLogger(this).error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(e,t){const i=e.geometry;if(null==i)return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,t.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!A(i.spatialReference,this._viewSpatialReference))return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,t.warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,t.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?q(e,this.layer):e;let s;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||null!=this.currentRenderer))s=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{s={symbol:r.symbol||X(r.geometry)}}return null==s?.symbol?(t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,t.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):s}_getRenderingInfoAsync(e,t){if(null==e.geometry)return this._geometryWarningLogged||(this._geometryWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return this._symbolWarningLogged||(this._symbolWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?q(e,this.layer):e;return this.owner.getRenderingInfoAsync(r,this.currentRenderer,this._arcadeOnDemand,t)}_createGraphics3DSymbol(e,t){if(!this._hasValidSymbolCreationContext(e))return null;const i=this._getConvertedSymbol(e);if(!i)return null;let r;if(null!=t&&"backgroundFillSymbol"in t&&t.backgroundFillSymbol){const e=K(t.backgroundFillSymbol,{ignoreDrivers:!0});null!=e.symbol&&(r=e.symbol.symbolLayers)}const s=pe(i,this.symbolCreationContext,r);return s.load((()=>{const e=s.extentPadding;e>this.extentPadding&&this._set("extentPadding",e),this.notifyChange("averageSymbolComplexity")}),(()=>{})),s}getOrCreateGraphics3DSymbol(e,t){let i=this._symbols.get(e.id);if(void 0===i){const r=this._unusedSymbolsCache.pop(e.id);i=null!=r?r:e instanceof Ve?new ce(e,(e=>this._dataUpdateQueue.push(e,null)),(e=>this._createGraphics3DSymbol(e,t))):this._createGraphics3DSymbol(e,t),this._symbols.set(e.id,i),this._symbolMaterials=null}return null!=i&&++i.referenced,i}trackGraphicState(e){return null==this._graphicStateTracking&&(this._graphicStateTracking=new ge(this)),this._graphicStateTracking.add(e)}_addGraphics3DGraphic(e){this._usedMemory+=e.usedMemory,this.graphics3DGraphics.set(e.graphic.uid,e),this._numberOfGraphics++,e.isElevationSource&&(this._numberOfGraphicsProvidingElevation++,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_removeGraphics3DGraphic(e,t,i=!1){this._usedMemory-=t,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,i&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,t){const i=t.graphic;if(this._graphicsWithoutSymbol.delete(i.uid),!this._symbols.has(e.symbol.id))return this.add([i]),null;if(this.graphics3DGraphics.has(i.uid))return null;const r=e.createGraphics3DGraphic(t);if(null==r)return null;this._addGraphics3DGraphic(r);const s=e.symbol.id;this._graphicsBySymbol.has(s)||this._graphicsBySymbol.set(s,new Map),this._graphicsBySymbol.get(s).set(i.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(i.uid),r.centroid=null,null!=i.geometry&&"point"!==i.geometry.type&&(r.centroid=ue(i.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(r),null!=this._filterVisibility){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(se.GRAPHIC,ae.FILTER,e),e||this._filterVisibility.reapply()}this._deconflictor?.addGraphic(r),this._labeler?.addGraphic(r),this._objectStates?.addGraphic(r),r.initialize(this.stageLayer,this.owner),null!=this._graphicStateTracking&&this._graphicStateTracking.addGraphic(r);const a=this._whenGraphics3DGraphicRequests[i.uid];return a&&(delete this._whenGraphics3DGraphicRequests[i.uid],a.resolve(r)),r}_abortRendererChange(){this._rendererChangeAbortController&&(this._rendererChangeAbortController.abort(),this._rendererChangeAbortController=null)}async rendererChange(e){if(this._abortRendererChange(),e!==this.currentRenderer)if(this._validateRenderer(e),null==e&&this._currentRendererChange(null,!1),Q(e))if(e?.arcadeRequired){const t=new AbortController;this._rendererChangeAbortController=t;const{arcadeUtils:i}=await this._ensureArcade();g(t);const r=i.hasGeometryOperations(e);r&&(await i.enableGeometryOperations(),g(t)),this.effectiveUpdatePolicy===we.ASYNC?await this._updateQueue.push((()=>this._currentRendererChange(e,r)),t.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===we.ASYNC){const t=new AbortController;this._rendererChangeAbortController=t,await this._updateQueue.push((()=>this._currentRendererChange(e,!1)),t.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1);else this._currentRendererChange(e,!1)}async _ensureArcade(){return null==this._arcadeOnDemand?(this._arcadeOnDemand=await Z(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,t){this.currentRenderer=e,this.rendererHasGeometryOperations=t,this.symbolCreationContext.arcade=this._arcadeOnDemand;const i=this.symbolCreationContext.renderer;if(e===i)return;if(this._symbolConversionCache.clear(),this._unusedSymbolsCache.clear(),null==e)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=x(i,e);this._updateUnchangedSymbolMappings(r,e,i),this.symbolCreationContext.renderer=e,null!=r&&("complete"===r.type?this.recreateAllGraphicsAndSymbols():"partial"===r.type&&(this._applyRendererDiff(r,e,i)?this._labeler?.reset():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(e){for(const t in e.diff)switch(t){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete e.diff[t];break;default:return!0}return!1}_applySymbolSetDiff(e,t,i){e=e||[],t=t||[];const r=[];for(const s of t){const t=this._graphicsBySymbol.get(s.id);t&&t.forEach(((a,n)=>{const o=a.graphic,l=this.layer instanceof W?this.layer:null,h=this._arcadeOnDemand;if(s===i.defaultSymbol&&i.getSymbol(q(o,l),{arcade:h})===i.defaultSymbol)return;const d=a.usedMemory;e.length||i.defaultSymbol?r.push(o):this._graphicsWithoutSymbol.set(n,o);const p=this.graphics3DGraphics.get(n);this._conditionalRemove(p,n),a.destroy(),t.delete(n),this._removeGraphics3DGraphic(n,d),this._updateLayerVisibility()})),this._whenSymbolRemoved.forAll((e=>e(s.id)))}(e.length||r.length)&&(this._graphicsWithoutSymbol.forEach((e=>r.push(e))),this._graphicsWithoutSymbol.clear(),this.add(r)),this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_applyUniqueValueRendererDiff(e,t,i){const r=e.diff.defaultSymbol,a=e.diff.uniqueValueInfos;if(r||a){const n=a?a.added.map((e=>e.symbol)).filter(s):[],o=a?a.removed.map((e=>e.symbol)).filter(s):[];if(a)for(let e=0;e<a.changed.length;e++)n.push(a.changed[e].newValue.symbol),o.push(a.changed[e].oldValue.symbol);return r?(i.defaultSymbol&&o.push(i.defaultSymbol),t.defaultSymbol&&n.push(t.defaultSymbol)):i.defaultSymbol&&n.length&&o.push(t.defaultSymbol),this._applySymbolSetDiff(n,o,t),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,t,i){if("unique-value"!==t?.type||"unique-value"!==i?.type||null!=e&&"partial"!==e.type)return[];const r=e=>null!=e?e.id:null,s=e&&e.diff,a=s?.defaultSymbol,n=s&&s.uniqueValueInfos;let o;if(n)o=n.unchanged.map((e=>({oldId:r(e.oldValue.symbol),newId:r(e.newValue.symbol)})));else{o=[];for(const e of i.uniqueValueInfos??[]){const i=r(e.symbol),s=t.uniqueValueInfos?.find((t=>t.value===e.value));s&&i!==r(s.symbol)&&o.push({oldId:i,newId:r(s.symbol)})}}return!a&&i.defaultSymbol&&o.push({oldId:r(i.defaultSymbol),newId:r(t.defaultSymbol)}),o}_updateSymbolMapping(e,t){const i=null!=t&&t?"string"==typeof t?t:t.id:null;if(null==e||e===i)return;const r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),void 0!==r&&this._graphicsBySymbol.set(i,r);const s=this._symbols.get(e);if(void 0!==s&&(this._symbols.delete(e),this._symbols.set(i,s),this._symbolMaterials=null,null!=s)){const e="string"==typeof t?null:t;null!=e?s.symbol=e:s.symbol.id=i}}_updateUnchangedSymbolMappings(e,t,i){const r=this._calculateUnchangedSymbolMapping(e,t,i);for(const{oldId:s,newId:a}of r)this._updateSymbolMapping(s,a)}_applyRendererDiff(e,i,r){if(this._diffHasSymbolChange(e))return!1;if(i instanceof t&&r instanceof t&&this._applyUniqueValueRendererDiff(e,i,r)&&0===Object.keys(e.diff).length)return!0;for(const[t]of this._graphicsBySymbol){const r=this._symbols.get(t);if(null!=r)switch(r.applyRendererDiff(e,i)){case me.RecreateSymbol:this._recreateSymbol(t);break;case me.RecreateGraphics:this._recreateGraphicsForSymbol(t);case me.FastUpdate:}}return!0}opacityChange(){this.forEachGraphics3DSymbol(((e,t)=>e.globalPropertyChanged("opacity",t))),this._updateStageLayerVisibility()}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol(((e,t)=>e.globalPropertyChanged("slicePlaneEnabled",t))),this._deconflictor?.slicePlaneEnabledChange(),this._labeler?.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",t)||this._recreateSymbol(i)}))}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("skipHighSymbolLods",t)||this._recreateSymbol(i)}))}_pixelRatioChange(){this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("pixelRatio",t)||this._recreateSymbol(i)}))}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=G((()=>{this._updatingPendingLoadedGraphicsChange=null}))}setClippingExtent(e,t){const i=this.symbolCreationContext.clippingExtent,r=z();return Ce(e,r,t)?this.symbolCreationContext.clippingExtent=T(V(),r):this.symbolCreationContext.clippingExtent=null,!M(this.symbolCreationContext.clippingExtent,i)}modifyGraphics3DGraphicVisibilities(e){if(this.destroyed)return;let t=!1;this.graphics3DGraphics.forEach((i=>{e(i)&&(t=!0)})),t&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}forEachGraphics3DSymbol(e){for(const[t,i]of this._symbols){if(null==i)return;e(i,this._graphicsBySymbol.get(t)||qe,t)}}updateAllGraphicsVisibility(){null!=this._filterVisibility&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities((e=>{const t=this._updateUserVisibility(e),i=null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(e);return t||i}))}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(se.GRAPHIC,ae.USER,!1)))}_validateRenderer(e){const t=()=>`'${this.layer.title?`${this.layer.title}, `:""}id:${this.layer.id}'`,r=$(e,{geometryType:this.layer?.geometryType,logWarning:e=>i.getLogger(this).warn(`Symbology conversion for layer ${t()}: ${e}`)});if(r){const e=`Renderer for layer ${t} is not supported in a SceneView`;i.getLogger(this).warn(e,r.message)}}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach(((t,i)=>{if(null==t||t.referenced>0)return;const r=this._graphicsBySymbol.get(i);r&&0!==r.size||(this._graphicsBySymbol.delete(i),this._symbols.delete(i),this._symbolMaterials=null,this._unusedSymbolsCache.put(i,t,fe(t),c),e=!0)})),e&&(this._recomputeExtentPadding(),this.notifyChange("averageSymbolComplexity"))}get test(){}get performanceInfo(){return new ye(this.graphics3DGraphics.size,this._graphicsWithoutSymbol.size,this._pendingUpdates.size)}};var ke;ze.tmpVec=U(),e([w({readOnly:!0})],ze.prototype,"computedExtent",void 0),e([w()],ze.prototype,"currentRenderer",void 0),e([w()],ze.prototype,"rendererHasGeometryOperations",void 0),e([w()],ze.prototype,"_frameTaskHandle",void 0),e([w()],ze.prototype,"_dataUpdateQueue",void 0),e([w()],ze.prototype,"_updateQueue",void 0),e([w({readOnly:!0})],ze.prototype,"_viewSpatialReference",null),e([w()],ze.prototype,"_rendererChangeAbortController",void 0),e([w()],ze.prototype,"_elevationInfoChangeAbortController",void 0),e([w()],ze.prototype,"_initializeAbortController",void 0),e([w()],ze.prototype,"_elevationAlignment",void 0),e([w()],ze.prototype,"_scaleVisibility",void 0),e([w()],ze.prototype,"_filterVisibility",void 0),e([w()],ze.prototype,"_initializePromise",void 0),e([w()],ze.prototype,"_spatialIndex",void 0),e([w({readOnly:!0})],ze.prototype,"extentPadding",void 0),e([w()],ze.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([w()],ze.prototype,"_featureStore",void 0),e([w()],ze.prototype,"_objectStates",void 0),e([w()],ze.prototype,"_loadingSymbols",void 0),e([w()],ze.prototype,"preferredUpdatePolicy",void 0),e([w()],ze.prototype,"_forcedUpdatePolicy",void 0),e([w({readOnly:!0})],ze.prototype,"effectiveUpdatePolicy",null),e([w({constructOnly:!0})],ze.prototype,"elevationFeatureExpressionEnabled",void 0),e([w({constructOnly:!0})],ze.prototype,"owner",void 0),e([w({constructOnly:!0})],ze.prototype,"layer",void 0),e([w({constructOnly:!0})],ze.prototype,"graphicSymbolSupported",void 0),e([w({constructOnly:!0})],ze.prototype,"getRenderingInfoWithoutRenderer",void 0),e([w({constructOnly:!0})],ze.prototype,"componentFactories",void 0),e([w({constructOnly:!0})],ze.prototype,"setUidToIdOnAdd",void 0),e([w()],ze.prototype,"featureStore",null),e([w()],ze.prototype,"initializePromise",null),e([w()],ze.prototype,"scaleVisibility",null),e([w()],ze.prototype,"elevationAlignment",null),e([w()],ze.prototype,"objectStates",null),e([w()],ze.prototype,"filterVisibility",null),e([w({readOnly:!0})],ze.prototype,"updating",null),e([w({readOnly:!0})],ze.prototype,"dataUpdating",null),e([w({readOnly:!0})],ze.prototype,"running",null),e([w({readOnly:!0})],ze.prototype,"suspendedOrOutsideOfView",null),e([w({readOnly:!0,dependsOn:[]})],ze.prototype,"updatingRemaining",null),e([w({readOnly:!0})],ze.prototype,"displayFeatureLimit",null),e([w({readOnly:!0,dependsOn:[]})],ze.prototype,"averageSymbolComplexity",null),e([w({constructOnly:!0})],ze.prototype,"hasZ",void 0),e([w({constructOnly:!0})],ze.prototype,"hasM",void 0),e([w()],ze.prototype,"_objectIdField",null),ze=Fe=e([R("esri.views.3d.layers.graphics.Graphics3DCore")],ze),function(e){e[e.NEW=0]="NEW",e[e.LOADING=1]="LOADING",e[e.READY=2]="READY",e[e.REJECTED=3]="REJECTED"}(ke||(ke={}));class We{constructor(){this.add=null,this.renderingInfo=null,this.state=ke.NEW,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=ke.NEW,this.abortController=null,this.remove=null}}const He=10,Ne=U(),Be=U(),qe=new Map;export{ze as Graphics3DCore};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import"../../../../geometry.js";import"../../../../renderers/ClassBreaksRenderer.js";import"../../../../renderers/DictionaryRenderer.js";import"../../../../renderers/DotDensityRenderer.js";import"../../../../renderers/HeatmapRenderer.js";import"../../../../renderers/PieChartRenderer.js";import"../../../../renderers/Renderer.js";import"../../../../renderers/SimpleRenderer.js";import t from"../../../../renderers/UniqueValueRenderer.js";import"../../../../renderers/support/jsonUtils.js";import i from"../../../../core/Logger.js";import"../../../../symbols.js";import r from"../../../../core/Accessor.js";import{isSome as s}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import a from"../../../../core/Error.js";import{makeHandle as n}from"../../../../core/handleUtils.js";import{someMap as o,findInMap as l}from"../../../../core/MapUtils.js";import{removeMaybe as h,destroyMaybe as d,disposeMaybe as p}from"../../../../core/maybe.js";import{MinPriority as c}from"../../../../core/MemCache.js";import y from"../../../../core/PooledArray.js";import{throwIfAborted as g,createResolver as u,isAbortError as m,ignoreAbortErrors as b}from"../../../../core/promiseUtils.js";import{watch as _,when as f,on as v,syncAndInitial as C,whenOnce as S}from"../../../../core/reactiveUtils.js";import{schedule as G}from"../../../../core/scheduling.js";import{property as w}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as R}from"../../../../core/accessorSupport/decorators/subclass.js";import{diff as x,isEmpty as P}from"../../../../core/accessorSupport/diffUtils.js";import{s as D,g as E,j as I}from"../../../../chunks/vec32.js";import{create as U}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as A}from"../../../../geometry/projection.js";import{projectBuffer as L}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as j}from"../../../../geometry/projection/projectVectorToVector.js";import{projectXYZToVector as O}from"../../../../geometry/projection/projectXYZToVector.js";import{create as V,center as F,fromRect as M,equals as T}from"../../../../geometry/support/aaBoundingBox.js";import{create as z}from"../../../../geometry/support/aaBoundingRect.js";import{equals as k}from"../../../../geometry/support/spatialReferenceUtils.js";import W from"../../../../layers/Layer.js";import{getObjectId as H,computeAABB as N,hasGeometry as B}from"../../../../layers/graphics/dehydratedFeatures.js";import{hydrateGraphic as q}from"../../../../layers/graphics/hydratedFeatures.js";import{PromiseQueue as Y}from"../../../../layers/support/PromiseQueue.js";import{isSupportedRenderer3D as Q,validateTo3D as $}from"../../../../renderers/support/rendererConversion.js";import{loadArcade as Z}from"../../../../support/arcadeOnDemand.js";import{isBasemapLayer as J}from"../../../../support/basemapUtils.js";import{getDefaultSymbol3D as X}from"../../../../symbols/support/defaults3D.js";import{to3D as K}from"../../../../symbols/support/symbolConversion.js";import{averageSymbolComplexities as ee,defaultSymbolComplexity as te}from"./defaultSymbolComplexity.js";import{DisplayFeatureLimit as ie}from"./DisplayFeatureLimit.js";import{ViewElevationProvider as re}from"./ElevationQuery.js";import{VisibilityGroup as se,VisibilityFlag as ae}from"./enums.js";import{extractExpressionInfo as ne,createContext as oe}from"./featureExpressionInfoUtils.js";import{Graphics3DFeatureStore as le}from"./Graphics3DFeatureStore.js";import{Graphics3DGraphicCreationContext as he}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DSymbolCreationContext as de}from"./Graphics3DSymbolCreationContext.js";import{make as pe}from"./Graphics3DSymbolFactory.js";import{Graphics3DWebStyleSymbol as ce}from"./Graphics3DWebStyleSymbol.js";import{GraphicsCorePerformanceInfo as ye}from"./GraphicsCorePerformanceInfo.js";import{GraphicStateTracking as ge}from"./GraphicStateTracking.js";import{computeCentroid as ue}from"./graphicUtils.js";import{ApplyRendererDiffResult as me}from"./interfaces.js";import{LoadStatus as be}from"./Loadable.js";import{SpatialIndex2D as _e}from"./SpatialIndex2D.js";import{getSymbolMemorySize as fe}from"./symbolMemory.js";import{StageLayerElevationProvider as ve}from"../support/StageLayerElevationProvider.js";import{toBoundingRect as Ce}from"../../support/extentUtils.js";import{PropertiesPool as Se}from"../../support/PropertiesPool.js";import{GridLocalOriginFactory as Ge}from"../../webgl-engine/lib/GridLocalOriginFactory.js";import{UpdatePolicy as we}from"../../webgl-engine/lib/UpdatePolicy.js";import{affectsGeometry as Re}from"../../webgl-engine/lib/VertexAttribute.js";import{WebGLLayer as xe}from"../../webgl-engine/lib/WebGLLayer.js";import{hasPopupTemplate as Pe}from"../../../layers/support/popupUtils.js";import{ImmediateTask as De,noBudget as Ee,TaskPriority as Ie}from"../../../support/Scheduler.js";import{Yield as Ue}from"../../../support/Yield.js";import Ae from"../../../../geometry/Extent.js";import Le from"../../../../geometry/Point.js";import je from"../../../../symbols/LabelSymbol3D.js";import Oe from"../../../../symbols/TextSymbol.js";import Ve from"../../../../symbols/WebStyleSymbol.js";var Fe;const Me=U(),Te=V();let ze=Fe=class extends r{get _viewSpatialReference(){return this.owner.view.spatialReference}get spatialIndex(){return this._spatialIndex||(this._spatialIndex=new _e({objectIdField:this.owner.layer?.objectIdField,spatialReference:this._viewSpatialReference,hasZ:!!this.hasZ,hasM:!!this.hasM}),this._spatialIndex.setup(Array.from(this.graphics3DGraphics.values()))),this._spatialIndex.update(),this._spatialIndex}get deconflictor(){return this._deconflictor}get labeler(){return this._labeler}get numberOfGraphics(){return this._numberOfGraphics}get effectiveUpdatePolicy(){return null!=this.currentRenderer&&"dictionary"===this.currentRenderer.type?we.ASYNC:this._forcedUpdatePolicy??this.preferredUpdatePolicy}get featureStore(){return this._featureStore}get initializePromise(){return this._initializePromise}get scaleVisibility(){return this._scaleVisibility}get elevationAlignment(){return this._elevationAlignment}get objectStates(){return this._objectStates}get filterVisibility(){return this._filterVisibility}get updating(){return!!(this.dataUpdating||this._elevationAlignment?.updating||this._scaleVisibility?.updating||this._filterVisibility?.updating||this._rendererChangeAbortController||this._elevationInfoChangeAbortController||this._frameTaskHandle.updating||this.running)}get dataUpdating(){return!!(this._graphicsWaitingForSymbol.size>0||this._pendingUpdates.size>0||this._spatialIndex?.updating||this._updatingPendingLoadedGraphicsChange||this._dataUpdateQueue.running||this._loadingSymbols>0)}get running(){return this._pendingUpdates.size>0||!!this._spatialIndex?.updating||this._dataUpdateQueue.running||this._updateQueue.running}get suspendedOrOutsideOfView(){return this.owner.suspended||!!this.owner.suspendInfo?.outsideOfView}get updatingRemaining(){return this.updating?this._pendingUpdates.size+.1*(this._spatialIndex?.updatingRemaining||0)+.1*(this._elevationAlignment?.updatingRemaining||0):0}get displayFeatureLimit(){const e=this.owner&&this.owner.view&&this.owner.view.qualitySettings,t=e?.graphics3D.minTotalNumberOfFeatures??0,i=e?.graphics3D.maxTotalNumberOfFeatures??0,r=e?.graphics3D.maxNumberOfDrawCalls??0,s=e?.graphics3D.maxTotalNumberOfVertices??0,a=this.averageSymbolComplexity,n=Math.max(1,a?.verticesPerFeature??1),o=a&&a.drawCallsPerFeature>0&&r>0?r/a.drawCallsPerFeature:i,l=Math.ceil(s/n),h=Math.max(t,Math.min(i,l,o)),d=this._get("displayFeatureLimit");return d&&d.maximumTotalNumberOfVertices===s&&d.averageSymbolComplexity===a&&d.maximumNumberOfFeatures===h?d:new ie(s,h,a)}get averageSymbolComplexity(){const e=ee(this._symbolComplexities),t=this._get("averageSymbolComplexity");return 0===e.numComplexities||null!=t&&(e.estimated&&(t.verticesPerFeature>=e.verticesPerFeature||t.verticesPerCoordinate>=e.verticesPerCoordinate||t.drawCallsPerFeature>=e.drawCallsPerFeature)||t.verticesPerFeature===e.verticesPerFeature&&t.verticesPerCoordinate===e.verticesPerCoordinate&&t.drawCallsPerFeature===e.drawCallsPerFeature)?t:e}get usedMemory(){const e=null!=this.averageSymbolComplexity&&this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel*this._numberOfGraphics:0,t=this._getSymbolComplexitiesUsed().reduce(((e,t)=>e+t.memory.resourceBytes),0);if(null==this._symbolMaterials){this._symbolMaterials=[];for(const e of this._symbols.values())if(null!=e)for(const t of e.symbolLayers)if(t)for(const e of t.materials)e&&this._symbolMaterials.push(e)}const i=this.owner.view._stage.renderer.plugins,r=this.owner.view.basemapTerrain.overlayManager.renderer,s=this._symbolMaterials.reduce(((e,t)=>e+((i.getMaterialRenderer(t)||r.getMaterialRenderer(t))?.usedMemory??0)),0);return this._usedMemory+e+t+s}get usedMemoryPerGraphic(){if(this._usedMemory&&this._numberOfGraphics){const e=this._numberOfGraphics/(this._numberOfGraphics+Math.max(this._pendingAdds,this._pendingRemoves));return this._usedMemory/this._numberOfGraphics*e}if(null!=this.averageSymbolComplexity){const e=this.labelsEnabled?this.averageSymbolComplexity.memory.bytesPerFeatureLabel:0;return this.averageSymbolComplexity.memory.bytesPerFeature+e}return 0}get unprocessedMemoryEstimate(){return(this._pendingAdds-this._pendingRemoves)*this.usedMemoryPerGraphic}get _symbolComplexities(){return this.currentRenderer?this._getSymbolComplexitiesUsedOrRenderer(this.currentRenderer):this._getSymbolComplexitiesUsed()}get visible(){return this._visible}_getConvertedSymbol(e){if("web-style"===e.type)return e.clone();const t=this._symbolConversionCache.get(e.id);if(null!=t)return t;const r=K(e,{geometryType:this.layer?.geometryType??void 0,retainId:!0,hasLabelingContext:this._hasLabelingContext(e),cimFallbackEnabled:!0}),s=r.symbol||null;return null==s&&r.error&&i.getLogger(this).error(r.error.message),this._symbolConversionCache.set(e.id,s),s}_getSymbolComplexitiesUsedOrRenderer(e){if(null==e)return[];const t=e.getSymbols(),i="backgroundFillSymbol"in e?e.backgroundFillSymbol:null;if(!i&&!t?.length)return[];const r=[],s=this._getSymbolComplexityUsedOrRenderer(i);null!=s&&r.push(s);for(const a of t){const e=this._getSymbolComplexityUsedOrRenderer(a);null!=e&&r.push(e)}return r}_getSymbolComplexityUsedOrRenderer(e){if(null==e)return null;const t=this._symbols.get(e.id);if(null!=t)return t.complexity;const i=this._getConvertedSymbol(e);return null!=i?te(i):null}_getSymbolComplexitiesUsed(){const e=[];return this._symbols.forEach((t=>{null!=t&&e.push(t.complexity)})),e}get _objectIdField(){return this.layer.objectIdField}constructor(e){super(e),this._propertiesPool=new Se({computedExtent:Ae},this),this.computedExtent=null,this.currentRenderer=null,this.rendererHasGeometryOperations=!1,this._graphicStateTracking=null,this.graphics3DGraphics=new Map,this.stageLayer=null,this.stage=null,this._graphicsDrapedUids=new Set,this._graphicsBySymbol=new Map,this._symbolConversionCache=new Map,this._symbols=new Map,this._graphicsWithoutSymbol=new Map,this._graphicsWaitingForSymbol=new Map,this._graphicsUpdateId=0,this._frameTaskHandle=De,this._dataUpdateQueue=new Y,this._updateQueue=new Y,this._suspendSymbolCleanup=!1,this._arcadeOnDemand=null,this._rendererChangeAbortController=null,this._elevationInfoChangeAbortController=null,this._initializeAbortController=null,this._elevationAlignment=null,this._scaleVisibility=null,this._filterVisibility=null,this._spatialIndex=null,this.extentPadding=0,this._updatingPendingLoadedGraphicsChange=null,this._featureStore=null,this._deconflictor=null,this._labeler=null,this._objectStates=null,this._viewElevationProvider=null,this._stageLayerElevationProvider=null,this._sharedSymbolResourcesOwnerHandle=null,this._whenGraphics3DGraphicRequests={},this._pendingUpdates=new Map,this._numberOfGraphics=0,this._numberOfGraphicsProvidingElevation=0,this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this._loadingSymbols=0,this._pendingUpdatesPool=new y({allocator:e=>e||new We,deallocator:e=>(e.clear(),e)}),this._symbolWarningLogged=!1,this._geometryWarningLogged=!1,this._objectIdInvisibleSet=new Set,this._whenSymbolRemoved=new y,this.preferredUpdatePolicy=we.SYNC,this._forcedUpdatePolicy=null,this.elevationFeatureExpressionEnabled=!0,this.owner=null,this.layer=null,this.graphicSymbolSupported=!0,this.getRenderingInfoWithoutRenderer=!1,this.setUidToIdOnAdd=!0,this.hasZ=null,this.hasM=null,this._usedMemory=0,this._visible=!1,this._startCreateGraphics=!1,this._unusedSymbolsCache=e.owner.view.resourceController.memoryController.newCache("graphics-3d-unused-symbols",(e=>e.destroy())),this.symbolCreationContext=new de(e.owner.view.resourceController.scheduler,((e,t)=>this._updateQueue.push(e,t)))}initialize(){this._featureStore=new le({objectIdField:this.owner.layer?.objectIdField,hasZ:!!this.hasZ,hasM:!!this.hasM,viewSpatialReference:this._viewSpatialReference,featureSpatialReference:this.owner.featureSpatialReference,getSpatialIndex:()=>this.spatialIndex,forEach:e=>this.graphics3DGraphics.forEach(e)});const e=(e,t,i)=>this.spatialIndex.queryGraphicUIDsInExtent(e,t,i),{componentFactories:t}=this;this._elevationAlignment=t.elevationAlignment?.(this,e),this._scaleVisibility=t.scaleVisibility?.(this,e),this._filterVisibility=t.filterVisibility?.({featureStore:this._featureStore,getFeatureCount:()=>this.graphics3DGraphics.size,updateFeatureVisibilities:e=>this.modifyGraphics3DGraphicVisibilities((t=>t.setVisibilityFlag(se.GRAPHIC,ae.FILTER,e(H(t.graphic,this._objectIdField))))),setAllFeaturesVisibility:e=>this.modifyGraphics3DGraphicVisibilities((t=>t.setVisibilityFlag(se.GRAPHIC,ae.FILTER,e))),clearFeaturesVisibility:()=>this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(se.GRAPHIC,ae.FILTER,!0)))}),this._deconflictor=t.deconflictor?.(this),this._labeler=t.labeler?.(this,this._scaleVisibility),this._objectStates=t.objectStates?.(this),this._initializeAbortController=new AbortController,this._initializePromise=this._initializeAsync()}async _initializeAsync(){const e=this._initializeAbortController?.signal,t=this.owner.view;this._viewElevationProvider=new re(this._viewSpatialReference,t),this._initializeStage(t,this.layer.uid);const r=t.sharedSymbolResources;this.symbolCreationContext.sharedResources=r,this._sharedSymbolResourcesOwnerHandle=r.addGraphicsOwner(this.owner),null!=this.currentRenderer&&(this.symbolCreationContext.renderer=this.currentRenderer),this.symbolCreationContext.stage=this.stage,this.symbolCreationContext.streamDataRequester=r.streamDataRequester,this.symbolCreationContext.renderCoordsHelper=t.renderCoordsHelper,this.symbolCreationContext.layer=this.layer,this.symbolCreationContext.graphicsCoreOwner=this.owner,this.symbolCreationContext.localOriginFactory=new Ge(t.renderSpatialReference),this.symbolCreationContext.elevationProvider=t.elevationProvider,this.symbolCreationContext.notifyGraphicGeometryChanged=e=>this.notifyGraphicGeometryChanged(e),this.symbolCreationContext.notifyGraphicVisibilityChanged=e=>this.notifyGraphicVisibilityChanged(e);const s=ne(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);if(this.symbolCreationContext.featureExpressionInfoContext=await oe(s,this._viewSpatialReference,e,i.getLogger(this)),g(e),this.symbolCreationContext.screenSizePerspectiveEnabled=t.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this.symbolCreationContext.physicalBasedRenderingEnabled=!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled,this.symbolCreationContext.skipHighSymbolLods=!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods,"drapeSourceType"in this.owner){const{owner:e}=this;this.symbolCreationContext.drapeSourceRenderer=t.basemapTerrain.overlayManager.registerGeometryDrapeSource(e),this.addHandles(n((()=>t.basemapTerrain.overlayManager.unregisterDrapeSource(e))))}this.addHandles([_((()=>this.suspendedOrOutsideOfView),(()=>this._updateQueue.unshift((()=>this._updateLayerVisibility()),null).catch(b))),_((()=>[this.layer?.screenSizePerspectiveEnabled,this.owner.view?.screenSizePerspectiveEnabled]),(()=>{const e=t.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled;e!==this.symbolCreationContext.screenSizePerspectiveEnabled&&(this.symbolCreationContext.screenSizePerspectiveEnabled=e,this._labeler?.reset(),this.recreateAllGraphicsAndSymbols())})),_((()=>this.owner.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(!!e))),_((()=>this.owner.view.state?.rasterPixelRatio),(()=>this._pixelRatioChange())),_((()=>!!this.owner.view.qualitySettings?.physicallyBasedRenderingEnabled),(e=>this._physicalBasedRenderingChange(e))),_((()=>!!this.owner.view.qualitySettings?.graphics3D?.skipHighSymbolLods),(e=>this._skipHighSymbolLoDsChange(e))),f((()=>t.basemapTerrain?.tilingScheme),(e=>{if(e.spatialReference.equals(this.symbolCreationContext.overlaySR)||null==t.basemapTerrain.spatialReference||(this.symbolCreationContext.overlaySR=t.basemapTerrain.spatialReference),this.hasHandles("loaded-graphics"))this.recreateAllGraphics();else{const e=()=>this.owner?.loadedGraphics;this.addHandles([v(e,"change",(e=>{this._graphicsCollectionChanged(e),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}),{onListenerAdd:()=>{this.recreateAllGraphics(),this._signalUpdatingDuringAsyncLoadedGraphicsChange()}})],"loaded-graphics")}}),{initial:!0}),_((()=>this.effectiveUpdatePolicy),(e=>{null!=this.stageLayer&&(this.stageLayer.updatePolicy=e),this.symbolCreationContext.isAsync=this.effectiveUpdatePolicy===we.ASYNC,e===we.SYNC&&this.runTask(Ee)}),C)]),this._frameTaskHandle=t.resourceController.scheduler.registerTask(Ie.GRAPHICS_CORE,this),this.layer&&"featureReduction"in this.layer&&this.addHandles(_((()=>this.layer.featureReduction),(()=>this._deconflictor?.featureReductionChange()))),this.notifyChange("averageSymbolComplexity"),this.rendererChange(this.owner.renderer).catch((()=>{})),this._initializeAbortController=null}_abortInitialize(){this._initializeAbortController&&(this._initializeAbortController.abort(),this._initializeAbortController=null)}destroy(){this._unusedSymbolsCache.destroy(),this._abortInitialize(),this._abortRendererChange(),this._abortElevationInfoChange(),this._frameTaskHandle.remove(),this._frameTaskHandle=De,this._dataUpdateQueue.cancelAll(),this._updateQueue.cancelAll(),this._deconflictor=h(this._deconflictor),this._labeler=h(this._labeler),this._elevationAlignment=d(this._elevationAlignment),this._scaleVisibility=d(this._scaleVisibility),this._filterVisibility=d(this._filterVisibility),this._objectStates=d(this._objectStates),this.clear(),this._featureStore=d(this._featureStore),this._updatingPendingLoadedGraphicsChange=h(this._updatingPendingLoadedGraphicsChange),this._graphicStateTracking=d(this._graphicStateTracking),this.stage&&(this.stageLayer=d(this.stageLayer),this.stage=null),this._set("owner",null);for(const e in this._whenGraphics3DGraphicRequests)this._whenGraphics3DGraphicRequests[e].reject(new a("graphic:layer-destroyed","Layer has been destroyed"));this._whenGraphics3DGraphicRequests=null,this._sharedSymbolResourcesOwnerHandle=h(this._sharedSymbolResourcesOwnerHandle),this._propertiesPool=d(this._propertiesPool),this._pendingUpdatesPool=null,this._symbolConversionCache.clear(),this._objectIdInvisibleSet.clear(),this._spatialIndex=d(this._spatialIndex)}clear(){this._objectStates?.allGraphicsDeleted(),null!=this._graphicStateTracking&&this._graphicStateTracking.allGraphicsDeleted(),this.graphics3DGraphics.forEach((e=>e.destroy())),this._spatialIndex?.clear(),this.graphics3DGraphics.clear(),this._numberOfGraphics=0,this._usedMemory=0,this._updateLayerVisibility(),this._symbols.forEach(d),this._symbols.clear(),this._symbolMaterials=null,this._graphicsBySymbol.clear(),this._graphicsWithoutSymbol.clear(),this._graphicsWaitingForSymbol.clear(),this._pendingUpdates.clear(),this._pendingUpdatesPool.clear(),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1,this.notifyChange("dataUpdating"),this.notifyChange("running"),this.notifyChange("updatingRemaining"),this._featureStore.events.emit("changed")}_initializeStage(e,t){this.stage=e._stage,this.stageLayer=new xe(this.stage,{pickable:!this.suspendedOrOutsideOfView,updatePolicy:this.effectiveUpdatePolicy},t);const i=this.stageLayer.events;i.on("transformationChanged",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),i.on("shaderTransformationChanged",(e=>this.notifyGraphicGeometryChanged(e.graphicUid))),i.on("visibilityChanged",(e=>this.notifyGraphicVisibilityChanged(e.graphicUid))),i.on("geometryAdded",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),i.on("geometryRemoved",(e=>this.notifyGraphicGeometryChanged(e.object.graphicUid))),i.on("attributesChanged",(e=>Re(e.attribute)&&this.notifyGraphicGeometryChanged(e.object.graphicUid)))}notifyGraphicGeometryChanged(e){if(null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicGeometry(t)}notifyGraphicVisibilityChanged(e){if(null==this._graphicStateTracking||null==e)return;const t=this.graphics3DGraphics.get(e);t&&this._graphicStateTracking.updateGraphicVisibility(t)}_updateLayerVisibility(){const e=this.displayFeatureLimit.maximumNumberOfFeatures,t=this._numberOfGraphics>e*He,i=!this.suspendedOrOutsideOfView&&!t;i!==this._visible&&(this._visible=i,i?(this.stageLayer.pickable=!0,this.updateAllGraphicsVisibility()):(this.stageLayer.pickable=!1,this._hideAllGraphics()),this._updateStageLayerVisibility())}_updateStageLayerVisibility(){this.stageLayer.visible=this._visible&&(null==this.layer.opacity||this.layer.opacity>0)}getGraphics3DGraphicById(e){return null!=e?this.graphics3DGraphics.get(e):void 0}getGraphics3DGraphicByObjectId(e){return this.owner.layer?.objectIdField?this._findGraphics3DGraphicByObjectId(e):null}_getGraphicObjectID(e,t=this.owner.layer?.objectIdField){return H(e,t)}get graphics3DGraphicsByObjectID(){const e=this.owner.layer?.objectIdField;if(!e)return;const t=new Map;return this.graphics3DGraphics.forEach((i=>{if(!i)return;const r=i.graphic,s=this._getGraphicObjectID(r,e);null!=s&&t.set(s,i)})),t}get labelsEnabled(){return!!this._labeler?.layerLabelsEnabled()}async updateLabelingInfo(e){const t=this._deconflictor?.labelingInfoChange(e),i=this._labeler?.labelingInfoChange(e);await Promise.allSettled([t,i])}updateVisibilityInfo(){this._deconflictor?.labelingInfoChange(),this._labeler?.visibilityInfoChange()}get symbolUpdateType(){if(this._pendingUpdates.size>0)return"unknown";let e=0,t=0;return o(this._symbols,((i,r)=>{if(null!=i){const s=i.getFastUpdateStatus();if(s.loading>0)return!0;this._graphicsBySymbol.has(r)&&(t+=s.fast,e+=s.slow)}return!1}))?"unknown":t>=0&&0===e?"fast":e>=0&&0===t?"slow":"mixed"}runTask(e){if(this._dataUpdateQueue.runTask(e),this._updateQueue.runTask(e),this._applyPendingUpdates(e),this.notifyChange("running"),this.running||this.notifyChange("dataUpdating"),this.notifyChange("updatingRemaining"),!e.hasProgressed)return Ue}setObjectIdVisibility(e,t){t?this._objectIdInvisibleSet.delete(e):this._objectIdInvisibleSet.add(e);const i=this._findGraphics3DGraphicByObjectId(e);null!=i&&this._updateUserVisibility(i)}_findGraphics3DGraphicByObjectId(e){return l(this.graphics3DGraphics,(t=>this._getGraphicObjectID(t.graphic)===e))}_updateUserVisibility(e){if(null==e)return!1;const t=e.graphic,i=this._getGraphicObjectID(t),r=t.visible&&!this.owner.suspended&&(null==i||!this._objectIdInvisibleSet.has(i));return e.setVisibilityFlag(se.GRAPHIC,ae.USER,r)}_whenGraphics3DGraphic(e){const t=this.graphics3DGraphics.get(e.uid);if(t)return Promise.resolve(t);const i=this._whenGraphics3DGraphicRequests[e.uid];if(i)return i.promise;const r=u();return this._whenGraphics3DGraphicRequests[e.uid]=r,r.promise}async _boundsForGraphics3DGraphic(e,t){const i=this._viewSpatialReference,r=this.owner.view.renderSpatialReference,s=this.owner.view.basemapTerrain.spatialReference,a=(e,t,s)=>L(e,r,t,e,i,t,s),n=(e,t,r)=>L(e,s,t,e,i,t,r),o=this._viewElevationProvider?{service:this._viewElevationProvider,useViewElevation:null!=t&&!!t.useViewElevation,minDemResolution:null!=t?t.minDemResolution:null,minDemResolutionForPoints:this.owner.view.resolution}:null,l=await e.getProjectedBoundingBox(a,n,o,t?.signal);if(!l)return null;const h=l.boundingBox;if(l.requiresDrapedElevation){const e=this.symbolCreationContext.elevationProvider;if(e){F(h,Me);const t=e.getElevation(Me[0],Me[1],0,i,"ground")??0;h[2]=Math.min(h[2],t),h[5]=Math.max(h[5],t)}}return{boundingBox:h,screenSpaceObjects:l.screenSpaceObjects}}async whenGraphicBounds(e,t){await S((()=>this.owner?.loadedGraphics));const i=this.owner.layer?.objectIdField,r=this.owner.loadedGraphics.find((t=>t===e||null!=i&&null!=t.attributes&&e.attributes&&t.attributes[i]===e.attributes[i]));if(!r)throw new a("internal:graphic-not-part-of-view","Graphic is not part of this view");const s=await this._whenGraphics3DGraphic(r);return this._boundsForGraphics3DGraphic(s,t)}computeAttachmentOrigin(e,t){const i=this.graphics3DGraphics.get(e.uid);if(!i)return null;const r=i.computeAttachmentOrigin();if(0===r.render.num&&0===r.draped.num)return null;D(Ne,0,0,0);let s=0;if(r.render.num>0){if(!j(r.render.origin,this.symbolCreationContext.renderCoordsHelper.spatialReference,Be,t))return null;E(Ne,Ne,Be),s++}if(r.draped.num>0){const[e,i]=r.draped.origin,a=this._viewElevationProvider.getElevation(e,i,"ground")??0;if(D(Be,e,i,a),!j(Be,this._viewElevationProvider.spatialReference,Be,t))return null;E(Ne,Ne,Be),s++}return s>1&&I(Ne,Ne,1/s),new Le({x:Ne[0],y:Ne[1],z:Ne[2],spatialReference:t})}getSymbolLayerSize(e,t){const i=this._symbols.get(e.id);if(null==i)throw new a("internal:symbol-not-part-of-view","Symbol is not part of this view");const r=e.symbolLayers.indexOf(t);if(-1===r)throw new a("internal:missing-symbol-layer","Symbol layer is not in symbol");const s=i.getSymbolLayerSize(r);if(null==s)throw new a("internal:missing-size","Symbol layer has no valid size");return s}_graphicsCollectionChanged(e){this._startCreateGraphics&&(this.add(e.added),this.remove(e.removed))}graphicUpdateHandler(e){const t=e.graphic.uid,i=this.graphics3DGraphics.get(t);if(null!=i||null!=this._graphicsWithoutSymbol.get(t))switch(e.property){case"visible":this._graphicUpdateVisibleHandler(i);break;case"geometry":this._graphicUpdateGeometryHandler(i,e);break;case"symbol":this._graphicUpdateSymbolHandler(i,e);break;case"attributes":break;case"origin-transform":this._graphicUpdateTransformHandler(i,e)}}_graphicUpdateGeometryHandler(e,t){this._graphicUpdateGeometryOrTransformHandler(e,t,(()=>!(null==t.newValue||null==e||!e.graphics3DSymbol.updateGeometry(e,t.newValue)||!(this._labeler?.updateGraphicGeometry(e)??1))&&(this._labeler?.setDirty(),!0)));const i=t.graphic.geometry;null!=i&&this._expandComputedExtent(i)}_graphicUpdateTransformHandler(e,t){const i=t.graphic.geometry;this._graphicUpdateGeometryOrTransformHandler(e,t,(()=>null!=t.newValue&&null!=e&&null!=i&&e.graphics3DSymbol.updateTransform(e,i.spatialReference,t.newValue,t.action)))}_graphicUpdateGeometryOrTransformHandler(e,t,i){if(null!=t.graphic.geometry)if(null!=e)i()||this._recreateGraphic(e.graphic);else{const e=t.graphic.symbol?.id;if(e){const t=this._symbols.get(e);if(null!=t&&t.loadStatus===be.LOADING)return}this._recreateGraphic(t.graphic)}else this._recreateGraphic(t.graphic)}_graphicUpdateSymbolHandler(e,t){const i=t.graphic,r=null!=e?e.graphics3DSymbol:null!=t.oldValue?this._symbols.get(t.oldValue.id):null;if(null==r||null==t.newValue)return void this._recreateGraphic(i);const s=r.symbol,a=this._getConvertedSymbol(t.newValue);if(null!=a&&(a.type!==s.type||"web-style"===a.type)||"web-style"===s.type)return void this._recreateGraphic(i);const n=this._graphicsBySymbol.get(s.id);if(n&&1!==n.size)return void this._recreateGraphic(i);const o=x(s,a);if(null==o)return void this._updateSymbolMapping(s.id,a);const l={diff:o,graphics3DGraphicPatches:[],symbolStatePatches:[]};if(r.prepareSymbolPatch(l),!P(l.diff))return void this._recreateGraphic(i);const h=this._getRenderingInfo(i);if(null==h)return void this._recreateGraphic(i);const d=r.extentPadding;for(const p of l.symbolStatePatches)p();if(d!==r.extentPadding&&this._recomputeExtentPadding(),null!=e)for(const p of l.graphics3DGraphicPatches)p(e,h);this._updateSymbolMapping(s.id,a)}_graphicUpdateVisibleHandler(e){this._updateUserVisibility(e)&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}recreateGraphics(e){this._suspendSymbolCleanup=!0,this.remove(e),this.add(e),this._suspendSymbolCleanup=!1,this.effectiveUpdatePolicy===we.SYNC&&this._cleanupSymbols()}_recreateGraphic(e){this.recreateGraphics([e])}_beginGraphicUpdate(e){const t=this._graphicsUpdateId;return this._graphicsUpdateId++,this._graphicsWaitingForSymbol.set(e.uid,t),1===this._graphicsWaitingForSymbol.size&&this.notifyChange("dataUpdating"),t}_endGraphicUpdate(e){e&&(this._graphicsWaitingForSymbol.delete(e.uid),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("dataUpdating")))}_recomputeExtentPadding(){let e=0;this._symbols.forEach((t=>{null!=t&&(e=Math.max(e,t.extentPadding))})),this._set("extentPadding",e)}_expandComputedExtent(e){const t=Te,i=e.spatialReference;N(e,t);const r=this._viewSpatialReference,s=Fe.tmpVec;if(k(i,r)||O(t[0],t[1],0,i,s,r)&&(t[0]=s[0],t[1]=s[1],O(t[3],t[4],0,i,s,r),t[3]=s[0],t[4]=s[1]),!(isFinite(t[0])&&isFinite(t[3])&&isFinite(t[1])&&isFinite(t[4])))return;const a=this.computedExtent;let n=null;const o=isFinite(t[2])&&isFinite(t[5]),l=o&&(null==a?.zmin||t[2]<a.zmin),h=o&&(null==a?.zmax||t[5]>a.zmax);if(a){(t[0]<a.xmin||t[1]<a.ymin||t[3]>a.xmax||t[4]>a.ymax||l||h)&&(n=this._propertiesPool.get("computedExtent"),n.xmin=Math.min(t[0],a.xmin),n.ymin=Math.min(t[1],a.ymin),n.xmax=Math.max(t[3],a.xmax),n.ymax=Math.max(t[4],a.ymax),n.spatialReference=r)}else n=this._propertiesPool.get("computedExtent"),n.xmin=t[0],n.ymin=t[1],n.xmax=t[3],n.ymax=t[4],n.spatialReference=r;n&&(l&&(n.zmin=t[2]),h&&(n.zmax=t[5]),this._set("computedExtent",n))}_abortElevationInfoChange(){this._elevationInfoChangeAbortController&&(this._elevationInfoChangeAbortController.abort(),this._elevationInfoChangeAbortController=null)}async elevationInfoChange(){this._abortElevationInfoChange();const e=new AbortController;this._elevationInfoChangeAbortController=e;const t=ne(this.layer.elevationInfo,this.elevationFeatureExpressionEnabled);this.symbolCreationContext.featureExpressionInfoContext=await oe(t,this._viewSpatialReference,e.signal,i.getLogger(this)),g(e.signal),this._elevationInfoChangeAbortController=null,this._labeler?.elevationInfoChange(),this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("elevationInfo",t)?t.forEach((e=>{const t=e.graphic,i=e.labelLayers;for(const r of i){r.graphics3DSymbolLayer.updateGraphicElevationContext(t,r)}})):this._recreateSymbol(i)})),this.updateStageLayerElevationProvider(),this._elevationAlignment?.elevationInfoChange()}updateStageLayerElevationProvider(){this._stageLayerElevationProvider?(this.layer.elevationInfo&&"relative-to-scene"===this.layer.elevationInfo.mode||0===this._numberOfGraphicsProvidingElevation)&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=p(this._stageLayerElevationProvider)):(!this.layer.elevationInfo||this.layer.elevationInfo&&"relative-to-scene"!==this.layer.elevationInfo.mode)&&this._numberOfGraphicsProvidingElevation>0&&(this._stageLayerElevationProvider=new ve({layer:this.layer,stageLayer:this.stageLayer,view:this.owner.view}),this.owner.view.elevationProvider.register("scene",this._stageLayerElevationProvider))}_clearSymbolsAndGraphics(){this.clear(),null!=this._filterVisibility&&this._filterVisibility.clear(),this._labeler?.reset(),this._deconflictor?.clear(),this._elevationAlignment?.clear(),this.stageLayer?.invalidateSpatialQueryAccelerator(),this._stageLayerElevationProvider&&(this.owner.view.elevationProvider.unregister(this._stageLayerElevationProvider),this._stageLayerElevationProvider=p(this._stageLayerElevationProvider))}startCreateGraphics(){this._startCreateGraphics=!0,this.recreateAllGraphics()}recreateAllGraphics(){this._recreateAllGraphics(!1)}recreateAllGraphicsAndSymbols(){this._recreateAllGraphics(!0)}_recreateAllGraphics(e=!1){if(!this._startCreateGraphics)return;const{loadedGraphics:t,view:i}=this.owner,r=i.basemapTerrain.tilingScheme&&t?.length?t.toArray():null;!e&&r||this._clearSymbolsAndGraphics(),this.symbolCreationContext.screenSizePerspectiveEnabled=this.owner.view.screenSizePerspectiveEnabled&&!!this.layer.screenSizePerspectiveEnabled,this.symbolCreationContext.slicePlaneEnabled=!!this.owner.slicePlaneEnabled,this._set("computedExtent",null),r&&(e?this.add(r):this.recreateGraphics(r))}_recreateSymbol(e){const t=this._graphicsBySymbol.get(e),i=[];t&&(t.forEach(((e,t)=>{const r=e.usedMemory;this._conditionalRemove(e,t),this._spatialIndex?.remove(e),i.push(e.graphic),e.destroy(),this._removeGraphics3DGraphic(t,r),this._updateLayerVisibility(),this._featureStore.events.emit("changed")})),this._graphicsBySymbol.set(e,new Map));const r=this._symbols.get(e);d(r),this._symbols.delete(e),this._symbolMaterials=null,this.add(i)}_recreateGraphicsForSymbol(e){const t=this._graphicsBySymbol.get(e);if(t){const e=[];t.forEach((t=>e.push(t.graphic))),this.recreateGraphics(e)}}_conditionalRemove(e,t){this._graphicsDrapedUids.delete(t),this._objectStates?.removeGraphic(e),this._labeler?.removeGraphic(e),this._deconflictor?.removeGraphic(e),null!=this._graphicStateTracking&&this._graphicStateTracking.removeGraphic(e)}add(e){e&&0!==e.length&&(this.owner.view.basemapTerrain?.tilingScheme?(this._updatePolicyForGraphics(e)===we.ASYNC?this._addDelayed(e):this._addImmediate(e),this.notifyChange("dataUpdating")):i.getLogger(this).error("#add()","Cannot add graphics before terrain surface has been initialized"))}_updatePolicyForGraphics(e){if(this.effectiveUpdatePolicy===we.SYNC&&("mesh"===this.layer.geometryType||null==this.layer.geometryType))for(const t of e)if(null!=t.geometry&&"mesh"===t.geometry.type&&!t.geometry.loaded)return we.ASYNC;return this.effectiveUpdatePolicy}_addImmediate(e){this._geometryWarningLogged=!1,this._symbolWarningLogged=!1;for(const t of e)this._addGraphic(t,this._getRenderingInfo(t,i.getLogger(this)),we.SYNC);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_addDelayed(e){for(const t of e){const e=t.uid;let i=this._pendingUpdates.get(e);i?i.add?i.state!==ke.NEW&&i.abortController?.abort():this._pendingAdds++:(i=this._pendingUpdatesPool.pushNew(),this._pendingAdds++,this._pendingUpdates.set(e,i)),i.add=t}this.notifyChange("running"),this.notifyChange("updatingRemaining"),this.notifyChange("dataUpdating")}remove(e){this.effectiveUpdatePolicy===we.ASYNC?this._removeDelayed(e):this._removeImmediate(e),this.notifyChange("dataUpdating")}_removeImmediate(e){for(const t of e)this._removeGraphic(t);this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_removeDelayed(e){for(const t of e){const e=t.uid,i=this._pendingUpdates.get(e);if(i)i.add&&(i.remove?i.add=null:this._pendingUpdates.delete(e),i.state===ke.LOADING&&i.abortController?.abort(),this._pendingAdds--);else{const i=this._pendingUpdatesPool.pushNew();i.remove=t,this._pendingUpdates.set(e,i),this._pendingRemoves++,this._applyPendingRemovesFirst=!0}}0===this._pendingUpdates.size&&this._finishPendingUpdates(),this.notifyChange("running"),this.notifyChange("updatingRemaining"),this.notifyChange("dataUpdating")}_finishPendingUpdates(){this._pendingUpdatesPool.clear(),this._cleanupSymbols(),(this._pendingAdds||this._pendingRemoves)&&i.getLogger(this).warn("pendingAdds/Removes in inconsistent state!"),this._pendingAdds=0,this._pendingRemoves=0,this._applyPendingRemovesFirst=!1}_applyPendingUpdates(e){if(this._geometryWarningLogged=!1,this._symbolWarningLogged=!1,0===this._pendingUpdates.size&&this._spatialIndex?.updating)return this._spatialIndex.update(),void e.madeProgress();if(this._applyPendingRemovesFirst){this._applyPendingRemovesFirst=!1;for(const[t,i]of this._pendingUpdates){if(e.done){this._applyPendingRemovesFirst=!0;break}if(i.remove&&!i.add&&(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,this._pendingUpdates.delete(t),0===this._pendingRemoves))break}}for(const[t,i]of this._pendingUpdates){if(e.done)break;i.add&&i.state===ke.NEW&&this._processPendingUpdateNew(i);let r=this.effectiveUpdatePolicy;if(!i.remove||i.add&&i.state!==ke.READY||(this._pendingRemoves--,e.madeProgress(),this._removeGraphic(i.remove),i.remove=null,r=we.SYNC),i.add)switch(i.state){case ke.READY:this._addGraphic(i.add,i.renderingInfo,r),i.add=null,this._pendingAdds--,e.madeProgress();break;case ke.REJECTED:i.add=null,this._pendingAdds--;case ke.LOADING:}null==i.remove&&null==i.add&&this._pendingUpdates.delete(t)}0===this._pendingUpdates.size&&(this._finishPendingUpdates(),this.notifyChange("running"),this.notifyChange("dataUpdating"))}_processPendingUpdateNew(e){if(!e.add)return void(e.state=ke.READY);const t=e.add.geometry;null==t||"mesh"!==t.type||t.loaded?this._processPendingUpdateNewRenderingInfo(e):this._processPendingUpdateNewMesh(e,t)}async _processPendingUpdateNewMesh(e,t){e.state=ke.LOADING,e.abortController=new AbortController;const i=e.abortController.signal;try{await t.load({signal:i})}catch(r){return this._processPendingUpdateNewError(e,r)}e.abortController=null,this._processPendingUpdateNewRenderingInfo(e)}_processPendingUpdateNewError(e,t){e.abortController=null,m(t)?e.state=ke.NEW:e.state=ke.REJECTED}async _processPendingUpdateNewRenderingInfo(e){if(null==this.layer.renderer||"dictionary"!==this.layer.renderer.type)return e.renderingInfo=this._getRenderingInfo(e.add,i.getLogger(this)),void(e.state=ke.READY);e.state=ke.LOADING,e.abortController=new AbortController;let t=null;try{t=await this._getRenderingInfoAsync(e.add,{signal:e.abortController.signal})}catch(r){return e.abortController=null,void(m(r)?e.state=ke.NEW:e.state=ke.REJECTED)}null==t?.symbol?(this._symbolWarningLogged||(this._symbolWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),e.renderingInfo=null):e.renderingInfo=t,e.state=ke.READY}_addGraphic(e,t,i){if(this._graphicsWithoutSymbol.set(e.uid,e),null==t?.symbol||!B(e))return;if(null!=this.stage.renderView.objectAndLayerIdRenderHelper&&this.setUidToIdOnAdd){const t=J(this.owner.view.map,this.layer.uid);this.stage.renderView.objectAndLayerIdRenderHelper.setUidToObjectAndLayerId(e.objectId,e.uid,this.layer.id,this.layer.uid,!!this.layer.popupEnabled&&!t&&Pe(this.layer,this.owner.view.popup?.defaultPopupTemplateEnabled))}const r=t.symbol,s=this.getOrCreateGraphics3DSymbol(r,t.renderer);if(null==s)return;this._expandComputedExtent(e.geometry);const a=this._beginGraphicUpdate(e),n=new he(e,t,this.layer);let o=!1;const l=e=>{e===s.symbol.id&&(o=!0)};this._whenSymbolRemoved.push(l);const h=()=>{if(--this._loadingSymbols,this.destroyed)return;this._whenSymbolRemoved.removeUnordered(l);if(this._graphicsWaitingForSymbol.get(e.uid)!==a||o||s.destroyed||this.graphicSymbolSupported&&e.symbol&&e.symbol.id!==s.symbol.id)--s.referenced,this._cleanupSymbols();else{const t=this._createGraphics3DGraphic(s,n);this._spatialIndex&&null!=t&&this._spatialIndex.add(t),--s.referenced,this._endGraphicUpdate(e)}this._featureStore.events.emit("changed"),this._labeler?.setDirty()},d=t=>{--this._loadingSymbols,this.destroyed||(this._whenSymbolRemoved.removeUnordered(l),o||(m(t)?this.add([e]):s.destroyed||this._endGraphicUpdate(e)))};++this._loadingSymbols,i===we.ASYNC?s.load((()=>this._dataUpdateQueue.push(h,null).catch(b)),(e=>this._dataUpdateQueue.push((()=>d(e)),null).catch(b))):s.load(h,d)}_removeGraphic(e){const t=e.uid,i=this.graphics3DGraphics.get(t);if(i){i.graphics3DSymbol.onRemoveGraphic(i);const e=i.usedMemory,r=i.isElevationSource;this._conditionalRemove(i,t),this._spatialIndex?.remove(i);const s=i.graphics3DSymbol.symbol.id;this._graphicsBySymbol.get(s)?.delete(t),this._graphicsWithoutSymbol.delete(t),this._removeGraphics3DGraphic(t,e,r),i.destroy(),this._featureStore.events.emit("changed")}else this._graphicsWithoutSymbol.delete(t),this._graphicsWaitingForSymbol.delete(t),0===this._graphicsWaitingForSymbol.size&&(this._cleanupSymbols(),this.notifyChange("dataUpdating"))}_hasLabelingContext(e){if(e instanceof je||e instanceof Oe){const t=this.symbolCreationContext.layer;return!!t.labelingInfo&&t.labelingInfo.some((t=>t.symbol===e))}return!1}_hasValidSymbolCreationContext(e){return!(e instanceof je&&!this._hasLabelingContext(e))||(i.getLogger(this).error("LabelSymbol3D is only valid as part of a LabelClass. Using LabelSymbol3D as a renderer symbol is not supported."),!1)}_getRenderingInfo(e,t){const i=e.geometry;if(null==i)return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,t.warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!A(i.spatialReference,this._viewSpatialReference))return t&&!this._geometryWarningLogged&&(this._geometryWarningLogged=!0,t.warn(`Graphic in layer ${this.layer.id} has incompatible spatial reference and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,t.warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?q(e,this.layer):e;let s;if(this.owner.getRenderingInfo&&(this.getRenderingInfoWithoutRenderer||null!=this.currentRenderer))s=this.owner.getRenderingInfo(r,this.currentRenderer,this._arcadeOnDemand);else{s={symbol:r.symbol||X(r.geometry)}}return null==s?.symbol?(t&&!this._symbolWarningLogged&&(this._symbolWarningLogged=!0,t.warn(`Graphic in layer ${this.layer.id} has no symbol and will not render`)),null):s}_getRenderingInfoAsync(e,t){if(null==e.geometry)return this._geometryWarningLogged||(this._geometryWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} has no geometry and will not render`)),null;if(!this.graphicSymbolSupported&&null!=e.symbol)return this._symbolWarningLogged||(this._symbolWarningLogged=!0,i.getLogger(this).warn(`Graphic in layer ${this.layer.id} is not allowed to have a symbol, use a renderer instead`)),null;const r=this.rendererHasGeometryOperations?q(e,this.layer):e;return this.owner.getRenderingInfoAsync(r,this.currentRenderer,this._arcadeOnDemand,t)}_createGraphics3DSymbol(e,t){if(!this._hasValidSymbolCreationContext(e))return null;const i=this._getConvertedSymbol(e);if(!i)return null;let r;if(null!=t&&"backgroundFillSymbol"in t&&t.backgroundFillSymbol){const e=K(t.backgroundFillSymbol,{ignoreDrivers:!0});null!=e.symbol&&(r=e.symbol.symbolLayers)}const s=pe(i,this.symbolCreationContext,r);return s.load((()=>{const e=s.extentPadding;e>this.extentPadding&&this._set("extentPadding",e),this.notifyChange("averageSymbolComplexity")}),(()=>{})),s}getOrCreateGraphics3DSymbol(e,t){let i=this._symbols.get(e.id);if(void 0===i){const r=this._unusedSymbolsCache.pop(e.id);i=null!=r?r:e instanceof Ve?new ce(e,(e=>this._dataUpdateQueue.push(e,null)),(e=>this._createGraphics3DSymbol(e,t))):this._createGraphics3DSymbol(e,t),this._symbols.set(e.id,i),this._symbolMaterials=null}return null!=i&&++i.referenced,i}trackGraphicState(e){return null==this._graphicStateTracking&&(this._graphicStateTracking=new ge(this)),this._graphicStateTracking.add(e)}_addGraphics3DGraphic(e){this._usedMemory+=e.usedMemory,this.graphics3DGraphics.set(e.graphic.uid,e),this._numberOfGraphics++,e.isElevationSource&&(this._numberOfGraphicsProvidingElevation++,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_removeGraphics3DGraphic(e,t,i=!1){this._usedMemory-=t,this.graphics3DGraphics.delete(e),this._numberOfGraphics--,i&&(this._numberOfGraphicsProvidingElevation--,this.updateStageLayerElevationProvider()),this._updateLayerVisibility()}_createGraphics3DGraphic(e,t){const i=t.graphic;if(this._graphicsWithoutSymbol.delete(i.uid),!this._symbols.has(e.symbol.id))return this.add([i]),null;if(this.graphics3DGraphics.has(i.uid))return null;const r=e.createGraphics3DGraphic(t);if(null==r)return null;this._addGraphics3DGraphic(r);const s=e.symbol.id;this._graphicsBySymbol.has(s)||this._graphicsBySymbol.set(s,new Map),this._graphicsBySymbol.get(s).set(i.uid,r);if(r.isDraped&&this._graphicsDrapedUids.add(i.uid),r.centroid=null,null!=i.geometry&&"point"!==i.geometry.type&&(r.centroid=ue(i.geometry,this._viewSpatialReference)),this._updateUserVisibility(r),null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(r),null!=this._filterVisibility){const{defaultVisibility:e}=this._filterVisibility;r.setVisibilityFlag(se.GRAPHIC,ae.FILTER,e),e||this._filterVisibility.reapply()}this._deconflictor?.addGraphic(r),this._labeler?.addGraphic(r),this._objectStates?.addGraphic(r),r.initialize(this.stageLayer,this.owner),null!=this._graphicStateTracking&&this._graphicStateTracking.addGraphic(r);const a=this._whenGraphics3DGraphicRequests[i.uid];return a&&(delete this._whenGraphics3DGraphicRequests[i.uid],a.resolve(r)),this._symbolMaterials=null,r}_abortRendererChange(){this._rendererChangeAbortController&&(this._rendererChangeAbortController.abort(),this._rendererChangeAbortController=null)}async rendererChange(e){if(this._abortRendererChange(),e!==this.currentRenderer)if(this._validateRenderer(e),null==e&&this._currentRendererChange(null,!1),Q(e))if(e?.arcadeRequired){const t=new AbortController;this._rendererChangeAbortController=t;const{arcadeUtils:i}=await this._ensureArcade();g(t);const r=i.hasGeometryOperations(e);r&&(await i.enableGeometryOperations(),g(t)),this.effectiveUpdatePolicy===we.ASYNC?await this._updateQueue.push((()=>this._currentRendererChange(e,r)),t.signal):this._currentRendererChange(e,r),this._rendererChangeAbortController=null}else if(this.effectiveUpdatePolicy===we.ASYNC){const t=new AbortController;this._rendererChangeAbortController=t,await this._updateQueue.push((()=>this._currentRendererChange(e,!1)),t.signal),this._rendererChangeAbortController=null}else this._currentRendererChange(e,!1);else this._currentRendererChange(e,!1)}async _ensureArcade(){return null==this._arcadeOnDemand?(this._arcadeOnDemand=await Z(),this._arcadeOnDemand):this._arcadeOnDemand}_currentRendererChange(e,t){this.currentRenderer=e,this.rendererHasGeometryOperations=t,this.symbolCreationContext.arcade=this._arcadeOnDemand;const i=this.symbolCreationContext.renderer;if(e===i)return;if(this._symbolConversionCache.clear(),this._unusedSymbolsCache.clear(),null==e)return this.symbolCreationContext.renderer=null,void this.recreateAllGraphicsAndSymbols();const r=x(i,e);this._updateUnchangedSymbolMappings(r,e,i),this.symbolCreationContext.renderer=e,null!=r&&("complete"===r.type?this.recreateAllGraphicsAndSymbols():"partial"===r.type&&(this._applyRendererDiff(r,e,i)?this._labeler?.reset():this.recreateAllGraphicsAndSymbols()),this.notifyChange("averageSymbolComplexity"))}_diffHasSymbolChange(e){for(const t in e.diff)switch(t){case"visualVariables":case"defaultSymbol":case"uniqueValueInfos":break;case"uniqueValueGroups":case"authoringInfo":case"fieldDelimiter":delete e.diff[t];break;default:return!0}return!1}_applySymbolSetDiff(e,t,i){e=e||[],t=t||[];const r=[];for(const s of t){const t=this._graphicsBySymbol.get(s.id);t&&t.forEach(((a,n)=>{const o=a.graphic,l=this.layer instanceof W?this.layer:null,h=this._arcadeOnDemand;if(s===i.defaultSymbol&&i.getSymbol(q(o,l),{arcade:h})===i.defaultSymbol)return;const d=a.usedMemory;e.length||i.defaultSymbol?r.push(o):this._graphicsWithoutSymbol.set(n,o);const p=this.graphics3DGraphics.get(n);this._conditionalRemove(p,n),a.destroy(),t.delete(n),this._removeGraphics3DGraphic(n,d),this._updateLayerVisibility()})),this._whenSymbolRemoved.forAll((e=>e(s.id)))}(e.length||r.length)&&(this._graphicsWithoutSymbol.forEach((e=>r.push(e))),this._graphicsWithoutSymbol.clear(),this.add(r)),this._cleanupSymbols(),this._labeler?.setDirty(),this._deconflictor?.setDirty()}_applyUniqueValueRendererDiff(e,t,i){const r=e.diff.defaultSymbol,a=e.diff.uniqueValueInfos;if(r||a){const n=a?a.added.map((e=>e.symbol)).filter(s):[],o=a?a.removed.map((e=>e.symbol)).filter(s):[];if(a)for(let e=0;e<a.changed.length;e++)n.push(a.changed[e].newValue.symbol),o.push(a.changed[e].oldValue.symbol);return r?(i.defaultSymbol&&o.push(i.defaultSymbol),t.defaultSymbol&&n.push(t.defaultSymbol)):i.defaultSymbol&&n.length&&o.push(t.defaultSymbol),this._applySymbolSetDiff(n,o,t),delete e.diff.defaultSymbol,delete e.diff.uniqueValueInfos,!0}return!1}_calculateUnchangedSymbolMapping(e,t,i){if("unique-value"!==t?.type||"unique-value"!==i?.type||null!=e&&"partial"!==e.type)return[];const r=e=>null!=e?e.id:null,s=e&&e.diff,a=s?.defaultSymbol,n=s&&s.uniqueValueInfos;let o;if(n)o=n.unchanged.map((e=>({oldId:r(e.oldValue.symbol),newId:r(e.newValue.symbol)})));else{o=[];for(const e of i.uniqueValueInfos??[]){const i=r(e.symbol),s=t.uniqueValueInfos?.find((t=>t.value===e.value));s&&i!==r(s.symbol)&&o.push({oldId:i,newId:r(s.symbol)})}}return!a&&i.defaultSymbol&&o.push({oldId:r(i.defaultSymbol),newId:r(t.defaultSymbol)}),o}_updateSymbolMapping(e,t){const i=null!=t&&t?"string"==typeof t?t:t.id:null;if(null==e||e===i)return;const r=this._graphicsBySymbol.get(e);this._graphicsBySymbol.delete(e),void 0!==r&&this._graphicsBySymbol.set(i,r);const s=this._symbols.get(e);if(void 0!==s&&(this._symbols.delete(e),this._symbols.set(i,s),this._symbolMaterials=null,null!=s)){const e="string"==typeof t?null:t;null!=e?s.symbol=e:s.symbol.id=i}}_updateUnchangedSymbolMappings(e,t,i){const r=this._calculateUnchangedSymbolMapping(e,t,i);for(const{oldId:s,newId:a}of r)this._updateSymbolMapping(s,a)}_applyRendererDiff(e,i,r){if(this._diffHasSymbolChange(e))return!1;if(i instanceof t&&r instanceof t&&this._applyUniqueValueRendererDiff(e,i,r)&&0===Object.keys(e.diff).length)return!0;for(const[t]of this._graphicsBySymbol){const r=this._symbols.get(t);if(null!=r)switch(r.applyRendererDiff(e,i)){case me.RecreateSymbol:this._recreateSymbol(t);break;case me.RecreateGraphics:this._recreateGraphicsForSymbol(t);case me.FastUpdate:}}return!0}opacityChange(){this.forEachGraphics3DSymbol(((e,t)=>e.globalPropertyChanged("opacity",t))),this._updateStageLayerVisibility()}_slicePlaneEnabledChange(e){e!==this.symbolCreationContext.slicePlaneEnabled&&(this.symbolCreationContext.slicePlaneEnabled=e,this.stageLayer.sliceable=e,this.forEachGraphics3DSymbol(((e,t)=>e.globalPropertyChanged("slicePlaneEnabled",t))),this._deconflictor?.slicePlaneEnabledChange(),this._labeler?.slicePlaneEnabledChange())}_physicalBasedRenderingChange(e){this.symbolCreationContext.physicalBasedRenderingEnabled=e,this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("physicalBasedRenderingEnabled",t)||this._recreateSymbol(i)}))}_skipHighSymbolLoDsChange(e){this.symbolCreationContext.skipHighSymbolLods=e,this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("skipHighSymbolLods",t)||this._recreateSymbol(i)}))}_pixelRatioChange(){this.forEachGraphics3DSymbol(((e,t,i)=>{e.globalPropertyChanged("pixelRatio",t)||this._recreateSymbol(i)}))}_signalUpdatingDuringAsyncLoadedGraphicsChange(){this._updatingPendingLoadedGraphicsChange&&this._updatingPendingLoadedGraphicsChange.remove(),this._updatingPendingLoadedGraphicsChange=G((()=>{this._updatingPendingLoadedGraphicsChange=null}))}setClippingExtent(e,t){const i=this.symbolCreationContext.clippingExtent,r=z();return Ce(e,r,t)?this.symbolCreationContext.clippingExtent=M(V(),r):this.symbolCreationContext.clippingExtent=null,!T(this.symbolCreationContext.clippingExtent,i)}modifyGraphics3DGraphicVisibilities(e){if(this.destroyed)return;let t=!1;this.graphics3DGraphics.forEach((i=>{e(i)&&(t=!0)})),t&&(this._labeler?.setDirty(),this._deconflictor?.setDirty())}forEachGraphics3DSymbol(e){for(const[t,i]of this._symbols){if(null==i)return;e(i,this._graphicsBySymbol.get(t)||qe,t)}}updateAllGraphicsVisibility(){null!=this._filterVisibility&&this._filterVisibility.reapply(),this.modifyGraphics3DGraphicVisibilities((e=>{const t=this._updateUserVisibility(e),i=null!=this._scaleVisibility&&this._scaleVisibility.updateVisibility(e);return t||i}))}_hideAllGraphics(){this.modifyGraphics3DGraphicVisibilities((e=>e.setVisibilityFlag(se.GRAPHIC,ae.USER,!1)))}_validateRenderer(e){const t=()=>`'${this.layer.title?`${this.layer.title}, `:""}id:${this.layer.id}'`,r=$(e,{geometryType:this.layer?.geometryType,logWarning:e=>i.getLogger(this).warn(`Symbology conversion for layer ${t()}: ${e}`)});if(r){const e=`Renderer for layer ${t} is not supported in a SceneView`;i.getLogger(this).warn(e,r.message)}}_cleanupSymbols(){if(this._graphicsWaitingForSymbol.size>0||this._suspendSymbolCleanup)return;let e=!1;this._symbols.forEach(((t,i)=>{if(null==t||t.referenced>0)return;const r=this._graphicsBySymbol.get(i);r&&0!==r.size||(this._graphicsBySymbol.delete(i),this._symbols.delete(i),this._symbolMaterials=null,this._unusedSymbolsCache.put(i,t,fe(t),c),e=!0)})),e&&(this._recomputeExtentPadding(),this.notifyChange("averageSymbolComplexity"))}get test(){}get performanceInfo(){return new ye(this.graphics3DGraphics.size,this._graphicsWithoutSymbol.size,this._pendingUpdates.size)}};var ke;ze.tmpVec=U(),e([w({readOnly:!0})],ze.prototype,"computedExtent",void 0),e([w()],ze.prototype,"currentRenderer",void 0),e([w()],ze.prototype,"rendererHasGeometryOperations",void 0),e([w()],ze.prototype,"_frameTaskHandle",void 0),e([w()],ze.prototype,"_dataUpdateQueue",void 0),e([w()],ze.prototype,"_updateQueue",void 0),e([w({readOnly:!0})],ze.prototype,"_viewSpatialReference",null),e([w()],ze.prototype,"_rendererChangeAbortController",void 0),e([w()],ze.prototype,"_elevationInfoChangeAbortController",void 0),e([w()],ze.prototype,"_initializeAbortController",void 0),e([w()],ze.prototype,"_elevationAlignment",void 0),e([w()],ze.prototype,"_scaleVisibility",void 0),e([w()],ze.prototype,"_filterVisibility",void 0),e([w()],ze.prototype,"_initializePromise",void 0),e([w()],ze.prototype,"_spatialIndex",void 0),e([w({readOnly:!0})],ze.prototype,"extentPadding",void 0),e([w()],ze.prototype,"_updatingPendingLoadedGraphicsChange",void 0),e([w()],ze.prototype,"_featureStore",void 0),e([w()],ze.prototype,"_objectStates",void 0),e([w()],ze.prototype,"_loadingSymbols",void 0),e([w()],ze.prototype,"preferredUpdatePolicy",void 0),e([w()],ze.prototype,"_forcedUpdatePolicy",void 0),e([w({readOnly:!0})],ze.prototype,"effectiveUpdatePolicy",null),e([w({constructOnly:!0})],ze.prototype,"elevationFeatureExpressionEnabled",void 0),e([w({constructOnly:!0})],ze.prototype,"owner",void 0),e([w({constructOnly:!0})],ze.prototype,"layer",void 0),e([w({constructOnly:!0})],ze.prototype,"graphicSymbolSupported",void 0),e([w({constructOnly:!0})],ze.prototype,"getRenderingInfoWithoutRenderer",void 0),e([w({constructOnly:!0})],ze.prototype,"componentFactories",void 0),e([w({constructOnly:!0})],ze.prototype,"setUidToIdOnAdd",void 0),e([w()],ze.prototype,"featureStore",null),e([w()],ze.prototype,"initializePromise",null),e([w()],ze.prototype,"scaleVisibility",null),e([w()],ze.prototype,"elevationAlignment",null),e([w()],ze.prototype,"objectStates",null),e([w()],ze.prototype,"filterVisibility",null),e([w({readOnly:!0})],ze.prototype,"updating",null),e([w({readOnly:!0})],ze.prototype,"dataUpdating",null),e([w({readOnly:!0})],ze.prototype,"running",null),e([w({readOnly:!0})],ze.prototype,"suspendedOrOutsideOfView",null),e([w({readOnly:!0,dependsOn:[]})],ze.prototype,"updatingRemaining",null),e([w({readOnly:!0})],ze.prototype,"displayFeatureLimit",null),e([w({readOnly:!0,dependsOn:[]})],ze.prototype,"averageSymbolComplexity",null),e([w({constructOnly:!0})],ze.prototype,"hasZ",void 0),e([w({constructOnly:!0})],ze.prototype,"hasM",void 0),e([w()],ze.prototype,"_objectIdField",null),ze=Fe=e([R("esri.views.3d.layers.graphics.Graphics3DCore")],ze),function(e){e[e.NEW=0]="NEW",e[e.LOADING=1]="LOADING",e[e.READY=2]="READY",e[e.REJECTED=3]="REJECTED"}(ke||(ke={}));class We{constructor(){this.add=null,this.renderingInfo=null,this.state=ke.NEW,this.abortController=null,this.remove=null}clear(){this.add=null,this.renderingInfo=null,this.state=ke.NEW,this.abortController=null,this.remove=null}}const He=10,Ne=U(),Be=U(),qe=new Map;export{ze as Graphics3DCore};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{lerp as e,clamp as t}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as i}from"../../../core/unitUtils.js";import{f as r,n as s,m as n,l as a}from"../../../chunks/vec32.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as o}from"../../../geometry/ellipsoidUtils.js";import h from"../../../geometry/Extent.js";import{ViewingMode as l}from"../../ViewingMode.js";import{computeInnerAltitudeFade as x}from"../environment/atmosphereUtils.js";function c(e,t,i){return e===l.Global?new M(i):new u(t,i)}class u{constructor(e,t){this._elevationProvider=e,this._referenceEllipsoid=o(t),this._unitInMeters=i(t,this._referenceEllipsoid.metersPerDegree)}compute(i,a,m,o,l){l||(l={near:0,far:0});let x=i[2]*this._unitInMeters;const c=x,u=x-o,M=this._elevationProvider?.visibleElevationBounds;M&&(x=u>=0?c-this._unitInMeters*M.min:this._unitInMeters*M.max-c);const _={x:(m=null!=m?m:new h({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0})).xmax-m.xmin,y:m.ymax-m.ymin,z:4*Math.max(m.xmax-m.xmin,m.ymax-m.ymin)},I=Math.max(_.x,_.y,_.z);r(E,a,i),v[0]=E[0]>0?m.xmax:m.xmin,v[1]=E[1]>0?m.ymax:m.ymin,v[2]=E[2]>0?I/2:-I/2,r(v,v,i),s(E,E);const j=1.1*n(v,E)*this._unitInMeters,g=Math.sqrt(x*(x+2*this._referenceEllipsoid.radius)),b=Math.max(m.xmax-m.xmin,m.ymax-m.ymin),w=b*d*this._unitInMeters,z=b*y*this._unitInMeters,U=t((x-z)/(w-z),0,1)**3,P=Math.min(e(g,j,U),g)*Math.max(Math.log(Math.abs(u)),1);return f(Math.min(P,Math.max(34064e4,I))/this._unitInMeters,p,this._unitInMeters,l)}}class M{constructor(e){this._referenceEllipsoid=o(e)}compute(i,r,s,n,m){m||(m={near:0,far:0});const o=a(i),h=o-this._referenceEllipsoid.radius,l=this._referenceEllipsoid.radius+Math.min(0,n),c=Math.abs(h-n),u=Math.max(c,Math.abs(h)),M=Math.sqrt(u*(u+2*l)),p=o+this._referenceEllipsoid.radius;return f(1.2*e(M,p,x(u)),t(2e4-(Math.log(u)-7.983)/9.011*19e3,1e3,2e4),1,m)}}function f(e,t,i,r){const s=_/i;return e/t>s?(r.far=e,r.near=r.far/t):(r.near=s,r.far=r.near*t),r}const p=2e4,_=2,d=.001,y=1e-4,v=m(),E=m();export{c as createNearFarHeuristic};
5
+ import{lerp as t,clamp as e}from"../../../core/mathUtils.js";import{getMetersPerUnitForSR as i}from"../../../core/unitUtils.js";import{f as r,n as s,m as n,l as a}from"../../../chunks/vec32.js";import{create as m}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as o}from"../../../geometry/ellipsoidUtils.js";import h from"../../../geometry/Extent.js";import{ViewingMode as l}from"../../ViewingMode.js";import{computeInnerAltitudeFade as x}from"../environment/atmosphereUtils.js";function c(t,e,i){return t===l.Global?new M(i):new u(e,i)}class u{constructor(t,e){this._elevationProvider=t,this._referenceEllipsoid=o(e),this._unitInMeters=i(e,this._referenceEllipsoid.metersPerDegree)}compute(i,a,m,o,l){l||(l={near:0,far:0});let x=i[2]*this._unitInMeters;const c=x,u=x-o,M=this._elevationProvider?.visibleElevationBounds;M&&(x=u>=0?c-this._unitInMeters*M.min:this._unitInMeters*M.max-c);const _={x:(m=null!=m?m:new h({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0})).xmax-m.xmin,y:m.ymax-m.ymin,z:4*Math.max(m.xmax-m.xmin,m.ymax-m.ymin)},I=Math.max(_.x,_.y,_.z);r(E,a,i),v[0]=E[0]>0?m.xmax:m.xmin,v[1]=E[1]>0?m.ymax:m.ymin,v[2]=E[2]>0?I/2:-I/2,r(v,v,i),s(E,E);const j=1.1*n(v,E)*this._unitInMeters,g=Math.sqrt(x*(x+2*this._referenceEllipsoid.radius)),b=Math.max(m.xmax-m.xmin,m.ymax-m.ymin),w=b*d*this._unitInMeters,z=b*y*this._unitInMeters,U=e((x-z)/(w-z),0,1)**3,P=Math.min(t(g,j,U),g)*Math.max(Math.log(Math.abs(u)),1);return f(Math.min(P,Math.max(34064e4,I))/this._unitInMeters,p,this._unitInMeters,l)}}class M{constructor(t){this._referenceEllipsoid=o(t)}compute(i,r,s,n,m){m||(m={near:0,far:0});const o=a(i),h=o-this._referenceEllipsoid.radius,l=this._referenceEllipsoid.radius+Math.min(0,n),c=Math.abs(h-n),u=Math.max(c,Math.abs(h)),M=Math.sqrt(u*(u+2*l)),p=o+this._referenceEllipsoid.radius;return f(1.2*t(M,p,x(u)),e(2e4-(Math.log(u)-7.983)/9.011*19900,100,2e4),1,m)}}function f(t,e,i,r){const s=_/i;return t/e>s?(r.far=t,r.near=r.far/e):(r.near=s,r.far=r.near*e),r}const p=2e4,_=2,d=.001,y=1e-4,v=m(),E=m();export{c as createNearFarHeuristic};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t}from"../../../../../core/mathUtils.js";import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{createUintArray as n}from"../../lib/triangleIntersectionUtils.js";class i{constructor(t,n){this.elementCount=t,this.model=n,this._elementIndexMap=null,this._bspNodes=[],this._generatedBVH=!1,this.localMode=n.localMode,this.planetCenterZ=n.planetCenterZ,this.geometryMinZ=n.geometryMinZ,this.planetCenter=e(0,0,this.planetCenterZ),this.maxBspNodeDepth=n.maxBspNodeDepth??8,this.minElementCountForBVH=n.minElementCountForBVH??15,this.minBspNodeElementCount=n.minBspNodeElementCount??5}get elementIndexMap(){return this._ensureBVH(),this._elementIndexMap}_ensureBVH(){if(this._generatedBVH)return;const{elementCount:t}=this;t<this.minElementCountForBVH||0===this._bspNodes.length&&this._generateBsp()}intersectRay(t,e,n){const{elementCount:i}=this;i<1||(i<this.minElementCountForBVH?this._intersectRayWithoutBVH(n):this._intersectRayWithBVH(t,e,n))}_intersectRayWithoutBVH(t){this._intersectRange(0,this.elementCount)}_intersectRange(t,e){this.model.intersectRange(t,e)}_intersectRayWithBVH(t,e,n){this._ensureBVH(),n?this._intersectGeometryWithBVHVerticalRay(t):this._intersectGeometryWithBVHGeneralRay(t,e)}_intersectGeometryWithBVHVerticalRay(t){let e=t[0],n=t[1];if(!this.localMode){const{geometryMinZ:i,planetCenterZ:s}=this,h=(i-s)/(t[2]-s);e=t[0]*h,n=t[1]*h}const{_bspNodes:i}=this;let s=0;for(;s>=0;){const t=i[s],{d:h,dim:o,minIndexIndex:a,minMidIndexIndex:r,maxMidIndexIndex:c,maxIndexIndex:m,aabb2D:d}=t;if(e<d[0]||e>d[2]||n<d[1]||n>d[3])break;if(-1===o||-1===t.child0&&-1===t.child1){this._intersectRange(a,m);break}{this._intersectRange(r,c);const i=(0===o?e:n)-h;if(i<0){if(-1===t.child0){this._intersectRange(a,r);break}s=t.child0}else{if(!(i>0))break;if(-1===t.child1){this._intersectRange(c,m);break}s=t.child1}}}}_intersectGeometryWithBVHGeneralRay(e,n){let i=e[0],s=e[1],h=n[0],o=n[1];const{geometryMinZ:a}=this;if(!this.localMode){let t=0,r=1;const c=Math.min(.5*this.planetCenterZ,a),m=e[2],d=n[2];if(m<c&&d<c)return;if(m<c&&(t=(c-m)/(d-m)),d<c&&(r=(c-m)/(d-m)),t>r)return;const l=(1-t)*e[0]+t*n[0],x=(1-t)*e[1]+t*n[1],u=(1-t)*e[2]+t*n[2],M=(1-r)*e[0]+r*n[0],p=(1-r)*e[1]+r*n[1],f=(1-r)*e[2]+r*n[2],{planetCenterZ:g}=this,_=a-g,I=_/(u-g);i=l*I,s=x*I;const B=_/(f-g);h=M*B,o=p*B}const r=h-i,c=o-s,m=this._bspNodes,d=[0,0,1];let l=0;for(;l<d.length;){const e=d[l];let n=d[l+1],h=d[l+2];if(l+=3,n>h)continue;const o=m[e],{minIndexIndex:a,maxIndexIndex:x}=o,{child0:u,child1:M,minMidIndexIndex:p,maxMidIndexIndex:f,aabb2D:g,d:_,dim:I}=o;{const t=i+n*r,e=i+h*r,s=Math.min(t,e),o=Math.max(t,e),a=g[0],c=g[2];if(o<a||c<s)continue;if(s<a){const t=(a-i)/r;r>0?n=Math.max(n,t):h=Math.min(h,t)}if(c<o){const t=(c-i)/r;r>0?h=Math.min(h,t):n=Math.max(n,t)}}{const t=s+n*c,e=s+h*c,i=Math.min(t,e),o=Math.max(t,e),a=g[1],r=g[3];if(o<a||r<i)continue;if(i<a){const t=(a-s)/c;c>0?n=Math.max(n,t):h=Math.min(h,t)}if(r<o){const t=(r-s)/c;c>0?h=Math.min(h,t):n=Math.max(n,t)}}if(-1===u&&-1===M)this._intersectRange(a,x);else{const e=0===I?i:s,o=0===I?r:c,m=e+n*o,l=e+h*o,g=Math.min(m,l),B=Math.max(m,l),b=t((_-e)/o,0,1);a<p&&g<=_&&(-1!==u?(d.push(u),d.push(o>=0?n:Math.max(n,b)),d.push(o>=0?Math.min(h,b):h)):this._intersectRange(a,p)),this._intersectRange(p,f),f<x&&_<=B&&(-1!==M?(d.push(M),d.push(o>=0?Math.max(n,b):n),d.push(o>=0?h:Math.min(h,b))):this._intersectRange(f,x))}}}_generateBsp(){const{elementCount:t}=this;if(t<1)return;const e=n(t,t);this._elementIndexMap=e;for(let n=0;n<t;++n)e[n]=n;const i=this.model.getAabbs2D();let a=0;const m=this._bspNodes;m.length=0;const{localMode:d}=this;let l=!1;if(!d){const{planetCenterZ:t,geometryMinZ:e}=this;l=t>=0||e<.5*t}const x=[],u=(t,e,n,i,s)=>{x.push(t),x.push(e),x.push(n),x.push(i<0?-1:(s?0:1)+2*i)},{maxBspNodeDepth:M,minBspNodeElementCount:p}=this,f=(t,n,a,x,f)=>{const g=m.length;if(g>0&&(l||a>=M||n-t<p))return;const _=[0,0,0,0];r(_,t,n,e,i);const{d:I,dim:B}=d?s(_):h(_),{rangeMidStart:b,rangeMidEnd:C}=o(t,n,B,I,e,i),R=a===M-1,V=!R&&b>=t+p,y=!R&&n>=C+p;if(V||y||0===g){const e=new c(t,b,C,n,B,I,_);if(V&&u(t,b,a+1,g,!0),y&&u(C,n,a+1,g,!1),m.push(e),-1!==x){const t=m[x];f?t.child0=g:t.child1=g}}};for(u(0,t,0,-1,!1);a<x.length;){const t=x[a],e=x[a+1],n=x[a+2],i=x[a+3];a+=4;const s=i>>1;f(t,e,n,s,i-(s<<1)==0)}this._generatedBVH=!0}}function s(t){const e=t[0],n=t[1],i=t[2],s=t[3];let h,o;return i-e>=s-n?(o=.5*(e+i),h=0):(o=.5*(n+s),h=1),{d:o,dim:h}}function h(t){const e=t[0],n=t[1],i=t[2],s=t[3];let h,o;return i-e>=s-n?(h=0,o=.5*(e+i)):(h=1,o=.5*(n+s)),{dim:h,d:o}}function o(t,e,n,i,s,h){let o=t;{let t=e;for(;o<t;){const e=s[o];a(e,n,i,h)<0?++o:(--t,s[o]=s[t],s[t]=e)}}const r=o;let c=o,m=e;for(;c<m;){const t=s[m-1];a(t,n,i,h)>0?--m:(s[m-1]=s[c],s[c]=t,++c)}return{rangeMidStart:r,rangeMidEnd:m}}function a(t,e,n,i){const s=4*t,h=i[s+0+e];return i[s+2+e]<n?-1:h>n?1:0}function r(t,e,n,i,s){let h=1/0,o=1/0,a=-1/0,r=-1/0;for(let c=e;c<n;++c){const t=4*i[c];h=Math.min(h,s[t+0]),o=Math.min(o,s[t+1]),a=Math.max(a,s[t+2]),r=Math.max(r,s[t+3])}t[0]=h,t[1]=o,t[2]=a,t[3]=r}class c{constructor(t,e,n,i,s,h,o){this.minIndexIndex=t,this.minMidIndexIndex=e,this.maxMidIndexIndex=n,this.maxIndexIndex=i,this.dim=s,this.d=h,this.aabb2D=o,this.child0=-1,this.child1=-1}}export{i as ElevationAgnosticBVH};
5
+ import{clamp as t}from"../../../../../core/mathUtils.js";import{fromValues as e}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{createUintArray as n}from"../../lib/triangleIntersectionUtils.js";class i{constructor(t,n){this.elementCount=t,this.model=n,this._elementIndexMap=null,this._bspNodes=[],this._generatedBVH=!1,this.localMode=n.localMode,this.planetCenterZ=n.planetCenterZ,this.geometryMinZ=n.geometryMinZ,this.planetCenter=e(0,0,this.planetCenterZ),this.maxBspNodeDepth=n.maxBspNodeDepth??8,this.minElementCountForBVH=n.minElementCountForBVH??15,this.minBspNodeElementCount=n.minBspNodeElementCount??5}get elementIndexMap(){return this._ensureBVH(),this._elementIndexMap}get _skipBVH(){return this.elementCount<this.minElementCountForBVH||this.geometryMinZ<.5*this.planetCenterZ}_ensureBVH(){this._generatedBVH||this._skipBVH||0===this._bspNodes.length&&this._generateBsp()}intersectRay(t,e,n){this.elementCount<1||(this._skipBVH?this._intersectRayWithoutBVH(n):this._intersectRayWithBVH(t,e,n))}_intersectRayWithoutBVH(t){this._intersectRange(0,this.elementCount)}_intersectRange(t,e){this.model.intersectRange(t,e)}_intersectRayWithBVH(t,e,n){this._ensureBVH(),n?this._intersectGeometryWithBVHVerticalRay(t):this._intersectGeometryWithBVHGeneralRay(t,e)}_intersectGeometryWithBVHVerticalRay(t){let e=t[0],n=t[1];if(!this.localMode){const{geometryMinZ:i,planetCenterZ:s}=this,h=(i-s)/(t[2]-s);e=t[0]*h,n=t[1]*h}const{_bspNodes:i}=this;let s=0;for(;s>=0;){const t=i[s],{d:h,dim:a,minIndexIndex:o,minMidIndexIndex:r,maxMidIndexIndex:c,maxIndexIndex:m,aabb2D:l}=t;if(e<l[0]||e>l[2]||n<l[1]||n>l[3])break;if(-1===a||-1===t.child0&&-1===t.child1){this._intersectRange(o,m);break}{this._intersectRange(r,c);const i=(0===a?e:n)-h;if(i<0){if(-1===t.child0){this._intersectRange(o,r);break}s=t.child0}else{if(!(i>0))break;if(-1===t.child1){this._intersectRange(c,m);break}s=t.child1}}}}_intersectGeometryWithBVHGeneralRay(e,n){let i=e[0],s=e[1],h=n[0],a=n[1];const{geometryMinZ:o}=this;if(!this.localMode){let t=0,r=1;const c=Math.min(.5*this.planetCenterZ,o),m=e[2],l=n[2];if(m<c&&l<c)return;if(m<c&&(t=(c-m)/(l-m)),l<c&&(r=(c-m)/(l-m)),t>r)return;const d=(1-t)*e[0]+t*n[0],M=(1-t)*e[1]+t*n[1],x=(1-t)*e[2]+t*n[2],u=(1-r)*e[0]+r*n[0],p=(1-r)*e[1]+r*n[1],f=(1-r)*e[2]+r*n[2],{planetCenterZ:_}=this,g=o-_,I=g/(x-_);i=d*I,s=M*I;const B=g/(f-_);h=u*B,a=p*B}const r=h-i,c=a-s,m=this._bspNodes;let l=1;{const{aabb2D:t}=m[0],e=(t,e,n,i)=>{if(Math.abs(e)<1e-5*Math.max(i-n,1))return!1;const s=e>0,h=s?i:n,a=t+l*e;return(s?a<h:a>h)&&(l=Math.max((h-t)/e,l),!0)},n=()=>e(i,r,t[0],t[2]),h=()=>e(s,c,t[1],t[3]);Math.abs(r)>=Math.abs(c)?n()||h():h()||n()}const d=[0,0,l];let M=0;for(;M<d.length;){const e=d[M];let n=d[M+1],h=d[M+2];if(M+=3,n>h)continue;const a=m[e],{minIndexIndex:o,maxIndexIndex:x}=a,{child0:u,child1:p,minMidIndexIndex:f,maxMidIndexIndex:_,aabb2D:g,d:I,dim:B}=a;{const t=i+n*r,e=i+h*r,s=Math.min(t,e),a=Math.max(t,e),o=g[0],c=g[2];if(a<o||c<s)continue;if(s<o){const t=(o-i)/r;r>0?n=Math.max(n,t):h=Math.min(h,t)}if(c<a){const t=(c-i)/r;r>0?h=Math.min(h,t):n=Math.max(n,t)}}{const t=s+n*c,e=s+h*c,i=Math.min(t,e),a=Math.max(t,e),o=g[1],r=g[3];if(a<o||r<i)continue;if(i<o){const t=(o-s)/c;c>0?n=Math.max(n,t):h=Math.min(h,t)}if(r<a){const t=(r-s)/c;c>0?h=Math.min(h,t):n=Math.max(n,t)}}if(-1===u&&-1===p)this._intersectRange(o,x);else{const e=0===B?i:s,a=0===B?r:c,m=e+n*a,M=e+h*a,g=Math.min(m,M),b=Math.max(m,M),V=t((I-e)/a,0,l);o<f&&g<=I&&(-1!==u?(d.push(u),d.push(a>=0?n:Math.max(n,V)),d.push(a>=0?Math.min(h,V):h)):this._intersectRange(o,f)),this._intersectRange(f,_),_<x&&I<=b&&(-1!==p?(d.push(p),d.push(a>=0?Math.max(n,V):n),d.push(a>=0?h:Math.min(h,V))):this._intersectRange(_,x))}}}_generateBsp(){const{elementCount:t}=this;if(t<1)return;const e=n(t,t);this._elementIndexMap=e;for(let n=0;n<t;++n)e[n]=n;const i=this.model.getAabbs2D();let o=0;const m=this._bspNodes;m.length=0;const{localMode:l}=this;let d=!1;if(!l){const{planetCenterZ:t,geometryMinZ:e}=this;d=t>=0||e<.5*t}const M=[],x=(t,e,n,i,s)=>{M.push(t),M.push(e),M.push(n),M.push(i<0?-1:(s?0:1)+2*i)},{maxBspNodeDepth:u,minBspNodeElementCount:p}=this,f=(t,n,o,M,f)=>{const _=m.length;if(_>0&&(d||o>=u||n-t<p))return;const g=[0,0,0,0];r(g,t,n,e,i);const{d:I,dim:B}=l?s(g):h(g),{rangeMidStart:b,rangeMidEnd:V}=a(t,n,B,I,e,i),C=o===u-1,H=!C&&b>=t+p,R=!C&&n>=V+p;if(H||R||0===_){const e=new c(t,b,V,n,B,I,g);if(H&&x(t,b,o+1,_,!0),R&&x(V,n,o+1,_,!1),m.push(e),-1!==M){const t=m[M];f?t.child0=_:t.child1=_}}};for(x(0,t,0,-1,!1);o<M.length;){const t=M[o],e=M[o+1],n=M[o+2],i=M[o+3];o+=4;const s=i>>1;f(t,e,n,s,i-(s<<1)==0)}this._generatedBVH=!0}}function s(t){const e=t[0],n=t[1],i=t[2],s=t[3];let h,a;return i-e>=s-n?(a=.5*(e+i),h=0):(a=.5*(n+s),h=1),{d:a,dim:h}}function h(t){const e=t[0],n=t[1],i=t[2],s=t[3];let h,a;return i-e>=s-n?(h=0,a=.5*(e+i)):(h=1,a=.5*(n+s)),{dim:h,d:a}}function a(t,e,n,i,s,h){let a=t;{let t=e;for(;a<t;){const e=s[a];o(e,n,i,h)<0?++a:(--t,s[a]=s[t],s[t]=e)}}const r=a;let c=a,m=e;for(;c<m;){const t=s[m-1];o(t,n,i,h)>0?--m:(s[m-1]=s[c],s[c]=t,++c)}return{rangeMidStart:r,rangeMidEnd:m}}function o(t,e,n,i){const s=4*t,h=i[s+0+e];return i[s+2+e]<n?-1:h>n?1:0}function r(t,e,n,i,s){let h=1/0,a=1/0,o=-1/0,r=-1/0;for(let c=e;c<n;++c){const t=4*i[c];h=Math.min(h,s[t+0]),a=Math.min(a,s[t+1]),o=Math.max(o,s[t+2]),r=Math.max(r,s[t+3])}t[0]=h,t[1]=a,t[2]=o,t[3]=r}class c{constructor(t,e,n,i,s,h,a){this.minIndexIndex=t,this.minMidIndexIndex=e,this.maxMidIndexIndex=n,this.maxIndexIndex=i,this.dim=s,this.d=h,this.aabb2D=a,this.child0=-1,this.child1=-1}}export{i as ElevationAgnosticBVH};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import{MultiOriginJSONSupport as t}from"../../core/MultiOriginJSONSupport.js";import{whenOnce as o}from"../../core/reactiveUtils.js";import{hasSameCanonicalPortal as a,urlToObject as r}from"../../core/urlUtils.js";import{updateOrigins as i}from"../../core/accessorSupport/originUtils.js";import n from"../../geometry/SpatialReference.js";import{equals as s}from"../../geometry/support/spatialReferenceUtils.js";import{webMercatorToGeographic as l}from"../../geometry/support/webMercatorUtils.js";import{isServerOrServicesAGOLUrl as p}from"../../layers/support/arcgisLayerUrl.js";import{isLayerWithFeatureLayerSource as c,isFeatureCollectionLayer as m}from"../../layers/support/layerUtils.js";import u from"../../portal/Portal.js";import f from"../../portal/PortalItem.js";import{createForItemWrite as d}from"../../portal/support/jsonContext.js";import{typeKeyword as y,removeTypeKeyword as w,addTypeKeyword as g,hasTypeKeyword as h}from"../../portal/support/portalItemUtils.js";import{project as _}from"../../rest/geometryService/project.js";import v from"../../rest/support/ProjectParameters.js";import{hasDeveloperBasemapLayer as b,findSpatialReference as j,isDeveloperBasemapLayer as R}from"../../support/basemapUtils.js";import{saveResources as I}from"./resourceUtils.js";import{validateSaveAPIKey as P}from"./saveAPIKeyUtils.js";import{beforeSave as W,evaluateWriteErrors as S}from"./saveUtils.js";const A=["NatGeo_World_Map","Ocean_Basemap","USA_Topo_Maps","World_Imagery","World_Street_Map","World_Terrain_Base","World_Topo_Map","World_Hillshade","Canvas/World_Light_Gray_Base","Canvas/World_Light_Gray_Reference","Canvas/World_Dark_Gray_Base","Canvas/World_Dark_Gray_Reference","Ocean/World_Ocean_Base","Ocean/World_Ocean_Reference","Reference/World_Boundaries_and_Places","Reference/World_Reference_Overlay","Reference/World_Transportation"].map((e=>e.toLowerCase()));async function U(e,t,a){a??={},C(e,t),await o((()=>!t.updatingFromView)),await t.load(),await V(t),await W(t),await E(e,t);const r=t.portalItem,{json:i,jsonContext:n}=await O(t,r);return S(n,{errorName:`${e.name}:save`},a),await G(t,r),await we(e,t,r,i,n),await Promise.all([t.updateItemThumbnail(),I(t.resourceReferences,n)]),r}async function O(e,t){const o=d(t,"web-map",!0),a=e.write({},o);return await Promise.all(o.resources.pendingOperations),{json:a,jsonContext:o}}async function T(e,t,a,r){r??={};const i=L(e,a);await o((()=>!t.updatingFromView)),await t.load(),D(e,t),await V(t),await W(t),await E(e,t);const{json:n,jsonContext:s}=await O(t,i);S(s,{errorName:`${e.name}:save`},r),await Z(t,i);const l=t.getThumbnailState();return await ge(e,t,i,n,s,r)&&(t.resourceReferences.portalItem=i),t.restoreThumbnailFromState(l),await Promise.all([t.updateItemThumbnail(),I(t.resourceReferences,s)]),i}function C(t,o){if(!o.portalItem)throw new e(`${t.name}:portal-item-not-set`,"Portal item to save to has not been set on the WebMap");P(o.portalItem),M(t,o.portalItem)}function M(t,o){if(o.type!==t.itemType)throw new e(`${t.name}:portal-item-wrong-type`,`Portal item needs to have type "${t.itemType}"`)}function D(t,o){const a=o.allLayers.filter((e=>"unsupported"===e.type&&"KnowledgeGraphLayer"===e.resourceInfo?.layerType));if(a.length)throw new e(`${t.name}:save-as-invalid-configuration`,`Failed to save a copy of ${t.name} to prevent persisting invalid configuration. See 'details.layers'`,{layers:a.toArray()})}async function E(t,a){if(!a.basemap?.baseLayers.length)throw new e(`${t.name}:save`,"Map does not have a valid basemap with a base layer.");let r=null;if(await o((()=>{const e=j(a.initialViewProperties,a.basemap);return r=e.spatialReference,!e.updating})),!s(r,a.initialViewProperties.spatialReference))throw new e(`${t.name}:save`,"The spatial reference of the basemap is not compatible with the one from the map.",{expected:a.initialViewProperties.spatialReference,actual:r})}function L(e,t){let o=f.from(t);return o.id&&(o=o.clone(),o.id=null),o.type||(o.type=e.itemType),o.portal||(o.portal=u.getDefault()),P(o),M(e,o),o}function V(e){const t=[];return e.basemap&&t.push(e.basemap.load()),e.ground&&t.push(e.ground.load()),Promise.allSettled(t).then((()=>{}))}async function G(e,t){t.extent=await me(e.portalItem,e.initialViewProperties.viewpoint.targetGeometry),await ee(e,t)}const $=y.JSAPI,x="CollectorDisabled",k="Collector",B="Data Editing",N="OfflineDisabled",K="Offline",F="Workforce Project",H="Workforce Worker",J="Workforce Dispatcher",q="Offline Map Areas",z="FieldMapsDisabled",Q=y.DEVELOPER_BASEMAP,X="UtilityNetwork",Y="IPS";async function Z(e,t){w(t,x),w(t,z),w(t,y.METADATA),w(t,N),w(t,q),w(t,J),w(t,F),w(t,H),await G(e,t)}async function ee(e,t){g(t,$),await te(e),ie(e,t),ne(e,t),se(e,t),le(e,t),pe(e,t),ce(e,t),t.typeKeywords&&(t.typeKeywords=t.typeKeywords.filter(((e,t,o)=>o.indexOf(e)===t)))}function te(e){const t=oe(e).map((e=>e.load())).toArray();return Promise.allSettled(t).then((()=>{}))}function oe(e){return e.allLayers.concat(e.allTables)}function ae(e){return oe(e).some((e=>e.loaded&&c(e)&&e.capabilities.operations.supportsEditing&&e.editingEnabled&&("subtype-group"!==e.type||e.sublayers.some((e=>e.editingEnabled)))))}function re(e){return oe(e).filter((e=>"group"!==e.type)).every((t=>t.loaded&&de(e,t)))}function ie(e,t){h(t,x)||h(t,F)||h(t,H)||h(t,J)||!ae(e)?w(t,k):g(t,k)}function ne(e,t){ae(e)?g(t,B):w(t,B)}function se(e,t){!h(t,N)&&re(e)?g(t,K):w(t,K)}function le(e,t){b(e.basemap)?g(t,Q):w(t,Q)}function pe(e,t){e.utilityNetworks?.length?g(t,X):w(t,X)}function ce(e,t){e.ipsInfo?g(t,Y):w(t,Y)}async function me(e,t){const o=t.clone().normalize();let a;if(o.length>1)for(const r of o)a?r.width>a.width&&(a=r):a=r;else a=o[0];return ue(e,a)}async function ue(e,t){const o=t.spatialReference;if(o.isWGS84)return t.clone();if(o.isWebMercator)return l(t);const{getGeometryServiceURL:a}=await import("../../portal/support/geometryServiceUtils.js"),r=await a(e),i=new v({geometries:[t],outSpatialReference:n.WGS84});return(await _(r,i))[0]}function fe(e){return m(e)||"map-notes"===e.type||"route"===e.type}function de(e,t){return c(t)&&t.capabilities.operations.supportsSync||fe(t)&&!t.portalItem||("tile"===t.type||"vector-tile"===t.type)&&(t.capabilities.operations.supportsExportTiles||ye(t)||R(t))&&t.spatialReference.equals(e.initialViewProperties.spatialReference)}function ye(e){return"tile"===e.type&&(p(e.url)&&A.some((t=>e.url?.toLowerCase().includes("/"+t+"/"))))}async function we(e,t,o,a,r){await o.update({data:a}),ve(e,t,o,a,r)}async function ge(t,o,a,r,i,n){const s=o.portalItem,l={item:s,authenticated:!(!s?.id||!s.portal.user)},p=a.portal;await p.signIn();const{copyAllowed:c,itemReloaded:m}=await he(l,p);if(l.authenticated||=m,!c)throw new e(`${t.name}:save-as-copy-not-allowed`,"Owner of this map does not allow others to save a copy");const u=await _e(a,l,r,n);return o.portalItem=a,ve(t,o,a,r,i),u}async function he(e,t){const{item:o,authenticated:a}=e;return o?.id&&o.typeKeywords?.includes("useOnly")?o.portal.portalHostname!==t.portalHostname?{copyAllowed:!1,itemReloaded:!1}:(a||await o.reload(),{copyAllowed:"admin"===o.itemControl||"update"===o.itemControl,itemReloaded:!0}):{copyAllowed:!0,itemReloaded:!1}}async function _e(e,t,o,r){const i=e.portal,{item:n}=t,{folder:s,copyAllResources:l}=r;let p=!1;if(l&&n?.id&&a(n.portal.url,i.url)&&parseInt(n.portal.currentVersion,10)>=2023){const{total:e}=await n.fetchResources();p=!!e}if(p){const t=await n.copy({copyResources:"all",folder:s});e.id=t.id,e.portal=t.portal;const a=e.toJSON();await e.load(),e.read(a),await e.update({data:o})}else await(i.user?.addItem({item:e,folder:s,data:o}));return p}function ve(e,o,a,n,s){t.prototype.read.call(o,{version:n.version,authoringApp:n.authoringApp,authoringAppVersion:n.authoringAppVersion},{origin:e.origin,ignoreDefaults:!0,url:a.itemUrl?r(a.itemUrl):void 0}),i(s),o.resourceInfo=n}export{O as createJSON,U as save,T as saveAs};
5
+ import e from"../../core/Error.js";import{MultiOriginJSONSupport as t}from"../../core/MultiOriginJSONSupport.js";import{whenOnce as o}from"../../core/reactiveUtils.js";import{hasSameCanonicalPortal as r,urlToObject as a}from"../../core/urlUtils.js";import{updateOrigins as i}from"../../core/accessorSupport/originUtils.js";import n from"../../geometry/SpatialReference.js";import{equals as s}from"../../geometry/support/spatialReferenceUtils.js";import{webMercatorToGeographic as l}from"../../geometry/support/webMercatorUtils.js";import{isServerOrServicesAGOLUrl as p}from"../../layers/support/arcgisLayerUrl.js";import{isLayerWithFeatureLayerSource as c,isFeatureCollectionLayer as m}from"../../layers/support/layerUtils.js";import u from"../../portal/Portal.js";import f from"../../portal/PortalItem.js";import{createForItemWrite as d}from"../../portal/support/jsonContext.js";import{typeKeyword as w,removeTypeKeyword as y,addTypeKeyword as h,hasTypeKeyword as g}from"../../portal/support/portalItemUtils.js";import{project as _}from"../../rest/geometryService/project.js";import b from"../../rest/support/ProjectParameters.js";import{hasDeveloperBasemapLayer as j,findSpatialReference as R,isDeveloperBasemapLayer as v}from"../../support/basemapUtils.js";import{saveResources as P}from"./resourceUtils.js";import{validateSaveAPIKey as W}from"./saveAPIKeyUtils.js";import{beforeSave as I,evaluateWriteErrors as S}from"./saveUtils.js";const A=["NatGeo_World_Map","Ocean_Basemap","USA_Topo_Maps","World_Imagery","World_Street_Map","World_Terrain_Base","World_Topo_Map","World_Hillshade","Canvas/World_Light_Gray_Base","Canvas/World_Light_Gray_Reference","Canvas/World_Dark_Gray_Base","Canvas/World_Dark_Gray_Reference","Ocean/World_Ocean_Base","Ocean/World_Ocean_Reference","Reference/World_Boundaries_and_Places","Reference/World_Reference_Overlay","Reference/World_Transportation"].map((e=>e.toLowerCase()));async function U(e,t,r){r??={},C(e,t),await o((()=>!t.updatingFromView)),await t.load(),await V(t),await I(t),await D(e,t);const a=t.portalItem,{json:i,jsonContext:n}=await O(t,a);return S(n,{errorName:`${e.name}:save`},r),await x(t,a),await we(e,t,a,i,n),await Promise.all([t.updateItemThumbnail(),P(t.resourceReferences,n)]),a}async function O(e,t){const o=d(t,"web-map",!0),r=e.write({},o);return await Promise.all(o.resources.pendingOperations),{json:r,jsonContext:o}}async function T(e,t,r,a){a??={};const i=E(e,r);await o((()=>!t.updatingFromView)),await t.load(),await V(t),await I(t),await D(e,t);const{json:n,jsonContext:s}=await O(t,i);S(s,{errorName:`${e.name}:save`},a),await Y(t,i);const l=t.getThumbnailState();return await ye(e,t,i,n,s,a)&&(t.resourceReferences.portalItem=i),t.restoreThumbnailFromState(l),await Promise.all([t.updateItemThumbnail(),P(t.resourceReferences,s)]),i}function C(t,o){if(!o.portalItem)throw new e(`${t.name}:portal-item-not-set`,"Portal item to save to has not been set on the WebMap");W(o.portalItem),M(t,o.portalItem)}function M(t,o){if(o.type!==t.itemType)throw new e(`${t.name}:portal-item-wrong-type`,`Portal item needs to have type "${t.itemType}"`)}async function D(t,r){if(!r.basemap?.baseLayers.length)throw new e(`${t.name}:save`,"Map does not have a valid basemap with a base layer.");let a=null;if(await o((()=>{const e=R(r.initialViewProperties,r.basemap);return a=e.spatialReference,!e.updating})),!s(a,r.initialViewProperties.spatialReference))throw new e(`${t.name}:save`,"The spatial reference of the basemap is not compatible with the one from the map.",{expected:r.initialViewProperties.spatialReference,actual:a})}function E(e,t){let o=f.from(t);return o.id&&(o=o.clone(),o.id=null),o.type||(o.type=e.itemType),o.portal||(o.portal=u.getDefault()),W(o),M(e,o),o}function V(e){const t=[];return e.basemap&&t.push(e.basemap.load()),e.ground&&t.push(e.ground.load()),Promise.allSettled(t).then((()=>{}))}async function x(e,t){t.extent=await ce(e.portalItem,e.initialViewProperties.viewpoint.targetGeometry),await Z(e,t)}const G=w.JSAPI,L="CollectorDisabled",k="Collector",$="Data Editing",B="OfflineDisabled",N="Offline",K="Workforce Project",F="Workforce Worker",H="Workforce Dispatcher",J="Offline Map Areas",q="FieldMapsDisabled",z=w.DEVELOPER_BASEMAP,Q="UtilityNetwork",X="IPS";async function Y(e,t){y(t,L),y(t,q),y(t,w.METADATA),y(t,B),y(t,J),y(t,H),y(t,K),y(t,F),await x(e,t)}async function Z(e,t){h(t,G),await ee(e),ae(e,t),ie(e,t),ne(e,t),se(e,t),le(e,t),pe(e,t),t.typeKeywords&&(t.typeKeywords=t.typeKeywords.filter(((e,t,o)=>o.indexOf(e)===t)))}function ee(e){const t=te(e).map((e=>e.load())).toArray();return Promise.allSettled(t).then((()=>{}))}function te(e){return e.allLayers.concat(e.allTables)}function oe(e){return te(e).some((e=>e.loaded&&c(e)&&e.capabilities.operations.supportsEditing&&e.editingEnabled&&("subtype-group"!==e.type||e.sublayers.some((e=>e.editingEnabled)))))}function re(e){return te(e).filter((e=>"group"!==e.type)).every((t=>t.loaded&&fe(e,t)))}function ae(e,t){g(t,L)||g(t,K)||g(t,F)||g(t,H)||!oe(e)?y(t,k):h(t,k)}function ie(e,t){oe(e)?h(t,$):y(t,$)}function ne(e,t){!g(t,B)&&re(e)?h(t,N):y(t,N)}function se(e,t){j(e.basemap)?h(t,z):y(t,z)}function le(e,t){e.utilityNetworks?.length?h(t,Q):y(t,Q)}function pe(e,t){e.ipsInfo?h(t,X):y(t,X)}async function ce(e,t){const o=t.clone().normalize();let r;if(o.length>1)for(const a of o)r?a.width>r.width&&(r=a):r=a;else r=o[0];return me(e,r)}async function me(e,t){const o=t.spatialReference;if(o.isWGS84)return t.clone();if(o.isWebMercator)return l(t);const{getGeometryServiceURL:r}=await import("../../portal/support/geometryServiceUtils.js"),a=await r(e),i=new b({geometries:[t],outSpatialReference:n.WGS84});return(await _(a,i))[0]}function ue(e){return m(e)||"map-notes"===e.type||"route"===e.type}function fe(e,t){return c(t)&&t.capabilities.operations.supportsSync||ue(t)&&!t.portalItem||("tile"===t.type||"vector-tile"===t.type)&&(t.capabilities.operations.supportsExportTiles||de(t)||v(t))&&t.spatialReference.equals(e.initialViewProperties.spatialReference)}function de(e){return"tile"===e.type&&(p(e.url)&&A.some((t=>e.url?.toLowerCase().includes("/"+t+"/"))))}async function we(e,t,o,r,a){await o.update({data:r}),_e(e,t,o,r,a)}async function ye(t,o,r,a,i,n){const s=o.portalItem,l={item:s,authenticated:!(!s?.id||!s.portal.user)},p=r.portal;await p.signIn();const{copyAllowed:c,itemReloaded:m}=await he(l,p);if(l.authenticated||=m,!c)throw new e(`${t.name}:save-as-copy-not-allowed`,"Owner of this map does not allow others to save a copy");const u=await ge(r,l,a,n);return o.portalItem=r,_e(t,o,r,a,i),u}async function he(e,t){const{item:o,authenticated:r}=e;return o?.id&&o.typeKeywords?.includes("useOnly")?o.portal.portalHostname!==t.portalHostname?{copyAllowed:!1,itemReloaded:!1}:(r||await o.reload(),{copyAllowed:"admin"===o.itemControl||"update"===o.itemControl,itemReloaded:!0}):{copyAllowed:!0,itemReloaded:!1}}async function ge(e,t,o,a){const i=e.portal,{item:n}=t,{folder:s,copyAllResources:l}=a;let p=!1;if(l&&n?.id&&r(n.portal.url,i.url)&&parseInt(n.portal.currentVersion,10)>=2023){const{total:e}=await n.fetchResources();p=!!e}if(p){const t=await n.copy({copyResources:"all",folder:s});e.id=t.id,e.portal=t.portal;const r=e.toJSON();await e.load(),e.read(r),await e.update({data:o})}else await(i.user?.addItem({item:e,folder:s,data:o}));return p}function _e(e,o,r,n,s){t.prototype.read.call(o,{version:n.version,authoringApp:n.authoringApp,authoringAppVersion:n.authoringAppVersion},{origin:e.origin,ignoreDefaults:!0,url:r.itemUrl?a(r.itemUrl):void 0}),i(s),o.resourceInfo=n}export{O as createJSON,U as save,T as saveAs};