import { location as d, direction as c, color as u } from "@synnaxlabs/x";
function a(s) {
  var r, e, t = "";
  if (typeof s == "string" || typeof s == "number") t += s;
  else if (typeof s == "object") if (Array.isArray(s)) {
    var o = s.length;
    for (r = 0; r < o; r++) s[r] && (e = a(s[r])) && (t && (t += " "), t += e);
  } else for (e in s) s[e] && (t && (t += " "), t += e);
  return t;
}
function p() {
  for (var s, r, e = 0, t = "", o = arguments.length; e < o; e++) (s = arguments[e]) && (r = a(s)) && (t && (t += " "), t += r);
  return t;
}
const h = p, n = "-", l = "__", i = "--", b = (s) => {
  const r = (...e) => h(...e);
  return r.B = (...e) => s + n + e.join(n), r.E = (e) => s + l + e, r.M = (...e) => s + i + e.join("-"), r.BM = (e, ...t) => r.B(e) + i + t.join("-"), r.BE = (e, ...t) => r.B(e) + l + t.join(n), r.BEM = (e, t, ...o) => r.BE(e, t) + i + o.join(n), r.var = (...e) => i + s + n + e.join(n), r;
};
class M {
  rows = [];
  columns = [];
  prefix;
  constructor(r = "") {
    this.prefix = r;
  }
  row(r, e, t) {
    const { prefix: o } = this;
    return this.rows.push({ startLabel: o + r, endLabel: o + e, size: t }), this;
  }
  col(r, e, t) {
    const { prefix: o } = this;
    return this.columns.push({ startLabel: o + r, endLabel: o + e, size: t }), this;
  }
  build() {
    return {
      display: "grid",
      gridTemplateRows: this.rows.map((r, e) => {
        let t = e === 0 ? "[" : "";
        return t += `${r.startLabel}] ${r.size}${typeof r.size == "number" ? "px" : ""} [${r.endLabel}`, t += e === this.rows.length - 1 ? "]" : "", t;
      }).join(" "),
      gridTemplateColumns: this.columns.map((r, e) => {
        let t = e === 0 ? "[" : "";
        return t += `${r.startLabel}] ${r.size}${typeof r.size == "number" ? "px" : ""} [${r.endLabel}`, t += e === this.columns.length - 1 ? "]" : "", t;
      }).join(" ")
    };
  }
}
const f = (s, r) => Object.entries(r).forEach(
  ([e, t]) => t != null && s.style.setProperty(e, `${t}`)
), m = (s, r) => Array.from(s.style).forEach((e) => {
  e.startsWith(r) && s.style.removeProperty(e);
}), y = (s) => {
  const r = b(s);
  return r.visible = (e) => r.M(e ? "visible" : "hidden"), r.expanded = (e) => r.M(e ? "expanded" : "collapsed"), r.loc = (e) => r.M("location", d.construct(e)), r.disabled = (e) => e === !0 && r.M("disabled"), r.align = (e) => r.M(e), r.dir = (e) => e != null && r.M("direction", c.construct(e)), r.sharp = (e) => e !== !1 && r.M("sharp"), r.rounded = (e) => e !== !1 && r.M("rounded"), r.bordered = (e) => typeof e == "boolean" ? e && r.M("bordered") : e != null ? r.M(`bordered-${e.toString()}`) : r.M("bordered"), r.selected = (e) => e && r.M("selected"), r.altColor = (e) => e && r.M("alt-color"), r.editable = (e) => e && r.M("editable"), r.noSelect = r.M("no-select"), r.applyVars = f, r.removeVars = m, r.newGridBuilder = (e) => new M(e), r.dropRegion = (e) => e && r.B("haul-drop-region"), r.px = (e) => `${e}px`, r.inheritDims = (e = !0) => e && r.M("inherit-dims"), r.shade = ((e) => e != null && r.M(`shade-${e}`)), r.colorVar = (e) => {
    if (!(e == null || e === !1))
      return typeof e == "number" ? `var(--${s}-gray-l${e})` : u.cssString(e);
  }, r.levelSizeVar = (e) => `var(--${s}-${e}-size)`, r.level = (e) => r.M(`level-${e}`), r;
}, g = y("pluto");
export {
  g as C,
  p as c,
  b as n
};
