/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../chunks/_rollupPluginBabelHelpers","../../../chunks/tslib.es6","../../../core/Accessor","../../../core/Handles","../../../core/accessorSupport/decorators/property","../../../core/arrayUtils","../../../core/has","../../../core/accessorSupport/ensureType","../../../core/accessorSupport/decorators/subclass","../camera/constraintUtils","../camera/intersectionUtils","../camera/constraintUtils/surfaceCollision"],(function(e,t,s,n,i,r,o,a,l,c,u,h,p){"use strict";e.SurfaceCollisionConstraint=function(e){function s(t){var s;return(s=e.call(this,t)||this).handles=new i,s}t._inheritsLoose(s,e);var n=s.prototype;return n.initialize=function(){this.handles.add(this.view.basemapTerrain.on("elevation-change",(e=>this._handleElevationChangeEvent(e))))},n.destroy=function(){this.handles&&(this.handles.destroy(),this.handles=null)},n._handleElevationChangeEvent=function(e){if(this.view.state.cameraController)return;const t=this.view.state.camera;h.eyeWithinExtent(this.view,t,e.extent,e.spatialReference)&&this._applyToCurrentCamera()},n._applyToCurrentCamera=function(){this.view.state.updateCamera((e=>{p.applySurfaceCollisionConstraint(this.view,e,p.Mode.EYE_AND_CENTER)}))},s}(n),s.__decorate([r.property({constructOnly:!0})],e.SurfaceCollisionConstraint.prototype,"view",void 0),e.SurfaceCollisionConstraint=s.__decorate([c.subclass("esri.views.3d.state.ElevationCollisionConstraint")],e.SurfaceCollisionConstraint),Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
