/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["../../../../chunks/_rollupPluginBabelHelpers","../../../../request","../../../../core/promiseUtils","../../tiling/TileKey"],(function(e,t,n,r){"use strict";let i=function(){function i(e){this.url=e}var l=i.prototype;return l.fetchTileIndex=function(){var n=e._asyncToGenerator((function*(){return this._tileIndexPromise||(this._tileIndexPromise=t(this.url).then((e=>e.data.index))),this._tileIndexPromise}));function r(){return n.apply(this,arguments)}return r}(),l.dataKey=function(){var t=e._asyncToGenerator((function*(e,t){const r=yield this.fetchTileIndex();return n.throwIfAborted(t),this._getIndexedDataKey(r,e)}));function r(e,n){return t.apply(this,arguments)}return r}(),l._getIndexedDataKey=function(e,t){const n=[t];if(t.level<0||t.row<0||t.col<0||t.row>>t.level>0||t.col>>t.level>0)return null;let i=t;for(;0!==i.level;)i=new r(i.level-1,i.row>>1,i.col>>1,i.world),n.push(i);let l,o,u=e,s=n.pop();if(1===u)return s;for(;n.length;)if(l=n.pop(),o=(1&l.col)+((1&l.row)<<1),u){if(0===u[o]){s=null;break}if(1===u[o]){s=l;break}s=l,u=u[o]}return s},i}();return i}));
