/*
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/Accessor","../../core/Evented","../../core/HandleOwner","../../core/Identifiable","../../core/Logger","../../core/maybe","../../core/Promise","../../core/accessorSupport/decorators/property","../../core/arrayUtils","../../core/has","../../core/accessorSupport/ensureType","../../core/accessorSupport/decorators/subclass"],(function(e,r,t,n,i,o,s,l,a,p,d,u,c,y){"use strict";let h=function(r){function t(e){var t;return(t=r.call(this,e)||this).layer=null,t.parent=null,t}e._inheritsLoose(t,r);var n=t.prototype;return n.initialize=function(){this.when().catch((e=>{if("layerview:create-error"!==e.name){const r=this.layer&&this.layer.id||"no id",t=this.layer&&this.layer.title||"no title";s.getLogger(this.declaredClass).error("#resolve()",`Failed to resolve layer view (layer title: '${t}', id: '${r}')`,e)}}))},n.canResume=function(){var e,r,t;return this.visible&&(null==(e=this.layer)?void 0:e.loaded)&&!(null!=(r=this.parent)&&r.suspended)&&(null==(t=this.view)?void 0:t.ready)||!1},n.getSuspendInfo=function(){const e=this.parent&&this.parent.suspended?this.parent.suspendInfo:{},r=this;return r.view&&r.view.ready||(e.viewNotReady=!0),this.layer&&this.layer.loaded||(e.layerNotLoaded=!0),this.visible||(e.layerInvisible=!0),e},n.isUpdating=function(){return!1},e._createClass(t,[{key:"fullOpacity",get:function(){return l.unwrapOr(this.get("layer.opacity"),1)*l.unwrapOr(this.get("parent.fullOpacity"),1)}},{key:"suspended",get:function(){return!this.canResume()}},{key:"suspendInfo",get:function(){return this.getSuspendInfo()}},{key:"legendEnabled",get:function(){var e;return!this.suspended&&!0===(null==(e=this.layer)?void 0:e.legendEnabled)}},{key:"updating",get:function(){var e;return!!(null!=(e=this.updatingHandles)&&e.updating||this.isUpdating())}},{key:"updatingProgress",get:function(){return this.updating?0:1}},{key:"visible",get:function(){var e;return!0===(null==(e=this.layer)?void 0:e.visible)},set:function(e){void 0!==e?this._override("visible",e):this._clearOverride("visible")}}]),t}(i.HandleOwnerMixin(o.IdentifiableMixin(a.EsriPromiseMixin(n.EventedMixin(t)))));r.__decorate([p.property()],h.prototype,"fullOpacity",null),r.__decorate([p.property()],h.prototype,"layer",void 0),r.__decorate([p.property()],h.prototype,"parent",void 0),r.__decorate([p.property({readOnly:!0})],h.prototype,"suspended",null),r.__decorate([p.property({readOnly:!0})],h.prototype,"suspendInfo",null),r.__decorate([p.property({readOnly:!0})],h.prototype,"legendEnabled",null),r.__decorate([p.property({type:Boolean,readOnly:!0})],h.prototype,"updating",null),r.__decorate([p.property({readOnly:!0})],h.prototype,"updatingProgress",null),r.__decorate([p.property()],h.prototype,"visible",null),r.__decorate([p.property()],h.prototype,"view",void 0),h=r.__decorate([y.subclass("esri.views.layers.LayerView")],h);return h}));
