// Generated by ReScript, PLEASE EDIT WITH CARE

import * as Tea_Url from "./Tea_Url.res.mjs";
import * as Tea_Navigation from "./Tea_Navigation.res.mjs";

function urlChanges(toMsg) {
  return {
          TAG: "UrlChange",
          _0: toMsg
        };
}

function initFromUrl(parseRoute) {
  return parseRoute(Tea_Url.current());
}

function handleNavigation(model, cmd) {
  Tea_Navigation.execute(cmd);
  return [
          model,
          undefined
        ];
}

function listen(onUrlChange) {
  var match = typeof __unsafe_window === "undefined" ? undefined : __unsafe_window;
  if (match !== undefined) {
    return (window.addEventListener('popstate', function() {
        onUrlChange(window.location.pathname + window.location.search + window.location.hash)
      }))(function (url) {
                onUrlChange(Tea_Url.parse(url));
              });
  }
  
}

function unlisten() {
  if (typeof __unsafe_window === "undefined") {
    
  } else {
    (__unsafe_window);
  }
}

export {
  urlChanges ,
  initFromUrl ,
  handleNavigation ,
  listen ,
  unlisten ,
}
/* No side effect */
