"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.shouldResolveUrl = exports.default = void 0;
var _react = require("react");
var _linkProvider = require("@atlaskit/link-provider");
var allowedHostnames = ['sharepoint.com', 'onedrive.live.com', 'docs.google.com', 'drive.google.com'];
var shouldResolveUrl = exports.shouldResolveUrl = function shouldResolveUrl(href) {
  try {
    var hostname = new URL(href).hostname.toLowerCase();
    return allowedHostnames.some(function (allowedHostname) {
      return hostname.includes(allowedHostname);
    });
  } catch (_unused) {
    return false;
  }
};
var useResolveHyperlinkValidator = function useResolveHyperlinkValidator() {
  var href = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  var hasSmartCardProvider = !!(0, _react.useContext)(_linkProvider.SmartCardContext);
  return hasSmartCardProvider && shouldResolveUrl(href);
};
var _default = exports.default = useResolveHyperlinkValidator;