/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{getCursorBoundsXY as t}from"../../../geometry/support/boundsUtils.js";class e{static{this.instance=null}static local(){return null===e.instance&&(e.instance=new e),e.instance}execute(t,e,r){return new n(t,e,r)}}class n{constructor(t,e,n){this._inputGeometries=t,this._rotateAngle=void 0!==e.angle?e.angle*Math.PI/180:0}next(){let e=this._inputGeometries.next();for(;e;){if(0===this._rotateAngle||"esriGeometryPoint"===e.geometryType)return e;if(e.totalSize>0){const n=t(e),r=(n[2]+n[0])/2,s=(n[3]+n[1])/2;return e.reset(),this._rotate(e.clone(),r,s)}e=this._inputGeometries.next()}return null}_rotate(t,e,n){const r=Math.cos(this._rotateAngle),s=Math.sin(this._rotateAngle);for(;t.nextPath();)for(;t.nextPoint();){const o=t.x-e,i=t.y-n;t.x=e+o*r-i*s,t.y=n+o*s+i*r}return t.reset(),t}}export{e as EffectRotate};
