"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _CancelledCommandException = _interopRequireDefault(require("../Core/Scheduler/CancelledCommandException"));
var _default = {
  executeCommand(command) {
    const promises = [];
    const layer = command.layer;
    const requester = command.requester;
    const extentsSource = command.extentsSource;
    if (requester && !requester.material) {
      return Promise.reject(new _CancelledCommandException.default(command));
    }
    for (const extent of extentsSource) {
      promises.push(layer.convert(requester, extent));
    }
    return Promise.all(promises);
  }
};
exports.default = _default;