/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{createResolver as e}from"../../core/promiseUtils.js";import{whenOnce as r}from"../../core/reactiveUtils.js";import{debug as t}from"../../core/scheduling.js";import{dispatch as o}from"../../core/accessorSupport/watch.js";function s(e){switch(e.type){case"2d":return i(e);case"3d":if(e)return o(),t.dispatch(),r(()=>!e.updating)}return Promise.resolve()}function i(r){const s=e();let i=performance.now();const n=()=>(o(),t.dispatch(),!r.ready||r.updating||!r.stationary||r.rendering);function c(){if(!r.destroyed&&n())i=null,setTimeout(c,16);else{i||(i=performance.now());performance.now()-i>=100?s():setTimeout(c,16)}}return setTimeout(c,16),s.promise}export{s as default};
