/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../core/maybe"],(function(t,e){"use strict";function i(t){const i=t.capabilities.disjointTimerQuery;return e.isNone(i)?null:i.timestampBits()>0?new s(i):u?null:new r(i)}let s=function(){function t(t){this.timer=t,this.start=t.createQuery(),t.createTimestamp(this.start)}var e=t.prototype;return e.stop=function(t,e=50){this.end=this.timer.createQuery(),this.timer.createTimestamp(this.end),this._checkQueryResult(t,e)},e._checkQueryResult=function(t,e){if(!this.timer.resultAvailable(this.end))return void setTimeout((()=>this._checkQueryResult(t,e)),e);if(this.timer.disjoint())return void t(null);const i=this.timer.getResult(this.start),s=this.timer.getResult(this.end);t((s-i)/1e6)},t}(),r=function(){function t(t){this.timer=t,this.query=t.createQuery(),u=!0,this.timer.beginTimeElapsed(this.query)}var e=t.prototype;return e.stop=function(t,e=50){this.timer.endTimeElapsed(),u=!1,this._checkQueryResult(t,e)},e._checkQueryResult=function(t,e){const i=this.timer.resultAvailable(this.query),s=this.timer.disjoint();if(!i||s)s?t(null):setTimeout((()=>this._checkQueryResult(t,e)),e);else{const e=this.timer.getResult(this.query);t(e/1e6)}},t}(),u=!1;t.startMeasurement=i,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
