/*!
 * matrix 3.13.0
 * https://gsap.com
 *
 * Copyright 2008-2025, GreenSock. All rights reserved.
 * Subject to the terms at https://gsap.com/standard-license
 * @author: Jack Doyle, jack@greensock.com
*/
var g, b, E, x, w, y, C, _, u = "transform", S = u + "Origin", D, m = function(t) {
  var o = t.ownerDocument || t;
  for (!(u in t.style) && ("msTransform" in t.style) && (u = "msTransform", S = u + "Origin"); o.parentNode && (o = o.parentNode); )
    ;
  if (b = window, C = new v(), o) {
    g = o, E = o.documentElement, x = o.body, _ = g.createElementNS("http://www.w3.org/2000/svg", "g"), _.style.transform = "none";
    var e = o.createElement("div"), s = o.createElement("div"), a = o && (o.body || o.firstElementChild);
    a && a.appendChild && (a.appendChild(e), e.appendChild(s), e.setAttribute("style", "position:static;transform:translate3d(0,0,1px)"), D = s.offsetParent !== e, a.removeChild(e));
  }
  return o;
}, R = function(t) {
  for (var o, e; t && t !== x; )
    e = t._gsap, e && e.uncache && e.get(t, "x"), e && !e.scaleX && !e.scaleY && e.renderTransform && (e.scaleX = e.scaleY = 1e-4, e.renderTransform(1, e), o ? o.push(e) : o = [e]), t = t.parentNode;
  return o;
}, B = [], A = [], P = function() {
  return b.pageYOffset || g.scrollTop || E.scrollTop || x.scrollTop || 0;
}, I = function() {
  return b.pageXOffset || g.scrollLeft || E.scrollLeft || x.scrollLeft || 0;
}, L = function(t) {
  return t.ownerSVGElement || ((t.tagName + "").toLowerCase() === "svg" ? t : null);
}, X = function p(t) {
  if (b.getComputedStyle(t).position === "fixed")
    return !0;
  if (t = t.parentNode, t && t.nodeType === 1)
    return p(t);
}, T = function p(t, o) {
  if (t.parentNode && (g || m(t))) {
    var e = L(t), s = e ? e.getAttribute("xmlns") || "http://www.w3.org/2000/svg" : "http://www.w3.org/1999/xhtml", a = e ? o ? "rect" : "g" : "div", r = o !== 2 ? 0 : 100, c = o === 3 ? 100 : 0, f = "position:absolute;display:block;pointer-events:none;margin:0;padding:0;", i = g.createElementNS ? g.createElementNS(s.replace(/^https/, "http"), a) : g.createElement(a);
    return o && (e ? (y || (y = p(t)), i.setAttribute("width", 0.01), i.setAttribute("height", 0.01), i.setAttribute("transform", "translate(" + r + "," + c + ")"), y.appendChild(i)) : (w || (w = p(t), w.style.cssText = f), i.style.cssText = f + "width:0.1px;height:0.1px;top:" + c + "px;left:" + r + "px", w.appendChild(i))), i;
  }
  throw "Need document and parent.";
}, Y = function(t) {
  for (var o = new v(), e = 0; e < t.numberOfItems; e++)
    o.multiply(t.getItem(e).matrix);
  return o;
}, F = function(t) {
  var o = t.getCTM(), e;
  return o || (e = t.style[u], t.style[u] = "none", t.appendChild(_), o = _.getCTM(), t.removeChild(_), e ? t.style[u] = e : t.style.removeProperty(u.replace(/([A-Z])/g, "-$1").toLowerCase())), o || C.clone();
}, G = function(t, o) {
  var e = L(t), s = t === e, a = e ? B : A, r = t.parentNode, c = r && !e && r.shadowRoot && r.shadowRoot.appendChild ? r.shadowRoot : r, f, i, n, l, d, h;
  if (t === b)
    return t;
  if (a.length || a.push(T(t, 1), T(t, 2), T(t, 3)), f = e ? y : w, e)
    s ? (n = F(t), l = -n.e / n.a, d = -n.f / n.d, i = C) : t.getBBox ? (n = t.getBBox(), i = t.transform ? t.transform.baseVal : {}, i = i.numberOfItems ? i.numberOfItems > 1 ? Y(i) : i.getItem(0).matrix : C, l = i.a * n.x + i.c * n.y, d = i.b * n.x + i.d * n.y) : (i = new v(), l = d = 0), o && t.tagName.toLowerCase() === "g" && (l = d = 0), (s ? e : r).appendChild(f), f.setAttribute("transform", "matrix(" + i.a + "," + i.b + "," + i.c + "," + i.d + "," + (i.e + l) + "," + (i.f + d) + ")");
  else {
    if (l = d = 0, D)
      for (i = t.offsetParent, n = t; n && (n = n.parentNode) && n !== i && n.parentNode; )
        (b.getComputedStyle(n)[u] + "").length > 4 && (l = n.offsetLeft, d = n.offsetTop, n = 0);
    if (h = b.getComputedStyle(t), h.position !== "absolute" && h.position !== "fixed")
      for (i = t.offsetParent; r && r !== i; )
        l += r.scrollLeft || 0, d += r.scrollTop || 0, r = r.parentNode;
    n = f.style, n.top = t.offsetTop - d + "px", n.left = t.offsetLeft - l + "px", n[u] = h[u], n[S] = h[S], n.position = h.position === "fixed" ? "fixed" : "absolute", c.appendChild(f);
  }
  return f;
}, N = function(t, o, e, s, a, r, c) {
  return t.a = o, t.b = e, t.c = s, t.d = a, t.e = r, t.f = c, t;
}, v = /* @__PURE__ */ (function() {
  function p(o, e, s, a, r, c) {
    o === void 0 && (o = 1), e === void 0 && (e = 0), s === void 0 && (s = 0), a === void 0 && (a = 1), r === void 0 && (r = 0), c === void 0 && (c = 0), N(this, o, e, s, a, r, c);
  }
  var t = p.prototype;
  return t.inverse = function() {
    var e = this.a, s = this.b, a = this.c, r = this.d, c = this.e, f = this.f, i = e * r - s * a || 1e-10;
    return N(this, r / i, -s / i, -a / i, e / i, (a * f - r * c) / i, -(e * f - s * c) / i);
  }, t.multiply = function(e) {
    var s = this.a, a = this.b, r = this.c, c = this.d, f = this.e, i = this.f, n = e.a, l = e.c, d = e.b, h = e.d, O = e.e, M = e.f;
    return N(this, n * s + d * r, n * a + d * c, l * s + h * r, l * a + h * c, f + O * s + M * r, i + O * a + M * c);
  }, t.clone = function() {
    return new p(this.a, this.b, this.c, this.d, this.e, this.f);
  }, t.equals = function(e) {
    var s = this.a, a = this.b, r = this.c, c = this.d, f = this.e, i = this.f;
    return s === e.a && a === e.b && r === e.c && c === e.d && f === e.e && i === e.f;
  }, t.apply = function(e, s) {
    s === void 0 && (s = {});
    var a = e.x, r = e.y, c = this.a, f = this.b, i = this.c, n = this.d, l = this.e, d = this.f;
    return s.x = a * c + r * i + l || 0, s.y = a * f + r * n + d || 0, s;
  }, p;
})();
function V(p, t, o, e) {
  if (!p || !p.parentNode || (g || m(p)).documentElement === p)
    return new v();
  var s = R(p), a = L(p), r = a ? B : A, c = G(p, o), f = r[0].getBoundingClientRect(), i = r[1].getBoundingClientRect(), n = r[2].getBoundingClientRect(), l = c.parentNode, d = !e && X(p), h = new v((i.left - f.left) / 100, (i.top - f.top) / 100, (n.left - f.left) / 100, (n.top - f.top) / 100, f.left + (d ? 0 : I()), f.top + (d ? 0 : P()));
  if (l.removeChild(c), s)
    for (f = s.length; f--; )
      i = s[f], i.scaleX = i.scaleY = 0, i.renderTransform(1, i);
  return t ? h.inverse() : h;
}
export {
  v as Matrix2D,
  F as _getCTM,
  I as _getDocScrollLeft,
  P as _getDocScrollTop,
  X as _isFixed,
  m as _setDoc,
  V as getGlobalMatrix
};
