/*
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/accessorSupport/decorators/property","../../../../core/arrayUtils","../../../../core/has","../../../../core/accessorSupport/ensureType","../../../../core/accessorSupport/decorators/subclass","../../../../chunks/vec3f64","../../../ViewAnimation","../../animation/pointToPoint/Animation","./AnimationController","../../webgl-engine/lib/Camera","../../webgl-engine/lib/Intersector","../../../animation/easing"],(function(t,i,n,e,o,r,s,a,c,l,m,h,u,p,d){"use strict";t.PointToPointAnimationController=function(t){function n(i){var n;return(n=t.call(this,i)||this).view=null,n.mode="interaction",n.hasTarget=!1,n}i._inheritsLoose(n,t);var e=n.prototype;return e.initialize=function(){this.animation=new m.Animation(this.view.state.viewingMode),this.viewAnimation="interaction"===this.mode?null:new l},e.begin=function(t,i){this.hasTarget=!0;const n=this.animationSettings(i);g.copyFrom(this.view.state.camera);const e=p.newIntersector(this.view.state.viewingMode);this.intersectionHelper.intersectRay(g.ray,e,f)&&(g.center=f),this.animation.update(g,t,n),this.animation.finished&&this.finish()},e.finish=function(){this.animation.currentTime=this.animation.time,t.prototype.finish.call(this)},e.stepController=function(t,i){this.hasTarget&&this.animation.step(t,i)},e.onControllerEnd=function(i){this.hasTarget&&(this.animation.cameraAt(this.animation.currentTime/this.animation.time,i),this.animation.currentTime=this.animation.time),t.prototype.onControllerEnd.call(this,i)},e.animationSettings=function(t={}){return{apex:{maximumDistance:this.view.state.constraints.clampAltitude(1/0)/6,ascensionFactor:void 0,descensionFactor:void 0},...t,easing:"string"==typeof t.easing?d.EasingFunctions[t.easing]:t.easing}},i._createClass(n,[{key:"intersectionHelper",get:function(){return this.view.sceneIntersectionHelper}},{key:"isInteractive",get:function(){return"interaction"===this.mode}},{key:"steppingFinished",get:function(){return this.hasTarget&&this.animation.finished}}]),n}(h.AnimationController),n.__decorate([e.property({constructOnly:!0})],t.PointToPointAnimationController.prototype,"view",void 0),n.__decorate([e.property({constructOnly:!0})],t.PointToPointAnimationController.prototype,"mode",void 0),t.PointToPointAnimationController=n.__decorate([a.subclass("esri.views.3d.state.controllers.PointToPointAnimationController")],t.PointToPointAnimationController);const g=new u.Camera,f=c.create();Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
