/*
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/Collection","../core/Logger","../core/maybe","../core/accessorSupport/decorators/property","../core/arrayUtils","../core/has","../core/accessorSupport/decorators/cast","../core/accessorSupport/decorators/subclass","./Layer","./mixins/BlendLayer","./mixins/ScaleRangeLayer","./support/LocalMediaElementSource"],(function(e,r,t,o,s,a,c,l,n,i,p,u,d,y){"use strict";let h=function(r){function a(e){var t;return(t=r.call(this,e)||this).copyright=null,t.fullExtent=null,t.spatialReference=null,t.type="media",t.source=new y,t}e._inheritsLoose(a,r);var c=a.prototype;return c.load=function(e){this.spatialReference&&(this.source.spatialReference=this.spatialReference);const r=this.source.load(e).then((()=>{this.spatialReference=this.source.spatialReference}));return this.addResolvingPromise(r),Promise.resolve(this)},c.destroy=function(){var e;null==(e=s.unwrap(this.source))||e.destroy()},c.castSource=function(e){return e?Array.isArray(e)||e instanceof t?new y({elements:e}):e:null},e._createClass(a,[{key:"source",set:function(e){"not-loaded"===this.loadStatus?this._set("source",e):o.getLogger(this.declaredClass).error("#source","source cannot be changed after the layer is loaded.")}}]),a}(u.BlendLayer(d.ScaleRangeLayer(p)));r.__decorate([a.property({type:String})],h.prototype,"copyright",void 0),r.__decorate([a.property({aliasOf:"source.fullExtent"})],h.prototype,"fullExtent",void 0),r.__decorate([a.property({type:["show","hide"]})],h.prototype,"listMode",void 0),r.__decorate([a.property({nonNullable:!0})],h.prototype,"source",null),r.__decorate([n.cast("source")],h.prototype,"castSource",null),r.__decorate([a.property()],h.prototype,"spatialReference",void 0),r.__decorate([a.property({readOnly:!0})],h.prototype,"type",void 0),h=r.__decorate([i.subclass("esri.layers.MediaLayer")],h);return h}));
