/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.25/esri/copyright.txt for details. */ import{getId as t}from"./CIMCursor.js";import{CurveHelper as s,PIXEL_TOLERANCE as e}from"./CurveHelper.js";const i=1e-7;class n{constructor(){this._values=[],this.extPtGap=0,this.ctrlPtGap=0,this._length=0,this._currentValue=0}isEmpty(){return 0===this._values.length}size(){return this._values.length}init(t,s,e=!0){if(this._setEmpty(),!t||0===t.length)return!1;for(let n=0;n0&&(n/=this._currentPosition.segmentLength),this._currentPosition.copyTo(s);s.abscissa+t*this._partLengthRatio>s.segmentLength+this._tolerance;){if(e){if(0===e.length)if(0===n){const t=this._path[s.segment];e.push([t[0],t[1]])}else e.push(this.getSegCoord2D(this._path,s.segment,n));const t=this._path[s.segment+1];e.push([t[0],t[1]])}if(n=0,t-=(s.segmentLength-s.abscissa)/this._partLengthRatio,this._partSegCount)s.segment=this._nextSegment(),s.segmentLength=this.calculateSegLength(this._path,s.segment),s.abscissa=0,this._partSegCount--;else{if(!this._setPosAtNextPart())return i!==r.FAIL&&(s.segmentLength=this.calculateSegLength(this._path,s.segment),s.isPartEnd=!0,i===r.END?(s.abscissa=s.segmentLength,s.isPathEnd=!0):s.abscissa=s.segmentLength+t,!0);this._currentPosition.copyTo(s)}}if(s.abscissa+=t*this._partLengthRatio,e){if(0===e.length)if(0===n){const t=this._path[s.segment];e.push([t[0],t[1]])}else e.push(this.getSegCoord2D(this._path,s.segment,n));const t=s.abscissa/s.segmentLength;if(1===t){const t=this._path[s.segment+1];e.push([t[0],t[1]])}else e.push(this.getSegCoord2D(this._path,s.segment,t))}return this._partSegCount||Math.abs(s.abscissa-s.segmentLength)=this._path.length&&(i=0),this._ctrlPtEnd=1===t(this._path[i]),this._patternLength>0){const t=this._ctrlPtBegin?this._partCtrlPtGap:this._partExtPtGap,s=this._ctrlPtEnd?this._partCtrlPtGap:this._partExtPtGap;let e=Math.round((this._partLength-(t+s))/this._patternLength);e<=0&&(e=t+s>0?0:1),this._partLengthRatio=this._partLength/(t+s+e*this._patternLength),this._partLengthRatio<.01&&(this._partLengthRatio=1)}else this._partLengthRatio=1;return!0}_hasNextSegment(){return this._seg