import "lit";
class r {
  #t;
  get mediaSize() {
    return this.#s(), this.#t || "medium";
  }
  #e;
  #i;
  constructor(t, e = 40, s = 80) {
    this.host = t, this.#e = e, this.#i = s, t.addController(this), this.observer = new ResizeObserver((i) => {
      for (const o of i)
        this.contentRect = o.contentRect, this.#s(!0);
    });
  }
  setMediaBreakpoints(t, e) {
    this.#e = t, this.#i = e, this.#s();
  }
  hostConnected() {
    this.observer.observe(this.host);
  }
  hostDisconnected() {
    this.observer.disconnect();
  }
  #s(t = !1) {
    if (t || this.#t === void 0) {
      if (!this.contentRect?.width) {
        this.#t = void 0;
        return;
      }
      const e = getComputedStyle(document.documentElement), s = parseFloat(e.fontSize), i = this.contentRect.width / s, o = this.#t;
      i < this.#e ? this.#t = "small" : i < this.#i ? this.#t = "medium" : this.#t = "large", o !== this.mediaSize && this.host.requestUpdate();
    }
  }
}
export {
  r as ResizeController
};
