/*
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","./Analysis","./SlicePlane","../core/Collection","../core/collectionUtils","../core/Logger","../core/maybe","../core/accessorSupport/decorators/property","../core/arrayUtils","../core/has","../core/accessorSupport/ensureType","../core/accessorSupport/decorators/subclass","../geometry/support/coordinateSystem","../views/ViewingMode","../views/3d/analysis/Slice/sliceToolUtils","../views/3d/support/RenderCoordsHelper","../views/support/spatialReferenceSupport"],(function(e,t,o,r,s,i,n,l,a,p,c,d,u,y,h,g,f,S){"use strict";const _=n.getLogger("esri.analysis.Slice");let b=function(t){function o(e){var o;return(o=t.call(this,e)||this).type="slice",o.tiltEnabled=!1,o.shape=null,o.excludeGroundSurface=!1,o}return e._inheritsLoose(o,t),o.prototype.clear=function(){this.shape=null},e._createClass(o,[{key:"extent",get:function(){if(l.isNone(this.shape)||l.isNone(this.shape.position))return null;const e=this.shape.position.spatialReference;let t=null,o=null;if(S.isSpatialReferenceSupported(e,h.ViewingMode.Local)){const o=f.RenderCoordsHelper.create(h.ViewingMode.Local,y.renderSRFromViewSR(!1,e));t=g.shapeToExtent(this.shape,o,{tiltEnabled:this.tiltEnabled})}if(S.isSpatialReferenceSupported(e,h.ViewingMode.Global)){const t=f.RenderCoordsHelper.create(h.ViewingMode.Global,y.renderSRFromViewSR(!0,e));o=g.shapeToExtent(this.shape,t,{tiltEnabled:this.tiltEnabled})}return l.isSome(t)&&l.isSome(o)?t.union(o):l.isNone(t)&&l.isNone(o)?(_.warnOnce(`Extent of slice analysis (title: '${null!=(r=this.title)?r:"no title"}', id: '${null!=(s=this.id)?s:"no id"}') could not be computed as the spatial reference of the shape (wkid: '${null!=(i=e.wkid)?i:"no wkid"}') is not supported by the view`),null):l.isNone(t)?o:t;var r,s,i}},{key:"excludedLayers",get:function(){return this._get("excludedLayers")||new s},set:function(e){this._set("excludedLayers",i.referenceSetter(e,this._get("excludedLayers")))}},{key:"requiredPropertiesForEditing",get:function(){return[l.applySome(this.shape,(e=>e.position))]}},{key:"nonEditableMessage",get:function(){return l.isNone(this.shape)?"Assign a slice shape to the analysis to allow editing.":"plane"===this.shape.type?"Assign a position to the analysis slice plane to allow editing.":void 0}}]),o}(o);t.__decorate([a.property({type:["slice"]})],b.prototype,"type",void 0),t.__decorate([a.property({readOnly:!0})],b.prototype,"extent",null),t.__decorate([a.property()],b.prototype,"tiltEnabled",void 0),t.__decorate([a.property({types:{key:"type",base:null,typeMap:{plane:r},defaultKeyValue:"plane"}})],b.prototype,"shape",void 0),t.__decorate([a.property({cast:i.castForReferenceSetter,clonable:e=>e.slice()})],b.prototype,"excludedLayers",null),t.__decorate([a.property({type:Boolean,nonNullable:!0})],b.prototype,"excludeGroundSurface",void 0),t.__decorate([a.property({readOnly:!0})],b.prototype,"requiredPropertiesForEditing",null),t.__decorate([a.property({readOnly:!0})],b.prototype,"nonEditableMessage",null),b=t.__decorate([u.subclass("esri.analysis.SliceAnalysis")],b);return b}));
