import { p as g } from "./purify.es.BIuh5IAZ.js";
var m = /* @__PURE__ */ ((t) => (t.Asset = "asset", t.Folder = "folder", t.Link = "link", t.Page = "page", t.Space = "space", t))(m || {}), S = /* @__PURE__ */ ((t) => (t.Default = "default", t.Overlay = "overlay", t))(S || {}), A = /* @__PURE__ */ ((t) => (t.Always = "always", t.OnHover = "on-hover", t))(A || {}), h = /* @__PURE__ */ ((t) => (t.Track = "track", t.Transition = "transition", t))(h || {}), c = /* @__PURE__ */ ((t) => (t.Frames = "Frames", t.SMPTE = "SMPTE", t.Standard = "Standard", t))(c || {});
const C = 50;
function w(t) {
  return t.replaceAll(/[\s_]+/g, "-").replaceAll(/([a-z])([A-Z])/g, "$1-$2").replaceAll(/([A-Z])([A-Z])/g, "$1-$2").replaceAll(/([a-z])([0-9])/g, "$1-$2").replaceAll(/([A-Z])([0-9])/g, "$1-$2").replaceAll(/([0-9])([a-z])/g, "$1-$2").replaceAll(/([0-9])([A-Z])/g, "$1-$2").toLowerCase().replaceAll(/^-+|-+$/g, "");
}
function E(t) {
  return t.replaceAll(/[-_]+/g, " ").split(" ").map((r) => r.charAt(0).toUpperCase() + r.slice(1)).join("");
}
function I(t) {
  return t.trim().replaceAll(/([a-z])([A-Z])/g, "$1 $2").replaceAll(/([^0-9])([0-9])/g, "$1 $2").replaceAll(/([0-9])([a-z])/g, "$1 $2").replaceAll(/([0-9])([A-Z])/g, "$1 $2").replaceAll(/([A-Z])([A-Z])/g, "$1 $2").replaceAll(/[^A-Za-z0-9]/g, " ").split(" ").filter((r) => r).reduce((r, e, n) => `${r}${n ? $(e.toLowerCase()) : e.toLowerCase()}`, "");
}
function L(t) {
  return t.replaceAll(/([a-z])([A-Z])/g, "$1 $2").replaceAll(/([A-Z])([A-Z][a-z])/g, "$1 $2").trim();
}
function $(t) {
  if (typeof t != "string")
    return null;
  const r = t.trim(), e = r.charAt(0).toUpperCase(), n = r.slice(1);
  return `${e}${n}`;
}
const v = (t, r, e, n) => t && t.length > r ? t.substring(0, e) + " ... " + t.substring(t.length - n, t.length) : t, x = (t) => t ? t.replaceAll(/([a-z0-9])([A-Z])/g, "$1 $2").replaceAll(/([A-Z])([A-Z][a-z])/g, "$1 $2").replaceAll(/([a-zA-Z])([0-9])/g, "$1 $2").replaceAll(/([0-9])([a-zA-Z])/g, "$1 $2").replaceAll(/\s+/g, " ").trim().toLowerCase() : "";
function D(t, r = {}) {
  const {
    frameRate: e = 24,
    mode: n = c.Standard,
    showHours: s = !1,
    showMilliseconds: o = !1
  } = r, i = Number.isFinite(e) && e > 0 ? e : 24;
  if (typeof t != "number" || Number.isNaN(t) || t < 0)
    switch (n) {
      case c.Frames:
        return "0";
      case c.SMPTE:
        return "00:00:00:00";
      case c.Standard:
        return s ? "00:00:00" : "00:00";
      default:
        return "00:00";
    }
  switch (n) {
    case c.SMPTE:
      return N(t, i);
    case c.Frames:
      return M(t, i);
    case c.Standard:
    default:
      return T(t, o, s);
  }
}
function b(t) {
  return Math.abs(t - 29.97) < 0.01 || Math.abs(t - 59.94) < 0.01;
}
function N(t, r) {
  const e = Math.floor(t), n = t - e, s = Math.floor(n * r), o = Math.floor(e / 3600), i = Math.floor(e % 3600 / 60), l = e % 60, a = b(r) ? ";" : ":";
  return o.toString().padStart(2, "0") + ":" + i.toString().padStart(2, "0") + ":" + l.toString().padStart(2, "0") + a + s.toString().padStart(2, "0");
}
function M(t, r) {
  const e = t * r;
  return Math.floor(e + 1e-9).toString();
}
function T(t, r, e) {
  const n = Math.round(t * 100) / 100, s = Math.floor(n / 3600), o = Math.floor(n % 3600 / 60), i = Math.floor(n % 60), l = Math.round(n % 1 * 100), a = [];
  return (e || s > 0) && a.push(s.toString().padStart(2, "0")), a.push(o.toString().padStart(2, "0")), r && l > 0 ? a.push(
    `${i.toString().padStart(2, "0")}.${l.toString().padStart(2, "0")}`
  ) : a.push(i.toString().padStart(2, "0")), a.join(":");
}
function O(t) {
  return t.endsWith("/") ? t : `${t}/`;
}
const d = "-";
function j(t) {
  const r = t.split(d), e = r.pop() ?? "", n = r.join(d);
  return { id: e, path: n };
}
function k({
  id: t,
  path: r
}) {
  return [r, t].join(d);
}
function R(t, r) {
  const e = t.split("/"), n = r.split("/");
  return e.slice(0, n.length + 1).join("/");
}
function _(t, r = {}) {
  const { frameRate: e = 24, mode: n = c.Standard } = r, s = Number.isFinite(e) && e > 0 ? e : 24;
  if (!t || typeof t != "string")
    return 0;
  const o = t.trim();
  if (o === "")
    return 0;
  switch (n) {
    case c.SMPTE:
      return z(o, s);
    case c.Frames:
      return F(o, s);
    case c.Standard:
    default:
      return P(o);
  }
}
function z(t, r) {
  const e = /^(\d{1,2}):(\d{1,2}):(\d{1,2})[:;](\d{1,2})$/, n = t.match(e);
  if (!n)
    return 0;
  const [, s, o, i, l] = n, a = Number.parseInt(s, 10), u = Number.parseInt(o, 10), f = Number.parseInt(i, 10), p = Number.parseInt(l, 10);
  return a < 0 || a > 23 || u < 0 || u > 59 || f < 0 || f > 59 || p < 0 || p >= r ? 0 : a * 3600 + u * 60 + f + p / r;
}
function F(t, r) {
  const e = Number.parseInt(t, 10);
  return Number.isNaN(e) || e < 0 ? 0 : e / r;
}
function P(t) {
  const r = /^(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?(?:\.(\d{1,2}))?$/, e = t.match(r);
  if (!e)
    return 0;
  const [, n, s, o, i] = e;
  let l = 0, a = 0, u = 0, f = 0;
  if (o !== void 0 ? (l = Number.parseInt(n, 10), a = Number.parseInt(s, 10), u = Number.parseInt(o, 10)) : (a = Number.parseInt(n, 10), u = Number.parseInt(s, 10)), i !== void 0 && (f = Number.parseInt(i, 10)), l < 0 || a < 0 || u < 0 || f < 0)
    return 0;
  if (o !== void 0) {
    if (a > 59 || u > 59)
      return 0;
  } else if (u > 59)
    return 0;
  return f > 99 ? 0 : l * 3600 + a * 60 + u + f / 100;
}
function H(t) {
  if (typeof t != "string" || t.length === 0)
    return null;
  const r = t.split(/[?#]/)[0], e = (r.split("/").pop() ?? r).trim(), n = e.lastIndexOf(".");
  return n <= 0 ? null : e.slice(n).toLowerCase();
}
function y(t) {
  return g.sanitize(t, {
    CUSTOM_ELEMENT_HANDLING: {
      allowCustomizedBuiltInElements: !0,
      attributeNameCheck: /^(?!on)[a-z][a-z0-9-]*$/i,
      tagNameCheck: /^cx-/
    }
  });
}
function U(t) {
  return typeof t == "string" ? t.replaceAll(" ", " ") : t == null ? "" : String(t);
}
function W(t) {
  return t == null || t === "" ? " " : String(t);
}
function B(t) {
  return typeof t != "string" ? !1 : Object.values(m).includes(t);
}
function q(t) {
  if (!t)
    return "";
  const r = t.startsWith(".") ? t.toLowerCase() : `.${t.toLowerCase()}`;
  return r === "." ? "" : r;
}
function K(t) {
  return t ? t.toLowerCase() === "true" : !1;
}
export {
  C as F,
  S as G,
  h as M,
  c as T,
  q as a,
  H as b,
  W as c,
  U as d,
  j as e,
  D as f,
  k as g,
  A as h,
  m as i,
  B as j,
  x as k,
  _ as l,
  w as m,
  E as n,
  I as o,
  O as p,
  L as q,
  R as r,
  y as s,
  v as t,
  $ as u,
  K as v
};
