text: "use strict";
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.default = void 0;
  
  var _react = _interopRequireDefault(require("react"));
  
  var _Link = _interopRequireDefault(require("./Link"));
  
  var _internalRouterContextTypeCheck = _interopRequireDefault(require("./internalRouterContextTypeCheck"));
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
  
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
  
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
  
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  
  class IntentLink extends _react.default.PureComponent {
    constructor() {
      super(...arguments);
  
      _defineProperty(this, "context", null);
  
      _defineProperty(this, "_element", null);
  
      _defineProperty(this, "setElement", element => {
        if (element) {
          this._element = element;
        }
      });
    }
  
    focus() {
      if (this._element) {
        this._element.focus();
      }
    }
  
    resolveIntentLink(intent, params) {
      if (!this.context) throw new Error('IntentLink: missing context value');
  
      if (!this.context.__internalRouter) {
        return "javascript://intent@".concat(JSON.stringify({
          intent,
          params
        }));
      }
  
      return this.context.__internalRouter.resolveIntentLink(intent, params);
    }
  
    render() {
      var _this$props = this.props,
          intent = _this$props.intent,
          params = _this$props.params,
          restProps = _objectWithoutProperties(_this$props, ["intent", "params"]);
  
      return /*#__PURE__*/_react.default.createElement(_Link.default, _extends({}, restProps, {
        href: this.resolveIntentLink(intent, params),
        ref: this.setElement
      }));
    }
  
  }
  
  exports.default = IntentLink;
  
  _defineProperty(IntentLink, "contextTypes", {
    __internalRouter: _internalRouterContextTypeCheck.default
  });