/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.25/esri/copyright.txt for details. */ import{GeometricEffectOffsetMethod as t}from"./enums.js";const e=.03;class s{constructor(){this._path=[]}path(){return this._path}addPath(t,e){e||t.reverse(),Array.prototype.push.apply(this._path,t),e||t.reverse()}static mergePath(t,e){e&&Array.prototype.push.apply(t,e)}startPath(t){this._path.push(t)}lineTo(t){this._path.push(t)}close(){const t=this._path;t.length>1&&(t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]||t.push([t[0][0],t[0][1]]))}}class n{constructor(t=0,e=!1){}normalize(t){const e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);0!==e&&(t[0]/=e,t[1]/=e)}calculateLength(t,e){const s=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(s*s+n*n)}calculateSegLength(t,e){return this.calculateLength(t[e],t[e+1])}calculatePathLength(t){let e=0;const s=t?t.length:0;for(let n=0;n0?[n/h,r/h]:[1,0]}getSegAngleCS(t,e,s){return this.getAngleCS(t[e],t[e+1],s)}cut(t,e,s,n){return[s<=0?t[e]:this.getSegCoord2D(t,e,s),n>=1?t[e+1]:this.getSegCoord2D(t,e,n)]}addSegment(t,e,s){s&&t.push(e[0]),t.push(e[1])}getSubCurve(t,e,s){const n=[];return this.appendSubCurve(n,t,e,s)?n:null}appendSubCurve(t,e,s,n){const r=e?e.length-1:0;let h=0,l=!0,o=0;for(;os){const a=(s-h)/r;let u=1,c=!1;h+r>=n&&(u=(n-h)/r,c=!0);const i=this.cut(e,o,a,u);if(i&&this.addSegment(t,i,l),c)break;l=!1}}else{if(h+r>n){const s=this.cut(e,o,0,(n-h)/r);s&&this.addSegment(t,s,l);break}this.addSegment(t,[e[o],e[o+1]],l)}h+=r,++o}else++o}return!0}getCIMPointAlong(t,e){const s=t?t.length-1:0;let n=0,r=-1;for(;re){const h=(e-n)/s;return this.getCoord2D(t[r],t[r+1],h)}n+=s}}return null}isEmpty(t,e){if(!t||t.length<=1)return!0;const s=t?t.length-1:0;let n=-1;for(;n=0==s<=0){if(u<1){const t=[e[0]-l[0],e[1]-l[1]];this.normalize(t);const n=Math.sqrt((1+u)/2);if(n>1/r){const e=-Math.abs(s)/n;c.push([i[0]-t[0]*e,i[1]-t[1]*e])}}}else switch(n){case t.Mitered:{const t=Math.sqrt((1+u)/2);if(t>0&&1/t0){const n=1/t;let r=n;for(let h=1;h