/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
import r from "@arcgis/core/request.js";
const s = /\.(\w+)$/iv;
function p(t) {
  const e = new URL(t).pathname.match(s);
  if (!(!e || e.length < 2))
    return e[1].toUpperCase();
}
async function c(t, n) {
  const o = (await r(t, { ...n, method: "head" }))?.getHeader?.("Content-Type");
  if (o)
    return o.split("/")[1].toUpperCase();
}
export {
  c as getDatasetFormat,
  p as guessExtensionFromURI
};
