var fn = Object.defineProperty;
var Un = (e, A, r) => A in e ? fn(e, A, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[A] = r;
var ue = (e, A, r) => (Un(e, typeof A != "symbol" ? A + "" : A, r), r);
import { ViewMode as cB, UIActionHandler as Fn, PluginStaticResource as hn } from "@ibiz-template/runtime";
import { useWFStepTraceViewController as dn, usePropsWatch as En, useNamespace as et, useViewController as Hn, useEditView3Controller as pn } from "@ibiz-template/vue-util";
import { defineComponent as rt, getCurrentInstance as tt, ref as Xe, h as Qr } from "vue";
import { ViewType as In } from "@ibiz-template/model";
import { createUUID as ct } from "qx-util";
import { WFDynaEditView3Controller as vn } from "@ibiz-template/controller";
const gB = rt({
  name: "WFStepTraceGrid",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    },
    deName: {
      type: String,
      required: !0
    }
  },
  setup(e) {
    const {
      proxy: A
    } = tt(), r = dn(A, e.modelPath);
    En(A, "deName", r.setDeName.bind(r));
    const t = et("wf-step-trace-grid"), B = Xe([]), n = (i, a, o = !1) => {
      i.comments.length > 0 && i.comments.forEach((Q) => {
        o && Q.type === "启动流程" || a.push({
          id: ct(),
          nodeName: i.userTaskName,
          personName: Q.authorName,
          time: Q.time,
          content: Q.type,
          comment: Q.fullMessage
        });
      });
    };
    r.nerve.self.evt.on("mounted", () => {
      var i;
      r.data && ((i = r.data.usertasks) == null || i.forEach((a) => {
        if (a.usertasks && a.usertasks.length > 0) {
          const o = [];
          a.usertasks.forEach((Q) => {
            n(Q, o, !0);
          }), B.value.push({
            id: ct(),
            nodeName: `${a.userTaskName}`,
            personName: "",
            time: "",
            content: "",
            comment: "",
            children: o,
            _showChildren: !0
          });
        } else
          n(a, B.value);
      }), B.value.sort((a, o) => Date.parse(a.time) - Date.parse(o.time)));
    });
    const s = Xe([{
      title: "处理环节",
      key: "nodeName",
      width: 250,
      resizable: !0,
      tree: !0,
      className: "clhj"
    }, {
      title: "处理人",
      key: "personName",
      width: 150,
      resizable: !0
    }, {
      title: "处理时间",
      key: "time",
      width: 180,
      resizable: !0
    }, {
      title: "处理内容",
      key: "content",
      width: 150,
      resizable: !0
    }, {
      title: "处理意见",
      key: "comment"
    }]);
    return {
      c: r,
      ns: t,
      gridData: B,
      columns: s
    };
  },
  render() {
    return Qr("div", {
      class: this.ns.b()
    }, [Qr("div", {
      class: this.ns.e("title")
    }, ["审批信息"]), Qr("i-table", {
      attrs: {
        "disabled-hover": !0,
        columns: this.columns,
        data: this.gridData,
        "row-key": "id"
      },
      class: this.ns.e("grid")
    })]);
  }
});
class mn extends vn {
  async calcWfToolbar() {
    await super.calcWfToolbar(), this.isEditable && this.wfLinks.unshift({
      sequenceFlowName: "保存",
      type: "FORM_SAVE"
    });
  }
  async onLinkClick(A) {
    A.type === "FORM_SAVE" ? await this.save() : super.onLinkClick(A);
  }
}
const yn = rt({
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    const {
      proxy: A
    } = tt(), r = Hn(A, (s, i) => new mn(e.modelPath, s, i)), t = et(`view-${In.DE_WF_DYNA_EDIT_VIEW3}`.toLowerCase()), B = Xe(["mainForm"]);
    return {
      c: r,
      ns: t,
      onTabClick: (s) => {
        B.value.includes(s) || B.value.push(s);
      },
      lazyList: B
    };
  },
  render(e) {
    const A = [];
    if (this.c.complete) {
      const {
        activeForm: r
      } = this.c;
      r && this.c.providers[r.name] && A.push(e(this.c.providers[r.name].component, {
        props: {
          modelData: r,
          context: this.c.context,
          params: this.c.params
        },
        style: {
          height: "auto"
        },
        on: {
          neuronInit: this.c.nerve.onNeuronInit("form")
        }
      }));
    }
    if (this.c.complete && this.c.model.drTab.pages[0]) {
      const r = this.c.model.drTab.pages[0], t = this.c.drPages[r.source.name];
      A.push(e(gB, {
        attrs: {
          context: t.context,
          params: t.params,
          deName: this.c.model.appEntity.source.codeName,
          modal: this.modal,
          modelPath: r.embedView.source.modelPath
        }
      }));
    }
    return e("view-base", {
      attrs: {
        controller: this.c
      },
      scopedSlots: {
        toolbar: () => this.c.complete ? [this.c.wfLinks.length > 0 && e("wf-toolbar", {
          attrs: {
            wfLinks: this.c.wfLinks
          },
          on: {
            "wf-link-click": (r) => {
              this.c.onLinkClick(r);
            }
          }
        })] : null
      }
    }, [this.c.complete && e("i-tabs", {
      class: [this.ns.be("", "tab")],
      attrs: {
        name: this.c.model.drTab.source.name
      },
      on: {
        "on-click": this.onTabClick
      }
    }, [e("i-tab-pane", {
      class: this.ns.be("", "tab-item"),
      attrs: {
        tab: this.c.model.drTab.source.name,
        label: this.c.model.drTab.source.editItemCaption,
        name: "mainForm"
      }
    }, [A]), this.c.model.drTab.pages.map((r) => {
      const t = this.c.drPages[r.source.name];
      return e("i-tab-pane", {
        class: this.ns.be("", "tab-item"),
        attrs: {
          tab: this.c.model.drTab.source.name,
          disabled: this.c.isNewData,
          label: r.source.caption,
          name: r.source.name
        }
      }, [!this.c.isNewData && this.lazyList.includes(r.source.name) && e("ViewShell", {
        attrs: {
          context: t.context,
          params: t.params,
          modal: {
            mode: cB.EMBED
          },
          modelPath: r.embedView.source.modelPath,
          // 流程跟踪视图用
          deName: this.c.model.appEntity.source.codeName
        },
        on: {
          neuronInit: this.c.nerve.onNeuronInit(r.source.name)
        },
        key: t.key
      })]);
    })])]);
  }
});
class Kn {
  constructor() {
    ue(this, "component", yn);
  }
}
const Ln = rt({
  name: "SyEditView3",
  props: {
    context: Object,
    params: {
      type: Object
    },
    modelPath: {
      type: String,
      required: !0
    },
    modal: {
      type: Object
    }
  },
  setup(e) {
    const {
      proxy: A
    } = tt(), r = pn(A, e.modelPath), t = et("view-deeditview3"), B = Xe(["mainForm"]);
    return {
      c: r,
      ns: t,
      onTabClick: (s) => {
        B.value.includes(s) || B.value.push(s);
      },
      lazyList: B
    };
  },
  render(e) {
    return e("view-base", {
      attrs: {
        controller: this.c
      }
    }, [this.c.complete && e("i-tabs", {
      class: [this.ns.be("", "tab")],
      attrs: {
        name: this.c.model.drTab.source.name
      },
      on: {
        "on-click": this.onTabClick
      }
    }, [e("i-tab-pane", {
      class: this.ns.be("", "tab-item"),
      attrs: {
        tab: this.c.model.drTab.source.name,
        label: this.c.model.drTab.source.editItemCaption,
        name: "mainForm"
      }
    }, [e("edit-form-control", {
      attrs: {
        modelData: this.c.model.form,
        context: this.c.context,
        params: this.c.params
      },
      style: {
        height: "auto"
      },
      on: {
        neuronInit: this.c.nerve.onNeuronInit(this.c.model.form.source.name)
      }
    }), e(gB, {
      attrs: {
        context: this.c.drPages[this.c.model.drTab.pages[0].source.name].context,
        params: this.c.drPages[this.c.model.drTab.pages[0].source.name].params,
        deName: this.c.model.appEntity.source.codeName,
        modal: this.modal,
        modelPath: this.c.model.drTab.pages[0].embedView.source.modelPath
      }
    })]), this.c.model.drTab.pages.map((A) => {
      const r = this.c.drPages[A.source.name];
      if (r)
        return e("i-tab-pane", {
          class: this.ns.be("", "tab-item"),
          attrs: {
            tab: this.c.model.drTab.source.name,
            disabled: this.c.isNewData,
            label: A.source.caption,
            name: A.source.name
          }
        }, [!this.c.isNewData && this.lazyList.includes(A.source.name) && e("ViewShell", {
          attrs: {
            context: r.context,
            params: r.params,
            modal: {
              mode: cB.EMBED
            },
            modelPath: A.embedView.source.modelPath,
            // 流程跟踪视图用
            deName: this.c.model.appEntity.source.codeName
          },
          on: {
            neuronInit: this.c.nerve.onNeuronInit(A.source.name)
          },
          key: r.key
        })]);
    })])]);
  }
});
class bn {
  constructor() {
    ue(this, "component", Ln);
  }
}
/*!
 * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
 * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
 * Released under MIT License
 */
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var Dr = function(e, A) {
  return Dr = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(r, t) {
    r.__proto__ = t;
  } || function(r, t) {
    for (var B in t)
      Object.prototype.hasOwnProperty.call(t, B) && (r[B] = t[B]);
  }, Dr(e, A);
};
function tA(e, A) {
  if (typeof A != "function" && A !== null)
    throw new TypeError("Class extends value " + String(A) + " is not a constructor or null");
  Dr(e, A);
  function r() {
    this.constructor = e;
  }
  e.prototype = A === null ? Object.create(A) : (r.prototype = A.prototype, new r());
}
var xr = function() {
  return xr = Object.assign || function(A) {
    for (var r, t = 1, B = arguments.length; t < B; t++) {
      r = arguments[t];
      for (var n in r)
        Object.prototype.hasOwnProperty.call(r, n) && (A[n] = r[n]);
    }
    return A;
  }, xr.apply(this, arguments);
};
function J(e, A, r, t) {
  function B(n) {
    return n instanceof r ? n : new r(function(s) {
      s(n);
    });
  }
  return new (r || (r = Promise))(function(n, s) {
    function i(Q) {
      try {
        o(t.next(Q));
      } catch (c) {
        s(c);
      }
    }
    function a(Q) {
      try {
        o(t.throw(Q));
      } catch (c) {
        s(c);
      }
    }
    function o(Q) {
      Q.done ? n(Q.value) : B(Q.value).then(i, a);
    }
    o((t = t.apply(e, A || [])).next());
  });
}
function X(e, A) {
  var r = { label: 0, sent: function() {
    if (n[0] & 1)
      throw n[1];
    return n[1];
  }, trys: [], ops: [] }, t, B, n, s;
  return s = { next: i(0), throw: i(1), return: i(2) }, typeof Symbol == "function" && (s[Symbol.iterator] = function() {
    return this;
  }), s;
  function i(o) {
    return function(Q) {
      return a([o, Q]);
    };
  }
  function a(o) {
    if (t)
      throw new TypeError("Generator is already executing.");
    for (; r; )
      try {
        if (t = 1, B && (n = o[0] & 2 ? B.return : o[0] ? B.throw || ((n = B.return) && n.call(B), 0) : B.next) && !(n = n.call(B, o[1])).done)
          return n;
        switch (B = 0, n && (o = [o[0] & 2, n.value]), o[0]) {
          case 0:
          case 1:
            n = o;
            break;
          case 4:
            return r.label++, { value: o[1], done: !1 };
          case 5:
            r.label++, B = o[1], o = [0];
            continue;
          case 7:
            o = r.ops.pop(), r.trys.pop();
            continue;
          default:
            if (n = r.trys, !(n = n.length > 0 && n[n.length - 1]) && (o[0] === 6 || o[0] === 2)) {
              r = 0;
              continue;
            }
            if (o[0] === 3 && (!n || o[1] > n[0] && o[1] < n[3])) {
              r.label = o[1];
              break;
            }
            if (o[0] === 6 && r.label < n[1]) {
              r.label = n[1], n = o;
              break;
            }
            if (n && r.label < n[2]) {
              r.label = n[2], r.ops.push(o);
              break;
            }
            n[2] && r.ops.pop(), r.trys.pop();
            continue;
        }
        o = A.call(e, r);
      } catch (Q) {
        o = [6, Q], B = 0;
      } finally {
        t = n = 0;
      }
    if (o[0] & 5)
      throw o[1];
    return { value: o[0] ? o[1] : void 0, done: !0 };
  }
}
function Ce(e, A, r) {
  if (r || arguments.length === 2)
    for (var t = 0, B = A.length, n; t < B; t++)
      (n || !(t in A)) && (n || (n = Array.prototype.slice.call(A, 0, t)), n[t] = A[t]);
  return e.concat(n || A);
}
var wA = (
  /** @class */
  function() {
    function e(A, r, t, B) {
      this.left = A, this.top = r, this.width = t, this.height = B;
    }
    return e.prototype.add = function(A, r, t, B) {
      return new e(this.left + A, this.top + r, this.width + t, this.height + B);
    }, e.fromClientRect = function(A, r) {
      return new e(r.left + A.windowBounds.left, r.top + A.windowBounds.top, r.width, r.height);
    }, e.fromDOMRectList = function(A, r) {
      var t = Array.from(r).find(function(B) {
        return B.width !== 0;
      });
      return t ? new e(t.left + A.windowBounds.left, t.top + A.windowBounds.top, t.width, t.height) : e.EMPTY;
    }, e.EMPTY = new e(0, 0, 0, 0), e;
  }()
), Ar = function(e, A) {
  return wA.fromClientRect(e, A.getBoundingClientRect());
}, Dn = function(e) {
  var A = e.body, r = e.documentElement;
  if (!A || !r)
    throw new Error("Unable to get document size");
  var t = Math.max(Math.max(A.scrollWidth, r.scrollWidth), Math.max(A.offsetWidth, r.offsetWidth), Math.max(A.clientWidth, r.clientWidth)), B = Math.max(Math.max(A.scrollHeight, r.scrollHeight), Math.max(A.offsetHeight, r.offsetHeight), Math.max(A.clientHeight, r.clientHeight));
  return new wA(0, 0, t, B);
}, er = function(e) {
  for (var A = [], r = 0, t = e.length; r < t; ) {
    var B = e.charCodeAt(r++);
    if (B >= 55296 && B <= 56319 && r < t) {
      var n = e.charCodeAt(r++);
      (n & 64512) === 56320 ? A.push(((B & 1023) << 10) + (n & 1023) + 65536) : (A.push(B), r--);
    } else
      A.push(B);
  }
  return A;
}, S = function() {
  for (var e = [], A = 0; A < arguments.length; A++)
    e[A] = arguments[A];
  if (String.fromCodePoint)
    return String.fromCodePoint.apply(String, e);
  var r = e.length;
  if (!r)
    return "";
  for (var t = [], B = -1, n = ""; ++B < r; ) {
    var s = e[B];
    s <= 65535 ? t.push(s) : (s -= 65536, t.push((s >> 10) + 55296, s % 1024 + 56320)), (B + 1 === r || t.length > 16384) && (n += String.fromCharCode.apply(String, t), t.length = 0);
  }
  return n;
}, gt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", xn = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
for (var fe = 0; fe < gt.length; fe++)
  xn[gt.charCodeAt(fe)] = fe;
var wt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", jA = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
for (var Ue = 0; Ue < wt.length; Ue++)
  jA[wt.charCodeAt(Ue)] = Ue;
var Tn = function(e) {
  var A = e.length * 0.75, r = e.length, t, B = 0, n, s, i, a;
  e[e.length - 1] === "=" && (A--, e[e.length - 2] === "=" && A--);
  var o = typeof ArrayBuffer < "u" && typeof Uint8Array < "u" && typeof Uint8Array.prototype.slice < "u" ? new ArrayBuffer(A) : new Array(A), Q = Array.isArray(o) ? o : new Uint8Array(o);
  for (t = 0; t < r; t += 4)
    n = jA[e.charCodeAt(t)], s = jA[e.charCodeAt(t + 1)], i = jA[e.charCodeAt(t + 2)], a = jA[e.charCodeAt(t + 3)], Q[B++] = n << 2 | s >> 4, Q[B++] = (s & 15) << 4 | i >> 2, Q[B++] = (i & 3) << 6 | a & 63;
  return o;
}, Sn = function(e) {
  for (var A = e.length, r = [], t = 0; t < A; t += 2)
    r.push(e[t + 1] << 8 | e[t]);
  return r;
}, On = function(e) {
  for (var A = e.length, r = [], t = 0; t < A; t += 4)
    r.push(e[t + 3] << 24 | e[t + 2] << 16 | e[t + 1] << 8 | e[t]);
  return r;
}, DA = 5, Bt = 6 + 5, cr = 2, Mn = Bt - DA, wB = 65536 >> DA, Gn = 1 << DA, gr = Gn - 1, Rn = 1024 >> DA, Vn = wB + Rn, Nn = Vn, Pn = 32, Xn = Nn + Pn, _n = 65536 >> Bt, Jn = 1 << Mn, kn = Jn - 1, lt = function(e, A, r) {
  return e.slice ? e.slice(A, r) : new Uint16Array(Array.prototype.slice.call(e, A, r));
}, Wn = function(e, A, r) {
  return e.slice ? e.slice(A, r) : new Uint32Array(Array.prototype.slice.call(e, A, r));
}, Yn = function(e, A) {
  var r = Tn(e), t = Array.isArray(r) ? On(r) : new Uint32Array(r), B = Array.isArray(r) ? Sn(r) : new Uint16Array(r), n = 24, s = lt(B, n / 2, t[4] / 2), i = t[5] === 2 ? lt(B, (n + t[4]) / 2) : Wn(t, Math.ceil((n + t[4]) / 4));
  return new Zn(t[0], t[1], t[2], t[3], s, i);
}, Zn = (
  /** @class */
  function() {
    function e(A, r, t, B, n, s) {
      this.initialValue = A, this.errorValue = r, this.highStart = t, this.highValueIndex = B, this.index = n, this.data = s;
    }
    return e.prototype.get = function(A) {
      var r;
      if (A >= 0) {
        if (A < 55296 || A > 56319 && A <= 65535)
          return r = this.index[A >> DA], r = (r << cr) + (A & gr), this.data[r];
        if (A <= 65535)
          return r = this.index[wB + (A - 55296 >> DA)], r = (r << cr) + (A & gr), this.data[r];
        if (A < this.highStart)
          return r = Xn - _n + (A >> Bt), r = this.index[r], r += A >> DA & kn, r = this.index[r], r = (r << cr) + (A & gr), this.data[r];
        if (A <= 1114111)
          return this.data[this.highValueIndex];
      }
      return this.errorValue;
    }, e;
  }()
), ut = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", qn = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
for (var Fe = 0; Fe < ut.length; Fe++)
  qn[ut.charCodeAt(Fe)] = Fe;
