Liferay.Loader.define("app-builder-web@1.0.76/js/hooks/useBackUrl.es", ['module', 'exports', 'require', 'frontend-js-react-web$react', 'app-builder-web$react-router-dom'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = useBackUrl;

    var _react = require("frontend-js-react-web$react");

    var _reactRouterDom = require("app-builder-web$react-router-dom");

    /**
     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
     *
     * This library is free software; you can redistribute it and/or modify it under
     * the terms of the GNU Lesser General Public License as published by the Free
     * Software Foundation; either version 2.1 of the License, or (at your option)
     * any later version.
     *
     * This library is distributed in the hope that it will be useful, but WITHOUT
     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
     * details.
     */
    function useBackUrl() {
      var _useContext = (0, _react.useContext)(_reactRouterDom.__RouterContext),
          _useContext$location = _useContext.location,
          pathname = _useContext$location.pathname,
          search = _useContext$location.search;

      return (0, _react.useCallback)(function (url) {
        return {
          pathname: url,
          search: "?backUrl=".concat(pathname).concat(search)
        };
      }, [pathname, search]);
    }
    //# sourceMappingURL=useBackUrl.es.js.map
  }
});
//# sourceMappingURL=useBackUrl.es.js.map