1import{a as m,m as V}from"./Point2D-Dg_nYCFE.js";import"./Envelope2D-Ce1G9dtv.js";import{r as M,c as w,e as h,O as P,Y as Z}from"./ProjectionTransformation--FE933yF.js";import{bu as v,bv as R,z as p,bw as d,B as E}from"./index-CyVzZKgG.js";import{fromGeometryToGXGeometry as g,toGeometry as y}from"./jsonConverter-DFF3fSnj.js";import"./Transformation2D-DSWieLJs.js";import"./SimpleGeometryCursor-B92kdZ15.js";import"./OperatorDefinitions-DP7_WWTp.js";const a="_gxVersion",x=2,C=1;function _(t){return Array.isArray(t)?t[0].spatialReference:t.spatialReference}function j(t){switch(t.type){case"point":return G(t);case"multipoint":return Y(t);case"polyline":return k(t);case"polygon":return X(t);case"extent":return z(t);default:throw new Error(`Unsupported geometry type: ${t.type}`)}}function z(t){if(!t.getCacheValue(a)){const e=new M;e.setCoords(t.xmin,t.ymin,t.xmax,t.ymax),t.hasM&&e.setInterval(x,0,t.mmin,t.mmax),t.hasZ&&e.setInterval(C,0,t.zmin,t.zmax),t.setCacheValue(a,e)}return t.getCacheValue(a)}function Y(t){if(!t.getCacheValue(a)){const e=new w,n=new h,s=t.points,r=t.hasM,o=t.hasZ,i=o?3:2;for(let u=0,l=s.length;u<l;u++){const c=s[u];n.setXYCoords(c[0],c[1]),o&&n.setZ(c[2]??0),r&&n.setM(c[i]??NaN),e.add(n)}t.setCacheValue(a,e)}return t.getCacheValue(a)}function G(t){if(!t.getCacheValue(a)){const e=new h;e.setXYCoords(t.x,t.y),t.hasM&&e.setM(t.m),t.hasZ&&e.setZ(t.z),t.setCacheValue(a,e)}return t.getCacheValue(a)}function X(t){if(!t.getCacheValue(a)){const{curveRings:e,hasM:n,hasZ:s,rings:r}=t,o=g({curveRings:e,hasM:n,hasZ:s,rings:r});t.setCacheValue(a,o)}return t.getCacheValue(a)}function k(t){if(!t.getCacheValue(a)){const{curvePaths:e,hasM:n,hasZ:s,paths:r}=t,o=g({curvePaths:e,hasM:n,hasZ:s,paths:r});t.setCacheValue(a,o)}return t.getCacheValue(a)}function F(t){if(t.wkid)return P(t.wkid);const e=t.wkt2||t.wkt;return e?Z(e):null}function H(t,e){if(t)switch(t.getGeometryType()){case m.enumPoint:return O(t,e);case m.enumEnvelope:return I(t,e);case m.enumMultiPoint:return N(t,e);case m.enumPolyline:return $(t,e);case m.enumPolygon:return S(t,e)}return null}function I(t,e){if(t.isEmpty())return null;const n=new v({xmin:t.getXMin(),ymin:t.getYMin(),xmax:t.getXMax(),ymax:t.getYMax(),spatialReference:e}),s=t.getDescription();if(s.hasM()){const r=t.queryInterval(x,0);n.mmin=r.vmin,n.mmax=r.vmax}if(s.hasZ()){const r=t.queryInterval(C,0);n.zmin=r.vmin,n.zmax=r.vmax}return n.setCacheValue(a,t),n}function N(t,e){if(t.isEmpty())return null;const n=t.getDescription(),s=n.hasM(),r=n.hasZ(),o=[],i=new h;for(let l=0,c=t.getPointCount();l<c;l++){t.getPointByVal(l,i);const f=[i.getX(),i.getY()];r&&f.push(i.getZ()),s&&f.push(i.getM()),o.push(f)}const u=new R({hasM:s,hasZ:r,points:o,spatialReference:e});return u.setCacheValue(a,t),u}function O(t,e){if(t instanceof V)return new p({x:t.x,y:t.y,spatialReference:e});if(t.isEmpty())return null;const n=new p({x:t.getX(),y:t.getY(),spatialReference:e}),s=t.getDescription();return s.hasM()&&(n.m=t.getM()),s.hasZ()&&(n.z=t.getZ()),n.setCacheValue(a,t),n}function S(t,e){if(t.isEmpty())return null;const n=d.fromJSON({spatialReference:e,...y(t,null)});return n.setCacheValue(a,t),n}function $(t,e){if(t.isEmpty())return null;const n=E.fromJSON({spatialReference:e,...y(t,null)});return n.setCacheValue(a,t),n}export{z as fromExtent,j as fromGeometry,Y as fromMultipoint,G as fromPoint,X as fromPolygon,k as fromPolyline,F as fromSpatialReference,_ as getSpatialReference,I as toExtent,H as toGeometry,N as toMultipoint,O as toPoint,S as toPolygon,$ as toPolyline};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.