/*
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","./Basemap","./Ground","./core/Accessor","./core/CollectionFlattener","./core/Evented","./core/maybe","./core/accessorSupport/decorators/property","./core/arrayUtils","./core/has","./core/accessorSupport/decorators/cast","./core/accessorSupport/decorators/subclass","./layers/support/editableLayers","./support/basemapUtils","./support/collectionUtils","./support/groundUtils","./support/LayersMixin","./support/TablesMixin"],(function(e,r,t,a,s,o,l,n,i,p,c,d,u,y,b,h,_,m,L){"use strict";let f=function(r){function t(t){var s;return(s=r.call(this,t)||this).allLayers=new o({getCollections:()=>{var e,r,t;return[null==(e=s.basemap)?void 0:e.baseLayers,null==(r=s.ground)?void 0:r.layers,s.layers,null==(t=s.basemap)?void 0:t.referenceLayers]},getChildrenFunction:e=>"layers"in e?e.layers:null}),s.allTables=h.createFlattenedTablesCollection(e._assertThisInitialized(s)),s.basemap=null,s.editableLayers=new o({getCollections:()=>[s.allLayers],itemFilterFunction:y.isEditableLayer}),s.ground=new a,s._basemapCache=b.createCache(),s}e._inheritsLoose(t,r);var s=t.prototype;return s.destroy=function(){var e,r;this.allLayers.destroy(),this.allTables.destroy(),this.editableLayers.destroy(),null==(e=this.ground)||e.destroy(),null==(r=this.basemap)||r.destroy(),b.destroyCache(this._basemapCache),this._basemapCache=null},s.castBasemap=function(e){return b.ensureType(e,this._basemapCache)},s.castGround=function(e){const r=_.ensureType(e);return n.isNone(r)?this._get("ground"):r},s.findLayerById=function(e){return this.allLayers.find((r=>r.id===e))},s.findTableById=function(e){return this.allTables.find((r=>r.id===e))},t}(L.TablesMixin(m.LayersMixin(l.EventedMixin(s))));r.__decorate([i.property({readOnly:!0,dependsOn:[]})],f.prototype,"allLayers",void 0),r.__decorate([i.property({readOnly:!0})],f.prototype,"allTables",void 0),r.__decorate([i.property({type:t})],f.prototype,"basemap",void 0),r.__decorate([d.cast("basemap")],f.prototype,"castBasemap",null),r.__decorate([i.property({readOnly:!0})],f.prototype,"editableLayers",void 0),r.__decorate([i.property({type:a,nonNullable:!0})],f.prototype,"ground",void 0),r.__decorate([d.cast("ground")],f.prototype,"castGround",null),f=r.__decorate([u.subclass("esri.Map")],f);return f}));
