import _regeneratorRuntime from '@babel/runtime/regenerator';
import { _ as __awaiter } from '../../tslib.es6-848120af.js';
import { fetchCloudData } from '../base/base.mjs';
import { AREA_MAP } from './config.mjs';
import 'axios';
import '../../nodejs/crypto.mjs';

function purgePathCache(_ref) {
  var secretId = _ref.secretId,
    secretKey = _ref.secretKey,
    _ref$area = _ref.area,
    area = _ref$area === void 0 ? AREA_MAP.MAINLAND : _ref$area,
    _ref$flushType = _ref.flushType,
    flushType = _ref$flushType === void 0 ? 'flush' : _ref$flushType,
    paths = _ref.paths;
  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
    return _regeneratorRuntime.wrap(function (_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          return _context.abrupt("return", fetchCloudData({
            secretId: secretId,
            secretKey: secretKey,
            action: 'PurgePathCache',
            version: '2018-06-06',
            endpoint: 'cdn.tencentcloudapi.com',
            service: 'cdn',
            payload: JSON.stringify({
              Paths: paths,
              Area: area,
              FlushType: flushType
            })
          }));
        case 1:
        case "end":
          return _context.stop();
      }
    }, _callee);
  }));
}

export { purgePathCache };
