/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../chunks/_rollupPluginBabelHelpers","../chunks/tslib.es6","../core/JSONSupport","../core/lang","../core/accessorSupport/ensureType","../core/accessorSupport/decorators/property","../core/accessorSupport/decorators/subclass","../core/accessorSupport/decorators/writer","./support/spatialReferenceUtils"],(function(e,t,r,i,o,n,s,a,l){"use strict";var c;let p=c=function(t){function r(e){var r;return(r=t.call(this,e)||this).latestWkid=null,r.wkid=null,r.wkt=null,r.vcsWkid=null,r.latestVcsWkid=null,r.imageCoordinateSystem=null,r}e._inheritsLoose(r,t),r.fromJSON=function(e){if(!e)return null;if(e.wkid){if(102100===e.wkid)return c.WebMercator;if(4326===e.wkid)return c.WGS84}const t=new c;return t.read(e),t};var o=r.prototype;return o.normalizeCtorArgs=function(e){if(e&&"object"==typeof e)return e;return{["string"==typeof e?"wkt":"wkid"]:e}},o.writeWkt=function(e,t){this.wkid||(t.wkt=e)},o.clone=function(){if(this===c.WGS84)return c.WGS84;if(this===c.WebMercator)return c.WebMercator;const e=new c;return null!=this.wkid?(e.wkid=this.wkid,null!=this.latestWkid&&(e.latestWkid=this.latestWkid),null!=this.vcsWkid&&(e.vcsWkid=this.vcsWkid),null!=this.latestVcsWkid&&(e.latestVcsWkid=this.latestVcsWkid)):null!=this.wkt&&(e.wkt=this.wkt),this.imageCoordinateSystem&&(e.imageCoordinateSystem=i.clone(this.imageCoordinateSystem)),e},o.equals=function(e){if(null==e)return!1;if(this.imageCoordinateSystem||e.imageCoordinateSystem){if(null==this.imageCoordinateSystem||null==e.imageCoordinateSystem)return!1;const{id:t,referenceServiceName:r}=e.imageCoordinateSystem,{geodataXform:i}=e.imageCoordinateSystem,o=this.imageCoordinateSystem;return null==t||i?JSON.stringify(o)===JSON.stringify(e.imageCoordinateSystem):r?o.id===t&&o.referenceServiceName===r:o.id===t}return l.equals(this,e)},o.toJSON=function(e){return this.write(void 0,e)},e._createClass(r,[{key:"isWGS84",get:function(){return l.isWGS84(this)}},{key:"isWebMercator",get:function(){return l.isWebMercator(this)}},{key:"isGeographic",get:function(){return l.isGeographic(this)}},{key:"isWrappable",get:function(){return l.isWrappable(this)}}]),r}(r.JSONSupport);p.GCS_NAD_1927=null,p.WGS84=null,p.WebMercator=null,p.PlateCarree=null,t.__decorate([n.property({readOnly:!0})],p.prototype,"isWGS84",null),t.__decorate([n.property({readOnly:!0})],p.prototype,"isWebMercator",null),t.__decorate([n.property({readOnly:!0})],p.prototype,"isGeographic",null),t.__decorate([n.property({readOnly:!0})],p.prototype,"isWrappable",null),t.__decorate([n.property({type:o.Integer,json:{write:!0}})],p.prototype,"latestWkid",void 0),t.__decorate([n.property({type:o.Integer,json:{write:!0,origins:{"web-scene":{write:{overridePolicy(){return{isRequired:null===this.wkt}}}}}}})],p.prototype,"wkid",void 0),t.__decorate([n.property({type:String,json:{origins:{"web-scene":{write:{overridePolicy(){return{isRequired:null===this.wkid}}}}}}})],p.prototype,"wkt",void 0),t.__decorate([a.writer("wkt"),a.writer("web-scene","wkt")],p.prototype,"writeWkt",null),t.__decorate([n.property({type:o.Integer,json:{write:!0}})],p.prototype,"vcsWkid",void 0),t.__decorate([n.property({type:o.Integer,json:{write:!0}})],p.prototype,"latestVcsWkid",void 0),t.__decorate([n.property()],p.prototype,"imageCoordinateSystem",void 0),p=c=t.__decorate([s.subclass("esri.geometry.SpatialReference")],p),p.prototype.toJSON.isDefaultToJSON=!0,p.GCS_NAD_1927=new p({wkid:4267,wkt:'GEOGCS["GCS_North_American_1927",DATUM["D_North_American_1927",SPHEROID["Clarke_1866",6378206.4,294.9786982]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]'}),p.WGS84=new p(l.WGS84),p.WebMercator=new p(l.WebMercator),p.PlateCarree=new p(l.PlateCarree),Object.freeze&&(Object.freeze(p.GCS_NAD_1927),Object.freeze(p.WGS84),Object.freeze(p.WebMercator));return p}));
