/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../../Graphic.js";import{property as r,subclass as s}from"../../core/accessorSupport/decorators.js";import o from"../../geometry/Polyline.js";import p from"./DirectionsEvent.js";import n from"./DirectionsString.js";import{reader as i}from"../../core/accessorSupport/decorators/reader.js";function a(e){if(null==e||""===e)return null;let t=0,r=0,s=0,o=0;const p=[];let n,i,a,l,u,m,c,y,f=0,d=0,h=0;if(u=e.match(/((\+|-)[^+\-|]+|\|)/g),u||(u=[]),0===parseInt(u[f],32)){f=2;const e=parseInt(u[f],32);f++,m=parseInt(u[f],32),f++,1&e&&(d=u.indexOf("|")+1,c=parseInt(u[d],32),d++),2&e&&(h=u.indexOf("|",d)+1,y=parseInt(u[h],32),h++)}else m=parseInt(u[f],32),f++;for(;f<u.length&&"|"!==u[f];){n=parseInt(u[f],32)+t,f++,t=n,i=parseInt(u[f],32)+r,f++,r=i;const e=[n/m,i/m];d&&(l=parseInt(u[d],32)+s,d++,s=l,e.push(l/c)),h&&(a=parseInt(u[h],32)+o,h++,o=a,e.push(a/y)),p.push(e)}return{paths:[p],hasZ:d>0,hasM:h>0}}let l=class extends t{constructor(e){super(e),this.events=null,this.geometry=null,this.strings=null}set attributes(e){super.attributes=e}readGeometry(e,t){const r=a(t.compressedGeometry);return null!=r?o.fromJSON(r):null}};e([r({type:[p]})],l.prototype,"events",void 0),e([r({types:{base:null,key:"type",typeMap:{polygon:o},defaultKeyValue:"polygon"}})],l.prototype,"geometry",void 0),e([i("geometry",["compressedGeometry"])],l.prototype,"readGeometry",null),e([r({type:[n]})],l.prototype,"strings",void 0),l=e([s("esri.rest.support.DirectionsFeature")],l);const u=l;export{u as default};
