/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../../../core/arrayUtils","../II3SMeshView3D"],(function(e,t){"use strict";let i=function(){this.ids=new Set,this.paused=!1};return function(){function s({collection:e,forAllFeatures:t,forAllFeaturesOfNode:i}){this.highlights=[],this.collection=e,this.forAllFeatures=t,this.forAllFeaturesOfNode=i}var o=s.prototype;return o.destroy=function(){this.highlights.forEach((e=>this._releaseSet(e))),this.highlights=null},o.acquireSet=function(){const t=new i;this.highlights.push(t);const s={remove:()=>{this._releaseSet(t),e.removeUnordered(this.highlights,t)},pause:()=>{this._releaseSet(t),t.paused=!0},resume:()=>{t.paused=!1,this._initializeSet(t)}};return{set:t,handle:s}},o.setFeatureIds=function(e,t){t.forEach((t=>e.ids.add(t))),this._initializeSet(e)},o._initializeSet=function(e){this.forAllFeatures(((i,s,o)=>(e.ids.has(i)&&this.collection.addComponentHighlight(o.objectHandle,s),t.ForAllFeaturesReturnType.CONTINUE)))},o._releaseSet=function(e){this.forAllFeatures(((i,s,o)=>(e.ids.has(i)&&this.collection.removeComponentHighlight(o.objectHandle,s),t.ForAllFeaturesReturnType.CONTINUE)))},o.objectCreated=function(e){this.highlights.forEach((i=>{i.paused||this.forAllFeaturesOfNode(e,((s,o)=>(i.ids.has(s)&&this.collection.addComponentHighlight(e.objectHandle,o),t.ForAllFeaturesReturnType.CONTINUE)))}))},o.objectDeleted=function(e){this.collection.clearHighlights(e.objectHandle)},s}()}));