var zn = " ", Ct = 50, jn = 1, lB = 2, uB = 3, $n = 4, As = 5, ft = 7, CB = 8, Ut = 9, FA = 10, Tr = 11, Ft = 12, Sr = 13, es = 14, $A = 15, Or = 16, he = 17, YA = 18, rs = 19, ht = 20, Mr = 21, ZA = 22, wr = 23, SA = 24, z = 25, Ae = 26, ee = 27, OA = 28, ts = 29, LA = 30, Bs = 31, de = 32, Ee = 33, Gr = 34, Rr = 35, Vr = 36, Qe = 37, Nr = 38, Re = 39, Ve = 40, lr = 41, fB = 42, ns = 43, ss = [9001, 65288], UB = "!", I = "×", He = "÷", Pr = Yn(zn), QA = [LA, Vr], Xr = [jn, lB, uB, As], FB = [FA, CB], dt = [ee, Ae], as = Xr.concat(FB), Et = [Nr, Re, Ve, Gr, Rr], is = [$A, Sr], os = function(e, A) {
  A === void 0 && (A = "strict");
  var r = [], t = [], B = [];
  return e.forEach(function(n, s) {
    var i = Pr.get(n);
    if (i > Ct ? (B.push(!0), i -= Ct) : B.push(!1), ["normal", "auto", "loose"].indexOf(A) !== -1 && [8208, 8211, 12316, 12448].indexOf(n) !== -1)
      return t.push(s), r.push(Or);
    if (i === $n || i === Tr) {
      if (s === 0)
        return t.push(s), r.push(LA);
      var a = r[s - 1];
      return as.indexOf(a) === -1 ? (t.push(t[s - 1]), r.push(a)) : (t.push(s), r.push(LA));
    }
    if (t.push(s), i === Bs)
      return r.push(A === "strict" ? Mr : Qe);
    if (i === fB || i === ts)
      return r.push(LA);
    if (i === ns)
      return n >= 131072 && n <= 196605 || n >= 196608 && n <= 262141 ? r.push(Qe) : r.push(LA);
    r.push(i);
  }), [t, r, B];
}, ur = function(e, A, r, t) {
  var B = t[r];
  if (Array.isArray(e) ? e.indexOf(B) !== -1 : e === B)
    for (var n = r; n <= t.length; ) {
      n++;
      var s = t[n];
      if (s === A)
        return !0;
      if (s !== FA)
        break;
    }
  if (B === FA)
    for (var n = r; n > 0; ) {
      n--;
      var i = t[n];
      if (Array.isArray(e) ? e.indexOf(i) !== -1 : e === i)
        for (var a = r; a <= t.length; ) {
          a++;
          var s = t[a];
          if (s === A)
            return !0;
          if (s !== FA)
            break;
        }
      if (i !== FA)
        break;
    }
  return !1;
}, Ht = function(e, A) {
  for (var r = e; r >= 0; ) {
    var t = A[r];
    if (t === FA)
      r--;
    else
      return t;
  }
  return 0;
}, Qs = function(e, A, r, t, B) {
  if (r[t] === 0)
    return I;
  var n = t - 1;
  if (Array.isArray(B) && B[n] === !0)
    return I;
  var s = n - 1, i = n + 1, a = A[n], o = s >= 0 ? A[s] : 0, Q = A[i];
  if (a === lB && Q === uB)
    return I;
  if (Xr.indexOf(a) !== -1)
    return UB;
  if (Xr.indexOf(Q) !== -1 || FB.indexOf(Q) !== -1)
    return I;
  if (Ht(n, A) === CB)
    return He;
  if (Pr.get(e[n]) === Tr || (a === de || a === Ee) && Pr.get(e[i]) === Tr || a === ft || Q === ft || a === Ut || [FA, Sr, $A].indexOf(a) === -1 && Q === Ut || [he, YA, rs, SA, OA].indexOf(Q) !== -1 || Ht(n, A) === ZA || ur(wr, ZA, n, A) || ur([he, YA], Mr, n, A) || ur(Ft, Ft, n, A))
    return I;
  if (a === FA)
    return He;
  if (a === wr || Q === wr)
    return I;
  if (Q === Or || a === Or)
    return He;
  if ([Sr, $A, Mr].indexOf(Q) !== -1 || a === es || o === Vr && is.indexOf(a) !== -1 || a === OA && Q === Vr || Q === ht || QA.indexOf(Q) !== -1 && a === z || QA.indexOf(a) !== -1 && Q === z || a === ee && [Qe, de, Ee].indexOf(Q) !== -1 || [Qe, de, Ee].indexOf(a) !== -1 && Q === Ae || QA.indexOf(a) !== -1 && dt.indexOf(Q) !== -1 || dt.indexOf(a) !== -1 && QA.indexOf(Q) !== -1 || // (PR | PO) × ( OP | HY )? NU
  [ee, Ae].indexOf(a) !== -1 && (Q === z || [ZA, $A].indexOf(Q) !== -1 && A[i + 1] === z) || // ( OP | HY ) × NU
  [ZA, $A].indexOf(a) !== -1 && Q === z || // NU ×	(NU | SY | IS)
  a === z && [z, OA, SA].indexOf(Q) !== -1)
    return I;
  if ([z, OA, SA, he, YA].indexOf(Q) !== -1)
    for (var c = n; c >= 0; ) {
      var g = A[c];
      if (g === z)
        return I;
      if ([OA, SA].indexOf(g) !== -1)
        c--;
      else
        break;
    }
  if ([ee, Ae].indexOf(Q) !== -1)
    for (var c = [he, YA].indexOf(a) !== -1 ? s : n; c >= 0; ) {
      var g = A[c];
      if (g === z)
        return I;
      if ([OA, SA].indexOf(g) !== -1)
        c--;
      else
        break;
    }
  if (Nr === a && [Nr, Re, Gr, Rr].indexOf(Q) !== -1 || [Re, Gr].indexOf(a) !== -1 && [Re, Ve].indexOf(Q) !== -1 || [Ve, Rr].indexOf(a) !== -1 && Q === Ve || Et.indexOf(a) !== -1 && [ht, Ae].indexOf(Q) !== -1 || Et.indexOf(Q) !== -1 && a === ee || QA.indexOf(a) !== -1 && QA.indexOf(Q) !== -1 || a === SA && QA.indexOf(Q) !== -1 || QA.concat(z).indexOf(a) !== -1 && Q === ZA && ss.indexOf(e[i]) === -1 || QA.concat(z).indexOf(Q) !== -1 && a === YA)
    return I;
  if (a === lr && Q === lr) {
    for (var f = r[n], w = 1; f > 0 && (f--, A[f] === lr); )
      w++;
    if (w % 2 !== 0)
      return I;
  }
  return a === de && Q === Ee ? I : He;
}, cs = function(e, A) {
  A || (A = { lineBreak: "normal", wordBreak: "normal" });
  var r = os(e, A.lineBreak), t = r[0], B = r[1], n = r[2];
  (A.wordBreak === "break-all" || A.wordBreak === "break-word") && (B = B.map(function(i) {
    return [z, LA, fB].indexOf(i) !== -1 ? Qe : i;
  }));
  var s = A.wordBreak === "keep-all" ? n.map(function(i, a) {
    return i && e[a] >= 19968 && e[a] <= 40959;
  }) : void 0;
  return [t, B, s];
}, gs = (
  /** @class */
  function() {
    function e(A, r, t, B) {
      this.codePoints = A, this.required = r === UB, this.start = t, this.end = B;
    }
    return e.prototype.slice = function() {
      return S.apply(void 0, this.codePoints.slice(this.start, this.end));
    }, e;
  }()
), ws = function(e, A) {
  var r = er(e), t = cs(r, A), B = t[0], n = t[1], s = t[2], i = r.length, a = 0, o = 0;
  return {
    next: function() {
      if (o >= i)
        return { done: !0, value: null };
      for (var Q = I; o < i && (Q = Qs(r, n, B, ++o, s)) === I; )
        ;
      if (Q !== I || o === i) {
        var c = new gs(r, Q, a, o);
        return a = o, { value: c, done: !1 };
      }
      return { done: !0, value: null };
    }
  };
}, ls = 1 << 0, us = 1 << 1, we = 1 << 2, pt = 1 << 3, _e = 10, It = 47, ne = 92, Cs = 9, fs = 32, pe = 34, qA = 61, Us = 35, Fs = 36, hs = 37, Ie = 39, ve = 40, zA = 41, ds = 95, Z = 45, Es = 33, Hs = 60, ps = 62, Is = 64, vs = 91, ms = 93, ys = 61, Ks = 123, me = 63, Ls = 125, vt = 124, bs = 126, Ds = 128, mt = 65533, Cr = 42, bA = 43, xs = 44, Ts = 58, Ss = 59, ce = 46, Os = 0, Ms = 8, Gs = 11, Rs = 14, Vs = 31, Ns = 127, nA = -1, hB = 48, dB = 97, EB = 101, Ps = 102, Xs = 117, _s = 122, HB = 65, pB = 69, IB = 70, Js = 85, ks = 90, _ = function(e) {
  return e >= hB && e <= 57;
}, Ws = function(e) {
  return e >= 55296 && e <= 57343;
}, MA = function(e) {
  return _(e) || e >= HB && e <= IB || e >= dB && e <= Ps;
}, Ys = function(e) {
  return e >= dB && e <= _s;
}, Zs = function(e) {
  return e >= HB && e <= ks;
}, qs = function(e) {
  return Ys(e) || Zs(e);
}, zs = function(e) {
  return e >= Ds;
}, ye = function(e) {
  return e === _e || e === Cs || e === fs;
}, Je = function(e) {
  return qs(e) || zs(e) || e === ds;
}, yt = function(e) {
  return Je(e) || _(e) || e === Z;
}, js = function(e) {
  return e >= Os && e <= Ms || e === Gs || e >= Rs && e <= Vs || e === Ns;
}, UA = function(e, A) {
  return e !== ne ? !1 : A !== _e;
}, Ke = function(e, A, r) {
  return e === Z ? Je(A) || UA(A, r) : Je(e) ? !0 : !!(e === ne && UA(e, A));
}, fr = function(e, A, r) {
  return e === bA || e === Z ? _(A) ? !0 : A === ce && _(r) : _(e === ce ? A : e);
}, $s = function(e) {
  var A = 0, r = 1;
  (e[A] === bA || e[A] === Z) && (e[A] === Z && (r = -1), A++);
  for (var t = []; _(e[A]); )
    t.push(e[A++]);
  var B = t.length ? parseInt(S.apply(void 0, t), 10) : 0;
  e[A] === ce && A++;
  for (var n = []; _(e[A]); )
    n.push(e[A++]);
  var s = n.length, i = s ? parseInt(S.apply(void 0, n), 10) : 0;
  (e[A] === pB || e[A] === EB) && A++;
  var a = 1;
  (e[A] === bA || e[A] === Z) && (e[A] === Z && (a = -1), A++);
  for (var o = []; _(e[A]); )
    o.push(e[A++]);
  var Q = o.length ? parseInt(S.apply(void 0, o), 10) : 0;
  return r * (B + i * Math.pow(10, -s)) * Math.pow(10, a * Q);
}, Aa = {
  type: 2
  /* LEFT_PARENTHESIS_TOKEN */
}, ea = {
  type: 3
  /* RIGHT_PARENTHESIS_TOKEN */
}, ra = {
  type: 4
  /* COMMA_TOKEN */
}, ta = {
  type: 13
  /* SUFFIX_MATCH_TOKEN */
}, Ba = {
  type: 8
  /* PREFIX_MATCH_TOKEN */
}, na = {
  type: 21
  /* COLUMN_TOKEN */
}, sa = {
  type: 9
  /* DASH_MATCH_TOKEN */
}, aa = {
  type: 10
  /* INCLUDE_MATCH_TOKEN */
}, ia = {
  type: 11
  /* LEFT_CURLY_BRACKET_TOKEN */
}, oa = {
  type: 12
  /* RIGHT_CURLY_BRACKET_TOKEN */
}, Qa = {
  type: 14
  /* SUBSTRING_MATCH_TOKEN */
}, Le = {
  type: 23
  /* BAD_URL_TOKEN */
}, ca = {
  type: 1
  /* BAD_STRING_TOKEN */
}, ga = {
  type: 25
  /* CDO_TOKEN */
}, wa = {
  type: 24
  /* CDC_TOKEN */
}, la = {
  type: 26
  /* COLON_TOKEN */
}, ua = {
  type: 27
  /* SEMICOLON_TOKEN */
}, Ca = {
  type: 28
  /* LEFT_SQUARE_BRACKET_TOKEN */
}, fa = {
  type: 29
  /* RIGHT_SQUARE_BRACKET_TOKEN */
}, Ua = {
  type: 31
  /* WHITESPACE_TOKEN */
}, _r = {
  type: 32
  /* EOF_TOKEN */
}, vB = (
  /** @class */
  function() {
    function e() {
      this._value = [];
    }
    return e.prototype.write = function(A) {
      this._value = this._value.concat(er(A));
    }, e.prototype.read = function() {
      for (var A = [], r = this.consumeToken(); r !== _r; )
        A.push(r), r = this.consumeToken();
      return A;
    }, e.prototype.consumeToken = function() {
      var A = this.consumeCodePoint();
      switch (A) {
        case pe:
          return this.consumeStringToken(pe);
        case Us:
          var r = this.peekCodePoint(0), t = this.peekCodePoint(1), B = this.peekCodePoint(2);
          if (yt(r) || UA(t, B)) {
            var n = Ke(r, t, B) ? us : ls, s = this.consumeName();
            return { type: 5, value: s, flags: n };
          }
          break;
        case Fs:
          if (this.peekCodePoint(0) === qA)
            return this.consumeCodePoint(), ta;
          break;
        case Ie:
          return this.consumeStringToken(Ie);
        case ve:
          return Aa;
        case zA:
          return ea;
        case Cr:
          if (this.peekCodePoint(0) === qA)
            return this.consumeCodePoint(), Qa;
          break;
        case bA:
          if (fr(A, this.peekCodePoint(0), this.peekCodePoint(1)))
            return this.reconsumeCodePoint(A), this.consumeNumericToken();
          break;
        case xs:
          return ra;
        case Z:
          var i = A, a = this.peekCodePoint(0), o = this.peekCodePoint(1);
          if (fr(i, a, o))
            return this.reconsumeCodePoint(A), this.consumeNumericToken();
          if (Ke(i, a, o))
            return this.reconsumeCodePoint(A), this.consumeIdentLikeToken();
          if (a === Z && o === ps)
            return this.consumeCodePoint(), this.consumeCodePoint(), wa;
          break;
        case ce:
          if (fr(A, this.peekCodePoint(0), this.peekCodePoint(1)))
            return this.reconsumeCodePoint(A), this.consumeNumericToken();
          break;
        case It:
          if (this.peekCodePoint(0) === Cr)
            for (this.consumeCodePoint(); ; ) {
              var Q = this.consumeCodePoint();
              if (Q === Cr && (Q = this.consumeCodePoint(), Q === It))
                return this.consumeToken();
              if (Q === nA)
                return this.consumeToken();
            }
          break;
        case Ts:
          return la;
        case Ss:
          return ua;
        case Hs:
          if (this.peekCodePoint(0) === Es && this.peekCodePoint(1) === Z && this.peekCodePoint(2) === Z)
            return this.consumeCodePoint(), this.consumeCodePoint(), ga;
          break;
        case Is:
          var c = this.peekCodePoint(0), g = this.peekCodePoint(1), f = this.peekCodePoint(2);
          if (Ke(c, g, f)) {
            var s = this.consumeName();
            return { type: 7, value: s };
          }
          break;
        case vs:
          return Ca;
        case ne:
          if (UA(A, this.peekCodePoint(0)))
            return this.reconsumeCodePoint(A), this.consumeIdentLikeToken();
          break;
        case ms:
          return fa;
        case ys:
          if (this.peekCodePoint(0) === qA)
            return this.consumeCodePoint(), Ba;
          break;
        case Ks:
          return ia;
        case Ls:
          return oa;
        case Xs:
        case Js:
          var w = this.peekCodePoint(0), l = this.peekCodePoint(1);
          return w === bA && (MA(l) || l === me) && (this.consumeCodePoint(), this.consumeUnicodeRangeToken()), this.reconsumeCodePoint(A), this.consumeIdentLikeToken();
        case vt:
          if (this.peekCodePoint(0) === qA)
            return this.consumeCodePoint(), sa;
          if (this.peekCodePoint(0) === vt)
            return this.consumeCodePoint(), na;
          break;
        case bs:
          if (this.peekCodePoint(0) === qA)
            return this.consumeCodePoint(), aa;
          break;
        case nA:
          return _r;
      }
      return ye(A) ? (this.consumeWhiteSpace(), Ua) : _(A) ? (this.reconsumeCodePoint(A), this.consumeNumericToken()) : Je(A) ? (this.reconsumeCodePoint(A), this.consumeIdentLikeToken()) : { type: 6, value: S(A) };
    }, e.prototype.consumeCodePoint = function() {
      var A = this._value.shift();
      return typeof A > "u" ? -1 : A;
    }, e.prototype.reconsumeCodePoint = function(A) {
      this._value.unshift(A);
    }, e.prototype.peekCodePoint = function(A) {
      return A >= this._value.length ? -1 : this._value[A];
    }, e.prototype.consumeUnicodeRangeToken = function() {
      for (var A = [], r = this.consumeCodePoint(); MA(r) && A.length < 6; )
        A.push(r), r = this.consumeCodePoint();
      for (var t = !1; r === me && A.length < 6; )
        A.push(r), r = this.consumeCodePoint(), t = !0;
      if (t) {
        var B = parseInt(S.apply(void 0, A.map(function(a) {
          return a === me ? hB : a;
        })), 16), n = parseInt(S.apply(void 0, A.map(function(a) {
          return a === me ? IB : a;
        })), 16);
        return { type: 30, start: B, end: n };
      }
      var s = parseInt(S.apply(void 0, A), 16);
      if (this.peekCodePoint(0) === Z && MA(this.peekCodePoint(1))) {
        this.consumeCodePoint(), r = this.consumeCodePoint();
        for (var i = []; MA(r) && i.length < 6; )
          i.push(r), r = this.consumeCodePoint();
        var n = parseInt(S.apply(void 0, i), 16);
        return { type: 30, start: s, end: n };
      } else
        return { type: 30, start: s, end: s };
    }, e.prototype.consumeIdentLikeToken = function() {
      var A = this.consumeName();
      return A.toLowerCase() === "url" && this.peekCodePoint(0) === ve ? (this.consumeCodePoint(), this.consumeUrlToken()) : this.peekCodePoint(0) === ve ? (this.consumeCodePoint(), { type: 19, value: A }) : { type: 20, value: A };
    }, e.prototype.consumeUrlToken = function() {
      var A = [];
      if (this.consumeWhiteSpace(), this.peekCodePoint(0) === nA)
        return { type: 22, value: "" };
      var r = this.peekCodePoint(0);
      if (r === Ie || r === pe) {
        var t = this.consumeStringToken(this.consumeCodePoint());
        return t.type === 0 && (this.consumeWhiteSpace(), this.peekCodePoint(0) === nA || this.peekCodePoint(0) === zA) ? (this.consumeCodePoint(), { type: 22, value: t.value }) : (this.consumeBadUrlRemnants(), Le);
      }
      for (; ; ) {
        var B = this.consumeCodePoint();
        if (B === nA || B === zA)
          return { type: 22, value: S.apply(void 0, A) };
        if (ye(B))
          return this.consumeWhiteSpace(), this.peekCodePoint(0) === nA || this.peekCodePoint(0) === zA ? (this.consumeCodePoint(), { type: 22, value: S.apply(void 0, A) }) : (this.consumeBadUrlRemnants(), Le);
        if (B === pe || B === Ie || B === ve || js(B))
          return this.consumeBadUrlRemnants(), Le;
        if (B === ne)
          if (UA(B, this.peekCodePoint(0)))
            A.push(this.consumeEscapedCodePoint());
          else
            return this.consumeBadUrlRemnants(), Le;
        else
          A.push(B);
      }
    }, e.prototype.consumeWhiteSpace = function() {
      for (; ye(this.peekCodePoint(0)); )
        this.consumeCodePoint();
    }, e.prototype.consumeBadUrlRemnants = function() {
      for (; ; ) {
        var A = this.consumeCodePoint();
        if (A === zA || A === nA)
          return;
        UA(A, this.peekCodePoint(0)) && this.consumeEscapedCodePoint();
      }
    }, e.prototype.consumeStringSlice = function(A) {
      for (var r = 5e4, t = ""; A > 0; ) {
        var B = Math.min(r, A);
        t += S.apply(void 0, this._value.splice(0, B)), A -= B;
      }
      return this._value.shift(), t;
    }, e.prototype.consumeStringToken = function(A) {
      var r = "", t = 0;
      do {
        var B = this._value[t];
        if (B === nA || B === void 0 || B === A)
          return r += this.consumeStringSlice(t), { type: 0, value: r };
        if (B === _e)
          return this._value.splice(0, t), ca;
        if (B === ne) {
          var n = this._value[t + 1];
          n !== nA && n !== void 0 && (n === _e ? (r += this.consumeStringSlice(t), t = -1, this._value.shift()) : UA(B, n) && (r += this.consumeStringSlice(t), r += S(this.consumeEscapedCodePoint()), t = -1));
        }
        t++;
      } while (!0);
    }, e.prototype.consumeNumber = function() {
      var A = [], r = we, t = this.peekCodePoint(0);
      for ((t === bA || t === Z) && A.push(this.consumeCodePoint()); _(this.peekCodePoint(0)); )
        A.push(this.consumeCodePoint());
      t = this.peekCodePoint(0);
      var B = this.peekCodePoint(1);
      if (t === ce && _(B))
        for (A.push(this.consumeCodePoint(), this.consumeCodePoint()), r = pt; _(this.peekCodePoint(0)); )
          A.push(this.consumeCodePoint());
      t = this.peekCodePoint(0), B = this.peekCodePoint(1);
      var n = this.peekCodePoint(2);
      if ((t === pB || t === EB) && ((B === bA || B === Z) && _(n) || _(B)))
        for (A.push(this.consumeCodePoint(), this.consumeCodePoint()), r = pt; _(this.peekCodePoint(0)); )
          A.push(this.consumeCodePoint());
      return [$s(A), r];
    }, e.prototype.consumeNumericToken = function() {
      var A = this.consumeNumber(), r = A[0], t = A[1], B = this.peekCodePoint(0), n = this.peekCodePoint(1), s = this.peekCodePoint(2);
      if (Ke(B, n, s)) {
        var i = this.consumeName();
        return { type: 15, number: r, flags: t, unit: i };
      }
      return B === hs ? (this.consumeCodePoint(), { type: 16, number: r, flags: t }) : { type: 17, number: r, flags: t };
    }, e.prototype.consumeEscapedCodePoint = function() {
      var A = this.consumeCodePoint();
      if (MA(A)) {
        for (var r = S(A); MA(this.peekCodePoint(0)) && r.length < 6; )
          r += S(this.consumeCodePoint());
        ye(this.peekCodePoint(0)) && this.consumeCodePoint();
        var t = parseInt(r, 16);
        return t === 0 || Ws(t) || t > 1114111 ? mt : t;
      }
      return A === nA ? mt : A;
    }, e.prototype.consumeName = function() {
      for (var A = ""; ; ) {
        var r = this.consumeCodePoint();
        if (yt(r))
          A += S(r);
        else if (UA(r, this.peekCodePoint(0)))
          A += S(this.consumeEscapedCodePoint());
        else
          return this.reconsumeCodePoint(r), A;
      }
    }, e;
  }()
), mB = (
  /** @class */
  function() {
    function e(A) {
      this._tokens = A;
    }
    return e.create = function(A) {
      var r = new vB();
      return r.write(A), new e(r.read());
    }, e.parseValue = function(A) {
      return e.create(A).parseComponentValue();
    }, e.parseValues = function(A) {
      return e.create(A).parseComponentValues();
    }, e.prototype.parseComponentValue = function() {
      for (var A = this.consumeToken(); A.type === 31; )
        A = this.consumeToken();
      if (A.type === 32)
        throw new SyntaxError("Error parsing CSS component value, unexpected EOF");
      this.reconsumeToken(A);
      var r = this.consumeComponentValue();
      do
        A = this.consumeToken();
      while (A.type === 31);
      if (A.type === 32)
        return r;
      throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one");
    }, e.prototype.parseComponentValues = function() {
      for (var A = []; ; ) {
        var r = this.consumeComponentValue();
        if (r.type === 32)
          return A;
        A.push(r), A.push();
      }
    }, e.prototype.consumeComponentValue = function() {
      var A = this.consumeToken();
      switch (A.type) {
        case 11:
        case 28:
        case 2:
          return this.consumeSimpleBlock(A.type);
        case 19:
          return this.consumeFunction(A);
      }
      return A;
    }, e.prototype.consumeSimpleBlock = function(A) {
      for (var r = { type: A, values: [] }, t = this.consumeToken(); ; ) {
        if (t.type === 32 || ha(t, A))
          return r;
        this.reconsumeToken(t), r.values.push(this.consumeComponentValue()), t = this.consumeToken();
      }
    }, e.prototype.consumeFunction = function(A) {
      for (var r = {
        name: A.value,
        values: [],
        type: 18
        /* FUNCTION */
      }; ; ) {
        var t = this.consumeToken();
        if (t.type === 32 || t.type === 3)
          return r;
        this.reconsumeToken(t), r.values.push(this.consumeComponentValue());
      }
    }, e.prototype.consumeToken = function() {
      var A = this._tokens.shift();
      return typeof A > "u" ? _r : A;
    }, e.prototype.reconsumeToken = function(A) {
      this._tokens.unshift(A);
    }, e;
  }()
), le = function(e) {
  return e.type === 15;
}, kA = function(e) {
  return e.type === 17;
}, b = function(e) {
  return e.type === 20;
}, Fa = function(e) {
  return e.type === 0;
}, Jr = function(e, A) {
  return b(e) && e.value === A;
}, yB = function(e) {
  return e.type !== 31;
}, JA = function(e) {
  return e.type !== 31 && e.type !== 4;
}, sA = function(e) {
  var A = [], r = [];
  return e.forEach(function(t) {
    if (t.type === 4) {
      if (r.length === 0)
        throw new Error("Error parsing function args, zero tokens for arg");
      A.push(r), r = [];
      return;
    }
    t.type !== 31 && r.push(t);
  }), r.length && A.push(r), A;
}, ha = function(e, A) {
  return A === 11 && e.type === 12 || A === 28 && e.type === 29 ? !0 : A === 2 && e.type === 3;
}, pA = function(e) {
  return e.type === 17 || e.type === 15;
}, M = function(e) {
  return e.type === 16 || pA(e);
}, KB = function(e) {
  return e.length > 1 ? [e[0], e[1]] : [e[0]];
}, P = {
  type: 17,
  number: 0,
  flags: we
}, nt = {
  type: 16,
  number: 50,
  flags: we
}, hA = {
  type: 16,
  number: 100,
  flags: we
}, re = function(e, A, r) {
  var t = e[0], B = e[1];
  return [D(t, A), D(typeof B < "u" ? B : t, r)];
}, D = function(e, A) {
  if (e.type === 16)
    return e.number / 100 * A;
  if (le(e))
    switch (e.unit) {
      case "rem":
      case "em":
        return 16 * e.number;
      case "px":
      default:
        return e.number;
    }
  return e.number;
}, LB = "deg", bB = "grad", DB = "rad", xB = "turn", rr = {
  name: "angle",
  parse: function(e, A) {
    if (A.type === 15)
      switch (A.unit) {
        case LB:
          return Math.PI * A.number / 180;
        case bB:
          return Math.PI / 200 * A.number;
        case DB:
          return A.number;
        case xB:
          return Math.PI * 2 * A.number;
      }
    throw new Error("Unsupported angle type");
  }
}, TB = function(e) {
  return e.type === 15 && (e.unit === LB || e.unit === bB || e.unit === DB || e.unit === xB);
}, SB = function(e) {
  var A = e.filter(b).map(function(r) {
    return r.value;
  }).join(" ");
  switch (A) {
    case "to bottom right":
    case "to right bottom":
    case "left top":
    case "top left":
      return [P, P];
    case "to top":
    case "bottom":
      return AA(0);
    case "to bottom left":
    case "to left bottom":
    case "right top":
    case "top right":
      return [P, hA];
    case "to right":
    case "left":
      return AA(90);
    case "to top left":
    case "to left top":
    case "right bottom":
    case "bottom right":
      return [hA, hA];
    case "to bottom":
    case "top":
      return AA(180);
    case "to top right":
    case "to right top":
    case "left bottom":
    case "bottom left":
      return [hA, P];
    case "to left":
    case "right":
      return AA(270);
  }
  return 0;
}, AA = function(e) {
  return Math.PI * e / 180;
}, EA = {
  name: "color",
  parse: function(e, A) {
    if (A.type === 18) {
      var r = da[A.name];
      if (typeof r > "u")
        throw new Error('Attempting to parse an unsupported color function "' + A.name + '"');
      return r(e, A.values);
    }
    if (A.type === 5) {
      if (A.value.length === 3) {
        var t = A.value.substring(0, 1), B = A.value.substring(1, 2), n = A.value.substring(2, 3);
        return dA(parseInt(t + t, 16), parseInt(B + B, 16), parseInt(n + n, 16), 1);
      }
      if (A.value.length === 4) {
        var t = A.value.substring(0, 1), B = A.value.substring(1, 2), n = A.value.substring(2, 3), s = A.value.substring(3, 4);
        return dA(parseInt(t + t, 16), parseInt(B + B, 16), parseInt(n + n, 16), parseInt(s + s, 16) / 255);
      }
      if (A.value.length === 6) {
        var t = A.value.substring(0, 2), B = A.value.substring(2, 4), n = A.value.substring(4, 6);
        return dA(parseInt(t, 16), parseInt(B, 16), parseInt(n, 16), 1);
      }
      if (A.value.length === 8) {
        var t = A.value.substring(0, 2), B = A.value.substring(2, 4), n = A.value.substring(4, 6), s = A.value.substring(6, 8);
        return dA(parseInt(t, 16), parseInt(B, 16), parseInt(n, 16), parseInt(s, 16) / 255);
      }
    }
    if (A.type === 20) {
      var i = gA[A.value.toUpperCase()];
      if (typeof i < "u")
        return i;
    }
    return gA.TRANSPARENT;
  }
}, HA = function(e) {
  return (255 & e) === 0;
}, R = function(e) {
  var A = 255 & e, r = 255 & e >> 8, t = 255 & e >> 16, B = 255 & e >> 24;
  return A < 255 ? "rgba(" + B + "," + t + "," + r + "," + A / 255 + ")" : "rgb(" + B + "," + t + "," + r + ")";
}, dA = function(e, A, r, t) {
  return (e << 24 | A << 16 | r << 8 | Math.round(t * 255) << 0) >>> 0;
}, Kt = function(e, A) {
  if (e.type === 17)
    return e.number;
  if (e.type === 16) {
    var r = A === 3 ? 1 : 255;
    return A === 3 ? e.number / 100 * r : Math.round(e.number / 100 * r);
  }
  return 0;
}, Lt = function(e, A) {
  var r = A.filter(JA);
  if (r.length === 3) {
    var t = r.map(Kt), B = t[0], n = t[1], s = t[2];
    return dA(B, n, s, 1);
  }
  if (r.length === 4) {
    var i = r.map(Kt), B = i[0], n = i[1], s = i[2], a = i[3];
    return dA(B, n, s, a);
  }
  return 0;
};
function Ur(e, A, r) {
  return r < 0 && (r += 1), r >= 1 && (r -= 1), r < 1 / 6 ? (A - e) * r * 6 + e : r < 1 / 2 ? A : r < 2 / 3 ? (A - e) * 6 * (2 / 3 - r) + e : e;
}
var bt = function(e, A) {
  var r = A.filter(JA), t = r[0], B = r[1], n = r[2], s = r[3], i = (t.type === 17 ? AA(t.number) : rr.parse(e, t)) / (Math.PI * 2), a = M(B) ? B.number / 100 : 0, o = M(n) ? n.number / 100 : 0, Q = typeof s < "u" && M(s) ? D(s, 1) : 1;
  if (a === 0)
    return dA(o * 255, o * 255, o * 255, 1);
  var c = o <= 0.5 ? o * (a + 1) : o + a - o * a, g = o * 2 - c, f = Ur(g, c, i + 1 / 3), w = Ur(g, c, i), l = Ur(g, c, i - 1 / 3);
  return dA(f * 255, w * 255, l * 255, Q);
}, da = {
  hsl: bt,
  hsla: bt,
  rgb: Lt,
  rgba: Lt
}, se = function(e, A) {
  return EA.parse(e, mB.create(A).parseComponentValue());
}, gA = {
  ALICEBLUE: 4042850303,
  ANTIQUEWHITE: 4209760255,
  AQUA: 16777215,
  AQUAMARINE: 2147472639,
  AZURE: 4043309055,
  BEIGE: 4126530815,
  BISQUE: 4293182719,
  BLACK: 255,
  BLANCHEDALMOND: 4293643775,
  BLUE: 65535,
  BLUEVIOLET: 2318131967,
  BROWN: 2771004159,
  BURLYWOOD: 3736635391,
  CADETBLUE: 1604231423,
  CHARTREUSE: 2147418367,
  CHOCOLATE: 3530104575,
  CORAL: 4286533887,
  CORNFLOWERBLUE: 1687547391,
  CORNSILK: 4294499583,
  CRIMSON: 3692313855,
  CYAN: 16777215,
  DARKBLUE: 35839,
  DARKCYAN: 9145343,
  DARKGOLDENROD: 3095837695,
  DARKGRAY: 2846468607,
  DARKGREEN: 6553855,
  DARKGREY: 2846468607,
  DARKKHAKI: 3182914559,
  DARKMAGENTA: 2332068863,
  DARKOLIVEGREEN: 1433087999,
  DARKORANGE: 4287365375,
  DARKORCHID: 2570243327,
  DARKRED: 2332033279,
  DARKSALMON: 3918953215,
  DARKSEAGREEN: 2411499519,
  DARKSLATEBLUE: 1211993087,
  DARKSLATEGRAY: 793726975,
  DARKSLATEGREY: 793726975,
  DARKTURQUOISE: 13554175,
  DARKVIOLET: 2483082239,
  DEEPPINK: 4279538687,
  DEEPSKYBLUE: 12582911,
  DIMGRAY: 1768516095,
  DIMGREY: 1768516095,
  DODGERBLUE: 512819199,
  FIREBRICK: 2988581631,
  FLORALWHITE: 4294635775,
  FORESTGREEN: 579543807,
  FUCHSIA: 4278255615,
  GAINSBORO: 3705462015,
  GHOSTWHITE: 4177068031,
  GOLD: 4292280575,
  GOLDENROD: 3668254975,
  GRAY: 2155905279,
  GREEN: 8388863,
  GREENYELLOW: 2919182335,
  GREY: 2155905279,
  HONEYDEW: 4043305215,
  HOTPINK: 4285117695,
  INDIANRED: 3445382399,
  INDIGO: 1258324735,
  IVORY: 4294963455,
  KHAKI: 4041641215,
  LAVENDER: 3873897215,
  LAVENDERBLUSH: 4293981695,
  LAWNGREEN: 2096890111,
  LEMONCHIFFON: 4294626815,
  LIGHTBLUE: 2916673279,
  LIGHTCORAL: 4034953471,
  LIGHTCYAN: 3774873599,
  LIGHTGOLDENRODYELLOW: 4210742015,
  LIGHTGRAY: 3553874943,
  LIGHTGREEN: 2431553791,
  LIGHTGREY: 3553874943,
  LIGHTPINK: 4290167295,
  LIGHTSALMON: 4288707327,
  LIGHTSEAGREEN: 548580095,
  LIGHTSKYBLUE: 2278488831,
  LIGHTSLATEGRAY: 2005441023,
  LIGHTSLATEGREY: 2005441023,
  LIGHTSTEELBLUE: 2965692159,
  LIGHTYELLOW: 4294959359,
  LIME: 16711935,
  LIMEGREEN: 852308735,
  LINEN: 4210091775,
  MAGENTA: 4278255615,
  MAROON: 2147483903,
  MEDIUMAQUAMARINE: 1724754687,
  MEDIUMBLUE: 52735,
  MEDIUMORCHID: 3126187007,
  MEDIUMPURPLE: 2473647103,
  MEDIUMSEAGREEN: 1018393087,
  MEDIUMSLATEBLUE: 2070474495,
  MEDIUMSPRINGGREEN: 16423679,
  MEDIUMTURQUOISE: 1221709055,
  MEDIUMVIOLETRED: 3340076543,
  MIDNIGHTBLUE: 421097727,
  MINTCREAM: 4127193855,
  MISTYROSE: 4293190143,
  MOCCASIN: 4293178879,
  NAVAJOWHITE: 4292783615,
  NAVY: 33023,
  OLDLACE: 4260751103,
  OLIVE: 2155872511,
  OLIVEDRAB: 1804477439,
  ORANGE: 4289003775,
  ORANGERED: 4282712319,
  ORCHID: 3664828159,
  PALEGOLDENROD: 4008225535,
  PALEGREEN: 2566625535,
  PALETURQUOISE: 2951671551,
  PALEVIOLETRED: 3681588223,
  PAPAYAWHIP: 4293907967,
  PEACHPUFF: 4292524543,
  PERU: 3448061951,
  PINK: 4290825215,
  PLUM: 3718307327,
  POWDERBLUE: 2967529215,
  PURPLE: 2147516671,
  REBECCAPURPLE: 1714657791,
  RED: 4278190335,
  ROSYBROWN: 3163525119,
  ROYALBLUE: 1097458175,
  SADDLEBROWN: 2336560127,
  SALMON: 4202722047,
  SANDYBROWN: 4104413439,
  SEAGREEN: 780883967,
  SEASHELL: 4294307583,
  SIENNA: 2689740287,
  SILVER: 3233857791,
  SKYBLUE: 2278484991,
  SLATEBLUE: 1784335871,
  SLATEGRAY: 1887473919,
  SLATEGREY: 1887473919,
  SNOW: 4294638335,
  SPRINGGREEN: 16744447,
  STEELBLUE: 1182971135,
  TAN: 3535047935,
  TEAL: 8421631,
  THISTLE: 3636451583,
  TOMATO: 4284696575,
  TRANSPARENT: 0,
  TURQUOISE: 1088475391,
  VIOLET: 4001558271,
  WHEAT: 4125012991,
  WHITE: 4294967295,
  WHITESMOKE: 4126537215,
  YELLOW: 4294902015,
  YELLOWGREEN: 2597139199
}, Ea = {
  name: "background-clip",
  initialValue: "border-box",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    return A.map(function(r) {
      if (b(r))
        switch (r.value) {
          case "padding-box":
            return 1;
          case "content-box":
            return 2;
        }
      return 0;
    });
  }
}, Ha = {
  name: "background-color",
  initialValue: "transparent",
  prefix: !1,
  type: 3,
  format: "color"
}, tr = function(e, A) {
  var r = EA.parse(e, A[0]), t = A[1];
  return t && M(t) ? { color: r, stop: t } : { color: r, stop: null };
}, Dt = function(e, A) {
  var r = e[0], t = e[e.length - 1];
  r.stop === null && (r.stop = P), t.stop === null && (t.stop = hA);
  for (var B = [], n = 0, s = 0; s < e.length; s++) {
    var i = e[s].stop;
    if (i !== null) {
      var a = D(i, A);
      a > n ? B.push(a) : B.push(n), n = a;
    } else
      B.push(null);
  }
  for (var o = null, s = 0; s < B.length; s++) {
    var Q = B[s];
    if (Q === null)
      o === null && (o = s);
    else if (o !== null) {
      for (var c = s - o, g = B[o - 1], f = (Q - g) / (c + 1), w = 1; w <= c; w++)
        B[o + w - 1] = f * w;
      o = null;
    }
  }
  return e.map(function(l, H) {
    var h = l.color;
    return { color: h, stop: Math.max(Math.min(1, B[H] / A), 0) };
  });
}, pa = function(e, A, r) {
  var t = A / 2, B = r / 2, n = D(e[0], A) - t, s = B - D(e[1], r);
  return (Math.atan2(s, n) + Math.PI * 2) % (Math.PI * 2);
}, Ia = function(e, A, r) {
  var t = typeof e == "number" ? e : pa(e, A, r), B = Math.abs(A * Math.sin(t)) + Math.abs(r * Math.cos(t)), n = A / 2, s = r / 2, i = B / 2, a = Math.sin(t - Math.PI / 2) * i, o = Math.cos(t - Math.PI / 2) * i;
  return [B, n - o, n + o, s - a, s + a];
}, rA = function(e, A) {
  return Math.sqrt(e * e + A * A);
}, xt = function(e, A, r, t, B) {
  var n = [
    [0, 0],
    [0, A],
    [e, 0],
    [e, A]
  ];
  return n.reduce(function(s, i) {
    var a = i[0], o = i[1], Q = rA(r - a, t - o);
    return (B ? Q < s.optimumDistance : Q > s.optimumDistance) ? {
      optimumCorner: i,
      optimumDistance: Q
    } : s;
  }, {
    optimumDistance: B ? 1 / 0 : -1 / 0,
    optimumCorner: null
  }).optimumCorner;
}, va = function(e, A, r, t, B) {
  var n = 0, s = 0;
  switch (e.size) {
    case 0:
      e.shape === 0 ? n = s = Math.min(Math.abs(A), Math.abs(A - t), Math.abs(r), Math.abs(r - B)) : e.shape === 1 && (n = Math.min(Math.abs(A), Math.abs(A - t)), s = Math.min(Math.abs(r), Math.abs(r - B)));
      break;
    case 2:
      if (e.shape === 0)
        n = s = Math.min(rA(A, r), rA(A, r - B), rA(A - t, r), rA(A - t, r - B));
      else if (e.shape === 1) {
        var i = Math.min(Math.abs(r), Math.abs(r - B)) / Math.min(Math.abs(A), Math.abs(A - t)), a = xt(t, B, A, r, !0), o = a[0], Q = a[1];
        n = rA(o - A, (Q - r) / i), s = i * n;
      }
      break;
    case 1:
      e.shape === 0 ? n = s = Math.max(Math.abs(A), Math.abs(A - t), Math.abs(r), Math.abs(r - B)) : e.shape === 1 && (n = Math.max(Math.abs(A), Math.abs(A - t)), s = Math.max(Math.abs(r), Math.abs(r - B)));
      break;
    case 3:
      if (e.shape === 0)
        n = s = Math.max(rA(A, r), rA(A, r - B), rA(A - t, r), rA(A - t, r - B));
      else if (e.shape === 1) {
        var i = Math.max(Math.abs(r), Math.abs(r - B)) / Math.max(Math.abs(A), Math.abs(A - t)), c = xt(t, B, A, r, !1), o = c[0], Q = c[1];
        n = rA(o - A, (Q - r) / i), s = i * n;
      }
      break;
  }
  return Array.isArray(e.size) && (n = D(e.size[0], t), s = e.size.length === 2 ? D(e.size[1], B) : n), [n, s];
}, ma = function(e, A) {
  var r = AA(180), t = [];
  return sA(A).forEach(function(B, n) {
    if (n === 0) {
      var s = B[0];
      if (s.type === 20 && s.value === "to") {
        r = SB(B);
        return;
      } else if (TB(s)) {
        r = rr.parse(e, s);
        return;
      }
    }
    var i = tr(e, B);
    t.push(i);
  }), {
    angle: r,
    stops: t,
    type: 1
    /* LINEAR_GRADIENT */
  };
}, be = function(e, A) {
  var r = AA(180), t = [];
  return sA(A).forEach(function(B, n) {
    if (n === 0) {
      var s = B[0];
      if (s.type === 20 && ["top", "left", "right", "bottom"].indexOf(s.value) !== -1) {
        r = SB(B);
        return;
      } else if (TB(s)) {
        r = (rr.parse(e, s) + AA(270)) % AA(360);
        return;
      }
    }
    var i = tr(e, B);
    t.push(i);
  }), {
    angle: r,
    stops: t,
    type: 1
    /* LINEAR_GRADIENT */
  };
}, ya = function(e, A) {
  var r = AA(180), t = [], B = 1, n = 0, s = 3, i = [];
  return sA(A).forEach(function(a, o) {
    var Q = a[0];
    if (o === 0) {
      if (b(Q) && Q.value === "linear") {
        B = 1;
        return;
      } else if (b(Q) && Q.value === "radial") {
        B = 2;
        return;
      }
    }
    if (Q.type === 18) {
      if (Q.name === "from") {
        var c = EA.parse(e, Q.values[0]);
        t.push({ stop: P, color: c });
      } else if (Q.name === "to") {
        var c = EA.parse(e, Q.values[0]);
        t.push({ stop: hA, color: c });
      } else if (Q.name === "color-stop") {
        var g = Q.values.filter(JA);
        if (g.length === 2) {
          var c = EA.parse(e, g[1]), f = g[0];
          kA(f) && t.push({
            stop: { type: 16, number: f.number * 100, flags: f.flags },
            color: c
          });
        }
      }
    }
  }), B === 1 ? {
    angle: (r + AA(180)) % AA(360),
    stops: t,
    type: B
  } : { size: s, shape: n, stops: t, position: i, type: B };
}, OB = "closest-side", MB = "farthest-side", GB = "closest-corner", RB = "farthest-corner", VB = "circle", NB = "ellipse", PB = "cover", XB = "contain", Ka = function(e, A) {
  var r = 0, t = 3, B = [], n = [];
  return sA(A).forEach(function(s, i) {
    var a = !0;
    if (i === 0) {
      var o = !1;
      a = s.reduce(function(c, g) {
        if (o)
          if (b(g))
            switch (g.value) {
              case "center":
                return n.push(nt), c;
              case "top":
              case "left":
                return n.push(P), c;
              case "right":
              case "bottom":
                return n.push(hA), c;
            }
          else
            (M(g) || pA(g)) && n.push(g);
        else if (b(g))
          switch (g.value) {
            case VB:
              return r = 0, !1;
            case NB:
              return r = 1, !1;
            case "at":
              return o = !0, !1;
            case OB:
              return t = 0, !1;
            case PB:
            case MB:
              return t = 1, !1;
            case XB:
            case GB:
              return t = 2, !1;
            case RB:
              return t = 3, !1;
          }
        else if (pA(g) || M(g))
          return Array.isArray(t) || (t = []), t.push(g), !1;
        return c;
      }, a);
    }
    if (a) {
      var Q = tr(e, s);
      B.push(Q);
    }
  }), {
    size: t,
    shape: r,
    stops: B,
    position: n,
    type: 2
    /* RADIAL_GRADIENT */
  };
}, De = function(e, A) {
  var r = 0, t = 3, B = [], n = [];
  return sA(A).forEach(function(s, i) {
    var a = !0;
    if (i === 0 ? a = s.reduce(function(Q, c) {
      if (b(c))
        switch (c.value) {
          case "center":
            return n.push(nt), !1;
          case "top":
          case "left":
            return n.push(P), !1;
          case "right":
          case "bottom":
            return n.push(hA), !1;
        }
      else if (M(c) || pA(c))
        return n.push(c), !1;
      return Q;
    }, a) : i === 1 && (a = s.reduce(function(Q, c) {
      if (b(c))
        switch (c.value) {
          case VB:
            return r = 0, !1;
          case NB:
            return r = 1, !1;
          case XB:
          case OB:
            return t = 0, !1;
          case MB:
            return t = 1, !1;
          case GB:
            return t = 2, !1;
          case PB:
          case RB:
            return t = 3, !1;
        }
      else if (pA(c) || M(c))
        return Array.isArray(t) || (t = []), t.push(c), !1;
      return Q;
    }, a)), a) {
      var o = tr(e, s);
      B.push(o);
    }
  }), {
    size: t,
    shape: r,
    stops: B,
    position: n,
    type: 2
    /* RADIAL_GRADIENT */
  };
}, La = function(e) {
  return e.type === 1;
}, ba = function(e) {
  return e.type === 2;
}, st = {
  name: "image",
  parse: function(e, A) {
    if (A.type === 22) {
      var r = {
        url: A.value,
        type: 0
        /* URL */
      };
      return e.cache.addImage(A.value), r;
    }
    if (A.type === 18) {
      var t = _B[A.name];
      if (typeof t > "u")
        throw new Error('Attempting to parse an unsupported image function "' + A.name + '"');
      return t(e, A.values);
    }
    throw new Error("Unsupported image type " + A.type);
  }
};
function Da(e) {
  return !(e.type === 20 && e.value === "none") && (e.type !== 18 || !!_B[e.name]);
}
var _B = {
  "linear-gradient": ma,
  "-moz-linear-gradient": be,
  "-ms-linear-gradient": be,
  "-o-linear-gradient": be,
  "-webkit-linear-gradient": be,
  "radial-gradient": Ka,
  "-moz-radial-gradient": De,
  "-ms-radial-gradient": De,
  "-o-radial-gradient": De,
  "-webkit-radial-gradient": De,
  "-webkit-gradient": ya
}, xa = {
  name: "background-image",
  initialValue: "none",
  type: 1,
  prefix: !1,
  parse: function(e, A) {
    if (A.length === 0)
      return [];
    var r = A[0];
    return r.type === 20 && r.value === "none" ? [] : A.filter(function(t) {
      return JA(t) && Da(t);
    }).map(function(t) {
      return st.parse(e, t);
    });
  }
}, Ta = {
  name: "background-origin",
  initialValue: "border-box",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    return A.map(function(r) {
      if (b(r))
        switch (r.value) {
          case "padding-box":
            return 1;
          case "content-box":
            return 2;
        }
      return 0;
    });
  }
}, Sa = {
  name: "background-position",
  initialValue: "0% 0%",
  type: 1,
  prefix: !1,
  parse: function(e, A) {
    return sA(A).map(function(r) {
      return r.filter(M);
    }).map(KB);
  }
}, Oa = {
  name: "background-repeat",
  initialValue: "repeat",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    return sA(A).map(function(r) {
      return r.filter(b).map(function(t) {
        return t.value;
      }).join(" ");
    }).map(Ma);
  }
}, Ma = function(e) {
  switch (e) {
    case "no-repeat":
      return 1;
    case "repeat-x":
    case "repeat no-repeat":
      return 2;
    case "repeat-y":
    case "no-repeat repeat":
      return 3;
    case "repeat":
    default:
      return 0;
  }
}, _A;
(function(e) {
  e.AUTO = "auto", e.CONTAIN = "contain", e.COVER = "cover";
})(_A || (_A = {}));
var Ga = {
  name: "background-size",
  initialValue: "0",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    return sA(A).map(function(r) {
      return r.filter(Ra);
    });
  }
}, Ra = function(e) {
  return b(e) || M(e);
}, Br = function(e) {
  return {
    name: "border-" + e + "-color",
    initialValue: "transparent",
    prefix: !1,
    type: 3,
    format: "color"
  };
}, Va = Br("top"), Na = Br("right"), Pa = Br("bottom"), Xa = Br("left"), nr = function(e) {
  return {
    name: "border-radius-" + e,
    initialValue: "0 0",
    prefix: !1,
    type: 1,
    parse: function(A, r) {
      return KB(r.filter(M));
    }
  };
}, _a = nr("top-left"), Ja = nr("top-right"), ka = nr("bottom-right"), Wa = nr("bottom-left"), sr = function(e) {
  return {
    name: "border-" + e + "-style",
    initialValue: "solid",
    prefix: !1,
    type: 2,
    parse: function(A, r) {
      switch (r) {
        case "none":
          return 0;
        case "dashed":
          return 2;
        case "dotted":
          return 3;
        case "double":
          return 4;
      }
      return 1;
    }
  };
}, Ya = sr("top"), Za = sr("right"), qa = sr("bottom"), za = sr("left"), ar = function(e) {
  return {
    name: "border-" + e + "-width",
    initialValue: "0",
    type: 0,
    prefix: !1,
    parse: function(A, r) {
      return le(r) ? r.number : 0;
    }
  };
}, ja = ar("top"), $a = ar("right"), Ai = ar("bottom"), ei = ar("left"), ri = {
  name: "color",
  initialValue: "transparent",
  prefix: !1,
  type: 3,
  format: "color"
}, ti = {
  name: "direction",
  initialValue: "ltr",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "rtl":
        return 1;
      case "ltr":
      default:
        return 0;
    }
  }
}, Bi = {
  name: "display",
  initialValue: "inline-block",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    return A.filter(b).reduce(
      function(r, t) {
        return r | ni(t.value);
      },
      0
      /* NONE */
    );
  }
}, ni = function(e) {
  switch (e) {
    case "block":
    case "-webkit-box":
      return 2;
    case "inline":
      return 4;
    case "run-in":
      return 8;
    case "flow":
      return 16;
    case "flow-root":
      return 32;
    case "table":
      return 64;
    case "flex":
    case "-webkit-flex":
      return 128;
    case "grid":
    case "-ms-grid":
      return 256;
    case "ruby":
      return 512;
    case "subgrid":
      return 1024;
    case "list-item":
      return 2048;
    case "table-row-group":
      return 4096;
    case "table-header-group":
      return 8192;
    case "table-footer-group":
      return 16384;
    case "table-row":
      return 32768;
    case "table-cell":
      return 65536;
    case "table-column-group":
      return 131072;
    case "table-column":
      return 262144;
    case "table-caption":
      return 524288;
    case "ruby-base":
      return 1048576;
    case "ruby-text":
      return 2097152;
    case "ruby-base-container":
      return 4194304;
    case "ruby-text-container":
      return 8388608;
    case "contents":
      return 16777216;
    case "inline-block":
      return 33554432;
    case "inline-list-item":
      return 67108864;
    case "inline-table":
      return 134217728;
    case "inline-flex":
      return 268435456;
    case "inline-grid":
      return 536870912;
  }
  return 0;
}, si = {
  name: "float",
  initialValue: "none",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "left":
        return 1;
      case "right":
        return 2;
      case "inline-start":
        return 3;
      case "inline-end":
        return 4;
    }
    return 0;
  }
}, ai = {
  name: "letter-spacing",
  initialValue: "0",
  prefix: !1,
  type: 0,
  parse: function(e, A) {
    return A.type === 20 && A.value === "normal" ? 0 : A.type === 17 || A.type === 15 ? A.number : 0;
  }
}, ke;
(function(e) {
  e.NORMAL = "normal", e.STRICT = "strict";
})(ke || (ke = {}));
var ii = {
  name: "line-break",
  initialValue: "normal",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "strict":
        return ke.STRICT;
      case "normal":
      default:
        return ke.NORMAL;
    }
  }
}, oi = {
  name: "line-height",
  initialValue: "normal",
  prefix: !1,
  type: 4
  /* TOKEN_VALUE */
}, Tt = function(e, A) {
  return b(e) && e.value === "normal" ? 1.2 * A : e.type === 17 ? A * e.number : M(e) ? D(e, A) : A;
}, Qi = {
  name: "list-style-image",
  initialValue: "none",
  type: 0,
  prefix: !1,
  parse: function(e, A) {
    return A.type === 20 && A.value === "none" ? null : st.parse(e, A);
  }
}, ci = {
  name: "list-style-position",
  initialValue: "outside",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "inside":
        return 0;
      case "outside":
      default:
        return 1;
    }
  }
}, kr = {
  name: "list-style-type",
  initialValue: "none",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "disc":
        return 0;
      case "circle":
        return 1;
      case "square":
        return 2;
      case "decimal":
        return 3;
      case "cjk-decimal":
        return 4;
      case "decimal-leading-zero":
        return 5;
      case "lower-roman":
        return 6;
      case "upper-roman":
        return 7;
      case "lower-greek":
        return 8;
      case "lower-alpha":
        return 9;
      case "upper-alpha":
        return 10;
      case "arabic-indic":
        return 11;
      case "armenian":
        return 12;
      case "bengali":
        return 13;
      case "cambodian":
        return 14;
      case "cjk-earthly-branch":
        return 15;
      case "cjk-heavenly-stem":
        return 16;
      case "cjk-ideographic":
        return 17;
      case "devanagari":
        return 18;
      case "ethiopic-numeric":
        return 19;
      case "georgian":
        return 20;
      case "gujarati":
        return 21;
      case "gurmukhi":
        return 22;
      case "hebrew":
        return 22;
      case "hiragana":
        return 23;
      case "hiragana-iroha":
        return 24;
      case "japanese-formal":
        return 25;
      case "japanese-informal":
        return 26;
      case "kannada":
        return 27;
      case "katakana":
        return 28;
      case "katakana-iroha":
        return 29;
      case "khmer":
        return 30;
      case "korean-hangul-formal":
        return 31;
      case "korean-hanja-formal":
        return 32;
      case "korean-hanja-informal":
        return 33;
      case "lao":
        return 34;
      case "lower-armenian":
        return 35;
      case "malayalam":
        return 36;
      case "mongolian":
        return 37;
      case "myanmar":
        return 38;
      case "oriya":
        return 39;
      case "persian":
        return 40;
      case "simp-chinese-formal":
        return 41;
      case "simp-chinese-informal":
        return 42;
      case "tamil":
        return 43;
      case "telugu":
        return 44;
      case "thai":
        return 45;
      case "tibetan":
        return 46;
      case "trad-chinese-formal":
        return 47;
      case "trad-chinese-informal":
        return 48;
      case "upper-armenian":
        return 49;
      case "disclosure-open":
        return 50;
      case "disclosure-closed":
        return 51;
      case "none":
      default:
        return -1;
    }
  }
}, ir = function(e) {
  return {
    name: "margin-" + e,
    initialValue: "0",
    prefix: !1,
    type: 4
    /* TOKEN_VALUE */
  };
}, gi = ir("top"), wi = ir("right"), li = ir("bottom"), ui = ir("left"), Ci = {
  name: "overflow",
  initialValue: "visible",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    return A.filter(b).map(function(r) {
      switch (r.value) {
        case "hidden":
          return 1;
        case "scroll":
          return 2;
        case "clip":
          return 3;
        case "auto":
          return 4;
        case "visible":
        default:
          return 0;
      }
    });
  }
}, fi = {
  name: "overflow-wrap",
  initialValue: "normal",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "break-word":
        return "break-word";
      case "normal":
      default:
        return "normal";
    }
  }
}, or = function(e) {
  return {
    name: "padding-" + e,
    initialValue: "0",
    prefix: !1,
    type: 3,
    format: "length-percentage"
  };
}, Ui = or("top"), Fi = or("right"), hi = or("bottom"), di = or("left"), Ei = {
  name: "text-align",
  initialValue: "left",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "right":
        return 2;
      case "center":
      case "justify":
        return 1;
      case "left":
      default:
        return 0;
    }
  }
}, Hi = {
  name: "position",
  initialValue: "static",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "relative":
        return 1;
      case "absolute":
        return 2;
      case "fixed":
        return 3;
      case "sticky":
        return 4;
    }
    return 0;
  }
}, pi = {
  name: "text-shadow",
  initialValue: "none",
  type: 1,
  prefix: !1,
  parse: function(e, A) {
    return A.length === 1 && Jr(A[0], "none") ? [] : sA(A).map(function(r) {
      for (var t = {
        color: gA.TRANSPARENT,
        offsetX: P,
        offsetY: P,
        blur: P
      }, B = 0, n = 0; n < r.length; n++) {
        var s = r[n];
        pA(s) ? (B === 0 ? t.offsetX = s : B === 1 ? t.offsetY = s : t.blur = s, B++) : t.color = EA.parse(e, s);
      }
      return t;
    });
  }
}, Ii = {
  name: "text-transform",
  initialValue: "none",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "uppercase":
        return 2;
      case "lowercase":
        return 1;
      case "capitalize":
        return 3;
    }
    return 0;
  }
}, vi = {
  name: "transform",
  initialValue: "none",
  prefix: !0,
  type: 0,
  parse: function(e, A) {
    if (A.type === 20 && A.value === "none")
      return null;
    if (A.type === 18) {
      var r = Ki[A.name];
      if (typeof r > "u")
        throw new Error('Attempting to parse an unsupported transform function "' + A.name + '"');
      return r(A.values);
    }
    return null;
  }
}, mi = function(e) {
  var A = e.filter(function(r) {
    return r.type === 17;
  }).map(function(r) {
    return r.number;
  });
  return A.length === 6 ? A : null;
}, yi = function(e) {
  var A = e.filter(function(a) {
    return a.type === 17;
  }).map(function(a) {
    return a.number;
  }), r = A[0], t = A[1];
  A[2], A[3];
  var B = A[4], n = A[5];
  A[6], A[7], A[8], A[9], A[10], A[11];
  var s = A[12], i = A[13];
  return A[14], A[15], A.length === 16 ? [r, t, B, n, s, i] : null;
}, Ki = {
  matrix: mi,
  matrix3d: yi
}, St = {
  type: 16,
  number: 50,
  flags: we
}, Li = [St, St], bi = {
  name: "transform-origin",
  initialValue: "50% 50%",
  prefix: !0,
  type: 1,
  parse: function(e, A) {
    var r = A.filter(M);
    return r.length !== 2 ? Li : [r[0], r[1]];
  }
}, Di = {
  name: "visible",
  initialValue: "none",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "hidden":
        return 1;
      case "collapse":
        return 2;
      case "visible":
      default:
        return 0;
    }
  }
}, ae;
(function(e) {
  e.NORMAL = "normal", e.BREAK_ALL = "break-all", e.KEEP_ALL = "keep-all";
})(ae || (ae = {}));
var xi = {
  name: "word-break",
  initialValue: "normal",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "break-all":
        return ae.BREAK_ALL;
      case "keep-all":
        return ae.KEEP_ALL;
      case "normal":
      default:
        return ae.NORMAL;
    }
  }
}, Ti = {
  name: "z-index",
  initialValue: "auto",
  prefix: !1,
  type: 0,
  parse: function(e, A) {
    if (A.type === 20)
      return { auto: !0, order: 0 };
    if (kA(A))
      return { auto: !1, order: A.number };
    throw new Error("Invalid z-index number parsed");
  }
}, JB = {
  name: "time",
  parse: function(e, A) {
    if (A.type === 15)
      switch (A.unit.toLowerCase()) {
        case "s":
          return 1e3 * A.number;
        case "ms":
          return A.number;
      }
    throw new Error("Unsupported time type");
  }
}, Si = {
  name: "opacity",
  initialValue: "1",
  type: 0,
  prefix: !1,
  parse: function(e, A) {
    return kA(A) ? A.number : 1;
  }
}, Oi = {
  name: "text-decoration-color",
  initialValue: "transparent",
  prefix: !1,
  type: 3,
  format: "color"
}, Mi = {
  name: "text-decoration-line",
  initialValue: "none",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    return A.filter(b).map(function(r) {
      switch (r.value) {
        case "underline":
          return 1;
        case "overline":
          return 2;
        case "line-through":
          return 3;
        case "none":
          return 4;
      }
      return 0;
    }).filter(function(r) {
      return r !== 0;
    });
  }
}, Gi = {
  name: "font-family",
  initialValue: "",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    var r = [], t = [];
    return A.forEach(function(B) {
      switch (B.type) {
        case 20:
        case 0:
          r.push(B.value);
          break;
        case 17:
          r.push(B.number.toString());
          break;
        case 4:
          t.push(r.join(" ")), r.length = 0;
          break;
      }
    }), r.length && t.push(r.join(" ")), t.map(function(B) {
      return B.indexOf(" ") === -1 ? B : "'" + B + "'";
    });
  }
}, Ri = {
  name: "font-size",
  initialValue: "0",
  prefix: !1,
  type: 3,
  format: "length"
}, Vi = {
  name: "font-weight",
  initialValue: "normal",
  type: 0,
  prefix: !1,
  parse: function(e, A) {
    if (kA(A))
      return A.number;
    if (b(A))
      switch (A.value) {
        case "bold":
          return 700;
        case "normal":
        default:
          return 400;
      }
    return 400;
  }
}, Ni = {
  name: "font-variant",
  initialValue: "none",
  type: 1,
  prefix: !1,
  parse: function(e, A) {
    return A.filter(b).map(function(r) {
      return r.value;
    });
  }
}, Pi = {
  name: "font-style",
  initialValue: "normal",
  prefix: !1,
  type: 2,
  parse: function(e, A) {
    switch (A) {
      case "oblique":
        return "oblique";
      case "italic":
        return "italic";
      case "normal":
      default:
        return "normal";
    }
  }
}, G = function(e, A) {
  return (e & A) !== 0;
}, Xi = {
  name: "content",
  initialValue: "none",
  type: 1,
  prefix: !1,
  parse: function(e, A) {
    if (A.length === 0)
      return [];
    var r = A[0];
    return r.type === 20 && r.value === "none" ? [] : A;
  }
}, _i = {
  name: "counter-increment",
  initialValue: "none",
  prefix: !0,
  type: 1,
  parse: function(e, A) {
    if (A.length === 0)
      return null;
    var r = A[0];
    if (r.type === 20 && r.value === "none")
      return null;
    for (var t = [], B = A.filter(yB), n = 0; n < B.length; n++) {
      var s = B[n], i = B[n + 1];
      if (s.type === 20) {
        var a = i && kA(i) ? i.number : 1;
        t.push({ counter: s.value, increment: a });
      }
    }
    return t;
  }
}, Ji = {
  name: "counter-reset",
  initialValue: "none",
  prefix: !0,
  type: 1,
  parse: function(e, A) {
    if (A.length === 0)
      return [];
    for (var r = [], t = A.filter(yB), B = 0; B < t.length; B++) {
      var n = t[B], s = t[B + 1];
      if (b(n) && n.value !== "none") {
        var i = s && kA(s) ? s.number : 0;
        r.push({ counter: n.value, reset: i });
      }
    }
    return r;
  }
}, ki = {
  name: "duration",
  initialValue: "0s",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    return A.filter(le).map(function(r) {
      return JB.parse(e, r);
    });
  }
}, Wi = {
  name: "quotes",
  initialValue: "none",
  prefix: !0,
  type: 1,
  parse: function(e, A) {
    if (A.length === 0)
      return null;
    var r = A[0];
    if (r.type === 20 && r.value === "none")
      return null;
    var t = [], B = A.filter(Fa);
    if (B.length % 2 !== 0)
      return null;
    for (var n = 0; n < B.length; n += 2) {
      var s = B[n].value, i = B[n + 1].value;
      t.push({ open: s, close: i });
    }
    return t;
  }
}, Ot = function(e, A, r) {
  if (!e)
    return "";
  var t = e[Math.min(A, e.length - 1)];
  return t ? r ? t.open : t.close : "";
}, Yi = {
  name: "box-shadow",
  initialValue: "none",
  type: 1,
  prefix: !1,
  parse: function(e, A) {
    return A.length === 1 && Jr(A[0], "none") ? [] : sA(A).map(function(r) {
      for (var t = {
        color: 255,
        offsetX: P,
        offsetY: P,
        blur: P,
        spread: P,
        inset: !1
      }, B = 0, n = 0; n < r.length; n++) {
        var s = r[n];
        Jr(s, "inset") ? t.inset = !0 : pA(s) ? (B === 0 ? t.offsetX = s : B === 1 ? t.offsetY = s : B === 2 ? t.blur = s : t.spread = s, B++) : t.color = EA.parse(e, s);
      }
      return t;
    });
  }
}, Zi = {
  name: "paint-order",
  initialValue: "normal",
  prefix: !1,
  type: 1,
  parse: function(e, A) {
    var r = [
      0,
      1,
      2
      /* MARKERS */
    ], t = [];
    return A.filter(b).forEach(function(B) {
      switch (B.value) {
        case "stroke":
          t.push(
            1
            /* STROKE */
          );
          break;
        case "fill":
          t.push(
            0
            /* FILL */
          );
          break;
        case "markers":
          t.push(
            2
            /* MARKERS */
          );
          break;
      }
    }), r.forEach(function(B) {
      t.indexOf(B) === -1 && t.push(B);
    }), t;
  }
}, qi = {
  name: "-webkit-text-stroke-color",
  initialValue: "currentcolor",
  prefix: !1,
  type: 3,
  format: "color"
}, zi = {
  name: "-webkit-text-stroke-width",
  initialValue: "0",
  type: 0,
  prefix: !1,
  parse: function(e, A) {
    return le(A) ? A.number : 0;
  }
}, ji = (
  /** @class */
  function() {
    function e(A, r) {
      var t, B;
      this.animationDuration = U(A, ki, r.animationDuration), this.backgroundClip = U(A, Ea, r.backgroundClip), this.backgroundColor = U(A, Ha, r.backgroundColor), this.backgroundImage = U(A, xa, r.backgroundImage), this.backgroundOrigin = U(A, Ta, r.backgroundOrigin), this.backgroundPosition = U(A, Sa, r.backgroundPosition), this.backgroundRepeat = U(A, Oa, r.backgroundRepeat), this.backgroundSize = U(A, Ga, r.backgroundSize), this.borderTopColor = U(A, Va, r.borderTopColor), this.borderRightColor = U(A, Na, r.borderRightColor), this.borderBottomColor = U(A, Pa, r.borderBottomColor), this.borderLeftColor = U(A, Xa, r.borderLeftColor), this.borderTopLeftRadius = U(A, _a, r.borderTopLeftRadius), this.borderTopRightRadius = U(A, Ja, r.borderTopRightRadius), this.borderBottomRightRadius = U(A, ka, r.borderBottomRightRadius), this.borderBottomLeftRadius = U(A, Wa, r.borderBottomLeftRadius), this.borderTopStyle = U(A, Ya, r.borderTopStyle), this.borderRightStyle = U(A, Za, r.borderRightStyle), this.borderBottomStyle = U(A, qa, r.borderBottomStyle), this.borderLeftStyle = U(A, za, r.borderLeftStyle), this.borderTopWidth = U(A, ja, r.borderTopWidth), this.borderRightWidth = U(A, $a, r.borderRightWidth), this.borderBottomWidth = U(A, Ai, r.borderBottomWidth), this.borderLeftWidth = U(A, ei, r.borderLeftWidth), this.boxShadow = U(A, Yi, r.boxShadow), this.color = U(A, ri, r.color), this.direction = U(A, ti, r.direction), this.display = U(A, Bi, r.display), this.float = U(A, si, r.cssFloat), this.fontFamily = U(A, Gi, r.fontFamily), this.fontSize = U(A, Ri, r.fontSize), this.fontStyle = U(A, Pi, r.fontStyle), this.fontVariant = U(A, Ni, r.fontVariant), this.fontWeight = U(A, Vi, r.fontWeight), this.letterSpacing = U(A, ai, r.letterSpacing), this.lineBreak = U(A, ii, r.lineBreak), this.lineHeight = U(A, oi, r.lineHeight), this.listStyleImage = U(A, Qi, r.listStyleImage), this.listStylePosition = U(A, ci, r.listStylePosition), this.listStyleType = U(A, kr, r.listStyleType), this.marginTop = U(A, gi, r.marginTop), this.marginRight = U(A, wi, r.marginRight), this.marginBottom = U(A, li, r.marginBottom), this.marginLeft = U(A, ui, r.marginLeft), this.opacity = U(A, Si, r.opacity);
      var n = U(A, Ci, r.overflow);
      this.overflowX = n[0], this.overflowY = n[n.length > 1 ? 1 : 0], this.overflowWrap = U(A, fi, r.overflowWrap), this.paddingTop = U(A, Ui, r.paddingTop), this.paddingRight = U(A, Fi, r.paddingRight), this.paddingBottom = U(A, hi, r.paddingBottom), this.paddingLeft = U(A, di, r.paddingLeft), this.paintOrder = U(A, Zi, r.paintOrder), this.position = U(A, Hi, r.position), this.textAlign = U(A, Ei, r.textAlign), this.textDecorationColor = U(A, Oi, (t = r.textDecorationColor) !== null && t !== void 0 ? t : r.color), this.textDecorationLine = U(A, Mi, (B = r.textDecorationLine) !== null && B !== void 0 ? B : r.textDecoration), this.textShadow = U(A, pi, r.textShadow), this.textTransform = U(A, Ii, r.textTransform), this.transform = U(A, vi, r.transform), this.transformOrigin = U(A, bi, r.transformOrigin), this.visibility = U(A, Di, r.visibility), this.webkitTextStrokeColor = U(A, qi, r.webkitTextStrokeColor), this.webkitTextStrokeWidth = U(A, zi, r.webkitTextStrokeWidth), this.wordBreak = U(A, xi, r.wordBreak), this.zIndex = U(A, Ti, r.zIndex);
    }
    return e.prototype.isVisible = function() {
      return this.display > 0 && this.opacity > 0 && this.visibility === 0;
    }, e.prototype.isTransparent = function() {
      return HA(this.backgroundColor);
    }, e.prototype.isTransformed = function() {
      return this.transform !== null;
    }, e.prototype.isPositioned = function() {
      return this.position !== 0;
    }, e.prototype.isPositionedWithZIndex = function() {
      return this.isPositioned() && !this.zIndex.auto;
    }, e.prototype.isFloating = function() {
      return this.float !== 0;
    }, e.prototype.isInlineLevel = function() {
      return G(
        this.display,
        4
        /* INLINE */
      ) || G(
        this.display,
        33554432
        /* INLINE_BLOCK */
      ) || G(
        this.display,
        268435456
        /* INLINE_FLEX */
      ) || G(
        this.display,
        536870912
        /* INLINE_GRID */
      ) || G(
        this.display,
        67108864
        /* INLINE_LIST_ITEM */
      ) || G(
        this.display,
        134217728
        /* INLINE_TABLE */
      );
    }, e;
  }()
), $i = (
  /** @class */
  function() {
    function e(A, r) {
      this.content = U(A, Xi, r.content), this.quotes = U(A, Wi, r.quotes);
    }
    return e;
  }()
), Mt = (
  /** @class */
  function() {
    function e(A, r) {
      this.counterIncrement = U(A, _i, r.counterIncrement), this.counterReset = U(A, Ji, r.counterReset);
    }
    return e;
  }()
), U = function(e, A, r) {
  var t = new vB(), B = r !== null && typeof r < "u" ? r.toString() : A.initialValue;
  t.write(B);
  var n = new mB(t.read());
  switch (A.type) {
    case 2:
      var s = n.parseComponentValue();
      return A.parse(e, b(s) ? s.value : A.initialValue);
    case 0:
      return A.parse(e, n.parseComponentValue());
    case 1:
      return A.parse(e, n.parseComponentValues());
    case 4:
      return n.parseComponentValue();
    case 3:
      switch (A.format) {
        case "angle":
          return rr.parse(e, n.parseComponentValue());
        case "color":
          return EA.parse(e, n.parseComponentValue());
        case "image":
          return st.parse(e, n.parseComponentValue());
        case "length":
          var i = n.parseComponentValue();
          return pA(i) ? i : P;
        case "length-percentage":
          var a = n.parseComponentValue();
          return M(a) ? a : P;
        case "time":
          return JB.parse(e, n.parseComponentValue());
      }
      break;
  }
}, Ao = "data-html2canvas-debug", eo = function(e) {
  var A = e.getAttribute(Ao);
  switch (A) {
    case "all":
      return 1;
    case "clone":
      return 2;
    case "parse":
      return 3;
    case "render":
      return 4;
    default:
      return 0;
  }
}, Wr = function(e, A) {
  var r = eo(e);
  return r === 1 || A === r;
}, aA = (
  /** @class */
  function() {
    function e(A, r) {
      if (this.context = A, this.textNodes = [], this.elements = [], this.flags = 0, Wr(
        r,
        3
        /* PARSE */
      ))
        debugger;
      this.styles = new ji(A, window.getComputedStyle(r, null)), qr(r) && (this.styles.animationDuration.some(function(t) {
        return t > 0;
      }) && (r.style.animationDuration = "0s"), this.styles.transform !== null && (r.style.transform = "none")), this.bounds = Ar(this.context, r), Wr(
        r,
        4
        /* RENDER */
      ) && (this.flags |= 16);
    }
    return e;
  }()
), ro = " ", Gt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", te = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
for (var xe = 0; xe < Gt.length; xe++)
  te[Gt.charCodeAt(xe)] = xe;
