/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../chunks/_rollupPluginBabelHelpers","../../../core/promiseUtils","../../../core/Queue","./webgl/AttributeStoreView","./webgl/TileContainer","./webgl/WGLRendererInfo"],(function(e,t,r,i,n,o,s){"use strict";let a=function(e){function o(t){var r;return(r=e.call(this,t)||this)._rendererInfo=new s.WGLRendererInfo,r._materialItemsRequestQueue=new i,r.attributeView=new n.AttributeStoreView((()=>r.onAttributeStoreUpdate())),r}t._inheritsLoose(o,e);var a=o.prototype;return a.destroy=function(){this.removeAllChildren(),this.children.forEach((e=>e.destroy())),this.attributeView.destroy(),this._materialItemsRequestQueue.clear()},a.setRendererInfo=function(e,t,r){this._rendererInfo.setInfo(e,t,r),this.requestRender()},a.getMaterialItems=function(){var e=t._asyncToGenerator((function*(e,t){if(!e||0===e.length)return null;const i=r.createResolver();return this._materialItemsRequestQueue.push({items:e,abortOptions:t,resolver:i}),this.requestRender(),i.promise}));function i(t,r){return e.apply(this,arguments)}return i}(),a.doRender=function(t){if(t.context.capabilities.enable("textureFloat"),t.context.capabilities.enable("vao"),this._materialItemsRequestQueue.length>0){let e=this._materialItemsRequestQueue.pop();for(;e;)this._processMaterialItemRequest(t,e),e=this._materialItemsRequestQueue.pop()}e.prototype.doRender.call(this,t)},a.renderChildren=function(t){for(const e of this.children)e.commit(t);this._rendererInfo.update(t.state),e.prototype.renderChildren.call(this,t)},a.createRenderParams=function(t){const r=e.prototype.createRenderParams.call(this,t);return r.rendererInfo=this._rendererInfo,r.attributeView=this.attributeView,r},a.onAttributeStoreUpdate=function(){},a._processMaterialItemRequest=function(e,{items:t,abortOptions:r,resolver:i}){const{painter:n,pixelRatio:o}=e,s=t.map((e=>n.textureManager.rasterizeItem(e.symbol,o,e.glyphIds,r)));Promise.all(s).then((e=>{if(!this.stage)return void i.reject();const r=e.map(((e,r)=>({id:t[r].id,mosaicItem:e})));i.resolve(r)}),i.reject)},o}(o);e.FeatureContainer=a,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
