/* COPYRIGHT Esri - https://js.arcgis.com/5.0.18/LICENSE.txt */
import{Placement as t}from"./CIMPlacements.js";function e(t,e){t[4]=e}class i{constructor(e,i=!0,s=!0,r=0){this._angleToLine=!0,this._keepUpright=!1,this.isClosed=!1,this.geometryCursor=null,this.geometryCursor=!i&&"esriGeometryPolygon"===e.geometryType||!s&&"esriGeometryPolyline"===e.geometryType?null:e,this.geomUnitsPerPoint=r,this.iterateMultiPath=!1,this.iteratePath=!1,this.internalPlacement=new t}next(){if(!this.geometryCursor)return null;const t=this.processMultiPath(this.geometryCursor);if(this.iterateMultiPath&&t||(this.geometryCursor=null),!t)return null;const e=t.getAngle();if(this._angleToLine&&this._keepUpright&&Math.abs(e)>.5*Math.PI){const i=e+Math.PI,s=Math.atan2(Math.sin(i),Math.cos(i));Number.isNaN(s)||t.setRotate(s)}return t}processMultiPath(t){for(;this.iteratePath||t.pathIndex<t.totalSize-1;){this.iteratePath||t.nextPath(),this.iterateMultiPath=!0;const e=this.processPath(t);if(e)return e}return this.iterateMultiPath=!1,null}}class s{constructor(t,e,i,s=0){this.isClosed=!1,this.inputGeometries=t,this.acceptPolygon=e,this.acceptPolyline=i,this.geomUnitsPerPoint=s,this.iteratePath=!1,this.multiPathCursor=null}next(){for(;;){if(!this.multiPathCursor){let t=this.inputGeometries.next();for(;t&&(this.isClosed=this.acceptPolygon&&"esriGeometryPolygon"===t.geometryType||"esriGeometryEnvelope"===t.geometryType,this.multiPathCursor=t,!this.multiPathCursor);)t=this.inputGeometries.next();if(!this.multiPathCursor)return null}for(;this.iteratePath||this.multiPathCursor.nextPath();){this.multiPathCursor.seekPathStart();const t=this.processPath(this.multiPathCursor);if(t)return t}this.multiPathCursor=null}}}export{s as PathEffectCursor,i as PathTransformationCursor,e as setId};