var to = function(e) {
  var A = e.length * 0.75, r = e.length, t, B = 0, n, s, i, a;
  e[e.length - 1] === "=" && (A--, e[e.length - 2] === "=" && A--);
  var o = typeof ArrayBuffer < "u" && typeof Uint8Array < "u" && typeof Uint8Array.prototype.slice < "u" ? new ArrayBuffer(A) : new Array(A), Q = Array.isArray(o) ? o : new Uint8Array(o);
  for (t = 0; t < r; t += 4)
    n = te[e.charCodeAt(t)], s = te[e.charCodeAt(t + 1)], i = te[e.charCodeAt(t + 2)], a = te[e.charCodeAt(t + 3)], Q[B++] = n << 2 | s >> 4, Q[B++] = (s & 15) << 4 | i >> 2, Q[B++] = (i & 3) << 6 | a & 63;
  return o;
}, Bo = function(e) {
  for (var A = e.length, r = [], t = 0; t < A; t += 2)
    r.push(e[t + 1] << 8 | e[t]);
  return r;
}, no = function(e) {
  for (var A = e.length, r = [], t = 0; t < A; t += 4)
    r.push(e[t + 3] << 24 | e[t + 2] << 16 | e[t + 1] << 8 | e[t]);
  return r;
}, xA = 5, at = 6 + 5, Fr = 2, so = at - xA, kB = 65536 >> xA, ao = 1 << xA, hr = ao - 1, io = 1024 >> xA, oo = kB + io, Qo = oo, co = 32, go = Qo + co, wo = 65536 >> at, lo = 1 << so, uo = lo - 1, Rt = function(e, A, r) {
  return e.slice ? e.slice(A, r) : new Uint16Array(Array.prototype.slice.call(e, A, r));
}, Co = function(e, A, r) {
  return e.slice ? e.slice(A, r) : new Uint32Array(Array.prototype.slice.call(e, A, r));
}, fo = function(e, A) {
  var r = to(e), t = Array.isArray(r) ? no(r) : new Uint32Array(r), B = Array.isArray(r) ? Bo(r) : new Uint16Array(r), n = 24, s = Rt(B, n / 2, t[4] / 2), i = t[5] === 2 ? Rt(B, (n + t[4]) / 2) : Co(t, Math.ceil((n + t[4]) / 4));
  return new Uo(t[0], t[1], t[2], t[3], s, i);
}, Uo = (
  /** @class */
  function() {
    function e(A, r, t, B, n, s) {
      this.initialValue = A, this.errorValue = r, this.highStart = t, this.highValueIndex = B, this.index = n, this.data = s;
    }
    return e.prototype.get = function(A) {
      var r;
      if (A >= 0) {
        if (A < 55296 || A > 56319 && A <= 65535)
          return r = this.index[A >> xA], r = (r << Fr) + (A & hr), this.data[r];
        if (A <= 65535)
          return r = this.index[kB + (A - 55296 >> xA)], r = (r << Fr) + (A & hr), this.data[r];
        if (A < this.highStart)
          return r = go - wo + (A >> at), r = this.index[r], r += A >> xA & uo, r = this.index[r], r = (r << Fr) + (A & hr), this.data[r];
        if (A <= 1114111)
          return this.data[this.highValueIndex];
      }
      return this.errorValue;
    }, e;
  }()
), Vt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Fo = typeof Uint8Array > "u" ? [] : new Uint8Array(256);
for (var Te = 0; Te < Vt.length; Te++)
  Fo[Vt.charCodeAt(Te)] = Te;
