import { r as lt, h as Z, H as ct, g as ht } from "./index.61732cef.js";
import { c as dt, g as ft } from "./index-orsBiyT_.fc4357c3.js";
import "react";
import "react-dom";
var K = { exports: {} }, ut = K.exports, st;
function xt() {
  return st || (st = 1, function(o) {
    (function(l, a) {
      o.exports ? o.exports = a() : l.balanceText = a();
    })(ut, () => {
      let l, a, r;
      const c = {
        sel: [],
        el: []
      };
      let f = !1, v = !1;
      function z() {
      }
      function g(t, e) {
        Array.prototype.forEach.call(t, e);
      }
      function B(t) {
        document.readyState !== "loading" ? t() : document.addEventListener ? document.addEventListener("DOMContentLoaded", t) : document.attachEvent("onreadystatechange", () => {
          document.readyState !== "loading" && t();
        });
      }
      function D(t, e, n, ...i) {
        let s;
        return function() {
          const h = this;
          function S() {
            t.apply(h, i), s = null;
          }
          s && clearTimeout(s), s = setTimeout(S, 100);
        };
      }
      function I() {
        if (typeof window > "u")
          return !1;
        const { style: t } = document.documentElement;
        return t.textWrap || t.WebkitTextWrap || t.MozTextWrap || t.MsTextWrap;
      }
      function C() {
        this.reset();
      }
      C.prototype.reset = function() {
        this.index = 0, this.width = 0;
      };
      function m(t) {
        return a.some((e) => e.start < t && t < e.end);
      }
      function L(t, e) {
        if (t.nodeType === t.ELEMENT_NODE)
          if (window.getComputedStyle(t).whiteSpace === "nowrap") {
            const i = t.outerHTML.length;
            a.push({ start: r, end: r + i }), r += i;
          } else
            g(t.childNodes, (i) => {
              L(i, !0);
            }), e && (r += t.outerHTML.length - t.innerHTML.length);
        else
          t.nodeType === t.COMMENT_NODE ? r += t.length + 7 : t.nodeType === t.PROCESSING_INSTRUCTION_NODE ? r += t.length + 2 : r += t.length;
      }
      function k(t, e, n) {
        if (n === 0)
          t.style.whiteSpace = e, r = 0, a = [], L(t, !1), t.style.whiteSpace = "nowrap";
        else {
          const i = [];
          a.forEach((s) => {
            s.start > n && i.push({ start: s.start - n, end: s.end - n });
          }), a = i;
        }
      }
      function Q(t) {
        let e = t.querySelectorAll('br[data-owner="balance-text-hyphen"]');
        g(e, (i) => {
          i.outerHTML = "";
        }), e = t.querySelectorAll('br[data-owner="balance-text"]'), g(e, (i) => {
          i.outerHTML = " ";
        });
        let n = t.querySelectorAll('span[data-owner="balance-text-softhyphen"]');
        if (n.length > 0 && g(n, (i) => {
          const s = document.createTextNode("\xAD");
          i.parentNode.insertBefore(s, i), i.parentNode.removeChild(i);
        }), n = t.querySelectorAll('span[data-owner="balance-text-justify"]'), n.length > 0) {
          let i = "";
          g(n, (s) => {
            i += s.textContent, s.parentNode.removeChild(s);
          }), t.innerHTML = i;
        }
      }
      const _ = function(t) {
        return (t.currentStyle || window.getComputedStyle(t, null)).textAlign === "justify";
      };
      function d(t, e, n) {
        e = e.trim();
        const i = e.split(" ").length;
        if (e = `${e} `, i < 2)
          return e;
        const s = document.createElement("span");
        s.innerHTML = e, t.appendChild(s);
        const h = s.offsetWidth;
        s.parentNode.removeChild(s);
        const S = Math.floor((n - h) / (i - 1));
        s.style.wordSpacing = `${S}px`, s.setAttribute("data-owner", "balance-text-justify");
        const p = document.createElement("div");
        return p.appendChild(s), p.innerHTML;
      }
      function x(t, e) {
        const n = /([^\S\u00a0]|-|\u2014|\u2013|\u00ad)(?![^<]*>)/g;
        let i;
        if (!l)
          for (l = [], i = n.exec(t); i !== null; )
            m(i.index) || l.push(i.index), i = n.exec(t);
        return l.indexOf(e) !== -1;
      }
      function X(t, e) {
        return e === 0 || e === t.length || x(t, e - 1) && !x(t, e);
      }
      function b(t, e, n, i, s, h, S) {
        let p;
        if (e && typeof e == "string")
          for (; ; ) {
            for (; !X(e, h); )
              h += s;
            if (t.innerHTML = e.substr(0, h), p = t.offsetWidth, s < 0) {
              if (p <= i || p <= 0 || h === 0)
                break;
            } else if (i <= p || n <= p || h === e.length)
              break;
            h += s;
          }
        S.index = h, S.width = p;
      }
      function R(t, e) {
        const n = document.createElement("div");
        n.style.display = "block", n.style.position = "absolute", n.style.bottom = 0, n.style.right = 0, n.style.width = 0, n.style.height = 0, n.style.margin = 0, n.style.padding = 0, n.style.visibility = "hidden", n.style.overflow = "hidden";
        const i = document.createElement("span");
        i.style.fontSize = "2000px", i.innerHTML = "&nbsp;", n.appendChild(i), t.appendChild(n);
        const s = i.getBoundingClientRect();
        n.parentNode.removeChild(n);
        const h = s.height / s.width;
        return e / h;
      }
      function u(t) {
        return t ? typeof t == "string" ? document.querySelectorAll(t) : t.tagName && t.querySelectorAll ? [t] : t : [];
      }
      function O(t) {
        g(u(t), (e) => {
          Q(e);
          const i = e.style.whiteSpace, s = e.style.float, h = e.style.display, S = e.style.position, p = e.style.lineHeight;
          e.style.lineHeight = "normal";
          const E = e.offsetWidth, ot = e.offsetHeight;
          e.style.whiteSpace = "nowrap", e.style.float = "none", e.style.display = "inline", e.style.position = "static";
          let U = e.offsetWidth;
          const P = e.offsetHeight, tt = i === "pre-wrap" ? 0 : R(e, P);
          if (E > 0 && U > E && U < 5e3) {
            let w = e.innerHTML, q = "", N = "";
            const et = _(e);
            let V = Math.round(ot / P), it = 0, W, A, y, H, j, nt, Y;
            for (; V > 1; )
              l = null, k(e, i, it), W = Math.round((U + tt) / V - tt), A = Math.round((w.length + 1) / V) - 1, y = new C(), b(e, w, E, W, -1, A, y), H = new C(), A = y.index, b(e, w, E, W, 1, A, H), y.reset(), A = H.index, b(e, w, E, W, -1, A, y), y.index === 0 ? j = H.index : E < H.width || y.index === H.index ? j = y.index : j = Math.abs(W - y.width) < Math.abs(H.width - W) ? y.index : H.index, N = w.substr(0, j).replace(/\s$/, ""), Y = Boolean(N.match(/\u00ad$/)), Y && (N = N.replace(/\u00ad$/, '<span data-owner="balance-text-softhyphen">-</span>')), et ? q += d(e, N, E) : (q += N, nt = Y || Boolean(N.match(/(-|\u2014|\u2013)$/)), q += nt ? '<br data-owner="balance-text-hyphen" />' : '<br data-owner="balance-text" aria-hidden="true" />'), w = w.substr(j), it = j, V--, e.innerHTML = w, U = e.offsetWidth;
            et ? e.innerHTML = q + d(e, w, E) : e.innerHTML = q + w;
          }
          e.style.whiteSpace = i, e.style.float = s, e.style.display = h, e.style.position = S, e.style.lineHeight = p;
        });
      }
      function T() {
        const t = c.sel.join(","), e = u(t), n = Array.prototype.concat.apply(c.el, e);
        O(n);
      }
      function F() {
        f || (B(T), window.addEventListener("load", T), window.addEventListener("resize", D(T)), f = !0);
      }
      function M(t) {
        typeof t == "string" ? c.sel.push(t) : g(u(t), (e) => {
          c.el.push(e);
        }), F(), T();
      }
      function J(t) {
        typeof t == "string" ? c.sel = c.sel.filter((e) => e !== t) : (t = u(t), c.el = c.el.filter((e) => t.indexOf(e) === -1));
      }
      function G() {
        v || (c.sel.push(".balance-text"), F(), v = !0);
      }
      function $(t, e) {
        t ? e && e.watch === !0 ? M(t) : e && e.watch === !1 ? J(t) : O(t) : G();
      }
      return $.updateWatched = T, I() ? (z.updateWatched = z, z) : $;
    });
  }(K)), K.exports;
}
var pt = xt(), gt = /* @__PURE__ */ ft(pt);
/**
  shave - Shave is a javascript plugin that truncates multi-line text within a html element based on set max height
  @version v5.0.2
  @link https://github.com/yowainwright/shave#readme
  @author Jeff Wainwright <yowainwright@gmail.com> (jeffry.in)
  @license MIT
**/
function rt(o, l) {
  var a = typeof Symbol == "function" && o[Symbol.iterator];
  if (!a)
    return o;
  var r = a.call(o), c, f = [], v;
  try {
    for (; !(c = r.next()).done; )
      f.push(c.value);
  } catch (z) {
    v = { error: z };
  } finally {
    try {
      c && !c.done && (a = r.return) && a.call(r);
    } finally {
      if (v)
        throw v.error;
    }
  }
  return f;
}
function at(o, l, a) {
  if (arguments.length === 2)
    for (var r = 0, c = l.length, f; r < c; r++)
      (f || !(r in l)) && (f || (f = Array.prototype.slice.call(l, 0, r)), f[r] = l[r]);
  return o.concat(f || Array.prototype.slice.call(l));
}
function wt(o) {
  return typeof o == "string" ? at([], rt(document.querySelectorAll(o)), !1) : "length" in o ? at([], rt(o), !1) : [o];
}
function yt(o, l, a) {
  if (a === void 0 && (a = {}), typeof l > "u" || isNaN(l))
    throw Error("maxHeight is required");
  var r = wt(o);
  if (!!r.length)
    for (var c = a.character, f = c === void 0 ? "\u2026" : c, v = a.classname, z = v === void 0 ? "js-shave" : v, g = a.spaces, B = g === void 0 ? !0 : g, D = a.charclassname, I = D === void 0 ? "js-shave-char" : D, C = a.link, m = C === void 0 ? {} : C, L = typeof B == "boolean" ? B : !0, k = m && JSON.stringify(m) !== "{}" && m.href, Q = k ? "a" : "span", _ = 0; _ < r.length; _ += 1) {
      var d = r[_], x = d.style, X = d.querySelector("." + z), b = d.textContent === void 0 ? "innerText" : "textContent";
      X && (d.removeChild(d.querySelector("." + I)), d[b] = d[b]);
      var R = d[b], u = L ? R.split(" ") : R;
      if (!(u.length < 2)) {
        var O = x.height;
        x.height = "auto";
        var T = x.maxHeight;
        if (x.maxHeight = "none", d.offsetHeight <= l) {
          x.height = O, x.maxHeight = T;
          continue;
        }
        var F = k && m.textContent ? m.textContent : f, M = document.createElement(Q), J = {
          className: I,
          textContent: F
        };
        for (var G in J)
          M[G] = J[G], M.textContent = f;
        if (k)
          for (var $ in m)
            M[$] = m[$];
        for (var t = u.length - 1, e = 0, n = void 0; e < t; )
          n = e + t + 1 >> 1, d[b] = L ? u.slice(0, n).join(" ") : u.slice(0, n), d.insertAdjacentElement("beforeend", M), d.offsetHeight > l ? t = n - 1 : e = n;
        d[b] = L ? u.slice(0, t).join(" ") : u.slice(0, t), d.insertAdjacentElement("beforeend", M);
        var i = L ? " ".concat(u.slice(t).join(" ")) : u.slice(t), s = document.createTextNode(i), h = document.createElement("span");
        h.classList.add(z), h.style.display = "none", h.appendChild(s), d.insertAdjacentElement("beforeend", h), x.height = O, x.maxHeight = T;
      }
    }
}
const vt = () => ".sc-swirl-text-h{display:block;max-width:100%}.sc-swirl-text-h *.sc-swirl-text{box-sizing:border-box}.text.sc-swirl-text{overflow:hidden;margin:0;padding:0}.text--align-start.sc-swirl-text{text-align:start}.text--align-center.sc-swirl-text{text-align:center}.text--align-end.sc-swirl-text{text-align:end}.text--color-default.sc-swirl-text{color:var(--s-text-default)}.text--color-disabled.sc-swirl-text{color:var(--s-text-disabled)}.text--color-highlight.sc-swirl-text{color:var(--s-text-highlight)}.text--color-on-action-primary.sc-swirl-text{color:var(--s-text-on-action-primary)}.text--color-on-image.sc-swirl-text{color:var(--s-text-on-image)}.text--color-on-status.sc-swirl-text{color:var(--s-text-on-status)}.text--color-on-surface-highlight.sc-swirl-text{color:var(--s-text-on-surface-highlight)}.text--color-on-surface-highlight-subdued.sc-swirl-text{color:var(--s-text-on-surface-highlight-subdued)}.text--color-subdued.sc-swirl-text{color:var(--s-text-subdued)}.text--color-critical.sc-swirl-text{color:var(--s-text-critical)}.text--color-success.sc-swirl-text{color:var(--s-text-success)}.text--color-warning.sc-swirl-text{color:var(--s-text-warning)}.text--size-xs.sc-swirl-text{font-size:var(--s-font-size-xs);line-height:var(--s-line-height-xs)}.text--size-sm.sc-swirl-text{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}.text--size-base.sc-swirl-text{font-size:var(--s-font-size-base);line-height:var(--s-line-height-base)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.text--size-base.text--responsive.sc-swirl-text{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.text--size-lg.sc-swirl-text{font-size:var(--s-font-size-lg);line-height:var(--s-line-height-lg)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.text--size-lg.text--responsive.sc-swirl-text{font-size:var(--s-font-size-base);line-height:var(--s-line-height-base)}}.text--size-xl.sc-swirl-text{font-size:var(--s-font-size-xl);line-height:var(--s-line-height-xl)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.text--size-xl.text--responsive.sc-swirl-text{font-size:var(--s-font-size-lg);line-height:var(--s-line-height-lg)}}.text--size-2xl.sc-swirl-text{font-size:var(--s-font-size-2xl);line-height:var(--s-line-height-2xl)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.text--size-2xl.text--responsive.sc-swirl-text{font-size:var(--s-font-size-xl);line-height:var(--s-line-height-xl)}}.text--weight-normal.sc-swirl-text{font-weight:var(--s-font-weight-normal)}.text--weight-medium.sc-swirl-text{font-weight:var(--s-font-weight-medium)}.text--weight-semibold.sc-swirl-text{font-weight:var(--s-font-weight-semibold)}.text--weight-bold.sc-swirl-text{font-weight:var(--s-font-weight-bold)}.text--font-style-normal.sc-swirl-text{font-style:normal}.text--font-style-italic.sc-swirl-text{font-style:italic}.text--font-family-code.sc-swirl-text{font-family:var(--s-font-family-code)}.text--truncate.sc-swirl-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.text--truncate-direction-start.sc-swirl-text{direction:rtl;text-align:left}", mt = class {
  constructor(o) {
    lt(this, o), this.align = "start", this.as = "p", this.color = "default", this.fontFamily = "text", this.fontStyle = "normal", this.responsive = !0, this.size = "base", this.truncateDirection = "end", this.weight = "normal", this.whiteSpace = "normal";
  }
  componentDidRender() {
    this.rebalance(), this.handleTruncation();
  }
  onWindowResize() {
    this.rebalance(), this.handleTruncation();
  }
  handleTruncation() {
    if (!this.truncate || !Boolean(this.lines) || this.lines === 1)
      return;
    const o = +window.getComputedStyle(this.textEl, null).getPropertyValue("line-height").replace("px", "");
    o > 0 && yt(this.textEl, o * this.lines);
  }
  rebalance() {
    !this.balance || !Boolean(this.textEl) || gt(this.textEl);
  }
  render() {
    const o = this.as, l = this.truncate && (!Boolean(this.lines) || this.lines === 1), a = dt("text", `text--align-${this.align}`, `text--color-${this.color}`, `text--font-family-${this.fontFamily}`, `text--font-style-${this.fontStyle}`, `text--size-${this.size}`, `text--truncate-direction-${this.truncateDirection}`, `text--weight-${this.weight}`, {
      "text--truncate": l,
      "text--responsive": this.responsive
    }), r = {
      whiteSpace: l ? "nowrap" : this.whiteSpace
    };
    return Z(ct, { key: "c7e5c1fe48bf2922d59882164f2dbcbcdb886920" }, Z(o, { key: "e448f3f46c6debac61d339b3b0a948e74f334f2b", class: a, ref: (c) => this.textEl = c, style: r }, Z("slot", { key: "7f7dfe2c44d3c3b8c9105643c7eaf493a980d6b7" })));
  }
  get el() {
    return ht(this);
  }
};
mt.style = vt();
export {
  mt as swirl_text
};
