import { __module as l } from "./index-url-toolkit3.js";
var f;
function R() {
  return f ? l.exports : (f = 1, (function(m, y) {
    (function(g) {
      var c = /^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/, s = /^(?=([^\/?#]*))\1([^]*)$/, L = /(?:\/|^)\.(?=\/)/g, E = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g, n = {
        // If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or //
        // E.g
        // With opts.alwaysNormalize = false (default, spec compliant)
        // http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g
        // With opts.alwaysNormalize = true (not spec compliant)
        // http://a.com/b/cd + /e/f/../g => http://a.com/e/g
        buildAbsoluteURL: function(r, a, o) {
          if (o = o || {}, r = r.trim(), a = a.trim(), !a) {
            if (!o.alwaysNormalize)
              return r;
            var u = n.parseURL(r);
            if (!u)
              throw new Error("Error trying to parse base URL.");
            return u.path = n.normalizePath(
              u.path
            ), n.buildURLFromParts(u);
          }
          var e = n.parseURL(a);
          if (!e)
            throw new Error("Error trying to parse relative URL.");
          if (e.scheme)
            return o.alwaysNormalize ? (e.path = n.normalizePath(e.path), n.buildURLFromParts(e)) : a;
          var t = n.parseURL(r);
          if (!t)
            throw new Error("Error trying to parse base URL.");
          if (!t.netLoc && t.path && t.path[0] !== "/") {
            var h = s.exec(t.path);
            t.netLoc = h[1], t.path = h[2];
          }
          t.netLoc && !t.path && (t.path = "/");
          var i = {
            // 2c) Otherwise, the embedded URL inherits the scheme of
            // the base URL.
            scheme: t.scheme,
            netLoc: e.netLoc,
            path: null,
            params: e.params,
            query: e.query,
            fragment: e.fragment
          };
          if (!e.netLoc && (i.netLoc = t.netLoc, e.path[0] !== "/"))
            if (!e.path)
              i.path = t.path, e.params || (i.params = t.params, e.query || (i.query = t.query));
            else {
              var p = t.path, v = p.substring(0, p.lastIndexOf("/") + 1) + e.path;
              i.path = n.normalizePath(v);
            }
          return i.path === null && (i.path = o.alwaysNormalize ? n.normalizePath(e.path) : e.path), n.buildURLFromParts(i);
        },
        parseURL: function(r) {
          var a = c.exec(r);
          return a ? {
            scheme: a[1] || "",
            netLoc: a[2] || "",
            path: a[3] || "",
            params: a[4] || "",
            query: a[5] || "",
            fragment: a[6] || ""
          } : null;
        },
        normalizePath: function(r) {
          for (r = r.split("").reverse().join("").replace(L, ""); r.length !== (r = r.replace(E, "")).length; )
            ;
          return r.split("").reverse().join("");
        },
        buildURLFromParts: function(r) {
          return r.scheme + r.netLoc + r.path + r.params + r.query + r.fragment;
        }
      };
      m.exports = n;
    })();
  })(l), l.exports);
}
export {
  R as __require
};