var ho = 1, dr = 2, Er = 3, Nt = 4, Pt = 5, Eo = 7, Xt = 8, Hr = 9, pr = 10, _t = 11, Jt = 12, kt = 13, Wt = 14, Ir = 15, Ho = function(e) {
  for (var A = [], r = 0, t = e.length; r < t; ) {
    var B = e.charCodeAt(r++);
    if (B >= 55296 && B <= 56319 && r < t) {
      var n = e.charCodeAt(r++);
      (n & 64512) === 56320 ? A.push(((B & 1023) << 10) + (n & 1023) + 65536) : (A.push(B), r--);
    } else
      A.push(B);
  }
  return A;
}, po = function() {
  for (var e = [], A = 0; A < arguments.length; A++)
    e[A] = arguments[A];
  if (String.fromCodePoint)
    return String.fromCodePoint.apply(String, e);
  var r = e.length;
  if (!r)
    return "";
  for (var t = [], B = -1, n = ""; ++B < r; ) {
    var s = e[B];
    s <= 65535 ? t.push(s) : (s -= 65536, t.push((s >> 10) + 55296, s % 1024 + 56320)), (B + 1 === r || t.length > 16384) && (n += String.fromCharCode.apply(String, t), t.length = 0);
  }
  return n;
}, Io = fo(ro), j = "×", vr = "÷", vo = function(e) {
  return Io.get(e);
}, mo = function(e, A, r) {
  var t = r - 2, B = A[t], n = A[r - 1], s = A[r];
  if (n === dr && s === Er)
    return j;
  if (n === dr || n === Er || n === Nt || s === dr || s === Er || s === Nt)
    return vr;
  if (n === Xt && [Xt, Hr, _t, Jt].indexOf(s) !== -1 || (n === _t || n === Hr) && (s === Hr || s === pr) || (n === Jt || n === pr) && s === pr || s === kt || s === Pt || s === Eo || n === ho)
    return j;
  if (n === kt && s === Wt) {
    for (; B === Pt; )
      B = A[--t];
    if (B === Wt)
      return j;
  }
  if (n === Ir && s === Ir) {
    for (var i = 0; B === Ir; )
      i++, B = A[--t];
    if (i % 2 === 0)
      return j;
  }
  return vr;
}, yo = function(e) {
  var A = Ho(e), r = A.length, t = 0, B = 0, n = A.map(vo);
  return {
    next: function() {
      if (t >= r)
        return { done: !0, value: null };
      for (var s = j; t < r && (s = mo(A, n, ++t)) === j; )
        ;
      if (s !== j || t === r) {
        var i = po.apply(null, A.slice(B, t));
        return B = t, { value: i, done: !1 };
      }
      return { done: !0, value: null };
    }
  };
}, Ko = function(e) {
  for (var A = yo(e), r = [], t; !(t = A.next()).done; )
    t.value && r.push(t.value.slice());
  return r;
}, Lo = function(e) {
  var A = 123;
  if (e.createRange) {
    var r = e.createRange();
    if (r.getBoundingClientRect) {
      var t = e.createElement("boundtest");
      t.style.height = A + "px", t.style.display = "block", e.body.appendChild(t), r.selectNode(t);
      var B = r.getBoundingClientRect(), n = Math.round(B.height);
      if (e.body.removeChild(t), n === A)
        return !0;
    }
  }
  return !1;
}, bo = function(e) {
  var A = e.createElement("boundtest");
  A.style.width = "50px", A.style.display = "block", A.style.fontSize = "12px", A.style.letterSpacing = "0px", A.style.wordSpacing = "0px", e.body.appendChild(A);
  var r = e.createRange();
  A.innerHTML = typeof "".repeat == "function" ? "&#128104;".repeat(10) : "";
  var t = A.firstChild, B = er(t.data).map(function(a) {
    return S(a);
  }), n = 0, s = {}, i = B.every(function(a, o) {
    r.setStart(t, n), r.setEnd(t, n + a.length);
    var Q = r.getBoundingClientRect();
    n += a.length;
    var c = Q.x > s.x || Q.y > s.y;
    return s = Q, o === 0 ? !0 : c;
  });
  return e.body.removeChild(A), i;
}, Do = function() {
  return typeof new Image().crossOrigin < "u";
}, xo = function() {
  return typeof new XMLHttpRequest().responseType == "string";
}, To = function(e) {
  var A = new Image(), r = e.createElement("canvas"), t = r.getContext("2d");
  if (!t)
    return !1;
  A.src = "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";
  try {
    t.drawImage(A, 0, 0), r.toDataURL();
  } catch (B) {
    return !1;
  }
  return !0;
}, Yt = function(e) {
  return e[0] === 0 && e[1] === 255 && e[2] === 0 && e[3] === 255;
}, So = function(e) {
  var A = e.createElement("canvas"), r = 100;
  A.width = r, A.height = r;
  var t = A.getContext("2d");
  if (!t)
    return Promise.reject(!1);
  t.fillStyle = "rgb(0, 255, 0)", t.fillRect(0, 0, r, r);
  var B = new Image(), n = A.toDataURL();
  B.src = n;
  var s = Yr(r, r, 0, 0, B);
  return t.fillStyle = "red", t.fillRect(0, 0, r, r), Zt(s).then(function(i) {
    t.drawImage(i, 0, 0);
    var a = t.getImageData(0, 0, r, r).data;
    t.fillStyle = "red", t.fillRect(0, 0, r, r);
    var o = e.createElement("div");
    return o.style.backgroundImage = "url(" + n + ")", o.style.height = r + "px", Yt(a) ? Zt(Yr(r, r, 0, 0, o)) : Promise.reject(!1);
  }).then(function(i) {
    return t.drawImage(i, 0, 0), Yt(t.getImageData(0, 0, r, r).data);
  }).catch(function() {
    return !1;
  });
}, Yr = function(e, A, r, t, B) {
  var n = "http://www.w3.org/2000/svg", s = document.createElementNS(n, "svg"), i = document.createElementNS(n, "foreignObject");
  return s.setAttributeNS(null, "width", e.toString()), s.setAttributeNS(null, "height", A.toString()), i.setAttributeNS(null, "width", "100%"), i.setAttributeNS(null, "height", "100%"), i.setAttributeNS(null, "x", r.toString()), i.setAttributeNS(null, "y", t.toString()), i.setAttributeNS(null, "externalResourcesRequired", "true"), s.appendChild(i), i.appendChild(B), s;
}, Zt = function(e) {
  return new Promise(function(A, r) {
    var t = new Image();
    t.onload = function() {
      return A(t);
    }, t.onerror = r, t.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(e));
  });
}, N = {
  get SUPPORT_RANGE_BOUNDS() {
    var e = Lo(document);
    return Object.defineProperty(N, "SUPPORT_RANGE_BOUNDS", { value: e }), e;
  },
  get SUPPORT_WORD_BREAKING() {
    var e = N.SUPPORT_RANGE_BOUNDS && bo(document);
    return Object.defineProperty(N, "SUPPORT_WORD_BREAKING", { value: e }), e;
  },
  get SUPPORT_SVG_DRAWING() {
    var e = To(document);
    return Object.defineProperty(N, "SUPPORT_SVG_DRAWING", { value: e }), e;
  },
  get SUPPORT_FOREIGNOBJECT_DRAWING() {
    var e = typeof Array.from == "function" && typeof window.fetch == "function" ? So(document) : Promise.resolve(!1);
    return Object.defineProperty(N, "SUPPORT_FOREIGNOBJECT_DRAWING", { value: e }), e;
  },
  get SUPPORT_CORS_IMAGES() {
    var e = Do();
    return Object.defineProperty(N, "SUPPORT_CORS_IMAGES", { value: e }), e;
  },
  get SUPPORT_RESPONSE_TYPE() {
    var e = xo();
    return Object.defineProperty(N, "SUPPORT_RESPONSE_TYPE", { value: e }), e;
  },
  get SUPPORT_CORS_XHR() {
    var e = "withCredentials" in new XMLHttpRequest();
    return Object.defineProperty(N, "SUPPORT_CORS_XHR", { value: e }), e;
  },
  get SUPPORT_NATIVE_TEXT_SEGMENTATION() {
    var e = !!(typeof Intl < "u" && Intl.Segmenter);
    return Object.defineProperty(N, "SUPPORT_NATIVE_TEXT_SEGMENTATION", { value: e }), e;
  }
}, ie = (
  /** @class */
  function() {
    function e(A, r) {
      this.text = A, this.bounds = r;
    }
    return e;
  }()
), Oo = function(e, A, r, t) {
  var B = Ro(A, r), n = [], s = 0;
  return B.forEach(function(i) {
    if (r.textDecorationLine.length || i.trim().length > 0)
      if (N.SUPPORT_RANGE_BOUNDS) {
        var a = qt(t, s, i.length).getClientRects();
        if (a.length > 1) {
          var o = it(i), Q = 0;
          o.forEach(function(g) {
            n.push(new ie(g, wA.fromDOMRectList(e, qt(t, Q + s, g.length).getClientRects()))), Q += g.length;
          });
        } else
          n.push(new ie(i, wA.fromDOMRectList(e, a)));
      } else {
        var c = t.splitText(i.length);
        n.push(new ie(i, Mo(e, t))), t = c;
      }
    else
      N.SUPPORT_RANGE_BOUNDS || (t = t.splitText(i.length));
    s += i.length;
  }), n;
}, Mo = function(e, A) {
  var r = A.ownerDocument;
  if (r) {
    var t = r.createElement("html2canvaswrapper");
    t.appendChild(A.cloneNode(!0));
    var B = A.parentNode;
    if (B) {
      B.replaceChild(t, A);
      var n = Ar(e, t);
      return t.firstChild && B.replaceChild(t.firstChild, t), n;
    }
  }
  return wA.EMPTY;
}, qt = function(e, A, r) {
  var t = e.ownerDocument;
  if (!t)
    throw new Error("Node has no owner document");
  var B = t.createRange();
  return B.setStart(e, A), B.setEnd(e, A + r), B;
}, it = function(e) {
  if (N.SUPPORT_NATIVE_TEXT_SEGMENTATION) {
    var A = new Intl.Segmenter(void 0, { granularity: "grapheme" });
    return Array.from(A.segment(e)).map(function(r) {
      return r.segment;
    });
  }
  return Ko(e);
}, Go = function(e, A) {
  if (N.SUPPORT_NATIVE_TEXT_SEGMENTATION) {
    var r = new Intl.Segmenter(void 0, {
      granularity: "word"
    });
    return Array.from(r.segment(e)).map(function(t) {
      return t.segment;
    });
  }
  return No(e, A);
}, Ro = function(e, A) {
  return A.letterSpacing !== 0 ? it(e) : Go(e, A);
}, Vo = [32, 160, 4961, 65792, 65793, 4153, 4241], No = function(e, A) {
  for (var r = ws(e, {
    lineBreak: A.lineBreak,
    wordBreak: A.overflowWrap === "break-word" ? "break-word" : A.wordBreak
  }), t = [], B, n = function() {
    if (B.value) {
      var s = B.value.slice(), i = er(s), a = "";
      i.forEach(function(o) {
        Vo.indexOf(o) === -1 ? a += S(o) : (a.length && t.push(a), t.push(S(o)), a = "");
      }), a.length && t.push(a);
    }
  }; !(B = r.next()).done; )
    n();
  return t;
}, Po = (
  /** @class */
  function() {
    function e(A, r, t) {
      this.text = Xo(r.data, t.textTransform), this.textBounds = Oo(A, this.text, t, r);
    }
    return e;
  }()
), Xo = function(e, A) {
  switch (A) {
    case 1:
      return e.toLowerCase();
    case 3:
      return e.replace(_o, Jo);
    case 2:
      return e.toUpperCase();
    default:
      return e;
  }
}, _o = /(^|\s|:|-|\(|\))([a-z])/g, Jo = function(e, A, r) {
  return e.length > 0 ? A + r.toUpperCase() : e;
}, WB = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      return B.src = t.currentSrc || t.src, B.intrinsicWidth = t.naturalWidth, B.intrinsicHeight = t.naturalHeight, B.context.cache.addImage(B.src), B;
    }
    return A;
  }(aA)
), YB = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      return B.canvas = t, B.intrinsicWidth = t.width, B.intrinsicHeight = t.height, B;
    }
    return A;
  }(aA)
), ZB = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this, n = new XMLSerializer(), s = Ar(r, t);
      return t.setAttribute("width", s.width + "px"), t.setAttribute("height", s.height + "px"), B.svg = "data:image/svg+xml," + encodeURIComponent(n.serializeToString(t)), B.intrinsicWidth = t.width.baseVal.value, B.intrinsicHeight = t.height.baseVal.value, B.context.cache.addImage(B.svg), B;
    }
    return A;
  }(aA)
), qB = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      return B.value = t.value, B;
    }
    return A;
  }(aA)
), Zr = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      return B.start = t.start, B.reversed = typeof t.reversed == "boolean" && t.reversed === !0, B;
    }
    return A;
  }(aA)
), ko = [
  {
    type: 15,
    flags: 0,
    unit: "px",
    number: 3
  }
], Wo = [
  {
    type: 16,
    flags: 0,
    number: 50
  }
], Yo = function(e) {
  return e.width > e.height ? new wA(e.left + (e.width - e.height) / 2, e.top, e.height, e.height) : e.width < e.height ? new wA(e.left, e.top + (e.height - e.width) / 2, e.width, e.width) : e;
}, Zo = function(e) {
  var A = e.type === qo ? new Array(e.value.length + 1).join("•") : e.value;
  return A.length === 0 ? e.placeholder || "" : A;
}, We = "checkbox", Ye = "radio", qo = "password", zt = 707406591, ot = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      switch (B.type = t.type.toLowerCase(), B.checked = t.checked, B.value = Zo(t), (B.type === We || B.type === Ye) && (B.styles.backgroundColor = 3739148031, B.styles.borderTopColor = B.styles.borderRightColor = B.styles.borderBottomColor = B.styles.borderLeftColor = 2779096575, B.styles.borderTopWidth = B.styles.borderRightWidth = B.styles.borderBottomWidth = B.styles.borderLeftWidth = 1, B.styles.borderTopStyle = B.styles.borderRightStyle = B.styles.borderBottomStyle = B.styles.borderLeftStyle = 1, B.styles.backgroundClip = [
        0
        /* BORDER_BOX */
      ], B.styles.backgroundOrigin = [
        0
        /* BORDER_BOX */
      ], B.bounds = Yo(B.bounds)), B.type) {
        case We:
          B.styles.borderTopRightRadius = B.styles.borderTopLeftRadius = B.styles.borderBottomRightRadius = B.styles.borderBottomLeftRadius = ko;
          break;
        case Ye:
          B.styles.borderTopRightRadius = B.styles.borderTopLeftRadius = B.styles.borderBottomRightRadius = B.styles.borderBottomLeftRadius = Wo;
          break;
      }
      return B;
    }
    return A;
  }(aA)
), zB = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this, n = t.options[t.selectedIndex || 0];
      return B.value = n && n.text || "", B;
    }
    return A;
  }(aA)
), jB = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      return B.value = t.value, B;
    }
    return A;
  }(aA)
), $B = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      B.src = t.src, B.width = parseInt(t.width, 10) || 0, B.height = parseInt(t.height, 10) || 0, B.backgroundColor = B.styles.backgroundColor;
      try {
        if (t.contentWindow && t.contentWindow.document && t.contentWindow.document.documentElement) {
          B.tree = en(r, t.contentWindow.document.documentElement);
          var n = t.contentWindow.document.documentElement ? se(r, getComputedStyle(t.contentWindow.document.documentElement).backgroundColor) : gA.TRANSPARENT, s = t.contentWindow.document.body ? se(r, getComputedStyle(t.contentWindow.document.body).backgroundColor) : gA.TRANSPARENT;
          B.backgroundColor = HA(n) ? HA(s) ? B.styles.backgroundColor : s : n;
        }
      } catch (i) {
      }
      return B;
    }
    return A;
  }(aA)
), zo = ["OL", "UL", "MENU"], Ne = function(e, A, r, t) {
  for (var B = A.firstChild, n = void 0; B; B = n)
    if (n = B.nextSibling, rn(B) && B.data.trim().length > 0)
      r.textNodes.push(new Po(e, B, r.styles));
    else if (XA(B))
      if (sn(B) && B.assignedNodes)
        B.assignedNodes().forEach(function(i) {
          return Ne(e, i, r, t);
        });
      else {
        var s = An(e, B);
        s.styles.isVisible() && (jo(B, s, t) ? s.flags |= 4 : $o(s.styles) && (s.flags |= 2), zo.indexOf(B.tagName) !== -1 && (s.flags |= 8), r.elements.push(s), B.slot, B.shadowRoot ? Ne(e, B.shadowRoot, s, t) : !Ze(B) && !tn(B) && !qe(B) && Ne(e, B, s, t));
      }
}, An = function(e, A) {
  return zr(A) ? new WB(e, A) : Bn(A) ? new YB(e, A) : tn(A) ? new ZB(e, A) : AQ(A) ? new qB(e, A) : eQ(A) ? new Zr(e, A) : rQ(A) ? new ot(e, A) : qe(A) ? new zB(e, A) : Ze(A) ? new jB(e, A) : nn(A) ? new $B(e, A) : new aA(e, A);
}, en = function(e, A) {
  var r = An(e, A);
  return r.flags |= 4, Ne(e, A, r, r), r;
}, jo = function(e, A, r) {
  return A.styles.isPositionedWithZIndex() || A.styles.opacity < 1 || A.styles.isTransformed() || Qt(e) && r.styles.isTransparent();
}, $o = function(e) {
  return e.isPositioned() || e.isFloating();
}, rn = function(e) {
  return e.nodeType === Node.TEXT_NODE;
}, XA = function(e) {
  return e.nodeType === Node.ELEMENT_NODE;
}, qr = function(e) {
  return XA(e) && typeof e.style < "u" && !Pe(e);
}, Pe = function(e) {
  return typeof e.className == "object";
}, AQ = function(e) {
  return e.tagName === "LI";
}, eQ = function(e) {
  return e.tagName === "OL";
}, rQ = function(e) {
  return e.tagName === "INPUT";
}, tQ = function(e) {
  return e.tagName === "HTML";
}, tn = function(e) {
  return e.tagName === "svg";
}, Qt = function(e) {
  return e.tagName === "BODY";
}, Bn = function(e) {
  return e.tagName === "CANVAS";
}, jt = function(e) {
  return e.tagName === "VIDEO";
}, zr = function(e) {
  return e.tagName === "IMG";
}, nn = function(e) {
  return e.tagName === "IFRAME";
}, $t = function(e) {
  return e.tagName === "STYLE";
}, BQ = function(e) {
  return e.tagName === "SCRIPT";
}, Ze = function(e) {
  return e.tagName === "TEXTAREA";
}, qe = function(e) {
  return e.tagName === "SELECT";
}, sn = function(e) {
  return e.tagName === "SLOT";
}, AB = function(e) {
  return e.tagName.indexOf("-") > 0;
}, nQ = (
  /** @class */
  function() {
    function e() {
      this.counters = {};
    }
    return e.prototype.getCounterValue = function(A) {
      var r = this.counters[A];
      return r && r.length ? r[r.length - 1] : 1;
    }, e.prototype.getCounterValues = function(A) {
      var r = this.counters[A];
      return r || [];
    }, e.prototype.pop = function(A) {
      var r = this;
      A.forEach(function(t) {
        return r.counters[t].pop();
      });
    }, e.prototype.parse = function(A) {
      var r = this, t = A.counterIncrement, B = A.counterReset, n = !0;
      t !== null && t.forEach(function(i) {
        var a = r.counters[i.counter];
        a && i.increment !== 0 && (n = !1, a.length || a.push(1), a[Math.max(0, a.length - 1)] += i.increment);
      });
      var s = [];
      return n && B.forEach(function(i) {
        var a = r.counters[i.counter];
        s.push(i.counter), a || (a = r.counters[i.counter] = []), a.push(i.reset);
      }), s;
    }, e;
  }()
), eB = {
  integers: [1e3, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1],
  values: ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"]
}, rB = {
  integers: [
    9e3,
    8e3,
    7e3,
    6e3,
    5e3,
    4e3,
    3e3,
    2e3,
    1e3,
    900,
    800,
    700,
    600,
    500,
    400,
    300,
    200,
    100,
    90,
    80,
    70,
    60,
    50,
    40,
    30,
    20,
    10,
    9,
    8,
    7,
    6,
    5,
    4,
    3,
    2,
    1
  ],
  values: [
    "Ք",
    "Փ",
    "Ւ",
    "Ց",
    "Ր",
    "Տ",
    "Վ",
    "Ս",
    "Ռ",
    "Ջ",
    "Պ",
    "Չ",
    "Ո",
    "Շ",
    "Ն",
    "Յ",
    "Մ",
    "Ճ",
    "Ղ",
    "Ձ",
    "Հ",
    "Կ",
    "Ծ",
    "Խ",
    "Լ",
    "Ի",
    "Ժ",
    "Թ",
    "Ը",
    "Է",
    "Զ",
    "Ե",
    "Դ",
    "Գ",
    "Բ",
    "Ա"
  ]
}, sQ = {
  integers: [
    1e4,
    9e3,
    8e3,
    7e3,
    6e3,
    5e3,
    4e3,
    3e3,
    2e3,
    1e3,
    400,
    300,
    200,
    100,
    90,
    80,
    70,
    60,
    50,
    40,
    30,
    20,
    19,
    18,
    17,
    16,
    15,
    10,
    9,
    8,
    7,
    6,
    5,
    4,
    3,
    2,
    1
  ],
  values: [
    "י׳",
    "ט׳",
    "ח׳",
    "ז׳",
    "ו׳",
    "ה׳",
    "ד׳",
    "ג׳",
    "ב׳",
    "א׳",
    "ת",
    "ש",
    "ר",
    "ק",
    "צ",
    "פ",
    "ע",
    "ס",
    "נ",
    "מ",
    "ל",
    "כ",
    "יט",
    "יח",
    "יז",
    "טז",
    "טו",
    "י",
    "ט",
    "ח",
    "ז",
    "ו",
    "ה",
    "ד",
    "ג",
    "ב",
    "א"
  ]
}, aQ = {
  integers: [
    1e4,
    9e3,
    8e3,
    7e3,
    6e3,
    5e3,
    4e3,
    3e3,
    2e3,
    1e3,
    900,
    800,
    700,
    600,
    500,
    400,
    300,
    200,
    100,
    90,
    80,
    70,
    60,
    50,
    40,
    30,
    20,
    10,
    9,
    8,
    7,
    6,
    5,
    4,
    3,
    2,
    1
  ],
  values: [
    "ჵ",
    "ჰ",
    "ჯ",
    "ჴ",
    "ხ",
    "ჭ",
    "წ",
    "ძ",
    "ც",
    "ჩ",
    "შ",
    "ყ",
    "ღ",
    "ქ",
    "ფ",
    "ჳ",
    "ტ",
    "ს",
    "რ",
    "ჟ",
    "პ",
    "ო",
    "ჲ",
    "ნ",
    "მ",
    "ლ",
    "კ",
    "ი",
    "თ",
    "ჱ",
    "ზ",
    "ვ",
    "ე",
    "დ",
    "გ",
    "ბ",
    "ა"
  ]
}, GA = function(e, A, r, t, B, n) {
  return e < A || e > r ? ge(e, B, n.length > 0) : t.integers.reduce(function(s, i, a) {
    for (; e >= i; )
      e -= i, s += t.values[a];
    return s;
  }, "") + n;
}, an = function(e, A, r, t) {
  var B = "";
  do
    r || e--, B = t(e) + B, e /= A;
  while (e * A >= A);
  return B;
}, T = function(e, A, r, t, B) {
  var n = r - A + 1;
  return (e < 0 ? "-" : "") + (an(Math.abs(e), n, t, function(s) {
    return S(Math.floor(s % n) + A);
  }) + B);
}, KA = function(e, A, r) {
  r === void 0 && (r = ". ");
  var t = A.length;
  return an(Math.abs(e), t, !1, function(B) {
    return A[Math.floor(B % t)];
  }) + r;
}, NA = 1 << 0, CA = 1 << 1, fA = 1 << 2, Be = 1 << 3, cA = function(e, A, r, t, B, n) {
  if (e < -9999 || e > 9999)
    return ge(e, 4, B.length > 0);
  var s = Math.abs(e), i = B;
  if (s === 0)
    return A[0] + i;
  for (var a = 0; s > 0 && a <= 4; a++) {
    var o = s % 10;
    o === 0 && G(n, NA) && i !== "" ? i = A[o] + i : o > 1 || o === 1 && a === 0 || o === 1 && a === 1 && G(n, CA) || o === 1 && a === 1 && G(n, fA) && e > 100 || o === 1 && a > 1 && G(n, Be) ? i = A[o] + (a > 0 ? r[a - 1] : "") + i : o === 1 && a > 0 && (i = r[a - 1] + i), s = Math.floor(s / 10);
  }
  return (e < 0 ? t : "") + i;
}, tB = "十百千萬", BB = "拾佰仟萬", nB = "マイナス", mr = "마이너스", ge = function(e, A, r) {
  var t = r ? ". " : "", B = r ? "、" : "", n = r ? ", " : "", s = r ? " " : "";
  switch (A) {
    case 0:
      return "•" + s;
    case 1:
      return "◦" + s;
    case 2:
      return "◾" + s;
    case 5:
      var i = T(e, 48, 57, !0, t);
      return i.length < 4 ? "0" + i : i;
    case 4:
      return KA(e, "〇一二三四五六七八九", B);
    case 6:
      return GA(e, 1, 3999, eB, 3, t).toLowerCase();
    case 7:
      return GA(e, 1, 3999, eB, 3, t);
    case 8:
      return T(e, 945, 969, !1, t);
    case 9:
      return T(e, 97, 122, !1, t);
    case 10:
      return T(e, 65, 90, !1, t);
    case 11:
      return T(e, 1632, 1641, !0, t);
    case 12:
    case 49:
      return GA(e, 1, 9999, rB, 3, t);
    case 35:
      return GA(e, 1, 9999, rB, 3, t).toLowerCase();
    case 13:
      return T(e, 2534, 2543, !0, t);
    case 14:
    case 30:
      return T(e, 6112, 6121, !0, t);
    case 15:
      return KA(e, "子丑寅卯辰巳午未申酉戌亥", B);
    case 16:
      return KA(e, "甲乙丙丁戊己庚辛壬癸", B);
    case 17:
    case 48:
      return cA(e, "零一二三四五六七八九", tB, "負", B, CA | fA | Be);
    case 47:
      return cA(e, "零壹貳參肆伍陸柒捌玖", BB, "負", B, NA | CA | fA | Be);
    case 42:
      return cA(e, "零一二三四五六七八九", tB, "负", B, CA | fA | Be);
    case 41:
      return cA(e, "零壹贰叁肆伍陆柒捌玖", BB, "负", B, NA | CA | fA | Be);
    case 26:
      return cA(e, "〇一二三四五六七八九", "十百千万", nB, B, 0);
    case 25:
      return cA(e, "零壱弐参四伍六七八九", "拾百千万", nB, B, NA | CA | fA);
    case 31:
      return cA(e, "영일이삼사오육칠팔구", "십백천만", mr, n, NA | CA | fA);
    case 33:
      return cA(e, "零一二三四五六七八九", "十百千萬", mr, n, 0);
    case 32:
      return cA(e, "零壹貳參四五六七八九", "拾百千", mr, n, NA | CA | fA);
    case 18:
      return T(e, 2406, 2415, !0, t);
    case 20:
      return GA(e, 1, 19999, aQ, 3, t);
    case 21:
      return T(e, 2790, 2799, !0, t);
    case 22:
      return T(e, 2662, 2671, !0, t);
    case 22:
      return GA(e, 1, 10999, sQ, 3, t);
    case 23:
      return KA(e, "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");
    case 24:
      return KA(e, "いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");
    case 27:
      return T(e, 3302, 3311, !0, t);
    case 28:
      return KA(e, "アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン", B);
    case 29:
      return KA(e, "イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス", B);
    case 34:
      return T(e, 3792, 3801, !0, t);
    case 37:
      return T(e, 6160, 6169, !0, t);
    case 38:
      return T(e, 4160, 4169, !0, t);
    case 39:
      return T(e, 2918, 2927, !0, t);
    case 40:
      return T(e, 1776, 1785, !0, t);
    case 43:
      return T(e, 3046, 3055, !0, t);
    case 44:
      return T(e, 3174, 3183, !0, t);
    case 45:
      return T(e, 3664, 3673, !0, t);
    case 46:
      return T(e, 3872, 3881, !0, t);
    case 3:
    default:
      return T(e, 48, 57, !0, t);
  }
}, on = "data-html2canvas-ignore", sB = (
  /** @class */
  function() {
    function e(A, r, t) {
      if (this.context = A, this.options = t, this.scrolledElements = [], this.referenceElement = r, this.counters = new nQ(), this.quoteDepth = 0, !r.ownerDocument)
        throw new Error("Cloned element does not have an owner document");
      this.documentElement = this.cloneNode(r.ownerDocument.documentElement, !1);
    }
    return e.prototype.toIFrame = function(A, r) {
      var t = this, B = iQ(A, r);
      if (!B.contentWindow)
        return Promise.reject("Unable to find iframe window");
      var n = A.defaultView.pageXOffset, s = A.defaultView.pageYOffset, i = B.contentWindow, a = i.document, o = cQ(B).then(function() {
        return J(t, void 0, void 0, function() {
          var Q, c;
          return X(this, function(g) {
            switch (g.label) {
              case 0:
                return this.scrolledElements.forEach(uQ), i && (i.scrollTo(r.left, r.top), /(iPad|iPhone|iPod)/g.test(navigator.userAgent) && (i.scrollY !== r.top || i.scrollX !== r.left) && (this.context.logger.warn("Unable to restore scroll position for cloned document"), this.context.windowBounds = this.context.windowBounds.add(i.scrollX - r.left, i.scrollY - r.top, 0, 0))), Q = this.options.onclone, c = this.clonedReferenceElement, typeof c > "u" ? [2, Promise.reject("Error finding the " + this.referenceElement.nodeName + " in the cloned document")] : a.fonts && a.fonts.ready ? [4, a.fonts.ready] : [3, 2];
              case 1:
                g.sent(), g.label = 2;
              case 2:
                return /(AppleWebKit)/g.test(navigator.userAgent) ? [4, QQ(a)] : [3, 4];
              case 3:
                g.sent(), g.label = 4;
              case 4:
                return typeof Q == "function" ? [2, Promise.resolve().then(function() {
                  return Q(a, c);
                }).then(function() {
                  return B;
                })] : [2, B];
            }
          });
        });
      });
      return a.open(), a.write(wQ(document.doctype) + "<html></html>"), lQ(this.referenceElement.ownerDocument, n, s), a.replaceChild(a.adoptNode(this.documentElement), a.documentElement), a.close(), o;
    }, e.prototype.createElementClone = function(A) {
      if (Wr(
        A,
        2
        /* CLONE */
      ))
        debugger;
      if (Bn(A))
        return this.createCanvasClone(A);
      if (jt(A))
        return this.createVideoClone(A);
      if ($t(A))
        return this.createStyleClone(A);
      var r = A.cloneNode(!1);
      return zr(r) && (zr(A) && A.currentSrc && A.currentSrc !== A.src && (r.src = A.currentSrc, r.srcset = ""), r.loading === "lazy" && (r.loading = "eager")), AB(r) ? this.createCustomElementClone(r) : r;
    }, e.prototype.createCustomElementClone = function(A) {
      var r = document.createElement("html2canvascustomelement");
      return yr(A.style, r), r;
    }, e.prototype.createStyleClone = function(A) {
      try {
        var r = A.sheet;
        if (r && r.cssRules) {
          var t = [].slice.call(r.cssRules, 0).reduce(function(n, s) {
            return s && typeof s.cssText == "string" ? n + s.cssText : n;
          }, ""), B = A.cloneNode(!1);
          return B.textContent = t, B;
        }
      } catch (n) {
        if (this.context.logger.error("Unable to access cssRules property", n), n.name !== "SecurityError")
          throw n;
      }
      return A.cloneNode(!1);
    }, e.prototype.createCanvasClone = function(A) {
      var r;
      if (this.options.inlineImages && A.ownerDocument) {
        var t = A.ownerDocument.createElement("img");
        try {
          return t.src = A.toDataURL(), t;
        } catch (o) {
          this.context.logger.info("Unable to inline canvas contents, canvas is tainted", A);
        }
      }
      var B = A.cloneNode(!1);
      try {
        B.width = A.width, B.height = A.height;
        var n = A.getContext("2d"), s = B.getContext("2d");
        if (s)
          if (!this.options.allowTaint && n)
            s.putImageData(n.getImageData(0, 0, A.width, A.height), 0, 0);
          else {
            var i = (r = A.getContext("webgl2")) !== null && r !== void 0 ? r : A.getContext("webgl");
            if (i) {
              var a = i.getContextAttributes();
              (a == null ? void 0 : a.preserveDrawingBuffer) === !1 && this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false", A);
            }
            s.drawImage(A, 0, 0);
          }
        return B;
      } catch (o) {
        this.context.logger.info("Unable to clone canvas as it is tainted", A);
      }
      return B;
    }, e.prototype.createVideoClone = function(A) {
      var r = A.ownerDocument.createElement("canvas");
      r.width = A.offsetWidth, r.height = A.offsetHeight;
      var t = r.getContext("2d");
      try {
        return t && (t.drawImage(A, 0, 0, r.width, r.height), this.options.allowTaint || t.getImageData(0, 0, r.width, r.height)), r;
      } catch (n) {
        this.context.logger.info("Unable to clone video as it is tainted", A);
      }
      var B = A.ownerDocument.createElement("canvas");
      return B.width = A.offsetWidth, B.height = A.offsetHeight, B;
    }, e.prototype.appendChildNode = function(A, r, t) {
      (!XA(r) || !BQ(r) && !r.hasAttribute(on) && (typeof this.options.ignoreElements != "function" || !this.options.ignoreElements(r))) && (!this.options.copyStyles || !XA(r) || !$t(r)) && A.appendChild(this.cloneNode(r, t));
    }, e.prototype.cloneChildNodes = function(A, r, t) {
      for (var B = this, n = A.shadowRoot ? A.shadowRoot.firstChild : A.firstChild; n; n = n.nextSibling)
        if (XA(n) && sn(n) && typeof n.assignedNodes == "function") {
          var s = n.assignedNodes();
          s.length && s.forEach(function(i) {
            return B.appendChildNode(r, i, t);
          });
        } else
          this.appendChildNode(r, n, t);
    }, e.prototype.cloneNode = function(A, r) {
      if (rn(A))
        return document.createTextNode(A.data);
      if (!A.ownerDocument)
        return A.cloneNode(!1);
      var t = A.ownerDocument.defaultView;
      if (t && XA(A) && (qr(A) || Pe(A))) {
        var B = this.createElementClone(A);
        B.style.transitionProperty = "none";
        var n = t.getComputedStyle(A), s = t.getComputedStyle(A, ":before"), i = t.getComputedStyle(A, ":after");
        this.referenceElement === A && qr(B) && (this.clonedReferenceElement = B), Qt(B) && UQ(B);
        var a = this.counters.parse(new Mt(this.context, n)), o = this.resolvePseudoContent(A, B, s, oe.BEFORE);
        AB(A) && (r = !0), jt(A) || this.cloneChildNodes(A, B, r), o && B.insertBefore(o, B.firstChild);
        var Q = this.resolvePseudoContent(A, B, i, oe.AFTER);
        return Q && B.appendChild(Q), this.counters.pop(a), (n && (this.options.copyStyles || Pe(A)) && !nn(A) || r) && yr(n, B), (A.scrollTop !== 0 || A.scrollLeft !== 0) && this.scrolledElements.push([B, A.scrollLeft, A.scrollTop]), (Ze(A) || qe(A)) && (Ze(B) || qe(B)) && (B.value = A.value), B;
      }
      return A.cloneNode(!1);
    }, e.prototype.resolvePseudoContent = function(A, r, t, B) {
      var n = this;
      if (t) {
        var s = t.content, i = r.ownerDocument;
        if (!(!i || !s || s === "none" || s === "-moz-alt-content" || t.display === "none")) {
          this.counters.parse(new Mt(this.context, t));
          var a = new $i(this.context, t), o = i.createElement("html2canvaspseudoelement");
          yr(t, o), a.content.forEach(function(c) {
            if (c.type === 0)
              o.appendChild(i.createTextNode(c.value));
            else if (c.type === 22) {
              var g = i.createElement("img");
              g.src = c.value, g.style.opacity = "1", o.appendChild(g);
            } else if (c.type === 18) {
              if (c.name === "attr") {
                var f = c.values.filter(b);
                f.length && o.appendChild(i.createTextNode(A.getAttribute(f[0].value) || ""));
              } else if (c.name === "counter") {
                var w = c.values.filter(JA), l = w[0], H = w[1];
                if (l && b(l)) {
                  var h = n.counters.getCounterValue(l.value), F = H && b(H) ? kr.parse(n.context, H.value) : 3;
                  o.appendChild(i.createTextNode(ge(h, F, !1)));
                }
              } else if (c.name === "counters") {
                var y = c.values.filter(JA), l = y[0], p = y[1], H = y[2];
                if (l && b(l)) {
                  var d = n.counters.getCounterValues(l.value), C = H && b(H) ? kr.parse(n.context, H.value) : 3, v = p && p.type === 0 ? p.value : "", m = d.map(function(k) {
                    return ge(k, C, !1);
                  }).join(v);
                  o.appendChild(i.createTextNode(m));
                }
              }
            } else if (c.type === 20)
              switch (c.value) {
                case "open-quote":
                  o.appendChild(i.createTextNode(Ot(a.quotes, n.quoteDepth++, !0)));
                  break;
                case "close-quote":
                  o.appendChild(i.createTextNode(Ot(a.quotes, --n.quoteDepth, !1)));
                  break;
                default:
                  o.appendChild(i.createTextNode(c.value));
              }
          }), o.className = jr + " " + $r;
          var Q = B === oe.BEFORE ? " " + jr : " " + $r;
          return Pe(r) ? r.className.baseValue += Q : r.className += Q, o;
        }
      }
    }, e.destroy = function(A) {
      return A.parentNode ? (A.parentNode.removeChild(A), !0) : !1;
    }, e;
  }()
), oe;
(function(e) {
  e[e.BEFORE = 0] = "BEFORE", e[e.AFTER = 1] = "AFTER";
})(oe || (oe = {}));
var iQ = function(e, A) {
  var r = e.createElement("iframe");
  return r.className = "html2canvas-container", r.style.visibility = "hidden", r.style.position = "fixed", r.style.left = "-10000px", r.style.top = "0px", r.style.border = "0", r.width = A.width.toString(), r.height = A.height.toString(), r.scrolling = "no", r.setAttribute(on, "true"), e.body.appendChild(r), r;
}, oQ = function(e) {
  return new Promise(function(A) {
    if (e.complete) {
      A();
      return;
    }
    if (!e.src) {
      A();
      return;
    }
    e.onload = A, e.onerror = A;
  });
}, QQ = function(e) {
  return Promise.all([].slice.call(e.images, 0).map(oQ));
}, cQ = function(e) {
  return new Promise(function(A, r) {
    var t = e.contentWindow;
    if (!t)
      return r("No window assigned for iframe");
    var B = t.document;
    t.onload = e.onload = function() {
      t.onload = e.onload = null;
      var n = setInterval(function() {
        B.body.childNodes.length > 0 && B.readyState === "complete" && (clearInterval(n), A(e));
      }, 50);
    };
  });
}, gQ = [
  "all",
  "d",
  "content"
  // Safari shows pseudoelements if content is set
], yr = function(e, A) {
  for (var r = e.length - 1; r >= 0; r--) {
    var t = e.item(r);
    gQ.indexOf(t) === -1 && A.style.setProperty(t, e.getPropertyValue(t));
  }
  return A;
}, wQ = function(e) {
  var A = "";
  return e && (A += "<!DOCTYPE ", e.name && (A += e.name), e.internalSubset && (A += e.internalSubset), e.publicId && (A += '"' + e.publicId + '"'), e.systemId && (A += '"' + e.systemId + '"'), A += ">"), A;
}, lQ = function(e, A, r) {
  e && e.defaultView && (A !== e.defaultView.pageXOffset || r !== e.defaultView.pageYOffset) && e.defaultView.scrollTo(A, r);
}, uQ = function(e) {
  var A = e[0], r = e[1], t = e[2];
  A.scrollLeft = r, A.scrollTop = t;
}, CQ = ":before", fQ = ":after", jr = "___html2canvas___pseudoelement_before", $r = "___html2canvas___pseudoelement_after", aB = `{
    content: "" !important;
    display: none !important;
}`, UQ = function(e) {
  FQ(e, "." + jr + CQ + aB + `
         .` + $r + fQ + aB);
}, FQ = function(e, A) {
  var r = e.ownerDocument;
  if (r) {
    var t = r.createElement("style");
    t.textContent = A, e.appendChild(t);
  }
}, Qn = (
  /** @class */
  function() {
    function e() {
    }
    return e.getOrigin = function(A) {
      var r = e._link;
      return r ? (r.href = A, r.href = r.href, r.protocol + r.hostname + r.port) : "about:blank";
    }, e.isSameOrigin = function(A) {
      return e.getOrigin(A) === e._origin;
    }, e.setContext = function(A) {
      e._link = A.document.createElement("a"), e._origin = e.getOrigin(A.location.href);
    }, e._origin = "about:blank", e;
  }()
), hQ = (
  /** @class */
  function() {
    function e(A, r) {
      this.context = A, this._options = r, this._cache = {};
    }
    return e.prototype.addImage = function(A) {
      var r = Promise.resolve();
      return this.has(A) || (Lr(A) || pQ(A)) && (this._cache[A] = this.loadImage(A)).catch(function() {
      }), r;
    }, e.prototype.match = function(A) {
      return this._cache[A];
    }, e.prototype.loadImage = function(A) {
      return J(this, void 0, void 0, function() {
        var r, t, B, n, s = this;
        return X(this, function(i) {
          switch (i.label) {
            case 0:
              return r = Qn.isSameOrigin(A), t = !Kr(A) && this._options.useCORS === !0 && N.SUPPORT_CORS_IMAGES && !r, B = !Kr(A) && !r && !Lr(A) && typeof this._options.proxy == "string" && N.SUPPORT_CORS_XHR && !t, !r && this._options.allowTaint === !1 && !Kr(A) && !Lr(A) && !B && !t ? [
                2
                /*return*/
              ] : (n = A, B ? [4, this.proxy(n)] : [3, 2]);
            case 1:
              n = i.sent(), i.label = 2;
            case 2:
              return this.context.logger.debug("Added image " + A.substring(0, 256)), [4, new Promise(function(a, o) {
                var Q = new Image();
                Q.onload = function() {
                  return a(Q);
                }, Q.onerror = o, (IQ(n) || t) && (Q.crossOrigin = "anonymous"), Q.src = n, Q.complete === !0 && setTimeout(function() {
                  return a(Q);
                }, 500), s._options.imageTimeout > 0 && setTimeout(function() {
                  return o("Timed out (" + s._options.imageTimeout + "ms) loading image");
                }, s._options.imageTimeout);
              })];
            case 3:
              return [2, i.sent()];
          }
        });
      });
    }, e.prototype.has = function(A) {
      return typeof this._cache[A] < "u";
    }, e.prototype.keys = function() {
      return Promise.resolve(Object.keys(this._cache));
    }, e.prototype.proxy = function(A) {
      var r = this, t = this._options.proxy;
      if (!t)
        throw new Error("No proxy defined");
      var B = A.substring(0, 256);
      return new Promise(function(n, s) {
        var i = N.SUPPORT_RESPONSE_TYPE ? "blob" : "text", a = new XMLHttpRequest();
        a.onload = function() {
          if (a.status === 200)
            if (i === "text")
              n(a.response);
            else {
              var c = new FileReader();
              c.addEventListener("load", function() {
                return n(c.result);
              }, !1), c.addEventListener("error", function(g) {
                return s(g);
              }, !1), c.readAsDataURL(a.response);
            }
          else
            s("Failed to proxy resource " + B + " with status code " + a.status);
        }, a.onerror = s;
        var o = t.indexOf("?") > -1 ? "&" : "?";
        if (a.open("GET", "" + t + o + "url=" + encodeURIComponent(A) + "&responseType=" + i), i !== "text" && a instanceof XMLHttpRequest && (a.responseType = i), r._options.imageTimeout) {
          var Q = r._options.imageTimeout;
          a.timeout = Q, a.ontimeout = function() {
            return s("Timed out (" + Q + "ms) proxying " + B);
          };
        }
        a.send();
      });
    }, e;
  }()
), dQ = /^data:image\/svg\+xml/i, EQ = /^data:image\/.*;base64,/i, HQ = /^data:image\/.*/i, pQ = function(e) {
  return N.SUPPORT_SVG_DRAWING || !vQ(e);
}, Kr = function(e) {
  return HQ.test(e);
}, IQ = function(e) {
  return EQ.test(e);
}, Lr = function(e) {
  return e.substr(0, 4) === "blob";
}, vQ = function(e) {
  return e.substr(-3).toLowerCase() === "svg" || dQ.test(e);
}, u = (
  /** @class */
  function() {
    function e(A, r) {
      this.type = 0, this.x = A, this.y = r;
    }
    return e.prototype.add = function(A, r) {
      return new e(this.x + A, this.y + r);
    }, e;
  }()
), RA = function(e, A, r) {
  return new u(e.x + (A.x - e.x) * r, e.y + (A.y - e.y) * r);
}, Se = (
  /** @class */
  function() {
    function e(A, r, t, B) {
      this.type = 1, this.start = A, this.startControl = r, this.endControl = t, this.end = B;
    }
    return e.prototype.subdivide = function(A, r) {
      var t = RA(this.start, this.startControl, A), B = RA(this.startControl, this.endControl, A), n = RA(this.endControl, this.end, A), s = RA(t, B, A), i = RA(B, n, A), a = RA(s, i, A);
      return r ? new e(this.start, t, s, a) : new e(a, i, n, this.end);
    }, e.prototype.add = function(A, r) {
      return new e(this.start.add(A, r), this.startControl.add(A, r), this.endControl.add(A, r), this.end.add(A, r));
    }, e.prototype.reverse = function() {
      return new e(this.end, this.endControl, this.startControl, this.start);
    }, e;
  }()
), $ = function(e) {
  return e.type === 1;
}, mQ = (
  /** @class */
  function() {
    function e(A) {
      var r = A.styles, t = A.bounds, B = re(r.borderTopLeftRadius, t.width, t.height), n = B[0], s = B[1], i = re(r.borderTopRightRadius, t.width, t.height), a = i[0], o = i[1], Q = re(r.borderBottomRightRadius, t.width, t.height), c = Q[0], g = Q[1], f = re(r.borderBottomLeftRadius, t.width, t.height), w = f[0], l = f[1], H = [];
      H.push((n + a) / t.width), H.push((w + c) / t.width), H.push((s + l) / t.height), H.push((o + g) / t.height);
      var h = Math.max.apply(Math, H);
      h > 1 && (n /= h, s /= h, a /= h, o /= h, c /= h, g /= h, w /= h, l /= h);
      var F = t.width - a, y = t.height - g, p = t.width - c, d = t.height - l, C = r.borderTopWidth, v = r.borderRightWidth, m = r.borderBottomWidth, E = r.borderLeftWidth, O = D(r.paddingTop, A.bounds.width), k = D(r.paddingRight, A.bounds.width), q = D(r.paddingBottom, A.bounds.width), L = D(r.paddingLeft, A.bounds.width);
      this.topLeftBorderDoubleOuterBox = n > 0 || s > 0 ? x(t.left + E / 3, t.top + C / 3, n - E / 3, s - C / 3, K.TOP_LEFT) : new u(t.left + E / 3, t.top + C / 3), this.topRightBorderDoubleOuterBox = n > 0 || s > 0 ? x(t.left + F, t.top + C / 3, a - v / 3, o - C / 3, K.TOP_RIGHT) : new u(t.left + t.width - v / 3, t.top + C / 3), this.bottomRightBorderDoubleOuterBox = c > 0 || g > 0 ? x(t.left + p, t.top + y, c - v / 3, g - m / 3, K.BOTTOM_RIGHT) : new u(t.left + t.width - v / 3, t.top + t.height - m / 3), this.bottomLeftBorderDoubleOuterBox = w > 0 || l > 0 ? x(t.left + E / 3, t.top + d, w - E / 3, l - m / 3, K.BOTTOM_LEFT) : new u(t.left + E / 3, t.top + t.height - m / 3), this.topLeftBorderDoubleInnerBox = n > 0 || s > 0 ? x(t.left + E * 2 / 3, t.top + C * 2 / 3, n - E * 2 / 3, s - C * 2 / 3, K.TOP_LEFT) : new u(t.left + E * 2 / 3, t.top + C * 2 / 3), this.topRightBorderDoubleInnerBox = n > 0 || s > 0 ? x(t.left + F, t.top + C * 2 / 3, a - v * 2 / 3, o - C * 2 / 3, K.TOP_RIGHT) : new u(t.left + t.width - v * 2 / 3, t.top + C * 2 / 3), this.bottomRightBorderDoubleInnerBox = c > 0 || g > 0 ? x(t.left + p, t.top + y, c - v * 2 / 3, g - m * 2 / 3, K.BOTTOM_RIGHT) : new u(t.left + t.width - v * 2 / 3, t.top + t.height - m * 2 / 3), this.bottomLeftBorderDoubleInnerBox = w > 0 || l > 0 ? x(t.left + E * 2 / 3, t.top + d, w - E * 2 / 3, l - m * 2 / 3, K.BOTTOM_LEFT) : new u(t.left + E * 2 / 3, t.top + t.height - m * 2 / 3), this.topLeftBorderStroke = n > 0 || s > 0 ? x(t.left + E / 2, t.top + C / 2, n - E / 2, s - C / 2, K.TOP_LEFT) : new u(t.left + E / 2, t.top + C / 2), this.topRightBorderStroke = n > 0 || s > 0 ? x(t.left + F, t.top + C / 2, a - v / 2, o - C / 2, K.TOP_RIGHT) : new u(t.left + t.width - v / 2, t.top + C / 2), this.bottomRightBorderStroke = c > 0 || g > 0 ? x(t.left + p, t.top + y, c - v / 2, g - m / 2, K.BOTTOM_RIGHT) : new u(t.left + t.width - v / 2, t.top + t.height - m / 2), this.bottomLeftBorderStroke = w > 0 || l > 0 ? x(t.left + E / 2, t.top + d, w - E / 2, l - m / 2, K.BOTTOM_LEFT) : new u(t.left + E / 2, t.top + t.height - m / 2), this.topLeftBorderBox = n > 0 || s > 0 ? x(t.left, t.top, n, s, K.TOP_LEFT) : new u(t.left, t.top), this.topRightBorderBox = a > 0 || o > 0 ? x(t.left + F, t.top, a, o, K.TOP_RIGHT) : new u(t.left + t.width, t.top), this.bottomRightBorderBox = c > 0 || g > 0 ? x(t.left + p, t.top + y, c, g, K.BOTTOM_RIGHT) : new u(t.left + t.width, t.top + t.height), this.bottomLeftBorderBox = w > 0 || l > 0 ? x(t.left, t.top + d, w, l, K.BOTTOM_LEFT) : new u(t.left, t.top + t.height), this.topLeftPaddingBox = n > 0 || s > 0 ? x(t.left + E, t.top + C, Math.max(0, n - E), Math.max(0, s - C), K.TOP_LEFT) : new u(t.left + E, t.top + C), this.topRightPaddingBox = a > 0 || o > 0 ? x(t.left + Math.min(F, t.width - v), t.top + C, F > t.width + v ? 0 : Math.max(0, a - v), Math.max(0, o - C), K.TOP_RIGHT) : new u(t.left + t.width - v, t.top + C), this.bottomRightPaddingBox = c > 0 || g > 0 ? x(t.left + Math.min(p, t.width - E), t.top + Math.min(y, t.height - m), Math.max(0, c - v), Math.max(0, g - m), K.BOTTOM_RIGHT) : new u(t.left + t.width - v, t.top + t.height - m), this.bottomLeftPaddingBox = w > 0 || l > 0 ? x(t.left + E, t.top + Math.min(d, t.height - m), Math.max(0, w - E), Math.max(0, l - m), K.BOTTOM_LEFT) : new u(t.left + E, t.top + t.height - m), this.topLeftContentBox = n > 0 || s > 0 ? x(t.left + E + L, t.top + C + O, Math.max(0, n - (E + L)), Math.max(0, s - (C + O)), K.TOP_LEFT) : new u(t.left + E + L, t.top + C + O), this.topRightContentBox = a > 0 || o > 0 ? x(t.left + Math.min(F, t.width + E + L), t.top + C + O, F > t.width + E + L ? 0 : a - E + L, o - (C + O), K.TOP_RIGHT) : new u(t.left + t.width - (v + k), t.top + C + O), this.bottomRightContentBox = c > 0 || g > 0 ? x(t.left + Math.min(p, t.width - (E + L)), t.top + Math.min(y, t.height + C + O), Math.max(0, c - (v + k)), g - (m + q), K.BOTTOM_RIGHT) : new u(t.left + t.width - (v + k), t.top + t.height - (m + q)), this.bottomLeftContentBox = w > 0 || l > 0 ? x(t.left + E + L, t.top + d, Math.max(0, w - (E + L)), l - (m + q), K.BOTTOM_LEFT) : new u(t.left + E + L, t.top + t.height - (m + q));
    }
    return e;
  }()
), K;
(function(e) {
  e[e.TOP_LEFT = 0] = "TOP_LEFT", e[e.TOP_RIGHT = 1] = "TOP_RIGHT", e[e.BOTTOM_RIGHT = 2] = "BOTTOM_RIGHT", e[e.BOTTOM_LEFT = 3] = "BOTTOM_LEFT";
})(K || (K = {}));
var x = function(e, A, r, t, B) {
  var n = 4 * ((Math.sqrt(2) - 1) / 3), s = r * n, i = t * n, a = e + r, o = A + t;
  switch (B) {
    case K.TOP_LEFT:
      return new Se(new u(e, o), new u(e, o - i), new u(a - s, A), new u(a, A));
    case K.TOP_RIGHT:
      return new Se(new u(e, A), new u(e + s, A), new u(a, o - i), new u(a, o));
    case K.BOTTOM_RIGHT:
      return new Se(new u(a, A), new u(a, A + i), new u(e + s, o), new u(e, o));
    case K.BOTTOM_LEFT:
    default:
      return new Se(new u(a, o), new u(a - s, o), new u(e, A + i), new u(e, A));
  }
}, ze = function(e) {
  return [e.topLeftBorderBox, e.topRightBorderBox, e.bottomRightBorderBox, e.bottomLeftBorderBox];
}, yQ = function(e) {
  return [
    e.topLeftContentBox,
    e.topRightContentBox,
    e.bottomRightContentBox,
    e.bottomLeftContentBox
  ];
}, je = function(e) {
  return [
    e.topLeftPaddingBox,
    e.topRightPaddingBox,
    e.bottomRightPaddingBox,
    e.bottomLeftPaddingBox
  ];
}, KQ = (
  /** @class */
  function() {
    function e(A, r, t) {
      this.offsetX = A, this.offsetY = r, this.matrix = t, this.type = 0, this.target = 6;
    }
    return e;
  }()
), Oe = (
  /** @class */
  function() {
    function e(A, r) {
      this.path = A, this.target = r, this.type = 1;
    }
    return e;
  }()
), LQ = (
  /** @class */
  function() {
    function e(A) {
      this.opacity = A, this.type = 2, this.target = 6;
    }
    return e;
  }()
), bQ = function(e) {
  return e.type === 0;
}, cn = function(e) {
  return e.type === 1;
}, DQ = function(e) {
  return e.type === 2;
}, iB = function(e, A) {
  return e.length === A.length ? e.some(function(r, t) {
    return r === A[t];
  }) : !1;
}, xQ = function(e, A, r, t, B) {
  return e.map(function(n, s) {
    switch (s) {
      case 0:
        return n.add(A, r);
      case 1:
        return n.add(A + t, r);
      case 2:
        return n.add(A + t, r + B);
      case 3:
        return n.add(A, r + B);
    }
    return n;
  });
}, gn = (
  /** @class */
  function() {
    function e(A) {
      this.element = A, this.inlineLevel = [], this.nonInlineLevel = [], this.negativeZIndex = [], this.zeroOrAutoZIndexOrTransformedOrOpacity = [], this.positiveZIndex = [], this.nonPositionedFloats = [], this.nonPositionedInlineLevel = [];
    }
    return e;
  }()
), wn = (
  /** @class */
  function() {
    function e(A, r) {
      if (this.container = A, this.parent = r, this.effects = [], this.curves = new mQ(this.container), this.container.styles.opacity < 1 && this.effects.push(new LQ(this.container.styles.opacity)), this.container.styles.transform !== null) {
        var t = this.container.bounds.left + this.container.styles.transformOrigin[0].number, B = this.container.bounds.top + this.container.styles.transformOrigin[1].number, n = this.container.styles.transform;
        this.effects.push(new KQ(t, B, n));
      }
      if (this.container.styles.overflowX !== 0) {
        var s = ze(this.curves), i = je(this.curves);
        iB(s, i) ? this.effects.push(new Oe(
          s,
          6
          /* CONTENT */
        )) : (this.effects.push(new Oe(
          s,
          2
          /* BACKGROUND_BORDERS */
        )), this.effects.push(new Oe(
          i,
          4
          /* CONTENT */
        )));
      }
    }
    return e.prototype.getEffects = function(A) {
      for (var r = [
        2,
        3
        /* FIXED */
      ].indexOf(this.container.styles.position) === -1, t = this.parent, B = this.effects.slice(0); t; ) {
        var n = t.effects.filter(function(a) {
          return !cn(a);
        });
        if (r || t.container.styles.position !== 0 || !t.parent) {
          if (B.unshift.apply(B, n), r = [
            2,
            3
            /* FIXED */
          ].indexOf(t.container.styles.position) === -1, t.container.styles.overflowX !== 0) {
            var s = ze(t.curves), i = je(t.curves);
            iB(s, i) || B.unshift(new Oe(
              i,
              6
              /* CONTENT */
            ));
          }
        } else
          B.unshift.apply(B, n);
        t = t.parent;
      }
      return B.filter(function(a) {
        return G(a.target, A);
      });
    }, e;
  }()
), At = function(e, A, r, t) {
  e.container.elements.forEach(function(B) {
    var n = G(
      B.flags,
      4
      /* CREATES_REAL_STACKING_CONTEXT */
    ), s = G(
      B.flags,
      2
      /* CREATES_STACKING_CONTEXT */
    ), i = new wn(B, e);
    G(
      B.styles.display,
      2048
      /* LIST_ITEM */
    ) && t.push(i);
    var a = G(
      B.flags,
      8
      /* IS_LIST_OWNER */
    ) ? [] : t;
    if (n || s) {
      var o = n || B.styles.isPositioned() ? r : A, Q = new gn(i);
      if (B.styles.isPositioned() || B.styles.opacity < 1 || B.styles.isTransformed()) {
        var c = B.styles.zIndex.order;
        if (c < 0) {
          var g = 0;
          o.negativeZIndex.some(function(w, l) {
            return c > w.element.container.styles.zIndex.order ? (g = l, !1) : g > 0;
          }), o.negativeZIndex.splice(g, 0, Q);
        } else if (c > 0) {
          var f = 0;
          o.positiveZIndex.some(function(w, l) {
            return c >= w.element.container.styles.zIndex.order ? (f = l + 1, !1) : f > 0;
          }), o.positiveZIndex.splice(f, 0, Q);
        } else
          o.zeroOrAutoZIndexOrTransformedOrOpacity.push(Q);
      } else
        B.styles.isFloating() ? o.nonPositionedFloats.push(Q) : o.nonPositionedInlineLevel.push(Q);
      At(i, Q, n ? Q : r, a);
    } else
      B.styles.isInlineLevel() ? A.inlineLevel.push(i) : A.nonInlineLevel.push(i), At(i, A, r, a);
    G(
      B.flags,
      8
      /* IS_LIST_OWNER */
    ) && ln(B, a);
  });
}, ln = function(e, A) {
  for (var r = e instanceof Zr ? e.start : 1, t = e instanceof Zr ? e.reversed : !1, B = 0; B < A.length; B++) {
    var n = A[B];
    n.container instanceof qB && typeof n.container.value == "number" && n.container.value !== 0 && (r = n.container.value), n.listValue = ge(r, n.container.styles.listStyleType, !0), r += t ? -1 : 1;
  }
}, TQ = function(e) {
  var A = new wn(e, null), r = new gn(A), t = [];
  return At(A, r, r, t), ln(A.container, t), r;
}, oB = function(e, A) {
  switch (A) {
    case 0:
      return eA(e.topLeftBorderBox, e.topLeftPaddingBox, e.topRightBorderBox, e.topRightPaddingBox);
    case 1:
      return eA(e.topRightBorderBox, e.topRightPaddingBox, e.bottomRightBorderBox, e.bottomRightPaddingBox);
    case 2:
      return eA(e.bottomRightBorderBox, e.bottomRightPaddingBox, e.bottomLeftBorderBox, e.bottomLeftPaddingBox);
    case 3:
    default:
      return eA(e.bottomLeftBorderBox, e.bottomLeftPaddingBox, e.topLeftBorderBox, e.topLeftPaddingBox);
  }
}, SQ = function(e, A) {
  switch (A) {
    case 0:
      return eA(e.topLeftBorderBox, e.topLeftBorderDoubleOuterBox, e.topRightBorderBox, e.topRightBorderDoubleOuterBox);
    case 1:
      return eA(e.topRightBorderBox, e.topRightBorderDoubleOuterBox, e.bottomRightBorderBox, e.bottomRightBorderDoubleOuterBox);
    case 2:
      return eA(e.bottomRightBorderBox, e.bottomRightBorderDoubleOuterBox, e.bottomLeftBorderBox, e.bottomLeftBorderDoubleOuterBox);
    case 3:
    default:
      return eA(e.bottomLeftBorderBox, e.bottomLeftBorderDoubleOuterBox, e.topLeftBorderBox, e.topLeftBorderDoubleOuterBox);
  }
}, OQ = function(e, A) {
  switch (A) {
    case 0:
      return eA(e.topLeftBorderDoubleInnerBox, e.topLeftPaddingBox, e.topRightBorderDoubleInnerBox, e.topRightPaddingBox);
    case 1:
      return eA(e.topRightBorderDoubleInnerBox, e.topRightPaddingBox, e.bottomRightBorderDoubleInnerBox, e.bottomRightPaddingBox);
    case 2:
      return eA(e.bottomRightBorderDoubleInnerBox, e.bottomRightPaddingBox, e.bottomLeftBorderDoubleInnerBox, e.bottomLeftPaddingBox);
    case 3:
    default:
      return eA(e.bottomLeftBorderDoubleInnerBox, e.bottomLeftPaddingBox, e.topLeftBorderDoubleInnerBox, e.topLeftPaddingBox);
  }
}, MQ = function(e, A) {
  switch (A) {
    case 0:
      return Me(e.topLeftBorderStroke, e.topRightBorderStroke);
    case 1:
      return Me(e.topRightBorderStroke, e.bottomRightBorderStroke);
    case 2:
      return Me(e.bottomRightBorderStroke, e.bottomLeftBorderStroke);
    case 3:
    default:
      return Me(e.bottomLeftBorderStroke, e.topLeftBorderStroke);
  }
}, Me = function(e, A) {
  var r = [];
  return $(e) ? r.push(e.subdivide(0.5, !1)) : r.push(e), $(A) ? r.push(A.subdivide(0.5, !0)) : r.push(A), r;
}, eA = function(e, A, r, t) {
  var B = [];
  return $(e) ? B.push(e.subdivide(0.5, !1)) : B.push(e), $(r) ? B.push(r.subdivide(0.5, !0)) : B.push(r), $(t) ? B.push(t.subdivide(0.5, !0).reverse()) : B.push(t), $(A) ? B.push(A.subdivide(0.5, !1).reverse()) : B.push(A), B;
}, un = function(e) {
  var A = e.bounds, r = e.styles;
  return A.add(r.borderLeftWidth, r.borderTopWidth, -(r.borderRightWidth + r.borderLeftWidth), -(r.borderTopWidth + r.borderBottomWidth));
}, $e = function(e) {
  var A = e.styles, r = e.bounds, t = D(A.paddingLeft, r.width), B = D(A.paddingRight, r.width), n = D(A.paddingTop, r.width), s = D(A.paddingBottom, r.width);
  return r.add(t + A.borderLeftWidth, n + A.borderTopWidth, -(A.borderRightWidth + A.borderLeftWidth + t + B), -(A.borderTopWidth + A.borderBottomWidth + n + s));
}, GQ = function(e, A) {
  return e === 0 ? A.bounds : e === 2 ? $e(A) : un(A);
}, RQ = function(e, A) {
  return e === 0 ? A.bounds : e === 2 ? $e(A) : un(A);
}, br = function(e, A, r) {
  var t = GQ(PA(e.styles.backgroundOrigin, A), e), B = RQ(PA(e.styles.backgroundClip, A), e), n = VQ(PA(e.styles.backgroundSize, A), r, t), s = n[0], i = n[1], a = re(PA(e.styles.backgroundPosition, A), t.width - s, t.height - i), o = NQ(PA(e.styles.backgroundRepeat, A), a, n, t, B), Q = Math.round(t.left + a[0]), c = Math.round(t.top + a[1]);
  return [o, Q, c, s, i];
}, VA = function(e) {
  return b(e) && e.value === _A.AUTO;
}, Ge = function(e) {
  return typeof e == "number";
}, VQ = function(e, A, r) {
  var t = A[0], B = A[1], n = A[2], s = e[0], i = e[1];
  if (!s)
    return [0, 0];
  if (M(s) && i && M(i))
    return [D(s, r.width), D(i, r.height)];
  var a = Ge(n);
  if (b(s) && (s.value === _A.CONTAIN || s.value === _A.COVER)) {
    if (Ge(n)) {
      var o = r.width / r.height;
      return o < n != (s.value === _A.COVER) ? [r.width, r.width / n] : [r.height * n, r.height];
    }
    return [r.width, r.height];
  }
  var Q = Ge(t), c = Ge(B), g = Q || c;
  if (VA(s) && (!i || VA(i))) {
    if (Q && c)
      return [t, B];
    if (!a && !g)
      return [r.width, r.height];
    if (g && a) {
      var f = Q ? t : B * n, w = c ? B : t / n;
      return [f, w];
    }
    var l = Q ? t : r.width, H = c ? B : r.height;
    return [l, H];
  }
  if (a) {
    var h = 0, F = 0;
    return M(s) ? h = D(s, r.width) : M(i) && (F = D(i, r.height)), VA(s) ? h = F * n : (!i || VA(i)) && (F = h / n), [h, F];
  }
  var y = null, p = null;
  if (M(s) ? y = D(s, r.width) : i && M(i) && (p = D(i, r.height)), y !== null && (!i || VA(i)) && (p = Q && c ? y / t * B : r.height), p !== null && VA(s) && (y = Q && c ? p / B * t : r.width), y !== null && p !== null)
    return [y, p];
  throw new Error("Unable to calculate background-size for element");
}, PA = function(e, A) {
  var r = e[A];
  return typeof r > "u" ? e[0] : r;
}, NQ = function(e, A, r, t, B) {
  var n = A[0], s = A[1], i = r[0], a = r[1];
  switch (e) {
    case 2:
      return [
        new u(Math.round(t.left), Math.round(t.top + s)),
        new u(Math.round(t.left + t.width), Math.round(t.top + s)),
        new u(Math.round(t.left + t.width), Math.round(a + t.top + s)),
        new u(Math.round(t.left), Math.round(a + t.top + s))
      ];
    case 3:
      return [
        new u(Math.round(t.left + n), Math.round(t.top)),
        new u(Math.round(t.left + n + i), Math.round(t.top)),
        new u(Math.round(t.left + n + i), Math.round(t.height + t.top)),
        new u(Math.round(t.left + n), Math.round(t.height + t.top))
      ];
    case 1:
      return [
        new u(Math.round(t.left + n), Math.round(t.top + s)),
        new u(Math.round(t.left + n + i), Math.round(t.top + s)),
        new u(Math.round(t.left + n + i), Math.round(t.top + s + a)),
        new u(Math.round(t.left + n), Math.round(t.top + s + a))
      ];
    default:
      return [
        new u(Math.round(B.left), Math.round(B.top)),
        new u(Math.round(B.left + B.width), Math.round(B.top)),
        new u(Math.round(B.left + B.width), Math.round(B.height + B.top)),
        new u(Math.round(B.left), Math.round(B.height + B.top))
      ];
  }
}, PQ = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", QB = "Hidden Text", XQ = (
  /** @class */
  function() {
    function e(A) {
      this._data = {}, this._document = A;
    }
    return e.prototype.parseMetrics = function(A, r) {
      var t = this._document.createElement("div"), B = this._document.createElement("img"), n = this._document.createElement("span"), s = this._document.body;
      t.style.visibility = "hidden", t.style.fontFamily = A, t.style.fontSize = r, t.style.margin = "0", t.style.padding = "0", t.style.whiteSpace = "nowrap", s.appendChild(t), B.src = PQ, B.width = 1, B.height = 1, B.style.margin = "0", B.style.padding = "0", B.style.verticalAlign = "baseline", n.style.fontFamily = A, n.style.fontSize = r, n.style.margin = "0", n.style.padding = "0", n.appendChild(this._document.createTextNode(QB)), t.appendChild(n), t.appendChild(B);
      var i = B.offsetTop - n.offsetTop + 2;
      t.removeChild(n), t.appendChild(this._document.createTextNode(QB)), t.style.lineHeight = "normal", B.style.verticalAlign = "super";
      var a = B.offsetTop - t.offsetTop + 2;
      return s.removeChild(t), { baseline: i, middle: a };
    }, e.prototype.getMetrics = function(A, r) {
      var t = A + " " + r;
      return typeof this._data[t] > "u" && (this._data[t] = this.parseMetrics(A, r)), this._data[t];
    }, e;
  }()
), Cn = (
  /** @class */
  function() {
    function e(A, r) {
      this.context = A, this.options = r;
    }
    return e;
  }()
), _Q = 1e4, JQ = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      return B._activeEffects = [], B.canvas = t.canvas ? t.canvas : document.createElement("canvas"), B.ctx = B.canvas.getContext("2d"), t.canvas || (B.canvas.width = Math.floor(t.width * t.scale), B.canvas.height = Math.floor(t.height * t.scale), B.canvas.style.width = t.width + "px", B.canvas.style.height = t.height + "px"), B.fontMetrics = new XQ(document), B.ctx.scale(B.options.scale, B.options.scale), B.ctx.translate(-t.x, -t.y), B.ctx.textBaseline = "bottom", B._activeEffects = [], B.context.logger.debug("Canvas renderer initialized (" + t.width + "x" + t.height + ") with scale " + t.scale), B;
    }
    return A.prototype.applyEffects = function(r) {
      for (var t = this; this._activeEffects.length; )
        this.popEffect();
      r.forEach(function(B) {
        return t.applyEffect(B);
      });
    }, A.prototype.applyEffect = function(r) {
      this.ctx.save(), DQ(r) && (this.ctx.globalAlpha = r.opacity), bQ(r) && (this.ctx.translate(r.offsetX, r.offsetY), this.ctx.transform(r.matrix[0], r.matrix[1], r.matrix[2], r.matrix[3], r.matrix[4], r.matrix[5]), this.ctx.translate(-r.offsetX, -r.offsetY)), cn(r) && (this.path(r.path), this.ctx.clip()), this._activeEffects.push(r);
    }, A.prototype.popEffect = function() {
      this._activeEffects.pop(), this.ctx.restore();
    }, A.prototype.renderStack = function(r) {
      return J(this, void 0, void 0, function() {
        var t;
        return X(this, function(B) {
          switch (B.label) {
            case 0:
              return t = r.element.container.styles, t.isVisible() ? [4, this.renderStackContent(r)] : [3, 2];
            case 1:
              B.sent(), B.label = 2;
            case 2:
              return [
                2
                /*return*/
              ];
          }
        });
      });
    }, A.prototype.renderNode = function(r) {
      return J(this, void 0, void 0, function() {
        return X(this, function(t) {
          switch (t.label) {
            case 0:
              if (G(
                r.container.flags,
                16
                /* DEBUG_RENDER */
              ))
                debugger;
              return r.container.styles.isVisible() ? [4, this.renderNodeBackgroundAndBorders(r)] : [3, 3];
            case 1:
              return t.sent(), [4, this.renderNodeContent(r)];
            case 2:
              t.sent(), t.label = 3;
            case 3:
              return [
                2
                /*return*/
              ];
          }
        });
      });
    }, A.prototype.renderTextWithLetterSpacing = function(r, t, B) {
      var n = this;
      if (t === 0)
        this.ctx.fillText(r.text, r.bounds.left, r.bounds.top + B);
      else {
        var s = it(r.text);
        s.reduce(function(i, a) {
          return n.ctx.fillText(a, i, r.bounds.top + B), i + n.ctx.measureText(a).width;
        }, r.bounds.left);
      }
    }, A.prototype.createFontStyle = function(r) {
      var t = r.fontVariant.filter(function(s) {
        return s === "normal" || s === "small-caps";
      }).join(""), B = qQ(r.fontFamily).join(", "), n = le(r.fontSize) ? "" + r.fontSize.number + r.fontSize.unit : r.fontSize.number + "px";
      return [
        [r.fontStyle, t, r.fontWeight, n, B].join(" "),
        B,
        n
      ];
    }, A.prototype.renderTextNode = function(r, t) {
      return J(this, void 0, void 0, function() {
        var B, n, s, i, a, o, Q, c, g = this;
        return X(this, function(f) {
          return B = this.createFontStyle(t), n = B[0], s = B[1], i = B[2], this.ctx.font = n, this.ctx.direction = t.direction === 1 ? "rtl" : "ltr", this.ctx.textAlign = "left", this.ctx.textBaseline = "alphabetic", a = this.fontMetrics.getMetrics(s, i), o = a.baseline, Q = a.middle, c = t.paintOrder, r.textBounds.forEach(function(w) {
            c.forEach(function(l) {
              switch (l) {
                case 0:
                  g.ctx.fillStyle = R(t.color), g.renderTextWithLetterSpacing(w, t.letterSpacing, o);
                  var H = t.textShadow;
                  H.length && w.text.trim().length && (H.slice(0).reverse().forEach(function(h) {
                    g.ctx.shadowColor = R(h.color), g.ctx.shadowOffsetX = h.offsetX.number * g.options.scale, g.ctx.shadowOffsetY = h.offsetY.number * g.options.scale, g.ctx.shadowBlur = h.blur.number, g.renderTextWithLetterSpacing(w, t.letterSpacing, o);
                  }), g.ctx.shadowColor = "", g.ctx.shadowOffsetX = 0, g.ctx.shadowOffsetY = 0, g.ctx.shadowBlur = 0), t.textDecorationLine.length && (g.ctx.fillStyle = R(t.textDecorationColor || t.color), t.textDecorationLine.forEach(function(h) {
                    switch (h) {
                      case 1:
                        g.ctx.fillRect(w.bounds.left, Math.round(w.bounds.top + o), w.bounds.width, 1);
                        break;
                      case 2:
                        g.ctx.fillRect(w.bounds.left, Math.round(w.bounds.top), w.bounds.width, 1);
                        break;
                      case 3:
                        g.ctx.fillRect(w.bounds.left, Math.ceil(w.bounds.top + Q), w.bounds.width, 1);
                        break;
                    }
                  }));
                  break;
                case 1:
                  t.webkitTextStrokeWidth && w.text.trim().length && (g.ctx.strokeStyle = R(t.webkitTextStrokeColor), g.ctx.lineWidth = t.webkitTextStrokeWidth, g.ctx.lineJoin = window.chrome ? "miter" : "round", g.ctx.strokeText(w.text, w.bounds.left, w.bounds.top + o)), g.ctx.strokeStyle = "", g.ctx.lineWidth = 0, g.ctx.lineJoin = "miter";
                  break;
              }
            });
          }), [
            2
            /*return*/
          ];
        });
      });
    }, A.prototype.renderReplacedElement = function(r, t, B) {
      if (B && r.intrinsicWidth > 0 && r.intrinsicHeight > 0) {
        var n = $e(r), s = je(t);
        this.path(s), this.ctx.save(), this.ctx.clip(), this.ctx.drawImage(B, 0, 0, r.intrinsicWidth, r.intrinsicHeight, n.left, n.top, n.width, n.height), this.ctx.restore();
      }
    }, A.prototype.renderNodeContent = function(r) {
      return J(this, void 0, void 0, function() {
        var t, B, n, s, i, a, F, F, o, Q, c, g, p, f, w, d, l, H, h, F, y, p, d;
        return X(this, function(C) {
          switch (C.label) {
            case 0:
              this.applyEffects(r.getEffects(
                4
                /* CONTENT */
              )), t = r.container, B = r.curves, n = t.styles, s = 0, i = t.textNodes, C.label = 1;
            case 1:
              return s < i.length ? (a = i[s], [4, this.renderTextNode(a, n)]) : [3, 4];
            case 2:
              C.sent(), C.label = 3;
            case 3:
              return s++, [3, 1];
            case 4:
              if (!(t instanceof WB))
                return [3, 8];
              C.label = 5;
            case 5:
              return C.trys.push([5, 7, , 8]), [4, this.context.cache.match(t.src)];
            case 6:
              return F = C.sent(), this.renderReplacedElement(t, B, F), [3, 8];
            case 7:
              return C.sent(), this.context.logger.error("Error loading image " + t.src), [3, 8];
            case 8:
              if (t instanceof YB && this.renderReplacedElement(t, B, t.canvas), !(t instanceof ZB))
                return [3, 12];
              C.label = 9;
            case 9:
              return C.trys.push([9, 11, , 12]), [4, this.context.cache.match(t.svg)];
            case 10:
              return F = C.sent(), this.renderReplacedElement(t, B, F), [3, 12];
            case 11:
              return C.sent(), this.context.logger.error("Error loading svg " + t.svg.substring(0, 255)), [3, 12];
            case 12:
              return t instanceof $B && t.tree ? (o = new A(this.context, {
                scale: this.options.scale,
                backgroundColor: t.backgroundColor,
                x: 0,
                y: 0,
                width: t.width,
                height: t.height
              }), [4, o.render(t.tree)]) : [3, 14];
            case 13:
              Q = C.sent(), t.width && t.height && this.ctx.drawImage(Q, 0, 0, t.width, t.height, t.bounds.left, t.bounds.top, t.bounds.width, t.bounds.height), C.label = 14;
            case 14:
              if (t instanceof ot && (c = Math.min(t.bounds.width, t.bounds.height), t.type === We ? t.checked && (this.ctx.save(), this.path([
                new u(t.bounds.left + c * 0.39363, t.bounds.top + c * 0.79),
                new u(t.bounds.left + c * 0.16, t.bounds.top + c * 0.5549),
                new u(t.bounds.left + c * 0.27347, t.bounds.top + c * 0.44071),
                new u(t.bounds.left + c * 0.39694, t.bounds.top + c * 0.5649),
                new u(t.bounds.left + c * 0.72983, t.bounds.top + c * 0.23),
                new u(t.bounds.left + c * 0.84, t.bounds.top + c * 0.34085),
                new u(t.bounds.left + c * 0.39363, t.bounds.top + c * 0.79)
              ]), this.ctx.fillStyle = R(zt), this.ctx.fill(), this.ctx.restore()) : t.type === Ye && t.checked && (this.ctx.save(), this.ctx.beginPath(), this.ctx.arc(t.bounds.left + c / 2, t.bounds.top + c / 2, c / 4, 0, Math.PI * 2, !0), this.ctx.fillStyle = R(zt), this.ctx.fill(), this.ctx.restore())), kQ(t) && t.value.length) {
                switch (g = this.createFontStyle(n), p = g[0], f = g[1], w = this.fontMetrics.getMetrics(p, f).baseline, this.ctx.font = p, this.ctx.fillStyle = R(n.color), this.ctx.textBaseline = "alphabetic", this.ctx.textAlign = YQ(t.styles.textAlign), d = $e(t), l = 0, t.styles.textAlign) {
                  case 1:
                    l += d.width / 2;
                    break;
                  case 2:
                    l += d.width;
                    break;
                }
                H = d.add(l, 0, 0, -d.height / 2 + 1), this.ctx.save(), this.path([
                  new u(d.left, d.top),
                  new u(d.left + d.width, d.top),
                  new u(d.left + d.width, d.top + d.height),
                  new u(d.left, d.top + d.height)
                ]), this.ctx.clip(), this.renderTextWithLetterSpacing(new ie(t.value, H), n.letterSpacing, w), this.ctx.restore(), this.ctx.textBaseline = "alphabetic", this.ctx.textAlign = "left";
              }
              if (!G(
                t.styles.display,
                2048
                /* LIST_ITEM */
              ))
                return [3, 20];
              if (t.styles.listStyleImage === null)
                return [3, 19];
              if (h = t.styles.listStyleImage, h.type !== 0)
                return [3, 18];
              F = void 0, y = h.url, C.label = 15;
            case 15:
              return C.trys.push([15, 17, , 18]), [4, this.context.cache.match(y)];
            case 16:
              return F = C.sent(), this.ctx.drawImage(F, t.bounds.left - (F.width + 10), t.bounds.top), [3, 18];
            case 17:
              return C.sent(), this.context.logger.error("Error loading list-style-image " + y), [3, 18];
            case 18:
              return [3, 20];
            case 19:
              r.listValue && t.styles.listStyleType !== -1 && (p = this.createFontStyle(n)[0], this.ctx.font = p, this.ctx.fillStyle = R(n.color), this.ctx.textBaseline = "middle", this.ctx.textAlign = "right", d = new wA(t.bounds.left, t.bounds.top + D(t.styles.paddingTop, t.bounds.width), t.bounds.width, Tt(n.lineHeight, n.fontSize.number) / 2 + 1), this.renderTextWithLetterSpacing(new ie(r.listValue, d), n.letterSpacing, Tt(n.lineHeight, n.fontSize.number) / 2 + 2), this.ctx.textBaseline = "bottom", this.ctx.textAlign = "left"), C.label = 20;
            case 20:
              return [
                2
                /*return*/
              ];
          }
        });
      });
    }, A.prototype.renderStackContent = function(r) {
      return J(this, void 0, void 0, function() {
        var t, B, h, n, s, h, i, a, h, o, Q, h, c, g, h, f, w, h, l, H, h;
        return X(this, function(F) {
          switch (F.label) {
            case 0:
              if (G(
                r.element.container.flags,
                16
                /* DEBUG_RENDER */
              ))
                debugger;
              return [4, this.renderNodeBackgroundAndBorders(r.element)];
            case 1:
              F.sent(), t = 0, B = r.negativeZIndex, F.label = 2;
            case 2:
              return t < B.length ? (h = B[t], [4, this.renderStack(h)]) : [3, 5];
            case 3:
              F.sent(), F.label = 4;
            case 4:
              return t++, [3, 2];
            case 5:
              return [4, this.renderNodeContent(r.element)];
            case 6:
              F.sent(), n = 0, s = r.nonInlineLevel, F.label = 7;
            case 7:
              return n < s.length ? (h = s[n], [4, this.renderNode(h)]) : [3, 10];
            case 8:
              F.sent(), F.label = 9;
            case 9:
              return n++, [3, 7];
            case 10:
              i = 0, a = r.nonPositionedFloats, F.label = 11;
            case 11:
              return i < a.length ? (h = a[i], [4, this.renderStack(h)]) : [3, 14];
            case 12:
              F.sent(), F.label = 13;
            case 13:
              return i++, [3, 11];
            case 14:
              o = 0, Q = r.nonPositionedInlineLevel, F.label = 15;
            case 15:
              return o < Q.length ? (h = Q[o], [4, this.renderStack(h)]) : [3, 18];
            case 16:
              F.sent(), F.label = 17;
            case 17:
              return o++, [3, 15];
            case 18:
              c = 0, g = r.inlineLevel, F.label = 19;
            case 19:
              return c < g.length ? (h = g[c], [4, this.renderNode(h)]) : [3, 22];
            case 20:
              F.sent(), F.label = 21;
            case 21:
              return c++, [3, 19];
            case 22:
              f = 0, w = r.zeroOrAutoZIndexOrTransformedOrOpacity, F.label = 23;
            case 23:
              return f < w.length ? (h = w[f], [4, this.renderStack(h)]) : [3, 26];
            case 24:
              F.sent(), F.label = 25;
            case 25:
              return f++, [3, 23];
            case 26:
              l = 0, H = r.positiveZIndex, F.label = 27;
            case 27:
              return l < H.length ? (h = H[l], [4, this.renderStack(h)]) : [3, 30];
            case 28:
              F.sent(), F.label = 29;
            case 29:
              return l++, [3, 27];
            case 30:
              return [
                2
                /*return*/
              ];
          }
        });
      });
    }, A.prototype.mask = function(r) {
      this.ctx.beginPath(), this.ctx.moveTo(0, 0), this.ctx.lineTo(this.canvas.width, 0), this.ctx.lineTo(this.canvas.width, this.canvas.height), this.ctx.lineTo(0, this.canvas.height), this.ctx.lineTo(0, 0), this.formatPath(r.slice(0).reverse()), this.ctx.closePath();
    }, A.prototype.path = function(r) {
      this.ctx.beginPath(), this.formatPath(r), this.ctx.closePath();
    }, A.prototype.formatPath = function(r) {
      var t = this;
      r.forEach(function(B, n) {
        var s = $(B) ? B.start : B;
        n === 0 ? t.ctx.moveTo(s.x, s.y) : t.ctx.lineTo(s.x, s.y), $(B) && t.ctx.bezierCurveTo(B.startControl.x, B.startControl.y, B.endControl.x, B.endControl.y, B.end.x, B.end.y);
      });
    }, A.prototype.renderRepeat = function(r, t, B, n) {
      this.path(r), this.ctx.fillStyle = t, this.ctx.translate(B, n), this.ctx.fill(), this.ctx.translate(-B, -n);
    }, A.prototype.resizeImage = function(r, t, B) {
      var n;
      if (r.width === t && r.height === B)
        return r;
      var s = (n = this.canvas.ownerDocument) !== null && n !== void 0 ? n : document, i = s.createElement("canvas");
      i.width = Math.max(1, t), i.height = Math.max(1, B);
      var a = i.getContext("2d");
      return a.drawImage(r, 0, 0, r.width, r.height, 0, 0, t, B), i;
    }, A.prototype.renderBackgroundImage = function(r) {
      return J(this, void 0, void 0, function() {
        var t, B, n, s, i, a;
        return X(this, function(o) {
          switch (o.label) {
            case 0:
              t = r.styles.backgroundImage.length - 1, B = function(Q) {
                var c, g, f, O, W, Y, L, V, m, w, O, W, Y, L, V, l, H, h, F, y, p, d, C, v, m, E, O, k, q, L, V, lA, W, Y, IA, BA, uA, vA, mA, iA, yA, oA;
                return X(this, function(TA) {
                  switch (TA.label) {
                    case 0:
                      if (Q.type !== 0)
                        return [3, 5];
                      c = void 0, g = Q.url, TA.label = 1;
                    case 1:
                      return TA.trys.push([1, 3, , 4]), [4, n.context.cache.match(g)];
                    case 2:
                      return c = TA.sent(), [3, 4];
                    case 3:
                      return TA.sent(), n.context.logger.error("Error loading background-image " + g), [3, 4];
                    case 4:
                      return c && (f = br(r, t, [
                        c.width,
                        c.height,
                        c.width / c.height
                      ]), O = f[0], W = f[1], Y = f[2], L = f[3], V = f[4], m = n.ctx.createPattern(n.resizeImage(c, L, V), "repeat"), n.renderRepeat(O, m, W, Y)), [3, 6];
                    case 5:
                      La(Q) ? (w = br(r, t, [null, null, null]), O = w[0], W = w[1], Y = w[2], L = w[3], V = w[4], l = Ia(Q.angle, L, V), H = l[0], h = l[1], F = l[2], y = l[3], p = l[4], d = document.createElement("canvas"), d.width = L, d.height = V, C = d.getContext("2d"), v = C.createLinearGradient(h, y, F, p), Dt(Q.stops, H).forEach(function(WA) {
                        return v.addColorStop(WA.stop, R(WA.color));
                      }), C.fillStyle = v, C.fillRect(0, 0, L, V), L > 0 && V > 0 && (m = n.ctx.createPattern(d, "repeat"), n.renderRepeat(O, m, W, Y))) : ba(Q) && (E = br(r, t, [
                        null,
                        null,
                        null
                      ]), O = E[0], k = E[1], q = E[2], L = E[3], V = E[4], lA = Q.position.length === 0 ? [nt] : Q.position, W = D(lA[0], L), Y = D(lA[lA.length - 1], V), IA = va(Q, W, Y, L, V), BA = IA[0], uA = IA[1], BA > 0 && uA > 0 && (vA = n.ctx.createRadialGradient(k + W, q + Y, 0, k + W, q + Y, BA), Dt(Q.stops, BA * 2).forEach(function(WA) {
                        return vA.addColorStop(WA.stop, R(WA.color));
                      }), n.path(O), n.ctx.fillStyle = vA, BA !== uA ? (mA = r.bounds.left + 0.5 * r.bounds.width, iA = r.bounds.top + 0.5 * r.bounds.height, yA = uA / BA, oA = 1 / yA, n.ctx.save(), n.ctx.translate(mA, iA), n.ctx.transform(1, 0, 0, yA, 0, 0), n.ctx.translate(-mA, -iA), n.ctx.fillRect(k, oA * (q - iA) + iA, L, V * oA), n.ctx.restore()) : n.ctx.fill())), TA.label = 6;
                    case 6:
                      return t--, [
                        2
                        /*return*/
                      ];
                  }
                });
              }, n = this, s = 0, i = r.styles.backgroundImage.slice(0).reverse(), o.label = 1;
            case 1:
              return s < i.length ? (a = i[s], [5, B(a)]) : [3, 4];
            case 2:
              o.sent(), o.label = 3;
            case 3:
              return s++, [3, 1];
            case 4:
              return [
                2
                /*return*/
              ];
          }
        });
      });
    }, A.prototype.renderSolidBorder = function(r, t, B) {
      return J(this, void 0, void 0, function() {
        return X(this, function(n) {
          return this.path(oB(B, t)), this.ctx.fillStyle = R(r), this.ctx.fill(), [
            2
            /*return*/
          ];
        });
      });
    }, A.prototype.renderDoubleBorder = function(r, t, B, n) {
      return J(this, void 0, void 0, function() {
        var s, i;
        return X(this, function(a) {
          switch (a.label) {
            case 0:
              return t < 3 ? [4, this.renderSolidBorder(r, B, n)] : [3, 2];
            case 1:
              return a.sent(), [
                2
                /*return*/
              ];
            case 2:
              return s = SQ(n, B), this.path(s), this.ctx.fillStyle = R(r), this.ctx.fill(), i = OQ(n, B), this.path(i), this.ctx.fill(), [
                2
                /*return*/
              ];
          }
        });
      });
    }, A.prototype.renderNodeBackgroundAndBorders = function(r) {
      return J(this, void 0, void 0, function() {
        var t, B, n, s, i, a, o, Q, c = this;
        return X(this, function(g) {
          switch (g.label) {
            case 0:
              return this.applyEffects(r.getEffects(
                2
                /* BACKGROUND_BORDERS */
              )), t = r.container.styles, B = !HA(t.backgroundColor) || t.backgroundImage.length, n = [
                { style: t.borderTopStyle, color: t.borderTopColor, width: t.borderTopWidth },
                { style: t.borderRightStyle, color: t.borderRightColor, width: t.borderRightWidth },
                { style: t.borderBottomStyle, color: t.borderBottomColor, width: t.borderBottomWidth },
                { style: t.borderLeftStyle, color: t.borderLeftColor, width: t.borderLeftWidth }
              ], s = WQ(PA(t.backgroundClip, 0), r.curves), B || t.boxShadow.length ? (this.ctx.save(), this.path(s), this.ctx.clip(), HA(t.backgroundColor) || (this.ctx.fillStyle = R(t.backgroundColor), this.ctx.fill()), [4, this.renderBackgroundImage(r.container)]) : [3, 2];
            case 1:
              g.sent(), this.ctx.restore(), t.boxShadow.slice(0).reverse().forEach(function(f) {
                c.ctx.save();
                var w = ze(r.curves), l = f.inset ? 0 : _Q, H = xQ(w, -l + (f.inset ? 1 : -1) * f.spread.number, (f.inset ? 1 : -1) * f.spread.number, f.spread.number * (f.inset ? -2 : 2), f.spread.number * (f.inset ? -2 : 2));
                f.inset ? (c.path(w), c.ctx.clip(), c.mask(H)) : (c.mask(w), c.ctx.clip(), c.path(H)), c.ctx.shadowOffsetX = f.offsetX.number + l, c.ctx.shadowOffsetY = f.offsetY.number, c.ctx.shadowColor = R(f.color), c.ctx.shadowBlur = f.blur.number, c.ctx.fillStyle = f.inset ? R(f.color) : "rgba(0,0,0,1)", c.ctx.fill(), c.ctx.restore();
              }), g.label = 2;
            case 2:
              i = 0, a = 0, o = n, g.label = 3;
            case 3:
              return a < o.length ? (Q = o[a], Q.style !== 0 && !HA(Q.color) && Q.width > 0 ? Q.style !== 2 ? [3, 5] : [4, this.renderDashedDottedBorder(
                Q.color,
                Q.width,
                i,
                r.curves,
                2
                /* DASHED */
              )] : [3, 11]) : [3, 13];
            case 4:
              return g.sent(), [3, 11];
            case 5:
              return Q.style !== 3 ? [3, 7] : [4, this.renderDashedDottedBorder(
                Q.color,
                Q.width,
                i,
                r.curves,
                3
                /* DOTTED */
              )];
            case 6:
              return g.sent(), [3, 11];
            case 7:
              return Q.style !== 4 ? [3, 9] : [4, this.renderDoubleBorder(Q.color, Q.width, i, r.curves)];
            case 8:
              return g.sent(), [3, 11];
            case 9:
              return [4, this.renderSolidBorder(Q.color, i, r.curves)];
            case 10:
              g.sent(), g.label = 11;
            case 11:
              i++, g.label = 12;
            case 12:
              return a++, [3, 3];
            case 13:
              return [
                2
                /*return*/
              ];
          }
        });
      });
    }, A.prototype.renderDashedDottedBorder = function(r, t, B, n, s) {
      return J(this, void 0, void 0, function() {
        var i, a, o, Q, c, g, f, w, l, H, h, F, y, p, d, C, d, C;
        return X(this, function(v) {
          return this.ctx.save(), i = MQ(n, B), a = oB(n, B), s === 2 && (this.path(a), this.ctx.clip()), $(a[0]) ? (o = a[0].start.x, Q = a[0].start.y) : (o = a[0].x, Q = a[0].y), $(a[1]) ? (c = a[1].end.x, g = a[1].end.y) : (c = a[1].x, g = a[1].y), B === 0 || B === 2 ? f = Math.abs(o - c) : f = Math.abs(Q - g), this.ctx.beginPath(), s === 3 ? this.formatPath(i) : this.formatPath(a.slice(0, 2)), w = t < 3 ? t * 3 : t * 2, l = t < 3 ? t * 2 : t, s === 3 && (w = t, l = t), H = !0, f <= w * 2 ? H = !1 : f <= w * 2 + l ? (h = f / (2 * w + l), w *= h, l *= h) : (F = Math.floor((f + l) / (w + l)), y = (f - F * w) / (F - 1), p = (f - (F + 1) * w) / F, l = p <= 0 || Math.abs(l - y) < Math.abs(l - p) ? y : p), H && (s === 3 ? this.ctx.setLineDash([0, w + l]) : this.ctx.setLineDash([w, l])), s === 3 ? (this.ctx.lineCap = "round", this.ctx.lineWidth = t) : this.ctx.lineWidth = t * 2 + 1.1, this.ctx.strokeStyle = R(r), this.ctx.stroke(), this.ctx.setLineDash([]), s === 2 && ($(a[0]) && (d = a[3], C = a[0], this.ctx.beginPath(), this.formatPath([new u(d.end.x, d.end.y), new u(C.start.x, C.start.y)]), this.ctx.stroke()), $(a[1]) && (d = a[1], C = a[2], this.ctx.beginPath(), this.formatPath([new u(d.end.x, d.end.y), new u(C.start.x, C.start.y)]), this.ctx.stroke())), this.ctx.restore(), [
            2
            /*return*/
          ];
        });
      });
    }, A.prototype.render = function(r) {
      return J(this, void 0, void 0, function() {
        var t;
        return X(this, function(B) {
          switch (B.label) {
            case 0:
              return this.options.backgroundColor && (this.ctx.fillStyle = R(this.options.backgroundColor), this.ctx.fillRect(this.options.x, this.options.y, this.options.width, this.options.height)), t = TQ(r), [4, this.renderStack(t)];
            case 1:
              return B.sent(), this.applyEffects([]), [2, this.canvas];
          }
        });
      });
    }, A;
  }(Cn)
), kQ = function(e) {
  return e instanceof jB || e instanceof zB ? !0 : e instanceof ot && e.type !== Ye && e.type !== We;
}, WQ = function(e, A) {
  switch (e) {
    case 0:
      return ze(A);
    case 2:
      return yQ(A);
    case 1:
    default:
      return je(A);
  }
}, YQ = function(e) {
  switch (e) {
    case 1:
      return "center";
    case 2:
      return "right";
    case 0:
    default:
      return "left";
  }
}, ZQ = ["-apple-system", "system-ui"], qQ = function(e) {
  return /iPhone OS 15_(0|1)/.test(window.navigator.userAgent) ? e.filter(function(A) {
    return ZQ.indexOf(A) === -1;
  }) : e;
}, zQ = (
  /** @class */
  function(e) {
    tA(A, e);
    function A(r, t) {
      var B = e.call(this, r, t) || this;
      return B.canvas = t.canvas ? t.canvas : document.createElement("canvas"), B.ctx = B.canvas.getContext("2d"), B.options = t, B.canvas.width = Math.floor(t.width * t.scale), B.canvas.height = Math.floor(t.height * t.scale), B.canvas.style.width = t.width + "px", B.canvas.style.height = t.height + "px", B.ctx.scale(B.options.scale, B.options.scale), B.ctx.translate(-t.x, -t.y), B.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized (" + t.width + "x" + t.height + " at " + t.x + "," + t.y + ") with scale " + t.scale), B;
    }
    return A.prototype.render = function(r) {
      return J(this, void 0, void 0, function() {
        var t, B;
        return X(this, function(n) {
          switch (n.label) {
            case 0:
              return t = Yr(this.options.width * this.options.scale, this.options.height * this.options.scale, this.options.scale, this.options.scale, r), [4, jQ(t)];
            case 1:
              return B = n.sent(), this.options.backgroundColor && (this.ctx.fillStyle = R(this.options.backgroundColor), this.ctx.fillRect(0, 0, this.options.width * this.options.scale, this.options.height * this.options.scale)), this.ctx.drawImage(B, -this.options.x * this.options.scale, -this.options.y * this.options.scale), [2, this.canvas];
          }
        });
      });
    }, A;
  }(Cn)
), jQ = function(e) {
  return new Promise(function(A, r) {
    var t = new Image();
    t.onload = function() {
      A(t);
    }, t.onerror = r, t.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(e));
  });
}, $Q = (
  /** @class */
  function() {
    function e(A) {
      var r = A.id, t = A.enabled;
      this.id = r, this.enabled = t, this.start = Date.now();
    }
    return e.prototype.debug = function() {
      for (var A = [], r = 0; r < arguments.length; r++)
        A[r] = arguments[r];
      this.enabled && (typeof window < "u" && window.console && typeof console.debug == "function" ? console.debug.apply(console, Ce([this.id, this.getTime() + "ms"], A)) : this.info.apply(this, A));
    }, e.prototype.getTime = function() {
      return Date.now() - this.start;
    }, e.prototype.info = function() {
      for (var A = [], r = 0; r < arguments.length; r++)
        A[r] = arguments[r];
      this.enabled && typeof window < "u" && window.console && typeof console.info == "function" && console.info.apply(console, Ce([this.id, this.getTime() + "ms"], A));
    }, e.prototype.warn = function() {
      for (var A = [], r = 0; r < arguments.length; r++)
        A[r] = arguments[r];
      this.enabled && (typeof window < "u" && window.console && typeof console.warn == "function" ? console.warn.apply(console, Ce([this.id, this.getTime() + "ms"], A)) : this.info.apply(this, A));
    }, e.prototype.error = function() {
      for (var A = [], r = 0; r < arguments.length; r++)
        A[r] = arguments[r];
      this.enabled && (typeof window < "u" && window.console && typeof console.error == "function" ? console.error.apply(console, Ce([this.id, this.getTime() + "ms"], A)) : this.info.apply(this, A));
    }, e.instances = {}, e;
  }()
), Ac = (
  /** @class */
  function() {
    function e(A, r) {
      var t;
      this.windowBounds = r, this.instanceName = "#" + e.instanceCount++, this.logger = new $Q({ id: this.instanceName, enabled: A.logging }), this.cache = (t = A.cache) !== null && t !== void 0 ? t : new hQ(this, A);
    }
    return e.instanceCount = 1, e;
  }()
), ec = function(e, A) {
  return A === void 0 && (A = {}), rc(e, A);
};
typeof window < "u" && Qn.setContext(window);
var rc = function(e, A) {
  return J(void 0, void 0, void 0, function() {
    var r, t, B, n, s, i, a, o, Q, c, g, f, w, l, H, h, F, y, p, d, v, C, v, m, E, O, k, q, L, V, lA, W, Y, IA, BA, uA, vA, mA, iA, yA;
    return X(this, function(oA) {
      switch (oA.label) {
        case 0:
          if (!e || typeof e != "object")
            return [2, Promise.reject("Invalid element provided as first argument")];
          if (r = e.ownerDocument, !r)
            throw new Error("Element is not attached to a Document");
          if (t = r.defaultView, !t)
            throw new Error("Document is not attached to a Window");
          return B = {
            allowTaint: (m = A.allowTaint) !== null && m !== void 0 ? m : !1,
            imageTimeout: (E = A.imageTimeout) !== null && E !== void 0 ? E : 15e3,
            proxy: A.proxy,
            useCORS: (O = A.useCORS) !== null && O !== void 0 ? O : !1
          }, n = xr({ logging: (k = A.logging) !== null && k !== void 0 ? k : !0, cache: A.cache }, B), s = {
            windowWidth: (q = A.windowWidth) !== null && q !== void 0 ? q : t.innerWidth,
            windowHeight: (L = A.windowHeight) !== null && L !== void 0 ? L : t.innerHeight,
            scrollX: (V = A.scrollX) !== null && V !== void 0 ? V : t.pageXOffset,
            scrollY: (lA = A.scrollY) !== null && lA !== void 0 ? lA : t.pageYOffset
          }, i = new wA(s.scrollX, s.scrollY, s.windowWidth, s.windowHeight), a = new Ac(n, i), o = (W = A.foreignObjectRendering) !== null && W !== void 0 ? W : !1, Q = {
            allowTaint: (Y = A.allowTaint) !== null && Y !== void 0 ? Y : !1,
            onclone: A.onclone,
            ignoreElements: A.ignoreElements,
            inlineImages: o,
            copyStyles: o
          }, a.logger.debug("Starting document clone with size " + i.width + "x" + i.height + " scrolled to " + -i.left + "," + -i.top), c = new sB(a, e, Q), g = c.clonedReferenceElement, g ? [4, c.toIFrame(r, i)] : [2, Promise.reject("Unable to find element in cloned iframe")];
        case 1:
          return f = oA.sent(), w = Qt(g) || tQ(g) ? Dn(g.ownerDocument) : Ar(a, g), l = w.width, H = w.height, h = w.left, F = w.top, y = tc(a, g, A.backgroundColor), p = {
            canvas: A.canvas,
            backgroundColor: y,
            scale: (BA = (IA = A.scale) !== null && IA !== void 0 ? IA : t.devicePixelRatio) !== null && BA !== void 0 ? BA : 1,
            x: ((uA = A.x) !== null && uA !== void 0 ? uA : 0) + h,
            y: ((vA = A.y) !== null && vA !== void 0 ? vA : 0) + F,
            width: (mA = A.width) !== null && mA !== void 0 ? mA : Math.ceil(l),
            height: (iA = A.height) !== null && iA !== void 0 ? iA : Math.ceil(H)
          }, o ? (a.logger.debug("Document cloned, using foreign object rendering"), v = new zQ(a, p), [4, v.render(g)]) : [3, 3];
        case 2:
          return d = oA.sent(), [3, 5];
        case 3:
          return a.logger.debug("Document cloned, element located at " + h + "," + F + " with size " + l + "x" + H + " using computed rendering"), a.logger.debug("Starting DOM parsing"), C = en(a, g), y === C.styles.backgroundColor && (C.styles.backgroundColor = gA.TRANSPARENT), a.logger.debug("Starting renderer for element at " + p.x + "," + p.y + " with size " + p.width + "x" + p.height), v = new JQ(a, p), [4, v.render(C)];
        case 4:
          d = oA.sent(), oA.label = 5;
        case 5:
          return (!((yA = A.removeContainer) !== null && yA !== void 0) || yA) && (sB.destroy(f) || a.logger.error("Cannot detach cloned iframe as it is not in the DOM anymore")), a.logger.debug("Finished rendering"), [2, d];
      }
    });
  });
}, tc = function(e, A, r) {
  var t = A.ownerDocument, B = t.documentElement ? se(e, getComputedStyle(t.documentElement).backgroundColor) : gA.TRANSPARENT, n = t.body ? se(e, getComputedStyle(t.body).backgroundColor) : gA.TRANSPARENT, s = typeof r == "string" ? se(e, r) : r === null ? gA.TRANSPARENT : 4294967295;
  return A === t.documentElement ? HA(B) ? HA(n) ? s : n : B : s;
};
class Bc extends Fn {
  async execAction(A, r, t, B, n) {
    try {
      this.exportImg(t);
    } catch (s) {
      ibiz.log.error(s);
    }
    return {
      refresh: !1,
      closeView: !1
    };
  }
  exportImg(A) {
    const r = document.querySelector(
      ".ibiz-view.ibiz-view-deeditview3"
    ), t = document.querySelector(".ivu-tabs-tabpane");
    if (r && t) {
      const B = r.scrollHeight + t.scrollHeight - t.offsetHeight;
      ec(r, {
        useCORS: !0,
        allowTaint: !0,
        // 这两个属性都是图片跨域相关属性
        height: B,
        windowHeight: B * 2,
        scale: window.devicePixelRatio
      }).then(function(n) {
        const s = n.toDataURL("image/png").replace("image/png", "image/octet-stream"), i = document.createElement("a");
        i.href = s;
        let a = "downLoad.png";
        A && A[0] && (a = `${A[0].srfmajortext}.png`), i.download = a, i.click();
      });
    }
  }
}
class nc {
  constructor() {
    ue(this, "handler");
  }
  async getHandler() {
    return this.handler || (this.handler = new Bc()), this.handler;
  }
}
const sc = new hn(import.meta.url), lc = {
  mateUrl: import.meta.url,
  // eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
  install(e) {
    sc.loadStyle(["/style.css"]), ibiz.register.view.register(
      "VIEW_CUSTOM_SyWfDynaEditView3",
      new Kn()
    ), ibiz.register.view.register(
      "VIEW_CUSTOM_SyEditView3",
      new bn()
    ), ibiz.register.uiAction.register(
      "DEUIACTION_ExportAsImagePlugin",
      new nc()
    );
  }
};
export {
  lc as default
};
