import { t as e } from "./vidstack-BLEs9rMG-Agxpv9v8.js";
//#region node_modules/vidstack/prod/chunks/vidstack-q-9soyHT.js
var t = /* @__PURE__ */ e({
	getVimeoVideoInfo: () => s,
	resolveVimeoVideoId: () => o
}), n = /(?:https:\/\/)?(?:player\.)?vimeo(?:\.com)?\/(?:video\/)?(\d+)(?:(?:\?hash=|\?h=|\/)(.*))?/, r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = 1920;
function o(e) {
	let t = e.match(n);
	return {
		videoId: t?.[1],
		hash: t?.[2]
	};
}
async function s(e, t, n) {
	if (r.has(e)) return r.get(e);
	if (i.has(e)) return i.get(e);
	let a = `https://vimeo.com/api/oembed.json?url=https://player.vimeo.com/video/${e}`;
	n && (a = a.concat(`?h=${n}`));
	let o = window.fetch(a, {
		mode: "cors",
		signal: t.signal
	}).then((e) => e.json()).then((t) => {
		let n = {
			title: t?.title ?? "",
			duration: t?.duration ?? 0,
			poster: c(t),
			pro: t.account_type !== "basic"
		};
		return r.set(e, n), n;
	}).finally(() => i.delete(e));
	return i.set(e, o), o;
}
function c(e) {
	let t = e?.thumbnail_url ?? "", n = t.match(/vimeocdn\.com\/video\/([^_/?#]+)_/)?.[1];
	if (!n) return t;
	let r = l(e);
	return r ? `https://i.vimeocdn.com/video/${n}_${r.width}x${r.height}.webp` : t;
}
function l(e) {
	let t = e.width || e.thumbnail_width, n = e.height || e.thumbnail_height;
	return !t || !n ? null : t > n ? {
		width: a,
		height: Math.round(a * n / t)
	} : {
		width: Math.round(a * t / n),
		height: a
	};
}
//#endregion
export { s as getVimeoVideoInfo, o as resolveVimeoVideoId, t as utils_exports };
