UNPKG

our-medical

Version:

medical image vue component

9,143 lines 394 kB
var Ao = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports);
var Ph = Ao((xh, ze) => {
  var Kn;
  (function(e) {
    e.STACK = "stack", e.ORTHOGRAPHIC = "orthographic", e.PERSPECTIVE = "perspective", e.VOLUME_3D = "volume3d", e.VIDEO = "video", e.WholeSlide = "wholeSlide";
  })(Kn || (Kn = {}));
  var en;
  (function(e) {
    e.AXIAL = "axial", e.CORONAL = "coronal", e.SAGITTAL = "sagittal", e.ACQUISITION = "acquisition";
  })(en || (en = {}));
  var Yt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
  function Pr(e) {
    return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
  }
  function Xo(e) {
    if (e.__esModule) return e;
    var t = e.default;
    if (typeof t == "function") {
      var r = function i() {
        return this instanceof i ? Reflect.construct(t, arguments, this.constructor) : t.apply(this, arguments);
      };
      r.prototype = t.prototype;
    } else r = {};
    return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(e).forEach(function(i) {
      var a = Object.getOwnPropertyDescriptor(e, i);
      Object.defineProperty(r, i, a.get ? a : {
        enumerable: !0,
        get: function() {
          return e[i];
        }
      });
    }), r;
  }
  var _o = function e(t, r) {
    if (t === r) return !0;
    if (t && r && typeof t == "object" && typeof r == "object") {
      if (t.constructor !== r.constructor) return !1;
      var i, a, l;
      if (Array.isArray(t)) {
        if (i = t.length, i != r.length) return !1;
        for (a = i; a-- !== 0; )
          if (!e(t[a], r[a])) return !1;
        return !0;
      }
      if (t.constructor === RegExp) return t.source === r.source && t.flags === r.flags;
      if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === r.valueOf();
      if (t.toString !== Object.prototype.toString) return t.toString() === r.toString();
      if (l = Object.keys(t), i = l.length, i !== Object.keys(r).length) return !1;
      for (a = i; a-- !== 0; )
        if (!Object.prototype.hasOwnProperty.call(r, l[a])) return !1;
      for (a = i; a-- !== 0; ) {
        var u = l[a];
        if (!e(t[u], r[u])) return !1;
      }
      return !0;
    }
    return t !== t && r !== r;
  }, Yo = /* @__PURE__ */ Pr(_o), ei = Object.prototype.toString, Mi = function(t) {
    var r = ei.call(t), i = r === "[object Arguments]";
    return i || (i = r !== "[object Array]" && t !== null && typeof t == "object" && typeof t.length == "number" && t.length >= 0 && ei.call(t.callee) === "[object Function]"), i;
  }, zn, ni;
  function Bo() {
    if (ni) return zn;
    ni = 1;
    var e;
    if (!Object.keys) {
      var t = Object.prototype.hasOwnProperty, r = Object.prototype.toString, i = Mi, a = Object.prototype.propertyIsEnumerable, l = !a.call({ toString: null }, "toString"), u = a.call(function() {
      }, "prototype"), c = [
        "toString",
        "toLocaleString",
        "valueOf",
        "hasOwnProperty",
        "isPrototypeOf",
        "propertyIsEnumerable",
        "constructor"
      ], h = function(g) {
        var m = g.constructor;
        return m && m.prototype === g;
      }, y = {
        $applicationCache: !0,
        $console: !0,
        $external: !0,
        $frame: !0,
        $frameElement: !0,
        $frames: !0,
        $innerHeight: !0,
        $innerWidth: !0,
        $onmozfullscreenchange: !0,
        $onmozfullscreenerror: !0,
        $outerHeight: !0,
        $outerWidth: !0,
        $pageXOffset: !0,
        $pageYOffset: !0,
        $parent: !0,
        $scrollLeft: !0,
        $scrollTop: !0,
        $scrollX: !0,
        $scrollY: !0,
        $self: !0,
        $webkitIndexedDB: !0,
        $webkitStorageInfo: !0,
        $window: !0
      }, v = function() {
        if (typeof window > "u")
          return !1;
        for (var g in window)
          try {
            if (!y["$" + g] && t.call(window, g) && window[g] !== null && typeof window[g] == "object")
              try {
                h(window[g]);
              } catch {
                return !0;
              }
          } catch {
            return !0;
          }
        return !1;
      }(), d = function(g) {
        if (typeof window > "u" || !v)
          return h(g);
        try {
          return h(g);
        } catch {
          return !1;
        }
      };
      e = function(m) {
        var P = m !== null && typeof m == "object", x = r.call(m) === "[object Function]", S = i(m), L = P && r.call(m) === "[object String]", N = [];
        if (!P && !x && !S)
          throw new TypeError("Object.keys called on a non-object");
        var M = u && x;
        if (L && m.length > 0 && !t.call(m, 0))
          for (var E = 0; E < m.length; ++E)
            N.push(String(E));
        if (S && m.length > 0)
          for (var w = 0; w < m.length; ++w)
            N.push(String(w));
        else
          for (var A in m)
            !(M && A === "prototype") && t.call(m, A) && N.push(String(A));
        if (l)
          for (var X = d(m), _ = 0; _ < c.length; ++_)
            !(X && c[_] === "constructor") && t.call(m, c[_]) && N.push(c[_]);
        return N;
      };
    }
    return zn = e, zn;
  }
  var bo = Array.prototype.slice, ko = Mi, ri = Object.keys, vn = ri ? function(t) {
    return ri(t);
  } : Bo(), ii = Object.keys;
  vn.shim = function() {
    if (Object.keys) {
      var t = function() {
        var r = Object.keys(arguments);
        return r && r.length === arguments.length;
      }(1, 2);
      t || (Object.keys = function(i) {
        return ko(i) ? ii(bo.call(i)) : ii(i);
      });
    } else
      Object.keys = vn;
    return Object.keys || vn;
  };
  var Fo = vn, Ro = function() {
    if (typeof Symbol != "function" || typeof Object.getOwnPropertySymbols != "function")
      return !1;
    if (typeof Symbol.iterator == "symbol")
      return !0;
    var t = {}, r = Symbol("test"), i = Object(r);
    if (typeof r == "string" || Object.prototype.toString.call(r) !== "[object Symbol]" || Object.prototype.toString.call(i) !== "[object Symbol]")
      return !1;
    var a = 42;
    t[r] = a;
    for (r in t)
      return !1;
    if (typeof Object.keys == "function" && Object.keys(t).length !== 0 || typeof Object.getOwnPropertyNames == "function" && Object.getOwnPropertyNames(t).length !== 0)
      return !1;
    var l = Object.getOwnPropertySymbols(t);
    if (l.length !== 1 || l[0] !== r || !Object.prototype.propertyIsEnumerable.call(t, r))
      return !1;
    if (typeof Object.getOwnPropertyDescriptor == "function") {
      var u = Object.getOwnPropertyDescriptor(t, r);
      if (u.value !== a || u.enumerable !== !0)
        return !1;
    }
    return !0;
  }, si = typeof Symbol < "u" && Symbol, Uo = Ro, $o = function() {
    return typeof si != "function" || typeof Symbol != "function" || typeof si("foo") != "symbol" || typeof Symbol("bar") != "symbol" ? !1 : Uo();
  }, ai = {
    foo: {}
  }, Vo = Object, Wo = function() {
    return { __proto__: ai }.foo === ai.foo && !({ __proto__: null } instanceof Vo);
  }, zo = "Function.prototype.bind called on incompatible ", jn = Array.prototype.slice, jo = Object.prototype.toString, Go = "[object Function]", Zo = function(t) {
    var r = this;
    if (typeof r != "function" || jo.call(r) !== Go)
      throw new TypeError(zo + r);
    for (var i = jn.call(arguments, 1), a, l = function() {
      if (this instanceof a) {
        var v = r.apply(
          this,
          i.concat(jn.call(arguments))
        );
        return Object(v) === v ? v : this;
      } else
        return r.apply(
          t,
          i.concat(jn.call(arguments))
        );
    }, u = Math.max(0, r.length - i.length), c = [], h = 0; h < u; h++)
      c.push("$" + h);
    if (a = Function("binder", "return function (" + c.join(",") + "){ return binder.apply(this,arguments); }")(l), r.prototype) {
      var y = function() {
      };
      y.prototype = r.prototype, a.prototype = new y(), y.prototype = null;
    }
    return a;
  }, Ho = Zo, Di = Function.prototype.bind || Ho, qo = Di, Jo = qo.call(Function.call, Object.prototype.hasOwnProperty), et, Ve = SyntaxError, Ai = Function, Fe = TypeError, Gn = function(e) {
    try {
      return Ai('"use strict"; return (' + e + ").constructor;")();
    } catch {
    }
  }, Ie = Object.getOwnPropertyDescriptor;
  if (Ie)
    try {
      Ie({}, "");
    } catch {
      Ie = null;
    }
  var Zn = function() {
    throw new Fe();
  }, Ko = Ie ? function() {
    try {
      return arguments.callee, Zn;
    } catch {
      try {
        return Ie(arguments, "callee").get;
      } catch {
        return Zn;
      }
    }
  }() : Zn, Xe = $o(), Qo = Wo(), dt = Object.getPrototypeOf || (Qo ? function(e) {
    return e.__proto__;
  } : null), Ye = {}, tl = typeof Uint8Array > "u" || !dt ? et : dt(Uint8Array), Ee = {
    "%AggregateError%": typeof AggregateError > "u" ? et : AggregateError,
    "%Array%": Array,
    "%ArrayBuffer%": typeof ArrayBuffer > "u" ? et : ArrayBuffer,
    "%ArrayIteratorPrototype%": Xe && dt ? dt([][Symbol.iterator]()) : et,
    "%AsyncFromSyncIteratorPrototype%": et,
    "%AsyncFunction%": Ye,
    "%AsyncGenerator%": Ye,
    "%AsyncGeneratorFunction%": Ye,
    "%AsyncIteratorPrototype%": Ye,
    "%Atomics%": typeof Atomics > "u" ? et : Atomics,
    "%BigInt%": typeof BigInt > "u" ? et : BigInt,
    "%BigInt64Array%": typeof BigInt64Array > "u" ? et : BigInt64Array,
    "%BigUint64Array%": typeof BigUint64Array > "u" ? et : BigUint64Array,
    "%Boolean%": Boolean,
    "%DataView%": typeof DataView > "u" ? et : DataView,
    "%Date%": Date,
    "%decodeURI%": decodeURI,
    "%decodeURIComponent%": decodeURIComponent,
    "%encodeURI%": encodeURI,
    "%encodeURIComponent%": encodeURIComponent,
    "%Error%": Error,
    "%eval%": eval,
    // eslint-disable-line no-eval
    "%EvalError%": EvalError,
    "%Float32Array%": typeof Float32Array > "u" ? et : Float32Array,
    "%Float64Array%": typeof Float64Array > "u" ? et : Float64Array,
    "%FinalizationRegistry%": typeof FinalizationRegistry > "u" ? et : FinalizationRegistry,
    "%Function%": Ai,
    "%GeneratorFunction%": Ye,
    "%Int8Array%": typeof Int8Array > "u" ? et : Int8Array,
    "%Int16Array%": typeof Int16Array > "u" ? et : Int16Array,
    "%Int32Array%": typeof Int32Array > "u" ? et : Int32Array,
    "%isFinite%": isFinite,
    "%isNaN%": isNaN,
    "%IteratorPrototype%": Xe && dt ? dt(dt([][Symbol.iterator]())) : et,
    "%JSON%": typeof JSON == "object" ? JSON : et,
    "%Map%": typeof Map > "u" ? et : Map,
    "%MapIteratorPrototype%": typeof Map > "u" || !Xe || !dt ? et : dt((/* @__PURE__ */ new Map())[Symbol.iterator]()),
    "%Math%": Math,
    "%Number%": Number,
    "%Object%": Object,
    "%parseFloat%": parseFloat,
    "%parseInt%": parseInt,
    "%Promise%": typeof Promise > "u" ? et : Promise,
    "%Proxy%": typeof Proxy > "u" ? et : Proxy,
    "%RangeError%": RangeError,
    "%ReferenceError%": ReferenceError,
    "%Reflect%": typeof Reflect > "u" ? et : Reflect,
    "%RegExp%": RegExp,
    "%Set%": typeof Set > "u" ? et : Set,
    "%SetIteratorPrototype%": typeof Set > "u" || !Xe || !dt ? et : dt((/* @__PURE__ */ new Set())[Symbol.iterator]()),
    "%SharedArrayBuffer%": typeof SharedArrayBuffer > "u" ? et : SharedArrayBuffer,
    "%String%": String,
    "%StringIteratorPrototype%": Xe && dt ? dt(""[Symbol.iterator]()) : et,
    "%Symbol%": Xe ? Symbol : et,
    "%SyntaxError%": Ve,
    "%ThrowTypeError%": Ko,
    "%TypedArray%": tl,
    "%TypeError%": Fe,
    "%Uint8Array%": typeof Uint8Array > "u" ? et : Uint8Array,
    "%Uint8ClampedArray%": typeof Uint8ClampedArray > "u" ? et : Uint8ClampedArray,
    "%Uint16Array%": typeof Uint16Array > "u" ? et : Uint16Array,
    "%Uint32Array%": typeof Uint32Array > "u" ? et : Uint32Array,
    "%URIError%": URIError,
    "%WeakMap%": typeof WeakMap > "u" ? et : WeakMap,
    "%WeakRef%": typeof WeakRef > "u" ? et : WeakRef,
    "%WeakSet%": typeof WeakSet > "u" ? et : WeakSet
  };
  if (dt)
    try {
      null.error;
    } catch (e) {
      var el = dt(dt(e));
      Ee["%Error.prototype%"] = el;
    }
  var nl = function e(t) {
    var r;
    if (t === "%AsyncFunction%")
      r = Gn("async function () {}");
    else if (t === "%GeneratorFunction%")
      r = Gn("function* () {}");
    else if (t === "%AsyncGeneratorFunction%")
      r = Gn("async function* () {}");
    else if (t === "%AsyncGenerator%") {
      var i = e("%AsyncGeneratorFunction%");
      i && (r = i.prototype);
    } else if (t === "%AsyncIteratorPrototype%") {
      var a = e("%AsyncGenerator%");
      a && dt && (r = dt(a.prototype));
    }
    return Ee[t] = r, r;
  }, oi = {
    "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
    "%ArrayPrototype%": ["Array", "prototype"],
    "%ArrayProto_entries%": ["Array", "prototype", "entries"],
    "%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
    "%ArrayProto_keys%": ["Array", "prototype", "keys"],
    "%ArrayProto_values%": ["Array", "prototype", "values"],
    "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
    "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
    "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
    "%BooleanPrototype%": ["Boolean", "prototype"],
    "%DataViewPrototype%": ["DataView", "prototype"],
    "%DatePrototype%": ["Date", "prototype"],
    "%ErrorPrototype%": ["Error", "prototype"],
    "%EvalErrorPrototype%": ["EvalError", "prototype"],
    "%Float32ArrayPrototype%": ["Float32Array", "prototype"],
    "%Float64ArrayPrototype%": ["Float64Array", "prototype"],
    "%FunctionPrototype%": ["Function", "prototype"],
    "%Generator%": ["GeneratorFunction", "prototype"],
    "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
    "%Int8ArrayPrototype%": ["Int8Array", "prototype"],
    "%Int16ArrayPrototype%": ["Int16Array", "prototype"],
    "%Int32ArrayPrototype%": ["Int32Array", "prototype"],
    "%JSONParse%": ["JSON", "parse"],
    "%JSONStringify%": ["JSON", "stringify"],
    "%MapPrototype%": ["Map", "prototype"],
    "%NumberPrototype%": ["Number", "prototype"],
    "%ObjectPrototype%": ["Object", "prototype"],
    "%ObjProto_toString%": ["Object", "prototype", "toString"],
    "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
    "%PromisePrototype%": ["Promise", "prototype"],
    "%PromiseProto_then%": ["Promise", "prototype", "then"],
    "%Promise_all%": ["Promise", "all"],
    "%Promise_reject%": ["Promise", "reject"],
    "%Promise_resolve%": ["Promise", "resolve"],
    "%RangeErrorPrototype%": ["RangeError", "prototype"],
    "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
    "%RegExpPrototype%": ["RegExp", "prototype"],
    "%SetPrototype%": ["Set", "prototype"],
    "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
    "%StringPrototype%": ["String", "prototype"],
    "%SymbolPrototype%": ["Symbol", "prototype"],
    "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
    "%TypedArrayPrototype%": ["TypedArray", "prototype"],
    "%TypeErrorPrototype%": ["TypeError", "prototype"],
    "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
    "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
    "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
    "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
    "%URIErrorPrototype%": ["URIError", "prototype"],
    "%WeakMapPrototype%": ["WeakMap", "prototype"],
    "%WeakSetPrototype%": ["WeakSet", "prototype"]
  }, sn = Di, En = Jo, rl = sn.call(Function.call, Array.prototype.concat), il = sn.call(Function.apply, Array.prototype.splice), li = sn.call(Function.call, String.prototype.replace), Sn = sn.call(Function.call, String.prototype.slice), sl = sn.call(Function.call, RegExp.prototype.exec), al = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, ol = /\\(\\)?/g, ll = function(t) {
    var r = Sn(t, 0, 1), i = Sn(t, -1);
    if (r === "%" && i !== "%")
      throw new Ve("invalid intrinsic syntax, expected closing `%`");
    if (i === "%" && r !== "%")
      throw new Ve("invalid intrinsic syntax, expected opening `%`");
    var a = [];
    return li(t, al, function(l, u, c, h) {
      a[a.length] = c ? li(h, ol, "$1") : u || l;
    }), a;
  }, fl = function(t, r) {
    var i = t, a;
    if (En(oi, i) && (a = oi[i], i = "%" + a[0] + "%"), En(Ee, i)) {
      var l = Ee[i];
      if (l === Ye && (l = nl(i)), typeof l > "u" && !r)
        throw new Fe("intrinsic " + t + " exists, but is not available. Please file an issue!");
      return {
        alias: a,
        name: i,
        value: l
      };
    }
    throw new Ve("intrinsic " + t + " does not exist!");
  }, ul = function(t, r) {
    if (typeof t != "string" || t.length === 0)
      throw new Fe("intrinsic name must be a non-empty string");
    if (arguments.length > 1 && typeof r != "boolean")
      throw new Fe('"allowMissing" argument must be a boolean');
    if (sl(/^%?[^%]*%?$/, t) === null)
      throw new Ve("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
    var i = ll(t), a = i.length > 0 ? i[0] : "", l = fl("%" + a + "%", r), u = l.name, c = l.value, h = !1, y = l.alias;
    y && (a = y[0], il(i, rl([0, 1], y)));
    for (var v = 1, d = !0; v < i.length; v += 1) {
      var g = i[v], m = Sn(g, 0, 1), P = Sn(g, -1);
      if ((m === '"' || m === "'" || m === "`" || P === '"' || P === "'" || P === "`") && m !== P)
        throw new Ve("property names with quotes must have matching quotes");
      if ((g === "constructor" || !d) && (h = !0), a += "." + g, u = "%" + a + "%", En(Ee, u))
        c = Ee[u];
      else if (c != null) {
        if (!(g in c)) {
          if (!r)
            throw new Fe("base intrinsic for " + t + " exists, but the property is not available.");
          return;
        }
        if (Ie && v + 1 >= i.length) {
          var x = Ie(c, g);
          d = !!x, d && "get" in x && !("originalValue" in x.get) ? c = x.get : c = c[g];
        } else
          d = En(c, g), c = c[g];
        d && !h && (Ee[u] = c);
      }
    }
    return c;
  }, cl = ul, Qn = cl("%Object.defineProperty%", !0), tr = function() {
    if (Qn)
      try {
        return Qn({}, "a", { value: 1 }), !0;
      } catch {
        return !1;
      }
    return !1;
  };
  tr.hasArrayLengthDefineBug = function() {
    if (!tr())
      return null;
    try {
      return Qn([], "length", { value: 1 }).length !== 1;
    } catch {
      return !0;
    }
  };
  var hl = tr, pl = Fo, yl = typeof Symbol == "function" && typeof Symbol("foo") == "symbol", gl = Object.prototype.toString, vl = Array.prototype.concat, Xi = Object.defineProperty, ml = function(e) {
    return typeof e == "function" && gl.call(e) === "[object Function]";
  }, dl = hl(), _i = Xi && dl, Cl = function(e, t, r, i) {
    if (t in e) {
      if (i === !0) {
        if (e[t] === r)
          return;
      } else if (!ml(i) || !i())
        return;
    }
    _i ? Xi(e, t, {
      configurable: !0,
      enumerable: !1,
      value: r,
      writable: !0
    }) : e[t] = r;
  }, Yi = function(e, t) {
    var r = arguments.length > 2 ? arguments[2] : {}, i = pl(t);
    yl && (i = vl.call(i, Object.getOwnPropertySymbols(t)));
    for (var a = 0; a < i.length; a += 1)
      Cl(e, i[a], t[i[a]], r[i[a]]);
  };
  Yi.supportsDescriptors = !!_i;
  var Bi = Yi, mn = { exports: {} };
  typeof self < "u" ? mn.exports = self : typeof window < "u" ? mn.exports = window : mn.exports = Function("return this")();
  var bi = mn.exports, Pl = bi, ki = function() {
    return typeof Yt != "object" || !Yt || Yt.Math !== Math || Yt.Array !== Array ? Pl : Yt;
  }, Tl = Bi, xl = ki, Il = function() {
    var t = xl();
    if (Tl.supportsDescriptors) {
      var r = Object.getOwnPropertyDescriptor(t, "globalThis");
      (!r || r.configurable && (r.enumerable || !r.writable || globalThis !== t)) && Object.defineProperty(t, "globalThis", {
        configurable: !0,
        enumerable: !1,
        value: t,
        writable: !0
      });
    } else (typeof globalThis != "object" || globalThis !== t) && (t.globalThis = t);
    return t;
  }, El = Bi, Sl = bi, Fi = ki, Ol = Il, Ll = Fi(), Ri = function() {
    return Ll;
  };
  El(Ri, {
    getPolyfill: Fi,
    implementation: Sl,
    shim: Ol
  });
  var wl = Ri, Nl = /* @__PURE__ */ Pr(wl);
  const $t = Nl(), Ui = {
    vtkObject: () => null
  };
  function Vt(e) {
    if (e == null || e.isA)
      return e;
    if (!e.vtkClass)
      return $t.console && $t.console.error && $t.console.error("Invalid VTK object"), null;
    const t = Ui[e.vtkClass];
    if (!t)
      return $t.console && $t.console.error && $t.console.error(`No vtk class found for Object of type ${e.vtkClass}`), null;
    const r = {
      ...e
    };
    Object.keys(r).forEach((a) => {
      r[a] && typeof r[a] == "object" && r[a].vtkClass && (r[a] = Vt(r[a]));
    });
    const i = t(r);
    return i && i.modified && i.modified(), i;
  }
  function Ml(e, t) {
    Ui[e] = t;
  }
  Vt.register = Ml;
  class Hn extends Array {
    push() {
      for (let t = 0; t < arguments.length; t++)
        this.includes(arguments[t]) || super.push(arguments[t]);
      return this.length;
    }
  }
  let er = 0;
  const $i = Symbol("void");
  function Dl() {
    return er;
  }
  const Vi = {};
  function Pe() {
  }
  const Al = ["log", "debug", "info", "warn", "error", "time", "timeEnd", "group", "groupEnd"];
  Al.forEach((e) => {
    Vi[e] = Pe;
  });
  $t.console = console.hasOwnProperty("log") ? console : Vi;
  const pe = {
    debug: Pe,
    // Don't print debug by default
    error: $t.console.error || Pe,
    info: $t.console.info || Pe,
    log: $t.console.log || Pe,
    warn: $t.console.warn || Pe
  };
  function Wi(e, t) {
    pe[e] && (pe[e] = t || Pe);
  }
  function zi() {
    pe.log(...arguments);
  }
  function ji() {
    pe.info(...arguments);
  }
  function On() {
    pe.debug(...arguments);
  }
  function mt() {
    pe.error(...arguments);
  }
  function Yn() {
    pe.warn(...arguments);
  }
  const fi = {};
  function Gi(e) {
    fi[e] || (pe.error(e), fi[e] = !0);
  }
  const Pt = /* @__PURE__ */ Object.create(null);
  Pt.Float32Array = Float32Array;
  Pt.Float64Array = Float64Array;
  Pt.Uint8Array = Uint8Array;
  Pt.Int8Array = Int8Array;
  Pt.Uint16Array = Uint16Array;
  Pt.Int16Array = Int16Array;
  Pt.Uint32Array = Uint32Array;
  Pt.Int32Array = Int32Array;
  Pt.Uint8ClampedArray = Uint8ClampedArray;
  try {
    Pt.BigInt64Array = BigInt64Array, Pt.BigUint64Array = BigUint64Array;
  } catch {
  }
  function Bn(e) {
    for (var t = arguments.length, r = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
      r[i - 1] = arguments[i];
    return new (Pt[e] || Float64Array)(...r);
  }
  function Tr(e) {
    for (var t = arguments.length, r = new Array(t > 1 ? t - 1 : 0), i = 1; i < t; i++)
      r[i - 1] = arguments[i];
    return (Pt[e] || Float64Array).from(...r);
  }
  function bn(e) {
    return e.charAt(0).toUpperCase() + e.slice(1);
  }
  function ct(e) {
    return bn(e[0] === "_" ? e.slice(1) : e);
  }
  function Zi(e) {
    return e.charAt(0).toLowerCase() + e.slice(1);
  }
  function Hi(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 2, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1e3;
    const i = ["TB", "GB", "MB", "KB"];
    let a = Number(e), l = "B";
    for (; a > r; )
      a /= r, l = i.pop();
    return `${a.toFixed(t)} ${l}`;
  }
  function qi(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : " ";
    const r = [];
    let i = e;
    for (; i > 1e3; )
      r.push(`000${i % 1e3}`.slice(-3)), i = Math.floor(i / 1e3);
    return i > 0 && r.push(i), r.reverse(), r.join(t);
  }
  function Ji(e) {
    Object.keys(e).forEach((t) => {
      Array.isArray(e[t]) && (e[t] = [].concat(e[t]));
    });
  }
  function Xl(e) {
    return Object.values(Pt).some((t) => e instanceof t);
  }
  function _l(e, t) {
    if (e === t)
      return !0;
    if (Array.isArray(e) && Array.isArray(t)) {
      if (e.length !== t.length)
        return !1;
      for (let r = 0; r < e.length; r++)
        if (e[r] !== t[r])
          return !1;
      return !0;
    }
    return !1;
  }
  function Yl(e, t) {
    return Object.keys(e).find((r) => e[r] === t);
  }
  function Ki(e) {
    return e && e.isA ? e.getState() : e;
  }
  function xr(e) {
    setTimeout(e, 0);
  }
  function Qi(e, t) {
    const r = performance.now();
    e.finally(() => {
      const i = performance.now() - r;
      t(i);
    });
  }
  function Ir() {
    let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
    Ji(t);
    const r = [];
    if (Number.isInteger(t.mtime) || (t.mtime = ++er), !("classHierarchy" in t))
      t.classHierarchy = new Hn("vtkObject");
    else if (!(t.classHierarchy instanceof Hn)) {
      const l = new Hn();
      for (let u = 0; u < t.classHierarchy.length; u++)
        l.push(t.classHierarchy[u]);
      t.classHierarchy = l;
    }
    function i(l) {
      r[l] = null;
    }
    function a(l) {
      function u() {
        i(l);
      }
      return Object.freeze({
        unsubscribe: u
      });
    }
    return e.isDeleted = () => !!t.deleted, e.modified = (l) => {
      if (t.deleted) {
        mt("instance deleted - cannot call any method");
        return;
      }
      l && l < e.getMTime() || (t.mtime = ++er, r.forEach((u) => u && u(e)));
    }, e.onModified = (l) => {
      if (t.deleted)
        return mt("instance deleted - cannot call any method"), null;
      const u = r.length;
      return r.push(l), a(u);
    }, e.getMTime = () => t.mtime, e.isA = (l) => {
      let u = t.classHierarchy.length;
      for (; u--; )
        if (t.classHierarchy[u] === l)
          return !0;
      return !1;
    }, e.getClassName = function() {
      let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      return t.classHierarchy[t.classHierarchy.length - 1 - l];
    }, e.set = function() {
      let l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, c = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, h = !1;
      return Object.keys(l).forEach((y) => {
        const v = c ? null : e[`set${bn(y)}`];
        v && Array.isArray(l[y]) && v.length > 1 ? h = v(...l[y]) || h : v ? h = v(l[y]) || h : (["mtime"].indexOf(y) === -1 && !u && Yn(`Warning: Set value to model directly ${y}, ${l[y]}`), h = t[y] !== l[y] || h, t[y] = l[y]);
      }), h;
    }, e.get = function() {
      for (var l = arguments.length, u = new Array(l), c = 0; c < l; c++)
        u[c] = arguments[c];
      if (!u.length)
        return t;
      const h = {};
      return u.forEach((y) => {
        h[y] = t[y];
      }), h;
    }, e.getReferenceByName = (l) => t[l], e.delete = () => {
      Object.keys(t).forEach((l) => delete t[l]), r.forEach((l, u) => i(u)), t.deleted = !0;
    }, e.getState = () => {
      if (t.deleted)
        return null;
      const l = {
        ...t,
        vtkClass: e.getClassName()
      };
      Object.keys(l).forEach((c) => {
        l[c] === null || l[c] === void 0 || c[0] === "_" ? delete l[c] : l[c].isA ? l[c] = l[c].getState() : Array.isArray(l[c]) ? l[c] = l[c].map(Ki) : Xl(l[c]) && (l[c] = Array.from(l[c]));
      });
      const u = {};
      return Object.keys(l).sort().forEach((c) => {
        u[c] = l[c];
      }), u.mtime && delete u.mtime, u;
    }, e.shallowCopy = function(l) {
      let u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
      if (l.getClassName() !== e.getClassName())
        throw new Error(`Cannot ShallowCopy ${l.getClassName()} into ${e.getClassName()}`);
      const c = l.get(), h = Object.keys(t).sort();
      Object.keys(c).sort().forEach((v) => {
        const d = h.indexOf(v);
        d === -1 ? u && On(`add ${v} in shallowCopy`) : h.splice(d, 1), t[v] = c[v];
      }), h.length && u && On(`Untouched keys: ${h.join(", ")}`), e.modified();
    }, e.toJSON = function() {
      return e.getState();
    }, e;
  }
  const Bl = {
    object(e, t, r) {
      return function() {
        return {
          ...t[r.name]
        };
      };
    }
  };
  function an(e, t, r) {
    r.forEach((i) => {
      if (typeof i == "object") {
        const a = Bl[i.type];
        a ? e[`get${ct(i.name)}`] = a(e, t, i) : e[`get${ct(i.name)}`] = () => t[i.name];
      } else
        e[`get${ct(i)}`] = () => t[i];
    });
  }
  const bl = {
    enum(e, t, r) {
      const i = `_on${ct(r.name)}Changed`;
      return (a) => {
        var l;
        if (typeof a == "string") {
          if (r.enum[a] !== void 0)
            return t[r.name] !== r.enum[a] ? (t[r.name] = r.enum[a], e.modified(), !0) : !1;
          throw mt(`Set Enum with invalid argument ${r}, ${a}`), new RangeError("Set Enum with invalid string argument");
        }
        if (typeof a == "number") {
          if (t[r.name] !== a) {
            if (Object.keys(r.enum).map((u) => r.enum[u]).indexOf(a) !== -1) {
              const u = t[r.name];
              return t[r.name] = a, (l = t[i]) == null || l.call(t, e, t, a, u), e.modified(), !0;
            }
            throw mt(`Set Enum outside numeric range ${r}, ${a}`), new RangeError("Set Enum outside numeric range");
          }
          return !1;
        }
        throw mt(`Set Enum with invalid argument (String/Number) ${r}, ${a}`), new TypeError("Set Enum with invalid argument (String/Number)");
      };
    },
    object(e, t, r) {
      const i = `_on${ct(r.name)}Changed`;
      return (a) => {
        var l;
        if (!Yo(t[r.name], a)) {
          const u = t[r.name];
          return t[r.name] = a, (l = t[i]) == null || l.call(t, e, t, a, u), e.modified(), !0;
        }
        return !1;
      };
    }
  };
  function ui(e) {
    if (typeof e == "object") {
      const t = bl[e.type];
      if (t)
        return (r, i) => t(r, i, e);
      throw mt(`No setter for field ${e}`), new TypeError("No setter for field");
    }
    return function(r, i) {
      const a = `_on${ct(e)}Changed`;
      return function(u) {
        var c;
        if (i.deleted)
          return mt("instance deleted - cannot call any method"), !1;
        if (i[e] !== u) {
          const h = i[e.name];
          return i[e] = u, (c = i[a]) == null || c.call(i, r, i, u, h), r.modified(), !0;
        }
        return !1;
      };
    };
  }
  function kn(e, t, r) {
    r.forEach((i) => {
      typeof i == "object" ? e[`set${ct(i.name)}`] = ui(i)(e, t) : e[`set${ct(i)}`] = ui(i)(e, t);
    });
  }
  function Er(e, t, r) {
    an(e, t, r), kn(e, t, r);
  }
  function Sr(e, t, r) {
    r.forEach((i) => {
      e[`get${ct(i)}`] = () => t[i] ? Array.from(t[i]) : t[i], e[`get${ct(i)}ByReference`] = () => t[i];
    });
  }
  function Or(e, t, r, i) {
    let a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : void 0;
    r.forEach((l) => {
      if (t[l] && i && t[l].length !== i)
        throw new RangeError(`Invalid initial number of values for array (${l})`);
      const u = `_on${ct(l)}Changed`;
      e[`set${ct(l)}`] = function() {
        var m;
        if (t.deleted)
          return mt("instance deleted - cannot call any method"), !1;
        for (var c = arguments.length, h = new Array(c), y = 0; y < c; y++)
          h[y] = arguments[y];
        let v = h, d, g = !1;
        if (v.length === 1 && (v[0] == null || v[0].length >= 0) && (v = v[0], g = !0), v == null)
          d = t[l] !== v;
        else {
          if (i && v.length !== i)
            if (v.length < i && a !== void 0)
              for (v = Array.from(v), g = !1; v.length < i; ) v.push(a);
            else
              throw new RangeError(`Invalid number of values for array setter (${l})`);
          d = t[l] == null || t[l].length !== v.length;
          for (let P = 0; !d && P < v.length; ++P)
            d = t[l][P] !== v[P];
          d && g && (v = Array.from(v));
        }
        if (d) {
          const P = t[l.name];
          t[l] = v, (m = t[u]) == null || m.call(t, e, t, v, P), e.modified();
        }
        return d;
      }, e[`set${ct(l)}From`] = (c) => {
        const h = t[l];
        c.forEach((y, v) => {
          h[v] = y;
        });
      };
    });
  }
  function ts(e, t, r, i) {
    let a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : void 0;
    Sr(e, t, r), Or(e, t, r, i, a);
  }
  function es(e, t, r) {
    for (let i = 0; i < r.length; i++) {
      const a = r[i];
      t[a] !== void 0 && (t[`_${a}`] = t[a], delete t[a]);
    }
  }
  function ns(e, t, r, i) {
    t.inputData ? t.inputData = t.inputData.map(Vt) : t.inputData = [], t.inputConnection ? t.inputConnection = t.inputConnection.map(Vt) : t.inputConnection = [], t.output ? t.output = t.output.map(Vt) : t.output = [], t.inputArrayToProcess ? t.inputArrayToProcess = t.inputArrayToProcess.map(Vt) : t.inputArrayToProcess = [], t.numberOfInputs = r;
    function a(m) {
      let P = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      if (t.deleted) {
        mt("instance deleted - cannot call any method");
        return;
      }
      if (P >= t.numberOfInputs) {
        mt(`algorithm ${e.getClassName()} only has ${t.numberOfInputs} input ports. To add more input ports, use addInputData()`);
        return;
      }
      (t.inputData[P] !== m || t.inputConnection[P]) && (t.inputData[P] = m, t.inputConnection[P] = null, e.modified && e.modified());
    }
    function l() {
      let m = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      return t.inputConnection[m] && (t.inputData[m] = t.inputConnection[m]()), t.inputData[m];
    }
    function u(m) {
      let P = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      if (t.deleted) {
        mt("instance deleted - cannot call any method");
        return;
      }
      if (P >= t.numberOfInputs) {
        let x = `algorithm ${e.getClassName()} only has `;
        x += `${t.numberOfInputs}`, x += " input ports. To add more input ports, use addInputConnection()", mt(x);
        return;
      }
      t.inputData[P] = null, t.inputConnection[P] = m;
    }
    function c() {
      let m = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      return t.inputConnection[m];
    }
    function h() {
      let m = t.numberOfInputs;
      for (; m && !t.inputData[m - 1] && !t.inputConnection[m - 1]; )
        m--;
      return m === t.numberOfInputs && t.numberOfInputs++, m;
    }
    function y(m) {
      if (t.deleted) {
        mt("instance deleted - cannot call any method");
        return;
      }
      u(m, h());
    }
    function v(m) {
      if (t.deleted) {
        mt("instance deleted - cannot call any method");
        return;
      }
      a(m, h());
    }
    function d() {
      let m = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      return t.deleted ? (mt("instance deleted - cannot call any method"), null) : (e.shouldUpdate() && e.update(), t.output[m]);
    }
    e.shouldUpdate = () => {
      var S, L;
      const m = e.getMTime();
      let P = 1 / 0, x = i;
      for (; x--; ) {
        if (!t.output[x] || t.output[x].isDeleted())
          return !0;
        const N = t.output[x].getMTime();
        if (N < m)
          return !0;
        N < P && (P = N);
      }
      for (x = t.numberOfInputs; x--; )
        if ((S = t.inputConnection[x]) != null && S.filter.shouldUpdate() || ((L = e.getInputData(x)) == null ? void 0 : L.getMTime()) > P)
          return !0;
      return !1;
    };
    function g() {
      let m = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      const P = () => d(m);
      return P.filter = e, P;
    }
    if (t.numberOfInputs) {
      let m = t.numberOfInputs;
      for (; m--; )
        t.inputData.push(null), t.inputConnection.push(null);
      e.setInputData = a, e.setInputConnection = u, e.addInputData = v, e.addInputConnection = y, e.getInputData = l, e.getInputConnection = c;
    }
    i && (e.getOutputData = d, e.getOutputPort = g), e.update = () => {
      const m = [];
      if (t.numberOfInputs) {
        let P = 0;
        for (; P < t.numberOfInputs; )
          m[P] = e.getInputData(P), P++;
      }
      e.shouldUpdate() && e.requestData && e.requestData(m, t.output);
    }, e.getNumberOfInputPorts = () => t.numberOfInputs, e.getNumberOfOutputPorts = () => i || t.output.length, e.getInputArrayToProcess = (m) => {
      const P = t.inputArrayToProcess[m], x = t.inputData[m];
      return P && x ? x[`get${P.fieldAssociation}`]().getArray(P.arrayName) : null;
    }, e.setInputArrayToProcess = function(m, P, x) {
      let S = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "Scalars";
      for (; t.inputArrayToProcess.length < m; )
        t.inputArrayToProcess.push(null);
      t.inputArrayToProcess[m] = {
        arrayName: P,
        fieldAssociation: x,
        attributeType: S
      };
    };
  }
  const Lr = Symbol("Event abort");
  function rs(e, t, r) {
    const i = [], a = e.delete;
    let l = 1;
    function u(y) {
      for (let v = 0; v < i.length; ++v) {
        const [d] = i[v];
        if (d === y) {
          i.splice(v, 1);
          return;
        }
      }
    }
    function c(y) {
      function v() {
        u(y);
      }
      return Object.freeze({
        unsubscribe: v
      });
    }
    function h() {
      if (t.deleted) {
        mt("instance deleted - cannot call any method");
        return;
      }
      const y = i.slice();
      for (let v = 0; v < y.length; ++v) {
        const [, d, g] = y[v];
        if (d) {
          if (g < 0)
            setTimeout(() => d.apply(e, arguments), 1 - g);
          else if (d.apply(e, arguments) === Lr)
            break;
        }
      }
    }
    e[`invoke${ct(r)}`] = h, e[`on${ct(r)}`] = function(y) {
      let v = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      if (!y.apply)
        return console.error(`Invalid callback for event ${r}`), null;
      if (t.deleted)
        return mt("instance deleted - cannot call any method"), null;
      const d = l++;
      return i.push([d, y, v]), i.sort((g, m) => m[2] - g[2]), c(d);
    }, e.delete = () => {
      a(), i.forEach((y) => {
        let [v] = y;
        return u(v);
      });
    };
  }
  function wr(e, t) {
    const r = function() {
      let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
      const a = {}, l = {};
      return e(l, a, i), Object.freeze(l);
    };
    return t && Vt.register(t, r), r;
  }
  function is() {
    for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
      t[r] = arguments[r];
    return function() {
      for (var i = arguments.length, a = new Array(i), l = 0; l < i; l++)
        a[l] = arguments[l];
      return t.filter((u) => !!u).map((u) => u(...a));
    };
  }
  function Nr(e) {
    return e && e.isA && e.isA("vtkObject");
  }
  function Ln(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [], i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : [];
    if (Nr(e)) {
      if (i.indexOf(e) >= 0)
        return r;
      i.push(e);
      const a = t(e);
      a !== void 0 && r.push(a);
      const l = e.get();
      Object.keys(l).forEach((u) => {
        const c = l[u];
        Array.isArray(c) ? c.forEach((h) => {
          Ln(h, t, r, i);
        }) : Ln(c, t, r, i);
      });
    }
    return r;
  }
  function ss(e, t, r) {
    var i = this;
    let a;
    const l = function() {
      for (var u = arguments.length, c = new Array(u), h = 0; h < u; h++)
        c[h] = arguments[h];
      const y = i, v = () => {
        a = null, r || e.apply(y, c);
      }, d = r && !a;
      clearTimeout(a), a = setTimeout(v, t), d && e.apply(y, c);
    };
    return l.cancel = () => clearTimeout(a), l;
  }
  function as(e, t) {
    let r = !1, i = null;
    function a() {
      r = !1, i !== null && (l(...i), i = null);
    }
    function l() {
      for (var u = arguments.length, c = new Array(u), h = 0; h < u; h++)
        c[h] = arguments[h];
      if (r) {
        i = c;
        return;
      }
      r = !0, e(...c), setTimeout(a, t);
    }
    return l;
  }
  function Mr(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    t.keystore = Object.assign(t.keystore || {}, r), e.setKey = (i, a) => {
      t.keystore[i] = a;
    }, e.getKey = (i) => t.keystore[i], e.getAllKeys = () => Object.keys(t.keystore), e.deleteKey = (i) => delete t.keystore[i], e.clearKeystore = () => e.getAllKeys().forEach((i) => delete t.keystore[i]);
  }
  let kl = 1;
  const cn = "__root__";
  function os(e, t) {
    Mr(e, t);
    const r = e.delete;
    t.proxyId = `${kl++}`, t.ui = JSON.parse(JSON.stringify(t.ui || [])), an(e, t, ["proxyId", "proxyGroup", "proxyName"]), Er(e, t, ["proxyManager"]);
    const i = {}, a = {};
    function l(y, v) {
      a[v] || (a[v] = []);
      const d = a[v];
      for (let g = 0; g < y.length; g++)
        d.push(y[g].name), i[y[g].name] = y[g], y[g].children && y[g].children.length && l(y[g].children, y[g].name);
    }
    l(t.ui, cn), e.updateUI = (y) => {
      t.ui = JSON.parse(JSON.stringify(y || [])), Object.keys(i).forEach((v) => delete i[v]), Object.keys(a).forEach((v) => delete a[v]), l(t.ui, cn), e.modified();
    };
    function u() {
      let y = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : cn;
      return a[y];
    }
    e.updateProxyProperty = (y, v) => {
      const d = i[y];
      d ? Object.assign(d, v) : i[y] = {
        ...v
      };
    }, e.activate = () => {
      if (t.proxyManager) {
        const y = `setActive${ct(e.getProxyGroup().slice(0, -1))}`;
        t.proxyManager[y] && t.proxyManager[y](e);
      }
    }, t.propertyLinkSubscribers = {}, e.registerPropertyLinkForGC = (y, v) => {
      v in t.propertyLinkSubscribers || (t.propertyLinkSubscribers[v] = []), t.propertyLinkSubscribers[v].push(y);
    }, e.gcPropertyLinks = (y) => {
      const v = t.propertyLinkSubscribers[y] || [];
      for (; v.length; )
        v.pop().unbind(e);
    }, t.propertyLinkMap = {}, e.getPropertyLink = function(y) {
      let v = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
      if (t.propertyLinkMap[y])
        return t.propertyLinkMap[y];
      let d = null;
      const g = [];
      let m = 0, P = !1;
      function x(E) {
        let w = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
        if (P)
          return null;
        const A = [];
        let X = null;
        for (m = g.length; m--; ) {
          const k = g[m];
          k.instance === E ? X = k : A.push(k);
        }
        if (!X)
          return null;
        const _ = X.instance[`get${ct(X.propertyName)}`]();
        if (!_l(_, d) || w) {
          for (d = _, P = !0; A.length; ) {
            const k = A.pop();
            k.instance.set({
              [k.propertyName]: d
            });
          }
          P = !1;
        }
        return t.propertyLinkMap[y].persistent && (t.propertyLinkMap[y].value = _), _;
      }
      function S(E, w) {
        const A = [];
        for (m = g.length; m--; ) {
          const X = g[m];
          X.instance === E && (X.propertyName === w || w === void 0) && (X.subscription.unsubscribe(), A.push(m));
        }
        for (; A.length; )
          g.splice(A.pop(), 1);
      }
      function L(E, w) {
        let A = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
        const X = E.onModified(x), _ = g[0];
        return g.push({
          instance: E,
          propertyName: w,
          subscription: X
        }), A && (t.propertyLinkMap[y].persistent && t.propertyLinkMap[y].value !== void 0 ? E.set({
          [w]: t.propertyLinkMap[y].value
        }) : _ && x(_.instance, !0)), {
          unsubscribe: () => S(E, w)
        };
      }
      function N() {
        for (; g.length; )
          g.pop().subscription.unsubscribe();
      }
      const M = {
        bind: L,
        unbind: S,
        unsubscribe: N,
        persistent: v
      };
      return t.propertyLinkMap[y] = M, M;
    };
    function c() {
      let y = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : cn;
      const v = [], d = t.proxyId, g = u(y) || [];
      for (let m = 0; m < g.length; m++) {
        const P = g[m], x = e[`get${ct(P)}`], S = x ? x() : void 0, L = {
          id: d,
          name: P,
          value: S
        }, N = c(P);
        N.length && (L.children = N), v.push(L);
      }
      return v;
    }
    e.listPropertyNames = () => c().map((y) => y.name), e.getPropertyByName = (y) => c().find((v) => v.name === y), e.getPropertyDomainByName = (y) => (i[y] || {}).domain, e.getProxySection = () => ({
      id: t.proxyId,
      name: t.proxyGroup,
      ui: t.ui,
      properties: c()
    }), e.delete = () => {
      const y = Object.keys(t.propertyLinkMap);
      let v = y.length;
      for (; v--; )
        t.propertyLinkMap[y[v]].unsubscribe();
      Object.keys(t.propertyLinkSubscribers).forEach(e.gcPropertyLinks), r();
    }, e.getState = () => null;
    function h() {
      if (t.links)
        for (let y = 0; y < t.links.length; y++) {
          const {
            link: v,
            property: d,
            persistent: g,
            updateOnBind: m,
            type: P
          } = t.links[y];
          if (P === "application") {
            const x = t.proxyManager.getPropertyLink(v, g);
            e.registerPropertyLinkForGC(x, "application"), x.bind(e, d, m);
          }
        }
    }
    xr(h);
  }
  function ls(e, t, r) {
    const i = e.delete, a = [], l = Object.keys(r);
    let u = l.length;
    for (; u--; ) {
      const c = l[u], {
        modelKey: h,
        property: y,
        modified: v = !0
      } = r[c], d = ct(y), g = ct(c);
      e[`get${g}`] = t[h][`get${d}`], e[`set${g}`] = t[h][`set${d}`], v && a.push(t[h].onModified(e.modified));
    }
    e.delete = () => {
      for (; a.length; )
        a.pop().unsubscribe();
      i();
    };
  }
  function fs(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
    t.this = e;
    function a(c) {
      const h = Object.keys(c);
      let y = h.length;
      for (; y--; ) {
        const v = h[y];
        t[v].set(c[v]);
      }
    }
    const l = Object.keys(i);
    let u = l.length;
    for (; u--; ) {
      const c = l[u];
      t[c] = i[c];
      const h = r[c];
      e[`set${ct(c)}`] = (y) => {
        if (y !== t[c]) {
          t[c] = y;
          const v = h[y];
          a(v), e.modified();
        }
      };
    }
    l.length && an(e, t, l);
  }
  const ci = 10, hi = 40, pi = 800;
  function us(e) {
    let t = 0, r = 0, i = 0, a = 0;
    return "detail" in e && (r = e.detail), "wheelDelta" in e && (r = -e.wheelDelta / 120), "wheelDeltaY" in e && (r = -e.wheelDeltaY / 120), "wheelDeltaX" in e && (t = -e.wheelDeltaX / 120), "axis" in e && e.axis === e.HORIZONTAL_AXIS && (t = r, r = 0), i = t * ci, a = r * ci, "deltaY" in e && (a = e.deltaY), "deltaX" in e && (i = e.deltaX), (i || a) && e.deltaMode && (e.deltaMode === 1 ? (i *= hi, a *= hi) : (i *= pi, a *= pi)), i && !t && (t = i < 1 ? -1 : 1), a && !r && (r = a < 1 ? -1 : 1), {
      spinX: t,
      spinY: r || t,
      pixelX: i,
      pixelY: a || i
    };
  }
  var V = {
    algo: ns,
    capitalize: bn,
    chain: is,
    debounce: ss,
    enumToString: Yl,
    event: rs,
    EVENT_ABORT: Lr,
    formatBytesToProperUnit: Hi,
    formatNumbersWithThousandSeparator: qi,
    get: an,
    getArray: Sr,
    getCurrentGlobalMTime: Dl,
    getStateArrayMapFunc: Ki,
    isVtkObject: Nr,
    keystore: Mr,
    measurePromiseExecution: Qi,
    moveToProtected: es,
    newInstance: wr,
    newTypedArray: Bn,
    newTypedArrayFrom: Tr,
    normalizeWheel: us,
    obj: Ir,
    proxy: os,
    proxyPropertyMapping: ls,
    proxyPropertyState: fs,
    safeArrays: Ji,
    set: kn,
    setArray: Or,
    setGet: Er,
    setGetArray: ts,
    setImmediate: xr,
    setLoggerFunction: Wi,
    throttle: as,
    traverseInstanceTree: Ln,
    TYPED_ARRAYS: Pt,
    // deprecated todo remove on breaking API revision
    uncapitalize: Zi,
    VOID: $i,
    vtkDebugMacro: On,
    vtkErrorMacro: mt,
    vtkInfoMacro: ji,
    vtkLogMacro: zi,
    vtkOnceErrorMacro: Gi,
    vtkWarningMacro: Yn
  }, Fl = /* @__PURE__ */ Object.freeze({
    __proto__: null,
    VOID: $i,
    setLoggerFunction: Wi,
    vtkLogMacro: zi,
    vtkInfoMacro: ji,
    vtkDebugMacro: On,
    vtkErrorMacro: mt,
    vtkWarningMacro: Yn,
    vtkOnceErrorMacro: Gi,
    TYPED_ARRAYS: Pt,
    newTypedArray: Bn,
    newTypedArrayFrom: Tr,
    capitalize: bn,
    _capitalize: ct,
    uncapitalize: Zi,
    formatBytesToProperUnit: Hi,
    formatNumbersWithThousandSeparator: qi,
    setImmediateVTK: xr,
    measurePromiseExecution: Qi,
    obj: Ir,
    get: an,
    set: kn,
    setGet: Er,
    getArray: Sr,
    setArray: Or,
    setGetArray: ts,
    moveToProtected: es,
    algo: ns,
    EVENT_ABORT: Lr,
    event: rs,
    newInstance: wr,
    chain: is,
    isVtkObject: Nr,
    traverseInstanceTree: Ln,
    debounce: ss,
    throttle: as,
    keystore: Mr,
    proxy: os,
    proxyPropertyMapping: ls,
    proxyPropertyState: fs,
    normalizeWheel: us,
    default: V
  }), Dr = { exports: {} };
  Dr.exports;
  (function(e) {
    (function(t, r, i) {
      function a(h) {
        var y = this, v = c();
        y.next = function() {
          var d = 2091639 * y.s0 + y.c * 23283064365386963e-26;
          return y.s0 = y.s1, y.s1 = y.s2, y.s2 = d - (y.c = d | 0);
        }, y.c = 1, y.s0 = v(" "), y.s1 = v(" "), y.s2 = v(" "), y.s0 -= v(h), y.s0 < 0 && (y.s0 += 1), y.s1 -= v(h), y.s1 < 0 && (y.s1 += 1), y.s2 -= v(h), y.s2 < 0 && (y.s2 += 1), v = null;
      }
      function l(h, y) {
        return y.c = h.c, y.s0 = h.s0, y.s1 = h.s1, y.s2 = h.s2, y;
      }
      function u(h, y) {
        var v = new a(h), d = y && y.state, g = v.next;
        return g.int32 = function() {
          return v.next() * 4294967296 | 0;
        }, g.double = function() {
          return g() + (g() * 2097152 | 0) * 11102230246251565e-32;
        }, g.quick = g, d && (typeof d == "object" && l(d, v), g.state = function() {
          return l(v, {});
        }), g;
      }
      function c() {
        var h = 4022871197, y = function(v) {
          v = String(v);
          for (var d = 0; d < v.length; d++) {
            h += v.charCodeAt(d);
            var g = 0.02519603282416938 * h;
            h = g >>> 0, g -= h, g *= h, h = g >>> 0, g -= h, h += g * 4294967296;
          }
          return (h >>> 0) * 23283064365386963e-26;
        };
        return y;
      }
      r && r.exports ? r.exports = u : this.alea = u;
    })(
      Yt,
      e
    );
  })(Dr);
  var Rl = Dr.exports, Ar = { exports: {} };
  Ar.exports;
  (function(e) {
    (function(t, r, i) {
      function a(c) {
        var h = this, y = "";
        h.x = 0, h.y = 0, h.z = 0, h.w = 0, h.next = function() {
          var d = h.x ^ h.x << 11;
          return h.x = h.y, h.y = h.z, h.z = h.w, h.w ^= h.w >>> 19 ^ d ^ d >>> 8;
        }, c === (c | 0) ? h.x = c : y += c;
        for (var v = 0; v < y.length + 64; v++)
          h.x ^= y.charCodeAt(v) | 0, h.next();
      }
      function l(c, h) {
        return h.x = c.x, h.y = c.y, h.z = c.z, h.w = c.w, h;
      }
      function u(c, h) {
        var y = new a(c), v = h && h.state, d = function() {
          return (y.next() >>> 0) / 4294967296;
        };
        return d.double = function() {
          do
            var g = y.next() >>> 11, m = (y.next() >>> 0) / 4294967296, P = (g + m) / (1 << 21);
          while (P === 0);
          return P;
        }, d.int32 = y.next, d.quick = d, v && (typeof v == "object" && l(v, y), d.state = function() {
          return l(y, {});
        }), d;
      }
      r && r.exports ? r.exports = u : this.xor128 = u;
    })(
      Yt,
      e
    );
  })(Ar);
  var Ul = Ar.exports, Xr = { exports: {} };
  Xr.exports;
  (function(e) {
    (function(t, r, i) {
      function a(c) {
        var h = this, y = "";
        h.next = function() {
          var d = h.x ^ h.x >>> 2;
          return h.x = h.y, h.y = h.z, h.z = h.w, h.w = h.v, (h.d = h.d + 362437 | 0) + (h.v = h.v ^ h.v << 4 ^ (d ^ d << 1)) | 0;
        }, h.x = 0, h.y = 0, h.z = 0, h.w = 0, h.v = 0, c === (c | 0) ? h.x = c : y += c;
        for (var v = 0; v < y.length + 64; v++)
          h.x ^= y.charCodeAt(v) | 0, v == y.length && (h.d = h.x << 10 ^ h.x >>> 4), h.next();
      }
      function l(c, h) {
        return h.x = c.x, h.y = c.y, h.z = c.z, h.w = c.w, h.v = c.v, h.d = c.d, h;
      }
      function u(c, h) {
        var y = new a(c), v = h && h.state, d = function() {
          return (y.next() >>> 0) / 4294967296;
        };
        return d.double = function() {
          do
            var g = y.next() >>> 11, m = (y.next() >>> 0) / 4294967296, P = (g + m) / (1 << 21);
          while (P === 0);
          return P;
        }, d.int32 = y.next, d.quick = d, v && (typeof v == "object" && l(v, y), d.state = function() {
          return l(y, {});
        }), d;
      }
      r && r.exports ? r.exports = u : this.xorwow = u;
    })(
      Yt,
      e
    );
  })(Xr);
  var $l = Xr.exports, _r = { exports: {} };
  _r.exports;
  (function(e) {
    (function(t, r, i) {
      function a(c) {
        var h = this;
        h.next = function() {
          var v = h.x, d = h.i, g, m;
          return g = v[d], g ^= g >>> 7, m = g ^ g << 24, g = v[d + 1 & 7], m ^= g ^ g >>> 10, g = v[d + 3 & 7], m ^= g ^ g >>> 3, g = v[d + 4 & 7], m ^= g ^ g << 7, g = v[d + 7 & 7], g = g ^ g << 13, m ^= g ^ g << 9, v[d] = m, h.i = d + 1 & 7, m;
        };
        function y(v, d) {
          var g, m = [];
          if (d === (d | 0))
            m[0] = d;
          else
            for (d = "" + d, g = 0; g < d.length; ++g)
              m[g & 7] = m[g & 7] << 15 ^ d.charCodeAt(g) + m[g + 1 & 7] << 13;
          for (; m.length < 8; ) m.push(0);
          for (g = 0; g < 8 && m[g] === 0; ++g) ;
          for (g == 8 ? m[7] = -1 : m[g], v.x = m, v.i = 0, g = 256; g > 0; --g)
            v.next();
        }
        y(h, c);
      }
      function l(c, h) {
        return h.x = c.x.slice(), h.i = c.i, h;
      }
      function u(c, h) {
        c == null && (c = +/* @__PURE__ */ new Date());
        var y = new a(c), v = h && h.state, d = function() {
          return (y.next() >>> 0) / 4294967296;
        };
        return d.double = function() {
          do
            var g = y.next() >>> 11, m = (y.next() >>> 0) / 4294967296, P = (g + m) / (1 << 21);
          while (P === 0);
          return P;
        }, d.int32 = y.next, d.quick = d, v && (v.x && l(v, y), d.state = function() {
          return l(y, {});
        }), d;
      }
      r && r.exports ? r.exports = u : this.xorshift7 = u;
    })(
      Yt,
      e
    );
  })(_r);
  var Vl = _r.exports, Yr = { exports: {} };
  Yr.exports;
  (function(e) {
    (function(t, r, i) {
      function a(c) {
        var h = this;
        h.next = function() {
          var v = h.w, d = h.X, g = h.i, m, P;
          return h.w = v = v + 1640531527 | 0, P = d[g + 34 & 127], m = d[g = g + 1 & 127], P ^= P << 13, m ^= m << 17, P ^= P >>> 15, m ^= m >>> 12, P = d[g] = P ^ m, h.i = g, P + (v ^ v >>> 16) | 0;
        };
        function y(v, d) {
          var g, m, P, x, S, L = [], N = 128;
          for (d === (d | 0) ? (m = d, d = null) : (d = d + "\0", m = 0, N = Math.max(N, d.length)), P = 0, x = -32; x < N; ++x)
            d && (m ^= d.charCodeAt((x + 32) % d.length)), x === 0 && (S = m), m ^= m << 10, m ^= m >>> 15, m ^= m << 4, m ^= m >>> 13, x >= 0 && (S = S + 1640531527 | 0, g = L[x & 127] ^= m + S, P = g == 0 ? P + 1 : 0);
          for (P >= 128 && (L[(d && d.length || 0) & 127] = -1), P = 127, x = 4 * 128; x > 0; --x)
            m = L[P + 34 & 127], g = L[P = P + 1 & 127], m ^= m << 13, g ^= g << 17, m ^= m >>> 15, g ^= g >>> 12, L[P] = m ^ g;
          v.w = S, v.X = L, v.i = P;
        }
        y(h, c);
      }
      function l(c, h) {
        return h.i = c.i, h.w = c.w, h.X = c.X.slice(), h;
      }
      function u(c, h) {
        c == null && (c = +/* @__PURE__ */ new Date());
        var y = new a(c), v = h && h.state, d = function() {
          return (y.next() >>> 0) / 4294967296;
        };
        return d.double = function() {
          do
            var g = y.next() >>> 11, m = (y.next() >>> 0) / 4294967296, P = (g + m) / (1 << 21);
          while (P === 0);
          return P;
        }, d.int32 = y.next, d.quick = d, v && (v.X && l(v, y), d.state = function() {
          return l(y, {});
        }), d;
      }
      r && r.exports ? r.exports = u : this.xor4096 = u;
    })(
      Yt,
      // window object or global
      e
    );
  })(Yr);
  var Wl = Yr.exports, Br = { exports: {} };
  Br.exports;
  (function(e) {
    (function(t, r, i) {
      function a(c) {
        var h = this, y = "";
        h.next = function() {
          var d = h.b, g = h.c, m = h.d, P = h.a;
          return d = d << 25 ^ d >>> 7 ^ g, g = g - m | 0, m = m << 24 ^ m >>> 8 ^ P, P = P - d | 0, h.b = d = d << 20 ^ d >>> 12 ^ g, h.c = g = g - m | 0, h.d = m << 16 ^ g >>> 16 ^ P, h.a = P - d | 0;
        }, h.a = 0, h.b = 0, h.c = -1640531527, h.d = 1367130551, c === Math.floor(c) ? (h.a = c / 4294967296 | 0, h.b = c | 0) : y += c;
        for (var v = 0; v < y.length + 20; v++)
          h.b ^= y.charCodeAt(v) | 0, h.next();
      }
      function l(c, h) {
        return h.a = c.a, h.b = c.b, h.c = c.c, h.d = c.d, h;
      }
      function u(c, h) {
        var y = new a(c), v = h && h.state, d = function() {
          return (y.next() >>> 0) / 4294967296;
        };
        return d.double = function() {
          do
            var g = y.next() >>> 11, m = (y.next() >>> 0) / 4294967296, P = (g + m) / (1 << 21);
          while (P === 0);
          return P;
        }, d.int32 = y.next, d.quick = d, v && (typeof v == "object" && l(v, y), d.state = function() {
          return l(y, {});
        }), d;
      }
      r && r.exports ? r.exports = u : this.tychei = u;
    })(
      Yt,
      e
    );
  })(Br);
  var zl = Br.exports, cs = { exports: {} }, jl = {}, Gl = /* @__PURE__ */ Object.freeze({
    __proto__: null,
    default: jl
  }), Zl = /* @__PURE__ */ Xo(Gl);
  (function(e) {
    (function(t, r, i) {
      var a = 256, l = 6, u = 52, c = "random", h = i.pow(a, l), y = i.pow(2, u), v = y * 2, d = a - 1, g;
      function m(E, w, A) {
        var X = [];
        w = w == !0 ? { entropy: !0 } : w || {};
        var _ = L(S(
          w.entropy ? [E, M(r)] : E ?? N(),
          3
        ), X), k = new P(X), Y = function() {
          for (var F = k.g(l), W = h, U = 0; F < y; )
            F = (F + U) * a, W *= a, U = k.g(1);
          for (; F >= v; )
            F /= 2, W /= 2, U >>>= 1;
          return (F + U) / W;
        };
        return Y.int32 = function() {
          return k.g(4) | 0;
        }, Y.quick = function() {
          return k.g(4) / 4294967296;
        }, Y.double = Y, L(M(k.S), r), (w.pass || A || function(F, W, U, R) {
          return R && (R.S && x(R, k), F.state = function() {
            return x(k, {});
          }), U ? (i[c] = F, W) : F;
        })(
          Y,
          _,
          "global" in w ? w.global : this == i,
          w.state
        );
      }
      function P(E) {
        var w, A = E.length, X = this, _ = 0, k = X.i = X.j = 0, Y = X.S = [];
        for (A || (E = [A++]); _ < a; )
          Y[_] = _++;
        for (_ = 0; _ < a; _++)
          Y[_] = Y[k = d & k + E[_ % A] + (w = Y[_])], Y[k] = w;
        (X.g = function(F) {
          for (var W, U = 0, R = X.i, j = X.j, nt = X.S; F--; )
            W = nt[R = d & R + 1], U = U * a + nt[d & (nt[R] = nt[j = d & j + W]) + (nt[j] = W)];
          return X.i = R, X.j = j, U;
        })(a);
      }
      function x(E, w) {
        return w.i = E.i, w.j = E.j, w.S = E.S.slice(), w;
      }
      function S(E, w) {
        var A = [], X = typeof E, _;
        if (w && X == "object")
          for (_ in E)
            try {
              A.push(S(E[_], w - 1));
            } catch {
            }
        return A.length ? A : X == "string" ? E : E + "\0";
      }
      function L(E, w) {
        for (var A = E + "", X, _ = 0; _ < A.length; )
          w[d & _] = d & (X ^= w[d & _] * 19) + A.charCodeAt(_++);
        return M(w);
      }
      function N() {
        try {
          var E;
          return g && (E = g.randomBytes) ? E = E(a) : (E = new Uint8Array(a), (t.crypto || t.msCrypto).getRandomValues(E)), M(E);
        } catch {
          var w = t.navigator, A = w && w.plugins;
          return [+/* @__PURE__ */ new Date(), t, A, t.screen, M(r)];
        }
      }
      function M(E) {
        return String.fromCharCode.apply(0, E);
      }
      if (L(i.random(), r), e.exports) {
        e.exports = m;
        try {
          g = Zl;
        } catch {
        }
      } else
        i["seed" + c] = m;
    })(
      // global: `self` in browsers (including strict mode and web workers),
      // otherwise `this` in Node and other environments
      typeof self < "u" ? self : Yt,
      [],
      // pool: entropy pool starts empty
      Math
      // math: package containing random, pow, and seedrandom
    );
  })(cs);
  var Hl = cs.exports, ql = Rl, Jl = Ul, Kl = $l, Ql = Vl, tf = Wl, ef = zl, we = Hl;
  we.alea = ql;
  we.xor128 = Jl;
  we.xorwow = Kl;
  we.xorshift7 = Ql;
  we.xor4096 = tf;
  we.tychei = ef;
  var nf = we, rf = /* @__PURE__ */ Pr(nf);
  const hs = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], sf = [1, 0, 0, 0, 1, 0, 0, 0, 1], br = 1e-6, kr = 1e-12, {
    vtkErrorMacro: ps,
    vtkWarningMacro: Se
  } = V;
  let ys = 0;
  const yi = 20;
  function on(e) {
    return () => ps(`vtkMath::${e} - NOT IMPLEMENTED`);
  }
  function nn(e, t, r, i) {
    let a;
    for (let l = 0; l < t; l++)
      a = e[r * t + l], e[r * t + l] = e[i * t + l], e[i * t + l] = a;
  }
  function tn(e, t, r, i) {
    let a;
    for (let l = 0; l < t; l++)
      a = e[l * t + r], e[l * t + r] = e[l * t + i], e[l * t + i] = a;
  }
  function ot() {
    let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 3;
    const t = Array(e);
    for (let r = 0; r < e; ++r)
      t[r] = 0;
    return t;
  }
  const af = () => Math.PI;
  function of(e) {
    return e / 180 * Math.PI;
  }
  function lf(e) {
    return e * 180 / Math.PI;
  }
  const {
    round: ff,
    floor: uf,
    ceil: cf,
    min: hf,
    max: pf
  } = Math;
  function yf(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1, i = 1 / 0;
    for (let a = t, l = e.length; a < l; a += r)
      e[a] < i && (i = e[a]);
    return i;
  }
  function gf(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1, i = -1 / 0;
    for (let a = t, l = e.length; a < l; a += r)
      i < e[a] && (i = e[a]);
    return i;
  }
  function vf(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1, i = 1 / 0, a = -1 / 0;
    for (let l = t, u = e.length; l < u; l += r)
      e[l] < i && (i = e[l]), a < e[l] && (a = e[l]);
    return [i, a];
  }
  const mf = on("ceilLog2"), df = on("factorial");
  function gs(e) {
    let t = 1;
    for (; t < e; )
      t *= 2;
    return t;
  }
  function Cf(e) {
    return e === gs(e);
  }
  function Pf(e, t) {
    let r = 1;
    for (let i = 1; i <= t; ++i)
      r *= (e - i + 1) / i;
    return Math.floor(r);
  }
  function Tf(e, t) {
    if (e < t)
      return 0;
    const r = ot(t);
    for (let i = 0; i < t; ++i)
      r[i] = i;
    return r;
  }
  function xf(e, t, r) {
    let i = 0;
    for (let a = t - 1; a >= 0; --a)
      if (r[a] < e - t + a) {
        let l = r[a] + 1;
        for (; a < t; )
          r[a++] = l++;
        i = 1;
        break;
      }
    return i;
  }
  function If(e) {
    rf(`${e}`, {
      global: !0
    }), ys = e;
  }
  function Ef() {
    return ys;
  }
  function Sf() {
    let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
    const r = (arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1) - e;
    return e + r * Math.random();
  }
  const Of = on("gaussian");
  function vs(e, t, r) {
    return r[0] = e[0] + t[0], r[1] = e[1] + t[1], r[2] = e[2] + t[2], r;
  }
  function ie(e, t, r) {
    return r[0] = e[0] - t[0], r[1] = e[1] - t[1], r[2] = e[2] - t[2], r;
  }
  function ms(e, t) {
    return e[0] *= t, e[1] *= t, e[2] *= t, e;
  }
  function ds(e, t) {
    return e[0] *= t, e[1] *= t, e;
  }
  function nr(e, t, r, i) {
    return i[0] = e[0] + t[0] * r, i[1] = e[1] + t[1] * r, i[2] = e[2] + t[2] * r, i;
  }
  function Lf(e, t, r, i) {
    return i[0] = e[0] + t[0] * r, i[1] = e[1] + t[1] * r, i;
  }
  function q(e, t) {
    return e[0] * t[0] + e[1] * t[1] + e[2] * t[2];
  }
  function wf(e, t, r) {
    r[0] = e[0] * t[0], r[1] = e[0] * t[1], r[2] = e[0] * t[2], r[3] = e[1] * t[0], r[4] = e[1] * t[1], r[5] = e[1] * t[2], r[6] = e[2] * t[0], r[7] = e[2] * t[1], r[8] = e[2] * t[2];
  }
  function Oe(e, t, r) {
    const i = e[1] * t[2] - e[2] * t[1], a = e[2] * t[0] - e[0] * t[2], l = e[0] * t[1] - e[1] * t[0];
    return r[0] = i, r[1] = a, r[2] = l, r;
  }
  function ce(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 3;
    switch (t) {
      case 1:
        return Math.abs(e);
      case 2:
        return Math.sqrt(e[0] * e[0] + e[1] * e[1]);
      case 3:
        return Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2]);
      default: {
        let r = 0;
        for (let i = 0; i < t; i++)
          r += e[i] * e[i];
        return Math.sqrt(r);
      }
    }
  }
  function Fr(e) {
    const t = ce(e);
    return t !== 0 && (e[0] /= t, e[1] /= t, e[2] /= t), t;
  }
  function Nf(e, t, r, i) {
    const a = e[0] * e[0], l = e[1] * e[1], u = e[2] * e[2], c = Math.sqrt(a + l + u);
    let h, y, v;
    a > l && a > u ? (h = 0, y = 1, v = 2) : l > u ? (h = 1, y = 2, v = 0) : (h = 2, y = 0, v = 1);
    const d = e[h] / c, g = e[y] / c, m = e[v] / c, P = Math.sqrt(d * d + m * m);
    if (i !== 0) {
      const x = Math.sin(i), S = Math.cos(i);
      t && (t[h] = (m * S - d * g * x) / P, t[y] = x * P, t[v] = (-(d * S) - g * m * x) / P), r && (r[h] = (-(m * x) - d * g * S) / P, r[y] = S * P, r[v] = (d * x - g * m * S) / P);
    } else
      t && (t[h] = m / P, t[y] = 0, t[v] = -d / P), r && (r[h] = -d * g / P, r[y] = P, r[v] = -g * m / P);
  }
  function Mf(e, t, r) {
    const i = q(t, t);
    if (i === 0)
      return r[0] = 0, r[1] = 0, r[2] = 0, !1;
    const a = q(e, t) / i;
    for (let l = 0; l < 3; l++)
      r[l] = t[l];
    return ms(r, a), !0;
  }
  function rr(e, t) {
    return e[0] * t[0] + e[1] * t[1];
  }
  function Df(e, t, r) {
    const i = rr(t, t);
    if (i === 0)
      return r[0] = 0, r[1] = 0, !1;
    const a = rr(e, t) / i;
    for (let l = 0; l < 2; l++)
      r[l] = t[l];
    return ds(r, a), !0;
  }
  function qt(e, t) {
    return (e[0] - t[0]) * (e[0] - t[0]) + (e[1] - t[1]) * (e[1] - t[1]) + (e[2] - t[2]) * (e[2] - t[2]);
  }
  function Af(e, t) {
    const r = [0, 0, 0];
    return Oe(e, t, r), Math.atan2(ce(r), q(e, t));
  }
  function Xf(e, t, r) {
    const i = Math.abs(e - r);
    return 1 / Math.sqrt(2 * Math.PI * t) * Math.exp(-(i ** 2) / (2 * t));
  }
  function _f(e, t, r) {
    const i = Math.abs(e - r);
    return Math.exp(-(i ** 2) / (2 * t));
  }
  function Yf(e, t, r) {
    r[0] = e[0] * t[0], r[1] = e[0] * t[1], r[2] = e[1] * t[0], r[3] = e[1] * t[1];
  }
  function Cs(e) {
    return Math.sqrt(e[0] * e[0] + e[1] * e[1]);
  }
  function Bf(e) {
    const t = Cs(e);
    return t !== 0 && (e[0] /= t, e[1] /= t), t;
  }
  function ut() {
    for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
      t[r] = arguments[r];
    return t.length === 2 ? t[0][0] * t[1][1] - t[1][0] * t[0][1] : t.length === 4 ? t[0] * t[3] - t[1] * t[2] : Number.NaN;
  }
  function bf(e, t) {
    let r, i, a;
    const l = [0, 0, 0];
    for (let u = 0; u < 3; u++)
      a = Math.abs(e[u * 3]), (i = Math.abs(e[u * 3 + 1])) > a && (a = i), (i = Math.abs(e[u * 3 + 2])) > a && (a = i), l[u] = 1 / a;
    a = l[0] * Math.abs(e[0]), r = 0, (i = l[1] * Math.abs(e[3])) >= a && (a = i, r = 1), (i = l[2] * Math.abs(e[6])) >= a && (r = 2), r !== 0 && (nn(e, 3, r, 0), l[r] = l[0]), t[0] = r, e[3] /= e[0], e[6] /= e[0], e[4] -= e[3] * e[1], e[7] -= e[6] * e[1], a = l[1] * Math.abs(e[4]), r = 1, (i = l[2] * Math.abs(e[7])) >= a && (r = 2, nn(e, 3, 1, 2), l[2] = l[1]), t[1] = r, e[7] /= e[4], e[5] -= e[3] * e[2], e[8] -= e[6] * e[2] + e[7] * e[5], t[2] = 2;
  }
  function kf(e, t, r) {
    let i = r[t[0]];
    r[t[0]] = r[0], r[0] = i, i = r[t[1]], r[t[1]] = r[1], r[1] = i - e[3] * r[0], i = r[t[2]], r[t[2]] = r[2], r[2] = i - e[6] * r[0] - e[7] * r[1], r[2] /= e[8], r[1] = (r[1] - e[5] * r[2]) / e[4], r[0] = (r[0] - e[1] * r[1] - e[2] * r[2]) / e[0];
  }
  function Ff(e, t, r) {
    const i = e[0], a = e[1], l = e[2], u = e[3], c = e[4], h = e[5], y = e[6], v = e[7], d = e[8], g = +ut(c, v, h, d), m = -ut(u, y, h, d), P = +ut(u, y, c, v), x = -ut(a, v, l, d), S = +ut(i, y, l, d), L = -ut(i, y, a, v), N = +ut(a, c, l, h), M = -ut(i, u, l, h), E = +ut(i, u, a, c), w = i * g + a * m + l * P, A = g * t[0] + x * t[1] + N * t[2], X = m * t[0] + S * t[1] + M * t[2], _ = P * t[0] + L * t[1] + E * t[2];
    r[0] = A / w, r[1] = X / w, r[2] = _ / w;
  }
  function Rf(e, t, r) {
    const i = e[0] * t[0] + e[1] * t[1] + e[2] * t[2], a = e[3] * t[0] + e[4] * t[1] + e[5] * t[2], l = e[6] * t[0] + e[7] * t[1] + e[8] * t[2];
    r[0] = i, r[1] = a, r[2] = l;
  }
  function ir(e, t, r) {
    const i = [...e], a = [...t];
    for (let l = 0; l < 3; l++)
      r[l] = i[0] * a[l] + i[1] * a[l + 3] + i[2] * a[l + 6], r[l + 3] = i[3] * a[l] + i[4] * a[l + 3] + i[5] * a[l + 6], r[l + 6] = i[6] * a[l] + i[7] * a[l + 3] + i[8] * a[l + 6];
  }
  function Uf(e, t, r, i, a, l, u) {
    i !== a && ps("Number of columns of A must match number of rows of B.");
    const c = [...e], h = [...t];
    for (let y = 0; y < r; y++)
      for (let v = 0; v < l; v++) {
        u[y * l + v] = 0;
        for (let d = 0; d < i; d++)
          u[y * l + v] += c[y * i + d] * h[v + l * d];
      }
  }
  function Re(e, t) {
    let r;
    r = e[3], t[3] = e[1], t[1] = r, r = e[6], t[6] = e[2], t[2] = r, r = e[7], t[7] = e[5], t[5] = r, t[0] = e[0], t[4] = e[4], t[8] = e[8];
  }
  function $f(e, t) {
    const r = e[0], i = e[1], a = e[2], l = e[3], u = e[4], c = e[5], h = e[6], y = e[7], v = e[8], d = +ut(u, y, c, v), g = -ut(l, h, c, v), m = +ut(l, h, u, y), P = -ut(i, y, a, v), x = +ut(r, h, a, v), S = -ut(r, h, i, y), L = +ut(i, u, a, c), N = -ut(r, l, a, c), M = +ut(r, l, i, u), E = r * d + i * g + a * m;
    E === 0 && Se("Matrix has 0 determinant"), t[0] = d / E, t[3] = g / E, t[6] = m / E, t[1] = P / E, t[4] = x / E, t[7] = S / E, t[2] = L / E, t[5] = N / E, t[8] = M / E;
  }
  function Fn(e) {
    return e[0] * e[4] * e[8] + e[3] * e[7] * e[2] + e[6] * e[1] * e[5] - e[0] * e[7] * e[5] - e[3] * e[1] * e[8] - e[6] * e[4] * e[2];
  }
  function Ps(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : br;
    if (e.length !== t.length)
      return !1;
    function i(a, l) {
      return Math.abs(a - t[l]) <= r;
    }
    return e.every(i);
  }
  const Rn = Ps;
  function Ts(e) {
    for (let t = 0; t < 3; t++)
      e[t * 3] = e[t * 3 + 1] = e[t * 3 + 2] = 0, e[t * 3 + t] = 1;
  }
  function xs(e, t) {
    for (let r = 0; r < e; r++) {
      for (let i = 0; i < e; i++)
        t[r * e + i] = 0;
      t[r * e + r] = 1;
    }
    return t;
  }
  function Vf(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : br;
    return Rn(e, hs, t);
  }
  function Wf(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : br;
    return Rn(e, sf, t);
  }
  function Is(e, t) {
    const r = e[0] * e[0], i = e[0] * e[1], a = e[0] * e[2], l = e[0] * e[3], u = e[1] * e[1], c = e[2] * e[2], h = e[3] * e[3], y = e[1] * e[2], v = e[1] * e[3], d = e[2] * e[3], g = u + c + h;
    let m = 1 / (r + g);
    const P = (r - g) * m;
    m *= 2, t[0] = u * m + P, t[3] = (y + l) * m, t[6] = (v - a) * m, t[1] = (y - l) * m, t[4] = c * m + P, t[7] = (d + i) * m, t[2] = (v + a) * m, t[5] = (d - i) * m, t[8] = h * m + P;
  }
  function dn(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
    if (!`${e}`.includes("e"))
      return +`${Math.round(`${e}e+${t}`)}e-${t}`;
    const r = `${e}`.split("e");
    let i = "";
    return +r[1] + t > 0 && (i = "+"), +`${Math.round(`${+r[0]}e${i}${+r[1] + t}`)}e-${t}`;
  }
  function sr(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0, 0, 0], r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
    return t[0] = dn(e[0], r), t[1] = dn(e[1], r), t[2] = dn(e[2], r), t;
  }
  function ln(e, t, r, i) {
    let a, l, u, c, h, y, v, d, g, m, P, x, S, L, N, M;
    const E = ot(t), w = ot(t), A = (_, k, Y) => {
      L = _[k], S = _[Y], _[k] = L - x * (S + L * m), _[Y] = S + x * (L - S * m);
    };
    for (xs(t, i), h = 0; h < t; h++)
      E[h] = r[h] = e[h + h * t], w[h] = 0;
    for (a = 0; a < yi; a++) {
      for (P = 0, h = 0; h < t - 1; h++)
        for (c = h + 1; c < t; c++)
          P += Math.abs(e[h * t + c]);
      if (P === 0)
        break;
      for (a < 3 ? v = 0.2 * P / (t * t) : v = 0, h = 0; h < t - 1; h++)
        for (c = h + 1; c < t; c++)
          if (L = 100 * Math.abs(e[h * t + c]), a > 3 && Math.abs(r[h]) + L === Math.abs(r[h]) && Math.abs(r[c]) + L === Math.abs(r[c]))
            e[h * t + c] = 0;
          else if (Math.abs(e[h * t + c]) > v) {
            for (S = r[c] - r[h], Math.abs(S) + L === Math.abs(S) ? g = e[h * t + c] / S : (d = 0.5 * S / e[h * t + c], g = 1 / (Math.abs(d) + Math.sqrt(1 + d * d)), d < 0 && (g = -g)), N = 1 / Math.sqrt(1 + g * g), x = g * N, m = x / (1 + N), S = g * e[h * t + c], w[h] -= S, w[c] += S, r[h] -= S, r[c] += S, e[h * t + c] = 0, l = 0; l <= h - 1; l++)
              A(e, l * t + h, l * t + c);
            for (l = h + 1; l <= c - 1; l++)
              A(e, h * t + l, l * t + c);
            for (l = c + 1; l < t; l++)
              A(e, h * t + l, c * t + l);
            for (l = 0; l < t; l++)
              A(i, l * t + h, l * t + c);
          }
      for (h = 0; h < t; h++)
        E[h] += w[h], r[h] = E[h], w[h] = 0;
    }
    if (a >= yi)
      return Se("vtkMath::Jacobi: Error extracting eigenfunctions"), 0;
    for (l = 0; l < t - 1; l++) {
      for (u = l, M = r[u], a = l + 1; a < t; a++)
        (r[a] >= M || Math.abs(r[a] - M) < kr) && (u = a, M = r[u]);
      u !== l && (r[u] = r[l], r[l] = M, tn(i, t, l, u));
    }
    const X = (t >> 1) + (t & 1);
    for (y = 0, a = 0; a < t * t; a++)
      i[a] >= 0 && y++;
    if (y < X)
      for (a = 0; a < t; a++)
        i[a * t + l] *= -1;
    return 1;
  }
  function Es(e, t) {
    const r = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
    r[0] = e[0] + e[4] + e[8], r[5] = e[0] - e[4] - e[8], r[10] = -e[0] + e[4] - e[8], r[15] = -e[0] - e[4] + e[8], r[1] = r[4] = e[7] - e[5], r[2] = r[8] = e[2] - e[6], r[3] = r[12] = e[3] - e[1], r[6] = r[9] = e[3] + e[1], r[7] = r[13] = e[2] + e[6], r[11] = r[14] = e[7] + e[5];
    const i = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], a = [0, 0, 0, 0], l = [...r];
    ln(l, 4, a, i), t[0] = i[0], t[1] = i[4], t[2] = i[8], t[3] = i[12];
  }
  function zf(e, t, r) {
    const i = e[0] * t[0], a = e[0] * t[1], l = e[0] * t[2], u = e[0] * t[3], c = e[1] * t[0], h = e[1] * t[1], y = e[1] * t[2], v = e[1] * t[3], d = e[2] * t[0], g = e[2] * t[1], m = e[2] * t[2], P = e[2] * t[3], x = e[3] * t[0], S = e[3] * t[1], L = e[3] * t[2], N = e[3] * t[3];
    r[0] = i - h - m - N, r[1] = a + c + P - L, r[2] = l - v + d + S, r[3] = u + y - g + x;
  }
  function Ss(e, t) {
    for (let g = 0; g < 9; g++)
      t[g] = e[g];
    const r = ot(3), i = ot(3);
    let a;
    for (let g = 0; g < 3; g++) {
      const m = Math.abs(t[g * 3]), P = Math.abs(t[g * 3 + 1]), x = Math.abs(t[g * 3 + 2]);
      a = P > m ? P : m, a = x > a ? x : a, r[g] = 1, a !== 0 && (r[g] /= a);
    }
    const l = Math.abs(t[0]) * r[0], u = Math.abs(t[3]) * r[1], c = Math.abs(t[6]) * r[2];
    i[0] = 0, a = l, u >= a && (a = u, i[0] = 1), c >= a && (i[0] = 2), i[0] !== 0 && (tn(t, 3, i[0], 0), r[i[0]] = r[0]);
    const h = Math.abs(t[4]) * r[1], y = Math.abs(t[7]) * r[2];
    i[1] = 1, a = h, y >= a && (i[1] = 2, tn(t, 3, 1, 2)), i[2] = 2;
    let v = 0;
    if (Fn(t) < 0) {
      v = 1;
      for (let g = 0; g < 9; g++)
        t[g] = -t[g];
    }
    const d = ot(4);
    if (Es(t, d), Is(d, t), v)
      for (let g = 0; g < 9; g++)
        t[g] = -t[g];
    i[1] !== 1 && tn(t, 3, i[1], 1), i[0] !== 0 && tn(t, 3, i[0], 0);
  }
  function Os(e, t, r) {
    let i, a, l, u, c, h;
    const y = [...e];
    if (ln(y, 3, t, r), t[0] === t[1] && t[0] === t[2]) {
      Ts(r);
      return;
    }
    for (Re(r, r), i = 0; i < 3; i++)
      if (t[(i + 1) % 3] === t[(i + 2) % 3]) {
        for (h = Math.abs(r[i * 3]), u = 0, a = 1; a < 3; a++)
          h < (c = Math.abs(r[i * 3 + a])) && (h = c, u = a);
        u !== i && (c = t[u], t[u] = t[i], t[i] = c, nn(r, 3, i, u)), r[u * 3 + u] < 0 && (r[u * 3] = -r[u * 3], r[u * 3 + 1] = -r[u * 3 + 1], r[u * 3 + 2] = -r[u * 3 + 2]), a = (u + 1) % 3, l = (u + 2) % 3, r[a * 3] = 0, r[a * 3 + 1] = 0, r[a * 3 + 2] = 0, r[a * 3 + a] = 1;
        const v = Oe([r[u * 3], r[u * 3 + 1], r[u * 3 + 2]], [r[a * 3], r[a * 3 + 1], r[a * 3 + 2]], []);
        Fr(v);
        const d = Oe(v, [r[u * 3], r[u * 3 + 1], r[u * 3 + 2]], []);
        for (let g = 0; g < 3; g++)
          r[l * 3 + g] = v[g], r[a * 3 + g] = d[g];
        Re(r, r);
        return;
      }
    for (h = Math.abs(r[0]), u = 0, i = 1; i < 3; i++)
      h < (c = Math.abs(r[i * 3])) && (h = c, u = i);
    if (u !== 0) {
      const v = t[u];
      t[u] = t[0], t[0] = v, nn(r, 3, u, 0);
    }
    if (Math.abs(r[4]) < Math.abs(r[7])) {
      const v = t[2];
      t[2] = t[1], t[1] = v, nn(r, 3, 1, 2);
    }
    for (i = 0; i < 2; i++)
      r[i * 3 + i] < 0 && (r[i * 3] = -r[i * 3], r[i * 3 + 1] = -r[i * 3 + 1], r[i * 3 + 2] = -r[i * 3 + 2]);
    Fn(r) < 0 && (r[6] = -r[6], r[7] = -r[7], r[8] = -r[8]), Re(r, r);
  }
  function jf(e, t, r, i) {
    let a;
    const l = [...e], u = Fn(l);
    if (u < 0)
      for (a = 0; a < 9; a++)
        l[a] = -l[a];
    Ss(l, t), Re(l, l), ir(l, t, i), Os(i, r, i), ir(t, i, t), Re(i, i), u < 0 && (r[0] = -r[0], r[1] = -r[1], r[2] = -r[2]);
  }
  function Rr(e, t, r) {
    let i, a, l, u, c = 0, h, y, v;
    const d = ot(r);
    for (i = 0; i < r; i++) {
      for (u = 0, a = 0; a < r; a++)
        (v = Math.abs(e[i * r + a])) > u && (u = v);
      if (u === 0)
        return Se("Unable to factor linear system"), 0;
      d[i] = 1 / u;
    }
    for (a = 0; a < r; a++) {
      for (i = 0; i < a; i++) {
        for (h = e[i * r + a], l = 0; l < i; l++)
          h -= e[i * r + l] * e[l * r + a];
        e[i * r + a] = h;
      }
      for (u = 0, i = a; i < r; i++) {
        for (h = e[i * r + a], l = 0; l < a; l++)
          h -= e[i * r + l] * e[l * r + a];
        e[i * r + a] = h, (y = d[i] * Math.abs(h)) >= u && (u = y, c = i);
      }
      if (a !== c) {
        for (l = 0; l < r; l++)
          y = e[c * r + l], e[c * r + l] = e[a * r + l], e[a * r + l] = y;
        d[c] = d[a];
      }
      if (t[a] = c, Math.abs(e[a * r + a]) <= kr)
        return Se("Unable to factor linear system"), 0;
      if (a !== r - 1)
        for (y = 1 / e[a * r + a], i = a + 1; i < r; i++)
          e[i * r + a] *= y;
    }
    return 1;
  }
  function Ur(e, t, r, i) {
    let a, l, u, c, h;
    for (u = -1, a = 0; a < i; a++) {
      if (c = t[a], h = r[c], r[c] = r[a], u >= 0)
        for (l = u; l <= a - 1; l++)
          h -= e[a * i + l] * r[l];
      else h !== 0 && (u = a);
      r[a] = h;
    }
    for (a = i - 1; a >= 0; a--) {
      for (h = r[a], l = a + 1; l < i; l++)
        h -= e[a * i + l] * r[l];
      r[a] = h / e[a * i + a];
    }
  }
  function Ls(e, t, r) {
    if (r === 2) {
      const a = ot(2), l = ut(e[0], e[1], e[2], e[3]);
      return l === 0 ? 0 : (a[0] = (e[3] * t[0] - e[1] * t[1]) / l, a[1] = (-(e[2] * t[0]) + e[0] * t[1]) / l, t[0] = a[0], t[1] = a[1], 1);
    }
    if (r === 1)
      return e[0] === 0 ? 0 : (t[0] /= e[0], 1);
    const i = ot(r);
    return Rr(e, i, r) === 0 ? 0 : (Ur(e, i, t, r), 1);
  }
  function ws(e, t, r) {
    let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null, a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : null;
    const l = i || ot(r), u = a || ot(r);
    if (Rr(e, l, r) === 0)
      return null;
    for (let c = 0; c < r; c++) {
      for (let h = 0; h < r; h++)
        u[h] = 0;
      u[c] = 1, Ur(e, l, u, r);
      for (let h = 0; h < r; h++)
        t[h * r + c] = u[h];
    }
    return t;
  }
  function Gf(e, t) {
    let r = +Number.MAX_VALUE, i = -Number.MAX_VALUE;
    for (let a = 0; a < t; a++)
      for (let l = a; l < t; l++)
        Math.abs(e[a * t + l]) > i && (i = Math.abs(e[a * t + l]));
    for (let a = 0; a < t; a++)
      Math.abs(e[a * t + a]) < r && (r = Math.abs(e[a * t + a]));
    return r === 0 ? Number.MAX_VALUE : i / r;
  }
  function Zf(e, t, r) {
    return ln(e, 3, t, r);
  }
  function ar(e, t, r, i) {
    if (e < r)
      return Se("Insufficient number of samples. Underdetermined."), 0;
    let a, l, u;
    const c = ot(r * r), h = ot(r), y = ot(r * r);
    for (u = 0; u < e; u++)
      for (a = 0; a < r; a++)
        for (l = a; l < r; l++)
          c[a * r + l] += t[u * r + a] * t[u * r + l];
    for (a = 0; a < r; a++)
      for (l = 0; l < a; l++)
        c[a * r + l] = c[l * r + a];
    for (ln(c, r, h, y), a = 0; a < r; a++)
      i[a] = y[a * r + r - 1];
    return 1;
  }
  function Hf(e, t, r, i, a, l) {
    let u = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : !0;
    if (e < r || e < a)
      return Se("Insufficient number of samples. Underdetermined."), 0;
    const c = ot(a);
    let h = 1, y, v = 0, d, g, m, P = 0;
    if (u) {
      for (g = 0; g < a; g++)
        c[g] = 1;
      for (d = 0; d < e; d++)
        for (g = 0; g < a; g++)
          Math.abs(i[d * a + g]) > kr && (h = 0, c[g] = 0);
      if (h && a === 1)
        return Se("Detected homogeneous system (Y=0), calling SolveHomogeneousLeastSquares()"), ar(e, t, r, l);
      if (h)
        P = 1;
      else
        for (g = 0; g < a; g++)
          c[g] && (P = 1);
    }
    P && (y = ot(r), v = ar(e, t, r, y));
    const x = ot(r * r), S = ot(r * r), L = ot(r * a);
    for (m = 0; m < e; m++)
      for (d = 0; d < r; d++) {
        for (g = d; g < r; g++)
          x[d * r + g] += t[m * r + d] * t[m * r + g];
        for (g = 0; g < a; g++)
          L[d * a + g] += t[m * r + d] * i[m * a + g];
      }
    for (d = 0; d < r; d++)
      for (g = 0; g < d; g++)
        x[d * r + g] = x[g * r + d];
    const N = ws(x, S, r);
    if (N)
      for (d = 0; d < r; d++)
        for (g = 0; g < a; g++)
          for (l[d * a + g] = 0, m = 0; m < r; m++)
            l[d * a + g] += S[d * r + m] * L[m * a + g];
    if (P) {
      for (g = 0; g < a; g++)
        if (c[g])
          for (d = 0; d < r; d++)
            l[d * a + g] = y[d * a];
    }
    return P ? v && N : N;
  }
  function qf(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0, 0.5, 1];
    switch (e.length) {
      case 3:
        return t[0] = parseInt(e[0], 16) * 17 / 255, t[1] = parseInt(e[1], 16) * 17 / 255, t[2] = parseInt(e[2], 16) * 17 / 255, t;
      case 4:
        return t[0] = parseInt(e[1], 16) * 17 / 255, t[1] = parseInt(e[2], 16) * 17 / 255, t[2] = parseInt(e[3], 16) * 17 / 255, t;
      case 6:
        return t[0] = parseInt(e.substr(0, 2), 16) / 255, t[1] = parseInt(e.substr(2, 2), 16) / 255, t[2] = parseInt(e.substr(4, 2), 16) / 255, t;
      case 7:
        return t[0] = parseInt(e.substr(1, 2), 16) / 255, t[1] = parseInt(e.substr(3, 2), 16) / 255, t[2] = parseInt(e.substr(5, 2), 16) / 255, t;
      case 9:
        return t[0] = parseInt(e.substr(1, 2), 16) / 255, t[1] = parseInt(e.substr(3, 2), 16) / 255, t[2] = parseInt(e.substr(5, 2), 16) / 255, t[3] = parseInt(e.substr(7, 2), 16) / 255, t;
      default:
        return t;
    }
  }
  function Jf(e, t) {
    let r, i;
    const [a, l, u] = e, c = 1 / 3, h = 1 / 6, y = 2 / 3;
    let v = a, d = a;
    l > v ? v = l : l < d && (d = l), u > v ? v = u : u < d && (d = u);
    const g = v;
    g > 0 ? i = (v - d) / v : i = 0, i > 0 ? (a === v ? r = h * (l - u) / (v - d) : l === v ? r = c + h * (u - a) / (v - d) : r = y + h * (a - l) / (v - d), r < 0 && (r += 1)) : r = 0, t[0] = r, t[1] = i, t[2] = g;
  }
  function Kf(e, t) {
    const [r, i, a] = e, l = 1 / 3, u = 1 / 6, c = 2 / 3, h = 5 / 6;
    let y, v, d;
    r > u && r <= l ? (v = 1, y = (l - r) / u, d = 0) : r > l && r <= 0.5 ? (v = 1, d = (r - l) / u, y = 0) : r > 0.5 && r <= c ? (d = 1, v = (c - r) / u, y = 0) : r > c && r <= h ? (d = 1, y = (r - c) / u, v = 0) : r > h && r <= 1 ? (y = 1, d = (1 - r) / u, v = 0) : (y = 1, v = r / u, d = 0), y = i * y + (1 - i), v = i * v + (1 - i), d = i * d + (1 - i), y *= a, v *= a, d *= a, t[0] = y, t[1] = v, t[2] = d;
  }
  function Ns(e, t) {
    const [r, i, a] = e;
    let l = (r + 16) / 116, u = i / 500 + l, c = l - a / 200;
    l ** 3 > 8856e-6 ? l **= 3 : l = (l - 16 / 116) / 7.787, u ** 3 > 8856e-6 ? u **= 3 : u = (u - 16 / 116) / 7.787, c ** 3 > 8856e-6 ? c **= 3 : c = (c - 16 / 116) / 7.787;
    const h = 0.9505, y = 1, v = 1.089;
    t[0] = h * u, t[1] = y * l, t[2] = v * c;
  }
  function Ms(e, t) {
    const [r, i, a] = e, l = 0.9505, u = 1, c = 1.089;
    let h = r / l, y = i / u, v = a / c;
    h > 8856e-6 ? h **= 1 / 3 : h = 7.787 * h + 16 / 116, y > 8856e-6 ? y **= 1 / 3 : y = 7.787 * y + 16 / 116, v > 8856e-6 ? v **= 1 / 3 : v = 7.787 * v + 16 / 116, t[0] = 116 * y - 16, t[1] = 500 * (h - y), t[2] = 200 * (y - v);
  }
  function Ds(e, t) {
    const [r, i, a] = e;
    let l = r * 3.2406 + i * -1.5372 + a * -0.4986, u = r * -0.9689 + i * 1.8758 + a * 0.0415, c = r * 0.0557 + i * -0.204 + a * 1.057;
    l > 31308e-7 ? l = 1.055 * l ** (1 / 2.4) - 0.055 : l *= 12.92, u > 31308e-7 ? u = 1.055 * u ** (1 / 2.4) - 0.055 : u *= 12.92, c > 31308e-7 ? c = 1.055 * c ** (1 / 2.4) - 0.055 : c *= 12.92;
    let h = l;
    h < u && (h = u), h < c && (h = c), h > 1 && (l /= h, u /= h, c /= h), l < 0 && (l = 0), u < 0 && (u = 0), c < 0 && (c = 0), t[0] = l, t[1] = u, t[2] = c;
  }
  function As(e, t) {
    let [r, i, a] = e;
    r > 0.04045 ? r = ((r + 0.055) / 1.055) ** 2.4 : r /= 12.92, i > 0.04045 ? i = ((i + 0.055) / 1.055) ** 2.4 : i /= 12.92, a > 0.04045 ? a = ((a + 0.055) / 1.055) ** 2.4 : a /= 12.92, t[0] = r * 0.4124 + i * 0.3576 + a * 0.1805, t[1] = r * 0.2126 + i * 0.7152 + a * 0.0722, t[2] = r * 0.0193 + i * 0.1192 + a * 0.9505;
  }
  function Qf(e, t) {
    const r = [0, 0, 0];
    As(e, r), Ms(r, t);
  }
  function tu(e, t) {
    const r = [0, 0, 0];
    Ns(e, r), Ds(r, t);
  }
  function Xs(e) {
    return e[0] = 1, e[1] = -1, e[2] = 1, e[3] = -1, e[4] = 1, e[5] = -1, e;
  }
  function eu(e) {
    return !(e[1] - e[0] < 0);
  }
  function nu(e, t, r) {
    return r[0] = Math.min(e[0], t[0]), r[1] = Math.max(e[0], t[0]), r[2] = Math.min(e[1], t[1]), r[3] = Math.max(e[1], t[1]), r[4] = Math.min(e[2], t[2]), r[5] = Math.max(e[2], t[2]), r;
  }
  function Cn(e, t, r) {
    return e < t ? t : e > r ? r : e;
  }
  function or(e, t, r) {
    let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : [0, 0, 0];
    return i[0] = Cn(e[0], t[0], r[0]), i[1] = Cn(e[1], t[1], r[1]), i[2] = Cn(e[2], t[2], r[2]), i;
  }
  function ru(e, t) {
    let r = 0;
    return t[0] !== t[1] && (e < t[0] ? r = t[0] : e > t[1] ? r = t[1] : r = e, r = (r - t[0]) / (t[1] - t[0])), r;
  }
  const iu = on("GetScalarTypeFittingRange"), su = on("GetAdjustedScalarRange");
  function au(e, t) {
    if (!e || !t)
      return 0;
    for (let r = 0; r < 6; r += 2)
      if (e[r] < t[r] || e[r] > t[r + 1] || e[r + 1] < t[r] || e[r + 1] > t[r + 1])
        return 0;
    return 1;
  }
  function ou(e, t, r) {
    if (!e || !t)
      return 0;
    for (let i = 0; i < 6; i += 2)
      if (e[i] + r[i / 2] < t[i] || e[i] - r[i / 2] > t[i + 1] || e[i + 1] + r[i / 2] < t[i] || e[i + 1] - r[i / 2] > t[i + 1])
        return 0;
    return 1;
  }
  function lu(e, t, r) {
    if (!e || !t || !r)
      return 0;
    for (let i = 0; i < 3; i++)
      if (e[i] + r[i] < t[2 * i] || e[i] - r[i] > t[2 * i + 1])
        return 0;
    return 1;
  }
  function fu(e, t, r, i) {
    const a = ot(3), l = ot(3), u = ot(3), c = ot(3), h = ot(3), y = ot(3);
    for (let E = 0; E < 3; ++E)
      a[E] = e[E] - t[E], l[E] = t[E] - r[E], u[E] = r[E] - e[E], c[E] = -a[E], h[E] = -l[E], y[E] = -u[E];
    const v = ce(c), d = ce(h), g = ce(u), m = ot(3);
    Oe(a, l, m);
    const P = ce(m), x = v * d * g / (2 * P), S = 2 * P * P, L = d * d * q(a, y) / S, N = g * g * q(c, l) / S, M = v * v * q(u, h) / S;
    for (let E = 0; E < 3; ++E)
      i[E] = L * e[E] + N * t[E] + M * r[E];
    return x;
  }
  const uu = 1 / 0, cu = -1 / 0, hu = (e) => !Number.isFinite(e), {
    isFinite: pu,
    isNaN: gi
  } = Number;
  function yu() {
    return [].concat([
      Number.MAX_VALUE,
      -Number.MAX_VALUE,
      // X
      Number.MAX_VALUE,
      -Number.MAX_VALUE,
      // Y
      Number.MAX_VALUE,
      -Number.MAX_VALUE
      // Z
    ]);
  }
  function gu(e) {
    let t = -1, r = -1;
    for (let i = 0; i < e.length; i++) {
      const a = Math.abs(e[i]);
      a > t && (r = i, t = a);
    }
    return r;
  }
  function vu(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 3;
    const r = new Array(t), i = new Array(t);
    for (let l = 0; l < t; ++l)
      r[l] = l, i[l] = l;
    for (let l = t - 1; l > 0; l--) {
      let u = -1 / 0, c = 0, h = 0;
      for (let y = 0; y <= l; ++y) {
        const v = r[y];
        for (let d = 0; d <= l; ++d) {
          const g = i[d], m = Math.abs(e[v + t * g]);
          m > u && (u = m, c = y, h = d);
        }
      }
      [r[l], r[c]] = [r[c], r[l]], [i[l], i[h]] = [i[h], i[l]];
    }
    const a = new Array(t * t).fill(0);
    for (let l = 0; l < t; ++l) {
      const u = r[l] + t * i[l];
      a[u] = e[u] < 0 ? -1 : 1;
    }
    return a;
  }
  function _s(e) {
    const t = Math.floor(e * 255);
    return t > 15 ? t.toString(16) : `0${t.toString(16)}`;
  }
  function mu(e) {
    return `${arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "#"}${e.map(_s).join("")}`;
  }
  function hn(e) {
    return Math.round(e * 255);
  }
  function du(e) {
    return e.length === 3 ? `rgb(${e.map(hn).join(", ")})` : `rgba(${hn(e[0] || 0)}, ${hn(e[1] || 0)}, ${hn(e[2] || 0)}, ${e[3] || 0})`;
  }
  var Cu = {
    Pi: af,
    radiansFromDegrees: of,
    degreesFromRadians: lf,
    round: ff,
    floor: uf,
    ceil: cf,
    ceilLog2: mf,
    min: hf,
    max: pf,
    arrayMin: yf,
    arrayMax: gf,
    arrayRange: vf,
    isPowerOfTwo: Cf,
    nearestPowerOfTwo: gs,
    factorial: df,
    binomial: Pf,
    beginCombination: Tf,
    nextCombination: xf,
    randomSeed: If,
    getSeed: Ef,
    random: Sf,
    gaussian: Of,
    add: vs,
    subtract: ie,
    multiplyScalar: ms,
    multiplyScalar2D: ds,
    multiplyAccumulate: nr,
    multiplyAccumulate2D: Lf,
    dot: q,
    outer: wf,
    cross: Oe,
    norm: ce,
    normalize: Fr,
    perpendiculars: Nf,
    projectVector: Mf,
    projectVector2D: Df,
    distance2BetweenPoints: qt,
    angleBetweenVectors: Af,
    gaussianAmplitude: Xf,
    gaussianWeight: _f,
    dot2D: rr,
    outer2D: Yf,
    norm2D: Cs,
    normalize2D: Bf,
    determinant2x2: ut,
    LUFactor3x3: bf,
    LUSolve3x3: kf,
    linearSolve3x3: Ff,
    multiply3x3_vect3: Rf,
    multiply3x3_mat3: ir,
    multiplyMatrix: Uf,
    transpose3x3: Re,
    invert3x3: $f,
    identity3x3: Ts,
    identity: xs,
    isIdentity: Vf,
    isIdentity3x3: Wf,
    determinant3x3: Fn,
    quaternionToMatrix3x3: Is,
    areEquals: Ps,
    areMatricesEqual: Rn,
    roundNumber: dn,
    roundVector: sr,
    matrix3x3ToQuaternion: Es,
    multiplyQuaternion: zf,
    orthogonalize3x3: Ss,
    diagonalize3x3: Os,
    singularValueDecomposition3x3: jf,
    solveLinearSystem: Ls,
    invertMatrix: ws,
    luFactorLinearSystem: Rr,
    luSolveLinearSystem: Ur,
    estimateMatrixCondition: Gf,
    jacobi: Zf,
    jacobiN: ln,
    solveHomogeneousLeastSquares: ar,
    solveLeastSquares: Hf,
    hex2float: qf,
    rgb2hsv: Jf,
    hsv2rgb: Kf,
    lab2xyz: Ns,
    xyz2lab: Ms,
    xyz2rgb: Ds,
    rgb2xyz: As,
    rgb2lab: Qf,
    lab2rgb: tu,
    uninitializeBounds: Xs,
    areBoundsInitialized: eu,
    computeBoundsFromPoints: nu,
    clampValue: Cn,
    clampVector: or,
    clampAndNormalizeValue: ru,
    getScalarTypeFittingRange: iu,
    getAdjustedScalarRange: su,
    extentIsWithinOtherExtent: au,
    boundsIsWithinOtherBounds: ou,
    pointIsWithinBounds: lu,
    solve3PointCircle: fu,
    inf: uu,
    negInf: cu,
    isInf: hu,
    isNan: gi,
    isNaN: gi,
    isFinite: pu,
    // JS add-on
    createUninitializedBounds: yu,
    getMajorAxisIndex: gu,
    getSparseOrthogonalMatrix: vu,
    floatToHex2: _s,
    floatRGB2HexCode: mu,
    float2CssRGBA: du
  };
  const Pu = {
    Int8Array: 1,
    Uint8Array: 1,
    Uint8ClampedArray: 1,
    Int16Array: 2,
    Uint16Array: 2,
    Int32Array: 4,
    Uint32Array: 4,
    Float32Array: 4,
    Float64Array: 8
  }, he = {
    VOID: "",
    // not sure to know what that should be
    CHAR: "Int8Array",
    SIGNED_CHAR: "Int8Array",
    UNSIGNED_CHAR: "Uint8Array",
    UNSIGNED_CHAR_CLAMPED: "Uint8ClampedArray",
    // should be used for VTK.js internal purpose only
    SHORT: "Int16Array",
    UNSIGNED_SHORT: "Uint16Array",
    INT: "Int32Array",
    UNSIGNED_INT: "Uint32Array",
    FLOAT: "Float32Array",
    DOUBLE: "Float64Array"
  }, Tu = he.FLOAT;
  var Ys = {
    DefaultDataType: Tu,
    DataTypeByteSize: Pu,
    VtkDataTypes: he
  };
  const {
    vtkErrorMacro: xu
  } = Fl, {
    DefaultDataType: Iu
  } = Ys, Eu = 1e-6;
  function lr(e, t, r) {
    const i = e.length;
    let a = Number.MAX_VALUE, l = -Number.MAX_VALUE, u, c;
    for (c = t; c < i; c += r)
      if (!Number.isNaN(e[c])) {
        a = e[c], l = a;
        break;
      }
    for (; c < i; c += r)
      u = e[c], u < a ? a = u : u > l && (l = u);
    return {
      min: a,
      max: l
    };
  }
  function Su() {
    let e = Number.MAX_VALUE, t = -Number.MAX_VALUE, r = 0, i = 0;
    return {
      add(a) {
        e > a && (e = a), t < a && (t = a), r++, i += a;
      },
      get() {
        return {
          min: e,
          max: t,
          count: r,
          sum: i,
          mean: i / r
        };
      },
      getRange() {
        return {
          min: e,
          max: t
        };
      }
    };
  }
  function Bs(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
    if (t < 0 && r > 1) {
      const a = e.length / r, l = new Float64Array(a);
      for (let u = 0, c = 0; u < a; ++u) {
        for (let h = c + r; c < h; ++c)
          l[u] += e[c] * e[c];
        l[u] **= 0.5;
      }
      return lr(l, 0, 1);
    }
    return lr(e, t < 0 ? 0 : t, r);
  }
  function vi(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
    const r = e || [];
    for (; r.length <= t; )
      r.push(null);
    return r;
  }
  function $r(e) {
    return Object.prototype.toString.call(e).slice(8, -1);
  }
  function Ou(e) {
    const t = e.getNumberOfComponents();
    let r = 0;
    const i = new Array(t);
    for (let a = 0; a < e.getNumberOfTuples(); ++a) {
      e.getTuple(a, i);
      const l = ce(i, t);
      l > r && (r = l);
    }
    return r;
  }
  const Lu = {
    computeRange: Bs,
    createRangeHelper: Su,
    fastComputeRange: lr,
    getDataType: $r,
    getMaxNorm: Ou
  };
  function wu(e, t) {
    t.classHierarchy.push("vtkDataArray");
    function r(i) {
      if (i < 0)
        return !1;
      const a = e.getNumberOfComponents(), l = t.values.length / (a > 0 ? a : 1);
      if (i === l)
        return !0;
      if (i > l) {
        const u = t.values;
        return t.values = Bn(t.dataType, (i + l) * a), t.values.set(u), !0;
      }
      return t.size > i * a && (t.size = i * a, e.dataChange()), !0;
    }
    e.dataChange = () => {
      t.ranges = null, e.modified();
    }, e.resize = (i) => {
      r(i);
      const a = i * e.getNumberOfComponents();
      return t.size !== a ? (t.size = a, e.dataChange(), !0) : !1;
    }, e.initialize = () => {
      e.resize(0);
    }, e.getElementComponentSize = () => t.values.BYTES_PER_ELEMENT, e.getComponent = function(i) {
      let a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      return t.values[i * t.numberOfComponents + a];
    }, e.setComponent = (i, a, l) => {
      l !== t.values[i * t.numberOfComponents + a] && (t.values[i * t.numberOfComponents + a] = l, e.dataChange());
    }, e.getValue = (i) => {
      const a = i / t.numberOfComponents, l = i % t.numberOfComponents;
      return e.getComponent(a, l);
    }, e.setValue = (i, a) => {
      const l = i / t.numberOfComponents, u = i % t.numberOfComponents;
      e.setComponent(l, u, a);
    }, e.getData = () => t.size === t.values.length ? t.values : t.values.subarray(0, t.size), e.getRange = function() {
      let i = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : -1, a = i;
      a < 0 && (a = t.numberOfComponents === 1 ? 0 : t.numberOfComponents);
      let l = null;
      return t.ranges || (t.ranges = vi(t.ranges, t.numberOfComponents)), l = t.ranges[a], l ? (t.rangeTuple[0] = l.min, t.rangeTuple[1] = l.max, t.rangeTuple) : (l = Bs(e.getData(), i, t.numberOfComponents), t.ranges[a] = l, t.rangeTuple[0] = l.min, t.rangeTuple[1] = l.max, t.rangeTuple);
    }, e.setRange = (i, a) => {
      t.ranges || (t.ranges = vi(t.ranges, t.numberOfComponents));
      const l = {
        min: i.min,
        max: i.max
      };
      return t.ranges[a] = l, t.rangeTuple[0] = l.min, t.rangeTuple[1] = l.max, t.rangeTuple;
    }, e.setTuple = (i, a) => {
      const l = i * t.numberOfComponents;
      for (let u = 0; u < t.numberOfComponents; u++)
        t.values[l + u] = a[u];
    }, e.setTuples = (i, a) => {
      let l = i * t.numberOfComponents;
      const u = Math.min(a.length, t.size - l);
      for (let c = 0; c < u; )
        t.values[l++] = a[c++];
    }, e.insertTuple = (i, a) => (t.size <= i * t.numberOfComponents && (t.size = (i + 1) * t.numberOfComponents, r(i + 1)), e.setTuple(i, a), i), e.insertTuples = (i, a) => {
      const l = i + a.length / t.numberOfComponents;
      return t.size < l * t.numberOfComponents && (t.size = l * t.numberOfComponents, r(l)), e.setTuples(i, a), l;
    }, e.insertNextTuple = (i) => {
      const a = t.size / t.numberOfComponents;
      return e.insertTuple(a, i);
    }, e.insertNextTuples = (i) => {
      const a = t.size / t.numberOfComponents;
      return e.insertTuples(a, i);
    }, e.findTuple = function(i) {
      let a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Eu;
      for (let l = 0; l < t.size; l += t.numberOfComponents)
        if (Math.abs(i[0] - t.values[l]) <= a) {
          let u = !0;
          for (let c = 1; c < t.numberOfComponents; ++c)
            if (Math.abs(i[c] - t.values[l + c]) > a) {
              u = !1;
              break;
            }
          if (u)
            return l / t.numberOfComponents;
        }
      return -1;
    }, e.getTuple = function(i) {
      let a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
      const l = t.numberOfComponents || 1, u = i * l;
      switch (l) {
        case 4:
          a[3] = t.values[u + 3];
        case 3:
          a[2] = t.values[u + 2];
        case 2:
          a[1] = t.values[u + 1];
        case 1:
          a[0] = t.values[u];
          break;
        default:
          for (let c = l - 1; c >= 0; --c)
            a[c] = t.values[u + c];
      }
      return a;
    }, e.getTuples = (i, a) => {
      const l = (i ?? 0) * t.numberOfComponents, u = (a ?? e.getNumberOfTuples()) * t.numberOfComponents, c = e.getData().subarray(l, u);
      return c.length > 0 ? c : null;
    }, e.getTupleLocation = function() {
      return (arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1) * t.numberOfComponents;
    }, e.getNumberOfComponents = () => t.numberOfComponents, e.getNumberOfValues = () => t.size, e.getNumberOfTuples = () => t.size / t.numberOfComponents, e.getDataType = () => t.dataType, e.newClone = () => ks({
      empty: !0,
      name: t.name,
      dataType: t.dataType,
      numberOfComponents: t.numberOfComponents
    }), e.getName = () => (t.name || (e.modified(), t.name = `vtkDataArray${e.getMTime()}`), t.name), e.setData = (i, a) => {
      t.values = i, t.size = i.length, t.dataType = $r(i), a && (t.numberOfComponents = a), t.size % t.numberOfComponents !== 0 && (t.numberOfComponents = 1), e.dataChange();
    }, e.getState = () => {
      if (t.deleted)
        return null;
      const i = {
        ...t,
        vtkClass: e.getClassName()
      };
      i.values = Array.from(i.values), delete i.buffer, Object.keys(i).forEach((l) => {
        i[l] || delete i[l];
      });
      const a = {};
      return Object.keys(i).sort().forEach((l) => {
        a[l] = i[l];
      }), a.mtime && delete a.mtime, a;
    }, e.deepCopy = (i) => {
      const a = e.getDataType(), l = t.values;
      e.shallowCopy(i), (l == null ? void 0 : l.length) >= i.getNumberOfValues() && a === i.getDataType() ? (l.set(i.getData()), t.values = l, e.dataChange()) : e.setData(i.getData().slice());
    }, e.interpolateTuple = (i, a, l, u, c, h) => {
      const y = t.numberOfComponents || 1;
      (y !== a.getNumberOfComponents() || y !== u.getNumberOfComponents()) && xu("numberOfComponents must match");
      const v = a.getTuple(l), d = u.getTuple(c), g = [];
      switch (g.length = y, y) {
        case 4:
          g[3] = v[3] + (d[3] - v[3]) * h;
        case 3:
          g[2] = v[2] + (d[2] - v[2]) * h;
        case 2:
          g[1] = v[1] + (d[1] - v[1]) * h;
        case 1:
          g[0] = v[0] + (d[0] - v[0]) * h;
          break;
        default:
          for (let m = 0; m < y; m++)
            g[m] = v[m] + (d[m] - v[m]) * h;
      }
      return e.insertTuple(i, g);
    };
  }
  const Nu = {
    name: "",
    numberOfComponents: 1,
    dataType: Iu,
    rangeTuple: [0, 0]
    // size: undefined,
    // values: null,
    // ranges: null,
  };
  function bs(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    if (Object.assign(t, Nu, r), !t.empty && !t.values && !t.size)
      throw new TypeError("Cannot create vtkDataArray object without: size > 0, values");
    if (t.values ? Array.isArray(t.values) && (t.values = Tr(t.dataType, t.values)) : t.values = Bn(t.dataType, t.size), t.values && (t.size = t.size ?? t.values.length, t.dataType = $r(t.values)), Ir(e, t), kn(e, t, ["name", "numberOfComponents"]), t.size % t.numberOfComponents !== 0)
      throw new RangeError("model.size is not a multiple of model.numberOfComponents");
    wu(e, t);
  }
  const ks = wr(bs, "vtkDataArray");
  var Le = {
    newInstance: ks,
    extend: bs,
    ...Lu,
    ...Ys
  };
  function Mu() {
    var e;
    return ((e = crypto.randomUUID) == null ? void 0 : e.call(crypto)) || ("10000000-1000-4000-8000" + -1e11).replace(/[018]/g, (t) => (t ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> t / 4).toString(16));
  }
  function Fs(e, t, r) {
    return Math.abs(e - t) <= r;
  }
  function Du(e, t, r = 1e-5) {
    if (e.length !== t.length)
      return !1;
    for (let i = 0; i < e.length; i++)
      if (!Fs(e[i], t[i], r))
        return !1;
    return !0;
  }
  function mi(e) {
    return typeof e == "number";
  }
  function di(e) {
    return "length" in e && typeof e[0] == "number";
  }
  function Ci(e, t, r = 1e-5) {
    return typeof e != typeof t || e === null || t === null ? !1 : mi(e) && mi(t) ? Fs(e, t, r) : di(e) && di(t) ? Du(e, t, r) : !1;
  }
  var Vr = 1e-6, se = typeof Float32Array < "u" ? Float32Array : Array, Au = Math.PI / 180;
  function Xu(e) {
    return e * Au;
  }
  Math.hypot || (Math.hypot = function() {
    for (var e = 0, t = arguments.length; t--; )
      e += arguments[t] * arguments[t];
    return Math.sqrt(e);
  });
  function _u() {
    var e = new se(9);
    return se != Float32Array && (e[1] = 0, e[2] = 0, e[3] = 0, e[5] = 0, e[6] = 0, e[7] = 0), e[0] = 1, e[4] = 1, e[8] = 1, e;
  }
  function Yu(e) {
    return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 1, e[5] = 0, e[6] = 0, e[7] = 0, e[8] = 1, e;
  }
  function Pn(e, t) {
    return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[4] = t[4], e[5] = t[5], e[6] = t[6], e[7] = t[7], e[8] = t[8], e[9] = t[9], e[10] = t[10], e[11] = t[11], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15], e;
  }
  function Te(e) {
    return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = 1, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 1, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e;
  }
  function wn(e, t) {
    var r = t[0], i = t[1], a = t[2], l = t[3], u = t[4], c = t[5], h = t[6], y = t[7], v = t[8], d = t[9], g = t[10], m = t[11], P = t[12], x = t[13], S = t[14], L = t[15], N = r * c - i * u, M = r * h - a * u, E = r * y - l * u, w = i * h - a * c, A = i * y - l * c, X = a * y - l * h, _ = v * x - d * P, k = v * S - g * P, Y = v * L - m * P, F = d * S - g * x, W = d * L - m * x, U = g * L - m * S, R = N * U - M * W + E * F + w * Y - A * k + X * _;
    return R ? (R = 1 / R, e[0] = (c * U - h * W + y * F) * R, e[1] = (a * W - i * U - l * F) * R, e[2] = (x * X - S * A + L * w) * R, e[3] = (g * A - d * X - m * w) * R, e[4] = (h * Y - u * U - y * k) * R, e[5] = (r * U - a * Y + l * k) * R, e[6] = (S * E - P * X - L * M) * R, e[7] = (v * X - g * E + m * M) * R, e[8] = (u * W - c * Y + y * _) * R, e[9] = (i * Y - r * W - l * _) * R, e[10] = (P * A - x * E + L * N) * R, e[11] = (d * E - v * A - m * N) * R, e[12] = (c * k - u * F - h * _) * R, e[13] = (r * F - i * k + a * _) * R, e[14] = (x * M - P * w - S * N) * R, e[15] = (v * w - d * M + g * N) * R, e) : null;
  }
  function xe(e, t, r) {
    var i = t[0], a = t[1], l = t[2], u = t[3], c = t[4], h = t[5], y = t[6], v = t[7], d = t[8], g = t[9], m = t[10], P = t[11], x = t[12], S = t[13], L = t[14], N = t[15], M = r[0], E = r[1], w = r[2], A = r[3];
    return e[0] = M * i + E * c + w * d + A * x, e[1] = M * a + E * h + w * g + A * S, e[2] = M * l + E * y + w * m + A * L, e[3] = M * u + E * v + w * P + A * N, M = r[4], E = r[5], w = r[6], A = r[7], e[4] = M * i + E * c + w * d + A * x, e[5] = M * a + E * h + w * g + A * S, e[6] = M * l + E * y + w * m + A * L, e[7] = M * u + E * v + w * P + A * N, M = r[8], E = r[9], w = r[10], A = r[11], e[8] = M * i + E * c + w * d + A * x, e[9] = M * a + E * h + w * g + A * S, e[10] = M * l + E * y + w * m + A * L, e[11] = M * u + E * v + w * P + A * N, M = r[12], E = r[13], w = r[14], A = r[15], e[12] = M * i + E * c + w * d + A * x, e[13] = M * a + E * h + w * g + A * S, e[14] = M * l + E * y + w * m + A * L, e[15] = M * u + E * v + w * P + A * N, e;
  }
  function Bu(e, t, r) {
    var i = r[0], a = r[1], l = r[2], u, c, h, y, v, d, g, m, P, x, S, L;
    return t === e ? (e[12] = t[0] * i + t[4] * a + t[8] * l + t[12], e[13] = t[1] * i + t[5] * a + t[9] * l + t[13], e[14] = t[2] * i + t[6] * a + t[10] * l + t[14], e[15] = t[3] * i + t[7] * a + t[11] * l + t[15]) : (u = t[0], c = t[1], h = t[2], y = t[3], v = t[4], d = t[5], g = t[6], m = t[7], P = t[8], x = t[9], S = t[10], L = t[11], e[0] = u, e[1] = c, e[2] = h, e[3] = y, e[4] = v, e[5] = d, e[6] = g, e[7] = m, e[8] = P, e[9] = x, e[10] = S, e[11] = L, e[12] = u * i + v * a + P * l + t[12], e[13] = c * i + d * a + x * l + t[13], e[14] = h * i + g * a + S * l + t[14], e[15] = y * i + m * a + L * l + t[15]), e;
  }
  function Rs(e, t, r) {
    var i = r[0], a = r[1], l = r[2];
    return e[0] = t[0] * i, e[1] = t[1] * i, e[2] = t[2] * i, e[3] = t[3] * i, e[4] = t[4] * a, e[5] = t[5] * a, e[6] = t[6] * a, e[7] = t[7] * a, e[8] = t[8] * l, e[9] = t[9] * l, e[10] = t[10] * l, e[11] = t[11] * l, e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15], e;
  }
  function bu(e, t, r, i) {
    var a = i[0], l = i[1], u = i[2], c = Math.hypot(a, l, u), h, y, v, d, g, m, P, x, S, L, N, M, E, w, A, X, _, k, Y, F, W, U, R, j;
    return c < Vr ? null : (c = 1 / c, a *= c, l *= c, u *= c, h = Math.sin(r), y = Math.cos(r), v = 1 - y, d = t[0], g = t[1], m = t[2], P = t[3], x = t[4], S = t[5], L = t[6], N = t[7], M = t[8], E = t[9], w = t[10], A = t[11], X = a * a * v + y, _ = l * a * v + u * h, k = u * a * v - l * h, Y = a * l * v - u * h, F = l * l * v + y, W = u * l * v + a * h, U = a * u * v + l * h, R = l * u * v - a * h, j = u * u * v + y, e[0] = d * X + x * _ + M * k, e[1] = g * X + S * _ + E * k, e[2] = m * X + L * _ + w * k, e[3] = P * X + N * _ + A * k, e[4] = d * Y + x * F + M * W, e[5] = g * Y + S * F + E * W, e[6] = m * Y + L * F + w * W, e[7] = P * Y + N * F + A * W, e[8] = d * U + x * R + M * j, e[9] = g * U + S * R + E * j, e[10] = m * U + L * R + w * j, e[11] = P * U + N * R + A * j, t !== e && (e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e);
  }
  function ku(e, t, r) {
    var i = Math.sin(r), a = Math.cos(r), l = t[4], u = t[5], c = t[6], h = t[7], y = t[8], v = t[9], d = t[10], g = t[11];
    return t !== e && (e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[4] = l * a + y * i, e[5] = u * a + v * i, e[6] = c * a + d * i, e[7] = h * a + g * i, e[8] = y * a - l * i, e[9] = v * a - u * i, e[10] = d * a - c * i, e[11] = g * a - h * i, e;
  }
  function Fu(e, t, r) {
    var i = Math.sin(r), a = Math.cos(r), l = t[0], u = t[1], c = t[2], h = t[3], y = t[8], v = t[9], d = t[10], g = t[11];
    return t !== e && (e[4] = t[4], e[5] = t[5], e[6] = t[6], e[7] = t[7], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[0] = l * a - y * i, e[1] = u * a - v * i, e[2] = c * a - d * i, e[3] = h * a - g * i, e[8] = l * i + y * a, e[9] = u * i + v * a, e[10] = c * i + d * a, e[11] = h * i + g * a, e;
  }
  function Ru(e, t, r) {
    var i = Math.sin(r), a = Math.cos(r), l = t[0], u = t[1], c = t[2], h = t[3], y = t[4], v = t[5], d = t[6], g = t[7];
    return t !== e && (e[8] = t[8], e[9] = t[9], e[10] = t[10], e[11] = t[11], e[12] = t[12], e[13] = t[13], e[14] = t[14], e[15] = t[15]), e[0] = l * a + y * i, e[1] = u * a + v * i, e[2] = c * a + d * i, e[3] = h * a + g * i, e[4] = y * a - l * i, e[5] = v * a - u * i, e[6] = d * a - c * i, e[7] = g * a - h * i, e;
  }
  function Uu(e, t) {
    return e[0] = 1, e[1] = 0, e[2] = 0, e[3] = 0, e[4] = 0, e[5] = 1, e[6] = 0, e[7] = 0, e[8] = 0, e[9] = 0, e[10] = 1, e[11] = 0, e[12] = t[0], e[13] = t[1], e[14] = t[2], e[15] = 1, e;
  }
  function $u(e, t, r) {
    var i = r[0], a = r[1], l = r[2], u = Math.hypot(i, a, l), c, h, y;
    return u < Vr ? null : (u = 1 / u, i *= u, a *= u, l *= u, c = Math.sin(t), h = Math.cos(t), y = 1 - h, e[0] = i * i * y + h, e[1] = a * i * y + l * c, e[2] = l * i * y - a * c, e[3] = 0, e[4] = i * a * y - l * c, e[5] = a * a * y + h, e[6] = l * a * y + i * c, e[7] = 0, e[8] = i * l * y + a * c, e[9] = a * l * y - i * c, e[10] = l * l * y + h, e[11] = 0, e[12] = 0, e[13] = 0, e[14] = 0, e[15] = 1, e);
  }
  function Vu(e, t) {
    return e[0] === t[0] && e[1] === t[1] && e[2] === t[2] && e[3] === t[3] && e[4] === t[4] && e[5] === t[5] && e[6] === t[6] && e[7] === t[7] && e[8] === t[8] && e[9] === t[9] && e[10] === t[10] && e[11] === t[11] && e[12] === t[12] && e[13] === t[13] && e[14] === t[14] && e[15] === t[15];
  }
  function Us() {
    var e = new se(3);
    return se != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0), e;
  }
  function fr(e) {
    var t = e[0], r = e[1], i = e[2];
    return Math.hypot(t, r, i);
  }
  function ur(e, t, r) {
    var i = new se(3);
    return i[0] = e, i[1] = t, i[2] = r, i;
  }
  function _e(e, t, r, i) {
    return e[0] = t, e[1] = r, e[2] = i, e;
  }
  function Tn(e, t) {
    var r = t[0], i = t[1], a = t[2], l = r * r + i * i + a * a;
    return l > 0 && (l = 1 / Math.sqrt(l)), e[0] = t[0] * l, e[1] = t[1] * l, e[2] = t[2] * l, e;
  }
  function $s(e, t) {
    return e[0] * t[0] + e[1] * t[1] + e[2] * t[2];
  }
  function Ue(e, t, r) {
    var i = t[0], a = t[1], l = t[2], u = r[0], c = r[1], h = r[2];
    return e[0] = a * h - l * c, e[1] = l * u - i * h, e[2] = i * c - a * u, e;
  }
  function Nn(e, t, r) {
    var i = t[0], a = t[1], l = t[2], u = r[3] * i + r[7] * a + r[11] * l + r[15];
    return u = u || 1, e[0] = (r[0] * i + r[4] * a + r[8] * l + r[12]) / u, e[1] = (r[1] * i + r[5] * a + r[9] * l + r[13]) / u, e[2] = (r[2] * i + r[6] * a + r[10] * l + r[14]) / u, e;
  }
  var Wu = fr;
  (function() {
    var e = Us();
    return function(t, r, i, a, l, u) {
      var c, h;
      for (r || (r = 3), i || (i = 0), a ? h = Math.min(a * r + i, t.length) : h = t.length, c = i; c < h; c += r)
        e[0] = t[c], e[1] = t[c + 1], e[2] = t[c + 2], l(e, e, u), t[c] = e[0], t[c + 1] = e[1], t[c + 2] = e[2];
      return t;
    };
  })();
  function zu() {
    var e = new se(4);
    return se != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0, e[3] = 0), e;
  }
  function ju(e, t) {
    var r = t[0], i = t[1], a = t[2], l = t[3], u = r * r + i * i + a * a + l * l;
    return u > 0 && (u = 1 / Math.sqrt(u)), e[0] = r * u, e[1] = i * u, e[2] = a * u, e[3] = l * u, e;
  }
  function qn(e, t, r) {
    var i = t[0], a = t[1], l = t[2], u = t[3];
    return e[0] = r[0] * i + r[4] * a + r[8] * l + r[12] * u, e[1] = r[1] * i + r[5] * a + r[9] * l + r[13] * u, e[2] = r[2] * i + r[6] * a + r[10] * l + r[14] * u, e[3] = r[3] * i + r[7] * a + r[11] * l + r[15] * u, e;
  }
  (function() {
    var e = zu();
    return function(t, r, i, a, l, u) {
      var c, h;
      for (r || (r = 4), i || (i = 0), a ? h = Math.min(a * r + i, t.length) : h = t.length, c = i; c < h; c += r)
        e[0] = t[c], e[1] = t[c + 1], e[2] = t[c + 2], e[3] = t[c + 3], l(e, e, u), t[c] = e[0], t[c + 1] = e[1], t[c + 2] = e[2], t[c + 3] = e[3];
      return t;
    };
  })();
  function Pi() {
    var e = new se(4);
    return se != Float32Array && (e[0] = 0, e[1] = 0, e[2] = 0), e[3] = 1, e;
  }
  function Gu(e, t, r) {
    r = r * 0.5;
    var i = Math.sin(r);
    return e[0] = i * t[0], e[1] = i * t[1], e[2] = i * t[2], e[3] = Math.cos(r), e;
  }
  function xn(e, t, r, i) {
    var a = t[0], l = t[1], u = t[2], c = t[3], h = r[0], y = r[1], v = r[2], d = r[3], g, m, P, x, S;
    return m = a * h + l * y + u * v + c * d, m < 0 && (m = -m, h = -h, y = -y, v = -v, d = -d), 1 - m > Vr ? (g = Math.acos(m), P = Math.sin(g), x = Math.sin((1 - i) * g) / P, S = Math.sin(i * g) / P) : (x = 1 - i, S = i), e[0] = x * a + S * h, e[1] = x * l + S * y, e[2] = x * u + S * v, e[3] = x * c + S * d, e;
  }
  function Zu(e, t) {
    var r = t[0] + t[4] + t[8], i;
    if (r > 0)
      i = Math.sqrt(r + 1), e[3] = 0.5 * i, i = 0.5 / i, e[0] = (t[5] - t[7]) * i, e[1] = (t[6] - t[2]) * i, e[2] = (t[1] - t[3]) * i;
    else {
      var a = 0;
      t[4] > t[0] && (a = 1), t[8] > t[a * 3 + a] && (a = 2);
      var l = (a + 1) % 3, u = (a + 2) % 3;
      i = Math.sqrt(t[a * 3 + a] - t[l * 3 + l] - t[u * 3 + u] + 1), e[a] = 0.5 * i, i = 0.5 / i, e[3] = (t[l * 3 + u] - t[u * 3 + l]) * i, e[l] = (t[l * 3 + a] + t[a * 3 + l]) * i, e[u] = (t[u * 3 + a] + t[a * 3 + u]) * i;
    }
    return e;
  }
  var Vs = ju;
  (function() {
    var e = Us(), t = ur(1, 0, 0), r = ur(0, 1, 0);
    return function(i, a, l) {
      var u = $s(a, l);
      return u < -0.999999 ? (Ue(e, t, a), Wu(e) < 1e-6 && Ue(e, r, a), Tn(e, e), Gu(i, e, Math.PI), i) : u > 0.999999 ? (i[0] = 0, i[1] = 0, i[2] = 0, i[3] = 1, i) : (Ue(e, a, l), i[0] = e[0], i[1] = e[1], i[2] = e[2], i[3] = 1 + u, Vs(i, i));
    };
  })();
  (function() {
    var e = Pi(), t = Pi();
    return function(r, i, a, l, u, c) {
      return xn(e, i, u, c), xn(t, a, l, c), xn(r, e, t, 2 * c * (1 - c)), r;
    };
  })();
  (function() {
    var e = _u();
    return function(t, r, i, a) {
      return e[0] = i[0], e[3] = i[1], e[6] = i[2], e[1] = a[0], e[4] = a[1], e[7] = a[2], e[2] = -r[0], e[5] = -r[1], e[8] = -r[2], Vs(t, Zu(t, e));
    };
  })();
  const cr = 1e-6, Ws = "coincide", zs = "disjoint";
  function Hu(e, t, r) {
    return e[0] * (r[0] - t[0]) + e[1] * (r[1] - t[1]) + e[2] * (r[2] - t[2]);
  }
  function js(e, t, r) {
    const i = r[0] * (e[0] - t[0]) + r[1] * (e[1] - t[1]) + r[2] * (e[2] - t[2]);
    return Math.abs(i);
  }
  function Gs(e, t, r, i) {
    const a = [];
    ie(e, t, a);
    const l = q(r, a);
    i[0] = e[0] - l * r[0], i[1] = e[1] - l * r[1], i[2] = e[2] - l * r[2];
  }
  function Zs(e, t, r) {
    const i = q(e, t);
    let a = q(t, t);
    return a === 0 && (a = 1), r[0] = e[0] - i * t[0] / a, r[1] = e[1] - i * t[1] / a, r[2] = e[2] - i * t[2] / a, r;
  }
  function Hs(e, t, r, i) {
    const a = [];
    ie(e, t, a);
    const l = q(r, a), u = q(r, r);
    u !== 0 ? (i[0] = e[0] - l * r[0] / u, i[1] = e[1] - l * r[1] / u, i[2] = e[2] - l * r[2] / u) : (i[0] = e[0], i[1] = e[1], i[2] = e[2]);
  }
  function qs(e, t, r, i) {
    const a = {
      intersection: !1,
      betweenPoints: !1,
      t: Number.MAX_VALUE,
      x: []
    }, l = [], u = [];
    ie(t, e, l), ie(r, e, u);
    const c = q(i, u), h = q(i, l);
    let y, v;
    return h < 0 ? y = -h : y = h, c < 0 ? v = -c * cr : v = c * cr, y <= v || (a.t = c / h, a.x[0] = e[0] + a.t * l[0], a.x[1] = e[1] + a.t * l[1], a.x[2] = e[2] + a.t * l[2], a.intersection = !0, a.betweenPoints = a.t >= 0 && a.t <= 1), a;
  }
  function Js(e, t, r, i) {
    const a = {
      intersection: !1,
      l0: [],
      l1: [],
      error: null
    }, l = [];
    Oe(t, i, l);
    const u = l.map((d) => Math.abs(d));
    if (u[0] + u[1] + u[2] < cr) {
      const d = [];
      return ie(e, r, d), q(t, d) === 0 ? a.error = Ws : a.error = zs, a;
    }
    let c;
    u[0] > u[1] && u[0] > u[2] ? c = "x" : u[1] > u[2] ? c = "y" : c = "z";
    const h = [], y = -q(t, e), v = -q(i, r);
    switch (c) {
      case "x":
        h[0] = 0, h[1] = (v * t[2] - y * i[2]) / l[0], h[2] = (y * i[1] - v * t[1]) / l[0];
        break;
      case "y":
        h[0] = (y * i[2] - v * t[2]) / l[1], h[1] = 0, h[2] = (v * t[0] - y * i[0]) / l[1];
        break;
      case "z":
        h[0] = (v * t[1] - y * i[1]) / l[2], h[1] = (y * i[0] - v * t[0]) / l[2], h[2] = 0;
        break;
    }
    return a.l0 = h, vs(h, l, a.l1), a.intersection = !0, a;
  }
  const qu = {
    evaluate: Hu,
    distanceToPlane: js,
    projectPoint: Gs,
    projectVector: Zs,
    generalizedProjectPoint: Hs,
    intersectWithLine: qs,
    intersectWithPlane: Js,
    DISJOINT: zs,
    COINCIDE: Ws
  };
  function Ju(e, t) {
    t.classHierarchy.push("vtkPlane"), e.distanceToPlane = (r) => js(r, t.origin, t.normal), e.projectPoint = (r, i) => {
      Gs(r, t.origin, t.normal, i);
    }, e.projectVector = (r, i) => Zs(r, t.normal, i), e.push = (r) => {
      if (r !== 0)
        for (let i = 0; i < 3; i++)
          t.origin[i] += r * t.normal[i];
    }, e.generalizedProjectPoint = (r, i) => {
      Hs(r, t.origin, t.normal, i);
    }, e.evaluateFunction = (r, i, a) => Array.isArray(r) ? t.normal[0] * (r[0] - t.origin[0]) + t.normal[1] * (r[1] - t.origin[1]) + t.normal[2] * (r[2] - t.origin[2]) : t.normal[0] * (r - t.origin[0]) + t.normal[1] * (i - t.origin[1]) + t.normal[2] * (a - t.origin[2]), e.evaluateGradient = (r) => [t.normal[0], t.normal[1], t.normal[2]], e.intersectWithLine = (r, i) => qs(r, i, t.origin, t.normal), e.intersectWithPlane = (r, i) => Js(r, i, t.origin, t.normal);
  }
  const Ku = {
    normal: [0, 0, 1],
    origin: [0, 0, 0]
  };
  function Ks(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, Ku, r), V.obj(e, t), V.setGetArray(e, t, ["normal", "origin"], 3), Ju(e, t);
  }
  const Qu = V.newInstance(Ks, "vtkPlane");
  var We = {
    newInstance: Qu,
    extend: Ks,
    ...qu
  };
  const Un = [
    Number.MAX_VALUE,
    -Number.MAX_VALUE,
    // X
    Number.MAX_VALUE,
    -Number.MAX_VALUE,
    // Y
    Number.MAX_VALUE,
    -Number.MAX_VALUE
    // Z
  ];
  function Qs(e, t) {
    return e[0] === t[0] && e[1] === t[1] && e[2] === t[2] && e[3] === t[3] && e[4] === t[4] && e[5] === t[5];
  }
  function ae(e) {
    return (e == null ? void 0 : e.length) >= 6 && e[0] <= e[1] && e[2] <= e[3] && e[4] <= e[5];
  }
  function Wr(e, t) {
    return e[0] = t[0], e[1] = t[1], e[2] = t[2], e[3] = t[3], e[4] = t[4], e[5] = t[5], e;
  }
  function zr(e) {
    return Wr(e, Un);
  }
  function Mn(e, t, r, i) {
    const [a, l, u, c, h, y] = e;
    return e[0] = a < t ? a : t, e[1] = l > t ? l : t, e[2] = u < r ? u : r, e[3] = c > r ? c : r, e[4] = h < i ? h : i, e[5] = y > i ? y : i, e;
  }
  function jr(e, t) {
    if (t.length === 0)
      return e;
    if (Array.isArray(t[0]))
      for (let r = 0; r < t.length; ++r)
        Mn(e, ...t[r]);
    else
      for (let r = 0; r < t.length; r += 3)
        Mn(e, ...t.slice(r, r + 3));
    return e;
  }
  function ta(e, t, r, i, a, l, u) {
    const [c, h, y, v, d, g] = e;
    return u === void 0 ? (e[0] = Math.min(t[0], c), e[1] = Math.max(t[1], h), e[2] = Math.min(t[2], y), e[3] = Math.max(t[3], v), e[4] = Math.min(t[4], d), e[5] = Math.max(t[5], g)) : (e[0] = Math.min(t, c), e[1] = Math.max(r, h), e[2] = Math.min(i, y), e[3] = Math.max(a, v), e[4] = Math.min(l, d), e[5] = Math.max(u, g)), e;
  }
  function ea(e, t, r, i) {
    const [a, l, u, c, h, y] = e;
    return e[0] = t, e[1] = t > l ? t : l, e[2] = r, e[3] = r > c ? r : c, e[4] = i, e[5] = i > y ? i : y, a !== t || u !== r || h !== i;
  }
  function na(e, t, r, i) {
    const [a, l, u, c, h, y] = e;
    return e[0] = t < a ? t : a, e[1] = t, e[2] = r < u ? r : u, e[3] = r, e[4] = i < h ? i : h, e[5] = i, l !== t || c !== r || y !== i;
  }
  function ra(e, t) {
    return e[0] -= t, e[1] += t, e[2] -= t, e[3] += t, e[4] -= t, e[5] += t, e;
  }
  function Gr(e, t, r, i) {
    return ae(e) ? (t >= 0 ? (e[0] *= t, e[1] *= t) : (e[0] = t * e[1], e[1] = t * e[0]), r >= 0 ? (e[2] *= r, e[3] *= r) : (e[2] = r * e[3], e[3] = r * e[2]), i >= 0 ? (e[4] *= i, e[5] *= i) : (e[4] = i * e[5], e[5] = i * e[4]), !0) : !1;
  }
  function Zr(e) {
    return [0.5 * (e[0] + e[1]), 0.5 * (e[2] + e[3]), 0.5 * (e[4] + e[5])];
  }
  function tc(e, t, r, i) {
    if (!ae(e))
      return !1;
    const a = Zr(e);
    return e[0] -= a[0], e[1] -= a[0], e[2] -= a[1], e[3] -= a[1], e[4] -= a[2], e[5] -= a[2], Gr(e, t, r, i), e[0] += a[0], e[1] += a[0], e[2] += a[1], e[3] += a[1], e[4] += a[2], e[5] += a[2], !0;
  }
  function rn(e, t) {
    return e[t * 2 + 1] - e[t * 2];
  }
  function $n(e) {
    return [rn(e, 0), rn(e, 1), rn(e, 2)];
  }
  function ia(e) {
    return e.slice(0, 2);
  }
  function sa(e) {
    return e.slice(2, 4);
  }
  function aa(e) {
    return e.slice(4, 6);
  }
  function oa(e) {
    const t = $n(e);
    return t[0] > t[1] ? t[0] > t[2] ? t[0] : t[2] : t[1] > t[2] ? t[1] : t[2];
  }
  function la(e) {
    if (ae(e)) {
      const t = $n(e);
      return Math.sqrt(t[0] * t[0] + t[1] * t[1] + t[2] * t[2]);
    }
    return null;
  }
  function Hr(e) {
    return [e[0], e[2], e[4]];
  }
  function qr(e) {
    return [e[1], e[3], e[5]];
  }
  function pn(e, t) {
    return e <= 0 && t >= 0 || e >= 0 && t <= 0;
  }
  function Jr(e, t) {
    let r = 0;
    for (let i = 0; i < 2; i++)
      for (let a = 2; a < 4; a++)
        for (let l = 4; l < 6; l++)
          t[r++] = [e[i], e[a], e[l]];
    return t;
  }
  function fa(e, t, r) {
    return t[0] = e[0], t[1] = e[2], t[2] = e[4], r[0] = e[1], r[1] = e[3], r[2] = e[5], t;
  }
  function ua(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [];
    const i = Jr(e, []);
    for (let a = 0; a < i.length; ++a)
      Nn(i[a], i[a], t);
    return zr(r), jr(r, i);
  }
  function ca(e) {
    let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
    return t[0] = 0.5 * (e[1] - e[0]), t[1] = 0.5 * (e[3] - e[2]), t[2] = 0.5 * (e[5] - e[4]), t;
  }
  function ha(e, t, r, i) {
    const a = [].concat(Un), l = e.getData();
    for (let u = 0; u < l.length; u += 3) {
      const c = [l[u], l[u + 1], l[u + 2]], h = q(c, t);
      a[0] = Math.min(h, a[0]), a[1] = Math.max(h, a[1]);
      const y = q(c, r);
      a[2] = Math.min(y, a[2]), a[3] = Math.max(y, a[3]);
      const v = q(c, i);
      a[4] = Math.min(v, a[4]), a[5] = Math.max(v, a[5]);
    }
    return a;
  }
  function pa(e, t, r, i, a) {
    let l = !0;
    const u = [];
    let c = 0;
    const h = [], y = [0, 0, 0], v = 0, d = 1, g = 2;
    for (let m = 0; m < 3; m++)
      t[m] < e[2 * m] ? (u[m] = d, y[m] = e[2 * m], l = !1) : t[m] > e[2 * m + 1] ? (u[m] = v, y[m] = e[2 * m + 1], l = !1) : u[m] = g;
    if (l)
      return i[0] = t[0], i[1] = t[1], i[2] = t[2], a[0] = 0, 1;
    for (let m = 0; m < 3; m++)
      u[m] !== g && r[m] !== 0 ? h[m] = (y[m] - t[m]) / r[m] : h[m] = -1;
    for (let m = 0; m < 3; m++)
      h[c] < h[m] && (c = m);
    if (h[c] > 1 || h[c] < 0)
      return 0;
    a[0] = h[c];
    for (let m = 0; m < 3; m++)
      if (c !== m) {
        if (i[m] = t[m] + h[c] * r[m], i[m] < e[2 * m] || i[m] > e[2 * m + 1])
          return 0;
      } else
        i[m] = y[m];
    return 1;
  }
  function ya(e, t, r) {
    const i = [];
    let a = 0, l = 1, u = 1;
    for (let c = 4; c <= 5; ++c) {
      i[2] = e[c];
      for (let h = 2; h <= 3; ++h) {
        i[1] = e[h];
        for (let y = 0; y <= 1; ++y)
          if (i[0] = e[y], a = We.evaluate(r, t, i), u && (l = a >= 0 ? 1 : -1, u = 0), a === 0 || l > 0 && a < 0 || l < 0 && a > 0)
            return 1;
      }
    }
    return 0;
  }
  function ga(e, t) {
    if (!(ae(e) && ae(t)))
      return !1;
    const r = [0, 0, 0, 0, 0, 0];
    let i;
    for (let a = 0; a < 3; a++)
      if (i = !1, t[a * 2] >= e[a * 2] && t[a * 2] <= e[a * 2 + 1] ? (i = !0, r[a * 2] = t[a * 2]) : e[a * 2] >= t[a * 2] && e[a * 2] <= t[a * 2 + 1] && (i = !0, r[a * 2] = e[a * 2]), t[a * 2 + 1] >= e[a * 2] && t[a * 2 + 1] <= e[a * 2 + 1] ? (i = !0, r[a * 2 + 1] = t[2 * a + 1]) : e[a * 2 + 1] >= t[a * 2] && e[a * 2 + 1] <= t[a * 2 + 1] && (i = !0, r[a * 2 + 1] = e[a * 2 + 1]), !i)
        return !1;
    return e[0] = r[0], e[1] = r[1], e[2] = r[2], e[3] = r[3], e[4] = r[4], e[5] = r[5], !0;
  }
  function Dn(e, t) {
    if (!(ae(e) && ae(t)))
      return !1;
    for (let r = 0; r < 3; r++)
      if (!(t[r * 2] >= e[r * 2] && t[r * 2] <= e[r * 2 + 1]) && !(e[r * 2] >= t[r * 2] && e[r * 2] <= t[r * 2 + 1]) && !(t[r * 2 + 1] >= e[r * 2] && t[r * 2 + 1] <= e[r * 2 + 1]) && !(e[r * 2 + 1] >= t[r * 2] && e[r * 2 + 1] <= t[r * 2 + 1]))
        return !1;
    return !0;
  }
  function An(e, t, r, i) {
    return !(t < e[0] || t > e[1] || r < e[2] || r > e[3] || i < e[4] || i > e[5]);
  }
  function ec(e, t) {
    return !(!Dn(e, t) || !An(e, ...Hr(t)) || !An(e, ...qr(t)));
  }
  function va(e, t, r) {
    const i = [[0, 1, 2, 3, 4, 5, 6, 7], [0, 1, 4, 5, 2, 3, 6, 7], [0, 2, 4, 6, 1, 3, 5, 7]], a = [0, 0, 0, 0, 0, 0, 0, 0];
    let l = 0;
    for (let d = 0; d < 2; d++)
      for (let g = 2; g < 4; g++)
        for (let m = 4; m < 6; m++) {
          const P = [e[d], e[g], e[m]];
          a[l++] = We.evaluate(r, t, P);
        }
    let u = 2;
    for (; u-- && !(pn(a[i[u][0]], a[i[u][4]]) && pn(a[i[u][1]], a[i[u][5]]) && pn(a[i[u][2]], a[i[u][6]]) && pn(a[i[u][3]], a[i[u][7]])); )
      ;
    if (u < 0)
      return !1;
    const c = Math.sign(r[u]), h = Math.abs((e[u * 2 + 1] - e[u * 2]) * r[u]);
    let y = c > 0 ? 1 : 0;
    for (let d = 0; d < 4; d++) {
      if (h === 0)
        continue;
      const g = Math.abs(a[i[u][d]]) / h;
      c > 0 && g < y && (y = g), c < 0 && g > y && (y = g);
    }
    const v = (1 - y) * e[u * 2] + y * e[u * 2 + 1];
    return c > 0 ? e[u * 2] = v : e[u * 2 + 1] = v, !0;
  }
  class nc {
    constructor(t) {
      this.bounds = t, this.bounds || (this.bounds = new Float64Array(Un));
    }
    getBounds() {
      return this.bounds;
    }
    equals(t) {
      return Qs(this.bounds, t);
    }
    isValid() {
      return ae(this.bounds);
    }
    setBounds(t) {
      return Wr(this.bounds, t);
    }
    reset() {
      return zr(this.bounds);
    }
    addPoint() {
      for (var t = arguments.length, r = new Array(t), i = 0; i < t; i++)
        r[i] = arguments[i];
      return Mn(this.bounds, ...r);
    }
    addPoints(t) {
      return jr(this.bounds, t);
    }
    addBounds(t, r, i, a, l, u) {
      return ta(this.bounds, t, r, i, a, l, u);
    }
    setMinPoint(t, r, i) {
      return ea(this.bounds, t, r, i);
    }
    setMaxPoint(t, r, i) {
      return na(this.bounds, t, r, i);
    }
    inflate(t) {
      return ra(this.bounds, t);
    }
    scale(t, r, i) {
      return Gr(this.bounds, t, r, i);
    }
    getCenter() {
      return Zr(this.bounds);
    }
    getLength(t) {
      return rn(this.bounds, t);
    }
    getLengths() {
      return $n(this.bounds);
    }
    getMaxLength() {
      return oa(this.bounds);
    }
    getDiagonalLength() {
      return la(this.bounds);
    }
    getMinPoint() {
      return Hr(this.bounds);
    }
    getMaxPoint() {
      return qr(this.bounds);
    }
    getXRange() {
      return ia(this.bounds);
    }
    getYRange() {
      return sa(this.bounds);
    }
    getZRange() {
      return aa(this.bounds);
    }
    getCorners(t) {
      return Jr(this.bounds, t);
    }
    computeCornerPoints(t, r) {
      return fa(this.bounds, t, r);
    }
    computeLocalBounds(t, r, i) {
      return ha(this.bounds, t, r, i);
    }
    transformBounds(t) {
      let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
      return ua(this.bounds, t, r);
    }
    computeScale3(t) {
      return ca(this.bounds, t);
    }
    cutWithPlane(t, r) {
      return va(this.bounds, t, r);
    }
    intersectBox(t, r, i, a) {
      return pa(this.bounds, t, r, i, a);
    }
    intersectPlane(t, r) {
      return ya(this.bounds, t, r);
    }
    intersect(t) {
      return ga(this.bounds, t);
    }
    intersects(t) {
      return Dn(this.bounds, t);
    }
    containsPoint(t, r, i) {
      return An(this.bounds, t, r, i);
    }
    contains(t) {
      return Dn(this.bounds, t);
    }
  }
  function rc(e) {
    const t = e && e.bounds;
    return new nc(t);
  }
  const ic = {
    equals: Qs,
    isValid: ae,
    setBounds: Wr,
    reset: zr,
    addPoint: Mn,
    addPoints: jr,
    addBounds: ta,
    setMinPoint: ea,
    setMaxPoint: na,
    inflate: ra,
    scale: Gr,
    scaleAboutCenter: tc,
    getCenter: Zr,
    getLength: rn,
    getLengths: $n,
    getMaxLength: oa,
    getDiagonalLength: la,
    getMinPoint: Hr,
    getMaxPoint: qr,
    getXRange: ia,
    getYRange: sa,
    getZRange: aa,
    getCorners: Jr,
    computeCornerPoints: fa,
    computeLocalBounds: ha,
    transformBounds: ua,
    computeScale3: ca,
    cutWithPlane: va,
    intersectBox: pa,
    intersectPlane: ya,
    intersect: ga,
    intersects: Dn,
    containsPoint: An,
    contains: ec,
    INIT_BOUNDS: Un
  };
  var Ce = {
    newInstance: rc,
    ...ic
  };
  const {
    vtkErrorMacro: Ti,
    vtkWarningMacro: sc
  } = V;
  function ac(e, t) {
    t.classHierarchy.push("vtkFieldData");
    const r = e.getState;
    t.arrays && (t.arrays = t.arrays.map((i) => ({
      data: Vt(i.data)
    }))), e.initialize = () => {
      e.initializeFields(), e.copyAllOn(), e.clearFieldFlags();
    }, e.initializeFields = () => {
      t.arrays = [], t.copyFieldFlags = {}, e.modified();
    }, e.copyStructure = (i) => {
      e.initializeFields(), t.copyFieldFlags = i.getCopyFieldFlags().map((a) => a), t.arrays = i.arrays().map((a) => ({
        array: a
      }));
    }, e.getNumberOfArrays = () => t.arrays.length, e.getNumberOfActiveArrays = () => t.arrays.length, e.addArray = (i) => {
      const a = i.getName(), {
        array: l,
        index: u
      } = e.getArrayWithIndex(a);
      return l != null ? (t.arrays[u] = {
        data: i
      }, u) : (t.arrays = [].concat(t.arrays, {
        data: i
      }), t.arrays.length - 1);
    }, e.removeAllArrays = () => {
      t.arrays = [];
    }, e.removeArray = (i) => {
      const a = t.arrays.findIndex((l) => l.data.getName() === i);
      return e.removeArrayByIndex(a);
    }, e.removeArrayByIndex = (i) => i !== -1 && i < t.arrays.length ? (t.arrays.splice(i, 1), !0) : !1, e.getArrays = () => t.arrays.map((i) => i.data), e.getArray = (i) => typeof i == "number" ? e.getArrayByIndex(i) : e.getArrayByName(i), e.getArrayByName = (i) => t.arrays.reduce((a, l, u) => l.data.getName() === i ? l.data : a, null), e.getArrayWithIndex = (i) => {
      const a = t.arrays.findIndex((l) => l.data.getName() === i);
      return {
        array: a !== -1 ? t.arrays[a].data : null,
        index: a
      };
    }, e.getArrayByIndex = (i) => i >= 0 && i < t.arrays.length ? t.arrays[i].data : null, e.hasArray = (i) => e.getArrayWithIndex(i).index >= 0, e.getArrayName = (i) => {
      const a = t.arrays[i];
      return a ? a.data.getName() : "";
    }, e.getCopyFieldFlags = () => t.copyFieldFlags, e.getFlag = (i) => t.copyFieldFlags[i], e.passData = function(i) {
      let a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : -1, l = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : -1;
      i.getArrays().forEach((u) => {
        const c = e.getFlag(u.getName());
        if (c !== !1 && !(t.doCopyAllOff && c !== !0) && u) {
          let h = e.getArrayByName(u.getName());
          if (h)
            if (u.getNumberOfComponents() === h.getNumberOfComponents())
              if (a > -1 && a < u.getNumberOfTuples()) {
                const y = l > -1 ? l : a;
                h.insertTuple(y, u.getTuple(a));
              } else
                h.insertTuples(0, u.getTuples());
            else
              Ti("Unhandled case in passData");
          else if (a < 0 || a > u.getNumberOfTuples())
            e.addArray(u), i.getAttributes(u).forEach((y) => {
              e.setAttribute(u, y);
            });
          else {
            const y = u.getNumberOfComponents();
            let v = u.getNumberOfValues();
            const d = l > -1 ? l : a;
            v <= d * y && (v = (d + 1) * y), h = Le.newInstance({
              name: u.getName(),
              dataType: u.getDataType(),
              numberOfComponents: y,
              values: V.newTypedArray(u.getDataType(), v),
              size: 0
            }), h.insertTuple(d, u.getTuple(a)), e.addArray(h), i.getAttributes(u).forEach((g) => {
              e.setAttribute(h, g);
            });
          }
        }
      });
    }, e.interpolateData = function(i) {
      let a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : -1, l = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : -1, u = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : -1, c = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : 0.5;
      i.getArrays().forEach((h) => {
        const y = e.getFlag(h.getName());
        if (y !== !1 && !(t.doCopyAllOff && y !== !0) && h) {
          let v = e.getArrayByName(h.getName());
          if (v)
            if (h.getNumberOfComponents() === v.getNumberOfComponents())
              if (a > -1 && a < h.getNumberOfTuples()) {
                const d = u > -1 ? u : a;
                v.interpolateTuple(d, h, a, h, l, c), sc("Unexpected case in interpolateData");
              } else
                v.insertTuples(h.getTuples());
            else
              Ti("Unhandled case in interpolateData");
          else if (a < 0 || l < 0 || a > h.getNumberOfTuples())
            e.addArray(h), i.getAttributes(h).forEach((d) => {
              e.setAttribute(h, d);
            });
          else {
            const d = h.getNumberOfComponents();
            let g = h.getNumberOfValues();
            const m = u > -1 ? u : a;
            g <= m * d && (g = (m + 1) * d), v = Le.newInstance({
              name: h.getName(),
              dataType: h.getDataType(),
              numberOfComponents: d,
              values: V.newTypedArray(h.getDataType(), g),
              size: 0
            }), v.interpolateTuple(m, h, a, h, l, c), e.addArray(v), i.getAttributes(h).forEach((P) => {
              e.setAttribute(v, P);
            });
          }
        }
      });
    }, e.copyFieldOn = (i) => {
      t.copyFieldFlags[i] = !0;
    }, e.copyFieldOff = (i) => {
      t.copyFieldFlags[i] = !1;
    }, e.copyAllOn = () => {
      (!t.doCopyAllOn || t.doCopyAllOff) && (t.doCopyAllOn = !0, t.doCopyAllOff = !1, e.modified());
    }, e.copyAllOff = () => {
      (t.doCopyAllOn || !t.doCopyAllOff) && (t.doCopyAllOn = !1, t.doCopyAllOff = !0, e.modified());
    }, e.clearFieldFlags = () => {
      t.copyFieldFlags = {};
    }, e.deepCopy = (i) => {
      t.arrays = i.getArrays().map((a) => {
        const l = a.newClone();
        return l.deepCopy(a), {
          data: l
        };
      });
    }, e.copyFlags = (i) => i.getCopyFieldFlags().map((a) => a), e.reset = () => t.arrays.forEach((i) => i.data.reset()), e.getMTime = () => t.arrays.reduce((i, a) => a.data.getMTime() > i ? a.data.getMTime() : i, t.mtime), e.getNumberOfComponents = () => t.arrays.reduce((i, a) => i + a.data.getNumberOfComponents(), 0), e.getNumberOfTuples = () => t.arrays.length > 0 ? t.arrays[0].getNumberOfTuples() : 0, e.getState = () => {
      const i = r();
      return i && (i.arrays = t.arrays.map((a) => ({
        data: a.data.getState()
      }))), i;
    };
  }
  const oc = {
    arrays: [],
    copyFieldFlags: [],
    // fields not to copy
    doCopyAllOn: !0,
    doCopyAllOff: !1
  };
  function ma(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, oc, r), V.obj(e, t), ac(e, t);
  }
  const lc = V.newInstance(ma, "vtkFieldData");
  var fc = {
    newInstance: lc,
    extend: ma
  };
  const uc = {
    SCALARS: 0,
    VECTORS: 1,
    NORMALS: 2,
    TCOORDS: 3,
    TENSORS: 4,
    GLOBALIDS: 5,
    PEDIGREEIDS: 6,
    EDGEFLAG: 7,
    NUM_ATTRIBUTES: 8
  }, cc = {
    MAX: 0,
    EXACT: 1,
    NOLIMIT: 2
  }, hc = {
    DUPLICATECELL: 1,
    // the cell is present on multiple processors
    HIGHCONNECTIVITYCELL: 2,
    // the cell has more neighbors than in a regular mesh
    LOWCONNECTIVITYCELL: 4,
    // the cell has less neighbors than in a regular mesh
    REFINEDCELL: 8,
    // other cells are present that refines it.
    EXTERIORCELL: 16,
    // the cell is on the exterior of the data set
    HIDDENCELL: 32
    // the cell is needed to maintain connectivity, but the data values should be ignored.
  }, pc = {
    DUPLICATEPOINT: 1,
    // the cell is present on multiple processors
    HIDDENPOINT: 2
    // the point is needed to maintain connectivity, but the data values should be ignored.
  }, yc = {
    COPYTUPLE: 0,
    INTERPOLATE: 1,
    PASSDATA: 2,
    ALLCOPY: 3
    // all of the above
  }, gc = "vtkGhostType", vc = {
    DEFAULT: 0,
    // use the point type that does not truncate any data
    SINGLE: 1,
    // use Float32Array
    DOUBLE: 2
    // use Float64Array
  };
  var da = {
    AttributeCopyOperations: yc,
    AttributeLimitTypes: cc,
    AttributeTypes: uc,
    CellGhostTypes: hc,
    DesiredOutputPrecision: vc,
    PointGhostTypes: pc,
    ghostArrayName: gc
  };
  const {
    AttributeTypes: ue,
    AttributeCopyOperations: me
  } = da, {
    vtkWarningMacro: yn
  } = V;
  function mc(e, t) {
    const r = ["Scalars", "Vectors", "Normals", "TCoords", "Tensors", "GlobalIds", "PedigreeIds"];
    function i(u) {
      let c = r.find((h) => ue[h.toUpperCase()] === u || typeof u != "number" && h.toLowerCase() === u.toLowerCase());
      return typeof c > "u" && (c = null), c;
    }
    t.classHierarchy.push("vtkDataSetAttributes");
    const a = {
      ...e
    };
    e.checkNumberOfComponents = (u) => !0, e.setAttribute = (u, c) => {
      const h = i(c);
      if (u && h.toUpperCase() === "PEDIGREEIDS" && !u.isA("vtkDataArray"))
        return yn(`Cannot set attribute ${h}. The attribute must be a vtkDataArray.`), -1;
      if (u && !e.checkNumberOfComponents(u, h))
        return yn(`Cannot set attribute ${h}. Incorrect number of components.`), -1;
      let y = t[`active${h}`];
      if (y >= 0 && y < t.arrays.length) {
        if (t.arrays[y] === u)
          return y;
        e.removeArrayByIndex(y);
      }
      return u ? (y = e.addArray(u), t[`active${h}`] = y) : t[`active${h}`] = -1, e.modified(), t[`active${h}`];
    }, e.getAttributes = (u) => r.filter((c) => e[`get${c}`]() === u), e.setActiveAttributeByName = (u, c) => e.setActiveAttributeByIndex(e.getArrayWithIndex(u).index, c), e.setActiveAttributeByIndex = (u, c) => {
      const h = i(c);
      if (u >= 0 && u < t.arrays.length) {
        if (h.toUpperCase() !== "PEDIGREEIDS") {
          const y = e.getArrayByIndex(u);
          if (!y.isA("vtkDataArray"))
            return yn(`Cannot set attribute ${h}. Only vtkDataArray subclasses can be set as active attributes.`), -1;
          if (!e.checkNumberOfComponents(y, h))
            return yn(`Cannot set attribute ${h}. Incorrect number of components.`), -1;
        }
        return t[`active${h}`] = u, e.modified(), u;
      }
      return u === -1 && (t[`active${h}`] = u, e.modified()), -1;
    }, e.getActiveAttribute = (u) => {
      const c = i(u);
      return e[`get${c}`]();
    }, e.removeAllArrays = () => {
      r.forEach((u) => {
        t[`active${u}`] = -1;
      }), a.removeAllArrays();
    }, e.removeArrayByIndex = (u) => (u !== -1 && r.forEach((c) => {
      u === t[`active${c}`] ? t[`active${c}`] = -1 : u < t[`active${c}`] && (t[`active${c}`] -= 1);
    }), a.removeArrayByIndex(u)), r.forEach((u) => {
      const c = `active${u}`;
      e[`get${u}`] = () => e.getArrayByIndex(t[c]), e[`set${u}`] = (h) => e.setAttribute(h, u), e[`setActive${u}`] = (h) => e.setActiveAttributeByIndex(e.getArrayWithIndex(h).index, u), e[`copy${u}Off`] = () => {
        const h = u.toUpperCase();
        t.copyAttributeFlags[me.PASSDATA][ue[h]] = !1;
      }, e[`copy${u}On`] = () => {
        const h = u.toUpperCase();
        t.copyAttributeFlags[me.PASSDATA][ue[h]] = !0;
      };
    }), e.initializeAttributeCopyFlags = () => {
      t.copyAttributeFlags = [], Object.keys(me).filter((u) => u !== "ALLCOPY").forEach((u) => {
        t.copyAttributeFlags[me[u]] = Object.keys(ue).filter((c) => c !== "NUM_ATTRIBUTES").reduce((c, h) => (c[ue[h]] = !0, c), []);
      }), t.copyAttributeFlags[me.COPYTUPLE][ue.GLOBALIDS] = !1, t.copyAttributeFlags[me.INTERPOLATE][ue.GLOBALIDS] = !1, t.copyAttributeFlags[me.COPYTUPLE][ue.PEDIGREEIDS] = !1;
    }, e.initialize = V.chain(e.initialize, e.initializeAttributeCopyFlags), t.dataArrays && Object.keys(t.dataArrays).length && Object.keys(t.dataArrays).forEach((u) => {
      !t.dataArrays[u].ref && t.dataArrays[u].type === "vtkDataArray" && e.addArray(Le.newInstance(t.dataArrays[u]));
    });
    const l = e.shallowCopy;
    e.shallowCopy = (u, c) => {
      l(u, c), t.arrays = u.getArrays().map((h) => {
        const y = h.newClone();
        return y.shallowCopy(h, c), {
          data: y
        };
      });
    }, e.initializeAttributeCopyFlags();
  }
  const dc = {
    activeScalars: -1,
    activeVectors: -1,
    activeTensors: -1,
    activeNormals: -1,
    activeTCoords: -1,
    activeGlobalIds: -1,
    activePedigreeIds: -1
  };
  function Ca(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, dc, r), fc.extend(e, t, r), V.setGet(e, t, ["activeScalars", "activeNormals", "activeTCoords", "activeVectors", "activeTensors", "activeGlobalIds", "activePedigreeIds"]), t.arrays || (t.arrays = {}), mc(e, t);
  }
  const Cc = V.newInstance(Ca, "vtkDataSetAttributes");
  var hr = {
    newInstance: Cc,
    extend: Ca,
    ...da
  };
  const Pc = {
    UNIFORM: 0,
    // data that does not vary over points/cells/etc.
    DATA_OBJECT_FIELD: 0,
    // to match VTK
    COORDINATE: 1,
    // data that specifies the location of each point
    POINT_DATA: 1,
    // to match VTK
    POINT: 2,
    // data defined at each point, but that does not specify the point location
    POINT_FIELD_DATA: 2,
    // to match VTK
    CELL: 3,
    // data defined at each cell, but that does not specify the cell
    CELL_FIELD_DATA: 3,
    // to match VTK
    VERTEX: 4,
    // data defined at each graph vertex, but that does not specify the graph vertex
    VERTEX_FIELD_DATA: 4,
    // to match VTK
    EDGE: 5,
    // data defined at each graph edge, but that does not specify the graph edge
    EDGE_FIELD_DATA: 5,
    // to match VTK
    ROW: 6,
    // data specifying a table row
    ROW_DATA: 6
    // to match VTK
  }, Tc = {
    FIELD_ASSOCIATION_POINTS: 0,
    FIELD_ASSOCIATION_CELLS: 1,
    FIELD_ASSOCIATION_NONE: 2,
    FIELD_ASSOCIATION_POINTS_THEN_CELLS: 3,
    FIELD_ASSOCIATION_VERTICES: 4,
    FIELD_ASSOCIATION_EDGES: 5,
    FIELD_ASSOCIATION_ROWS: 6,
    NUMBER_OF_ASSOCIATIONS: 7
  };
  var xc = {
    FieldDataTypes: Pc,
    FieldAssociations: Tc
  };
  const pr = ["pointData", "cellData", "fieldData"];
  function Ic(e, t) {
    t.classHierarchy.push("vtkDataSet"), pr.forEach((i) => {
      t[i] ? t[i] = Vt(t[i]) : t[i] = hr.newInstance();
    });
    const r = e.shallowCopy;
    e.shallowCopy = function(i) {
      let a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
      r(i, a), pr.forEach((l) => {
        t[l] = hr.newInstance(), t[l].shallowCopy(i.getReferenceByName(l));
      });
    };
  }
  const Ec = {
    // pointData: null,
    // cellData: null,
    // fieldData: null,
  };
  function Pa(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, Ec, r), V.obj(e, t), V.setGet(e, t, pr), Ic(e, t);
  }
  const Sc = V.newInstance(Pa, "vtkDataSet");
  var Ta = {
    newInstance: Sc,
    extend: Pa,
    ...xc
  };
  const Ut = {
    UNCHANGED: 0,
    SINGLE_POINT: 1,
    X_LINE: 2,
    Y_LINE: 3,
    Z_LINE: 4,
    XY_PLANE: 5,
    YZ_PLANE: 6,
    XZ_PLANE: 7,
    XYZ_GRID: 8,
    EMPTY: 9
  };
  var xa = {
    StructuredType: Ut
  };
  const {
    StructuredType: re
  } = xa;
  function Oc(e) {
    let t = 0;
    for (let r = 0; r < 3; ++r)
      e[r * 2] < e[r * 2 + 1] && t++;
    return e[0] > e[1] || e[2] > e[3] || e[4] > e[5] ? re.EMPTY : t === 3 ? re.XYZ_GRID : t === 2 ? e[0] === e[1] ? re.YZ_PLANE : e[2] === e[3] ? re.XZ_PLANE : re.XY_PLANE : t === 1 ? e[0] < e[1] ? re.X_LINE : e[2] < e[3] ? re.Y_LINE : re.Z_LINE : re.SINGLE_POINT;
  }
  var Lc = {
    getDataDescriptionFromExtent: Oc,
    ...xa
  };
  const {
    vtkErrorMacro: de
  } = V;
  function wc(e, t) {
    t.classHierarchy.push("vtkImageData"), e.setExtent = function() {
      if (t.deleted)
        return de("instance deleted - cannot call any method"), !1;
      for (var r = arguments.length, i = new Array(r), a = 0; a < r; a++)
        i[a] = arguments[a];
      const l = i.length === 1 ? i[0] : i;
      if (l.length !== 6)
        return !1;
      const u = t.extent.some((c, h) => c !== l[h]);
      return u && (t.extent = l.slice(), t.dataDescription = Lc.getDataDescriptionFromExtent(t.extent), e.modified()), u;
    }, e.setDimensions = function() {
      let r, i, a;
      if (t.deleted) {
        de("instance deleted - cannot call any method");
        return;
      }
      if (arguments.length === 1) {
        const l = arguments.length <= 0 ? void 0 : arguments[0];
        r = l[0], i = l[1], a = l[2];
      } else if (arguments.length === 3)
        r = arguments.length <= 0 ? void 0 : arguments[0], i = arguments.length <= 1 ? void 0 : arguments[1], a = arguments.length <= 2 ? void 0 : arguments[2];
      else {
        de("Bad dimension specification");
        return;
      }
      e.setExtent(0, r - 1, 0, i - 1, 0, a - 1);
    }, e.getDimensions = () => [t.extent[1] - t.extent[0] + 1, t.extent[3] - t.extent[2] + 1, t.extent[5] - t.extent[4] + 1], e.getNumberOfCells = () => {
      const r = e.getDimensions();
      let i = 1;
      for (let a = 0; a < 3; a++) {
        if (r[a] === 0)
          return 0;
        r[a] > 1 && (i *= r[a] - 1);
      }
      return i;
    }, e.getNumberOfPoints = () => {
      const r = e.getDimensions();
      return r[0] * r[1] * r[2];
    }, e.getPoint = (r) => {
      const i = e.getDimensions();
      if (i[0] === 0 || i[1] === 0 || i[2] === 0)
        return de("Requesting a point from an empty image."), null;
      const a = new Float64Array(3);
      switch (t.dataDescription) {
        case Ut.EMPTY:
          return null;
        case Ut.SINGLE_POINT:
          break;
        case Ut.X_LINE:
          a[0] = r;
          break;
        case Ut.Y_LINE:
          a[1] = r;
          break;
        case Ut.Z_LINE:
          a[2] = r;
          break;
        case Ut.XY_PLANE:
          a[0] = r % i[0], a[1] = r / i[0];
          break;
        case Ut.YZ_PLANE:
          a[1] = r % i[1], a[2] = r / i[1];
          break;
        case Ut.XZ_PLANE:
          a[0] = r % i[0], a[2] = r / i[0];
          break;
        case Ut.XYZ_GRID:
          a[0] = r % i[0], a[1] = r / i[0] % i[1], a[2] = r / (i[0] * i[1]);
          break;
        default:
          de("Invalid dataDescription");
          break;
      }
      const l = [0, 0, 0];
      return e.indexToWorld(a, l), l;
    }, e.getBounds = () => e.extentToBounds(e.getSpatialExtent()), e.extentToBounds = (r) => Ce.transformBounds(r, t.indexToWorld), e.getSpatialExtent = () => Ce.inflate([...t.extent], 0.5), e.computeTransforms = () => {
      Uu(t.indexToWorld, t.origin), t.indexToWorld[0] = t.direction[0], t.indexToWorld[1] = t.direction[1], t.indexToWorld[2] = t.direction[2], t.indexToWorld[4] = t.direction[3], t.indexToWorld[5] = t.direction[4], t.indexToWorld[6] = t.direction[5], t.indexToWorld[8] = t.direction[6], t.indexToWorld[9] = t.direction[7], t.indexToWorld[10] = t.direction[8], Rs(t.indexToWorld, t.indexToWorld, t.spacing), wn(t.worldToIndex, t.indexToWorld);
    }, e.indexToWorld = function(r) {
      let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
      return Nn(i, r, t.indexToWorld), i;
    }, e.indexToWorldVec3 = e.indexToWorld, e.worldToIndex = function(r) {
      let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
      return Nn(i, r, t.worldToIndex), i;
    }, e.worldToIndexVec3 = e.worldToIndex, e.indexToWorldBounds = function(r) {
      let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
      return Ce.transformBounds(r, t.indexToWorld, i);
    }, e.worldToIndexBounds = function(r) {
      let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
      return Ce.transformBounds(r, t.worldToIndex, i);
    }, e.onModified(e.computeTransforms), e.computeTransforms(), e.getCenter = () => Ce.getCenter(e.getBounds()), e.computeHistogram = function(r) {
      let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
      const a = [0, 0, 0, 0, 0, 0];
      e.worldToIndexBounds(r, a);
      const l = [0, 0, 0], u = [0, 0, 0];
      Ce.computeCornerPoints(a, l, u), sr(l, l), sr(u, u);
      const c = e.getDimensions();
      or(l, [0, 0, 0], [c[0] - 1, c[1] - 1, c[2] - 1], l), or(u, [0, 0, 0], [c[0] - 1, c[1] - 1, c[2] - 1], u);
      const h = c[0], y = c[0] * c[1], v = e.getPointData().getScalars().getData();
      let d = -1 / 0, g = 1 / 0, m = 0, P = 0, x = 0;
      for (let M = l[2]; M <= u[2]; M++)
        for (let E = l[1]; E <= u[1]; E++) {
          let w = l[0] + E * h + M * y;
          for (let A = l[0]; A <= u[0]; A++) {
            if (!i || i([A, E, M], a)) {
              const X = v[w];
              X > d && (d = X), X < g && (g = X), m += X * X, P += X, x += 1;
            }
            ++w;
          }
        }
      const S = x > 0 ? P / x : 0, L = x ? Math.abs(m / x - S * S) : 0, N = Math.sqrt(L);
      return {
        minimum: g,
        maximum: d,
        average: S,
        variance: L,
        sigma: N,
        count: x
      };
    }, e.computeIncrements = function(r) {
      let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
      const a = [];
      let l = i;
      for (let u = 0; u < 3; ++u)
        a[u] = l, l *= r[u * 2 + 1] - r[u * 2] + 1;
      return a;
    }, e.computeOffsetIndex = (r) => {
      let [i, a, l] = r;
      const u = e.getExtent(), c = e.getPointData().getScalars().getNumberOfComponents(), h = e.computeIncrements(u, c);
      return Math.floor((Math.round(i) - u[0]) * h[0] + (Math.round(a) - u[2]) * h[1] + (Math.round(l) - u[4]) * h[2]);
    }, e.getOffsetIndexFromWorld = (r) => {
      const i = e.getExtent(), a = e.worldToIndex(r);
      for (let l = 0; l < 3; ++l)
        if (a[l] < i[l * 2] || a[l] > i[l * 2 + 1])
          return de(`GetScalarPointer: Pixel ${a} is not in memory. Current extent = ${i}`), NaN;
      return e.computeOffsetIndex(a);
    }, e.getScalarValueFromWorld = function(r) {
      let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      const a = e.getPointData().getScalars().getNumberOfComponents();
      if (i < 0 || i >= a)
        return de(`GetScalarPointer: Scalar Component ${i} is not within bounds. Current Scalar numberOfComponents: ${a}`), NaN;
      const l = e.getOffsetIndexFromWorld(r);
      return Number.isNaN(l) ? l : e.getPointData().getScalars().getComponent(l, i);
    };
  }
  const Nc = {
    direction: null,
    // a mat3
    indexToWorld: null,
    // a mat4
    worldToIndex: null,
    // a mat4
    spacing: [1, 1, 1],
    origin: [0, 0, 0],
    extent: [0, -1, 0, -1, 0, -1],
    dataDescription: Ut.EMPTY
  };
  function Ia(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, Nc, r), Ta.extend(e, t, r), t.direction ? Array.isArray(t.direction) && (t.direction = new Float64Array(t.direction.slice(0, 9))) : t.direction = Yu(new Float64Array(9)), t.indexToWorld = new Float64Array(16), t.worldToIndex = new Float64Array(16), V.get(e, t, ["indexToWorld", "worldToIndex"]), V.setGetArray(e, t, ["origin", "spacing"], 3), V.setGetArray(e, t, ["direction"], 9), V.getArray(e, t, ["extent"], 6), wc(e, t);
  }
  const Mc = V.newInstance(Ia, "vtkImageData");
  var Ea = {
    newInstance: Mc,
    extend: Ia
  };
  const {
    vtkErrorMacro: Dc
  } = V, Ac = [1, -1, 1, -1, 1, -1];
  function Xc(e, t) {
    t.classHierarchy.push("vtkPoints"), e.getNumberOfPoints = e.getNumberOfTuples, e.setNumberOfPoints = function(r) {
      let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 3;
      e.getNumberOfPoints() !== r && (t.size = r * i, t.values = V.newTypedArray(t.dataType, t.size), e.setNumberOfComponents(i), e.modified());
    }, e.setPoint = function(r) {
      for (var i = arguments.length, a = new Array(i > 1 ? i - 1 : 0), l = 1; l < i; l++)
        a[l - 1] = arguments[l];
      e.setTuple(r, a);
    }, e.getPoint = e.getTuple, e.findPoint = e.findTuple, e.insertNextPoint = (r, i, a) => e.insertNextTuple([r, i, a]), e.getBounds = () => {
      if (e.getNumberOfComponents() === 3) {
        const a = e.getRange(0);
        t.bounds[0] = a[0], t.bounds[1] = a[1];
        const l = e.getRange(1);
        t.bounds[2] = l[0], t.bounds[3] = l[1];
        const u = e.getRange(2);
        return t.bounds[4] = u[0], t.bounds[5] = u[1], t.bounds;
      }
      if (e.getNumberOfComponents() !== 2)
        return Dc(`getBounds called on an array with components of
        ${e.getNumberOfComponents()}`), Ac;
      const r = e.getRange(0);
      t.bounds[0] = r[0], t.bounds[1] = r[1];
      const i = e.getRange(1);
      return t.bounds[2] = i[0], t.bounds[3] = i[1], t.bounds[4] = 0, t.bounds[5] = 0, t.bounds;
    }, e.computeBounds = e.getBounds, e.setNumberOfComponents(t.numberOfComponents < 2 ? 3 : t.numberOfComponents);
  }
  const _c = {
    empty: !0,
    numberOfComponents: 3,
    dataType: he.FLOAT,
    bounds: [1, -1, 1, -1, 1, -1]
  };
  function Sa(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, _c, r), Le.extend(e, t, r), Xc(e, t);
  }
  const Yc = V.newInstance(Sa, "vtkPoints");
  var yr = {
    newInstance: Yc,
    extend: Sa
  };
  function Oa(e) {
    let t = 0;
    return e.filter((r, i) => i === t ? (t += r + 1, !0) : !1);
  }
  function La(e) {
    let t = 0;
    for (let r = 0; r < e.length; )
      r += e[r] + 1, t++;
    return t;
  }
  const Bc = {
    extractCellSizes: Oa,
    getNumberOfCells: La
  };
  function bc(e, t) {
    t.classHierarchy.push("vtkCellArray");
    const r = {
      ...e
    };
    e.getNumberOfCells = (i) => (t.numberOfCells !== void 0 && !i || (t.cellSizes ? t.numberOfCells = t.cellSizes.length : t.numberOfCells = La(e.getData())), t.numberOfCells), e.getCellSizes = (i) => (t.cellSizes !== void 0 && !i || (t.cellSizes = Oa(e.getData())), t.cellSizes), e.resize = (i) => {
      const a = e.getNumberOfTuples();
      r.resize(i);
      const l = e.getNumberOfTuples();
      l < a && (l === 0 ? (t.numberOfCells = 0, t.cellSizes = []) : (t.numberOfCells = void 0, t.cellSizes = void 0));
    }, e.setData = (i) => {
      r.setData(i, 1), t.numberOfCells = void 0, t.cellSizes = void 0;
    }, e.getCell = (i) => {
      let a = i;
      const l = t.values[a++];
      return t.values.subarray(a, a + l);
    }, e.insertNextCell = (i) => {
      const a = e.getNumberOfCells();
      return e.insertNextTuples([i.length, ...i]), ++t.numberOfCells, t.cellSizes != null && t.cellSizes.push(i.length), a;
    };
  }
  function kc(e) {
    return {
      empty: !0,
      numberOfComponents: 1,
      dataType: he.UNSIGNED_INT,
      ...e
    };
  }
  function wa(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Le.extend(e, t, kc(r)), bc(e, t);
  }
  const Fc = V.newInstance(wa, "vtkCellArray");
  var xi = {
    newInstance: Fc,
    extend: wa,
    ...Bc
  };
  function Rc(e, t) {
    t.classHierarchy.push("vtkCell"), e.initialize = function(r) {
      let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
      if (i) {
        t.pointsIds = i;
        let a = t.points.getData();
        a.length !== 3 * t.pointsIds.length && (a = V.newTypedArray(r.getDataType(), 3 * t.pointsIds.length));
        const l = r.getData();
        t.pointsIds.forEach((u, c) => {
          let h = 3 * u, y = 3 * c;
          a[y] = l[h], a[++y] = l[++h], a[++y] = l[++h];
        }), t.points.setData(a);
      } else {
        t.points = r, t.pointsIds = new Array(r.getNumberOfPoints());
        for (let a = r.getNumberOfPoints() - 1; a >= 0; --a)
          t.pointsIds[a] = a;
      }
    }, e.getBounds = () => {
      const r = t.points.getNumberOfPoints(), i = [];
      if (r) {
        t.points.getPoint(0, i), t.bounds[0] = i[0], t.bounds[1] = i[0], t.bounds[2] = i[1], t.bounds[3] = i[1], t.bounds[4] = i[2], t.bounds[5] = i[2];
        for (let a = 1; a < r; a++)
          t.points.getPoint(a, i), t.bounds[0] = i[0] < t.bounds[0] ? i[0] : t.bounds[0], t.bounds[1] = i[0] > t.bounds[1] ? i[0] : t.bounds[1], t.bounds[2] = i[1] < t.bounds[2] ? i[1] : t.bounds[2], t.bounds[3] = i[1] > t.bounds[3] ? i[1] : t.bounds[3], t.bounds[4] = i[2] < t.bounds[4] ? i[2] : t.bounds[4], t.bounds[5] = i[2] > t.bounds[5] ? i[2] : t.bounds[5];
      } else
        Xs(t.bounds);
      return t.bounds;
    }, e.getLength2 = () => {
      e.getBounds();
      let r = 0, i = 0;
      for (let a = 0; a < 3; a++)
        i = t.bounds[2 * a + 1] - t.bounds[2 * a], r += i * i;
      return r;
    }, e.getParametricDistance = (r) => {
      let i, a = 0;
      for (let l = 0; l < 3; l++)
        r[l] < 0 ? i = -r[l] : r[l] > 1 ? i = r[l] - 1 : i = 0, i > a && (a = i);
      return a;
    }, e.getNumberOfPoints = () => t.points.getNumberOfPoints(), e.deepCopy = (r) => {
      r.initialize(t.points, t.pointsIds);
    }, e.getCellDimension = () => {
    }, e.intersectWithLine = (r, i, a, l, u, c, h) => {
    }, e.evaluatePosition = (r, i, a, l, u, c) => {
      V.vtkErrorMacro("vtkCell.evaluatePosition is not implemented.");
    };
  }
  const Uc = {
    bounds: [-1, -1, -1, -1, -1, -1],
    pointsIds: []
  };
  function Na(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, Uc, r), V.obj(e, t), t.points || (t.points = yr.newInstance()), V.get(e, t, ["points", "pointsIds"]), Rc(e, t);
  }
  const $c = V.newInstance(Na, "vtkCell");
  var Xn = {
    newInstance: $c,
    extend: Na
  };
  function Vc(e, t) {
    let r = t;
    for (t >= e.array.length && (r += e.array.length); r > e.array.length; ) e.array.push({
      ncells: 0,
      cells: null
    });
    e.array.length = r;
  }
  function Wc(e, t) {
    t.classHierarchy.push("vtkCellLinks"), e.buildLinks = (r) => {
      const i = r.getPoints().getNumberOfPoints(), a = r.getNumberOfCells(), l = new Uint32Array(i);
      if (r.isA("vtkPolyData")) {
        for (let u = 0; u < a; ++u) {
          const {
            cellPointIds: c
          } = r.getCellPoints(u);
          c.forEach((h) => {
            e.incrementLinkCount(h);
          });
        }
        e.allocateLinks(i), t.maxId = i - 1;
        for (let u = 0; u < a; ++u) {
          const {
            cellPointIds: c
          } = r.getCellPoints(u);
          c.forEach((h) => {
            e.insertCellReference(h, l[h]++, u);
          });
        }
      } else {
        for (let u = 0; u < a; u++)
          Xn.newInstance().getPointsIds().forEach((h) => {
            e.incrementLinkCount(h);
          });
        e.allocateLinks(i), t.maxId = i - 1;
        for (let u = 0; u < a; ++u)
          Xn.newInstance().getPointsIds().forEach((h) => {
            e.insertCellReference(h, l[h]++, u);
          });
      }
    }, e.allocate = function(r) {
      let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1e3;
      t.array = Array(r).fill().map(() => ({
        ncells: 0,
        cells: null
      })), t.extend = i, t.maxId = -1;
    }, e.initialize = () => {
      t.array = null;
    }, e.getLink = (r) => t.array[r], e.getNcells = (r) => t.array[r].ncells, e.getCells = (r) => t.array[r].cells, e.insertNextPoint = (r) => {
      t.array.push({
        ncells: r,
        cells: Array(r)
      }), ++t.maxId;
    }, e.insertNextCellReference = (r, i) => {
      t.array[r].cells[t.array[r].ncells++] = i;
    }, e.deletePoint = (r) => {
      t.array[r].ncells = 0, t.array[r].cells = null;
    }, e.removeCellReference = (r, i) => {
      t.array[i].cells = t.array[i].cells.filter((a) => a !== r), t.array[i].ncells = t.array[i].cells.length;
    }, e.addCellReference = (r, i) => {
      t.array[i].cells[t.array[i].ncells++] = r;
    }, e.resizeCellList = (r, i) => {
      t.array[r].cells.length = i;
    }, e.squeeze = () => {
      Vc(t, t.maxId + 1);
    }, e.reset = () => {
      t.maxId = -1;
    }, e.deepCopy = (r) => {
      t.array = [...r.array], t.extend = r.extend, t.maxId = r.maxId;
    }, e.incrementLinkCount = (r) => {
      ++t.array[r].ncells;
    }, e.allocateLinks = (r) => {
      for (let i = 0; i < r; ++i)
        t.array[i].cells = new Array(t.array[i].ncells);
    }, e.insertCellReference = (r, i, a) => {
      t.array[r].cells[i] = a;
    };
  }
  const zc = {
    array: null,
    // pointer to data
    maxId: 0,
    // maximum index inserted thus far
    extend: 0
    // grow array by this point
  };
  function Ma(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, zc, r), V.obj(e, t), Wc(e, t);
  }
  const jc = V.newInstance(Ma, "vtkCellLinks");
  var Gc = {
    newInstance: jc,
    extend: Ma
  };
  const at = {
    // Linear cells
    VTK_EMPTY_CELL: 0,
    VTK_VERTEX: 1,
    VTK_POLY_VERTEX: 2,
    VTK_LINE: 3,
    VTK_POLY_LINE: 4,
    VTK_TRIANGLE: 5,
    VTK_TRIANGLE_STRIP: 6,
    VTK_POLYGON: 7,
    VTK_QUAD: 9,
    // Quadratic, isoparametric cells
    VTK_QUADRATIC_EDGE: 21,
    // Special class of cells formed by convex group of points
    VTK_CONVEX_POINT_SET: 41,
    // Polyhedron cell (consisting of polygonal faces)
    VTK_POLYHEDRON: 42
  }, gr = ["vtkEmptyCell", "vtkVertex", "vtkPolyVertex", "vtkLine", "vtkPolyLine", "vtkTriangle", "vtkTriangleStrip", "vtkPolygon", "vtkPixel", "vtkQuad", "vtkTetra", "vtkVoxel", "vtkHexahedron", "vtkWedge", "vtkPyramid", "vtkPentagonalPrism", "vtkHexagonalPrism", "UnknownClass", "UnknownClass", "UnknownClass", "UnknownClass", "vtkQuadraticEdge", "vtkQuadraticTriangle", "vtkQuadraticQuad", "vtkQuadraticTetra", "vtkQuadraticHexahedron", "vtkQuadraticWedge", "vtkQuadraticPyramid", "vtkBiQuadraticQuad", "vtkTriQuadraticHexahedron", "vtkQuadraticLinearQuad", "vtkQuadraticLinearWedge", "vtkBiQuadraticQuadraticWedge", "vtkBiQuadraticQuadraticHexahedron", "vtkBiQuadraticTriangle", "vtkCubicLine", "vtkQuadraticPolygon", "UnknownClass", "UnknownClass", "UnknownClass", "UnknownClass", "vtkConvexPointSet", "UnknownClass", "UnknownClass", "UnknownClass", "UnknownClass", "UnknownClass", "UnknownClass", "UnknownClass", "UnknownClass", "UnknownClass", "vtkParametricCurve", "vtkParametricSurface", "vtkParametricTriSurface", "vtkParametricQuadSurface", "vtkParametricTetraRegion", "vtkParametricHexRegion", "UnknownClass", "UnknownClass", "UnknownClass", "vtkHigherOrderEdge", "vtkHigherOrderTriangle", "vtkHigherOrderQuad", "vtkHigherOrderPolygon", "vtkHigherOrderTetrahedron", "vtkHigherOrderWedge", "vtkHigherOrderPyramid", "vtkHigherOrderHexahedron"];
  function Zc(e) {
    return e < gr.length ? gr[e] : "UnknownClass";
  }
  function Hc(e) {
    return gr.findIndex(e);
  }
  function qc(e) {
    return e < at.VTK_QUADRATIC_EDGE || e === at.VTK_CONVEX_POINT_SET || e === at.VTK_POLYHEDRON;
  }
  function Jc(e) {
    return e === at.VTK_TRIANGLE_STRIP || e === at.VTK_POLY_LINE || e === at.VTK_POLY_VERTEX;
  }
  const Kc = {
    getClassNameFromTypeId: Zc,
    getTypeIdFromClassName: Hc,
    isLinear: qc,
    hasSubCells: Jc
  };
  function Qc(e, t) {
    t.classHierarchy.push("vtkCellTypes"), e.allocate = function() {
      let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 512, i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1e3;
      t.size = r > 0 ? r : 1, t.extend = i > 0 ? i : 1, t.maxId = -1, t.typeArray = new Uint8Array(r), t.locationArray = new Uint32Array(r);
    }, e.insertCell = (r, i, a) => {
      t.typeArray[r] = i, t.locationArray[r] = a, r > t.maxId && (t.maxId = r);
    }, e.insertNextCell = (r, i) => (e.insertCell(++t.maxId, r, i), t.maxId), e.setCellTypes = (r, i, a) => {
      t.size = r, t.typeArray = i, t.locationArray = a, t.maxId = r - 1;
    }, e.getCellLocation = (r) => t.locationArray[r], e.deleteCell = (r) => {
      t.typeArray[r] = at.VTK_EMPTY_CELL;
    }, e.getNumberOfTypes = () => t.maxId + 1, e.isType = (r) => {
      const i = e.getNumberOfTypes();
      for (let a = 0; a < i; ++a)
        if (r === e.getCellType(a))
          return !0;
      return !1;
    }, e.insertNextType = (r) => e.insertNextCell(r, -1), e.getCellType = (r) => t.typeArray[r], e.reset = () => {
      t.maxId = -1;
    }, e.deepCopy = (r) => {
      e.allocate(r.getSize(), r.getExtend()), t.typeArray.set(r.getTypeArray()), t.locationArray.set(r.getLocationArray()), t.maxId = r.getMaxId();
    };
  }
  const t0 = {
    // typeArray: null, // pointer to types array
    // locationArray: null;   // pointer to array of offsets
    size: 0,
    // allocated size of data
    maxId: -1,
    // maximum index inserted thus far
    extend: 1e3
    // grow array by this point
  };
  function Da(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, t0, r), V.obj(e, t), V.get(e, t, ["size", "maxId", "extend"]), V.getArray(e, t, ["typeArray", "locationArray"]), Qc(e, t);
  }
  const e0 = V.newInstance(Da, "vtkCellTypes");
  var n0 = {
    newInstance: e0,
    extend: Da,
    ...Kc
  };
  const r0 = {
    NO_INTERSECTION: 0,
    YES_INTERSECTION: 1,
    ON_LINE: 2
  };
  var Aa = {
    IntersectionState: r0
  };
  const {
    IntersectionState: In
  } = Aa;
  function be(e, t, r) {
    let i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : null;
    const a = {
      t: Number.MIN_VALUE,
      distance: 0
    }, l = [];
    let u;
    l[0] = r[0] - t[0], l[1] = r[1] - t[1], l[2] = r[2] - t[2];
    const c = l[0] * (e[0] - t[0]) + l[1] * (e[1] - t[1]) + l[2] * (e[2] - t[2]), h = q(l, l);
    let y = 1e-5 * c;
    return h !== 0 && (a.t = c / h), y < 0 && (y = -y), -y < h && h < y || h <= 0 || a.t < 0 ? u = t : a.t > 1 ? u = r : (u = l, l[0] = t[0] + a.t * l[0], l[1] = t[1] + a.t * l[1], l[2] = t[2] + a.t * l[2]), i && (i[0] = u[0], i[1] = u[1], i[2] = u[2]), a.distance = qt(u, e), a;
  }
  function Xa(e, t, r, i, a, l) {
    const u = [], c = [], h = [];
    a[0] = 0, l[0] = 0, ie(t, e, u), ie(i, r, c), ie(r, e, h);
    const y = [q(u, u), -q(u, c), -q(u, c), q(c, c)], v = [];
    if (v[0] = q(u, h), v[1] = -q(c, h), Ls(y, v, 2) === 0) {
      let d = Number.MAX_VALUE;
      const g = [e, t, r, i], m = [r, r, e, e], P = [i, i, t, t];
      l[0], l[0], a[0], a[0], a[0], a[0], l[0], l[0];
      let x;
      for (let S = 0; S < 4; S++)
        x = be(g[S], m[S], P[S]), x.distance < d && (d = x.distance);
      return In.ON_LINE;
    }
    return a[0] = v[0], l[0] = v[1], a[0] >= 0 && a[0] <= 1 && l[0] >= 0 && l[0] <= 1 ? In.YES_INTERSECTION : In.NO_INTERSECTION;
  }
  const i0 = {
    distanceToLine: be,
    intersection: Xa
  };
  function s0(e, t) {
    t.classHierarchy.push("vtkLine");
    function r(i) {
      return i >= 0 && i <= 1;
    }
    e.getCellDimension = () => 1, e.intersectWithLine = (i, a, l, u, c) => {
      const h = {
        intersect: 0,
        t: Number.MAX_VALUE,
        subId: 0,
        betweenPoints: null
      };
      c[1] = 0, c[2] = 0;
      const y = [], v = [], d = [];
      t.points.getPoint(0, v), t.points.getPoint(1, d);
      const g = [], m = [], P = Xa(i, a, v, d, g, m);
      if (h.t = g[0], h.betweenPoints = r(h.t), c[0] = m[0], P === In.YES_INTERSECTION) {
        for (let x = 0; x < 3; x++)
          u[x] = v[x] + c[0] * (d[x] - v[x]), y[x] = i[x] + h.t * (a[x] - i[x]);
        if (qt(u, y) <= l * l)
          return h.intersect = 1, h;
      } else {
        let x;
        if (h.t < 0)
          return x = be(i, v, d, u), x.distance <= l * l && (h.t = 0, h.intersect = 1, h.betweenPoints = !0), h;
        if (h.t > 1)
          return x = be(a, v, d, u), x.distance <= l * l && (h.t = 1, h.intersect = 1, h.betweenPoints = !0), h;
        if (c[0] < 0)
          return c[0] = 0, x = be(v, i, a, u), h.t = x.t, x.distance <= l * l && (h.intersect = 1), h;
        if (c[0] > 1)
          return c[0] = 1, x = be(d, i, a, u), h.t = x.t, x.distance <= l * l && (h.intersect = 1), h;
      }
      return h;
    }, e.evaluateLocation = (i, a, l) => {
      const u = [], c = [];
      t.points.getPoint(0, u), t.points.getPoint(1, c);
      for (let h = 0; h < 3; h++)
        a[h] = u[h] + i[0] * (c[h] - u[h]);
      l[0] = 1 - i[0], l[1] = i[0];
    }, e.evaluateOrientation = (i, a, l) => t.orientations ? (xn(a, t.orientations[0], t.orientations[1], i[0]), l[0] = 1 - i[0], l[1] = i[0], !0) : !1;
  }
  const a0 = {
    orientations: null
    // an array of two quat or null
  };
  function _a(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, a0, r), Xn.extend(e, t, r), V.setGet(e, t, ["orientations"]), s0(e, t);
  }
  const o0 = V.newInstance(_a, "vtkLine");
  var _t = {
    newInstance: o0,
    extend: _a,
    ...i0,
    ...Aa
  };
  function l0(e, t) {
    t.classHierarchy.push("vtkPointSet"), t.points ? t.points = Vt(t.points) : t.points = yr.newInstance(), e.getNumberOfPoints = () => t.points.getNumberOfPoints(), e.getBounds = () => t.points.getBounds(), e.computeBounds = () => {
      e.getBounds();
    };
    const r = e.shallowCopy;
    e.shallowCopy = function(i) {
      let a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
      r(i, a), t.points = yr.newInstance(), t.points.shallowCopy(i.getPoints());
    };
  }
  const f0 = {
    // points: null,
  };
  function Ya(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, f0, r), Ta.extend(e, t, r), V.setGet(e, t, ["points"]), l0(e, t);
  }
  const u0 = V.newInstance(Ya, "vtkPointSet");
  var c0 = {
    newInstance: u0,
    extend: Ya
  };
  function Kr(e, t, r, i) {
    const a = r[0] - t[0], l = r[1] - t[1], u = r[2] - t[2], c = e[0] - t[0], h = e[1] - t[1], y = e[2] - t[2];
    i[0] = l * y - u * h, i[1] = u * c - a * y, i[2] = a * h - l * c;
  }
  function _n(e, t, r, i) {
    Kr(e, t, r, i);
    const a = Math.sqrt(i[0] * i[0] + i[1] * i[1] + i[2] * i[2]);
    a !== 0 && (i[0] /= a, i[1] /= a, i[2] /= a);
  }
  function h0(e, t, r, i, a, l) {
    let u = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : 1e-6, c = !1;
    const h = [], y = [], v = [], d = [], g = [];
    _n(e, t, r, d), _n(i, a, l, g);
    const m = -q(d, e), P = -q(g, i), x = [q(g, e) + P, q(g, t) + P, q(g, r) + P];
    if (x[0] * x[1] > u && x[0] * x[2] > u)
      return {
        intersect: !1,
        coplanar: c,
        pt1: h,
        pt2: y,
        surfaceId: v
      };
    const S = [q(d, i) + m, q(d, a) + m, q(d, l) + m];
    if (S[0] * S[1] > u && S[0] * S[2] > u)
      return {
        intersect: !1,
        coplanar: c,
        pt1: h,
        pt2: y,
        surfaceId: v
      };
    if (Math.abs(d[0] - g[0]) < 1e-9 && Math.abs(d[1] - g[1]) < 1e-9 && Math.abs(d[2] - g[2]) < 1e-9 && Math.abs(m - P) < 1e-9)
      return c = !0, {
        intersect: !1,
        coplanar: c,
        pt1: h,
        pt2: y,
        surfaceId: v
      };
    const L = [e, t, r], N = [i, a, l], M = q(d, g), E = (m - P * M) / (M * M - 1), w = (P - m * M) / (M * M - 1), A = [E * d[0] + w * g[0], E * d[1] + w * g[1], E * d[2] + w * g[2]], X = Oe(d, g, []);
    Fr(X);
    let _ = 0, k = 0;
    const Y = [], F = [];
    let W = 50, U = 50;
    for (let nt = 0; nt < 3; nt++) {
      const lt = nt, H = (nt + 1) % 3, Z = We.intersectWithLine(L[lt], L[H], i, g);
      Z.intersection && Z.t > 0 - u && Z.t < 1 + u && (Z.t < 1 + u && Z.t > 1 - u && (W = _), Y[_++] = q(Z.x, X) - q(A, X));
      const ht = We.intersectWithLine(N[lt], N[H], e, d);
      ht.intersection && ht.t > 0 - u && ht.t < 1 + u && (ht.t < 1 + u && ht.t > 1 - u && (U = k), F[k++] = q(ht.x, X) - q(A, X));
    }
    if (_ > 2) {
      _--;
      const nt = Y[2];
      Y[2] = Y[W], Y[W] = nt;
    }
    if (k > 2) {
      k--;
      const nt = F[2];
      F[2] = F[U], F[U] = nt;
    }
    if (_ !== 2 || k !== 2)
      return {
        intersect: !1,
        coplanar: c,
        pt1: h,
        pt2: y,
        surfaceId: v
      };
    if (Number.isNaN(Y[0]) || Number.isNaN(Y[1]) || Number.isNaN(F[0]) || Number.isNaN(F[1]))
      return {
        intersect: !1,
        coplanar: c,
        pt1: h,
        pt2: y,
        surfaceId: v
      };
    if (Y[0] > Y[1]) {
      const nt = Y[1];
      Y[1] = Y[0], Y[0] = nt;
    }
    if (F[0] > F[1]) {
      const nt = F[1];
      F[1] = F[0], F[0] = nt;
    }
    let R, j;
    return Y[1] < F[0] || F[1] < Y[0] ? {
      intersect: !1,
      coplanar: c,
      pt1: h,
      pt2: y,
      surfaceId: v
    } : (Y[0] < F[0] ? Y[1] < F[1] ? (v[0] = 2, v[1] = 1, R = F[0], j = Y[1]) : (v[0] = 2, v[1] = 2, R = F[0], j = F[1]) : Y[1] < F[1] ? (v[0] = 1, v[1] = 1, R = Y[0], j = Y[1]) : (v[0] = 1, v[1] = 2, R = Y[0], j = F[1]), nr(A, X, R, h), nr(A, X, j, y), {
      intersect: !0,
      coplanar: c,
      pt1: h,
      pt2: y,
      surfaceId: v
    });
  }
  const p0 = {
    computeNormalDirection: Kr,
    computeNormal: _n,
    intersectWithTriangle: h0
  };
  function y0(e, t) {
    t.classHierarchy.push("vtkTriangle"), e.getCellDimension = () => 2, e.intersectWithLine = (r, i, a, l, u) => {
      const c = {
        subId: 0,
        t: Number.MAX_VALUE,
        intersect: 0,
        betweenPoints: !1
      };
      u[2] = 0;
      const h = [], y = a * a, v = [], d = [], g = [];
      t.points.getPoint(0, v), t.points.getPoint(1, d), t.points.getPoint(2, g);
      const m = [], P = [];
      if (_n(v, d, g, m), m[0] !== 0 || m[1] !== 0 || m[2] !== 0) {
        const M = We.intersectWithLine(r, i, v, m);
        if (c.betweenPoints = M.betweenPoints, c.t = M.t, l[0] = M.x[0], l[1] = M.x[1], l[2] = M.x[2], !M.intersection)
          return u[0] = 0, u[1] = 0, c.intersect = 0, c;
        const E = e.evaluatePosition(l, h, u, P);
        if (E.evaluation >= 0)
          return E.dist2 <= y ? (c.intersect = 1, c) : (c.intersect = E.evaluation, c);
      }
      const x = qt(v, d), S = qt(d, g), L = qt(g, v);
      t.line || (t.line = _t.newInstance()), x > S && x > L ? (t.line.getPoints().setPoint(0, v), t.line.getPoints().setPoint(1, d)) : S > L && S > x ? (t.line.getPoints().setPoint(0, d), t.line.getPoints().setPoint(1, g)) : (t.line.getPoints().setPoint(0, g), t.line.getPoints().setPoint(1, v));
      const N = t.line.intersectWithLine(r, i, a, l, u);
      if (c.betweenPoints = N.betweenPoints, c.t = N.t, N.intersect) {
        const M = [], E = [], w = [];
        for (let A = 0; A < 3; A++)
          M[A] = v[A] - g[A], E[A] = d[A] - g[A], w[A] = l[A] - g[A];
        return u[0] = q(w, M) / L, u[1] = q(w, E) / S, c.intersect = 1, c;
      }
      return u[0] = 0, u[1] = 0, c.intersect = 0, c;
    }, e.evaluatePosition = (r, i, a, l) => {
      const u = {
        subId: 0,
        dist2: 0,
        evaluation: -1
      };
      let c, h;
      const y = [], v = [], d = [], g = [];
      let m;
      const P = [], x = [], S = [];
      let L = 0, N = 0;
      const M = [];
      let E, w, A, X = [];
      const _ = [], k = [], Y = [];
      u.subId = 0, a[2] = 0, t.points.getPoint(1, y), t.points.getPoint(2, v), t.points.getPoint(0, d), Kr(y, v, d, g), We.generalizedProjectPoint(r, y, g, Y);
      let F = 0;
      for (c = 0; c < 3; c++)
        g[c] < 0 ? m = -g[c] : m = g[c], m > F && (F = m, N = c);
      for (h = 0, c = 0; c < 3; c++)
        c !== N && (M[h++] = c);
      for (c = 0; c < 2; c++)
        P[c] = Y[M[c]] - d[M[c]], x[c] = y[M[c]] - d[M[c]], S[c] = v[M[c]] - d[M[c]];
      if (L = ut(x, S), L === 0)
        return a[0] = 0, a[1] = 0, u.evaluation = -1, u;
      if (a[0] = ut(P, S) / L, a[1] = ut(x, P) / L, l[0] = 1 - (a[0] + a[1]), l[1] = a[0], l[2] = a[1], l[0] >= 0 && l[0] <= 1 && l[1] >= 0 && l[1] <= 1 && l[2] >= 0 && l[2] <= 1)
        i && (u.dist2 = qt(Y, r), i[0] = Y[0], i[1] = Y[1], i[2] = Y[2]), u.evaluation = 1;
      else {
        let W;
        if (i) {
          if (l[1] < 0 && l[2] < 0)
            for (E = qt(r, d), w = _t.distanceToLine(r, y, d, W, _), A = _t.distanceToLine(r, d, v, W, k), E < w ? (u.dist2 = E, X = d) : (u.dist2 = w, X = _), A < u.dist2 && (u.dist2 = A, X = k), c = 0; c < 3; c++)
              i[c] = X[c];
          else if (l[2] < 0 && l[0] < 0)
            for (E = qt(r, y), w = _t.distanceToLine(r, y, d, W, _), A = _t.distanceToLine(r, y, v, W, k), E < w ? (u.dist2 = E, X = y) : (u.dist2 = w, X = _), A < u.dist2 && (u.dist2 = A, X = k), c = 0; c < 3; c++)
              i[c] = X[c];
          else if (l[1] < 0 && l[0] < 0)
            for (E = qt(r, v), w = _t.distanceToLine(r, v, d, W, _), A = _t.distanceToLine(r, y, v, W, k), E < w ? (u.dist2 = E, X = v) : (u.dist2 = w, X = _), A < u.dist2 && (u.dist2 = A, X = k), c = 0; c < 3; c++)
              i[c] = X[c];
          else if (l[0] < 0) {
            const U = _t.distanceToLine(r, y, v, i);
            u.dist2 = U.distance;
          } else if (l[1] < 0) {
            const U = _t.distanceToLine(r, v, d, i);
            u.dist2 = U.distance;
          } else if (l[2] < 0) {
            const U = _t.distanceToLine(r, y, d, i);
            u.dist2 = U.distance;
          }
        }
        u.evaluation = 0;
      }
      return u;
    }, e.evaluateLocation = (r, i, a) => {
      const l = [], u = [], c = [];
      t.points.getPoint(0, l), t.points.getPoint(1, u), t.points.getPoint(2, c);
      const h = 1 - r[0] - r[1];
      for (let y = 0; y < 3; y++)
        i[y] = l[y] * h + u[y] * r[0] + c[y] * r[1];
      a[0] = h, a[1] = r[0], a[2] = r[1];
    }, e.getParametricDistance = (r) => {
      let i, a = 0;
      const l = [];
      l[0] = r[0], l[1] = r[1], l[2] = 1 - r[0] - r[1];
      for (let u = 0; u < 3; u++)
        l[u] < 0 ? i = -l[u] : l[u] > 1 ? i = l[u] - 1 : i = 0, i > a && (a = i);
      return a;
    };
  }
  const g0 = {};
  function Ba(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, g0, r), Xn.extend(e, t, r), y0(e, t);
  }
  const v0 = V.newInstance(Ba, "vtkTriangle");
  var m0 = {
    newInstance: v0,
    extend: Ba,
    ...p0
  };
  const Jn = ["verts", "lines", "polys", "strips"], {
    vtkWarningMacro: Ii
  } = V, d0 = {
    [at.VTK_LINE]: _t,
    [at.VTK_POLY_LINE]: _t,
    [at.VTK_TRIANGLE]: m0
  };
  function C0(e, t) {
    t.classHierarchy.push("vtkPolyData");
    function r(a) {
      return a.replace(/(?:^\w|[A-Z]|\b\w)/g, (l) => l.toUpperCase()).replace(/\s+/g, "");
    }
    Jn.forEach((a) => {
      e[`getNumberOf${r(a)}`] = () => t[a].getNumberOfCells(), t[a] ? t[a] = Vt(t[a]) : t[a] = xi.newInstance();
    }), e.getNumberOfCells = () => Jn.reduce((a, l) => a + t[l].getNumberOfCells(), 0);
    const i = e.shallowCopy;
    e.shallowCopy = function(a) {
      let l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
      i(a, l), Jn.forEach((u) => {
        t[u] = xi.newInstance(), t[u].shallowCopy(a.getReferenceByName(u));
      });
    }, e.buildCells = () => {
      const a = e.getNumberOfVerts(), l = e.getNumberOfLines(), u = e.getNumberOfPolys(), c = e.getNumberOfStrips(), h = a + l + u + c, y = new Uint8Array(h);
      let v = y;
      const d = new Uint32Array(h);
      let g = d;
      if (a) {
        let m = 0;
        t.verts.getCellSizes().forEach((P, x) => {
          g[x] = m, v[x] = P > 1 ? at.VTK_POLY_VERTEX : at.VTK_VERTEX, m += P + 1;
        }), g = g.subarray(a), v = v.subarray(a);
      }
      if (l) {
        let m = 0;
        t.lines.getCellSizes().forEach((P, x) => {
          g[x] = m, v[x] = P > 2 ? at.VTK_POLY_LINE : at.VTK_LINE, P === 1 && Ii("Building VTK_LINE ", x, " with only one point, but VTK_LINE needs at least two points. Check the input."), m += P + 1;
        }), g = g.subarray(l), v = v.subarray(l);
      }
      if (u) {
        let m = 0;
        t.polys.getCellSizes().forEach((P, x) => {
          switch (g[x] = m, P) {
            case 3:
              v[x] = at.VTK_TRIANGLE;
              break;
            case 4:
              v[x] = at.VTK_QUAD;
              break;
            default:
              v[x] = at.VTK_POLYGON;
              break;
          }
          P < 3 && Ii("Building VTK_TRIANGLE ", x, " with less than three points, but VTK_TRIANGLE needs at least three points. Check the input."), m += P + 1;
        }), g += g.subarray(u), v += v.subarray(u);
      }
      if (c) {
        let m = 0;
        v.fill(at.VTK_TRIANGLE_STRIP, 0, c), t.strips.getCellSizes().forEach((P, x) => {
          g[x] = m, m += P + 1;
        });
      }
      t.cells = n0.newInstance(), t.cells.setCellTypes(h, y, d);
    }, e.buildLinks = function() {
      let a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
      t.cells === void 0 && e.buildCells(), t.links = Gc.newInstance(), a > 0 ? t.links.allocate(a) : t.links.allocate(e.getPoints().getNumberOfPoints()), t.links.buildLinks(e);
    }, e.getCellType = (a) => t.cells.getCellType(a), e.getCellPoints = (a) => {
      const l = e.getCellType(a);
      let u = null;
      switch (l) {
        case at.VTK_VERTEX:
        case at.VTK_POLY_VERTEX:
          u = t.verts;
          break;
        case at.VTK_LINE:
        case at.VTK_POLY_LINE:
          u = t.lines;
          break;
        case at.VTK_TRIANGLE:
        case at.VTK_QUAD:
        case at.VTK_POLYGON:
          u = t.polys;
          break;
        case at.VTK_TRIANGLE_STRIP:
          u = t.strips;
          break;
        default:
          return u = null, {
            type: 0,
            cellPointIds: null
          };
      }
      const c = t.cells.getCellLocation(a), h = u.getCell(c);
      return {
        cellType: l,
        cellPointIds: h
      };
    }, e.getPointCells = (a) => t.links.getCells(a), e.getCellEdgeNeighbors = (a, l, u) => {
      const c = t.links.getLink(l), h = t.links.getLink(u);
      return c.cells.filter((y) => y !== a && h.cells.indexOf(y) !== -1);
    }, e.getCell = function(a) {
      let l = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
      const u = e.getCellPoints(a), c = l || d0[u.cellType].newInstance();
      return c.initialize(e.getPoints(), u.cellPointIds), c;
    };
  }
  const P0 = {
    // verts: null,
    // lines: null,
    // polys: null,
    // strips: null,
    // cells: null,
    // links: null,
  };
  function ba(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, P0, r), c0.extend(e, t, r), V.get(e, t, ["cells", "links"]), V.setGet(e, t, ["verts", "lines", "polys", "strips"]), C0(e, t);
  }
  const T0 = V.newInstance(ba, "vtkPolyData");
  var x0 = {
    newInstance: T0,
    extend: ba
  };
  const I0 = (e) => e, Ei = 1e-6;
  class ka {
    constructor() {
      let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
      this.matrix = Te(new Float64Array(16)), this.tmp = new Float64Array(3), this.angleConv = t ? Xu : I0;
    }
    rotateFromDirections(t, r) {
      const i = new Float64Array(3), a = new Float64Array(3), l = new Float64Array(16);
      _e(i, t[0], t[1], t[2]), _e(a, r[0], r[1], r[2]), Tn(i, i), Tn(a, a);
      const u = $s(i, a);
      return u >= 1 ? this : (Ue(this.tmp, i, a), fr(this.tmp) < Ei && (Ue(this.tmp, [1, 0, 0], t), fr(this.tmp) < Ei && Ue(this.tmp, [0, 1, 0], t)), $u(l, Math.acos(u), this.tmp), xe(this.matrix, this.matrix, l), this);
    }
    rotate(t, r) {
      return _e(this.tmp, ...r), Tn(this.tmp, this.tmp), bu(this.matrix, this.matrix, this.angleConv(t), this.tmp), this;
    }
    rotateX(t) {
      return ku(this.matrix, this.matrix, this.angleConv(t)), this;
    }
    rotateY(t) {
      return Fu(this.matrix, this.matrix, this.angleConv(t)), this;
    }
    rotateZ(t) {
      return Ru(this.matrix, this.matrix, this.angleConv(t)), this;
    }
    translate(t, r, i) {
      return _e(this.tmp, t, r, i), Bu(this.matrix, this.matrix, this.tmp), this;
    }
    scale(t, r, i) {
      return _e(this.tmp, t, r, i), Rs(this.matrix, this.matrix, this.tmp), this;
    }
    multiply(t) {
      return xe(this.matrix, this.matrix, t), this;
    }
    multiply3x3(t) {
      return xe(this.matrix, this.matrix, [t[0], t[1], t[2], 0, t[3], t[4], t[5], 0, t[6], t[7], t[8], 0, 0, 0, 0, 1]), this;
    }
    invert() {
      return wn(this.matrix, this.matrix), this;
    }
    identity() {
      return Te(this.matrix), this;
    }
    //-----------
    apply(t) {
      let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : -1;
      if (Rn(hs, this.matrix))
        return this;
      const a = i === -1 ? t.length : r + i * 3;
      for (let l = r; l < a; l += 3)
        _e(this.tmp, t[l], t[l + 1], t[l + 2]), Nn(this.tmp, this.tmp, this.matrix), t[l] = this.tmp[0], t[l + 1] = this.tmp[1], t[l + 2] = this.tmp[2];
      return this;
    }
    getMatrix() {
      return this.matrix;
    }
    setMatrix(t) {
      return t && t.length === 16 && Pn(this.matrix, t), this;
    }
  }
  function E0() {
    return new ka(!0);
  }
  function S0() {
    return new ka(!1);
  }
  var O0 = {
    buildFromDegree: E0,
    buildFromRadian: S0
  };
  class L0 {
    constructor() {
      let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
      this.oriented = t, this.edgeMap = /* @__PURE__ */ new Map();
    }
    initialize() {
      this.edgeMap.clear();
    }
    computeEdgeKey(t, r) {
      return this.oriented || t < r ? (
        // Cantor pairing function:
        0.5 * (t * r) * (t * r + 1) + r
      ) : 0.5 * (r * t) * (r * t + 1) + t;
    }
    insertUniqueEdge(t, r, i) {
      const a = this.computeEdgeKey(t, r);
      let l = this.edgeMap.get(a);
      return l || (l = {
        key: a,
        edgeId: this.edgeMap.size,
        value: i
      }, this.edgeMap.set(a, l)), l;
    }
    insertEdge(t, r, i) {
      const a = this.computeEdgeKey(t, r), l = {
        key: a,
        edgeId: this.edgeMap.size,
        value: i
      };
      return this.edgeMap.set(a, l), l;
    }
    isInsertedEdge(t, r) {
      const i = this.computeEdgeKey(t, r);
      return this.edgeMap.get(i);
    }
    static getEdgePointIds(t) {
      const r = 0.5 * (-1 + Math.sqrt(8 * t.key + 1)), i = t.key - 0.5 * (r + 1) * r, a = r - i;
      return [i, a];
    }
  }
  function w0() {
    let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    return new L0(e.oriented);
  }
  var N0 = {
    newInstance: w0
  };
  const M0 = [
    [-1, -1, -1, -1, -1],
    [0, 3, -1, -1, -1],
    [1, 0, -1, -1, -1],
    [1, 3, -1, -1, -1],
    [2, 1, -1, -1, -1],
    [0, 3, 2, 1, -1],
    [2, 0, -1, -1, -1],
    [2, 3, -1, -1, -1],
    [3, 2, -1, -1, -1],
    [0, 2, -1, -1, -1],
    [1, 0, 3, 2, -1],
    [1, 2, -1, -1, -1],
    [3, 1, -1, -1, -1],
    [0, 1, -1, -1, -1],
    [3, 0, -1, -1, -1],
    [-1, -1, -1, -1, -1]
    /* 15 */
  ], D0 = [[0, 1], [1, 3], [2, 3], [0, 2]];
  function A0(e) {
    return M0[e];
  }
  function X0(e) {
    return D0[e];
  }
  var Si = {
    getCase: A0,
    getEdge: X0
  };
  const {
    vtkErrorMacro: Oi,
    vtkDebugMacro: _0
  } = V;
  function Y0(e, t) {
    function r() {
      let c = 0, h = 1;
      return t.slicingMode === 1 ? (c = 0, h = 2) : t.slicingMode === 0 && (c = 1, h = 2), [c, h];
    }
    t.classHierarchy.push("vtkImageMarchingSquares"), e.getContourValues = () => t.contourValues, e.setContourValues = (c) => {
      t.contourValues = c, e.modified();
    };
    const i = [], a = [], l = [], u = N0.newInstance();
    e.getPixelScalars = (c, h, y, v, d, g) => {
      const [m, P, x] = c;
      i[0] = x * h[1] * h[0] + P * h[0] + m, i[1] = i[0] + v[d], i[2] = i[0] + v[g], i[3] = i[2] + v[d];
      for (let S = 0; S < 4; ++S)
        a[S] = y[i[S]];
    }, e.getPixelPoints = (c, h, y, v, d) => {
      const g = c[v], m = c[d];
      l[0] = h[v] + g * y[v], l[1] = h[d] + m * y[d], l[2] = l[0] + y[v], l[3] = l[1], l[4] = l[0], l[5] = l[1] + y[d], l[6] = l[2], l[7] = l[5];
    }, e.produceLines = (c, h, y, v, d, g, m, P, x, S, L) => {
      var k;
      const N = h[t.slicingMode], M = [1, 2, 8, 4], E = [];
      let w;
      e.getPixelScalars(h, y, g, x, S, L);
      let A = 0;
      for (let Y = 0; Y < 4; Y++)
        a[Y] >= c && (A |= M[Y]);
      const X = Si.getCase(A);
      if (X[0] < 0)
        return;
      e.getPixelPoints(h, v, d, S, L);
      const _ = v[t.slicingMode] + N * d[t.slicingMode];
      for (let Y = 0; X[Y] >= 0; Y += 2) {
        P.push(2);
        for (let F = 0; F < 2; F++) {
          const W = Si.getEdge(X[Y + F]);
          if (w = void 0, t.mergePoints && (w = (k = u.isInsertedEdge(i[W[0]], i[W[1]])) == null ? void 0 : k.value), w === void 0) {
            const U = (c - a[W[0]]) / (a[W[1]] - a[W[0]]), R = l.slice(W[0] * 2, (W[0] + 1) * 2), j = l.slice(W[1] * 2, (W[1] + 1) * 2);
            E[S] = R[0] + U * (j[0] - R[0]), E[L] = R[1] + U * (j[1] - R[1]), E[t.slicingMode] = _, w = m.length / 3, m.push(E[0], E[1], E[2]), t.mergePoints && u.insertEdge(i[W[0]], i[W[1]], w);
          }
          P.push(w);
        }
      }
    }, e.requestData = (c, h) => {
      const y = c[0];
      if (!y) {
        Oi("Invalid or missing input");
        return;
      }
      if (t.slicingMode == null || t.slicingMode < 0 || t.slicingMode > 2) {
        Oi("Invalid or missing slicing mode");
        return;
      }
      console.time("msquares");
      const v = y.getOrigin(), d = y.getSpacing(), g = y.getDimensions(), m = y.getExtent(), P = y.computeIncrements(m), x = y.getPointData().getScalars().getData(), [S, L] = r(), N = [], M = [];
      let E = Math.round(t.slice);
      E >= g[t.slicingMode] && (E = 0);
      const w = [0, 0, 0];
      w[t.slicingMode] = E;
      for (let X = 0; X < t.contourValues.length; ++X) {
        for (let _ = 0; _ < g[L] - 1; ++_) {
          w[L] = _;
          for (let k = 0; k < g[S] - 1; ++k)
            w[S] = k, e.produceLines(t.contourValues[X], w, g, v, d, x, N, M, P, S, L);
        }
        u.initialize();
      }
      const A = x0.newInstance();
      A.getPoints().setData(new Float32Array(N), 3), A.getLines().setData(new Uint32Array(M)), h[0] = A, _0("Produced output"), console.timeEnd("msquares");
    };
  }
  const B0 = {
    contourValues: [],
    slicingMode: 2,
    slice: 0,
    mergePoints: !1
  };
  function Fa(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, B0, r), V.obj(e, t), V.algo(e, t, 1, 1), V.setGet(e, t, ["slicingMode", "slice", "mergePoints"]), V.algo(e, t, 1, 1), Y0(e, t);
  }
  const b0 = V.newInstance(Fa, "vtkImageMarchingSquares");
  var k0 = {
    newInstance: b0,
    extend: Fa
  };
  function F0(e, t) {
    const r = t * 3;
    if (r < e.length)
      return ur(e[r], e[r + 1], e[r + 2]);
  }
  function R0(e) {
    const t = e.getLines().getData();
    let r = 0;
    const i = /* @__PURE__ */ new Map();
    for (; r < t.length; ) {
      const c = t[r++], h = [];
      for (let y = 0; y < c; y++)
        h.push(t[r + y]);
      i.set(h[0], h), r += c;
    }
    const a = [], l = (c) => {
      for (const [h, y] of c.entries())
        if (y !== void 0)
          return h;
      return -1;
    };
    let u = l(i);
    for (; u !== -1; ) {
      const c = [u];
      for (; i.has(u); ) {
        const h = i.get(u)[1];
        i.has(h) && c.push(h), i.delete(u), u = h;
      }
      a.push(c), u = l(i);
    }
    return a.length ? a : void 0;
  }
  function U0(e) {
    const t = R0(e);
    if (!t)
      return;
    const r = e.getPoints().getData();
    return t.map((i) => i.map((a) => F0(r, a)));
  }
  var ze = {}, Ra = { exports: {} };
  (function(e) {
    (function() {
      var t = {};
      t.version = "6.4.2.2", t.use_lines = !0, t.use_xyz = !1;
      var r = !1;
      e.exports ? (e.exports = t, r = !0) : typeof document < "u" ? window.ClipperLib = t : self.ClipperLib = t;
      var i;
      if (r) {
        var a = "chrome";
        i = "Netscape";
      } else {
        var a = navigator.userAgent.toString().toLowerCase();
        i = navigator.appName;
      }
      var l = {};
      a.indexOf("chrome") != -1 && a.indexOf("chromium") == -1 ? l.chrome = 1 : l.chrome = 0, a.indexOf("chromium") != -1 ? l.chromium = 1 : l.chromium = 0, a.indexOf("safari") != -1 && a.indexOf("chrome") == -1 && a.indexOf("chromium") == -1 ? l.safari = 1 : l.safari = 0, a.indexOf("firefox") != -1 ? l.firefox = 1 : l.firefox = 0, a.indexOf("firefox/17") != -1 ? l.firefox17 = 1 : l.firefox17 = 0, a.indexOf("firefox/15") != -1 ? l.firefox15 = 1 : l.firefox15 = 0, a.indexOf("firefox/3") != -1 ? l.firefox3 = 1 : l.firefox3 = 0, a.indexOf("opera") != -1 ? l.opera = 1 : l.opera = 0, a.indexOf("msie 10") != -1 ? l.msie10 = 1 : l.msie10 = 0, a.indexOf("msie 9") != -1 ? l.msie9 = 1 : l.msie9 = 0, a.indexOf("msie 8") != -1 ? l.msie8 = 1 : l.msie8 = 0, a.indexOf("msie 7") != -1 ? l.msie7 = 1 : l.msie7 = 0, a.indexOf("msie ") != -1 ? l.msie = 1 : l.msie = 0, t.biginteger_used = null;
      var u;
      function c(n, s, o) {
        t.biginteger_used = 1, n != null && (typeof n == "number" && typeof s > "u" ? this.fromInt(n) : typeof n == "number" ? this.fromNumber(n, s, o) : s == null && typeof n != "string" ? this.fromString(n, 256) : this.fromString(n, s));
      }
      function h() {
        return new c(null, void 0, void 0);
      }
      function y(n, s, o, f, p, C) {
        for (; --C >= 0; ) {
          var T = s * this[n++] + o[f] + p;
          p = Math.floor(T / 67108864), o[f++] = T & 67108863;
        }
        return p;
      }
      function v(n, s, o, f, p, C) {
        for (var T = s & 32767, I = s >> 15; --C >= 0; ) {
          var O = this[n] & 32767, D = this[n++] >> 15, b = I * O + D * T;
          O = T * O + ((b & 32767) << 15) + o[f] + (p & 1073741823), p = (O >>> 30) + (b >>> 15) + I * D + (p >>> 30), o[f++] = O & 1073741823;
        }
        return p;
      }
      function d(n, s, o, f, p, C) {
        for (var T = s & 16383, I = s >> 14; --C >= 0; ) {
          var O = this[n] & 16383, D = this[n++] >> 14, b = I * O + D * T;
          O = T * O + ((b & 16383) << 14) + o[f] + p, p = (O >> 28) + (b >> 14) + I * D, o[f++] = O & 268435455;
        }
        return p;
      }
      i == "Microsoft Internet Explorer" ? (c.prototype.am = v, u = 30) : i != "Netscape" ? (c.prototype.am = y, u = 26) : (c.prototype.am = d, u = 28), c.prototype.DB = u, c.prototype.DM = (1 << u) - 1, c.prototype.DV = 1 << u;
      var g = 52;
      c.prototype.FV = Math.pow(2, g), c.prototype.F1 = g - u, c.prototype.F2 = 2 * u - g;
      var m = "0123456789abcdefghijklmnopqrstuvwxyz", P = new Array(), x, S;
      for (x = 48, S = 0; S <= 9; ++S) P[x++] = S;
      for (x = 97, S = 10; S < 36; ++S) P[x++] = S;
      for (x = 65, S = 10; S < 36; ++S) P[x++] = S;
      function L(n) {
        return m.charAt(n);
      }
      function N(n, s) {
        var o = P[n.charCodeAt(s)];
        return o ?? -1;
      }
      function M(n) {
        for (var s = this.t - 1; s >= 0; --s) n[s] = this[s];
        n.t = this.t, n.s = this.s;
      }
      function E(n) {
        this.t = 1, this.s = n < 0 ? -1 : 0, n > 0 ? this[0] = n : n < -1 ? this[0] = n + this.DV : this.t = 0;
      }
      function w(n) {
        var s = h();
        return s.fromInt(n), s;
      }
      function A(n, s) {
        var o;
        if (s == 16) o = 4;
        else if (s == 8) o = 3;
        else if (s == 256) o = 8;
        else if (s == 2) o = 1;
        else if (s == 32) o = 5;
        else if (s == 4) o = 2;
        else {
          this.fromRadix(n, s);
          return;
        }
        this.t = 0, this.s = 0;
        for (var f = n.length, p = !1, C = 0; --f >= 0; ) {
          var T = o == 8 ? n[f] & 255 : N(n, f);
          if (T < 0) {
            n.charAt(f) == "-" && (p = !0);
            continue;
          }
          p = !1, C == 0 ? this[this.t++] = T : C + o > this.DB ? (this[this.t - 1] |= (T & (1 << this.DB - C) - 1) << C, this[this.t++] = T >> this.DB - C) : this[this.t - 1] |= T << C, C += o, C >= this.DB && (C -= this.DB);
        }
        o == 8 && n[0] & 128 && (this.s = -1, C > 0 && (this[this.t - 1] |= (1 << this.DB - C) - 1 << C)), this.clamp(), p && c.ZERO.subTo(this, this);
      }
      function X() {
        for (var n = this.s & this.DM; this.t > 0 && this[this.t - 1] == n; ) --this.t;
      }
      function _(n) {
        if (this.s < 0) return "-" + this.negate().toString(n);
        var s;
        if (n == 16) s = 4;
        else if (n == 8) s = 3;
        else if (n == 2) s = 1;
        else if (n == 32) s = 5;
        else if (n == 4) s = 2;
        else return this.toRadix(n);
        var o = (1 << s) - 1, f, p = !1, C = "", T = this.t, I = this.DB - T * this.DB % s;
        if (T-- > 0)
          for (I < this.DB && (f = this[T] >> I) > 0 && (p = !0, C = L(f)); T >= 0; )
            I < s ? (f = (this[T] & (1 << I) - 1) << s - I, f |= this[--T] >> (I += this.DB - s)) : (f = this[T] >> (I -= s) & o, I <= 0 && (I += this.DB, --T)), f > 0 && (p = !0), p && (C += L(f));
        return p ? C : "0";
      }
      function k() {
        var n = h();
        return c.ZERO.subTo(this, n), n;
      }
      function Y() {
        return this.s < 0 ? this.negate() : this;
      }
      function F(n) {
        var s = this.s - n.s;
        if (s != 0) return s;
        var o = this.t;
        if (s = o - n.t, s != 0) return this.s < 0 ? -s : s;
        for (; --o >= 0; )
          if ((s = this[o] - n[o]) != 0) return s;
        return 0;
      }
      function W(n) {
        var s = 1, o;
        return (o = n >>> 16) != 0 && (n = o, s += 16), (o = n >> 8) != 0 && (n = o, s += 8), (o = n >> 4) != 0 && (n = o, s += 4), (o = n >> 2) != 0 && (n = o, s += 2), (o = n >> 1) != 0 && (n = o, s += 1), s;
      }
      function U() {
        return this.t <= 0 ? 0 : this.DB * (this.t - 1) + W(this[this.t - 1] ^ this.s & this.DM);
      }
      function R(n, s) {
        var o;
        for (o = this.t - 1; o >= 0; --o) s[o + n] = this[o];
        for (o = n - 1; o >= 0; --o) s[o] = 0;
        s.t = this.t + n, s.s = this.s;
      }
      function j(n, s) {
        for (var o = n; o < this.t; ++o) s[o - n] = this[o];
        s.t = Math.max(this.t - n, 0), s.s = this.s;
      }
      function nt(n, s) {
        var o = n % this.DB, f = this.DB - o, p = (1 << f) - 1, C = Math.floor(n / this.DB), T = this.s << o & this.DM, I;
        for (I = this.t - 1; I >= 0; --I)
          s[I + C + 1] = this[I] >> f | T, T = (this[I] & p) << o;
        for (I = C - 1; I >= 0; --I) s[I] = 0;
        s[C] = T, s.t = this.t + C + 1, s.s = this.s, s.clamp();
      }
      function lt(n, s) {
        s.s = this.s;
        var o = Math.floor(n / this.DB);
        if (o >= this.t) {
          s.t = 0;
          return;
        }
        var f = n % this.DB, p = this.DB - f, C = (1 << f) - 1;
        s[0] = this[o] >> f;
        for (var T = o + 1; T < this.t; ++T)
          s[T - o - 1] |= (this[T] & C) << p, s[T - o] = this[T] >> f;
        f > 0 && (s[this.t - o - 1] |= (this.s & C) << p), s.t = this.t - o, s.clamp();
      }
      function H(n, s) {
        for (var o = 0, f = 0, p = Math.min(n.t, this.t); o < p; )
          f += this[o] - n[o], s[o++] = f & this.DM, f >>= this.DB;
        if (n.t < this.t) {
          for (f -= n.s; o < this.t; )
            f += this[o], s[o++] = f & this.DM, f >>= this.DB;
          f += this.s;
        } else {
          for (f += this.s; o < n.t; )
            f -= n[o], s[o++] = f & this.DM, f >>= this.DB;
          f -= n.s;
        }
        s.s = f < 0 ? -1 : 0, f < -1 ? s[o++] = this.DV + f : f > 0 && (s[o++] = f), s.t = o, s.clamp();
      }
      function Z(n, s) {
        var o = this.abs(), f = n.abs(), p = o.t;
        for (s.t = p + f.t; --p >= 0; ) s[p] = 0;
        for (p = 0; p < f.t; ++p) s[p + o.t] = o.am(0, f[p], s, p, 0, o.t);
        s.s = 0, s.clamp(), this.s != n.s && c.ZERO.subTo(s, s);
      }
      function ht(n) {
        for (var s = this.abs(), o = n.t = 2 * s.t; --o >= 0; ) n[o] = 0;
        for (o = 0; o < s.t - 1; ++o) {
          var f = s.am(o, s[o], n, 2 * o, 0, 1);
          (n[o + s.t] += s.am(o + 1, 2 * s[o], n, 2 * o + 1, f, s.t - o - 1)) >= s.DV && (n[o + s.t] -= s.DV, n[o + s.t + 1] = 1);
        }
        n.t > 0 && (n[n.t - 1] += s.am(o, s[o], n, 2 * o, 0, 1)), n.s = 0, n.clamp();
      }
      function gt(n, s, o) {
        var f = n.abs();
        if (!(f.t <= 0)) {
          var p = this.abs();
          if (p.t < f.t) {
            s != null && s.fromInt(0), o != null && this.copyTo(o);
            return;
          }
          o == null && (o = h());
          var C = h(), T = this.s, I = n.s, O = this.DB - W(f[f.t - 1]);
          O > 0 ? (f.lShiftTo(O, C), p.lShiftTo(O, o)) : (f.copyTo(C), p.copyTo(o));
          var D = C.t, b = C[D - 1];
          if (b != 0) {
            var B = b * (1 << this.F1) + (D > 1 ? C[D - 2] >> this.F2 : 0), $ = this.FV / B, G = (1 << this.F1) / B, K = 1 << this.F2, Q = o.t, st = Q - D, Lt = s ?? h();
            for (C.dlShiftTo(st, Lt), o.compareTo(Lt) >= 0 && (o[o.t++] = 1, o.subTo(Lt, o)), c.ONE.dlShiftTo(D, Lt), Lt.subTo(C, C); C.t < D; ) C[C.t++] = 0;
            for (; --st >= 0; ) {
              var Gt = o[--Q] == b ? this.DM : Math.floor(o[Q] * $ + (o[Q - 1] + K) * G);
              if ((o[Q] += C.am(0, Gt, o, st, 0, D)) < Gt)
                for (C.dlShiftTo(st, Lt), o.subTo(Lt, o); o[Q] < --Gt; ) o.subTo(Lt, o);
            }
            s != null && (o.drShiftTo(D, s), T != I && c.ZERO.subTo(s, s)), o.t = D, o.clamp(), O > 0 && o.rShiftTo(O, o), T < 0 && c.ZERO.subTo(o, o);
          }
        }
      }
      function rt(n) {
        var s = h();
        return this.abs().divRemTo(n, null, s), this.s < 0 && s.compareTo(c.ZERO) > 0 && n.subTo(s, s), s;
      }
      function z(n) {
        this.m = n;
      }
      function tt(n) {
        return n.s < 0 || n.compareTo(this.m) >= 0 ? n.mod(this.m) : n;
      }
      function wt(n) {
        return n;
      }
      function Ct(n) {
        n.divRemTo(this.m, null, n);
      }
      function Bt(n, s, o) {
        n.multiplyTo(s, o), this.reduce(o);
      }
      function Dt(n, s) {
        n.squareTo(s), this.reduce(s);
      }
      z.prototype.convert = tt, z.prototype.revert = wt, z.prototype.reduce = Ct, z.prototype.mulTo = Bt, z.prototype.sqrTo = Dt;
      function vt() {
        if (this.t < 1) return 0;
        var n = this[0];
        if (!(n & 1)) return 0;
        var s = n & 3;
        return s = s * (2 - (n & 15) * s) & 15, s = s * (2 - (n & 255) * s) & 255, s = s * (2 - ((n & 65535) * s & 65535)) & 65535, s = s * (2 - n * s % this.DV) % this.DV, s > 0 ? this.DV - s : -s;
      }
      function Ot(n) {
        this.m = n, this.mp = n.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << n.DB - 15) - 1, this.mt2 = 2 * n.t;
      }
      function Vn(n) {
        var s = h();
        return n.abs().dlShiftTo(this.m.t, s), s.divRemTo(this.m, null, s), n.s < 0 && s.compareTo(c.ZERO) > 0 && this.m.subTo(s, s), s;
      }
      function Ne(n) {
        var s = h();
        return n.copyTo(s), this.reduce(s), s;
      }
      function Wn(n) {
        for (; n.t <= this.mt2; )
          n[n.t++] = 0;
        for (var s = 0; s < this.m.t; ++s) {
          var o = n[s] & 32767, f = o * this.mpl + ((o * this.mph + (n[s] >> 15) * this.mpl & this.um) << 15) & n.DM;
          for (o = s + this.m.t, n[o] += this.m.am(0, f, n, s, 0, this.m.t); n[o] >= n.DV; )
            n[o] -= n.DV, n[++o]++;
        }
        n.clamp(), n.drShiftTo(this.m.t, n), n.compareTo(this.m) >= 0 && n.subTo(this.m, n);
      }
      function Jt(n, s) {
        n.squareTo(s), this.reduce(s);
      }
      function oe(n, s, o) {
        n.multiplyTo(s, o), this.reduce(o);
      }
      Ot.prototype.convert = Vn, Ot.prototype.revert = Ne, Ot.prototype.reduce = Wn, Ot.prototype.mulTo = oe, Ot.prototype.sqrTo = Jt;
      function Wt() {
        return (this.t > 0 ? this[0] & 1 : this.s) == 0;
      }
      function Nt(n, s) {
        if (n > 4294967295 || n < 1) return c.ONE;
        var o = h(), f = h(), p = s.convert(this), C = W(n) - 1;
        for (p.copyTo(o); --C >= 0; )
          if (s.sqrTo(o, f), (n & 1 << C) > 0) s.mulTo(f, p, o);
          else {
            var T = o;
            o = f, f = T;
          }
        return s.revert(o);
      }
      function bt(n, s) {
        var o;
        return n < 256 || s.isEven() ? o = new z(s) : o = new Ot(s), this.exp(n, o);
      }
      c.prototype.copyTo = M, c.prototype.fromInt = E, c.prototype.fromString = A, c.prototype.clamp = X, c.prototype.dlShiftTo = R, c.prototype.drShiftTo = j, c.prototype.lShiftTo = nt, c.prototype.rShiftTo = lt, c.prototype.subTo = H, c.prototype.multiplyTo = Z, c.prototype.squareTo = ht, c.prototype.divRemTo = gt, c.prototype.invDigit = vt, c.prototype.isEven = Wt, c.prototype.exp = Nt, c.prototype.toString = _, c.prototype.negate = k, c.prototype.abs = Y, c.prototype.compareTo = F, c.prototype.bitLength = U, c.prototype.mod = rt, c.prototype.modPowInt = bt, c.ZERO = w(0), c.ONE = w(1);
      function Kt() {
        var n = h();
        return this.copyTo(n), n;
      }
      function zt() {
        if (this.s < 0) {
          if (this.t == 1) return this[0] - this.DV;
          if (this.t == 0) return -1;
        } else {
          if (this.t == 1) return this[0];
          if (this.t == 0) return 0;
        }
        return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
      }
      function kt() {
        return this.t == 0 ? this.s : this[0] << 24 >> 24;
      }
      function je() {
        return this.t == 0 ? this.s : this[0] << 16 >> 16;
      }
      function fn(n) {
        return Math.floor(Math.LN2 * this.DB / Math.log(n));
      }
      function Tt() {
        return this.s < 0 ? -1 : this.t <= 0 || this.t == 1 && this[0] <= 0 ? 0 : 1;
      }
      function Qt(n) {
        if (n == null && (n = 10), this.signum() == 0 || n < 2 || n > 36) return "0";
        var s = this.chunkSize(n), o = Math.pow(n, s), f = w(o), p = h(), C = h(), T = "";
        for (this.divRemTo(f, p, C); p.signum() > 0; )
          T = (o + C.intValue()).toString(n).substr(1) + T, p.divRemTo(f, p, C);
        return C.intValue().toString(n) + T;
      }
      function xt(n, s) {
        this.fromInt(0), s == null && (s = 10);
        for (var o = this.chunkSize(s), f = Math.pow(s, o), p = !1, C = 0, T = 0, I = 0; I < n.length; ++I) {
          var O = N(n, I);
          if (O < 0) {
            n.charAt(I) == "-" && this.signum() == 0 && (p = !0);
            continue;
          }
          T = s * T + O, ++C >= o && (this.dMultiply(f), this.dAddOffset(T, 0), C = 0, T = 0);
        }
        C > 0 && (this.dMultiply(Math.pow(s, C)), this.dAddOffset(T, 0)), p && c.ZERO.subTo(this, this);
      }
      function ye(n, s, o) {
        if (typeof s == "number")
          if (n < 2) this.fromInt(1);
          else
            for (this.fromNumber(n, o), this.testBit(n - 1) || this.bitwiseTo(c.ONE.shiftLeft(n - 1), te, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(s); )
              this.dAddOffset(2, 0), this.bitLength() > n && this.subTo(c.ONE.shiftLeft(n - 1), this);
        else {
          var f = new Array(), p = n & 7;
          f.length = (n >> 3) + 1, s.nextBytes(f), p > 0 ? f[0] &= (1 << p) - 1 : f[0] = 0, this.fromString(f, 256);
        }
      }
      function At() {
        var n = this.t, s = new Array();
        s[0] = this.s;
        var o = this.DB - n * this.DB % 8, f, p = 0;
        if (n-- > 0)
          for (o < this.DB && (f = this[n] >> o) != (this.s & this.DM) >> o && (s[p++] = f | this.s << this.DB - o); n >= 0; )
            o < 8 ? (f = (this[n] & (1 << o) - 1) << 8 - o, f |= this[--n] >> (o += this.DB - 8)) : (f = this[n] >> (o -= 8) & 255, o <= 0 && (o += this.DB, --n)), f & 128 && (f |= -256), p == 0 && (this.s & 128) != (f & 128) && ++p, (p > 0 || f != this.s) && (s[p++] = f);
        return s;
      }
      function jt(n) {
        return this.compareTo(n) == 0;
      }
      function le(n) {
        return this.compareTo(n) < 0 ? this : n;
      }
      function Xt(n) {
        return this.compareTo(n) > 0 ? this : n;
      }
      function Ge(n, s, o) {
        var f, p, C = Math.min(n.t, this.t);
        for (f = 0; f < C; ++f) o[f] = s(this[f], n[f]);
        if (n.t < this.t) {
          for (p = n.s & this.DM, f = C; f < this.t; ++f) o[f] = s(this[f], p);
          o.t = this.t;
        } else {
          for (p = this.s & this.DM, f = C; f < n.t; ++f) o[f] = s(p, n[f]);
          o.t = n.t;
        }
        o.s = s(this.s, n.s), o.clamp();
      }
      function Ze(n, s) {
        return n & s;
      }
      function un(n) {
        var s = h();
        return this.bitwiseTo(n, Ze, s), s;
      }
      function te(n, s) {
        return n | s;
      }
      function fe(n) {
        var s = h();
        return this.bitwiseTo(n, te, s), s;
      }
      function It(n, s) {
        return n ^ s;
      }
      function Ft(n) {
        var s = h();
        return this.bitwiseTo(n, It, s), s;
      }
      function Et(n, s) {
        return n & ~s;
      }
      function ge(n) {
        var s = h();
        return this.bitwiseTo(n, Et, s), s;
      }
      function pt() {
        for (var n = h(), s = 0; s < this.t; ++s) n[s] = this.DM & ~this[s];
        return n.t = this.t, n.s = ~this.s, n;
      }
      function yt(n) {
        var s = h();
        return n < 0 ? this.rShiftTo(-n, s) : this.lShiftTo(n, s), s;
      }
      function ee(n) {
        var s = h();
        return n < 0 ? this.lShiftTo(-n, s) : this.rShiftTo(n, s), s;
      }
      function ve(n) {
        if (n == 0) return -1;
        var s = 0;
        return n & 65535 || (n >>= 16, s += 16), n & 255 || (n >>= 8, s += 8), n & 15 || (n >>= 4, s += 4), n & 3 || (n >>= 2, s += 2), n & 1 || ++s, s;
      }
      function He() {
        for (var n = 0; n < this.t; ++n)
          if (this[n] != 0) return n * this.DB + ve(this[n]);
        return this.s < 0 ? this.t * this.DB : -1;
      }
      function qe(n) {
        for (var s = 0; n != 0; )
          n &= n - 1, ++s;
        return s;
      }
      function ne() {
        for (var n = 0, s = this.s & this.DM, o = 0; o < this.t; ++o) n += qe(this[o] ^ s);
        return n;
      }
      function Je(n) {
        var s = Math.floor(n / this.DB);
        return s >= this.t ? this.s != 0 : (this[s] & 1 << n % this.DB) != 0;
      }
      function Za(n, s) {
        var o = c.ONE.shiftLeft(n);
        return this.bitwiseTo(o, s, o), o;
      }
      function Ha(n) {
        return this.changeBit(n, te);
      }
      function qa(n) {
        return this.changeBit(n, Et);
      }
      function Ja(n) {
        return this.changeBit(n, It);
      }
      function Ka(n, s) {
        for (var o = 0, f = 0, p = Math.min(n.t, this.t); o < p; )
          f += this[o] + n[o], s[o++] = f & this.DM, f >>= this.DB;
        if (n.t < this.t) {
          for (f += n.s; o < this.t; )
            f += this[o], s[o++] = f & this.DM, f >>= this.DB;
          f += this.s;
        } else {
          for (f += this.s; o < n.t; )
            f += n[o], s[o++] = f & this.DM, f >>= this.DB;
          f += n.s;
        }
        s.s = f < 0 ? -1 : 0, f > 0 ? s[o++] = f : f < -1 && (s[o++] = this.DV + f), s.t = o, s.clamp();
      }
      function Qa(n) {
        var s = h();
        return this.addTo(n, s), s;
      }
      function to(n) {
        var s = h();
        return this.subTo(n, s), s;
      }
      function eo(n) {
        var s = h();
        return this.multiplyTo(n, s), s;
      }
      function no() {
        var n = h();
        return this.squareTo(n), n;
      }
      function ro(n) {
        var s = h();
        return this.divRemTo(n, s, null), s;
      }
      function io(n) {
        var s = h();
        return this.divRemTo(n, null, s), s;
      }
      function so(n) {
        var s = h(), o = h();
        return this.divRemTo(n, s, o), new Array(s, o);
      }
      function ao(n) {
        this[this.t] = this.am(0, n - 1, this, 0, 0, this.t), ++this.t, this.clamp();
      }
      function oo(n, s) {
        if (n != 0) {
          for (; this.t <= s; ) this[this.t++] = 0;
          for (this[s] += n; this[s] >= this.DV; )
            this[s] -= this.DV, ++s >= this.t && (this[this.t++] = 0), ++this[s];
        }
      }
      function Ke() {
      }
      function Qr(n) {
        return n;
      }
      function lo(n, s, o) {
        n.multiplyTo(s, o);
      }
      function fo(n, s) {
        n.squareTo(s);
      }
      Ke.prototype.convert = Qr, Ke.prototype.revert = Qr, Ke.prototype.mulTo = lo, Ke.prototype.sqrTo = fo;
      function uo(n) {
        return this.exp(n, new Ke());
      }
      function co(n, s, o) {
        var f = Math.min(this.t + n.t, s);
        for (o.s = 0, o.t = f; f > 0; ) o[--f] = 0;
        var p;
        for (p = o.t - this.t; f < p; ++f) o[f + this.t] = this.am(0, n[f], o, f, 0, this.t);
        for (p = Math.min(n.t, s); f < p; ++f) this.am(0, n[f], o, f, 0, s - f);
        o.clamp();
      }
      function ho(n, s, o) {
        --s;
        var f = o.t = this.t + n.t - s;
        for (o.s = 0; --f >= 0; ) o[f] = 0;
        for (f = Math.max(s - this.t, 0); f < n.t; ++f)
          o[this.t + f - s] = this.am(s - f, n[f], o, 0, 0, this.t + f - s);
        o.clamp(), o.drShiftTo(1, o);
      }
      function Me(n) {
        this.r2 = h(), this.q3 = h(), c.ONE.dlShiftTo(2 * n.t, this.r2), this.mu = this.r2.divide(n), this.m = n;
      }
      function po(n) {
        if (n.s < 0 || n.t > 2 * this.m.t) return n.mod(this.m);
        if (n.compareTo(this.m) < 0) return n;
        var s = h();
        return n.copyTo(s), this.reduce(s), s;
      }
      function yo(n) {
        return n;
      }
      function go(n) {
        for (n.drShiftTo(this.m.t - 1, this.r2), n.t > this.m.t + 1 && (n.t = this.m.t + 1, n.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); n.compareTo(this.r2) < 0; ) n.dAddOffset(1, this.m.t + 1);
        for (n.subTo(this.r2, n); n.compareTo(this.m) >= 0; ) n.subTo(this.m, n);
      }
      function vo(n, s) {
        n.squareTo(s), this.reduce(s);
      }
      function mo(n, s, o) {
        n.multiplyTo(s, o), this.reduce(o);
      }
      Me.prototype.convert = po, Me.prototype.revert = yo, Me.prototype.reduce = go, Me.prototype.mulTo = mo, Me.prototype.sqrTo = vo;
      function Co(n, s) {
        var o = n.bitLength(), f, p = w(1), C;
        if (o <= 0) return p;
        o < 18 ? f = 1 : o < 48 ? f = 3 : o < 144 ? f = 4 : o < 768 ? f = 5 : f = 6, o < 8 ? C = new z(s) : s.isEven() ? C = new Me(s) : C = new Ot(s);
        var T = new Array(), I = 3, O = f - 1, D = (1 << f) - 1;
        if (T[1] = C.convert(this), f > 1) {
          var b = h();
          for (C.sqrTo(T[1], b); I <= D; )
            T[I] = h(), C.mulTo(b, T[I - 2], T[I]), I += 2;
        }
        var B = n.t - 1, $, G = !0, K = h(), Q;
        for (o = W(n[B]) - 1; B >= 0; ) {
          for (o >= O ? $ = n[B] >> o - O & D : ($ = (n[B] & (1 << o + 1) - 1) << O - o, B > 0 && ($ |= n[B - 1] >> this.DB + o - O)), I = f; !($ & 1); )
            $ >>= 1, --I;
          if ((o -= I) < 0 && (o += this.DB, --B), G)
            T[$].copyTo(p), G = !1;
          else {
            for (; I > 1; )
              C.sqrTo(p, K), C.sqrTo(K, p), I -= 2;
            I > 0 ? C.sqrTo(p, K) : (Q = p, p = K, K = Q), C.mulTo(K, T[$], p);
          }
          for (; B >= 0 && !(n[B] & 1 << o); )
            C.sqrTo(p, K), Q = p, p = K, K = Q, --o < 0 && (o = this.DB - 1, --B);
        }
        return C.revert(p);
      }
      function Po(n) {
        var s = this.s < 0 ? this.negate() : this.clone(), o = n.s < 0 ? n.negate() : n.clone();
        if (s.compareTo(o) < 0) {
          var f = s;
          s = o, o = f;
        }
        var p = s.getLowestSetBit(), C = o.getLowestSetBit();
        if (C < 0) return s;
        for (p < C && (C = p), C > 0 && (s.rShiftTo(C, s), o.rShiftTo(C, o)); s.signum() > 0; )
          (p = s.getLowestSetBit()) > 0 && s.rShiftTo(p, s), (p = o.getLowestSetBit()) > 0 && o.rShiftTo(p, o), s.compareTo(o) >= 0 ? (s.subTo(o, s), s.rShiftTo(1, s)) : (o.subTo(s, o), o.rShiftTo(1, o));
        return C > 0 && o.lShiftTo(C, o), o;
      }
      function To(n) {
        if (n <= 0) return 0;
        var s = this.DV % n, o = this.s < 0 ? n - 1 : 0;
        if (this.t > 0)
          if (s == 0) o = this[0] % n;
          else
            for (var f = this.t - 1; f >= 0; --f) o = (s * o + this[f]) % n;
        return o;
      }
      function xo(n) {
        var s = n.isEven();
        if (this.isEven() && s || n.signum() == 0) return c.ZERO;
        for (var o = n.clone(), f = this.clone(), p = w(1), C = w(0), T = w(0), I = w(1); o.signum() != 0; ) {
          for (; o.isEven(); )
            o.rShiftTo(1, o), s ? ((!p.isEven() || !C.isEven()) && (p.addTo(this, p), C.subTo(n, C)), p.rShiftTo(1, p)) : C.isEven() || C.subTo(n, C), C.rShiftTo(1, C);
          for (; f.isEven(); )
            f.rShiftTo(1, f), s ? ((!T.isEven() || !I.isEven()) && (T.addTo(this, T), I.subTo(n, I)), T.rShiftTo(1, T)) : I.isEven() || I.subTo(n, I), I.rShiftTo(1, I);
          o.compareTo(f) >= 0 ? (o.subTo(f, o), s && p.subTo(T, p), C.subTo(I, C)) : (f.subTo(o, f), s && T.subTo(p, T), I.subTo(C, I));
        }
        if (f.compareTo(c.ONE) != 0) return c.ZERO;
        if (I.compareTo(n) >= 0) return I.subtract(n);
        if (I.signum() < 0) I.addTo(n, I);
        else return I;
        return I.signum() < 0 ? I.add(n) : I;
      }
      var St = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], Io = (1 << 26) / St[St.length - 1];
      function Eo(n) {
        var s, o = this.abs();
        if (o.t == 1 && o[0] <= St[St.length - 1]) {
          for (s = 0; s < St.length; ++s)
            if (o[0] == St[s]) return !0;
          return !1;
        }
        if (o.isEven()) return !1;
        for (s = 1; s < St.length; ) {
          for (var f = St[s], p = s + 1; p < St.length && f < Io; ) f *= St[p++];
          for (f = o.modInt(f); s < p; )
            if (f % St[s++] == 0) return !1;
        }
        return o.millerRabin(n);
      }
      function So(n) {
        var s = this.subtract(c.ONE), o = s.getLowestSetBit();
        if (o <= 0) return !1;
        var f = s.shiftRight(o);
        n = n + 1 >> 1, n > St.length && (n = St.length);
        for (var p = h(), C = 0; C < n; ++C) {
          p.fromInt(St[Math.floor(Math.random() * St.length)]);
          var T = p.modPow(f, this);
          if (T.compareTo(c.ONE) != 0 && T.compareTo(s) != 0) {
            for (var I = 1; I++ < o && T.compareTo(s) != 0; )
              if (T = T.modPowInt(2, this), T.compareTo(c.ONE) == 0) return !1;
            if (T.compareTo(s) != 0) return !1;
          }
        }
        return !0;
      }
      c.prototype.chunkSize = fn, c.prototype.toRadix = Qt, c.prototype.fromRadix = xt, c.prototype.fromNumber = ye, c.prototype.bitwiseTo = Ge, c.prototype.changeBit = Za, c.prototype.addTo = Ka, c.prototype.dMultiply = ao, c.prototype.dAddOffset = oo, c.prototype.multiplyLowerTo = co, c.prototype.multiplyUpperTo = ho, c.prototype.modInt = To, c.prototype.millerRabin = So, c.prototype.clone = Kt, c.prototype.intValue = zt, c.prototype.byteValue = kt, c.prototype.shortValue = je, c.prototype.signum = Tt, c.prototype.toByteArray = At, c.prototype.equals = jt, c.prototype.min = le, c.prototype.max = Xt, c.prototype.and = un, c.prototype.or = fe, c.prototype.xor = Ft, c.prototype.andNot = ge, c.prototype.not = pt, c.prototype.shiftLeft = yt, c.prototype.shiftRight = ee, c.prototype.getLowestSetBit = He, c.prototype.bitCount = ne, c.prototype.testBit = Je, c.prototype.setBit = Ha, c.prototype.clearBit = qa, c.prototype.flipBit = Ja, c.prototype.add = Qa, c.prototype.subtract = to, c.prototype.multiply = eo, c.prototype.divide = ro, c.prototype.remainder = io, c.prototype.divideAndRemainder = so, c.prototype.modPow = Co, c.prototype.modInverse = xo, c.prototype.pow = uo, c.prototype.gcd = Po, c.prototype.isProbablePrime = Eo, c.prototype.square = no;
      var J = c;
      J.prototype.IsNegative = function() {
        return this.compareTo(J.ZERO) == -1;
      }, J.op_Equality = function(n, s) {
        return n.compareTo(s) == 0;
      }, J.op_Inequality = function(n, s) {
        return n.compareTo(s) != 0;
      }, J.op_GreaterThan = function(n, s) {
        return n.compareTo(s) > 0;
      }, J.op_LessThan = function(n, s) {
        return n.compareTo(s) < 0;
      }, J.op_Addition = function(n, s) {
        return new J(n, void 0, void 0).add(new J(s, void 0, void 0));
      }, J.op_Subtraction = function(n, s) {
        return new J(n, void 0, void 0).subtract(new J(s, void 0, void 0));
      }, J.Int128Mul = function(n, s) {
        return new J(n, void 0, void 0).multiply(new J(s, void 0, void 0));
      }, J.op_Division = function(n, s) {
        return n.divide(s);
      }, J.prototype.ToDouble = function() {
        return parseFloat(this.toString());
      };
      var ti = function(n, s) {
        var o;
        if (typeof Object.getOwnPropertyNames > "u") {
          for (o in s.prototype)
            (typeof n.prototype[o] > "u" || n.prototype[o] === Object.prototype[o]) && (n.prototype[o] = s.prototype[o]);
          for (o in s)
            typeof n[o] > "u" && (n[o] = s[o]);
          n.$baseCtor = s;
        } else {
          for (var f = Object.getOwnPropertyNames(s.prototype), p = 0; p < f.length; p++)
            typeof Object.getOwnPropertyDescriptor(n.prototype, f[p]) > "u" && Object.defineProperty(n.prototype, f[p], Object.getOwnPropertyDescriptor(s.prototype, f[p]));
          for (o in s)
            typeof n[o] > "u" && (n[o] = s[o]);
          n.$baseCtor = s;
        }
      };
      t.Path = function() {
        return [];
      }, t.Path.prototype.push = Array.prototype.push, t.Paths = function() {
        return [];
      }, t.Paths.prototype.push = Array.prototype.push, t.DoublePoint = function() {
        var n = arguments;
        this.X = 0, this.Y = 0, n.length === 1 ? (this.X = n[0].X, this.Y = n[0].Y) : n.length === 2 && (this.X = n[0], this.Y = n[1]);
      }, t.DoublePoint0 = function() {
        this.X = 0, this.Y = 0;
      }, t.DoublePoint0.prototype = t.DoublePoint.prototype, t.DoublePoint1 = function(n) {
        this.X = n.X, this.Y = n.Y;
      }, t.DoublePoint1.prototype = t.DoublePoint.prototype, t.DoublePoint2 = function(n, s) {
        this.X = n, this.Y = s;
      }, t.DoublePoint2.prototype = t.DoublePoint.prototype, t.PolyNode = function() {
        this.m_Parent = null, this.m_polygon = new t.Path(), this.m_Index = 0, this.m_jointype = 0, this.m_endtype = 0, this.m_Childs = [], this.IsOpen = !1;
      }, t.PolyNode.prototype.IsHoleNode = function() {
        for (var n = !0, s = this.m_Parent; s !== null; )
          n = !n, s = s.m_Parent;
        return n;
      }, t.PolyNode.prototype.ChildCount = function() {
        return this.m_Childs.length;
      }, t.PolyNode.prototype.Contour = function() {
        return this.m_polygon;
      }, t.PolyNode.prototype.AddChild = function(n) {
        var s = this.m_Childs.length;
        this.m_Childs.push(n), n.m_Parent = this, n.m_Index = s;
      }, t.PolyNode.prototype.GetNext = function() {
        return this.m_Childs.length > 0 ? this.m_Childs[0] : this.GetNextSiblingUp();
      }, t.PolyNode.prototype.GetNextSiblingUp = function() {
        return this.m_Parent === null ? null : this.m_Index === this.m_Parent.m_Childs.length - 1 ? this.m_Parent.GetNextSiblingUp() : this.m_Parent.m_Childs[this.m_Index + 1];
      }, t.PolyNode.prototype.Childs = function() {
        return this.m_Childs;
      }, t.PolyNode.prototype.Parent = function() {
        return this.m_Parent;
      }, t.PolyNode.prototype.IsHole = function() {
        return this.IsHoleNode();
      }, t.PolyTree = function() {
        this.m_AllPolys = [], t.PolyNode.call(this);
      }, t.PolyTree.prototype.Clear = function() {
        for (var n = 0, s = this.m_AllPolys.length; n < s; n++)
          this.m_AllPolys[n] = null;
        this.m_AllPolys.length = 0, this.m_Childs.length = 0;
      }, t.PolyTree.prototype.GetFirst = function() {
        return this.m_Childs.length > 0 ? this.m_Childs[0] : null;
      }, t.PolyTree.prototype.Total = function() {
        var n = this.m_AllPolys.length;
        return n > 0 && this.m_Childs[0] !== this.m_AllPolys[0] && n--, n;
      }, ti(t.PolyTree, t.PolyNode), t.Math_Abs_Int64 = t.Math_Abs_Int32 = t.Math_Abs_Double = function(n) {
        return Math.abs(n);
      }, t.Math_Max_Int32_Int32 = function(n, s) {
        return Math.max(n, s);
      }, l.msie || l.opera || l.safari ? t.Cast_Int32 = function(n) {
        return n | 0;
      } : t.Cast_Int32 = function(n) {
        return ~~n;
      }, typeof Number.toInteger > "u" && (Number.toInteger = null), l.chrome ? t.Cast_Int64 = function(n) {
        return n < -2147483648 || n > 2147483647 ? n < 0 ? Math.ceil(n) : Math.floor(n) : ~~n;
      } : l.firefox && typeof Number.toInteger == "function" ? t.Cast_Int64 = function(n) {
        return Number.toInteger(n);
      } : l.msie7 || l.msie8 ? t.Cast_Int64 = function(n) {
        return parseInt(n, 10);
      } : l.msie ? t.Cast_Int64 = function(n) {
        return n < -2147483648 || n > 2147483647 ? n < 0 ? Math.ceil(n) : Math.floor(n) : n | 0;
      } : t.Cast_Int64 = function(n) {
        return n < 0 ? Math.ceil(n) : Math.floor(n);
      }, t.Clear = function(n) {
        n.length = 0;
      }, t.PI = 3.141592653589793, t.PI2 = 2 * 3.141592653589793, t.IntPoint = function() {
        var n = arguments, s = n.length;
        if (this.X = 0, this.Y = 0, t.use_xyz)
          if (this.Z = 0, s === 3)
            this.X = n[0], this.Y = n[1], this.Z = n[2];
          else if (s === 2)
            this.X = n[0], this.Y = n[1], this.Z = 0;
          else if (s === 1)
            if (n[0] instanceof t.DoublePoint) {
              var o = n[0];
              this.X = t.Clipper.Round(o.X), this.Y = t.Clipper.Round(o.Y), this.Z = 0;
            } else {
              var f = n[0];
              typeof f.Z > "u" && (f.Z = 0), this.X = f.X, this.Y = f.Y, this.Z = f.Z;
            }
          else
            this.X = 0, this.Y = 0, this.Z = 0;
        else if (s === 2)
          this.X = n[0], this.Y = n[1];
        else if (s === 1)
          if (n[0] instanceof t.DoublePoint) {
            var o = n[0];
            this.X = t.Clipper.Round(o.X), this.Y = t.Clipper.Round(o.Y);
          } else {
            var f = n[0];
            this.X = f.X, this.Y = f.Y;
          }
        else
          this.X = 0, this.Y = 0;
      }, t.IntPoint.op_Equality = function(n, s) {
        return n.X === s.X && n.Y === s.Y;
      }, t.IntPoint.op_Inequality = function(n, s) {
        return n.X !== s.X || n.Y !== s.Y;
      }, t.IntPoint0 = function() {
        this.X = 0, this.Y = 0, t.use_xyz && (this.Z = 0);
      }, t.IntPoint0.prototype = t.IntPoint.prototype, t.IntPoint1 = function(n) {
        this.X = n.X, this.Y = n.Y, t.use_xyz && (typeof n.Z > "u" ? this.Z = 0 : this.Z = n.Z);
      }, t.IntPoint1.prototype = t.IntPoint.prototype, t.IntPoint1dp = function(n) {
        this.X = t.Clipper.Round(n.X), this.Y = t.Clipper.Round(n.Y), t.use_xyz && (this.Z = 0);
      }, t.IntPoint1dp.prototype = t.IntPoint.prototype, t.IntPoint2 = function(n, s, o) {
        this.X = n, this.Y = s, t.use_xyz && (typeof o > "u" ? this.Z = 0 : this.Z = o);
      }, t.IntPoint2.prototype = t.IntPoint.prototype, t.IntRect = function() {
        var n = arguments, s = n.length;
        if (s === 4)
          this.left = n[0], this.top = n[1], this.right = n[2], this.bottom = n[3];
        else if (s === 1) {
          var o = n[0];
          this.left = o.left, this.top = o.top, this.right = o.right, this.bottom = o.bottom;
        } else
          this.left = 0, this.top = 0, this.right = 0, this.bottom = 0;
      }, t.IntRect0 = function() {
        this.left = 0, this.top = 0, this.right = 0, this.bottom = 0;
      }, t.IntRect0.prototype = t.IntRect.prototype, t.IntRect1 = function(n) {
        this.left = n.left, this.top = n.top, this.right = n.right, this.bottom = n.bottom;
      }, t.IntRect1.prototype = t.IntRect.prototype, t.IntRect4 = function(n, s, o, f) {
        this.left = n, this.top = s, this.right = o, this.bottom = f;
      }, t.IntRect4.prototype = t.IntRect.prototype, t.ClipType = {
        ctIntersection: 0,
        ctUnion: 1,
        ctDifference: 2,
        ctXor: 3
      }, t.PolyType = {
        ptSubject: 0,
        ptClip: 1
      }, t.PolyFillType = {
        pftEvenOdd: 0,
        pftNonZero: 1,
        pftPositive: 2,
        pftNegative: 3
      }, t.JoinType = {
        jtSquare: 0,
        jtRound: 1,
        jtMiter: 2
      }, t.EndType = {
        etOpenSquare: 0,
        etOpenRound: 1,
        etOpenButt: 2,
        etClosedLine: 3,
        etClosedPolygon: 4
      }, t.EdgeSide = {
        esLeft: 0,
        esRight: 1
      }, t.Direction = {
        dRightToLeft: 0,
        dLeftToRight: 1
      }, t.TEdge = function() {
        this.Bot = new t.IntPoint0(), this.Curr = new t.IntPoint0(), this.Top = new t.IntPoint0(), this.Delta = new t.IntPoint0(), this.Dx = 0, this.PolyTyp = t.PolyType.ptSubject, this.Side = t.EdgeSide.esLeft, this.WindDelta = 0, this.WindCnt = 0, this.WindCnt2 = 0, this.OutIdx = 0, this.Next = null, this.Prev = null, this.NextInLML = null, this.NextInAEL = null, this.PrevInAEL = null, this.NextInSEL = null, this.PrevInSEL = null;
      }, t.IntersectNode = function() {
        this.Edge1 = null, this.Edge2 = null, this.Pt = new t.IntPoint0();
      }, t.MyIntersectNodeSort = function() {
      }, t.MyIntersectNodeSort.Compare = function(n, s) {
        var o = s.Pt.Y - n.Pt.Y;
        return o > 0 ? 1 : o < 0 ? -1 : 0;
      }, t.LocalMinima = function() {
        this.Y = 0, this.LeftBound = null, this.RightBound = null, this.Next = null;
      }, t.Scanbeam = function() {
        this.Y = 0, this.Next = null;
      }, t.Maxima = function() {
        this.X = 0, this.Next = null, this.Prev = null;
      }, t.OutRec = function() {
        this.Idx = 0, this.IsHole = !1, this.IsOpen = !1, this.FirstLeft = null, this.Pts = null, this.BottomPt = null, this.PolyNode = null;
      }, t.OutPt = function() {
        this.Idx = 0, this.Pt = new t.IntPoint0(), this.Next = null, this.Prev = null;
      }, t.Join = function() {
        this.OutPt1 = null, this.OutPt2 = null, this.OffPt = new t.IntPoint0();
      }, t.ClipperBase = function() {
        this.m_MinimaList = null, this.m_CurrentLM = null, this.m_edges = new Array(), this.m_UseFullRange = !1, this.m_HasOpenPaths = !1, this.PreserveCollinear = !1, this.m_Scanbeam = null, this.m_PolyOuts = null, this.m_ActiveEdges = null;
      }, t.ClipperBase.horizontal = -9007199254740992, t.ClipperBase.Skip = -2, t.ClipperBase.Unassigned = -1, t.ClipperBase.tolerance = 1e-20, t.ClipperBase.loRange = 47453132, t.ClipperBase.hiRange = 4503599627370495, t.ClipperBase.near_zero = function(n) {
        return n > -t.ClipperBase.tolerance && n < t.ClipperBase.tolerance;
      }, t.ClipperBase.IsHorizontal = function(n) {
        return n.Delta.Y === 0;
      }, t.ClipperBase.prototype.PointIsVertex = function(n, s) {
        var o = s;
        do {
          if (t.IntPoint.op_Equality(o.Pt, n))
            return !0;
          o = o.Next;
        } while (o !== s);
        return !1;
      }, t.ClipperBase.prototype.PointOnLineSegment = function(n, s, o, f) {
        return f ? n.X === s.X && n.Y === s.Y || n.X === o.X && n.Y === o.Y || n.X > s.X == n.X < o.X && n.Y > s.Y == n.Y < o.Y && J.op_Equality(
          J.Int128Mul(n.X - s.X, o.Y - s.Y),
          J.Int128Mul(o.X - s.X, n.Y - s.Y)
        ) : n.X === s.X && n.Y === s.Y || n.X === o.X && n.Y === o.Y || n.X > s.X == n.X < o.X && n.Y > s.Y == n.Y < o.Y && (n.X - s.X) * (o.Y - s.Y) === (o.X - s.X) * (n.Y - s.Y);
      }, t.ClipperBase.prototype.PointOnPolygon = function(n, s, o) {
        for (var f = s; ; ) {
          if (this.PointOnLineSegment(n, f.Pt, f.Next.Pt, o))
            return !0;
          if (f = f.Next, f === s)
            break;
        }
        return !1;
      }, t.ClipperBase.prototype.SlopesEqual = t.ClipperBase.SlopesEqual = function() {
        var n = arguments, s = n.length, o, f, p, C, T, I, O;
        return s === 3 ? (o = n[0], f = n[1], O = n[2], O ? J.op_Equality(J.Int128Mul(o.Delta.Y, f.Delta.X), J.Int128Mul(o.Delta.X, f.Delta.Y)) : t.Cast_Int64(o.Delta.Y * f.Delta.X) === t.Cast_Int64(o.Delta.X * f.Delta.Y)) : s === 4 ? (p = n[0], C = n[1], T = n[2], O = n[3], O ? J.op_Equality(J.Int128Mul(p.Y - C.Y, C.X - T.X), J.Int128Mul(p.X - C.X, C.Y - T.Y)) : t.Cast_Int64((p.Y - C.Y) * (C.X - T.X)) - t.Cast_Int64((p.X - C.X) * (C.Y - T.Y)) === 0) : (p = n[0], C = n[1], T = n[2], I = n[3], O = n[4], O ? J.op_Equality(J.Int128Mul(p.Y - C.Y, T.X - I.X), J.Int128Mul(p.X - C.X, T.Y - I.Y)) : t.Cast_Int64((p.Y - C.Y) * (T.X - I.X)) - t.Cast_Int64((p.X - C.X) * (T.Y - I.Y)) === 0);
      }, t.ClipperBase.SlopesEqual3 = function(n, s, o) {
        return o ? J.op_Equality(J.Int128Mul(n.Delta.Y, s.Delta.X), J.Int128Mul(n.Delta.X, s.Delta.Y)) : t.Cast_Int64(n.Delta.Y * s.Delta.X) === t.Cast_Int64(n.Delta.X * s.Delta.Y);
      }, t.ClipperBase.SlopesEqual4 = function(n, s, o, f) {
        return f ? J.op_Equality(J.Int128Mul(n.Y - s.Y, s.X - o.X), J.Int128Mul(n.X - s.X, s.Y - o.Y)) : t.Cast_Int64((n.Y - s.Y) * (s.X - o.X)) - t.Cast_Int64((n.X - s.X) * (s.Y - o.Y)) === 0;
      }, t.ClipperBase.SlopesEqual5 = function(n, s, o, f, p) {
        return p ? J.op_Equality(J.Int128Mul(n.Y - s.Y, o.X - f.X), J.Int128Mul(n.X - s.X, o.Y - f.Y)) : t.Cast_Int64((n.Y - s.Y) * (o.X - f.X)) - t.Cast_Int64((n.X - s.X) * (o.Y - f.Y)) === 0;
      }, t.ClipperBase.prototype.Clear = function() {
        this.DisposeLocalMinimaList();
        for (var n = 0, s = this.m_edges.length; n < s; ++n) {
          for (var o = 0, f = this.m_edges[n].length; o < f; ++o)
            this.m_edges[n][o] = null;
          t.Clear(this.m_edges[n]);
        }
        t.Clear(this.m_edges), this.m_UseFullRange = !1, this.m_HasOpenPaths = !1;
      }, t.ClipperBase.prototype.DisposeLocalMinimaList = function() {
        for (; this.m_MinimaList !== null; ) {
          var n = this.m_MinimaList.Next;
          this.m_MinimaList = null, this.m_MinimaList = n;
        }
        this.m_CurrentLM = null;
      }, t.ClipperBase.prototype.RangeTest = function(n, s) {
        s.Value ? (n.X > t.ClipperBase.hiRange || n.Y > t.ClipperBase.hiRange || -n.X > t.ClipperBase.hiRange || -n.Y > t.ClipperBase.hiRange) && t.Error("Coordinate outside allowed range in RangeTest().") : (n.X > t.ClipperBase.loRange || n.Y > t.ClipperBase.loRange || -n.X > t.ClipperBase.loRange || -n.Y > t.ClipperBase.loRange) && (s.Value = !0, this.RangeTest(n, s));
      }, t.ClipperBase.prototype.InitEdge = function(n, s, o, f) {
        n.Next = s, n.Prev = o, n.Curr.X = f.X, n.Curr.Y = f.Y, t.use_xyz && (n.Curr.Z = f.Z), n.OutIdx = -1;
      }, t.ClipperBase.prototype.InitEdge2 = function(n, s) {
        n.Curr.Y >= n.Next.Curr.Y ? (n.Bot.X = n.Curr.X, n.Bot.Y = n.Curr.Y, t.use_xyz && (n.Bot.Z = n.Curr.Z), n.Top.X = n.Next.Curr.X, n.Top.Y = n.Next.Curr.Y, t.use_xyz && (n.Top.Z = n.Next.Curr.Z)) : (n.Top.X = n.Curr.X, n.Top.Y = n.Curr.Y, t.use_xyz && (n.Top.Z = n.Curr.Z), n.Bot.X = n.Next.Curr.X, n.Bot.Y = n.Next.Curr.Y, t.use_xyz && (n.Bot.Z = n.Next.Curr.Z)), this.SetDx(n), n.PolyTyp = s;
      }, t.ClipperBase.prototype.FindNextLocMin = function(n) {
        for (var s; ; ) {
          for (; t.IntPoint.op_Inequality(n.Bot, n.Prev.Bot) || t.IntPoint.op_Equality(n.Curr, n.Top); )
            n = n.Next;
          if (n.Dx !== t.ClipperBase.horizontal && n.Prev.Dx !== t.ClipperBase.horizontal)
            break;
          for (; n.Prev.Dx === t.ClipperBase.horizontal; )
            n = n.Prev;
          for (s = n; n.Dx === t.ClipperBase.horizontal; )
            n = n.Next;
          if (n.Top.Y !== n.Prev.Bot.Y) {
            s.Prev.Bot.X < n.Bot.X && (n = s);
            break;
          }
        }
        return n;
      }, t.ClipperBase.prototype.ProcessBound = function(n, s) {
        var o, f = n, p;
        if (f.OutIdx === t.ClipperBase.Skip) {
          if (n = f, s) {
            for (; n.Top.Y === n.Next.Bot.Y; ) n = n.Next;
            for (; n !== f && n.Dx === t.ClipperBase.horizontal; ) n = n.Prev;
          } else {
            for (; n.Top.Y === n.Prev.Bot.Y; ) n = n.Prev;
            for (; n !== f && n.Dx === t.ClipperBase.horizontal; ) n = n.Next;
          }
          if (n === f)
            s ? f = n.Next : f = n.Prev;
          else {
            s ? n = f.Next : n = f.Prev;
            var C = new t.LocalMinima();
            C.Next = null, C.Y = n.Bot.Y, C.LeftBound = null, C.RightBound = n, n.WindDelta = 0, f = this.ProcessBound(n, s), this.InsertLocalMinima(C);
          }
          return f;
        }
        if (n.Dx === t.ClipperBase.horizontal && (s ? o = n.Prev : o = n.Next, o.Dx === t.ClipperBase.horizontal ? o.Bot.X !== n.Bot.X && o.Top.X !== n.Bot.X && this.ReverseHorizontal(n) : o.Bot.X !== n.Bot.X && this.ReverseHorizontal(n)), o = n, s) {
          for (; f.Top.Y === f.Next.Bot.Y && f.Next.OutIdx !== t.ClipperBase.Skip; )
            f = f.Next;
          if (f.Dx === t.ClipperBase.horizontal && f.Next.OutIdx !== t.ClipperBase.Skip) {
            for (p = f; p.Prev.Dx === t.ClipperBase.horizontal; )
              p = p.Prev;
            p.Prev.Top.X > f.Next.Top.X && (f = p.Prev);
          }
          for (; n !== f; )
            n.NextInLML = n.Next, n.Dx === t.ClipperBase.horizontal && n !== o && n.Bot.X !== n.Prev.Top.X && this.ReverseHorizontal(n), n = n.Next;
          n.Dx === t.ClipperBase.horizontal && n !== o && n.Bot.X !== n.Prev.Top.X && this.ReverseHorizontal(n), f = f.Next;
        } else {
          for (; f.Top.Y === f.Prev.Bot.Y && f.Prev.OutIdx !== t.ClipperBase.Skip; )
            f = f.Prev;
          if (f.Dx === t.ClipperBase.horizontal && f.Prev.OutIdx !== t.ClipperBase.Skip) {
            for (p = f; p.Next.Dx === t.ClipperBase.horizontal; )
              p = p.Next;
            (p.Next.Top.X === f.Prev.Top.X || p.Next.Top.X > f.Prev.Top.X) && (f = p.Next);
          }
          for (; n !== f; )
            n.NextInLML = n.Prev, n.Dx === t.ClipperBase.horizontal && n !== o && n.Bot.X !== n.Next.Top.X && this.ReverseHorizontal(n), n = n.Prev;
          n.Dx === t.ClipperBase.horizontal && n !== o && n.Bot.X !== n.Next.Top.X && this.ReverseHorizontal(n), f = f.Prev;
        }
        return f;
      }, t.ClipperBase.prototype.AddPath = function(n, s, o) {
        t.use_lines ? !o && s === t.PolyType.ptClip && t.Error("AddPath: Open paths must be subject.") : o || t.Error("AddPath: Open paths have been disabled.");
        var f = n.length - 1;
        if (o)
          for (; f > 0 && t.IntPoint.op_Equality(n[f], n[0]); )
            --f;
        for (; f > 0 && t.IntPoint.op_Equality(n[f], n[f - 1]); )
          --f;
        if (o && f < 2 || !o && f < 1)
          return !1;
        for (var p = new Array(), C = 0; C <= f; C++)
          p.push(new t.TEdge());
        var T = !0;
        p[1].Curr.X = n[1].X, p[1].Curr.Y = n[1].Y, t.use_xyz && (p[1].Curr.Z = n[1].Z);
        var I = {
          Value: this.m_UseFullRange
        };
        this.RangeTest(n[0], I), this.m_UseFullRange = I.Value, I.Value = this.m_UseFullRange, this.RangeTest(n[f], I), this.m_UseFullRange = I.Value, this.InitEdge(p[0], p[1], p[f], n[0]), this.InitEdge(p[f], p[0], p[f - 1], n[f]);
        for (var C = f - 1; C >= 1; --C)
          I.Value = this.m_UseFullRange, this.RangeTest(n[C], I), this.m_UseFullRange = I.Value, this.InitEdge(p[C], p[C + 1], p[C - 1], n[C]);
        for (var O = p[0], D = O, b = O; ; ) {
          if (D.Curr === D.Next.Curr && (o || D.Next !== O)) {
            if (D === D.Next)
              break;
            D === O && (O = D.Next), D = this.RemoveEdge(D), b = D;
            continue;
          }
          if (D.Prev === D.Next)
            break;
          if (o && t.ClipperBase.SlopesEqual4(D.Prev.Curr, D.Curr, D.Next.Curr, this.m_UseFullRange) && (!this.PreserveCollinear || !this.Pt2IsBetweenPt1AndPt3(D.Prev.Curr, D.Curr, D.Next.Curr))) {
            D === O && (O = D.Next), D = this.RemoveEdge(D), D = D.Prev, b = D;
            continue;
          }
          if (D = D.Next, D === b || !o && D.Next === O) break;
        }
        if (!o && D === D.Next || o && D.Prev === D.Next)
          return !1;
        o || (this.m_HasOpenPaths = !0, O.Prev.OutIdx = t.ClipperBase.Skip), D = O;
        do
          this.InitEdge2(D, s), D = D.Next, T && D.Curr.Y !== O.Curr.Y && (T = !1);
        while (D !== O);
        if (T) {
          if (o)
            return !1;
          D.Prev.OutIdx = t.ClipperBase.Skip;
          var B = new t.LocalMinima();
          for (B.Next = null, B.Y = D.Bot.Y, B.LeftBound = null, B.RightBound = D, B.RightBound.Side = t.EdgeSide.esRight, B.RightBound.WindDelta = 0; D.Bot.X !== D.Prev.Top.X && this.ReverseHorizontal(D), D.Next.OutIdx !== t.ClipperBase.Skip; )
            D.NextInLML = D.Next, D = D.Next;
          return this.InsertLocalMinima(B), this.m_edges.push(p), !0;
        }
        this.m_edges.push(p);
        var $, G = null;
        for (t.IntPoint.op_Equality(D.Prev.Bot, D.Prev.Top) && (D = D.Next); D = this.FindNextLocMin(D), D !== G; ) {
          G === null && (G = D);
          var B = new t.LocalMinima();
          B.Next = null, B.Y = D.Bot.Y, D.Dx < D.Prev.Dx ? (B.LeftBound = D.Prev, B.RightBound = D, $ = !1) : (B.LeftBound = D, B.RightBound = D.Prev, $ = !0), B.LeftBound.Side = t.EdgeSide.esLeft, B.RightBound.Side = t.EdgeSide.esRight, o ? B.LeftBound.Next === B.RightBound ? B.LeftBound.WindDelta = -1 : B.LeftBound.WindDelta = 1 : B.LeftBound.WindDelta = 0, B.RightBound.WindDelta = -B.LeftBound.WindDelta, D = this.ProcessBound(B.LeftBound, $), D.OutIdx === t.ClipperBase.Skip && (D = this.ProcessBound(D, $));
          var K = this.ProcessBound(B.RightBound, !$);
          K.OutIdx === t.ClipperBase.Skip && (K = this.ProcessBound(K, !$)), B.LeftBound.OutIdx === t.ClipperBase.Skip ? B.LeftBound = null : B.RightBound.OutIdx === t.ClipperBase.Skip && (B.RightBound = null), this.InsertLocalMinima(B), $ || (D = K);
        }
        return !0;
      }, t.ClipperBase.prototype.AddPaths = function(n, s, o) {
        for (var f = !1, p = 0, C = n.length; p < C; ++p)
          this.AddPath(n[p], s, o) && (f = !0);
        return f;
      }, t.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3 = function(n, s, o) {
        return t.IntPoint.op_Equality(n, o) || t.IntPoint.op_Equality(n, s) || t.IntPoint.op_Equality(o, s) ? !1 : n.X !== o.X ? s.X > n.X == s.X < o.X : s.Y > n.Y == s.Y < o.Y;
      }, t.ClipperBase.prototype.RemoveEdge = function(n) {
        n.Prev.Next = n.Next, n.Next.Prev = n.Prev;
        var s = n.Next;
        return n.Prev = null, s;
      }, t.ClipperBase.prototype.SetDx = function(n) {
        n.Delta.X = n.Top.X - n.Bot.X, n.Delta.Y = n.Top.Y - n.Bot.Y, n.Delta.Y === 0 ? n.Dx = t.ClipperBase.horizontal : n.Dx = n.Delta.X / n.Delta.Y;
      }, t.ClipperBase.prototype.InsertLocalMinima = function(n) {
        if (this.m_MinimaList === null)
          this.m_MinimaList = n;
        else if (n.Y >= this.m_MinimaList.Y)
          n.Next = this.m_MinimaList, this.m_MinimaList = n;
        else {
          for (var s = this.m_MinimaList; s.Next !== null && n.Y < s.Next.Y; )
            s = s.Next;
          n.Next = s.Next, s.Next = n;
        }
      }, t.ClipperBase.prototype.PopLocalMinima = function(n, s) {
        return s.v = this.m_CurrentLM, this.m_CurrentLM !== null && this.m_CurrentLM.Y === n ? (this.m_CurrentLM = this.m_CurrentLM.Next, !0) : !1;
      }, t.ClipperBase.prototype.ReverseHorizontal = function(n) {
        var s = n.Top.X;
        n.Top.X = n.Bot.X, n.Bot.X = s, t.use_xyz && (s = n.Top.Z, n.Top.Z = n.Bot.Z, n.Bot.Z = s);
      }, t.ClipperBase.prototype.Reset = function() {
        if (this.m_CurrentLM = this.m_MinimaList, this.m_CurrentLM !== null) {
          this.m_Scanbeam = null;
          for (var n = this.m_MinimaList; n !== null; ) {
            this.InsertScanbeam(n.Y);
            var s = n.LeftBound;
            s !== null && (s.Curr.X = s.Bot.X, s.Curr.Y = s.Bot.Y, t.use_xyz && (s.Curr.Z = s.Bot.Z), s.OutIdx = t.ClipperBase.Unassigned), s = n.RightBound, s !== null && (s.Curr.X = s.Bot.X, s.Curr.Y = s.Bot.Y, t.use_xyz && (s.Curr.Z = s.Bot.Z), s.OutIdx = t.ClipperBase.Unassigned), n = n.Next;
          }
          this.m_ActiveEdges = null;
        }
      }, t.ClipperBase.prototype.InsertScanbeam = function(n) {
        if (this.m_Scanbeam === null)
          this.m_Scanbeam = new t.Scanbeam(), this.m_Scanbeam.Next = null, this.m_Scanbeam.Y = n;
        else if (n > this.m_Scanbeam.Y) {
          var s = new t.Scanbeam();
          s.Y = n, s.Next = this.m_Scanbeam, this.m_Scanbeam = s;
        } else {
          for (var o = this.m_Scanbeam; o.Next !== null && n <= o.Next.Y; )
            o = o.Next;
          if (n === o.Y)
            return;
          var f = new t.Scanbeam();
          f.Y = n, f.Next = o.Next, o.Next = f;
        }
      }, t.ClipperBase.prototype.PopScanbeam = function(n) {
        return this.m_Scanbeam === null ? (n.v = 0, !1) : (n.v = this.m_Scanbeam.Y, this.m_Scanbeam = this.m_Scanbeam.Next, !0);
      }, t.ClipperBase.prototype.LocalMinimaPending = function() {
        return this.m_CurrentLM !== null;
      }, t.ClipperBase.prototype.CreateOutRec = function() {
        var n = new t.OutRec();
        return n.Idx = t.ClipperBase.Unassigned, n.IsHole = !1, n.IsOpen = !1, n.FirstLeft = null, n.Pts = null, n.BottomPt = null, n.PolyNode = null, this.m_PolyOuts.push(n), n.Idx = this.m_PolyOuts.length - 1, n;
      }, t.ClipperBase.prototype.DisposeOutRec = function(n) {
        var s = this.m_PolyOuts[n];
        s.Pts = null, s = null, this.m_PolyOuts[n] = null;
      }, t.ClipperBase.prototype.UpdateEdgeIntoAEL = function(n) {
        n.NextInLML === null && t.Error("UpdateEdgeIntoAEL: invalid call");
        var s = n.PrevInAEL, o = n.NextInAEL;
        return n.NextInLML.OutIdx = n.OutIdx, s !== null ? s.NextInAEL = n.NextInLML : this.m_ActiveEdges = n.NextInLML, o !== null && (o.PrevInAEL = n.NextInLML), n.NextInLML.Side = n.Side, n.NextInLML.WindDelta = n.WindDelta, n.NextInLML.WindCnt = n.WindCnt, n.NextInLML.WindCnt2 = n.WindCnt2, n = n.NextInLML, n.Curr.X = n.Bot.X, n.Curr.Y = n.Bot.Y, n.PrevInAEL = s, n.NextInAEL = o, t.ClipperBase.IsHorizontal(n) || this.InsertScanbeam(n.Top.Y), n;
      }, t.ClipperBase.prototype.SwapPositionsInAEL = function(n, s) {
        if (!(n.NextInAEL === n.PrevInAEL || s.NextInAEL === s.PrevInAEL)) {
          if (n.NextInAEL === s) {
            var o = s.NextInAEL;
            o !== null && (o.PrevInAEL = n);
            var f = n.PrevInAEL;
            f !== null && (f.NextInAEL = s), s.PrevInAEL = f, s.NextInAEL = n, n.PrevInAEL = s, n.NextInAEL = o;
          } else if (s.NextInAEL === n) {
            var p = n.NextInAEL;
            p !== null && (p.PrevInAEL = s);
            var C = s.PrevInAEL;
            C !== null && (C.NextInAEL = n), n.PrevInAEL = C, n.NextInAEL = s, s.PrevInAEL = n, s.NextInAEL = p;
          } else {
            var T = n.NextInAEL, I = n.PrevInAEL;
            n.NextInAEL = s.NextInAEL, n.NextInAEL !== null && (n.NextInAEL.PrevInAEL = n), n.PrevInAEL = s.PrevInAEL, n.PrevInAEL !== null && (n.PrevInAEL.NextInAEL = n), s.NextInAEL = T, s.NextInAEL !== null && (s.NextInAEL.PrevInAEL = s), s.PrevInAEL = I, s.PrevInAEL !== null && (s.PrevInAEL.NextInAEL = s);
          }
          n.PrevInAEL === null ? this.m_ActiveEdges = n : s.PrevInAEL === null && (this.m_ActiveEdges = s);
        }
      }, t.ClipperBase.prototype.DeleteFromAEL = function(n) {
        var s = n.PrevInAEL, o = n.NextInAEL;
        s === null && o === null && n !== this.m_ActiveEdges || (s !== null ? s.NextInAEL = o : this.m_ActiveEdges = o, o !== null && (o.PrevInAEL = s), n.NextInAEL = null, n.PrevInAEL = null);
      }, t.Clipper = function(n) {
        typeof n > "u" && (n = 0), this.m_PolyOuts = null, this.m_ClipType = t.ClipType.ctIntersection, this.m_Scanbeam = null, this.m_Maxima = null, this.m_ActiveEdges = null, this.m_SortedEdges = null, this.m_IntersectList = null, this.m_IntersectNodeComparer = null, this.m_ExecuteLocked = !1, this.m_ClipFillType = t.PolyFillType.pftEvenOdd, this.m_SubjFillType = t.PolyFillType.pftEvenOdd, this.m_Joins = null, this.m_GhostJoins = null, this.m_UsingPolyTree = !1, this.ReverseSolution = !1, this.StrictlySimple = !1, t.ClipperBase.call(this), this.m_Scanbeam = null, this.m_Maxima = null, this.m_ActiveEdges = null, this.m_SortedEdges = null, this.m_IntersectList = new Array(), this.m_IntersectNodeComparer = t.MyIntersectNodeSort.Compare, this.m_ExecuteLocked = !1, this.m_UsingPolyTree = !1, this.m_PolyOuts = new Array(), this.m_Joins = new Array(), this.m_GhostJoins = new Array(), this.ReverseSolution = (1 & n) !== 0, this.StrictlySimple = (2 & n) !== 0, this.PreserveCollinear = (4 & n) !== 0, t.use_xyz && (this.ZFillFunction = null);
      }, t.Clipper.ioReverseSolution = 1, t.Clipper.ioStrictlySimple = 2, t.Clipper.ioPreserveCollinear = 4, t.Clipper.prototype.Clear = function() {
        this.m_edges.length !== 0 && (this.DisposeAllPolyPts(), t.ClipperBase.prototype.Clear.call(this));
      }, t.Clipper.prototype.InsertMaxima = function(n) {
        var s = new t.Maxima();
        if (s.X = n, this.m_Maxima === null)
          this.m_Maxima = s, this.m_Maxima.Next = null, this.m_Maxima.Prev = null;
        else if (n < this.m_Maxima.X)
          s.Next = this.m_Maxima, s.Prev = null, this.m_Maxima = s;
        else {
          for (var o = this.m_Maxima; o.Next !== null && n >= o.Next.X; )
            o = o.Next;
          if (n === o.X)
            return;
          s.Next = o.Next, s.Prev = o, o.Next !== null && (o.Next.Prev = s), o.Next = s;
        }
      }, t.Clipper.prototype.Execute = function() {
        var n = arguments, s = n.length, o = n[1] instanceof t.PolyTree;
        if (s === 4 && !o) {
          var f = n[0], p = n[1], C = n[2], T = n[3];
          if (this.m_ExecuteLocked)
            return !1;
          this.m_HasOpenPaths && t.Error("Error: PolyTree struct is needed for open path clipping."), this.m_ExecuteLocked = !0, t.Clear(p), this.m_SubjFillType = C, this.m_ClipFillType = T, this.m_ClipType = f, this.m_UsingPolyTree = !1;
          try {
            var I = this.ExecuteInternal();
            I && this.BuildResult(p);
          } finally {
            this.DisposeAllPolyPts(), this.m_ExecuteLocked = !1;
          }
          return I;
        } else if (s === 4 && o) {
          var f = n[0], O = n[1], C = n[2], T = n[3];
          if (this.m_ExecuteLocked)
            return !1;
          this.m_ExecuteLocked = !0, this.m_SubjFillType = C, this.m_ClipFillType = T, this.m_ClipType = f, this.m_UsingPolyTree = !0;
          try {
            var I = this.ExecuteInternal();
            I && this.BuildResult2(O);
          } finally {
            this.DisposeAllPolyPts(), this.m_ExecuteLocked = !1;
          }
          return I;
        } else if (s === 2 && !o) {
          var f = n[0], p = n[1];
          return this.Execute(f, p, t.PolyFillType.pftEvenOdd, t.PolyFillType.pftEvenOdd);
        } else if (s === 2 && o) {
          var f = n[0], O = n[1];
          return this.Execute(f, O, t.PolyFillType.pftEvenOdd, t.PolyFillType.pftEvenOdd);
        }
      }, t.Clipper.prototype.FixHoleLinkage = function(n) {
        if (!(n.FirstLeft === null || n.IsHole !== n.FirstLeft.IsHole && n.FirstLeft.Pts !== null)) {
          for (var s = n.FirstLeft; s !== null && (s.IsHole === n.IsHole || s.Pts === null); )
            s = s.FirstLeft;
          n.FirstLeft = s;
        }
      }, t.Clipper.prototype.ExecuteInternal = function() {
        try {
          this.Reset(), this.m_SortedEdges = null, this.m_Maxima = null;
          var n = {}, s = {};
          if (!this.PopScanbeam(n))
            return !1;
          for (this.InsertLocalMinimaIntoAEL(n.v); this.PopScanbeam(s) || this.LocalMinimaPending(); ) {
            if (this.ProcessHorizontals(), this.m_GhostJoins.length = 0, !this.ProcessIntersections(s.v))
              return !1;
            this.ProcessEdgesAtTopOfScanbeam(s.v), n.v = s.v, this.InsertLocalMinimaIntoAEL(n.v);
          }
          var o, f, p;
          for (f = 0, p = this.m_PolyOuts.length; f < p; f++)
            o = this.m_PolyOuts[f], !(o.Pts === null || o.IsOpen) && (o.IsHole ^ this.ReverseSolution) == this.Area$1(o) > 0 && this.ReversePolyPtLinks(o.Pts);
          for (this.JoinCommonEdges(), f = 0, p = this.m_PolyOuts.length; f < p; f++)
            o = this.m_PolyOuts[f], o.Pts !== null && (o.IsOpen ? this.FixupOutPolyline(o) : this.FixupOutPolygon(o));
          return this.StrictlySimple && this.DoSimplePolygons(), !0;
        } finally {
          this.m_Joins.length = 0, this.m_GhostJoins.length = 0;
        }
      }, t.Clipper.prototype.DisposeAllPolyPts = function() {
        for (var n = 0, s = this.m_PolyOuts.length; n < s; ++n)
          this.DisposeOutRec(n);
        t.Clear(this.m_PolyOuts);
      }, t.Clipper.prototype.AddJoin = function(n, s, o) {
        var f = new t.Join();
        f.OutPt1 = n, f.OutPt2 = s, f.OffPt.X = o.X, f.OffPt.Y = o.Y, t.use_xyz && (f.OffPt.Z = o.Z), this.m_Joins.push(f);
      }, t.Clipper.prototype.AddGhostJoin = function(n, s) {
        var o = new t.Join();
        o.OutPt1 = n, o.OffPt.X = s.X, o.OffPt.Y = s.Y, t.use_xyz && (o.OffPt.Z = s.Z), this.m_GhostJoins.push(o);
      }, t.Clipper.prototype.SetZ = function(n, s, o) {
        if (this.ZFillFunction !== null) {
          if (n.Z !== 0 || this.ZFillFunction === null) return;
          t.IntPoint.op_Equality(n, s.Bot) ? n.Z = s.Bot.Z : t.IntPoint.op_Equality(n, s.Top) ? n.Z = s.Top.Z : t.IntPoint.op_Equality(n, o.Bot) ? n.Z = o.Bot.Z : t.IntPoint.op_Equality(n, o.Top) ? n.Z = o.Top.Z : this.ZFillFunction(s.Bot, s.Top, o.Bot, o.Top, n);
        }
      }, t.Clipper.prototype.InsertLocalMinimaIntoAEL = function(n) {
        for (var s = {}, o, f; this.PopLocalMinima(n, s); ) {
          o = s.v.LeftBound, f = s.v.RightBound;
          var p = null;
          if (o === null ? (this.InsertEdgeIntoAEL(f, null), this.SetWindingCount(f), this.IsContributing(f) && (p = this.AddOutPt(f, f.Bot))) : f === null ? (this.InsertEdgeIntoAEL(o, null), this.SetWindingCount(o), this.IsContributing(o) && (p = this.AddOutPt(o, o.Bot)), this.InsertScanbeam(o.Top.Y)) : (this.InsertEdgeIntoAEL(o, null), this.InsertEdgeIntoAEL(f, o), this.SetWindingCount(o), f.WindCnt = o.WindCnt, f.WindCnt2 = o.WindCnt2, this.IsContributing(o) && (p = this.AddLocalMinPoly(o, f, o.Bot)), this.InsertScanbeam(o.Top.Y)), f !== null && (t.ClipperBase.IsHorizontal(f) ? (f.NextInLML !== null && this.InsertScanbeam(f.NextInLML.Top.Y), this.AddEdgeToSEL(f)) : this.InsertScanbeam(f.Top.Y)), !(o === null || f === null)) {
            if (p !== null && t.ClipperBase.IsHorizontal(f) && this.m_GhostJoins.length > 0 && f.WindDelta !== 0)
              for (var C = 0, T = this.m_GhostJoins.length; C < T; C++) {
                var I = this.m_GhostJoins[C];
                this.HorzSegmentsOverlap(I.OutPt1.Pt.X, I.OffPt.X, f.Bot.X, f.Top.X) && this.AddJoin(I.OutPt1, p, I.OffPt);
              }
            if (o.OutIdx >= 0 && o.PrevInAEL !== null && o.PrevInAEL.Curr.X === o.Bot.X && o.PrevInAEL.OutIdx >= 0 && t.ClipperBase.SlopesEqual5(o.PrevInAEL.Curr, o.PrevInAEL.Top, o.Curr, o.Top, this.m_UseFullRange) && o.WindDelta !== 0 && o.PrevInAEL.WindDelta !== 0) {
              var O = this.AddOutPt(o.PrevInAEL, o.Bot);
              this.AddJoin(p, O, o.Top);
            }
            if (o.NextInAEL !== f) {
              if (f.OutIdx >= 0 && f.PrevInAEL.OutIdx >= 0 && t.ClipperBase.SlopesEqual5(f.PrevInAEL.Curr, f.PrevInAEL.Top, f.Curr, f.Top, this.m_UseFullRange) && f.WindDelta !== 0 && f.PrevInAEL.WindDelta !== 0) {
                var O = this.AddOutPt(f.PrevInAEL, f.Bot);
                this.AddJoin(p, O, f.Top);
              }
              var D = o.NextInAEL;
              if (D !== null)
                for (; D !== f; )
                  this.IntersectEdges(f, D, o.Curr), D = D.NextInAEL;
            }
          }
        }
      }, t.Clipper.prototype.InsertEdgeIntoAEL = function(n, s) {
        if (this.m_ActiveEdges === null)
          n.PrevInAEL = null, n.NextInAEL = null, this.m_ActiveEdges = n;
        else if (s === null && this.E2InsertsBeforeE1(this.m_ActiveEdges, n))
          n.PrevInAEL = null, n.NextInAEL = this.m_ActiveEdges, this.m_ActiveEdges.PrevInAEL = n, this.m_ActiveEdges = n;
        else {
          for (s === null && (s = this.m_ActiveEdges); s.NextInAEL !== null && !this.E2InsertsBeforeE1(s.NextInAEL, n); )
            s = s.NextInAEL;
          n.NextInAEL = s.NextInAEL, s.NextInAEL !== null && (s.NextInAEL.PrevInAEL = n), n.PrevInAEL = s, s.NextInAEL = n;
        }
      }, t.Clipper.prototype.E2InsertsBeforeE1 = function(n, s) {
        return s.Curr.X === n.Curr.X ? s.Top.Y > n.Top.Y ? s.Top.X < t.Clipper.TopX(n, s.Top.Y) : n.Top.X > t.Clipper.TopX(s, n.Top.Y) : s.Curr.X < n.Curr.X;
      }, t.Clipper.prototype.IsEvenOddFillType = function(n) {
        return n.PolyTyp === t.PolyType.ptSubject ? this.m_SubjFillType === t.PolyFillType.pftEvenOdd : this.m_ClipFillType === t.PolyFillType.pftEvenOdd;
      }, t.Clipper.prototype.IsEvenOddAltFillType = function(n) {
        return n.PolyTyp === t.PolyType.ptSubject ? this.m_ClipFillType === t.PolyFillType.pftEvenOdd : this.m_SubjFillType === t.PolyFillType.pftEvenOdd;
      }, t.Clipper.prototype.IsContributing = function(n) {
        var s, o;
        switch (n.PolyTyp === t.PolyType.ptSubject ? (s = this.m_SubjFillType, o = this.m_ClipFillType) : (s = this.m_ClipFillType, o = this.m_SubjFillType), s) {
          case t.PolyFillType.pftEvenOdd:
            if (n.WindDelta === 0 && n.WindCnt !== 1)
              return !1;
            break;
          case t.PolyFillType.pftNonZero:
            if (Math.abs(n.WindCnt) !== 1)
              return !1;
            break;
          case t.PolyFillType.pftPositive:
            if (n.WindCnt !== 1)
              return !1;
            break;
          default:
            if (n.WindCnt !== -1)
              return !1;
            break;
        }
        switch (this.m_ClipType) {
          case t.ClipType.ctIntersection:
            switch (o) {
              case t.PolyFillType.pftEvenOdd:
              case t.PolyFillType.pftNonZero:
                return n.WindCnt2 !== 0;
              case t.PolyFillType.pftPositive:
                return n.WindCnt2 > 0;
              default:
                return n.WindCnt2 < 0;
            }
          case t.ClipType.ctUnion:
            switch (o) {
              case t.PolyFillType.pftEvenOdd:
              case t.PolyFillType.pftNonZero:
                return n.WindCnt2 === 0;
              case t.PolyFillType.pftPositive:
                return n.WindCnt2 <= 0;
              default:
                return n.WindCnt2 >= 0;
            }
          case t.ClipType.ctDifference:
            if (n.PolyTyp === t.PolyType.ptSubject)
              switch (o) {
                case t.PolyFillType.pftEvenOdd:
                case t.PolyFillType.pftNonZero:
                  return n.WindCnt2 === 0;
                case t.PolyFillType.pftPositive:
                  return n.WindCnt2 <= 0;
                default:
                  return n.WindCnt2 >= 0;
              }
            else
              switch (o) {
                case t.PolyFillType.pftEvenOdd:
                case t.PolyFillType.pftNonZero:
                  return n.WindCnt2 !== 0;
                case t.PolyFillType.pftPositive:
                  return n.WindCnt2 > 0;
                default:
                  return n.WindCnt2 < 0;
              }
          case t.ClipType.ctXor:
            if (n.WindDelta === 0)
              switch (o) {
                case t.PolyFillType.pftEvenOdd:
                case t.PolyFillType.pftNonZero:
                  return n.WindCnt2 === 0;
                case t.PolyFillType.pftPositive:
                  return n.WindCnt2 <= 0;
                default:
                  return n.WindCnt2 >= 0;
              }
            else
              return !0;
        }
        return !0;
      }, t.Clipper.prototype.SetWindingCount = function(n) {
        for (var s = n.PrevInAEL; s !== null && (s.PolyTyp !== n.PolyTyp || s.WindDelta === 0); )
          s = s.PrevInAEL;
        if (s === null) {
          var o = n.PolyTyp === t.PolyType.ptSubject ? this.m_SubjFillType : this.m_ClipFillType;
          n.WindDelta === 0 ? n.WindCnt = o === t.PolyFillType.pftNegative ? -1 : 1 : n.WindCnt = n.WindDelta, n.WindCnt2 = 0, s = this.m_ActiveEdges;
        } else if (n.WindDelta === 0 && this.m_ClipType !== t.ClipType.ctUnion)
          n.WindCnt = 1, n.WindCnt2 = s.WindCnt2, s = s.NextInAEL;
        else if (this.IsEvenOddFillType(n)) {
          if (n.WindDelta === 0) {
            for (var f = !0, p = s.PrevInAEL; p !== null; )
              p.PolyTyp === s.PolyTyp && p.WindDelta !== 0 && (f = !f), p = p.PrevInAEL;
            n.WindCnt = f ? 0 : 1;
          } else
            n.WindCnt = n.WindDelta;
          n.WindCnt2 = s.WindCnt2, s = s.NextInAEL;
        } else
          s.WindCnt * s.WindDelta < 0 ? Math.abs(s.WindCnt) > 1 ? s.WindDelta * n.WindDelta < 0 ? n.WindCnt = s.WindCnt : n.WindCnt = s.WindCnt + n.WindDelta : n.WindCnt = n.WindDelta === 0 ? 1 : n.WindDelta : n.WindDelta === 0 ? n.WindCnt = s.WindCnt < 0 ? s.WindCnt - 1 : s.WindCnt + 1 : s.WindDelta * n.WindDelta < 0 ? n.WindCnt = s.WindCnt : n.WindCnt = s.WindCnt + n.WindDelta, n.WindCnt2 = s.WindCnt2, s = s.NextInAEL;
        if (this.IsEvenOddAltFillType(n))
          for (; s !== n; )
            s.WindDelta !== 0 && (n.WindCnt2 = n.WindCnt2 === 0 ? 1 : 0), s = s.NextInAEL;
        else
          for (; s !== n; )
            n.WindCnt2 += s.WindDelta, s = s.NextInAEL;
      }, t.Clipper.prototype.AddEdgeToSEL = function(n) {
        this.m_SortedEdges === null ? (this.m_SortedEdges = n, n.PrevInSEL = null, n.NextInSEL = null) : (n.NextInSEL = this.m_SortedEdges, n.PrevInSEL = null, this.m_SortedEdges.PrevInSEL = n, this.m_SortedEdges = n);
      }, t.Clipper.prototype.PopEdgeFromSEL = function(n) {
        if (n.v = this.m_SortedEdges, n.v === null)
          return !1;
        var s = n.v;
        return this.m_SortedEdges = n.v.NextInSEL, this.m_SortedEdges !== null && (this.m_SortedEdges.PrevInSEL = null), s.NextInSEL = null, s.PrevInSEL = null, !0;
      }, t.Clipper.prototype.CopyAELToSEL = function() {
        var n = this.m_ActiveEdges;
        for (this.m_SortedEdges = n; n !== null; )
          n.PrevInSEL = n.PrevInAEL, n.NextInSEL = n.NextInAEL, n = n.NextInAEL;
      }, t.Clipper.prototype.SwapPositionsInSEL = function(n, s) {
        if (!(n.NextInSEL === null && n.PrevInSEL === null) && !(s.NextInSEL === null && s.PrevInSEL === null)) {
          if (n.NextInSEL === s) {
            var o = s.NextInSEL;
            o !== null && (o.PrevInSEL = n);
            var f = n.PrevInSEL;
            f !== null && (f.NextInSEL = s), s.PrevInSEL = f, s.NextInSEL = n, n.PrevInSEL = s, n.NextInSEL = o;
          } else if (s.NextInSEL === n) {
            var o = n.NextInSEL;
            o !== null && (o.PrevInSEL = s);
            var f = s.PrevInSEL;
            f !== null && (f.NextInSEL = n), n.PrevInSEL = f, n.NextInSEL = s, s.PrevInSEL = n, s.NextInSEL = o;
          } else {
            var o = n.NextInSEL, f = n.PrevInSEL;
            n.NextInSEL = s.NextInSEL, n.NextInSEL !== null && (n.NextInSEL.PrevInSEL = n), n.PrevInSEL = s.PrevInSEL, n.PrevInSEL !== null && (n.PrevInSEL.NextInSEL = n), s.NextInSEL = o, s.NextInSEL !== null && (s.NextInSEL.PrevInSEL = s), s.PrevInSEL = f, s.PrevInSEL !== null && (s.PrevInSEL.NextInSEL = s);
          }
          n.PrevInSEL === null ? this.m_SortedEdges = n : s.PrevInSEL === null && (this.m_SortedEdges = s);
        }
      }, t.Clipper.prototype.AddLocalMaxPoly = function(n, s, o) {
        this.AddOutPt(n, o), s.WindDelta === 0 && this.AddOutPt(s, o), n.OutIdx === s.OutIdx ? (n.OutIdx = -1, s.OutIdx = -1) : n.OutIdx < s.OutIdx ? this.AppendPolygon(n, s) : this.AppendPolygon(s, n);
      }, t.Clipper.prototype.AddLocalMinPoly = function(n, s, o) {
        var f, p, C;
        if (t.ClipperBase.IsHorizontal(s) || n.Dx > s.Dx ? (f = this.AddOutPt(n, o), s.OutIdx = n.OutIdx, n.Side = t.EdgeSide.esLeft, s.Side = t.EdgeSide.esRight, p = n, p.PrevInAEL === s ? C = s.PrevInAEL : C = p.PrevInAEL) : (f = this.AddOutPt(s, o), n.OutIdx = s.OutIdx, n.Side = t.EdgeSide.esRight, s.Side = t.EdgeSide.esLeft, p = s, p.PrevInAEL === n ? C = n.PrevInAEL : C = p.PrevInAEL), C !== null && C.OutIdx >= 0 && C.Top.Y < o.Y && p.Top.Y < o.Y) {
          var T = t.Clipper.TopX(C, o.Y), I = t.Clipper.TopX(p, o.Y);
          if (T === I && p.WindDelta !== 0 && C.WindDelta !== 0 && t.ClipperBase.SlopesEqual5(new t.IntPoint2(T, o.Y), C.Top, new t.IntPoint2(I, o.Y), p.Top, this.m_UseFullRange)) {
            var O = this.AddOutPt(C, o);
            this.AddJoin(f, O, p.Top);
          }
        }
        return f;
      }, t.Clipper.prototype.AddOutPt = function(n, s) {
        if (n.OutIdx < 0) {
          var o = this.CreateOutRec();
          o.IsOpen = n.WindDelta === 0;
          var f = new t.OutPt();
          return o.Pts = f, f.Idx = o.Idx, f.Pt.X = s.X, f.Pt.Y = s.Y, t.use_xyz && (f.Pt.Z = s.Z), f.Next = f, f.Prev = f, o.IsOpen || this.SetHoleState(n, o), n.OutIdx = o.Idx, f;
        } else {
          var o = this.m_PolyOuts[n.OutIdx], p = o.Pts, C = n.Side === t.EdgeSide.esLeft;
          if (C && t.IntPoint.op_Equality(s, p.Pt))
            return p;
          if (!C && t.IntPoint.op_Equality(s, p.Prev.Pt))
            return p.Prev;
          var f = new t.OutPt();
          return f.Idx = o.Idx, f.Pt.X = s.X, f.Pt.Y = s.Y, t.use_xyz && (f.Pt.Z = s.Z), f.Next = p, f.Prev = p.Prev, f.Prev.Next = f, p.Prev = f, C && (o.Pts = f), f;
        }
      }, t.Clipper.prototype.GetLastOutPt = function(n) {
        var s = this.m_PolyOuts[n.OutIdx];
        return n.Side === t.EdgeSide.esLeft ? s.Pts : s.Pts.Prev;
      }, t.Clipper.prototype.SwapPoints = function(n, s) {
        var o = new t.IntPoint1(n.Value);
        n.Value.X = s.Value.X, n.Value.Y = s.Value.Y, t.use_xyz && (n.Value.Z = s.Value.Z), s.Value.X = o.X, s.Value.Y = o.Y, t.use_xyz && (s.Value.Z = o.Z);
      }, t.Clipper.prototype.HorzSegmentsOverlap = function(n, s, o, f) {
        var p;
        return n > s && (p = n, n = s, s = p), o > f && (p = o, o = f, f = p), n < f && o < s;
      }, t.Clipper.prototype.SetHoleState = function(n, s) {
        for (var o = n.PrevInAEL, f = null; o !== null; )
          o.OutIdx >= 0 && o.WindDelta !== 0 && (f === null ? f = o : f.OutIdx === o.OutIdx && (f = null)), o = o.PrevInAEL;
        f === null ? (s.FirstLeft = null, s.IsHole = !1) : (s.FirstLeft = this.m_PolyOuts[f.OutIdx], s.IsHole = !s.FirstLeft.IsHole);
      }, t.Clipper.prototype.GetDx = function(n, s) {
        return n.Y === s.Y ? t.ClipperBase.horizontal : (s.X - n.X) / (s.Y - n.Y);
      }, t.Clipper.prototype.FirstIsBottomPt = function(n, s) {
        for (var o = n.Prev; t.IntPoint.op_Equality(o.Pt, n.Pt) && o !== n; )
          o = o.Prev;
        var f = Math.abs(this.GetDx(n.Pt, o.Pt));
        for (o = n.Next; t.IntPoint.op_Equality(o.Pt, n.Pt) && o !== n; )
          o = o.Next;
        var p = Math.abs(this.GetDx(n.Pt, o.Pt));
        for (o = s.Prev; t.IntPoint.op_Equality(o.Pt, s.Pt) && o !== s; )
          o = o.Prev;
        var C = Math.abs(this.GetDx(s.Pt, o.Pt));
        for (o = s.Next; t.IntPoint.op_Equality(o.Pt, s.Pt) && o !== s; )
          o = o.Next;
        var T = Math.abs(this.GetDx(s.Pt, o.Pt));
        return Math.max(f, p) === Math.max(C, T) && Math.min(f, p) === Math.min(C, T) ? this.Area(n) > 0 : f >= C && f >= T || p >= C && p >= T;
      }, t.Clipper.prototype.GetBottomPt = function(n) {
        for (var s = null, o = n.Next; o !== n; )
          o.Pt.Y > n.Pt.Y ? (n = o, s = null) : o.Pt.Y === n.Pt.Y && o.Pt.X <= n.Pt.X && (o.Pt.X < n.Pt.X ? (s = null, n = o) : o.Next !== n && o.Prev !== n && (s = o)), o = o.Next;
        if (s !== null)
          for (; s !== o; )
            for (this.FirstIsBottomPt(o, s) || (n = s), s = s.Next; t.IntPoint.op_Inequality(s.Pt, n.Pt); )
              s = s.Next;
        return n;
      }, t.Clipper.prototype.GetLowermostRec = function(n, s) {
        n.BottomPt === null && (n.BottomPt = this.GetBottomPt(n.Pts)), s.BottomPt === null && (s.BottomPt = this.GetBottomPt(s.Pts));
        var o = n.BottomPt, f = s.BottomPt;
        return o.Pt.Y > f.Pt.Y ? n : o.Pt.Y < f.Pt.Y ? s : o.Pt.X < f.Pt.X ? n : o.Pt.X > f.Pt.X || o.Next === o ? s : f.Next === f || this.FirstIsBottomPt(o, f) ? n : s;
      }, t.Clipper.prototype.OutRec1RightOfOutRec2 = function(n, s) {
        do
          if (n = n.FirstLeft, n === s)
            return !0;
        while (n !== null);
        return !1;
      }, t.Clipper.prototype.GetOutRec = function(n) {
        for (var s = this.m_PolyOuts[n]; s !== this.m_PolyOuts[s.Idx]; )
          s = this.m_PolyOuts[s.Idx];
        return s;
      }, t.Clipper.prototype.AppendPolygon = function(n, s) {
        var o = this.m_PolyOuts[n.OutIdx], f = this.m_PolyOuts[s.OutIdx], p;
        this.OutRec1RightOfOutRec2(o, f) ? p = f : this.OutRec1RightOfOutRec2(f, o) ? p = o : p = this.GetLowermostRec(o, f);
        var C = o.Pts, T = C.Prev, I = f.Pts, O = I.Prev;
        n.Side === t.EdgeSide.esLeft ? s.Side === t.EdgeSide.esLeft ? (this.ReversePolyPtLinks(I), I.Next = C, C.Prev = I, T.Next = O, O.Prev = T, o.Pts = O) : (O.Next = C, C.Prev = O, I.Prev = T, T.Next = I, o.Pts = I) : s.Side === t.EdgeSide.esRight ? (this.ReversePolyPtLinks(I), T.Next = O, O.Prev = T, I.Next = C, C.Prev = I) : (T.Next = I, I.Prev = T, C.Prev = O, O.Next = C), o.BottomPt = null, p === f && (f.FirstLeft !== o && (o.FirstLeft = f.FirstLeft), o.IsHole = f.IsHole), f.Pts = null, f.BottomPt = null, f.FirstLeft = o;
        var D = n.OutIdx, b = s.OutIdx;
        n.OutIdx = -1, s.OutIdx = -1;
        for (var B = this.m_ActiveEdges; B !== null; ) {
          if (B.OutIdx === b) {
            B.OutIdx = D, B.Side = n.Side;
            break;
          }
          B = B.NextInAEL;
        }
        f.Idx = o.Idx;
      }, t.Clipper.prototype.ReversePolyPtLinks = function(n) {
        if (n !== null) {
          var s, o;
          s = n;
          do
            o = s.Next, s.Next = s.Prev, s.Prev = o, s = o;
          while (s !== n);
        }
      }, t.Clipper.SwapSides = function(n, s) {
        var o = n.Side;
        n.Side = s.Side, s.Side = o;
      }, t.Clipper.SwapPolyIndexes = function(n, s) {
        var o = n.OutIdx;
        n.OutIdx = s.OutIdx, s.OutIdx = o;
      }, t.Clipper.prototype.IntersectEdges = function(n, s, o) {
        var f = n.OutIdx >= 0, p = s.OutIdx >= 0;
        if (t.use_xyz && this.SetZ(o, n, s), t.use_lines && (n.WindDelta === 0 || s.WindDelta === 0)) {
          if (n.WindDelta === 0 && s.WindDelta === 0) return;
          n.PolyTyp === s.PolyTyp && n.WindDelta !== s.WindDelta && this.m_ClipType === t.ClipType.ctUnion ? n.WindDelta === 0 ? p && (this.AddOutPt(n, o), f && (n.OutIdx = -1)) : f && (this.AddOutPt(s, o), p && (s.OutIdx = -1)) : n.PolyTyp !== s.PolyTyp && (n.WindDelta === 0 && Math.abs(s.WindCnt) === 1 && (this.m_ClipType !== t.ClipType.ctUnion || s.WindCnt2 === 0) ? (this.AddOutPt(n, o), f && (n.OutIdx = -1)) : s.WindDelta === 0 && Math.abs(n.WindCnt) === 1 && (this.m_ClipType !== t.ClipType.ctUnion || n.WindCnt2 === 0) && (this.AddOutPt(s, o), p && (s.OutIdx = -1)));
          return;
        }
        if (n.PolyTyp === s.PolyTyp)
          if (this.IsEvenOddFillType(n)) {
            var C = n.WindCnt;
            n.WindCnt = s.WindCnt, s.WindCnt = C;
          } else
            n.WindCnt + s.WindDelta === 0 ? n.WindCnt = -n.WindCnt : n.WindCnt += s.WindDelta, s.WindCnt - n.WindDelta === 0 ? s.WindCnt = -s.WindCnt : s.WindCnt -= n.WindDelta;
        else
          this.IsEvenOddFillType(s) ? n.WindCnt2 = n.WindCnt2 === 0 ? 1 : 0 : n.WindCnt2 += s.WindDelta, this.IsEvenOddFillType(n) ? s.WindCnt2 = s.WindCnt2 === 0 ? 1 : 0 : s.WindCnt2 -= n.WindDelta;
        var T, I, O, D;
        n.PolyTyp === t.PolyType.ptSubject ? (T = this.m_SubjFillType, O = this.m_ClipFillType) : (T = this.m_ClipFillType, O = this.m_SubjFillType), s.PolyTyp === t.PolyType.ptSubject ? (I = this.m_SubjFillType, D = this.m_ClipFillType) : (I = this.m_ClipFillType, D = this.m_SubjFillType);
        var b, B;
        switch (T) {
          case t.PolyFillType.pftPositive:
            b = n.WindCnt;
            break;
          case t.PolyFillType.pftNegative:
            b = -n.WindCnt;
            break;
          default:
            b = Math.abs(n.WindCnt);
            break;
        }
        switch (I) {
          case t.PolyFillType.pftPositive:
            B = s.WindCnt;
            break;
          case t.PolyFillType.pftNegative:
            B = -s.WindCnt;
            break;
          default:
            B = Math.abs(s.WindCnt);
            break;
        }
        if (f && p)
          b !== 0 && b !== 1 || B !== 0 && B !== 1 || n.PolyTyp !== s.PolyTyp && this.m_ClipType !== t.ClipType.ctXor ? this.AddLocalMaxPoly(n, s, o) : (this.AddOutPt(n, o), this.AddOutPt(s, o), t.Clipper.SwapSides(n, s), t.Clipper.SwapPolyIndexes(n, s));
        else if (f)
          (B === 0 || B === 1) && (this.AddOutPt(n, o), t.Clipper.SwapSides(n, s), t.Clipper.SwapPolyIndexes(n, s));
        else if (p)
          (b === 0 || b === 1) && (this.AddOutPt(s, o), t.Clipper.SwapSides(n, s), t.Clipper.SwapPolyIndexes(n, s));
        else if ((b === 0 || b === 1) && (B === 0 || B === 1)) {
          var $, G;
          switch (O) {
            case t.PolyFillType.pftPositive:
              $ = n.WindCnt2;
              break;
            case t.PolyFillType.pftNegative:
              $ = -n.WindCnt2;
              break;
            default:
              $ = Math.abs(n.WindCnt2);
              break;
          }
          switch (D) {
            case t.PolyFillType.pftPositive:
              G = s.WindCnt2;
              break;
            case t.PolyFillType.pftNegative:
              G = -s.WindCnt2;
              break;
            default:
              G = Math.abs(s.WindCnt2);
              break;
          }
          if (n.PolyTyp !== s.PolyTyp)
            this.AddLocalMinPoly(n, s, o);
          else if (b === 1 && B === 1)
            switch (this.m_ClipType) {
              case t.ClipType.ctIntersection:
                $ > 0 && G > 0 && this.AddLocalMinPoly(n, s, o);
                break;
              case t.ClipType.ctUnion:
                $ <= 0 && G <= 0 && this.AddLocalMinPoly(n, s, o);
                break;
              case t.ClipType.ctDifference:
                (n.PolyTyp === t.PolyType.ptClip && $ > 0 && G > 0 || n.PolyTyp === t.PolyType.ptSubject && $ <= 0 && G <= 0) && this.AddLocalMinPoly(n, s, o);
                break;
              case t.ClipType.ctXor:
                this.AddLocalMinPoly(n, s, o);
                break;
            }
          else
            t.Clipper.SwapSides(n, s);
        }
      }, t.Clipper.prototype.DeleteFromSEL = function(n) {
        var s = n.PrevInSEL, o = n.NextInSEL;
        s === null && o === null && n !== this.m_SortedEdges || (s !== null ? s.NextInSEL = o : this.m_SortedEdges = o, o !== null && (o.PrevInSEL = s), n.NextInSEL = null, n.PrevInSEL = null);
      }, t.Clipper.prototype.ProcessHorizontals = function() {
        for (var n = {}; this.PopEdgeFromSEL(n); )
          this.ProcessHorizontal(n.v);
      }, t.Clipper.prototype.GetHorzDirection = function(n, s) {
        n.Bot.X < n.Top.X ? (s.Left = n.Bot.X, s.Right = n.Top.X, s.Dir = t.Direction.dLeftToRight) : (s.Left = n.Top.X, s.Right = n.Bot.X, s.Dir = t.Direction.dRightToLeft);
      }, t.Clipper.prototype.ProcessHorizontal = function(n) {
        var s = {
          Dir: null,
          Left: null,
          Right: null
        };
        this.GetHorzDirection(n, s);
        for (var o = s.Dir, f = s.Left, p = s.Right, C = n.WindDelta === 0, T = n, I = null; T.NextInLML !== null && t.ClipperBase.IsHorizontal(T.NextInLML); )
          T = T.NextInLML;
        T.NextInLML === null && (I = this.GetMaximaPair(T));
        var O = this.m_Maxima;
        if (O !== null)
          if (o === t.Direction.dLeftToRight) {
            for (; O !== null && O.X <= n.Bot.X; )
              O = O.Next;
            O !== null && O.X >= T.Top.X && (O = null);
          } else {
            for (; O.Next !== null && O.Next.X < n.Bot.X; )
              O = O.Next;
            O.X <= T.Top.X && (O = null);
          }
        for (var D = null; ; ) {
          for (var b = n === T, B = this.GetNextInAEL(n, o); B !== null; ) {
            if (O !== null)
              if (o === t.Direction.dLeftToRight)
                for (; O !== null && O.X < B.Curr.X; )
                  n.OutIdx >= 0 && !C && this.AddOutPt(n, new t.IntPoint2(O.X, n.Bot.Y)), O = O.Next;
              else
                for (; O !== null && O.X > B.Curr.X; )
                  n.OutIdx >= 0 && !C && this.AddOutPt(n, new t.IntPoint2(O.X, n.Bot.Y)), O = O.Prev;
            if (o === t.Direction.dLeftToRight && B.Curr.X > p || o === t.Direction.dRightToLeft && B.Curr.X < f || B.Curr.X === n.Top.X && n.NextInLML !== null && B.Dx < n.NextInLML.Dx)
              break;
            if (n.OutIdx >= 0 && !C) {
              t.use_xyz && (o === t.Direction.dLeftToRight ? this.SetZ(B.Curr, n, B) : this.SetZ(B.Curr, B, n)), D = this.AddOutPt(n, B.Curr);
              for (var $ = this.m_SortedEdges; $ !== null; ) {
                if ($.OutIdx >= 0 && this.HorzSegmentsOverlap(n.Bot.X, n.Top.X, $.Bot.X, $.Top.X)) {
                  var G = this.GetLastOutPt($);
                  this.AddJoin(G, D, $.Top);
                }
                $ = $.NextInSEL;
              }
              this.AddGhostJoin(D, n.Bot);
            }
            if (B === I && b) {
              n.OutIdx >= 0 && this.AddLocalMaxPoly(n, I, n.Top), this.DeleteFromAEL(n), this.DeleteFromAEL(I);
              return;
            }
            if (o === t.Direction.dLeftToRight) {
              var K = new t.IntPoint2(B.Curr.X, n.Curr.Y);
              this.IntersectEdges(n, B, K);
            } else {
              var K = new t.IntPoint2(B.Curr.X, n.Curr.Y);
              this.IntersectEdges(B, n, K);
            }
            var Q = this.GetNextInAEL(B, o);
            this.SwapPositionsInAEL(n, B), B = Q;
          }
          if (n.NextInLML === null || !t.ClipperBase.IsHorizontal(n.NextInLML))
            break;
          n = this.UpdateEdgeIntoAEL(n), n.OutIdx >= 0 && this.AddOutPt(n, n.Bot), s = {
            Dir: o,
            Left: f,
            Right: p
          }, this.GetHorzDirection(n, s), o = s.Dir, f = s.Left, p = s.Right;
        }
        if (n.OutIdx >= 0 && D === null) {
          D = this.GetLastOutPt(n);
          for (var $ = this.m_SortedEdges; $ !== null; ) {
            if ($.OutIdx >= 0 && this.HorzSegmentsOverlap(n.Bot.X, n.Top.X, $.Bot.X, $.Top.X)) {
              var G = this.GetLastOutPt($);
              this.AddJoin(G, D, $.Top);
            }
            $ = $.NextInSEL;
          }
          this.AddGhostJoin(D, n.Top);
        }
        if (n.NextInLML !== null)
          if (n.OutIdx >= 0) {
            if (D = this.AddOutPt(n, n.Top), n = this.UpdateEdgeIntoAEL(n), n.WindDelta === 0)
              return;
            var st = n.PrevInAEL, Q = n.NextInAEL;
            if (st !== null && st.Curr.X === n.Bot.X && st.Curr.Y === n.Bot.Y && st.WindDelta === 0 && st.OutIdx >= 0 && st.Curr.Y > st.Top.Y && t.ClipperBase.SlopesEqual3(n, st, this.m_UseFullRange)) {
              var G = this.AddOutPt(st, n.Bot);
              this.AddJoin(D, G, n.Top);
            } else if (Q !== null && Q.Curr.X === n.Bot.X && Q.Curr.Y === n.Bot.Y && Q.WindDelta !== 0 && Q.OutIdx >= 0 && Q.Curr.Y > Q.Top.Y && t.ClipperBase.SlopesEqual3(n, Q, this.m_UseFullRange)) {
              var G = this.AddOutPt(Q, n.Bot);
              this.AddJoin(D, G, n.Top);
            }
          } else
            n = this.UpdateEdgeIntoAEL(n);
        else
          n.OutIdx >= 0 && this.AddOutPt(n, n.Top), this.DeleteFromAEL(n);
      }, t.Clipper.prototype.GetNextInAEL = function(n, s) {
        return s === t.Direction.dLeftToRight ? n.NextInAEL : n.PrevInAEL;
      }, t.Clipper.prototype.IsMinima = function(n) {
        return n !== null && n.Prev.NextInLML !== n && n.Next.NextInLML !== n;
      }, t.Clipper.prototype.IsMaxima = function(n, s) {
        return n !== null && n.Top.Y === s && n.NextInLML === null;
      }, t.Clipper.prototype.IsIntermediate = function(n, s) {
        return n.Top.Y === s && n.NextInLML !== null;
      }, t.Clipper.prototype.GetMaximaPair = function(n) {
        return t.IntPoint.op_Equality(n.Next.Top, n.Top) && n.Next.NextInLML === null ? n.Next : t.IntPoint.op_Equality(n.Prev.Top, n.Top) && n.Prev.NextInLML === null ? n.Prev : null;
      }, t.Clipper.prototype.GetMaximaPairEx = function(n) {
        var s = this.GetMaximaPair(n);
        return s === null || s.OutIdx === t.ClipperBase.Skip || s.NextInAEL === s.PrevInAEL && !t.ClipperBase.IsHorizontal(s) ? null : s;
      }, t.Clipper.prototype.ProcessIntersections = function(n) {
        if (this.m_ActiveEdges === null)
          return !0;
        try {
          if (this.BuildIntersectList(n), this.m_IntersectList.length === 0)
            return !0;
          if (this.m_IntersectList.length === 1 || this.FixupIntersectionOrder())
            this.ProcessIntersectList();
          else
            return !1;
        } catch {
          this.m_SortedEdges = null, this.m_IntersectList.length = 0, t.Error("ProcessIntersections error");
        }
        return this.m_SortedEdges = null, !0;
      }, t.Clipper.prototype.BuildIntersectList = function(n) {
        if (this.m_ActiveEdges !== null) {
          var s = this.m_ActiveEdges;
          for (this.m_SortedEdges = s; s !== null; )
            s.PrevInSEL = s.PrevInAEL, s.NextInSEL = s.NextInAEL, s.Curr.X = t.Clipper.TopX(s, n), s = s.NextInAEL;
          for (var o = !0; o && this.m_SortedEdges !== null; ) {
            for (o = !1, s = this.m_SortedEdges; s.NextInSEL !== null; ) {
              var f = s.NextInSEL, p = new t.IntPoint0();
              if (s.Curr.X > f.Curr.X) {
                this.IntersectPoint(s, f, p), p.Y < n && (p = new t.IntPoint2(t.Clipper.TopX(s, n), n));
                var C = new t.IntersectNode();
                C.Edge1 = s, C.Edge2 = f, C.Pt.X = p.X, C.Pt.Y = p.Y, t.use_xyz && (C.Pt.Z = p.Z), this.m_IntersectList.push(C), this.SwapPositionsInSEL(s, f), o = !0;
              } else
                s = f;
            }
            if (s.PrevInSEL !== null)
              s.PrevInSEL.NextInSEL = null;
            else
              break;
          }
          this.m_SortedEdges = null;
        }
      }, t.Clipper.prototype.EdgesAdjacent = function(n) {
        return n.Edge1.NextInSEL === n.Edge2 || n.Edge1.PrevInSEL === n.Edge2;
      }, t.Clipper.IntersectNodeSort = function(n, s) {
        return s.Pt.Y - n.Pt.Y;
      }, t.Clipper.prototype.FixupIntersectionOrder = function() {
        this.m_IntersectList.sort(this.m_IntersectNodeComparer), this.CopyAELToSEL();
        for (var n = this.m_IntersectList.length, s = 0; s < n; s++) {
          if (!this.EdgesAdjacent(this.m_IntersectList[s])) {
            for (var o = s + 1; o < n && !this.EdgesAdjacent(this.m_IntersectList[o]); )
              o++;
            if (o === n)
              return !1;
            var f = this.m_IntersectList[s];
            this.m_IntersectList[s] = this.m_IntersectList[o], this.m_IntersectList[o] = f;
          }
          this.SwapPositionsInSEL(this.m_IntersectList[s].Edge1, this.m_IntersectList[s].Edge2);
        }
        return !0;
      }, t.Clipper.prototype.ProcessIntersectList = function() {
        for (var n = 0, s = this.m_IntersectList.length; n < s; n++) {
          var o = this.m_IntersectList[n];
          this.IntersectEdges(o.Edge1, o.Edge2, o.Pt), this.SwapPositionsInAEL(o.Edge1, o.Edge2);
        }
        this.m_IntersectList.length = 0;
      };
      var Oo = function(n) {
        return n < 0 ? Math.ceil(n - 0.5) : Math.round(n);
      }, Lo = function(n) {
        return n < 0 ? Math.ceil(n - 0.5) : Math.floor(n + 0.5);
      }, wo = function(n) {
        return n < 0 ? -Math.round(Math.abs(n)) : Math.round(n);
      }, No = function(n) {
        return n < 0 ? (n -= 0.5, n < -2147483648 ? Math.ceil(n) : n | 0) : (n += 0.5, n > 2147483647 ? Math.floor(n) : n | 0);
      };
      l.msie ? t.Clipper.Round = Oo : l.chromium ? t.Clipper.Round = wo : l.safari ? t.Clipper.Round = No : t.Clipper.Round = Lo, t.Clipper.TopX = function(n, s) {
        return s === n.Top.Y ? n.Top.X : n.Bot.X + t.Clipper.Round(n.Dx * (s - n.Bot.Y));
      }, t.Clipper.prototype.IntersectPoint = function(n, s, o) {
        o.X = 0, o.Y = 0;
        var f, p;
        if (n.Dx === s.Dx) {
          o.Y = n.Curr.Y, o.X = t.Clipper.TopX(n, o.Y);
          return;
        }
        if (n.Delta.X === 0)
          o.X = n.Bot.X, t.ClipperBase.IsHorizontal(s) ? o.Y = s.Bot.Y : (p = s.Bot.Y - s.Bot.X / s.Dx, o.Y = t.Clipper.Round(o.X / s.Dx + p));
        else if (s.Delta.X === 0)
          o.X = s.Bot.X, t.ClipperBase.IsHorizontal(n) ? o.Y = n.Bot.Y : (f = n.Bot.Y - n.Bot.X / n.Dx, o.Y = t.Clipper.Round(o.X / n.Dx + f));
        else {
          f = n.Bot.X - n.Bot.Y * n.Dx, p = s.Bot.X - s.Bot.Y * s.Dx;
          var C = (p - f) / (n.Dx - s.Dx);
          o.Y = t.Clipper.Round(C), Math.abs(n.Dx) < Math.abs(s.Dx) ? o.X = t.Clipper.Round(n.Dx * C + f) : o.X = t.Clipper.Round(s.Dx * C + p);
        }
        if (o.Y < n.Top.Y || o.Y < s.Top.Y) {
          if (n.Top.Y > s.Top.Y)
            return o.Y = n.Top.Y, o.X = t.Clipper.TopX(s, n.Top.Y), o.X < n.Top.X;
          o.Y = s.Top.Y, Math.abs(n.Dx) < Math.abs(s.Dx) ? o.X = t.Clipper.TopX(n, o.Y) : o.X = t.Clipper.TopX(s, o.Y);
        }
        o.Y > n.Curr.Y && (o.Y = n.Curr.Y, Math.abs(n.Dx) > Math.abs(s.Dx) ? o.X = t.Clipper.TopX(s, o.Y) : o.X = t.Clipper.TopX(n, o.Y));
      }, t.Clipper.prototype.ProcessEdgesAtTopOfScanbeam = function(n) {
        for (var s = this.m_ActiveEdges; s !== null; ) {
          var o = this.IsMaxima(s, n);
          if (o) {
            var f = this.GetMaximaPairEx(s);
            o = f === null || !t.ClipperBase.IsHorizontal(f);
          }
          if (o) {
            this.StrictlySimple && this.InsertMaxima(s.Top.X);
            var p = s.PrevInAEL;
            this.DoMaxima(s), p === null ? s = this.m_ActiveEdges : s = p.NextInAEL;
          } else {
            if (this.IsIntermediate(s, n) && t.ClipperBase.IsHorizontal(s.NextInLML) ? (s = this.UpdateEdgeIntoAEL(s), s.OutIdx >= 0 && this.AddOutPt(s, s.Bot), this.AddEdgeToSEL(s)) : (s.Curr.X = t.Clipper.TopX(s, n), s.Curr.Y = n), t.use_xyz && (s.Top.Y === n ? s.Curr.Z = s.Top.Z : s.Bot.Y === n ? s.Curr.Z = s.Bot.Z : s.Curr.Z = 0), this.StrictlySimple) {
              var p = s.PrevInAEL;
              if (s.OutIdx >= 0 && s.WindDelta !== 0 && p !== null && p.OutIdx >= 0 && p.Curr.X === s.Curr.X && p.WindDelta !== 0) {
                var C = new t.IntPoint1(s.Curr);
                t.use_xyz && this.SetZ(C, p, s);
                var T = this.AddOutPt(p, C), I = this.AddOutPt(s, C);
                this.AddJoin(T, I, C);
              }
            }
            s = s.NextInAEL;
          }
        }
        for (this.ProcessHorizontals(), this.m_Maxima = null, s = this.m_ActiveEdges; s !== null; ) {
          if (this.IsIntermediate(s, n)) {
            var T = null;
            s.OutIdx >= 0 && (T = this.AddOutPt(s, s.Top)), s = this.UpdateEdgeIntoAEL(s);
            var p = s.PrevInAEL, O = s.NextInAEL;
            if (p !== null && p.Curr.X === s.Bot.X && p.Curr.Y === s.Bot.Y && T !== null && p.OutIdx >= 0 && p.Curr.Y === p.Top.Y && t.ClipperBase.SlopesEqual5(s.Curr, s.Top, p.Curr, p.Top, this.m_UseFullRange) && s.WindDelta !== 0 && p.WindDelta !== 0) {
              var I = this.AddOutPt(ePrev2, s.Bot);
              this.AddJoin(T, I, s.Top);
            } else if (O !== null && O.Curr.X === s.Bot.X && O.Curr.Y === s.Bot.Y && T !== null && O.OutIdx >= 0 && O.Curr.Y === O.Top.Y && t.ClipperBase.SlopesEqual5(s.Curr, s.Top, O.Curr, O.Top, this.m_UseFullRange) && s.WindDelta !== 0 && O.WindDelta !== 0) {
              var I = this.AddOutPt(O, s.Bot);
              this.AddJoin(T, I, s.Top);
            }
          }
          s = s.NextInAEL;
        }
      }, t.Clipper.prototype.DoMaxima = function(n) {
        var s = this.GetMaximaPairEx(n);
        if (s === null) {
          n.OutIdx >= 0 && this.AddOutPt(n, n.Top), this.DeleteFromAEL(n);
          return;
        }
        for (var o = n.NextInAEL; o !== null && o !== s; )
          this.IntersectEdges(n, o, n.Top), this.SwapPositionsInAEL(n, o), o = n.NextInAEL;
        n.OutIdx === -1 && s.OutIdx === -1 ? (this.DeleteFromAEL(n), this.DeleteFromAEL(s)) : n.OutIdx >= 0 && s.OutIdx >= 0 ? (n.OutIdx >= 0 && this.AddLocalMaxPoly(n, s, n.Top), this.DeleteFromAEL(n), this.DeleteFromAEL(s)) : t.use_lines && n.WindDelta === 0 ? (n.OutIdx >= 0 && (this.AddOutPt(n, n.Top), n.OutIdx = t.ClipperBase.Unassigned), this.DeleteFromAEL(n), s.OutIdx >= 0 && (this.AddOutPt(s, n.Top), s.OutIdx = t.ClipperBase.Unassigned), this.DeleteFromAEL(s)) : t.Error("DoMaxima error");
      }, t.Clipper.ReversePaths = function(n) {
        for (var s = 0, o = n.length; s < o; s++)
          n[s].reverse();
      }, t.Clipper.Orientation = function(n) {
        return t.Clipper.Area(n) >= 0;
      }, t.Clipper.prototype.PointCount = function(n) {
        if (n === null)
          return 0;
        var s = 0, o = n;
        do
          s++, o = o.Next;
        while (o !== n);
        return s;
      }, t.Clipper.prototype.BuildResult = function(n) {
        t.Clear(n);
        for (var s = 0, o = this.m_PolyOuts.length; s < o; s++) {
          var f = this.m_PolyOuts[s];
          if (f.Pts !== null) {
            var p = f.Pts.Prev, C = this.PointCount(p);
            if (!(C < 2)) {
              for (var T = new Array(C), I = 0; I < C; I++)
                T[I] = p.Pt, p = p.Prev;
              n.push(T);
            }
          }
        }
      }, t.Clipper.prototype.BuildResult2 = function(n) {
        n.Clear();
        for (var s = 0, o = this.m_PolyOuts.length; s < o; s++) {
          var f = this.m_PolyOuts[s], p = this.PointCount(f.Pts);
          if (!(f.IsOpen && p < 2 || !f.IsOpen && p < 3)) {
            this.FixHoleLinkage(f);
            var C = new t.PolyNode();
            n.m_AllPolys.push(C), f.PolyNode = C, C.m_polygon.length = p;
            for (var T = f.Pts.Prev, I = 0; I < p; I++)
              C.m_polygon[I] = T.Pt, T = T.Prev;
          }
        }
        for (var s = 0, o = this.m_PolyOuts.length; s < o; s++) {
          var f = this.m_PolyOuts[s];
          f.PolyNode !== null && (f.IsOpen ? (f.PolyNode.IsOpen = !0, n.AddChild(f.PolyNode)) : f.FirstLeft !== null && f.FirstLeft.PolyNode !== null ? f.FirstLeft.PolyNode.AddChild(f.PolyNode) : n.AddChild(f.PolyNode));
        }
      }, t.Clipper.prototype.FixupOutPolyline = function(n) {
        for (var s = n.Pts, o = s.Prev; s !== o; )
          if (s = s.Next, t.IntPoint.op_Equality(s.Pt, s.Prev.Pt)) {
            s === o && (o = s.Prev);
            var f = s.Prev;
            f.Next = s.Next, s.Next.Prev = f, s = f;
          }
        s === s.Prev && (n.Pts = null);
      }, t.Clipper.prototype.FixupOutPolygon = function(n) {
        var s = null;
        n.BottomPt = null;
        for (var o = n.Pts, f = this.PreserveCollinear || this.StrictlySimple; ; ) {
          if (o.Prev === o || o.Prev === o.Next) {
            n.Pts = null;
            return;
          }
          if (t.IntPoint.op_Equality(o.Pt, o.Next.Pt) || t.IntPoint.op_Equality(o.Pt, o.Prev.Pt) || t.ClipperBase.SlopesEqual4(o.Prev.Pt, o.Pt, o.Next.Pt, this.m_UseFullRange) && (!f || !this.Pt2IsBetweenPt1AndPt3(o.Prev.Pt, o.Pt, o.Next.Pt)))
            s = null, o.Prev.Next = o.Next, o.Next.Prev = o.Prev, o = o.Prev;
          else {
            if (o === s)
              break;
            s === null && (s = o), o = o.Next;
          }
        }
        n.Pts = o;
      }, t.Clipper.prototype.DupOutPt = function(n, s) {
        var o = new t.OutPt();
        return o.Pt.X = n.Pt.X, o.Pt.Y = n.Pt.Y, t.use_xyz && (o.Pt.Z = n.Pt.Z), o.Idx = n.Idx, s ? (o.Next = n.Next, o.Prev = n, n.Next.Prev = o, n.Next = o) : (o.Prev = n.Prev, o.Next = n, n.Prev.Next = o, n.Prev = o), o;
      }, t.Clipper.prototype.GetOverlap = function(n, s, o, f, p) {
        return n < s ? o < f ? (p.Left = Math.max(n, o), p.Right = Math.min(s, f)) : (p.Left = Math.max(n, f), p.Right = Math.min(s, o)) : o < f ? (p.Left = Math.max(s, o), p.Right = Math.min(n, f)) : (p.Left = Math.max(s, f), p.Right = Math.min(n, o)), p.Left < p.Right;
      }, t.Clipper.prototype.JoinHorz = function(n, s, o, f, p, C) {
        var T = n.Pt.X > s.Pt.X ? t.Direction.dRightToLeft : t.Direction.dLeftToRight, I = o.Pt.X > f.Pt.X ? t.Direction.dRightToLeft : t.Direction.dLeftToRight;
        if (T === I)
          return !1;
        if (T === t.Direction.dLeftToRight) {
          for (; n.Next.Pt.X <= p.X && n.Next.Pt.X >= n.Pt.X && n.Next.Pt.Y === p.Y; )
            n = n.Next;
          C && n.Pt.X !== p.X && (n = n.Next), s = this.DupOutPt(n, !C), t.IntPoint.op_Inequality(s.Pt, p) && (n = s, n.Pt.X = p.X, n.Pt.Y = p.Y, t.use_xyz && (n.Pt.Z = p.Z), s = this.DupOutPt(n, !C));
        } else {
          for (; n.Next.Pt.X >= p.X && n.Next.Pt.X <= n.Pt.X && n.Next.Pt.Y === p.Y; )
            n = n.Next;
          !C && n.Pt.X !== p.X && (n = n.Next), s = this.DupOutPt(n, C), t.IntPoint.op_Inequality(s.Pt, p) && (n = s, n.Pt.X = p.X, n.Pt.Y = p.Y, t.use_xyz && (n.Pt.Z = p.Z), s = this.DupOutPt(n, C));
        }
        if (I === t.Direction.dLeftToRight) {
          for (; o.Next.Pt.X <= p.X && o.Next.Pt.X >= o.Pt.X && o.Next.Pt.Y === p.Y; )
            o = o.Next;
          C && o.Pt.X !== p.X && (o = o.Next), f = this.DupOutPt(o, !C), t.IntPoint.op_Inequality(f.Pt, p) && (o = f, o.Pt.X = p.X, o.Pt.Y = p.Y, t.use_xyz && (o.Pt.Z = p.Z), f = this.DupOutPt(o, !C));
        } else {
          for (; o.Next.Pt.X >= p.X && o.Next.Pt.X <= o.Pt.X && o.Next.Pt.Y === p.Y; )
            o = o.Next;
          !C && o.Pt.X !== p.X && (o = o.Next), f = this.DupOutPt(o, C), t.IntPoint.op_Inequality(f.Pt, p) && (o = f, o.Pt.X = p.X, o.Pt.Y = p.Y, t.use_xyz && (o.Pt.Z = p.Z), f = this.DupOutPt(o, C));
        }
        return T === t.Direction.dLeftToRight === C ? (n.Prev = o, o.Next = n, s.Next = f, f.Prev = s) : (n.Next = o, o.Prev = n, s.Prev = f, f.Next = s), !0;
      }, t.Clipper.prototype.JoinPoints = function(n, s, o) {
        var f = n.OutPt1, p = new t.OutPt(), C = n.OutPt2, T = new t.OutPt(), I = n.OutPt1.Pt.Y === n.OffPt.Y;
        if (I && t.IntPoint.op_Equality(n.OffPt, n.OutPt1.Pt) && t.IntPoint.op_Equality(n.OffPt, n.OutPt2.Pt)) {
          if (s !== o) return !1;
          for (p = n.OutPt1.Next; p !== f && t.IntPoint.op_Equality(p.Pt, n.OffPt); )
            p = p.Next;
          var O = p.Pt.Y > n.OffPt.Y;
          for (T = n.OutPt2.Next; T !== C && t.IntPoint.op_Equality(T.Pt, n.OffPt); )
            T = T.Next;
          var D = T.Pt.Y > n.OffPt.Y;
          return O === D ? !1 : O ? (p = this.DupOutPt(f, !1), T = this.DupOutPt(C, !0), f.Prev = C, C.Next = f, p.Next = T, T.Prev = p, n.OutPt1 = f, n.OutPt2 = p, !0) : (p = this.DupOutPt(f, !0), T = this.DupOutPt(C, !1), f.Next = C, C.Prev = f, p.Prev = T, T.Next = p, n.OutPt1 = f, n.OutPt2 = p, !0);
        } else if (I) {
          for (p = f; f.Prev.Pt.Y === f.Pt.Y && f.Prev !== p && f.Prev !== C; )
            f = f.Prev;
          for (; p.Next.Pt.Y === p.Pt.Y && p.Next !== f && p.Next !== C; )
            p = p.Next;
          if (p.Next === f || p.Next === C)
            return !1;
          for (T = C; C.Prev.Pt.Y === C.Pt.Y && C.Prev !== T && C.Prev !== p; )
            C = C.Prev;
          for (; T.Next.Pt.Y === T.Pt.Y && T.Next !== C && T.Next !== f; )
            T = T.Next;
          if (T.Next === C || T.Next === f)
            return !1;
          var b = {
            Left: null,
            Right: null
          };
          if (!this.GetOverlap(f.Pt.X, p.Pt.X, C.Pt.X, T.Pt.X, b))
            return !1;
          var B = b.Left, $ = b.Right, G = new t.IntPoint0(), K;
          return f.Pt.X >= B && f.Pt.X <= $ ? (G.X = f.Pt.X, G.Y = f.Pt.Y, t.use_xyz && (G.Z = f.Pt.Z), K = f.Pt.X > p.Pt.X) : C.Pt.X >= B && C.Pt.X <= $ ? (G.X = C.Pt.X, G.Y = C.Pt.Y, t.use_xyz && (G.Z = C.Pt.Z), K = C.Pt.X > T.Pt.X) : p.Pt.X >= B && p.Pt.X <= $ ? (G.X = p.Pt.X, G.Y = p.Pt.Y, t.use_xyz && (G.Z = p.Pt.Z), K = p.Pt.X > f.Pt.X) : (G.X = T.Pt.X, G.Y = T.Pt.Y, t.use_xyz && (G.Z = T.Pt.Z), K = T.Pt.X > C.Pt.X), n.OutPt1 = f, n.OutPt2 = C, this.JoinHorz(f, p, C, T, G, K);
        } else {
          for (p = f.Next; t.IntPoint.op_Equality(p.Pt, f.Pt) && p !== f; )
            p = p.Next;
          var Q = p.Pt.Y > f.Pt.Y || !t.ClipperBase.SlopesEqual4(f.Pt, p.Pt, n.OffPt, this.m_UseFullRange);
          if (Q) {
            for (p = f.Prev; t.IntPoint.op_Equality(p.Pt, f.Pt) && p !== f; )
              p = p.Prev;
            if (p.Pt.Y > f.Pt.Y || !t.ClipperBase.SlopesEqual4(f.Pt, p.Pt, n.OffPt, this.m_UseFullRange))
              return !1;
          }
          for (T = C.Next; t.IntPoint.op_Equality(T.Pt, C.Pt) && T !== C; )
            T = T.Next;
          var st = T.Pt.Y > C.Pt.Y || !t.ClipperBase.SlopesEqual4(C.Pt, T.Pt, n.OffPt, this.m_UseFullRange);
          if (st) {
            for (T = C.Prev; t.IntPoint.op_Equality(T.Pt, C.Pt) && T !== C; )
              T = T.Prev;
            if (T.Pt.Y > C.Pt.Y || !t.ClipperBase.SlopesEqual4(C.Pt, T.Pt, n.OffPt, this.m_UseFullRange))
              return !1;
          }
          return p === f || T === C || p === T || s === o && Q === st ? !1 : Q ? (p = this.DupOutPt(f, !1), T = this.DupOutPt(C, !0), f.Prev = C, C.Next = f, p.Next = T, T.Prev = p, n.OutPt1 = f, n.OutPt2 = p, !0) : (p = this.DupOutPt(f, !0), T = this.DupOutPt(C, !1), f.Next = C, C.Prev = f, p.Prev = T, T.Next = p, n.OutPt1 = f, n.OutPt2 = p, !0);
        }
      }, t.Clipper.GetBounds = function(n) {
        for (var s = 0, o = n.length; s < o && n[s].length === 0; ) s++;
        if (s === o) return new t.IntRect(0, 0, 0, 0);
        var f = new t.IntRect();
        for (f.left = n[s][0].X, f.right = f.left, f.top = n[s][0].Y, f.bottom = f.top; s < o; s++)
          for (var p = 0, C = n[s].length; p < C; p++)
            n[s][p].X < f.left ? f.left = n[s][p].X : n[s][p].X > f.right && (f.right = n[s][p].X), n[s][p].Y < f.top ? f.top = n[s][p].Y : n[s][p].Y > f.bottom && (f.bottom = n[s][p].Y);
        return f;
      }, t.Clipper.prototype.GetBounds2 = function(n) {
        var s = n, o = new t.IntRect();
        for (o.left = n.Pt.X, o.right = n.Pt.X, o.top = n.Pt.Y, o.bottom = n.Pt.Y, n = n.Next; n !== s; )
          n.Pt.X < o.left && (o.left = n.Pt.X), n.Pt.X > o.right && (o.right = n.Pt.X), n.Pt.Y < o.top && (o.top = n.Pt.Y), n.Pt.Y > o.bottom && (o.bottom = n.Pt.Y), n = n.Next;
        return o;
      }, t.Clipper.PointInPolygon = function(n, s) {
        var o = 0, f = s.length;
        if (f < 3)
          return 0;
        for (var p = s[0], C = 1; C <= f; ++C) {
          var T = C === f ? s[0] : s[C];
          if (T.Y === n.Y && (T.X === n.X || p.Y === n.Y && T.X > n.X == p.X < n.X))
            return -1;
          if (p.Y < n.Y != T.Y < n.Y) {
            if (p.X >= n.X)
              if (T.X > n.X)
                o = 1 - o;
              else {
                var I = (p.X - n.X) * (T.Y - n.Y) - (T.X - n.X) * (p.Y - n.Y);
                if (I === 0)
                  return -1;
                I > 0 == T.Y > p.Y && (o = 1 - o);
              }
            else if (T.X > n.X) {
              var I = (p.X - n.X) * (T.Y - n.Y) - (T.X - n.X) * (p.Y - n.Y);
              if (I === 0)
                return -1;
              I > 0 == T.Y > p.Y && (o = 1 - o);
            }
          }
          p = T;
        }
        return o;
      }, t.Clipper.prototype.PointInPolygon = function(n, s) {
        var o = 0, f = s, p = n.X, C = n.Y, T = s.Pt.X, I = s.Pt.Y;
        do {
          s = s.Next;
          var O = s.Pt.X, D = s.Pt.Y;
          if (D === C && (O === p || I === C && O > p == T < p))
            return -1;
          if (I < C != D < C) {
            if (T >= p)
              if (O > p)
                o = 1 - o;
              else {
                var b = (T - p) * (D - C) - (O - p) * (I - C);
                if (b === 0)
                  return -1;
                b > 0 == D > I && (o = 1 - o);
              }
            else if (O > p) {
              var b = (T - p) * (D - C) - (O - p) * (I - C);
              if (b === 0)
                return -1;
              b > 0 == D > I && (o = 1 - o);
            }
          }
          T = O, I = D;
        } while (f !== s);
        return o;
      }, t.Clipper.prototype.Poly2ContainsPoly1 = function(n, s) {
        var o = n;
        do {
          var f = this.PointInPolygon(o.Pt, s);
          if (f >= 0)
            return f > 0;
          o = o.Next;
        } while (o !== n);
        return !0;
      }, t.Clipper.prototype.FixupFirstLefts1 = function(n, s) {
        for (var o, f, p = 0, C = this.m_PolyOuts.length; p < C; p++)
          o = this.m_PolyOuts[p], f = t.Clipper.ParseFirstLeft(o.FirstLeft), o.Pts !== null && f === n && this.Poly2ContainsPoly1(o.Pts, s.Pts) && (o.FirstLeft = s);
      }, t.Clipper.prototype.FixupFirstLefts2 = function(n, s) {
        for (var o = s.FirstLeft, f, p, C = 0, T = this.m_PolyOuts.length; C < T; C++)
          f = this.m_PolyOuts[C], !(f.Pts === null || f === s || f === n) && (p = t.Clipper.ParseFirstLeft(f.FirstLeft), !(p !== o && p !== n && p !== s) && (this.Poly2ContainsPoly1(f.Pts, n.Pts) ? f.FirstLeft = n : this.Poly2ContainsPoly1(f.Pts, s.Pts) ? f.FirstLeft = s : (f.FirstLeft === n || f.FirstLeft === s) && (f.FirstLeft = o)));
      }, t.Clipper.prototype.FixupFirstLefts3 = function(n, s) {
        for (var o, f, p = 0, C = this.m_PolyOuts.length; p < C; p++)
          o = this.m_PolyOuts[p], f = t.Clipper.ParseFirstLeft(o.FirstLeft), o.Pts !== null && f === n && (o.FirstLeft = s);
      }, t.Clipper.ParseFirstLeft = function(n) {
        for (; n !== null && n.Pts === null; )
          n = n.FirstLeft;
        return n;
      }, t.Clipper.prototype.JoinCommonEdges = function() {
        for (var n = 0, s = this.m_Joins.length; n < s; n++) {
          var o = this.m_Joins[n], f = this.GetOutRec(o.OutPt1.Idx), p = this.GetOutRec(o.OutPt2.Idx);
          if (!(f.Pts === null || p.Pts === null) && !(f.IsOpen || p.IsOpen)) {
            var C;
            f === p ? C = f : this.OutRec1RightOfOutRec2(f, p) ? C = p : this.OutRec1RightOfOutRec2(p, f) ? C = f : C = this.GetLowermostRec(f, p), this.JoinPoints(o, f, p) && (f === p ? (f.Pts = o.OutPt1, f.BottomPt = null, p = this.CreateOutRec(), p.Pts = o.OutPt2, this.UpdateOutPtIdxs(p), this.Poly2ContainsPoly1(p.Pts, f.Pts) ? (p.IsHole = !f.IsHole, p.FirstLeft = f, this.m_UsingPolyTree && this.FixupFirstLefts2(p, f), (p.IsHole ^ this.ReverseSolution) == this.Area$1(p) > 0 && this.ReversePolyPtLinks(p.Pts)) : this.Poly2ContainsPoly1(f.Pts, p.Pts) ? (p.IsHole = f.IsHole, f.IsHole = !p.IsHole, p.FirstLeft = f.FirstLeft, f.FirstLeft = p, this.m_UsingPolyTree && this.FixupFirstLefts2(f, p), (f.IsHole ^ this.ReverseSolution) == this.Area$1(f) > 0 && this.ReversePolyPtLinks(f.Pts)) : (p.IsHole = f.IsHole, p.FirstLeft = f.FirstLeft, this.m_UsingPolyTree && this.FixupFirstLefts1(f, p))) : (p.Pts = null, p.BottomPt = null, p.Idx = f.Idx, f.IsHole = C.IsHole, C === p && (f.FirstLeft = p.FirstLeft), p.FirstLeft = f, this.m_UsingPolyTree && this.FixupFirstLefts3(p, f)));
          }
        }
      }, t.Clipper.prototype.UpdateOutPtIdxs = function(n) {
        var s = n.Pts;
        do
          s.Idx = n.Idx, s = s.Prev;
        while (s !== n.Pts);
      }, t.Clipper.prototype.DoSimplePolygons = function() {
        for (var n = 0; n < this.m_PolyOuts.length; ) {
          var s = this.m_PolyOuts[n++], o = s.Pts;
          if (!(o === null || s.IsOpen))
            do {
              for (var f = o.Next; f !== s.Pts; ) {
                if (t.IntPoint.op_Equality(o.Pt, f.Pt) && f.Next !== o && f.Prev !== o) {
                  var p = o.Prev, C = f.Prev;
                  o.Prev = C, C.Next = o, f.Prev = p, p.Next = f, s.Pts = o;
                  var T = this.CreateOutRec();
                  T.Pts = f, this.UpdateOutPtIdxs(T), this.Poly2ContainsPoly1(T.Pts, s.Pts) ? (T.IsHole = !s.IsHole, T.FirstLeft = s, this.m_UsingPolyTree && this.FixupFirstLefts2(T, s)) : this.Poly2ContainsPoly1(s.Pts, T.Pts) ? (T.IsHole = s.IsHole, s.IsHole = !T.IsHole, T.FirstLeft = s.FirstLeft, s.FirstLeft = T, this.m_UsingPolyTree && this.FixupFirstLefts2(s, T)) : (T.IsHole = s.IsHole, T.FirstLeft = s.FirstLeft, this.m_UsingPolyTree && this.FixupFirstLefts1(s, T)), f = o;
                }
                f = f.Next;
              }
              o = o.Next;
            } while (o !== s.Pts);
        }
      }, t.Clipper.Area = function(n) {
        if (!Array.isArray(n))
          return 0;
        var s = n.length;
        if (s < 3)
          return 0;
        for (var o = 0, f = 0, p = s - 1; f < s; ++f)
          o += (n[p].X + n[f].X) * (n[p].Y - n[f].Y), p = f;
        return -o * 0.5;
      }, t.Clipper.prototype.Area = function(n) {
        var s = n;
        if (n === null) return 0;
        var o = 0;
        do
          o = o + (n.Prev.Pt.X + n.Pt.X) * (n.Prev.Pt.Y - n.Pt.Y), n = n.Next;
        while (n !== s);
        return o * 0.5;
      }, t.Clipper.prototype.Area$1 = function(n) {
        return this.Area(n.Pts);
      }, t.Clipper.SimplifyPolygon = function(n, s) {
        var o = new Array(), f = new t.Clipper(0);
        return f.StrictlySimple = !0, f.AddPath(n, t.PolyType.ptSubject, !0), f.Execute(t.ClipType.ctUnion, o, s, s), o;
      }, t.Clipper.SimplifyPolygons = function(n, s) {
        typeof s > "u" && (s = t.PolyFillType.pftEvenOdd);
        var o = new Array(), f = new t.Clipper(0);
        return f.StrictlySimple = !0, f.AddPaths(n, t.PolyType.ptSubject, !0), f.Execute(t.ClipType.ctUnion, o, s, s), o;
      }, t.Clipper.DistanceSqrd = function(n, s) {
        var o = n.X - s.X, f = n.Y - s.Y;
        return o * o + f * f;
      }, t.Clipper.DistanceFromLineSqrd = function(n, s, o) {
        var f = s.Y - o.Y, p = o.X - s.X, C = f * s.X + p * s.Y;
        return C = f * n.X + p * n.Y - C, C * C / (f * f + p * p);
      }, t.Clipper.SlopesNearCollinear = function(n, s, o, f) {
        return Math.abs(n.X - s.X) > Math.abs(n.Y - s.Y) ? n.X > s.X == n.X < o.X ? t.Clipper.DistanceFromLineSqrd(n, s, o) < f : s.X > n.X == s.X < o.X ? t.Clipper.DistanceFromLineSqrd(s, n, o) < f : t.Clipper.DistanceFromLineSqrd(o, n, s) < f : n.Y > s.Y == n.Y < o.Y ? t.Clipper.DistanceFromLineSqrd(n, s, o) < f : s.Y > n.Y == s.Y < o.Y ? t.Clipper.DistanceFromLineSqrd(s, n, o) < f : t.Clipper.DistanceFromLineSqrd(o, n, s) < f;
      }, t.Clipper.PointsAreClose = function(n, s, o) {
        var f = n.X - s.X, p = n.Y - s.Y;
        return f * f + p * p <= o;
      }, t.Clipper.ExcludeOp = function(n) {
        var s = n.Prev;
        return s.Next = n.Next, n.Next.Prev = s, s.Idx = 0, s;
      }, t.Clipper.CleanPolygon = function(n, s) {
        typeof s > "u" && (s = 1.415);
        var o = n.length;
        if (o === 0)
          return new Array();
        for (var f = new Array(o), p = 0; p < o; ++p)
          f[p] = new t.OutPt();
        for (var p = 0; p < o; ++p)
          f[p].Pt = n[p], f[p].Next = f[(p + 1) % o], f[p].Next.Prev = f[p], f[p].Idx = 0;
        for (var C = s * s, T = f[0]; T.Idx === 0 && T.Next !== T.Prev; )
          t.Clipper.PointsAreClose(T.Pt, T.Prev.Pt, C) ? (T = t.Clipper.ExcludeOp(T), o--) : t.Clipper.PointsAreClose(T.Prev.Pt, T.Next.Pt, C) ? (t.Clipper.ExcludeOp(T.Next), T = t.Clipper.ExcludeOp(T), o -= 2) : t.Clipper.SlopesNearCollinear(T.Prev.Pt, T.Pt, T.Next.Pt, C) ? (T = t.Clipper.ExcludeOp(T), o--) : (T.Idx = 1, T = T.Next);
        o < 3 && (o = 0);
        for (var I = new Array(o), p = 0; p < o; ++p)
          I[p] = new t.IntPoint1(T.Pt), T = T.Next;
        return f = null, I;
      }, t.Clipper.CleanPolygons = function(n, s) {
        for (var o = new Array(n.length), f = 0, p = n.length; f < p; f++)
          o[f] = t.Clipper.CleanPolygon(n[f], s);
        return o;
      }, t.Clipper.Minkowski = function(n, s, o, f) {
        var p = f ? 1 : 0, C = n.length, T = s.length, I = new Array();
        if (o)
          for (var O = 0; O < T; O++) {
            for (var D = new Array(C), b = 0, B = n.length, $ = n[b]; b < B; b++, $ = n[b])
              D[b] = new t.IntPoint2(s[O].X + $.X, s[O].Y + $.Y);
            I.push(D);
          }
        else
          for (var O = 0; O < T; O++) {
            for (var D = new Array(C), b = 0, B = n.length, $ = n[b]; b < B; b++, $ = n[b])
              D[b] = new t.IntPoint2(s[O].X - $.X, s[O].Y - $.Y);
            I.push(D);
          }
        for (var G = new Array(), O = 0; O < T - 1 + p; O++)
          for (var b = 0; b < C; b++) {
            var K = new Array();
            K.push(I[O % T][b % C]), K.push(I[(O + 1) % T][b % C]), K.push(I[(O + 1) % T][(b + 1) % C]), K.push(I[O % T][(b + 1) % C]), t.Clipper.Orientation(K) || K.reverse(), G.push(K);
          }
        return G;
      }, t.Clipper.MinkowskiSum = function(n, s, o) {
        if (s[0] instanceof Array) {
          for (var p = s, T = new t.Paths(), C = new t.Clipper(), I = 0; I < p.length; ++I) {
            var O = t.Clipper.Minkowski(n, p[I], !0, o);
            if (C.AddPaths(O, t.PolyType.ptSubject, !0), o) {
              var f = t.Clipper.TranslatePath(p[I], n[0]);
              C.AddPath(f, t.PolyType.ptClip, !0);
            }
          }
          return C.Execute(
            t.ClipType.ctUnion,
            T,
            t.PolyFillType.pftNonZero,
            t.PolyFillType.pftNonZero
          ), T;
        } else {
          var f = s, p = t.Clipper.Minkowski(n, f, !0, o), C = new t.Clipper();
          return C.AddPaths(p, t.PolyType.ptSubject, !0), C.Execute(t.ClipType.ctUnion, p, t.PolyFillType.pftNonZero, t.PolyFillType.pftNonZero), p;
        }
      }, t.Clipper.TranslatePath = function(n, s) {
        for (var o = new t.Path(), f = 0; f < n.length; f++)
          o.push(new t.IntPoint2(n[f].X + s.X, n[f].Y + s.Y));
        return o;
      }, t.Clipper.MinkowskiDiff = function(n, s) {
        var o = t.Clipper.Minkowski(n, s, !1, !0), f = new t.Clipper();
        return f.AddPaths(o, t.PolyType.ptSubject, !0), f.Execute(t.ClipType.ctUnion, o, t.PolyFillType.pftNonZero, t.PolyFillType.pftNonZero), o;
      }, t.Clipper.PolyTreeToPaths = function(n) {
        var s = new Array();
        return t.Clipper.AddPolyNodeToPaths(n, t.Clipper.NodeType.ntAny, s), s;
      }, t.Clipper.AddPolyNodeToPaths = function(n, s, o) {
        var f = !0;
        switch (s) {
          case t.Clipper.NodeType.ntOpen:
            return;
          case t.Clipper.NodeType.ntClosed:
            f = !n.IsOpen;
            break;
        }
        n.m_polygon.length > 0 && f && o.push(n.m_polygon);
        for (var p = 0, C = n.Childs(), T = C.length, I = C[p]; p < T; p++, I = C[p])
          t.Clipper.AddPolyNodeToPaths(I, s, o);
      }, t.Clipper.OpenPathsFromPolyTree = function(n) {
        for (var s = new t.Paths(), o = 0, f = n.ChildCount(); o < f; o++)
          n.Childs()[o].IsOpen && s.push(n.Childs()[o].m_polygon);
        return s;
      }, t.Clipper.ClosedPathsFromPolyTree = function(n) {
        var s = new t.Paths();
        return t.Clipper.AddPolyNodeToPaths(n, t.Clipper.NodeType.ntClosed, s), s;
      }, ti(t.Clipper, t.ClipperBase), t.Clipper.NodeType = {
        ntAny: 0,
        ntOpen: 1,
        ntClosed: 2
      }, t.ClipperOffset = function(n, s) {
        typeof n > "u" && (n = 2), typeof s > "u" && (s = t.ClipperOffset.def_arc_tolerance), this.m_destPolys = new t.Paths(), this.m_srcPoly = new t.Path(), this.m_destPoly = new t.Path(), this.m_normals = new Array(), this.m_delta = 0, this.m_sinA = 0, this.m_sin = 0, this.m_cos = 0, this.m_miterLim = 0, this.m_StepsPerRad = 0, this.m_lowest = new t.IntPoint0(), this.m_polyNodes = new t.PolyNode(), this.MiterLimit = n, this.ArcTolerance = s, this.m_lowest.X = -1;
      }, t.ClipperOffset.two_pi = 6.28318530717959, t.ClipperOffset.def_arc_tolerance = 0.25, t.ClipperOffset.prototype.Clear = function() {
        t.Clear(this.m_polyNodes.Childs()), this.m_lowest.X = -1;
      }, t.ClipperOffset.Round = t.Clipper.Round, t.ClipperOffset.prototype.AddPath = function(n, s, o) {
        var f = n.length - 1;
        if (!(f < 0)) {
          var p = new t.PolyNode();
          if (p.m_jointype = s, p.m_endtype = o, o === t.EndType.etClosedLine || o === t.EndType.etClosedPolygon)
            for (; f > 0 && t.IntPoint.op_Equality(n[0], n[f]); )
              f--;
          p.m_polygon.push(n[0]);
          for (var C = 0, T = 0, I = 1; I <= f; I++)
            t.IntPoint.op_Inequality(p.m_polygon[C], n[I]) && (C++, p.m_polygon.push(n[I]), (n[I].Y > p.m_polygon[T].Y || n[I].Y === p.m_polygon[T].Y && n[I].X < p.m_polygon[T].X) && (T = C));
          if (!(o === t.EndType.etClosedPolygon && C < 2) && (this.m_polyNodes.AddChild(p), o === t.EndType.etClosedPolygon))
            if (this.m_lowest.X < 0)
              this.m_lowest = new t.IntPoint2(this.m_polyNodes.ChildCount() - 1, T);
            else {
              var O = this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];
              (p.m_polygon[T].Y > O.Y || p.m_polygon[T].Y === O.Y && p.m_polygon[T].X < O.X) && (this.m_lowest = new t.IntPoint2(this.m_polyNodes.ChildCount() - 1, T));
            }
        }
      }, t.ClipperOffset.prototype.AddPaths = function(n, s, o) {
        for (var f = 0, p = n.length; f < p; f++)
          this.AddPath(n[f], s, o);
      }, t.ClipperOffset.prototype.FixOrientations = function() {
        if (this.m_lowest.X >= 0 && !t.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))
          for (var n = 0; n < this.m_polyNodes.ChildCount(); n++) {
            var s = this.m_polyNodes.Childs()[n];
            (s.m_endtype === t.EndType.etClosedPolygon || s.m_endtype === t.EndType.etClosedLine && t.Clipper.Orientation(s.m_polygon)) && s.m_polygon.reverse();
          }
        else
          for (var n = 0; n < this.m_polyNodes.ChildCount(); n++) {
            var s = this.m_polyNodes.Childs()[n];
            s.m_endtype === t.EndType.etClosedLine && !t.Clipper.Orientation(s.m_polygon) && s.m_polygon.reverse();
          }
      }, t.ClipperOffset.GetUnitNormal = function(n, s) {
        var o = s.X - n.X, f = s.Y - n.Y;
        if (o === 0 && f === 0)
          return new t.DoublePoint2(0, 0);
        var p = 1 / Math.sqrt(o * o + f * f);
        return o *= p, f *= p, new t.DoublePoint2(f, -o);
      }, t.ClipperOffset.prototype.DoOffset = function(n) {
        if (this.m_destPolys = new Array(), this.m_delta = n, t.ClipperBase.near_zero(n)) {
          for (var s = 0; s < this.m_polyNodes.ChildCount(); s++) {
            var o = this.m_polyNodes.Childs()[s];
            o.m_endtype === t.EndType.etClosedPolygon && this.m_destPolys.push(o.m_polygon);
          }
          return;
        }
        this.MiterLimit > 2 ? this.m_miterLim = 2 / (this.MiterLimit * this.MiterLimit) : this.m_miterLim = 0.5;
        var f;
        this.ArcTolerance <= 0 ? f = t.ClipperOffset.def_arc_tolerance : this.ArcTolerance > Math.abs(n) * t.ClipperOffset.def_arc_tolerance ? f = Math.abs(n) * t.ClipperOffset.def_arc_tolerance : f = this.ArcTolerance;
        var p = 3.14159265358979 / Math.acos(1 - f / Math.abs(n));
        this.m_sin = Math.sin(t.ClipperOffset.two_pi / p), this.m_cos = Math.cos(t.ClipperOffset.two_pi / p), this.m_StepsPerRad = p / t.ClipperOffset.two_pi, n < 0 && (this.m_sin = -this.m_sin);
        for (var s = 0; s < this.m_polyNodes.ChildCount(); s++) {
          var o = this.m_polyNodes.Childs()[s];
          this.m_srcPoly = o.m_polygon;
          var C = this.m_srcPoly.length;
          if (!(C === 0 || n <= 0 && (C < 3 || o.m_endtype !== t.EndType.etClosedPolygon))) {
            if (this.m_destPoly = new Array(), C === 1) {
              if (o.m_jointype === t.JoinType.jtRound)
                for (var T = 1, I = 0, O = 1; O <= p; O++) {
                  this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[0].X + T * n), t.ClipperOffset.Round(this.m_srcPoly[0].Y + I * n)));
                  var D = T;
                  T = T * this.m_cos - this.m_sin * I, I = D * this.m_sin + I * this.m_cos;
                }
              else
                for (var T = -1, I = -1, O = 0; O < 4; ++O)
                  this.m_destPoly.push(new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[0].X + T * n), t.ClipperOffset.Round(this.m_srcPoly[0].Y + I * n))), T < 0 ? T = 1 : I < 0 ? I = 1 : T = -1;
              this.m_destPolys.push(this.m_destPoly);
              continue;
            }
            this.m_normals.length = 0;
            for (var O = 0; O < C - 1; O++)
              this.m_normals.push(t.ClipperOffset.GetUnitNormal(this.m_srcPoly[O], this.m_srcPoly[O + 1]));
            if (o.m_endtype === t.EndType.etClosedLine || o.m_endtype === t.EndType.etClosedPolygon ? this.m_normals.push(t.ClipperOffset.GetUnitNormal(this.m_srcPoly[C - 1], this.m_srcPoly[0])) : this.m_normals.push(new t.DoublePoint1(this.m_normals[C - 2])), o.m_endtype === t.EndType.etClosedPolygon) {
              for (var b = C - 1, O = 0; O < C; O++)
                b = this.OffsetPoint(O, b, o.m_jointype);
              this.m_destPolys.push(this.m_destPoly);
            } else if (o.m_endtype === t.EndType.etClosedLine) {
              for (var b = C - 1, O = 0; O < C; O++)
                b = this.OffsetPoint(O, b, o.m_jointype);
              this.m_destPolys.push(this.m_destPoly), this.m_destPoly = new Array();
              for (var B = this.m_normals[C - 1], O = C - 1; O > 0; O--)
                this.m_normals[O] = new t.DoublePoint2(-this.m_normals[O - 1].X, -this.m_normals[O - 1].Y);
              this.m_normals[0] = new t.DoublePoint2(-B.X, -B.Y), b = 0;
              for (var O = C - 1; O >= 0; O--)
                b = this.OffsetPoint(O, b, o.m_jointype);
              this.m_destPolys.push(this.m_destPoly);
            } else {
              for (var b = 0, O = 1; O < C - 1; ++O)
                b = this.OffsetPoint(O, b, o.m_jointype);
              var $;
              if (o.m_endtype === t.EndType.etOpenButt) {
                var O = C - 1;
                $ = new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[O].X + this.m_normals[O].X * n), t.ClipperOffset.Round(this.m_srcPoly[O].Y + this.m_normals[O].Y * n)), this.m_destPoly.push($), $ = new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[O].X - this.m_normals[O].X * n), t.ClipperOffset.Round(this.m_srcPoly[O].Y - this.m_normals[O].Y * n)), this.m_destPoly.push($);
              } else {
                var O = C - 1;
                b = C - 2, this.m_sinA = 0, this.m_normals[O] = new t.DoublePoint2(-this.m_normals[O].X, -this.m_normals[O].Y), o.m_endtype === t.EndType.etOpenSquare ? this.DoSquare(O, b) : this.DoRound(O, b);
              }
              for (var O = C - 1; O > 0; O--)
                this.m_normals[O] = new t.DoublePoint2(-this.m_normals[O - 1].X, -this.m_normals[O - 1].Y);
              this.m_normals[0] = new t.DoublePoint2(-this.m_normals[1].X, -this.m_normals[1].Y), b = C - 1;
              for (var O = b - 1; O > 0; --O)
                b = this.OffsetPoint(O, b, o.m_jointype);
              o.m_endtype === t.EndType.etOpenButt ? ($ = new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[0].X - this.m_normals[0].X * n), t.ClipperOffset.Round(this.m_srcPoly[0].Y - this.m_normals[0].Y * n)), this.m_destPoly.push($), $ = new t.IntPoint2(t.ClipperOffset.Round(this.m_srcPoly[0].X + this.m_normals[0].X * n), t.ClipperOffset.Round(this.m_srcPoly[0].Y + this.m_normals[0].Y * n)), this.m_destPoly.push($)) : (b = 1, this.m_sinA = 0, o.m_endtype === t.EndType.etOpenSquare ? this.DoSquare(0, 1) : this.DoRound(0, 1)), this.m_destPolys.push(this.m_destPoly);
            }
          }
        }
      }, t.ClipperOffset.prototype.Execute = function() {
        var n = arguments, s = n[0] instanceof t.PolyTree;
        if (s) {
          var o = n[0], f = n[1];
          o.Clear(), this.FixOrientations(), this.DoOffset(f);
          var p = new t.Clipper(0);
          if (p.AddPaths(this.m_destPolys, t.PolyType.ptSubject, !0), f > 0)
            p.Execute(t.ClipType.ctUnion, o, t.PolyFillType.pftPositive, t.PolyFillType.pftPositive);
          else {
            var C = t.Clipper.GetBounds(this.m_destPolys), T = new t.Path();
            if (T.push(new t.IntPoint2(C.left - 10, C.bottom + 10)), T.push(new t.IntPoint2(C.right + 10, C.bottom + 10)), T.push(new t.IntPoint2(C.right + 10, C.top - 10)), T.push(new t.IntPoint2(C.left - 10, C.top - 10)), p.AddPath(T, t.PolyType.ptSubject, !0), p.ReverseSolution = !0, p.Execute(t.ClipType.ctUnion, o, t.PolyFillType.pftNegative, t.PolyFillType.pftNegative), o.ChildCount() === 1 && o.Childs()[0].ChildCount() > 0) {
              var I = o.Childs()[0];
              o.Childs()[0] = I.Childs()[0], o.Childs()[0].m_Parent = o;
              for (var O = 1; O < I.ChildCount(); O++)
                o.AddChild(I.Childs()[O]);
            } else
              o.Clear();
          }
        } else {
          var o = n[0], f = n[1];
          t.Clear(o), this.FixOrientations(), this.DoOffset(f);
          var p = new t.Clipper(0);
          if (p.AddPaths(this.m_destPolys, t.PolyType.ptSubject, !0), f > 0)
            p.Execute(t.ClipType.ctUnion, o, t.PolyFillType.pftPositive, t.PolyFillType.pftPositive);
          else {
            var C = t.Clipper.GetBounds(this.m_destPolys), T = new t.Path();
            T.push(new t.IntPoint2(C.left - 10, C.bottom + 10)), T.push(new t.IntPoint2(C.right + 10, C.bottom + 10)), T.push(new t.IntPoint2(C.right + 10, C.top - 10)), T.push(new t.IntPoint2(C.left - 10, C.top - 10)), p.AddPath(T, t.PolyType.ptSubject, !0), p.ReverseSolution = !0, p.Execute(t.ClipType.ctUnion, o, t.PolyFillType.pftNegative, t.PolyFillType.pftNegative), o.length > 0 && o.splice(0, 1);
          }
        }
      }, t.ClipperOffset.prototype.OffsetPoint = function(n, s, o) {
        if (this.m_sinA = this.m_normals[s].X * this.m_normals[n].Y - this.m_normals[n].X * this.m_normals[s].Y, Math.abs(this.m_sinA * this.m_delta) < 1) {
          var f = this.m_normals[s].X * this.m_normals[n].X + this.m_normals[n].Y * this.m_normals[s].Y;
          if (f > 0)
            return this.m_destPoly.push(new t.IntPoint2(
              t.ClipperOffset.Round(this.m_srcPoly[n].X + this.m_normals[s].X * this.m_delta),
              t.ClipperOffset.Round(this.m_srcPoly[n].Y + this.m_normals[s].Y * this.m_delta)
            )), s;
        } else this.m_sinA > 1 ? this.m_sinA = 1 : this.m_sinA < -1 && (this.m_sinA = -1);
        if (this.m_sinA * this.m_delta < 0)
          this.m_destPoly.push(new t.IntPoint2(
            t.ClipperOffset.Round(this.m_srcPoly[n].X + this.m_normals[s].X * this.m_delta),
            t.ClipperOffset.Round(this.m_srcPoly[n].Y + this.m_normals[s].Y * this.m_delta)
          )), this.m_destPoly.push(new t.IntPoint1(this.m_srcPoly[n])), this.m_destPoly.push(new t.IntPoint2(
            t.ClipperOffset.Round(this.m_srcPoly[n].X + this.m_normals[n].X * this.m_delta),
            t.ClipperOffset.Round(this.m_srcPoly[n].Y + this.m_normals[n].Y * this.m_delta)
          ));
        else
          switch (o) {
            case t.JoinType.jtMiter: {
              var p = 1 + (this.m_normals[n].X * this.m_normals[s].X + this.m_normals[n].Y * this.m_normals[s].Y);
              p >= this.m_miterLim ? this.DoMiter(n, s, p) : this.DoSquare(n, s);
              break;
            }
            case t.JoinType.jtSquare:
              this.DoSquare(n, s);
              break;
            case t.JoinType.jtRound:
              this.DoRound(n, s);
              break;
          }
        return s = n, s;
      }, t.ClipperOffset.prototype.DoSquare = function(n, s) {
        var o = Math.tan(Math.atan2(
          this.m_sinA,
          this.m_normals[s].X * this.m_normals[n].X + this.m_normals[s].Y * this.m_normals[n].Y
        ) / 4);
        this.m_destPoly.push(new t.IntPoint2(
          t.ClipperOffset.Round(this.m_srcPoly[n].X + this.m_delta * (this.m_normals[s].X - this.m_normals[s].Y * o)),
          t.ClipperOffset.Round(this.m_srcPoly[n].Y + this.m_delta * (this.m_normals[s].Y + this.m_normals[s].X * o))
        )), this.m_destPoly.push(new t.IntPoint2(
          t.ClipperOffset.Round(this.m_srcPoly[n].X + this.m_delta * (this.m_normals[n].X + this.m_normals[n].Y * o)),
          t.ClipperOffset.Round(this.m_srcPoly[n].Y + this.m_delta * (this.m_normals[n].Y - this.m_normals[n].X * o))
        ));
      }, t.ClipperOffset.prototype.DoMiter = function(n, s, o) {
        var f = this.m_delta / o;
        this.m_destPoly.push(new t.IntPoint2(
          t.ClipperOffset.Round(this.m_srcPoly[n].X + (this.m_normals[s].X + this.m_normals[n].X) * f),
          t.ClipperOffset.Round(this.m_srcPoly[n].Y + (this.m_normals[s].Y + this.m_normals[n].Y) * f)
        ));
      }, t.ClipperOffset.prototype.DoRound = function(n, s) {
        for (var o = Math.atan2(
          this.m_sinA,
          this.m_normals[s].X * this.m_normals[n].X + this.m_normals[s].Y * this.m_normals[n].Y
        ), f = Math.max(t.Cast_Int32(t.ClipperOffset.Round(this.m_StepsPerRad * Math.abs(o))), 1), p = this.m_normals[s].X, C = this.m_normals[s].Y, T, I = 0; I < f; ++I)
          this.m_destPoly.push(new t.IntPoint2(
            t.ClipperOffset.Round(this.m_srcPoly[n].X + p * this.m_delta),
            t.ClipperOffset.Round(this.m_srcPoly[n].Y + C * this.m_delta)
          )), T = p, p = p * this.m_cos - this.m_sin * C, C = T * this.m_sin + C * this.m_cos;
        this.m_destPoly.push(new t.IntPoint2(
          t.ClipperOffset.Round(this.m_srcPoly[n].X + this.m_normals[n].X * this.m_delta),
          t.ClipperOffset.Round(this.m_srcPoly[n].Y + this.m_normals[n].Y * this.m_delta)
        ));
      }, t.Error = function(n) {
        try {
          throw new Error(n);
        } catch (s) {
          alert(s.message);
        }
      }, t.JS = {}, t.JS.AreaOfPolygon = function(n, s) {
        return s || (s = 1), t.Clipper.Area(n) / (s * s);
      }, t.JS.AreaOfPolygons = function(n, s) {
        s || (s = 1);
        for (var o = 0, f = 0; f < n.length; f++)
          o += t.Clipper.Area(n[f]);
        return o / (s * s);
      }, t.JS.BoundsOfPath = function(n, s) {
        return t.JS.BoundsOfPaths([n], s);
      }, t.JS.BoundsOfPaths = function(n, s) {
        s || (s = 1);
        var o = t.Clipper.GetBounds(n);
        return o.left /= s, o.bottom /= s, o.right /= s, o.top /= s, o;
      }, t.JS.Clean = function(f, s) {
        if (!(f instanceof Array)) return [];
        var o = f[0] instanceof Array, f = t.JS.Clone(f);
        if (typeof s != "number" || s === null)
          return t.Error("Delta is not a number in Clean()."), f;
        if (f.length === 0 || f.length === 1 && f[0].length === 0 || s < 0) return f;
        o || (f = [f]);
        for (var p = f.length, C, T, I, O, D, b, B, $ = [], G = 0; G < p; G++)
          if (T = f[G], C = T.length, C !== 0) {
            if (C < 3) {
              I = T, $.push(I);
              continue;
            }
            for (I = T, O = s * s, D = T[0], b = 1, B = 1; B < C; B++)
              (T[B].X - D.X) * (T[B].X - D.X) + (T[B].Y - D.Y) * (T[B].Y - D.Y) <= O || (I[b] = T[B], D = T[B], b++);
            D = T[b - 1], (T[0].X - D.X) * (T[0].X - D.X) + (T[0].Y - D.Y) * (T[0].Y - D.Y) <= O && b--, b < C && I.splice(b, C - b), I.length && $.push(I);
          }
        return !o && $.length ? $ = $[0] : !o && $.length === 0 ? $ = [] : o && $.length === 0 && ($ = [
          []
        ]), $;
      }, t.JS.Clone = function(n) {
        if (!(n instanceof Array)) return [];
        if (n.length === 0) return [];
        if (n.length === 1 && n[0].length === 0) return [
          []
        ];
        var s = n[0] instanceof Array;
        s || (n = [n]);
        var o = n.length, f, p, C, T, I = new Array(o);
        for (p = 0; p < o; p++) {
          for (f = n[p].length, T = new Array(f), C = 0; C < f; C++)
            T[C] = {
              X: n[p][C].X,
              Y: n[p][C].Y
            };
          I[p] = T;
        }
        return s || (I = I[0]), I;
      }, t.JS.Lighten = function(n, s) {
        if (!(n instanceof Array)) return [];
        if (typeof s != "number" || s === null)
          return t.Error("Tolerance is not a number in Lighten()."), t.JS.Clone(n);
        if (n.length === 0 || n.length === 1 && n[0].length === 0 || s < 0)
          return t.JS.Clone(n);
        var o = n[0] instanceof Array;
        o || (n = [n]);
        var f, p, C, T, I, O, D, b, B, $, G, K, Q, st, Lt, Gt, De, Mo = n.length, Do = s * s, Ae = [];
        for (f = 0; f < Mo; f++)
          if (C = n[f], O = C.length, O !== 0) {
            for (T = 0; T < 1e6; T++) {
              for (I = [], O = C.length, C[O - 1].X !== C[0].X || C[O - 1].Y !== C[0].Y ? (K = 1, C.push(
                {
                  X: C[0].X,
                  Y: C[0].Y
                }
              ), O = C.length) : K = 0, G = [], p = 0; p < O - 2; p++)
                D = C[p], B = C[p + 1], b = C[p + 2], Gt = D.X, De = D.Y, Q = b.X - Gt, st = b.Y - De, (Q !== 0 || st !== 0) && (Lt = ((B.X - Gt) * Q + (B.Y - De) * st) / (Q * Q + st * st), Lt > 1 ? (Gt = b.X, De = b.Y) : Lt > 0 && (Gt += Q * Lt, De += st * Lt)), Q = B.X - Gt, st = B.Y - De, $ = Q * Q + st * st, $ <= Do && (G[p + 1] = 1, p++);
              for (I.push(
                {
                  X: C[0].X,
                  Y: C[0].Y
                }
              ), p = 1; p < O - 1; p++)
                G[p] || I.push(
                  {
                    X: C[p].X,
                    Y: C[p].Y
                  }
                );
              if (I.push(
                {
                  X: C[O - 1].X,
                  Y: C[O - 1].Y
                }
              ), K && C.pop(), G.length) C = I;
              else break;
            }
            O = I.length, I[O - 1].X === I[0].X && I[O - 1].Y === I[0].Y && I.pop(), I.length > 2 && Ae.push(I);
          }
        return o || (Ae = Ae[0]), typeof Ae > "u" && (Ae = []), Ae;
      }, t.JS.PerimeterOfPath = function(n, s, o) {
        if (typeof n > "u") return 0;
        var f = Math.sqrt, p = 0, C, T, I = 0, O = 0, D = 0, b = 0, B = n.length;
        if (B < 2) return 0;
        for (s && (n[B] = n[0], B++); --B; )
          C = n[B], I = C.X, O = C.Y, T = n[B - 1], D = T.X, b = T.Y, p += f((I - D) * (I - D) + (O - b) * (O - b));
        return s && n.pop(), p / o;
      }, t.JS.PerimeterOfPaths = function(n, s, o) {
        o || (o = 1);
        for (var f = 0, p = 0; p < n.length; p++)
          f += t.JS.PerimeterOfPath(n[p], s, o);
        return f;
      }, t.JS.ScaleDownPath = function(n, s) {
        var o, f;
        for (s || (s = 1), o = n.length; o--; )
          f = n[o], f.X = f.X / s, f.Y = f.Y / s;
      }, t.JS.ScaleDownPaths = function(n, s) {
        var o, f, p;
        for (s || (s = 1), o = n.length; o--; )
          for (f = n[o].length; f--; )
            p = n[o][f], p.X = p.X / s, p.Y = p.Y / s;
      }, t.JS.ScaleUpPath = function(n, s) {
        var o, f, p = Math.round;
        for (s || (s = 1), o = n.length; o--; )
          f = n[o], f.X = p(f.X * s), f.Y = p(f.Y * s);
      }, t.JS.ScaleUpPaths = function(n, s) {
        var o, f, p, C = Math.round;
        for (s || (s = 1), o = n.length; o--; )
          for (f = n[o].length; f--; )
            p = n[o][f], p.X = C(p.X * s), p.Y = C(p.Y * s);
      }, t.ExPolygons = function() {
        return [];
      }, t.ExPolygon = function() {
        this.outer = null, this.holes = null;
      }, t.JS.AddOuterPolyNodeToExPolygons = function(n, s) {
        var o = new t.ExPolygon();
        o.outer = n.Contour();
        var f = n.Childs(), p = f.length;
        o.holes = new Array(p);
        var C, T, I, O, D, b;
        for (I = 0; I < p; I++)
          for (C = f[I], o.holes[I] = C.Contour(), O = 0, D = C.Childs(), b = D.length; O < b; O++)
            T = D[O], t.JS.AddOuterPolyNodeToExPolygons(T, s);
        s.push(o);
      }, t.JS.ExPolygonsToPaths = function(n) {
        var s, o, f, p, C = new t.Paths();
        for (s = 0, f = n.length; s < f; s++)
          for (C.push(n[s].outer), o = 0, p = n[s].holes.length; o < p; o++)
            C.push(n[s].holes[o]);
        return C;
      }, t.JS.PolyTreeToExPolygons = function(n) {
        var s = new t.ExPolygons(), o, f, p, C;
        for (f = 0, p = n.Childs(), C = p.length; f < C; f++)
          o = p[f], t.JS.AddOuterPolyNodeToExPolygons(o, s);
        return s;
      };
    })();
  })(Ra);
  var $0 = Ra.exports;
  Object.defineProperty(ze, "__esModule", {
    value: !0
  });
  ze.setErrorCallback = void 0;
  var V0 = /* @__PURE__ */ function() {
    function e(t, r) {
      for (var i = 0; i < r.length; i++) {
        var a = r[i];
        a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object.defineProperty(t, a.key, a);
      }
    }
    return function(t, r, i) {
      return r && e(t.prototype, r), i && e(t, i), t;
    };
  }(), W0 = $0, it = z0(W0);
  function z0(e) {
    return e && e.__esModule ? e : { default: e };
  }
  function Li(e) {
    if (Array.isArray(e)) {
      for (var t = 0, r = Array(e.length); t < e.length; t++)
        r[t] = e[t];
      return r;
    } else
      return Array.from(e);
  }
  function j0(e, t) {
    if (!(e instanceof t))
      throw new TypeError("Cannot call a class as a function");
  }
  var vr = void 0;
  ze.setErrorCallback = function(t) {
    vr = t;
  };
  it.default.Error = function(e) {
    vr && vr(e);
  };
  var gn = new it.default.Clipper(), Qe = new it.default.ClipperOffset(), G0 = function() {
    function e() {
      var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, l = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !1;
      j0(this, e), this.paths = t, i && (this.paths = this.paths.map(q0)), a && (this.paths = this.paths.map(wi)), l && (this.paths = this.paths.map(Ni)), this.closed = r;
    }
    return V0(e, [{
      key: "_clip",
      value: function(r) {
        var i = new it.default.PolyTree();
        gn.Clear(), gn.AddPaths(this.paths, it.default.PolyType.ptSubject, this.closed);
        for (var a = arguments.length, l = Array(a > 1 ? a - 1 : 0), u = 1; u < a; u++)
          l[u - 1] = arguments[u];
        for (var c = 0; c < l.length; c++) {
          var h = l[c];
          gn.AddPaths(h.paths, it.default.PolyType.ptClip, h.closed);
        }
        gn.Execute(r, i);
        var y = it.default.Clipper.PolyTreeToPaths(i);
        return new e(y, this.closed);
      }
    }, {
      key: "union",
      value: function() {
        for (var r = arguments.length, i = Array(r), a = 0; a < r; a++)
          i[a] = arguments[a];
        return this._clip.apply(this, [it.default.ClipType.ctUnion].concat(i));
      }
    }, {
      key: "difference",
      value: function() {
        for (var r = arguments.length, i = Array(r), a = 0; a < r; a++)
          i[a] = arguments[a];
        return this._clip.apply(this, [it.default.ClipType.ctDifference].concat(i));
      }
    }, {
      key: "intersect",
      value: function() {
        for (var r = arguments.length, i = Array(r), a = 0; a < r; a++)
          i[a] = arguments[a];
        return this._clip.apply(this, [it.default.ClipType.ctIntersection].concat(i));
      }
    }, {
      key: "xor",
      value: function() {
        for (var r = arguments.length, i = Array(r), a = 0; a < r; a++)
          i[a] = arguments[a];
        return this._clip.apply(this, [it.default.ClipType.ctXor].concat(i));
      }
    }, {
      key: "offset",
      value: function(r) {
        var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = i.jointType, l = a === void 0 ? "jtSquare" : a, u = i.endType, c = u === void 0 ? "etClosedPolygon" : u, h = i.miterLimit, y = h === void 0 ? 2 : h, v = i.roundPrecision, d = v === void 0 ? 0.25 : v;
        Qe.Clear(), Qe.ArcTolerance = d, Qe.MiterLimit = y;
        var g = new it.default.Paths();
        return Qe.AddPaths(this.paths, it.default.JoinType[l], it.default.EndType[c]), Qe.Execute(g, r), new e(g, !0);
      }
    }, {
      key: "scaleUp",
      value: function(r) {
        return it.default.JS.ScaleUpPaths(this.paths, r), this;
      }
    }, {
      key: "scaleDown",
      value: function(r) {
        return it.default.JS.ScaleDownPaths(this.paths, r), this;
      }
    }, {
      key: "firstPoint",
      value: function() {
        var r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
        if (this.paths.length !== 0) {
          var i = this.paths[0], a = i[0];
          return r ? mr(a) : a;
        }
      }
    }, {
      key: "lastPoint",
      value: function() {
        var r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1;
        if (this.paths.length !== 0) {
          var i = this.paths[this.paths.length - 1], a = this.closed ? i[0] : i[i.length - 1];
          return r ? mr(a) : a;
        }
      }
    }, {
      key: "areas",
      value: function() {
        var r = this, i = this.paths.map(function(a, l) {
          return r.area(l);
        });
        return i;
      }
    }, {
      key: "area",
      value: function(r) {
        var i = this.paths[r], a = it.default.Clipper.Area(i);
        return a;
      }
    }, {
      key: "totalArea",
      value: function() {
        return this.areas().reduce(function(r, i) {
          return r + i;
        }, 0);
      }
    }, {
      key: "perimeter",
      value: function(r) {
        var i = this.paths[r], a = it.default.JS.PerimeterOfPath(i, this.closed, 1);
        return a;
      }
    }, {
      key: "perimeters",
      value: function() {
        var r = this;
        return this.paths.map(function(i) {
          return it.default.JS.PerimeterOfPath(i, r.closed, 1);
        });
      }
    }, {
      key: "totalPerimeter",
      value: function() {
        var r = it.default.JS.PerimeterOfPaths(this.paths, this.closed);
        return r;
      }
    }, {
      key: "reverse",
      value: function() {
        return it.default.Clipper.ReversePaths(this.paths), this;
      }
    }, {
      key: "thresholdArea",
      value: function(r) {
        for (var i = [].concat(Li(this.paths)), a = 0; a < i.length; a++) {
          var l = i[a], u = Math.abs(it.default.Clipper.Area(l));
          if (u < r) {
            var c = this.paths.indexOf(l);
            this.paths.splice(c, 1);
          }
        }
        return this;
      }
    }, {
      key: "join",
      value: function(r) {
        var i;
        return (i = this.paths).splice.apply(i, [this.paths.length, 0].concat(Li(r.paths))), this;
      }
    }, {
      key: "clone",
      value: function() {
        return new e(it.default.JS.Clone(this.paths), this.closed);
      }
    }, {
      key: "shapeBounds",
      value: function() {
        return it.default.JS.BoundsOfPaths(this.paths);
      }
    }, {
      key: "pathBounds",
      value: function(r) {
        var i = this.paths[r];
        return it.default.JS.BoundsOfPath(i);
      }
    }, {
      key: "clean",
      value: function(r) {
        return new e(it.default.Clipper.CleanPolygons(this.paths, r), this.closed);
      }
    }, {
      key: "orientation",
      value: function(r) {
        var i = this.paths[r];
        return it.default.Clipper.Orientation(i);
      }
    }, {
      key: "pointInShape",
      value: function(r) {
        var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
        i && (r = dr(r)), a && (r = Cr(r));
        for (var l = 0; l < this.paths.length; l++) {
          var u = this.pointInPath(l, r), c = this.orientation(l);
          if (!u && c || u && !c)
            return !1;
        }
        return !0;
      }
    }, {
      key: "pointInPath",
      value: function(r, i) {
        var a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, l = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1;
        a && (i = dr(i)), l && (i = Cr(i));
        var u = this.paths[r], c = { X: Math.round(i.X), Y: Math.round(i.Y) };
        return it.default.Clipper.PointInPolygon(c, u) > 0;
      }
    }, {
      key: "fixOrientation",
      value: function() {
        return this.closed ? (this.totalArea() < 0 && this.reverse(), this) : this;
      }
    }, {
      key: "simplify",
      value: function(r) {
        if (this.closed) {
          var i = it.default.Clipper.SimplifyPolygons(this.paths, it.default.PolyFillType[r]);
          return new e(i, !0);
        } else
          return this;
      }
    }, {
      key: "separateShapes",
      value: function() {
        var r = [];
        if (this.closed) {
          for (var y = /* @__PURE__ */ new WeakMap(), v = [], d = [], g = 0; g < this.paths.length; g++) {
            var m = this.paths[g], P = this.orientation(g);
            if (P) {
              var x = this.area(g);
              y.set(m, x), v.push(m);
            } else
              d.push(m);
          }
          v.sort(function(U, R) {
            return y.get(U) - y.get(R);
          });
          var S = !0, L = !1, N = void 0;
          try {
            for (var M = v[Symbol.iterator](), E; !(S = (E = M.next()).done); S = !0) {
              for (var w = E.value, A = [w], X = this.paths.indexOf(w), _ = [].concat(d), k = 0; k < _.length; k++) {
                var Y = _[k], F = this.pointInPath(X, Y[0]);
                if (F) {
                  A.push(Y);
                  var W = d.indexOf(Y);
                  d.splice(W, 1);
                }
              }
              r.push(new e(A, !0));
            }
          } catch (U) {
            L = !0, N = U;
          } finally {
            try {
              !S && M.return && M.return();
            } finally {
              if (L)
                throw N;
            }
          }
        } else {
          var i = !0, a = !1, l = void 0;
          try {
            for (var u = this.paths[Symbol.iterator](), c; !(i = (c = u.next()).done); i = !0) {
              var h = c.value;
              r.push(new e([h], !1));
            }
          } catch (U) {
            a = !0, l = U;
          } finally {
            try {
              !i && u.return && u.return();
            } finally {
              if (a)
                throw l;
            }
          }
        }
        return r;
      }
    }, {
      key: "round",
      value: function() {
        return new e(this.paths.map(wi), this.closed);
      }
    }, {
      key: "removeDuplicates",
      value: function() {
        return new e(this.paths.map(Ni), this.closed);
      }
    }, {
      key: "mapToLower",
      value: function() {
        return this.paths.map(H0);
      }
    }]), e;
  }(), Z0 = ze.default = G0;
  function H0(e) {
    return e.map(mr);
  }
  function mr(e) {
    var t = e.X, r = e.Y;
    return { x: t, y: r };
  }
  function q0(e) {
    return e.map(dr);
  }
  function dr(e) {
    var t = e.x, r = e.y;
    return { X: t, Y: r };
  }
  function wi(e) {
    return e.map(Cr);
  }
  function Cr(e) {
    var t = e.X, r = e.Y;
    return { X: Math.round(t), Y: Math.round(r) };
  }
  function Ni(e) {
    return e.filter(J0);
  }
  function J0(e, t, r) {
    if (t === 0) return !0;
    var i = r[t - 1];
    return !(e.X === i.X && e.Y === i.Y);
  }
  const Mt = {
    CLAMP: 0,
    REPEAT: 1,
    MIRROR: 2
  }, ft = {
    NEAREST: 0,
    LINEAR: 1,
    CUBIC: 2
  };
  var Ua = {
    ImageBorderMode: Mt,
    InterpolationMode: ft
  };
  const $a = {
    pointer: null,
    extent: [0, -1, 0, -1, 0, -1],
    increments: [0, 0, 0],
    scalarType: null,
    // dataType
    dataTypeSize: 1,
    // BYTES_PER_ELEMENT
    numberOfComponents: 1,
    borderMode: Mt.CLAMP,
    interpolationMode: ft.LINEAR,
    extraInfo: null
  }, K0 = {
    ...$a,
    positions: [0, 0, 0],
    weights: null,
    weightExtent: [0, -1, 0, -1, 0, -1],
    kernelSize: [1, 1, 1],
    workspace: null,
    lastY: null,
    lastZ: null
  };
  function ke(e) {
    const t = Math.floor(e);
    return {
      floored: t,
      error: e - t
    };
  }
  function $e(e) {
    return Math.round(e);
  }
  function Rt(e, t, r) {
    let i = e <= r ? e : r;
    return i -= t, i = i >= 0 ? i : 0, i;
  }
  function Zt(e, t, r) {
    const i = r - t + 1;
    let a = e - t;
    return a %= i, a = a >= 0 ? a : a + i, a;
  }
  function Ht(e, t, r) {
    const i = r - t, a = i === 0 ? 1 : 0, l = 2 * i + a;
    let u = e - t;
    return u = u >= 0 ? u : -u, u %= l, u = u <= i ? u : l - u, u;
  }
  const {
    ImageBorderMode: Q0
  } = Ua;
  function th(e, t) {
    t.classHierarchy.push("vtkAbstractImageInterpolator"), e.initialize = (r) => {
      e.releaseData(), t.scalars = r.getPointData().getScalars(), t.spacing = r.getSpacing(), t.origin = r.getOrigin(), t.extent = r.getExtent(), e.update();
    }, e.releaseData = () => {
      t.scalars = null;
    }, e.update = () => {
      if (!t.scalars) {
        t.interpolationInfo.pointer = null, t.interpolationInfo.numberOfComponents = 1;
        return;
      }
      t.interpolationInfo.extent = t.extent.slice();
      const r = e.computeSupportSize(null), i = Math.max(Math.max(r[0], r[1]), r[2]), a = Number.MIN_SAFE_INTEGER + i / 2, l = Number.MAX_SAFE_INTEGER - i / 2;
      for (let g = 0; g < 3; ++g) {
        const m = Math.max(0.5 * (t.extent[2 * g] === t.extent[2 * g + 1]), t.tolerance);
        t.structuredBounds[2 * g] = Math.max(t.extent[2 * g] - m, a), t.structuredBounds[2 * g + 1] = Math.min(t.extent[2 * g + 1] + m, l);
      }
      const u = t.extent[1] - t.extent[0] + 1, c = t.extent[3] - t.extent[2] + 1, h = t.scalars.getNumberOfComponents();
      t.interpolationInfo.increments[0] = h, t.interpolationInfo.increments[1] = t.interpolationInfo.increments[0] * u, t.interpolationInfo.increments[2] = t.interpolationInfo.increments[1] * c;
      let y = t.componentOffset;
      y = y > 0 ? y : 0, y = y < h ? y : h - 1;
      const v = 1, d = t.scalars.getData();
      t.interpolationInfo.pointer = d.subarray(y * v), t.interpolationInfo.scalarType = t.scalars.dataType, t.interpolationInfo.dataTypeSize = 1, t.interpolationInfo.numberOfComponents = e.computeNumberOfComponents(h), t.interpolationInfo.borderMode = t.borderMode, e.internalUpdate();
    }, e.internalUpdate = () => {
    }, e.interpolateXYZ = (r, i, a, l) => {
      let u = t.outValue;
      const c = [r, i, a], h = [(c[0] - t.origin[0]) / t.spacing[0], (c[1] - t.origin[1]) / t.spacing[1], (c[2] - t.origin[2]) / t.spacing[2]];
      if (e.checkBoundsIJK(h)) {
        const y = {
          ...t.interpolationInfo
        }, v = y.increments[0] - t.componentOffset, d = 1;
        let g = l > 0 ? l : 0;
        g = g < v ? g : v - 1, y.pointer = t.interpolationInfo.pointer.subarray(d * g), y.numberOfComponents = 1;
        const m = [u];
        e.interpolatePoint(y, h, m), u = m[0];
      }
      return u;
    }, e.interpolate = (r, i) => {
      const a = [(r[0] - t.origin[0]) / t.spacing[0], (r[1] - t.origin[1]) / t.spacing[1], (r[2] - t.origin[2]) / t.spacing[2]];
      if (e.checkBoundsIJK(a))
        return e.interpolatePoint(t.interpolationInfo, a, i), !0;
      for (let l = 0; l < t.interpolationInfo.numberOfComponents; ++l)
        i[l] = t.outValue;
      return !1;
    }, e.computeNumberOfComponents = (r) => {
      const i = Math.min(Math.max(t.componentOffset, 0), r - 1), a = t.componentCount < r - i ? t.componentCount : r - i;
      return a > 0 ? a : r - i;
    }, e.getNumberOfComponents = () => t.interpolationInfo.numberOfComponents, e.interpolateIJK = (r, i) => {
      e.interpolatePoint(t.interpolationInfo, r, i);
    }, e.checkBoundsIJK = (r) => !(r[0] < t.structuredBounds[0] || r[0] > t.structuredBounds[1] || r[1] < t.structuredBounds[2] || r[1] > t.structuredBounds[3] || r[2] < t.structuredBounds[4] || r[2] > t.structuredBounds[5]), e.computeSupportSize = null, e.isSeparable = null, e.precomputeWeightsForExtent = (r, i, a) => {
    }, e.FreePrecomputedWeights = (r) => {
    }, e.interpolatePoint = (r, i, a) => {
    }, e.interpolateRow = (r, i, a, l, u, c) => {
    };
  }
  const eh = {
    outValue: 0,
    tolerance: Number.EPSILON,
    componentOffset: 0,
    componentCount: -1,
    borderMode: Q0.CLAMP,
    slidingWindow: !1,
    scalars: null,
    interpolationInfo: {
      ...$a
    },
    interpolationFunc: null,
    rowInterpolationFunc: null,
    structuredBounds: [0, -1, 0, -1, 0, -1],
    spacing: null,
    origin: null,
    extent: null
  };
  function Va(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, eh, r), V.obj(e, t), V.setGet(e, t, ["outValue", "tolerance", "componentOffset", "componentCount", "borderMode", "slidingWindow"]), V.get(e, t, ["origin", "spacing"]), th(e, t);
  }
  const nh = V.newInstance(Va, "vtkAbstractImageInterpolator");
  var rh = {
    newInstance: nh,
    extend: Va,
    ...Ua
  };
  function ih(e, t) {
    t.classHierarchy.push("vtkImageInterpolator"), e.computeSupportSize = (r) => {
      let i = 1;
      t.interpolationMode === ft.LINEAR ? i = 2 : t.interpolationMode === ft.CUBIC && (i = 4);
      const a = [i, i, i];
      if (r == null || r[12] !== 0 || r[13] !== 0 || r[14] !== 0 || r[15] !== 1)
        return a;
      for (let l = 0; l < 3; ++l) {
        let u = !0;
        for (let c = 0; c < 3; ++c)
          u = u && Number.isInteger(r[4 * l + c]);
        u && (a[l] = 1);
      }
      return a;
    }, e.internalUpdate = () => {
      t.interpolationInfo.interpolationMode = t.interpolationMode;
    }, e.isSeparable = () => !0, e.interpolateNearest = (r, i, a) => {
      const l = r.extent, u = r.increments, c = r.numberOfComponents;
      let h = $e(i[0]), y = $e(i[1]), v = $e(i[2]);
      switch (r.borderMode) {
        case Mt.REPEAT:
          h = Zt(h, l[0], l[1]), y = Zt(y, l[2], l[3]), v = Zt(v, l[4], l[5]);
          break;
        case Mt.MIRROR:
          h = Ht(h, l[0], l[1]), y = Ht(y, l[2], l[3]), v = Ht(v, l[4], l[5]);
          break;
        default:
          h = Rt(h, l[0], l[1]), y = Rt(y, l[2], l[3]), v = Rt(v, l[4], l[5]);
          break;
      }
      const d = h * u[0] + y * u[1] + v * u[2];
      for (let g = 0; g < c; ++g)
        a[g] = r.pointer[d + g];
    }, e.interpolateLinear = (r, i, a) => {
      const l = r.extent, u = r.increments, c = r.numberOfComponents, h = ke(i[0]), y = ke(i[1]), v = ke(i[2]);
      let d = h.floored, g = y.floored, m = v.floored;
      const P = h.error, x = y.error, S = v.error;
      let L = d + (P !== 0), N = g + (x !== 0), M = m + (S !== 0);
      switch (r.borderMode) {
        case Mt.REPEAT:
          d = Zt(d, l[0], l[1]), g = Zt(g, l[2], l[3]), m = Zt(m, l[4], l[5]), L = Zt(L, l[0], l[1]), N = Zt(N, l[2], l[3]), M = Zt(M, l[4], l[5]);
          break;
        case Mt.MIRROR:
          d = Ht(d, l[0], l[1]), g = Ht(g, l[2], l[3]), m = Ht(m, l[4], l[5]), L = Ht(L, l[0], l[1]), N = Ht(N, l[2], l[3]), M = Ht(M, l[4], l[5]);
          break;
        default:
          d = Rt(d, l[0], l[1]), g = Rt(g, l[2], l[3]), m = Rt(m, l[4], l[5]), L = Rt(L, l[0], l[1]), N = Rt(N, l[2], l[3]), M = Rt(M, l[4], l[5]);
          break;
      }
      const E = d * u[0], w = L * u[0], A = g * u[1], X = N * u[1], _ = m * u[2], k = M * u[2], Y = A + _, F = A + k, W = X + _, U = X + k, R = 1 - P, j = 1 - x, nt = 1 - S, lt = j * nt, H = x * nt, Z = j * S, ht = x * S, gt = r.pointer;
      for (let rt = 0; rt < c; ++rt)
        a[rt] = R * (lt * gt[E + Y + rt * 4] + Z * gt[E + F + rt * 4] + H * gt[E + W + rt * 4] + ht * gt[E + U + rt * 4]) + P * (lt * gt[w + Y + rt * 4] + Z * gt[w + F + rt * 4] + H * gt[w + W + rt * 4] + ht * gt[w + U + rt * 4]);
    }, e.interpolatePoint = (r, i, a) => {
      switch (t.interpolationMode) {
        case ft.LINEAR:
          e.interpolateLinear(r, i, a);
          break;
        case ft.CUBIC:
          console.log("CUBIC not implemented");
          break;
        case ft.NEAREST:
        default:
          e.interpolateNearest(r, i, a);
          break;
      }
    }, e.interpolateRowNearest = (r, i, a, l, u, c) => {
      const h = r.positions[0].subarray(i), y = r.positions[1].subarray(a), v = r.positions[2].subarray(l), d = r.pointer.subarray(y[0] + v[0]), g = r.numberOfComponents;
      for (let m = 0; m < c; ++m)
        u.set(d.subarray(h[m], g), m * g);
    }, e.interpolateRowLinear = (r, i, a, l, u, c) => {
      const h = r.kernelSize[0], y = r.kernelSize[1], v = r.kernelSize[2], d = i * h, g = a * y, m = l * v, P = r.weights[0].subarray(d), x = r.weights[1].subarray(g), S = r.weights[2].subarray(m), L = r.positions[0].subarray(d), N = r.positions[1].subarray(g), M = r.positions[2].subarray(m), E = r.pointer, w = r.numberOfComponents, A = N.subarray(M[0]);
      let X = A, _ = A, k = A, Y = 1, F = 0, W = 1, U = 0;
      y === 2 && (_ = N[1].subarray(M[0]), k = _, Y = x[0], F = x[1]), v === 2 && (X = N[0].subarray(M[1]), k = X, W = S[0], U = S[1]), y + v === 4 && (k = N[1].subarray(M[1]));
      const R = Y * W, j = Y * U, nt = F * W, lt = F * U;
      if (h === 1)
        if (F === 0 && U === 0)
          for (let H = c; H > 0; --H)
            for (let Z = 0; Z < w; Z++)
              u[Z + c - H] = E[A + L[c - H] + Z];
        else if (F === 0)
          for (let H = c; H > 0; --H)
            for (let Z = 0; Z < w; Z++)
              u[Z + c - H] = W * E[L[c - H] + A + Z * 4] + U * E[L[c - H] + X + Z * 4];
        else
          for (let H = c; H > 0; --H)
            for (let Z = 0; Z < w; Z++)
              u[Z + c - H] = R * E[L[c - H] + A + Z * 4] + j * E[L[c - H] + X + Z * 4] + nt * E[L[c - H] + _ + Z * 4] + lt * E[L[c - H] + k + Z * 4];
      else if (U === 0) {
        let H = 0;
        for (let Z = c; Z > 0; --Z) {
          const ht = P[0 + 2 * H], gt = P[1 + 2 * H], rt = L[0 + 2 * H], z = L[1 + 2 * H];
          for (let tt = 0; tt < w; tt++)
            u[tt + c - Z] = ht * (Y * E[rt + A + tt * 4] + F * E[rt + _ + tt * 4]) + gt * (Y * E[z + A + tt * 4] + F * E[z + _ + tt * 4]);
          H++;
        }
      } else {
        let H = 0;
        for (let Z = c; Z > 0; --Z) {
          const ht = P[0 + 2 * H], gt = P[1 + 2 * H], rt = L[0 + 2 * H], z = L[1 + 2 * H];
          for (let tt = 0; tt < w; tt++)
            u[tt] = ht * (R * E[rt + A + tt * 4] + j * E[rt + X + tt * 4] + nt * E[rt + _ + tt * 4] + lt * E[rt + k + tt * 4]) + gt * (R * E[z + A + tt * 4] + j * E[z + X + tt * 4] + nt * E[z + _ + tt * 4] + lt * E[z + k + tt * 4]);
          H++;
        }
      }
    }, e.interpolateRow = (r, i, a, l, u, c) => {
      switch (t.interpolationMode) {
        case ft.LINEAR:
          e.interpolateRowLinear(r, i, a, l, u, c);
          break;
        case ft.CUBIC:
          console.log("CUBIC not implemented");
          break;
        case ft.NEAREST:
        default:
          e.interpolateRowNearest(r, i, a, l, u, c);
          break;
      }
    }, e.vtkTricubicInterpWeights = (r) => {
      const a = r - 1, l = r * 0.5, u = r * 3;
      return [-l * a * a, ((u - 2) * l - 1) * a, -((u - 4) * r - 1) * l, r * l * a];
    }, e.precomputeWeightsForExtent = (r, i, a) => {
      const l = {
        ...K0.newInstance(),
        ...t.interpolationInfo
      };
      l.weightType = "Float32Array";
      const u = l.interpolationMode;
      let c = !0;
      for (let h = 0; h < 3; ++h) {
        let y;
        for (y = 0; y < 3 && r[4 * h + y] === 0; ++y)
          ;
        a[2 * h] = i[2 * h], a[2 * h + 1] = i[2 * h + 1];
        const v = l.extent[2 * y], d = l.extent[2 * y + 1], g = t.structuredBounds[2 * y], m = t.structuredBounds[2 * y + 1];
        let P = 1;
        P = u < ft.LINEAR ? P : 2, P = u < ft.CUBIC ? P : 4;
        const x = d - v + 1;
        P = P < x ? P : x, Number.isInteger(r[4 * h + y]) && Number.isInteger(r[4 * y + y]) && (P = 1);
        const S = P * (i[2 * h + 1] - i[2 * h] + 1), L = new Int16Array(S), N = P * i[2 * h];
        let M = null;
        u !== ft.NEAREST && (M = new Int16Array(S)), l.kernelSize[h] = P, l.weightExtent[2 * h] = i[2 * h], l.weightExtent[2 * h + 1] = i[2 * h + 1], l.positions[h] = L, l.weights[h] = M;
        let E = 0;
        for (let w = i[2 * h]; w <= i[2 * h + 1]; ++w) {
          const A = r[12 + y] + w * r[4 * h + y];
          let X = P, _ = 0, k = 0;
          if (u === ft.NEAREST)
            _ = Math.round(A);
          else {
            const U = ke(A);
            _ = U.integer, k = U.error, u === ft.CUBIC && P !== 1 && (_--, X = 4);
          }
          const Y = [0, 0, 0, 0];
          let F = 0;
          switch (l.borderMode) {
            case Mt.REPEAT:
              do
                Y[F] = Zt(_, v, d), _++;
              while (++F < X);
              break;
            case Mt.MIRROR:
              do
                Y[F] = Ht(_, v, d), _++;
              while (++F < X);
              break;
            default:
              do
                Y[F] = Rt(_, v, d), _++;
              while (++F < X);
              break;
          }
          const W = l.increments[y];
          if (L[P * w - N] = Y[0] * W, u !== ft.NEAREST && (M[P * w - N] = 1), P > 1) {
            if (u === ft.LINEAR)
              L[P * w + 1 - N] = Y[1] * W, M[P * w - N] = 1 - k, M[P * w + 1 - N] = k;
            else if (u === ft.CUBIC) {
              const U = e.vtkTricubicInterpWeights(k);
              if (P === 4)
                for (let R = 0; R < 4; R++)
                  L[P * w + R - N] = Y[R] * W, M[P * w + R - N] = U[R];
              else {
                const R = [0, 0, 0, 0];
                for (let j = 0; j < 4; j++) {
                  const nt = Y[j] - v;
                  R[nt] += U[j];
                }
                for (let j = 0; j < P; j++)
                  L[P * w + j - N] = v + j, M[P * w + j - N] = R[j];
              }
            }
          }
          A >= g && A <= m ? E === 0 && (E = 1, a[2 * h] = w) : E === 1 && (E = 2, a[2 * h + 1] = w - 1);
        }
        (E === 0 || a[2 * h] > a[2 * h + 1]) && (c = !1);
      }
      if (!c)
        for (let h = 0; h < 3; h++)
          a[2 * h] = i[2 * h], a[2 * h + 1] = i[2 * h] - 1;
    };
  }
  const sh = {
    interpolationMode: ft.NEAREST
  };
  function Wa(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, sh, r), rh.extend(e, t, r), V.setGet(e, t, ["interpolationMode"]), ih(e, t);
  }
  const ah = V.newInstance(Wa, "vtkImageInterpolator");
  var oh = {
    newInstance: ah,
    extend: Wa
  };
  function lh(e, t) {
    t.classHierarchy.push("vtkImagePointDataIterator"), e.initialize = (r, i, a, l) => {
      const u = r.getExtent();
      let c = i;
      c == null && (c = u);
      let h = !1;
      for (let g = 0; g < 6; g += 2)
        t.extent[g] = Math.max(c[g], u[g]), t.extent[g + 1] = Math.min(c[g + 1], u[g + 1]), t.extent[g] > t.extent[g + 1] && (h = !0);
      t.rowIncrement = u[1] - u[0] + 1, t.sliceIncrement = t.rowIncrement * (u[3] - u[2] + 1);
      let y, v, d;
      if (!h)
        y = t.extent[1] - t.extent[0] + 1, v = t.extent[3] - t.extent[2] + 1, d = t.extent[5] - t.extent[4] + 1, t.id = t.extent[0] - u[0] + (t.extent[2] - u[2]) * t.rowIncrement + (t.extent[4] - u[4]) * t.sliceIncrement, t.rowEndIncrement = t.rowIncrement - y, t.sliceEndIncrement = t.rowEndIncrement + t.sliceIncrement - t.rowIncrement * v;
      else {
        y = 0, v = 0, d = 0, t.id = 0, t.rowEndIncrement = 0, t.sliceEndIncrement = 0;
        for (let g = 0; g < 6; g += 2)
          t.extent[g] = u[g], t.extent[g + 1] = u[g] - 1;
      }
      if (t.spanEnd = t.id + y, t.rowEnd = t.id + y, t.sliceEnd = t.id + (t.rowIncrement * v - t.rowEndIncrement), t.end = t.id + (t.sliceIncrement * d - t.sliceEndIncrement), t.index[0] = t.extent[0], t.index[1] = t.extent[2], t.index[2] = t.extent[4], t.startY = t.index[1], a) {
        t.hasStencil = !0, t.inStencil = !1, t.spanIndex = 0;
        const g = a.getExtent();
        if (t.spanSliceIncrement = 0, t.spanSliceEndIncrement = 0, g[3] >= g[2] && g[5] >= g[4]) {
          t.spanSliceIncrement = g[3] - g[2] + 1;
          const S = t.extent[2] - g[2];
          S >= 0 && (t.spanSliceEndIncrement += S);
          const L = g[3] - t.extent[3];
          L >= 0 && (t.spanSliceEndIncrement += L);
        }
        let m = 0;
        const P = t.extent[2] - g[2];
        P < 0 ? (t.extent[2] = g[2], m -= 1) : m += P, g[3] <= t.extent[3] && (t.extent[3] = g[3]);
        const x = t.extent[4] - g[4];
        x < 0 ? (t.extent[4] = g[4], P >= 0 && (m -= 1 + t.spanSliceEndIncrement)) : m += x * t.spanSliceIncrement, g[5] <= t.extent[5] && (t.extent[5] = g[5]), t.extent[2] <= t.extent[3] && t.extent[4] <= t.extent[5] ? (t.spanCountPointer = a.extentListLengths.subarray(m), t.spanListPointer = a.extentLists.subarray(m), P >= 0 && x >= 0 && (t.inStencil = !0, t.setSpanState(t.extent[0]))) : (t.spanCountPointer = null, t.spanListPointer = null, t.inStencil = !1);
      } else
        t.hasStencil = !1, t.inStencil = !0, t.spanSliceEndIncrement = 0, t.spanSliceIncrement = 0, t.spanIndex = 0, t.spanCountPointer = null, t.spanListPointer = null;
      if (l) {
        t.algorithm = l;
        const g = v * d;
        t.target = g / 50 + 1, t.count = t.target * 50 - g / t.target * t.target + 1;
      } else
        t.algorithm = null, t.target = 0, t.count = 0;
    }, e.setSpanState = (r) => {
      let i = !1;
      const a = t.spanListPointer, l = t.spanCountPointer[0];
      let u;
      for (u = 0; u < l && !(a[u] > r); ++u)
        i = !i;
      t.spanIndex = u, t.inStencil = i;
      let c = t.extent[1] + 1;
      u < l && a[u] <= t.extent[1] && (c = a[u]);
      const h = t.rowEnd - (t.rowIncrement - t.rowEndIncrement);
      t.id = h + (r - t.extent[0]), t.spanEnd = h + (c - t.extent[0]);
    }, e.nextSpan = () => {
      if (t.spanEnd === t.rowEnd) {
        let r = 1;
        if (t.spanEnd !== t.sliceEnd)
          t.id = t.rowEnd + t.rowEndIncrement, t.rowEnd += t.rowIncrement, t.spanEnd = t.rowEnd, t.index[1]++;
        else if (t.spanEnd !== t.end)
          t.id = t.sliceEnd + t.sliceEndIncrement, t.sliceEnd += t.sliceIncrement, t.rowEnd = t.id + (t.rowIncrement - t.rowEndIncrement), t.spanEnd = t.rowEnd, t.index[1] = t.startY, t.index[2]++, r += t.spanSliceEndIncrement;
        else {
          t.id = t.end;
          return;
        }
        t.index[0] = t.extent[0], t.hasStencil && (t.index[1] >= t.extent[2] && t.index[1] <= t.extent[3] && t.index[2] >= t.extent[4] && t.index[2] <= t.extent[5] ? (t.spanCountPointer = t.spanCountPointer.subarray(r), t.spanListPointer = t.spanListPointer.subarray(r), e.setSpanState(t.extent[0])) : t.inStencil = !1), t.algorithm && e.reportProgress();
      } else {
        t.id = t.spanEnd;
        const r = t.spanCountPointer[0];
        let i = t.extent[1] + 1;
        if (t.index[0] = i, t.spanIndex < r) {
          const a = t.spanListPointer[t.spanIndex];
          a < i && (t.index[0] = a);
        }
        if (t.spanIndex++, t.spanIndex < r) {
          const a = t.spanListPointer[t.spanIndex];
          a < i && (i = a);
        }
        t.spanEnd = t.rowEnd - (t.rowIncrement - t.rowEndIncrement) + (i - t.extent[0]), t.inStencil = !t.inStencil;
      }
    }, e.isAtEnd = () => t.id === t.end, e.isInStencil = () => t.inStencil, e.spanEndId = () => t.spanEnd, e.reportProgress = () => {
    }, e.getArray = (r, i) => r.getData().subarray(i * r.getNumberOfComponents()), e.getScalars = function(r) {
      let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
      return e.getArray(r.getPointData().getScalars(), i);
    };
  }
  const fh = {
    spanState: 0,
    extent: [0, -1, 0, -1, 0, -1],
    end: 0,
    spanEnd: 0,
    rowEnd: 0,
    sliceEnd: 0,
    rowIncrement: 0,
    rowEndIncrement: 0,
    sliceIncrement: 0,
    sliceEndIncrement: 0,
    id: 0,
    index: [0, 0, 0],
    startY: 0,
    hasStencil: !1,
    inStencil: !0,
    spanIndex: 0,
    spanSliceIncrement: 0,
    spanSliceEndIncrement: 0,
    spanCountPointer: null,
    spanListPointer: null,
    algorithm: null,
    target: 0,
    count: 0
  };
  function za(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, fh, r), V.obj(e, t), V.get(e, t, ["id", "index"]), lh(e, t);
  }
  const uh = V.newInstance(za, "vtkImagePointDataIterator");
  var ch = {
    newInstance: uh,
    extend: za
  };
  const hh = {
    MIN: 0,
    MAX: 1,
    MEAN: 2,
    SUM: 3
  };
  var ja = {
    SlabMode: hh
  };
  const {
    SlabMode: Be
  } = ja, {
    vtkErrorMacro: ph
  } = V;
  function yh(e, t) {
    t.classHierarchy.push("vtkImageReslice");
    const r = {
      ...e
    }, i = Te(new Float64Array(16));
    let a = null;
    function l(m, P, x, S) {
      const L = x - 1;
      for (let N = 0; N < P; N += 1) {
        let M = m[N] * 0.5;
        for (let E = 1; E < L; E += 1)
          M += m[N + E * P];
        M += m[N + L * P] * 0.5, m[N] = M * S;
      }
    }
    function u(m, P, x, S) {
      for (let L = 0; L < P; L += 1) {
        let N = m[L];
        for (let M = 1; M < x; M += 1)
          N += m[L + M * P];
        m[L] = N * S;
      }
    }
    function c(m, P, x) {
      for (let S = 0; S < P; S += 1) {
        let L = m[S];
        for (let N = 1; N < x; N += 1)
          L = Math.min(L, m[S + N * P]);
        m[S] = L;
      }
    }
    function h(m, P, x) {
      for (let S = 0; S < P; S += 1) {
        let L = m[S];
        for (let N = 1; N < x; N += 1)
          L = Math.max(L, m[S + N * P]);
        m[S] = L;
      }
    }
    function y(m, P, x) {
      const S = 1 / x;
      u(m, P, x, S);
    }
    function v(m, P, x) {
      const S = 1 / (x - 1);
      l(m, P, x, S);
    }
    function d(m, P, x) {
      u(m, P, x, 1);
    }
    function g(m, P, x) {
      l(m, P, x, 1);
    }
    e.getMTime = () => {
      let m = r.getMTime();
      return t.resliceTransform && (m = Math.max(m, t.resliceTransform.getMTime())), m;
    }, e.setResliceAxes = (m) => (t.resliceAxes || (t.resliceAxes = Te(new Float64Array(16))), Vu(t.resliceAxes, m) ? !1 : (Pn(t.resliceAxes, m), e.modified(), !0)), e.requestData = (m, P) => {
      const x = m[0];
      if (!x) {
        ph("Invalid or missing input");
        return;
      }
      const S = x.getOrigin(), L = x.getSpacing(), N = x.getDimensions(), M = x.getPointData().getScalars(), E = [0, N[0] - 1, 0, N[1] - 1, 0, N[2] - 1], w = [0, 0, 0], A = [1, 1, 1], X = [0, 0, 0, 0, 0, 0], _ = [0, 0, 0], k = Te(new Float64Array(16));
      t.resliceAxes && xe(k, k, t.resliceAxes);
      const Y = new Float64Array(16);
      wn(Y, k);
      const F = [S[0] + 0.5 * (E[0] + E[1]) * L[0], S[1] + 0.5 * (E[2] + E[3]) * L[1], S[2] + 0.5 * (E[4] + E[5]) * L[2]];
      let W = null;
      t.autoCropOutput && (W = e.getAutoCroppedOutputBounds(x));
      for (let z = 0; z < 3; z++) {
        let tt = 0, wt = 0, Ct = 0, Bt = 0;
        if (t.transformInputSampling) {
          let Dt = 0;
          for (let vt = 0; vt < 3; vt++) {
            Bt += Y[4 * vt + z] * (F[vt] - k[4 * 3 + vt]);
            const Ot = k[4 * z + vt] * k[4 * z + vt];
            tt += Ot * Math.abs(L[vt]), wt += Ot * (E[2 * vt + 1] - E[2 * vt]) * Math.abs(L[vt]), Ct += Ot * E[2 * vt], Dt += Ot;
          }
          tt /= Dt, wt /= Dt * Math.sqrt(Dt), Ct /= Dt;
        } else
          Bt = F[z], tt = L[z], wt = (E[2 * z + 1] - E[2 * z]) * tt, Ct = E[2 * z];
        t.outputSpacing == null ? A[z] = tt : A[z] = t.outputSpacing[z], z >= t.outputDimensionality ? (X[2 * z] = 0, X[2 * z + 1] = 0) : t.outputExtent == null ? (t.autoCropOutput && (wt = W[2 * z + 1] - W[2 * z]), X[2 * z] = Math.round(Ct), X[2 * z + 1] = Math.round(X[2 * z] + Math.abs(wt / A[z]))) : (X[2 * z] = t.outputExtent[2 * z], X[2 * z + 1] = t.outputExtent[2 * z + 1]), z >= t.outputDimensionality ? w[z] = 0 : t.outputOrigin == null ? t.autoCropOutput ? w[z] = W[2 * z] - X[2 * z] * A[z] : w[z] = Bt - 0.5 * (X[2 * z] + X[2 * z + 1]) * A[z] : w[z] = t.outputOrigin[z], _[z] = X[2 * z + 1] - X[2 * z] + 1;
      }
      let U = M.getDataType();
      t.outputScalarType && (U = t.outputScalarType);
      const R = x.getPointData().getScalars().getNumberOfComponents(), j = V.newTypedArray(U, _[0] * _[1] * _[2] * R), nt = Le.newInstance({
        name: "Scalars",
        values: j,
        numberOfComponents: R
      }), lt = Ea.newInstance();
      lt.setDimensions(_), lt.setOrigin(w), lt.setSpacing(A), t.outputDirection && lt.setDirection(t.outputDirection), lt.getPointData().setScalars(nt), e.getIndexMatrix(x, lt);
      let H = t.interpolationMode;
      t.usePermuteExecute = !1, t.optimization && a == null && t.slabSliceSpacingFraction === 1 && t.interpolator.isSeparable() && e.isPermutationMatrix(i) && (t.usePermuteExecute = !0, e.canUseNearestNeighbor(i, X) && (H = ft.NEAREST)), t.interpolator.setInterpolationMode(H);
      let Z = Mt.CLAMP;
      Z = t.wrap ? Mt.REPEAT : Z, Z = t.mirror ? Mt.MIRROR : Z, t.interpolator.setBorderMode(Z);
      const ht = 762939453125e-17, gt = 2 * 2147483647;
      let rt = 0.5 * t.border;
      rt = Z === Mt.CLAMP ? rt : gt, rt = rt > ht ? rt : ht, t.interpolator.setTolerance(rt), t.interpolator.initialize(x), e.vtkImageResliceExecute(x, lt), t.interpolator.releaseData(), P[0] = lt;
    }, e.vtkImageResliceExecute = (m, P) => {
      const x = m.getPointData().getScalars(), S = P.getPointData().getScalars();
      let L = S.getData();
      const N = P.getExtent(), M = i, E = Math.max(t.slabNumberOfSlices, 1), w = t.slabSliceSpacingFraction, A = e.isPerspectiveMatrix(M);
      let X = x.getData();
      const _ = 1, k = x.getDataType(), Y = x.getNumberOfComponents(), F = t.interpolator.getComponentOffset(), W = t.interpolator.getBorderMode(), U = m.getDimensions(), R = [0, U[0] - 1, 0, U[1] - 1, 0, U[2] - 1], j = [0, 0, 0];
      j[0] = x.getNumberOfComponents(), j[1] = j[0] * U[0], j[2] = j[1] * U[1];
      const nt = U[0] * U[1] * U[2];
      F > 0 && F + Y < j[0] && (X = X.subarray(_ * F));
      let lt = ft.NEAREST;
      t.interpolator.isA("vtkImageInterpolator") && (lt = t.interpolator.getInterpolationMode());
      const H = null, Z = t.scalarShift !== 0 || t.scalarScale !== 1, ht = lt === ft.NEAREST && W === Mt.CLAMP && !(a != null || A || H != null || Z) && k === S.getDataType() && nt === x.getNumberOfTuples() && t.border === !0 && E <= 1, gt = S.getDataType(), rt = 1, z = S.getNumberOfComponents(), tt = [0, 0, 0, 0], wt = [0, 0, 0, 0], Ct = [0, 0, 0, 0], Bt = [0, 0, 0, 0];
      for (let Tt = 0; Tt < 4; ++Tt)
        tt[Tt] = M[4 * 0 + Tt], wt[Tt] = M[4 * 1 + Tt], Ct[Tt] = M[4 * 2 + Tt], Bt[Tt] = M[4 * 3 + Tt];
      let Dt = null;
      ht || (Dt = new Float64Array(Y * (N[1] - N[0] + E)));
      const vt = V.newTypedArray(k, t.backgroundColor), Ot = lt > ft.LINEAR || E > 1 && t.slabMode === Be.SUM, Vn = e.getConversionFunc(k, gt, t.scalarShift, t.scalarScale, Ot), Ne = e.getSetPixelsFunc(gt, rt, z, L), Wn = e.getCompositeFunc(t.slabMode, t.slabTrapezoidIntegration);
      let Jt = N[2] - 1, oe = N[4] - 1;
      const Wt = [0, 0, 0, 0], Nt = [0, 0, 0, 0], bt = ch.newInstance();
      bt.initialize(P, N, t.stencil, null);
      const Kt = bt.getScalars(P, 0);
      let zt = 0;
      const kt = V.newTypedArray(gt, Ce.getDiagonalLength(N) * z * 2), je = new Float64Array(Y * E), fn = new Float64Array(Y);
      for (; !bt.isAtEnd(); bt.nextSpan()) {
        const Tt = bt.spanEndId() - bt.getId();
        if (zt = bt.getId() * rt * z, bt.isInStencil()) {
          const Qt = bt.getIndex();
          Qt[2] > oe && (oe = Qt[2], Wt[0] = Bt[0] + oe * Ct[0], Wt[1] = Bt[1] + oe * Ct[1], Wt[2] = Bt[2] + oe * Ct[2], Wt[3] = Bt[3] + oe * Ct[3], Jt = N[2] - 1), Qt[1] > Jt && (Jt = Qt[1], Nt[0] = Wt[0] + Jt * wt[0], Nt[1] = Wt[1] + Jt * wt[1], Nt[2] = Wt[2] + Jt * wt[2], Nt[3] = Wt[3] + Jt * wt[3]);
          const xt = Qt[0], ye = xt + Tt - 1;
          if (ht) {
            const At = X, jt = L, le = j[0] * _, Xt = j[1] * _, Ge = j[2] * _, Ze = R[1] - R[0] + 1, un = R[3] - R[2] + 1, te = R[5] - R[4] + 1;
            let fe = xt, It = xt - 1, Ft = !1;
            const Et = _ * Y;
            for (let pt = xt; pt <= ye; pt++) {
              const yt = [Nt[0] + pt * tt[0], Nt[1] + pt * tt[1], Nt[2] + pt * tt[2]], ee = $e(yt[0]) - R[0], ve = $e(yt[1]) - R[2], He = $e(yt[2]) - R[4];
              if (ee >= 0 && ee < Ze && ve >= 0 && ve < un && He >= 0 && He < te) {
                if (!Ft) {
                  fe = pt, Ft = !0;
                  const ne = Ne(kt, vt, z, fe - xt);
                  for (let Je = 0; Je < ne; ++Je)
                    Kt[zt++] = kt[Je];
                }
                It = pt;
                let qe = ee * le + ve * Xt + He * Ge;
                switch (Et) {
                  case 1:
                    Kt[zt++] = At[qe];
                    break;
                  case 2:
                  case 3:
                  case 4:
                  case 8:
                  case 12:
                  case 16:
                    for (let ne = 0; ne < Et; ++ne)
                      Kt[zt++] = At[qe + ne];
                    break;
                  default: {
                    let ne = 0;
                    do
                      Kt[zt++] = At[qe++];
                    while (++ne !== Et);
                    break;
                  }
                }
              } else if (Ft)
                break;
            }
            L = jt;
            const ge = Ne(kt, vt, z, ye - It);
            for (let pt = 0; pt < ge; ++pt)
              Kt[zt++] = kt[pt];
          } else {
            let At = 1, jt = 1, le = xt, Xt = xt;
            const Ge = Dt;
            let Ze = 0;
            for (; le <= ye; ) {
              for (; Xt <= ye && jt === At; Xt++) {
                const It = [Nt[0] + Xt * tt[0], Nt[1] + Xt * tt[1], Nt[2] + Xt * tt[2], Nt[3] + Xt * tt[3]], Ft = [0, 0, 0, 0];
                let Et = It;
                jt = !1;
                let ge = 0;
                for (let pt = 0; pt < E; ++pt) {
                  if (E > 1) {
                    let yt = pt - 0.5 * (E - 1);
                    yt *= w, Ft[0] = It[0] + yt * Ct[0], Ft[1] = It[1] + yt * Ct[1], Ft[2] = It[2] + yt * Ct[2], Ft[3] = It[3] + yt * Ct[3], Et = Ft;
                  }
                  if (A) {
                    const yt = 1 / Et[3];
                    Et[0] *= yt, Et[1] *= yt, Et[2] *= yt;
                  }
                  if (a !== null) {
                    const yt = t.interpolator.getOrigin(), ee = t.interpolator.getSpacing(), ve = [1 / ee[0], 1 / ee[1], 1 / ee[2]];
                    e.applyTransform(a, Et, yt, ve);
                  }
                  if (t.interpolator.checkBoundsIJK(Et)) {
                    jt = 1, t.interpolator.interpolateIJK(Et, fn);
                    for (let yt = 0; yt < Y; ++yt)
                      je[ge++] = fn[yt];
                  }
                }
                ge > Y && Wn(je, Y, ge / Y);
                for (let pt = 0; pt < Y; ++pt)
                  Ge[Ze++] = je[pt];
                At = Xt > xt ? At : jt;
              }
              const te = Xt - 1 - (jt !== At) - le + 1;
              let fe = 0;
              At ? (Z && e.rescaleScalars(Dt, Y, ye - xt + 1, t.scalarShift, t.scalarScale), fe = Vn(kt, Dt.subarray(le * Y), z, te)) : fe = Ne(kt, vt, z, te);
              for (let It = 0; It < fe; ++It)
                Kt[zt++] = kt[It];
              le += te, At = jt;
            }
          }
        } else {
          const Qt = Ne(kt, vt, z, Tt);
          for (let xt = 0; xt < Qt; ++xt)
            Kt[zt++] = kt[xt];
        }
      }
    }, e.getIndexMatrix = (m, P) => {
      const x = Te(new Float64Array(16));
      a = null, t.resliceAxes && Pn(x, t.resliceAxes), t.resliceTransform && (t.resliceTransform.isA("vtkHomogeneousTransform") ? xe(x, t.resliceTransform.getMatrix(), x) : Yn("Non homogeneous transform have not yet been ported"));
      const S = P.getIndexToWorld();
      if (xe(x, x, S), a == null) {
        const L = m.getWorldToIndex();
        xe(x, L, x);
      }
      return Pn(i, x), i;
    }, e.getAutoCroppedOutputBounds = (m) => {
      const P = m.getOrigin(), x = m.getSpacing(), S = m.getDirection(), L = m.getDimensions(), N = [0, L[0] - 1, 0, L[1] - 1, 0, L[2] - 1], M = new Float64Array(16);
      t.resliceAxes ? wn(M, t.resliceAxes) : Te(M);
      let E = null;
      t.resliceTransform && (E = t.resliceTransform.getInverse());
      let w = null;
      Cu.isIdentity3x3(S) || (w = O0.buildFromRadian().translate(P[0], P[1], P[2]).multiply3x3(S).translate(-P[0], -P[1], -P[2]).invert().getMatrix());
      const A = [Number.MAX_VALUE, -Number.MAX_VALUE, Number.MAX_VALUE, -Number.MAX_VALUE, Number.MAX_VALUE, -Number.MAX_VALUE], X = [0, 0, 0, 0];
      for (let _ = 0; _ < 8; ++_) {
        X[0] = P[0] + N[_ % 2] * x[0], X[1] = P[1] + N[2 + Math.floor(_ / 2) % 2] * x[1], X[2] = P[2] + N[4 + Math.floor(_ / 4) % 2] * x[2], X[3] = 1, w && qn(X, X, w), t.resliceTransform && E.transformPoint(X, X), qn(X, X, M);
        const k = 1 / X[3];
        X[0] *= k, X[1] *= k, X[2] *= k;
        for (let Y = 0; Y < 3; ++Y)
          X[Y] > A[2 * Y + 1] && (A[2 * Y + 1] = X[Y]), X[Y] < A[2 * Y] && (A[2 * Y] = X[Y]);
      }
      return A;
    }, e.getDataTypeMinMax = (m) => {
      switch (m) {
        case "Int8Array":
          return {
            min: -128,
            max: 127
          };
        case "Int16Array":
          return {
            min: -32768,
            max: 32767
          };
        case "Uint16Array":
          return {
            min: 0,
            max: 65535
          };
        case "Int32Array":
          return {
            min: -2147483648,
            max: 2147483647
          };
        case "Uint32Array":
          return {
            min: 0,
            max: 4294967295
          };
        case "Float32Array":
          return {
            min: -12e37,
            max: 12e37
          };
        case "Float64Array":
          return {
            min: -12e37,
            max: 12e37
          };
        case "Uint8Array":
        case "Uint8ClampedArray":
        default:
          return {
            min: 0,
            max: 255
          };
      }
    }, e.clamp = (m, P, x, S, L, N) => {
      const M = S * x;
      for (let E = 0; E < M; ++E)
        m[E] = Rt(P[E], L, N);
      return M;
    }, e.convert = (m, P, x, S) => {
      const L = S * x;
      for (let N = 0; N < L; ++N)
        m[N] = Math.round(P[N]);
      return L;
    }, e.getConversionFunc = (m, P, x, S, L) => {
      let N = L;
      if (P !== he.FLOAT && P !== he.DOUBLE && !L) {
        const M = e.getDataTypeMinMax(m);
        let E = (M.min + x) * S, w = (M.max + x) * S;
        const A = e.getDataTypeMinMax(P), X = A.min, _ = A.max;
        if (E > w) {
          const k = w;
          w = E, E = k;
        }
        N = E < X || w > _;
      }
      if (N && P !== he.FLOAT && P !== he.DOUBLE) {
        const M = e.getDataTypeMinMax(P);
        return (w, A, X, _) => e.clamp(w, A, X, _, M.min, M.max);
      }
      return e.convert;
    }, e.set = (m, P, x, S) => {
      const L = x * S;
      for (let N = 0; N < S; ++N)
        m[N] = P[N];
      return L;
    }, e.set1 = (m, P, x, S) => (m.fill(P[0], 0, S), S), e.getSetPixelsFunc = (m, P, x, S) => x === 1 ? e.set1 : e.set, e.getCompositeFunc = (m, P) => {
      let x = null;
      switch (m) {
        case Be.MIN:
          x = c;
          break;
        case Be.MAX:
          x = h;
          break;
        case Be.MEAN:
          P ? x = v : x = y;
          break;
        case Be.SUM:
          P ? x = g : x = d;
          break;
      }
      return x;
    }, e.applyTransform = (m, P, x, S) => {
      P[3] = 1, qn(P, P, m), P[0] -= x[0], P[1] -= x[1], P[2] -= x[2], P[0] *= S[0], P[1] *= S[1], P[2] *= S[2];
    }, e.rescaleScalars = (m, P, x, S, L) => {
      const N = x * P;
      for (let M = 0; M < N; ++M)
        m[M] = (m[M] + S) * L;
    }, e.isPermutationMatrix = (m) => {
      for (let P = 0; P < 3; P++)
        if (m[4 * P + 3] !== 0)
          return !1;
      if (m[4 * 3 + 3] !== 1)
        return !1;
      for (let P = 0; P < 3; P++) {
        let x = 0;
        for (let S = 0; S < 3; S++)
          m[4 * P + S] !== 0 && x++;
        if (x !== 1)
          return !1;
      }
      return !0;
    }, e.isIdentityMatrix = (m) => {
      for (let P = 0; P < 4; ++P)
        for (let x = 0; x < 4; ++x)
          if ((P === x ? 1 : 0) !== m[4 * x + P])
            return !1;
      return !0;
    }, e.isPerspectiveMatrix = (m) => m[4 * 0 + 3] !== 0 || m[4 * 1 + 3] !== 0 || m[4 * 2 + 3] !== 0 || m[4 * 3 + 3] !== 1, e.canUseNearestNeighbor = (m, P) => {
      for (let x = 0; x < 3; x++) {
        let S;
        for (S = 0; S < 3 && m[4 * S + x] === 0; S++)
          ;
        if (S >= 3)
          return !1;
        let L = m[4 * S + x], N = m[4 * 3 + x];
        P[2 * S] === P[2 * S + 1] && (N += L * P[2 * x], L = 0);
        const M = ke(L).error, E = ke(N).error;
        if (M !== 0 || E !== 0)
          return !1;
      }
      return !0;
    };
  }
  const gh = {
    transformInputSampling: !0,
    autoCropOutput: !1,
    outputDimensionality: 3,
    outputSpacing: null,
    // automatically computed if null
    outputOrigin: null,
    // automatically computed if null
    outputDirection: null,
    // identity if null
    outputExtent: null,
    // automatically computed if null
    outputScalarType: null,
    wrap: !1,
    // don't wrap
    mirror: !1,
    // don't mirror
    border: !0,
    // apply a border
    interpolationMode: ft.NEAREST,
    // only NEAREST supported so far
    slabMode: Be.MIN,
    slabTrapezoidIntegration: !1,
    slabNumberOfSlices: 1,
    slabSliceSpacingFraction: 1,
    optimization: !1,
    // not supported yet
    scalarShift: 0,
    // for rescaling the data
    scalarScale: 1,
    backgroundColor: [0, 0, 0, 0],
    resliceAxes: null,
    // resliceTransform: null,
    interpolator: oh.newInstance(),
    usePermuteExecute: !1
    // no supported yet
  };
  function Ga(e, t) {
    let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
    Object.assign(t, gh, r), V.obj(e, t), V.algo(e, t, 1, 1), V.setGet(e, t, ["outputDimensionality", "outputScalarType", "scalarShift", "scalarScale", "transformInputSampling", "autoCropOutput", "wrap", "mirror", "border", "interpolationMode", "resliceTransform", "slabMode", "slabTrapezoidIntegration", "slabNumberOfSlices", "slabSliceSpacingFraction"]), V.setGetArray(e, t, ["outputOrigin", "outputSpacing"], 3), V.setGetArray(e, t, ["outputExtent"], 6), V.setGetArray(e, t, ["outputDirection"], 9), V.setGetArray(e, t, ["backgroundColor"], 4), V.get(e, t, ["resliceAxes"]), yh(e, t);
  }
  const vh = V.newInstance(Ga, "vtkImageReslice");
  var mh = {
    newInstance: vh,
    extend: Ga,
    ...ja
  };
  "" + Mu();
  en.AXIAL + "", en.SAGITTAL + "", en.CORONAL + "", Kn.VOLUME_3D + "";
  self.onmessage = function({ data: e }) {
    const {
      AXIS_AXES: t,
      dimensions: r,
      direction: i,
      origin: a,
      spacing: l,
      scalarData: u,
      segmentationId: c,
      segmentIndex: h
    } = e, [y, v, d] = r, g = [], m = y * v;
    for (let _ = 0; _ < d; _++) {
      const k = _ * m;
      let Y = !1;
      for (let F = 0; F < v; F++) {
        const W = F * y;
        for (let U = 0; U < y; U++) {
          const R = k + W + U;
          if (u[R] > 0) {
            g.push(_), Y = !0;
            break;
          }
        }
        if (Y) break;
      }
    }
    const P = Le.newInstance({
      name: "Pixels",
      numberOfComponents: 1,
      values: u
    }), x = hr.newInstance();
    x.addArray(P);
    const S = Ea.newInstance();
    S.setDimensions(r), S.setDirection(i), S.setOrigin(a), S.setSpacing(l), S.setPointData(x), S.getPointData().setScalars(P);
    const L = mh.newInstance();
    L.setInputData(S), L.setOutputDimensionality(2);
    const [N, M, E] = dh(i.slice(0, 6)), w = [...t[E]], A = 15 - N - M, X = /* @__PURE__ */ new Map();
    for (let _ = 0, k = g.length + 1; _ < k; _++) {
      const Y = g[_], F = a[E] + l[E] * Y;
      w[A] = F, L.setResliceAxes(w);
      const W = L.getOutputData(), U = k0.newInstance();
      U.setInputData(W), U.setMergePoints(!0), U.setContourValues([h]);
      const R = U.getOutputData(), j = U0(R);
      j && X.set(F, Ch(j));
    }
    self.postMessage({ contours: X, segmentationId: c });
  };
  function dh(e) {
    const [t, r, i, a, l, u] = e, c = [t, r, i], h = [a, l, u];
    let y = null, v = null, d = null, g = null;
    for (let P = 0; P < 2; P++) {
      const x = P + 1, S = Math.abs(c[P]), L = Math.abs(c[x]), N = Math.abs(h[P]), M = Math.abs(h[x]);
      y === null ? (d = Math.max(S, L), g = Math.max(N, M)) : (d = Math.max(S, L, d), g = Math.max(N, M, g)), S >= d && (y = P), L >= d && (y = x), N >= g && (v = P), M >= g && (v = x);
    }
    const [m] = [0, 1, 2].filter((P) => P !== y && P !== v);
    return [y || 0, v || 1, m || 2];
  }
  function Ch(e) {
    const t = [];
    for (const r of e) {
      const i = [], a = { x: 1 / 0, y: 0 }, l = { x: -1 / 0, y: 0 }, u = { x: 0, y: 1 / 0 }, c = { x: 0, y: -1 / 0 };
      for (let v = 0, d = r.length; v < d; v++) {
        const [g, m] = r[v];
        i.push({ X: g, Y: m }), g < a.x && (a.x = g, a.y = m), g > l.x && (l.x = g, l.y = m), m < u.y && (u.x = g, u.y = m), m > c.y && (c.x = g, c.y = m);
      }
      const y = new Z0([i]).simplify("pftEvenOdd").mapToLower();
      y.length ? t.push(y[0]) : Ci(a.x, l.x) ? t.push([u, c]) : Ci(u.y, c.y) ? t.push([a, l]) : (t.push([a, l]), t.push([u, c]));
    }
    return t;
  }
});
export default Ph();