"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getServiceTypeFromUrl = exports.isMapOrFeatureServerUrl = void 0;
const util_1 = require("../util");
const MAP_OR_FEATURE_SERVER_URL_REGEX = /\/(map|feature)server/i;
/**
 *
 * @param url
 * @returns true if the url is of a map or feature service
 */
const isMapOrFeatureServerUrl = (url) => {
    return MAP_OR_FEATURE_SERVER_URL_REGEX.test(url);
};
exports.isMapOrFeatureServerUrl = isMapOrFeatureServerUrl;
/**
 * parses map or feature service type from URL
 * @param url map or feature service URL
 * @returns item type, either "Map Service" or "Feature Service"
 * or undefined for other types of URLs
 */
const getServiceTypeFromUrl = (url) => {
    const match = MAP_OR_FEATURE_SERVER_URL_REGEX.exec(url);
    const mapOrFeature = match && match[1];
    return mapOrFeature && `${(0, util_1.capitalize)(mapOrFeature)} Service`;
};
exports.getServiceTypeFromUrl = getServiceTypeFromUrl;
//# sourceMappingURL=feature-service-urls.js.map