/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../core/Error","../../../geometry/Multipoint","../../../geometry/Point","../../../geometry/Polygon","../../../geometry/Polyline","./KnowledgeWasmInterface"],(function(e,o,t,n,r,s,l){"use strict";function a(e){const o={},n=c(e,o),r=e.lengths,s=e.coords,l=r[0];o.points=[];let a=0;for(let t=0;t<l;t++){const e=[];for(let o=0;o<n;o++)e[o]=s[a],a++;o.points.push(e)}return new t(o)}function i(e){const o={};let t=2;c(e,o);const r=e.coords;return o.x=r[0],o.y=r[1],e.has_z&&(o.z=r[t],t++),e.has_m&&(o.m=r[t]),new n(o)}function m(e){return new s(y(e))}function u(e){return new r(y(e))}function y(e){const t={},n=c(e,t),r=e.lengths,s=e.coords;let a="";if(e.geometry_type.value===l.WasmGeometryTypeCodes.ESRI_GEOMETRY_POLYGON)a="rings";else{if(e.geometry_type.value!==l.WasmGeometryTypeCodes.ESRI_GEOMETRY_POLYLINE)throw new o("KnowledgeGraph:illegal-geometry-type","Illegal Geometry type for multipath conversion");a="paths"}t[a]=[];let i=0;return r.forEach((e=>{const o=[];for(let t=0;t<e;t++){const e=[];for(let o=0;o<n;o++)e[o]=s[i],i++;o.push(e)}t[a].push(o)})),t}function c(e,o){let t=2;return e.has_z?(o.hasZ=e.has_z,t++):o.hasZ=!1,e.has_m?(o.hasM=e.has_m,t++):o.hasM=!1,t}e.wasmToMultipointGeometry=a,e.wasmToPointGeometry=i,e.wasmToPolygonGeometry=u,e.wasmToPolylineGeometry=m,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
