/*
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/arrayUtils","../../../core/Handles","../../../core/handleUtils","../../../core/reactiveUtils","../../../geometry/projectionEllipsoid","./index","./StreamTextureCollection","../webgl-engine/lib/screenSizePerspectiveUtils","../../webgl/enums"],(function(e,t,s,i,r,n,c,a,l,o,u){"use strict";let d=function(){function e(e){this.textures=null,this.streamDataRequester=null,this.graphicsOwners=[],this.screenSizePerspectiveHandles=null,this.cimSymbolRasterizer=null,this.viewState=e.viewState,this.view=e.view,this.pointsOfInterest=e.pointsOfInterest,this.objectResourceCache=e.objectResourceCache,this.streamDataRequester=e.resourceController.createStreamDataRequester(a.ClientType.SYMBOLOGY),this.textures=new l.StreamTextureCollection(this.streamDataRequester,e.view._stage,{preMultiplyAlpha:!0,wrap:{s:u.TextureWrapMode.CLAMP_TO_EDGE,t:u.TextureWrapMode.CLAMP_TO_EDGE}},e.resourceController.scheduler);const t=c.getReferenceEllipsoid(this.view.spatialReference).radius;this.screenSizePerspectiveSettings=o.getSettings(e.viewingMode,t),this.screenSizePerspectiveSettingsLabels=o.getLabelSettings(e.viewingMode,t)}var d=e.prototype;return d.destroy=function(){this.textures.destroy(),this.textures=null,this.streamDataRequester=null},d.addGraphicsOwner=function(e){if(!e)return r.makeHandle();this.graphicsOwners.push(e);const t=n.watch((()=>{var t;return null==(t=e.layer)?void 0:t.screenSizePerspectiveEnabled}),(()=>this._updateScreenSizePerspectiveEnabled()));return this._updateScreenSizePerspectiveEnabled(),r.makeHandle((()=>{t.remove(),s.removeUnordered(this.graphicsOwners,e),this._updateScreenSizePerspectiveEnabled()}))},d._updateScreenSizePerspectiveEnabled=function(){const e=this.graphicsOwners.some((e=>{var t;return!0===(null==(t=e.layer)?void 0:t.screenSizePerspectiveEnabled)}));if(e&&!this.screenSizePerspectiveHandles){this.screenSizePerspectiveHandles=new i;const e=()=>this._updateScreenSizePerspectiveSettings();this.screenSizePerspectiveHandles.add([n.watch((()=>this.pointsOfInterest.centerOnSurfaceInfrequent.distance),e,n.sync),this.viewState.events.on("camera-projection-changed",e)]),this._updateScreenSizePerspectiveSettings()}else!e&&this.screenSizePerspectiveHandles&&(this.screenSizePerspectiveHandles.destroy(),this.screenSizePerspectiveHandles=null)},d._updateScreenSizePerspectiveSettings=function(){const e=this.pointsOfInterest;p.distance=e.centerOnSurfaceInfrequent.distance,p.fovY=this.viewState.camera.fovY,this.screenSizePerspectiveSettings.update(p),this.screenSizePerspectiveSettingsLabels.update(p),this.view._stage.renderView.requestRender()},t._createClass(e,[{key:"test",get:function(){return{screenSizePerspectiveHandles:this.screenSizePerspectiveHandles}}}]),e}();const p={distance:0,fovY:0};e.SharedSymbolResources=d,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
