/* eslint-disable */
/*
 * GoJS v2.1.5 JavaScript Library for HTML Diagrams
 * Northwoods Software, https://www.nwoods.com/
 * GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation.
 * Copyright (C) 1998-2020 by Northwoods Software Corporation.  All Rights Reserved.
 * THIS SOFTWARE IS LICENSED.  THE LICENSE AGREEMENT IS AT: https://gojs.net/2.1.5/license.html.
 */
(function () {
    var t;
    function aa(a) {
      var b = 0;
      return function () {
        return b < a.length ? { done: !1, value: a[b++] } : { done: !0 };
      };
    }
    function ba(a) {
      var b =
        'undefined' != typeof Symbol && Symbol.iterator && a[Symbol.iterator];
      return b ? b.call(a) : { next: aa(a) };
    }
    function da(a) {
      for (var b, c = []; !(b = a.next()).done; ) c.push(b.value);
      return c;
    }
    var ea =
        'function' == typeof Object.create
          ? Object.create
          : function (a) {
              function b() {}
              b.prototype = a;
              return new b();
            },
      fa;
    if ('function' == typeof Object.setPrototypeOf) fa = Object.setPrototypeOf;
    else {
      var ha;
      a: {
        var ia = { a: !0 },
          ja = {};
        try {
          ja.__proto__ = ia;
          ha = ja.a;
          break a;
        } catch (a) {}
        ha = !1;
      }
      fa = ha
        ? function (a, b) {
            a.__proto__ = b;
            if (a.__proto__ !== b) throw new TypeError(a + ' is not extensible');
            return a;
          }
        : null;
    }
    var ka = fa;
    function la(a, b) {
      a.prototype = ea(b.prototype);
      a.prototype.constructor = a;
      if (ka) ka(a, b);
      else
        for (var c in b)
          if ('prototype' != c)
            if (Object.defineProperties) {
              var d = Object.getOwnPropertyDescriptor(b, c);
              d && Object.defineProperty(a, c, d);
            } else a[c] = b[c];
      a.NA = b.prototype;
    }
    var ma =
        'undefined' != typeof window && window === self
          ? self
          : 'undefined' != typeof global && null != global
          ? global
          : self,
      na =
        'function' == typeof Object.defineProperties
          ? Object.defineProperty
          : function (a, b, c) {
              a != Array.prototype && a != Object.prototype && (a[b] = c.value);
            };
    function oa(a) {
      if (a) {
        for (
          var b = ma, c = ['Array', 'prototype', 'fill'], d = 0;
          d < c.length - 1;
          d++
        ) {
          var e = c[d];
          e in b || (b[e] = {});
          b = b[e];
        }
        c = c[c.length - 1];
        d = b[c];
        a = a(d);
        a != d && null != a && na(b, c, { writable: !0, value: a });
      }
    }
    oa(function (a) {
      return a
        ? a
        : function (a, c, d) {
            var b = this.length || 0;
            0 > c && (c = Math.max(0, b + c));
            if (null == d || d > b) d = b;
            d = Number(d);
            0 > d && (d = Math.max(0, b + d));
            for (c = Number(c || 0); c < d; c++) this[c] = a;
            return this;
          };
    });
    var x =
      ('object' === typeof self && self.self === self && self) ||
      ('object' === typeof global && global.global === global && global) ||
      ('object' === typeof window && window.window === window && window) ||
      {};
    void 0 === x.requestAnimationFrame &&
      (x.requestAnimationFrame = x.setImmediate);
    function qa() {}
    function ra(a, b) {
      var c = -1;
      return function () {
        var d = this,
          e = arguments;
        -1 !== c && x.clearTimeout(c);
        c = sa(function () {
          c = -1;
          a.apply(d, e);
        }, b);
      };
    }
    function sa(a, b) {
      return x.setTimeout(a, b);
    }
    function ta(a) {
      return x.document.createElement(a);
    }
    function B(a) {
      throw Error(a);
    }
    function ua(a, b) {
      a =
        'The object is frozen, so its properties cannot be set: ' + a.toString();
      void 0 !== b && (a += '  to value: ' + b);
      B(a);
    }
    function va(a, b, c, d) {
      c =
        null === c
          ? '*'
          : 'string' === typeof c
          ? c
          : 'function' === typeof c && 'string' === typeof c.className
          ? c.className
          : '';
      void 0 !== d && (c += '.' + d);
      B(c + ' is not in the range ' + b + ': ' + a);
    }
    function wa(a) {
      x.console && x.console.log(a);
    }
    function ya() {
      x.console &&
        x.console.log(
          'Warning: List/Map/Set constructors no longer take an argument that enforces type.Instead they take an optional collection of Values to add to the collection. See 2.0 changelog for details.',
        );
    }
    function za(a) {
      return 'object' === typeof a && null !== a;
    }
    function Aa(a) {
      return (
        Array.isArray(a) ||
        (x.NodeList && a instanceof x.NodeList) ||
        (x.HTMLCollection && a instanceof x.HTMLCollection)
      );
    }
    function Ba(a) {
      return Array.prototype.slice.call(a);
    }
    function Ca(a, b, c) {
      Array.isArray(a)
        ? b >= a.length
          ? a.push(c)
          : a.splice(b, 0, c)
        : B(
            'Cannot insert an object into an HTMLCollection or NodeList: ' +
              c +
              ' at ' +
              b,
          );
    }
    function Da(a, b) {
      Array.isArray(a)
        ? b >= a.length
          ? a.pop()
          : a.splice(b, 1)
        : B('Cannot remove an object from an HTMLCollection or NodeList at ' + b);
    }
    function Ea() {
      var a = Ga.pop();
      return void 0 === a ? [] : a;
    }
    function Ha(a) {
      a.length = 0;
      Ga.push(a);
    }
    function Ia(a) {
      if ('function' === typeof a) {
        if (a.className) return a.className;
        if (a.name) return a.name;
        var b = a.toString();
        b = b.substring(9, b.indexOf('(')).trim();
        if ('' !== b) return (a._className = b);
      } else if (za(a) && a.constructor) return Ia(a.constructor);
      return typeof a;
    }
    function Ja(a) {
      var b = a;
      za(a) &&
        (a.text
          ? (b = a.text)
          : a.name
          ? (b = a.name)
          : void 0 !== a.key
          ? (b = a.key)
          : void 0 !== a.id
          ? (b = a.id)
          : a.constructor === Object &&
            (a.Text
              ? (b = a.Text)
              : a.Name
              ? (b = a.Name)
              : void 0 !== a.Key
              ? (b = a.Key)
              : void 0 !== a.Id
              ? (b = a.Id)
              : void 0 !== a.ID && (b = a.ID)));
      return void 0 === b ? 'undefined' : null === b ? 'null' : b.toString();
    }
    function Ka(a, b) {
      if (a.hasOwnProperty(b)) return !0;
      for (a = Object.getPrototypeOf(a); a && a !== Function; ) {
        if (a.hasOwnProperty(b)) return !0;
        var c = a.HA;
        if (c && c[b]) return !0;
        a = Object.getPrototypeOf(a);
      }
      return !1;
    }
    function La(a, b, c) {
      Object.defineProperty(Oa.prototype, a, { get: b, set: c });
    }
    function Pa() {
      var a = Qa;
      if (0 === a.length)
        for (
          var b = x.document.getElementsByTagName('canvas'), c = b.length, d = 0;
          d < c;
          d++
        ) {
          var e = b[d];
          e.parentElement && e.parentElement.B && a.push(e.parentElement.B);
        }
      return a;
    }
    function Ra(a) {
      for (var b = [], c = 0; 256 > c; c++)
        b['0123456789abcdef'.charAt(c >> 4) + '0123456789abcdef'.charAt(c & 15)] =
          String.fromCharCode(c);
      a.length % 2 && (a = '0' + a);
      c = [];
      for (var d = 0, e = 0; e < a.length; e += 2) c[d++] = b[a.substr(e, 2)];
      a = c.join('');
      a = '' === a ? '0' : a;
      b = [];
      for (c = 0; 256 > c; c++) b[c] = c;
      for (c = d = 0; 256 > c; c++)
        (d = (d + b[c] + 119) % 256), (e = b[c]), (b[c] = b[d]), (b[d] = e);
      d = c = 0;
      for (var f = '', g = 0; g < a.length; g++)
        (c = (c + 1) % 256),
          (d = (d + b[c]) % 256),
          (e = b[c]),
          (b[c] = b[d]),
          (b[d] = e),
          (f += String.fromCharCode(a.charCodeAt(g) ^ b[(b[c] + b[d]) % 256]));
      return f;
    }
    var Sa =
        void 0 !== x.navigator && 0 < x.navigator.userAgent.indexOf('MSIE 9.0'),
      Ta =
        void 0 !== x.navigator && 0 < x.navigator.userAgent.indexOf('MSIE 10.0'),
      Ua =
        void 0 !== x.navigator && 0 < x.navigator.userAgent.indexOf('Trident/7'),
      Va = void 0 !== x.navigator && 0 < x.navigator.userAgent.indexOf('Edge/'),
      Wa =
        void 0 !== x.navigator &&
        void 0 !== x.navigator.platform &&
        0 <= x.navigator.platform.toUpperCase().indexOf('MAC'),
      Xa =
        void 0 !== x.navigator &&
        void 0 !== x.navigator.platform &&
        null !== x.navigator.platform.match(/(iPhone|iPod|iPad)/i),
      Ga = [];
    Object.freeze([]);
    var Qa = [];
    qa.className = 'Util';
    qa.Dx = '32ab5ff3b26f42dc0ed90f21442913b5';
    qa.adym = 'gojs.net';
    qa.vfo = '28e647fdb6';
    qa.className = 'Util';
    function D(a, b, c) {
      Za(this);
      this.l = a;
      this.Ra = b;
      this.v = c;
    }
    D.prototype.toString = function () {
      return 'EnumValue.' + this.Ra;
    };
    function $a(a, b) {
      return void 0 === b || null === b || '' === b ? null : a[b];
    }
    ma.Object.defineProperties(D.prototype, {
      classType: {
        get: function () {
          return this.l;
        },
      },
      name: {
        get: function () {
          return this.Ra;
        },
      },
      value: {
        get: function () {
          return this.v;
        },
      },
    });
    D.className = 'EnumValue';
    function cb() {
      this.Rw = [];
    }
    cb.prototype.toString = function () {
      return this.Rw.join('');
    };
    cb.prototype.add = function (a) {
      '' !== a && this.Rw.push(a);
    };
    cb.className = 'StringBuilder';
    function db() {}
    db.className = 'PropertyCollection';
    function eb() {}
    eb.prototype.reset = function () {};
    eb.prototype.next = function () {
      return !1;
    };
    eb.prototype.dd = function () {
      return !1;
    };
    eb.prototype.first = function () {
      return null;
    };
    eb.prototype.any = function () {
      return !1;
    };
    eb.prototype.all = function () {
      return !0;
    };
    eb.prototype.each = function () {
      return this;
    };
    eb.prototype.map = function () {
      return this;
    };
    eb.prototype.filter = function () {
      return this;
    };
    eb.prototype.Bd = function () {};
    eb.prototype.toString = function () {
      return 'EmptyIterator';
    };
    ma.Object.defineProperties(eb.prototype, {
      iterator: {
        get: function () {
          return this;
        },
      },
      count: {
        get: function () {
          return 0;
        },
      },
    });
    eb.prototype.first = eb.prototype.first;
    eb.prototype.hasNext = eb.prototype.dd;
    eb.prototype.next = eb.prototype.next;
    eb.prototype.reset = eb.prototype.reset;
    var fb = null;
    eb.className = 'EmptyIterator';
    fb = new eb();
    function gb(a) {
      this.key = -1;
      this.value = a;
    }
    gb.prototype.reset = function () {
      this.key = -1;
    };
    gb.prototype.next = function () {
      return -1 === this.key ? ((this.key = 0), !0) : !1;
    };
    gb.prototype.dd = function () {
      return this.next();
    };
    gb.prototype.first = function () {
      this.key = 0;
      return this.value;
    };
    gb.prototype.any = function (a) {
      this.key = -1;
      return a(this.value);
    };
    gb.prototype.all = function (a) {
      this.key = -1;
      return a(this.value);
    };
    gb.prototype.each = function (a) {
      this.key = -1;
      a(this.value);
      return this;
    };
    gb.prototype.map = function (a) {
      return new gb(a(this.value));
    };
    gb.prototype.filter = function (a) {
      return a(this.value) ? new gb(this.value) : fb;
    };
    gb.prototype.Bd = function () {
      this.value = null;
    };
    gb.prototype.toString = function () {
      return 'SingletonIterator(' + this.value + ')';
    };
    ma.Object.defineProperties(gb.prototype, {
      iterator: {
        get: function () {
          return this;
        },
      },
      count: {
        get: function () {
          return 1;
        },
      },
    });
    gb.prototype.first = gb.prototype.first;
    gb.prototype.hasNext = gb.prototype.dd;
    gb.prototype.next = gb.prototype.next;
    gb.prototype.reset = gb.prototype.reset;
    gb.className = 'SingletonIterator';
    function ib(a) {
      this.ob = a;
      this.Ye = null;
      a.Ga = null;
      this.ia = a.xa;
      this.Pa = -1;
    }
    ib.prototype.reset = function () {
      var a = this.ob;
      a.Ga = null;
      this.ia = a.xa;
      this.Pa = -1;
    };
    ib.prototype.next = function () {
      var a = this.ob;
      if (a.xa !== this.ia && 0 > this.key) return !1;
      a = a.j;
      var b = a.length,
        c = ++this.Pa,
        d = this.Ye;
      if (null !== d)
        for (; c < b; ) {
          var e = a[c];
          if (d(e)) return (this.key = this.Pa = c), (this.value = e), !0;
          c++;
        }
      else {
        if (c < b) return (this.key = c), (this.value = a[c]), !0;
        this.Bd();
      }
      return !1;
    };
    ib.prototype.dd = function () {
      return this.next();
    };
    ib.prototype.first = function () {
      var a = this.ob;
      this.ia = a.xa;
      this.Pa = 0;
      a = a.j;
      var b = a.length,
        c = this.Ye;
      if (null !== c) {
        for (var d = 0; d < b; ) {
          var e = a[d];
          if (c(e)) return (this.key = this.Pa = d), (this.value = e);
          d++;
        }
        return null;
      }
      return 0 < b ? ((a = a[0]), (this.key = 0), (this.value = a)) : null;
    };
    ib.prototype.any = function (a) {
      var b = this.ob;
      b.Ga = null;
      this.Pa = -1;
      b = b.j;
      for (var c = b.length, d = this.Ye, e = 0; e < c; e++) {
        var f = b[e];
        if ((null === d || d(f)) && a(f)) return !0;
      }
      return !1;
    };
    ib.prototype.all = function (a) {
      var b = this.ob;
      b.Ga = null;
      this.Pa = -1;
      b = b.j;
      for (var c = b.length, d = this.Ye, e = 0; e < c; e++) {
        var f = b[e];
        if ((null === d || d(f)) && !a(f)) return !1;
      }
      return !0;
    };
    ib.prototype.each = function (a) {
      var b = this.ob;
      b.Ga = null;
      this.Pa = -1;
      b = b.j;
      for (var c = b.length, d = this.Ye, e = 0; e < c; e++) {
        var f = b[e];
        (null === d || d(f)) && a(f);
      }
      return this;
    };
    ib.prototype.map = function (a) {
      var b = this.ob;
      b.Ga = null;
      this.Pa = -1;
      var c = [];
      b = b.j;
      for (var d = b.length, e = this.Ye, f = 0; f < d; f++) {
        var g = b[f];
        (null === e || e(g)) && c.push(a(g));
      }
      a = new E();
      a.j = c;
      a.ib();
      return a.iterator;
    };
    ib.prototype.filter = function (a) {
      var b = this.ob;
      b.Ga = null;
      this.Pa = -1;
      var c = [];
      b = b.j;
      for (var d = b.length, e = this.Ye, f = 0; f < d; f++) {
        var g = b[f];
        (null === e || e(g)) && a(g) && c.push(g);
      }
      a = new E();
      a.j = c;
      a.ib();
      return a.iterator;
    };
    ib.prototype.Bd = function () {
      this.key = -1;
      this.value = null;
      this.ia = -1;
      this.Ye = null;
      this.ob.Ga = this;
    };
    ib.prototype.toString = function () {
      return 'ListIterator@' + this.Pa + '/' + this.ob.count;
    };
    ma.Object.defineProperties(ib.prototype, {
      iterator: {
        get: function () {
          return this;
        },
      },
      predicate: {
        get: function () {
          return this.Ye;
        },
        set: function (a) {
          this.Ye = a;
        },
      },
      count: {
        get: function () {
          var a = this.Ye;
          if (null !== a) {
            for (var b = 0, c = this.ob.j, d = c.length, e = 0; e < d; e++)
              a(c[e]) && b++;
            return b;
          }
          return this.ob.j.length;
        },
      },
    });
    ib.prototype.first = ib.prototype.first;
    ib.prototype.hasNext = ib.prototype.dd;
    ib.prototype.next = ib.prototype.next;
    ib.prototype.reset = ib.prototype.reset;
    ib.className = 'ListIterator';
    function jb(a) {
      this.ob = a;
      a.dh = null;
      this.ia = a.xa;
      this.Pa = a.j.length;
    }
    jb.prototype.reset = function () {
      var a = this.ob;
      a.dh = null;
      this.ia = a.xa;
      this.Pa = a.j.length;
    };
    jb.prototype.next = function () {
      var a = this.ob;
      if (a.xa !== this.ia && 0 > this.key) return !1;
      var b = --this.Pa;
      if (0 <= b) return (this.key = b), (this.value = a.j[b]), !0;
      this.Bd();
      return !1;
    };
    jb.prototype.dd = function () {
      return this.next();
    };
    jb.prototype.first = function () {
      var a = this.ob;
      this.ia = a.xa;
      var b = a.j;
      this.Pa = a = b.length - 1;
      return 0 <= a ? ((b = b[a]), (this.key = a), (this.value = b)) : null;
    };
    jb.prototype.any = function (a) {
      var b = this.ob;
      b.dh = null;
      b = b.j;
      var c = b.length;
      this.Pa = c;
      for (--c; 0 <= c; c--) if (a(b[c])) return !0;
      return !1;
    };
    jb.prototype.all = function (a) {
      var b = this.ob;
      b.dh = null;
      b = b.j;
      var c = b.length;
      this.Pa = c;
      for (--c; 0 <= c; c--) if (!a(b[c])) return !1;
      return !0;
    };
    jb.prototype.each = function (a) {
      var b = this.ob;
      b.dh = null;
      b = b.j;
      var c = b.length;
      this.Pa = c;
      for (--c; 0 <= c; c--) a(b[c]);
      return this;
    };
    jb.prototype.map = function (a) {
      var b = this.ob;
      b.dh = null;
      var c = [];
      b = b.j;
      var d = b.length;
      this.Pa = d;
      for (--d; 0 <= d; d--) c.push(a(b[d]));
      a = new E();
      a.j = c;
      a.ib();
      return a.iterator;
    };
    jb.prototype.filter = function (a) {
      var b = this.ob;
      b.dh = null;
      var c = [];
      b = b.j;
      var d = b.length;
      this.Pa = d;
      for (--d; 0 <= d; d--) {
        var e = b[d];
        a(e) && c.push(e);
      }
      a = new E();
      a.j = c;
      a.ib();
      return a.iterator;
    };
    jb.prototype.Bd = function () {
      this.key = -1;
      this.value = null;
      this.ia = -1;
      this.ob.dh = this;
    };
    jb.prototype.toString = function () {
      return 'ListIteratorBackwards(' + this.Pa + '/' + this.ob.count + ')';
    };
    ma.Object.defineProperties(jb.prototype, {
      iterator: {
        get: function () {
          return this;
        },
      },
      count: {
        get: function () {
          return this.ob.j.length;
        },
      },
    });
    jb.prototype.first = jb.prototype.first;
    jb.prototype.hasNext = jb.prototype.dd;
    jb.prototype.next = jb.prototype.next;
    jb.prototype.reset = jb.prototype.reset;
    jb.className = 'ListIteratorBackwards';
    function E(a) {
      Za(this);
      this.s = !1;
      this.j = [];
      this.xa = 0;
      this.dh = this.Ga = null;
      void 0 !== a &&
        ('function' === typeof a || 'string' === typeof a
          ? ya()
          : this.addAll(a));
    }
    t = E.prototype;
    t.ib = function () {
      var a = this.xa;
      a++;
      999999999 < a && (a = 0);
      this.xa = a;
    };
    t.freeze = function () {
      this.s = !0;
      return this;
    };
    t.ea = function () {
      this.s = !1;
      return this;
    };
    t.toString = function () {
      return 'List()#' + lb(this);
    };
    t.add = function (a) {
      if (null === a) return this;
      this.s && ua(this, a);
      this.j.push(a);
      this.ib();
      return this;
    };
    t.push = function (a) {
      this.add(a);
    };
    t.addAll = function (a) {
      if (null === a) return this;
      this.s && ua(this);
      var b = this.j;
      if (Aa(a)) for (var c = a.length, d = 0; d < c; d++) b.push(a[d]);
      else for (a = a.iterator; a.next(); ) b.push(a.value);
      this.ib();
      return this;
    };
    t.clear = function () {
      this.s && ua(this);
      this.j.length = 0;
      this.ib();
    };
    t.contains = function (a) {
      return null === a ? !1 : -1 !== this.j.indexOf(a);
    };
    t.has = function (a) {
      return this.contains(a);
    };
    t.indexOf = function (a) {
      return null === a ? -1 : this.j.indexOf(a);
    };
    t.L = function (a) {
      var b = this.j;
      (0 > a || a >= b.length) && va(a, '0 <= i < length', E, 'elt:i');
      return b[a];
    };
    t.get = function (a) {
      return this.L(a);
    };
    t.fd = function (a, b) {
      var c = this.j;
      (0 > a || a >= c.length) && va(a, '0 <= i < length', E, 'setElt:i');
      this.s && ua(this, a);
      c[a] = b;
    };
    t.set = function (a, b) {
      this.fd(a, b);
    };
    t.first = function () {
      var a = this.j;
      return 0 === a.length ? null : a[0];
    };
    t.Wb = function () {
      var a = this.j,
        b = a.length;
      return 0 < b ? a[b - 1] : null;
    };
    t.pop = function () {
      this.s && ua(this);
      var a = this.j;
      return 0 < a.length ? a.pop() : null;
    };
    E.prototype.any = function (a) {
      for (var b = this.j, c = b.length, d = 0; d < c; d++)
        if (a(b[d])) return !0;
      return !1;
    };
    E.prototype.all = function (a) {
      for (var b = this.j, c = b.length, d = 0; d < c; d++)
        if (!a(b[d])) return !1;
      return !0;
    };
    E.prototype.each = function (a) {
      for (var b = this.j, c = b.length, d = 0; d < c; d++) a(b[d]);
      return this;
    };
    E.prototype.map = function (a) {
      for (var b = new E(), c = [], d = this.j, e = d.length, f = 0; f < e; f++)
        c.push(a(d[f]));
      b.j = c;
      b.ib();
      return b;
    };
    E.prototype.filter = function (a) {
      for (var b = new E(), c = [], d = this.j, e = d.length, f = 0; f < e; f++) {
        var g = d[f];
        a(g) && c.push(g);
      }
      b.j = c;
      b.ib();
      return b;
    };
    t = E.prototype;
    t.Lb = function (a, b) {
      0 > a && va(a, '>= 0', E, 'insertAt:i');
      this.s && ua(this, a);
      var c = this.j;
      a >= c.length ? c.push(b) : c.splice(a, 0, b);
      this.ib();
    };
    t.remove = function (a) {
      if (null === a) return !1;
      this.s && ua(this, a);
      var b = this.j;
      a = b.indexOf(a);
      if (-1 === a) return !1;
      a === b.length - 1 ? b.pop() : b.splice(a, 1);
      this.ib();
      return !0;
    };
    t.delete = function (a) {
      return this.remove(a);
    };
    t.mb = function (a) {
      var b = this.j;
      (0 > a || a >= b.length) && va(a, '0 <= i < length', E, 'removeAt:i');
      this.s && ua(this, a);
      a === b.length - 1 ? b.pop() : b.splice(a, 1);
      this.ib();
    };
    t.removeRange = function (a, b) {
      var c = this.j,
        d = c.length;
      if (0 > a) a = 0;
      else if (a >= d) return this;
      if (0 > b) return this;
      b >= d && (b = d - 1);
      if (a > b) return this;
      this.s && ua(this);
      for (var e = a, f = b + 1; f < d; ) c[e++] = c[f++];
      c.length = d - (b - a + 1);
      this.ib();
      return this;
    };
    E.prototype.copy = function () {
      var a = new E(),
        b = this.j;
      0 < b.length && (a.j = Array.prototype.slice.call(b));
      return a;
    };
    t = E.prototype;
    t.na = function () {
      for (var a = this.j, b = this.count, c = Array(b), d = 0; d < b; d++)
        c[d] = a[d];
      return c;
    };
    t.pw = function () {
      for (var a = new F(), b = this.j, c = this.count, d = 0; d < c; d++)
        a.add(b[d]);
      return a;
    };
    t.sort = function (a) {
      this.s && ua(this);
      this.j.sort(a);
      this.ib();
      return this;
    };
    t.dj = function (a, b, c) {
      var d = this.j,
        e = d.length;
      void 0 === b && (b = 0);
      void 0 === c && (c = e);
      this.s && ua(this);
      var f = c - b;
      if (1 >= f) return this;
      (0 > b || b >= e - 1) && va(b, '0 <= from < length', E, 'sortRange:from');
      if (2 === f)
        return (
          (c = d[b]),
          (e = d[b + 1]),
          0 < a(c, e) && ((d[b] = e), (d[b + 1] = c), this.ib()),
          this
        );
      if (0 === b)
        if (c >= e) d.sort(a);
        else for (b = d.slice(0, c), b.sort(a), a = 0; a < c; a++) d[a] = b[a];
      else if (c >= e)
        for (c = d.slice(b), c.sort(a), a = b; a < e; a++) d[a] = c[a - b];
      else for (e = d.slice(b, c), e.sort(a), a = b; a < c; a++) d[a] = e[a - b];
      this.ib();
      return this;
    };
    t.reverse = function () {
      this.s && ua(this);
      this.j.reverse();
      this.ib();
      return this;
    };
    ma.Object.defineProperties(E.prototype, {
      _dataArray: {
        get: function () {
          return this.j;
        },
      },
      count: {
        get: function () {
          return this.j.length;
        },
      },
      size: {
        get: function () {
          return this.j.length;
        },
      },
      length: {
        get: function () {
          return this.j.length;
        },
      },
      iterator: {
        get: function () {
          if (0 >= this.j.length) return fb;
          var a = this.Ga;
          return null !== a ? (a.reset(), a) : new ib(this);
        },
      },
      iteratorBackwards: {
        get: function () {
          if (0 >= this.j.length) return fb;
          var a = this.dh;
          return null !== a ? (a.reset(), a) : new jb(this);
        },
      },
    });
    E.prototype.reverse = E.prototype.reverse;
    E.prototype.sortRange = E.prototype.dj;
    E.prototype.sort = E.prototype.sort;
    E.prototype.toSet = E.prototype.pw;
    E.prototype.toArray = E.prototype.na;
    E.prototype.removeRange = E.prototype.removeRange;
    E.prototype.removeAt = E.prototype.mb;
    E.prototype['delete'] = E.prototype.delete;
    E.prototype.remove = E.prototype.remove;
    E.prototype.insertAt = E.prototype.Lb;
    E.prototype.pop = E.prototype.pop;
    E.prototype.last = E.prototype.Wb;
    E.prototype.first = E.prototype.first;
    E.prototype.set = E.prototype.set;
    E.prototype.setElt = E.prototype.fd;
    E.prototype.get = E.prototype.get;
    E.prototype.elt = E.prototype.L;
    E.prototype.indexOf = E.prototype.indexOf;
    E.prototype.has = E.prototype.has;
    E.prototype.contains = E.prototype.contains;
    E.prototype.clear = E.prototype.clear;
    E.prototype.addAll = E.prototype.addAll;
    E.prototype.push = E.prototype.push;
    E.prototype.add = E.prototype.add;
    E.prototype.thaw = E.prototype.ea;
    E.prototype.freeze = E.prototype.freeze;
    E.className = 'List';
    function nb(a) {
      this.rg = a;
      a.Ga = null;
      this.ia = a.xa;
      this.la = null;
    }
    nb.prototype.reset = function () {
      var a = this.rg;
      a.Ga = null;
      this.ia = a.xa;
      this.la = null;
    };
    nb.prototype.next = function () {
      var a = this.rg;
      if (a.xa !== this.ia && null === this.key) return !1;
      var b = this.la;
      b = null === b ? a.ba : b.oa;
      if (null !== b)
        return (this.la = b), (this.value = b.value), (this.key = b.key), !0;
      this.Bd();
      return !1;
    };
    nb.prototype.dd = function () {
      return this.next();
    };
    nb.prototype.first = function () {
      var a = this.rg;
      this.ia = a.xa;
      a = a.ba;
      if (null !== a) {
        this.la = a;
        var b = a.value;
        this.key = a.key;
        return (this.value = b);
      }
      return null;
    };
    nb.prototype.any = function (a) {
      var b = this.rg;
      this.la = b.Ga = null;
      for (b = b.ba; null !== b; ) {
        if (a(b.value)) return !0;
        b = b.oa;
      }
      return !1;
    };
    nb.prototype.all = function (a) {
      var b = this.rg;
      this.la = b.Ga = null;
      for (b = b.ba; null !== b; ) {
        if (!a(b.value)) return !1;
        b = b.oa;
      }
      return !0;
    };
    nb.prototype.each = function (a) {
      var b = this.rg;
      this.la = b.Ga = null;
      for (b = b.ba; null !== b; ) a(b.value), (b = b.oa);
      return this;
    };
    nb.prototype.map = function (a) {
      var b = this.rg;
      b.Ga = null;
      var c = new E();
      for (b = b.ba; null !== b; ) c.add(a(b.value)), (b = b.oa);
      return c.iterator;
    };
    nb.prototype.filter = function (a) {
      var b = this.rg;
      b.Ga = null;
      var c = new E();
      for (b = b.ba; null !== b; ) {
        var d = b.value;
        a(d) && c.add(d);
        b = b.oa;
      }
      return c.iterator;
    };
    nb.prototype.Bd = function () {
      this.value = this.key = null;
      this.ia = -1;
      this.rg.Ga = this;
    };
    nb.prototype.toString = function () {
      return null !== this.la ? 'SetIterator@' + this.la.value : 'SetIterator';
    };
    ma.Object.defineProperties(nb.prototype, {
      iterator: {
        get: function () {
          return this;
        },
      },
      count: {
        get: function () {
          return this.rg.Db;
        },
      },
    });
    nb.prototype.first = nb.prototype.first;
    nb.prototype.hasNext = nb.prototype.dd;
    nb.prototype.next = nb.prototype.next;
    nb.prototype.reset = nb.prototype.reset;
    nb.className = 'SetIterator';
    function F(a) {
      Za(this);
      this.s = !1;
      this.Eb = {};
      this.Db = 0;
      this.Ga = null;
      this.xa = 0;
      this.Se = this.ba = null;
      void 0 !== a &&
        ('function' === typeof a || 'string' === typeof a
          ? ya()
          : this.addAll(a));
    }
    t = F.prototype;
    t.ib = function () {
      var a = this.xa;
      a++;
      999999999 < a && (a = 0);
      this.xa = a;
    };
    t.freeze = function () {
      this.s = !0;
      return this;
    };
    t.ea = function () {
      this.s = !1;
      return this;
    };
    t.toString = function () {
      return 'Set()#' + lb(this);
    };
    t.add = function (a) {
      if (null === a) return this;
      this.s && ua(this, a);
      var b = a;
      za(a) && (b = ob(a));
      void 0 === this.Eb[b] &&
        (this.Db++,
        (a = new pb(a, a)),
        (this.Eb[b] = a),
        (b = this.Se),
        null === b ? (this.ba = a) : ((a.Fl = b), (b.oa = a)),
        (this.Se = a),
        this.ib());
      return this;
    };
    t.addAll = function (a) {
      if (null === a) return this;
      this.s && ua(this);
      if (Aa(a)) for (var b = a.length, c = 0; c < b; c++) this.add(a[c]);
      else for (a = a.iterator; a.next(); ) this.add(a.value);
      return this;
    };
    t.contains = function (a) {
      if (null === a) return !1;
      var b = a;
      return za(a) && ((b = lb(a)), void 0 === b) ? !1 : void 0 !== this.Eb[b];
    };
    t.has = function (a) {
      return this.contains(a);
    };
    t.Wy = function (a) {
      if (null === a) return !0;
      for (a = a.iterator; a.next(); ) if (!this.contains(a.value)) return !1;
      return !0;
    };
    t.Xy = function (a) {
      if (null === a) return !0;
      for (a = a.iterator; a.next(); ) if (this.contains(a.value)) return !0;
      return !1;
    };
    t.first = function () {
      var a = this.ba;
      return null === a ? null : a.value;
    };
    F.prototype.any = function (a) {
      for (var b = this.ba; null !== b; ) {
        if (a(b.value)) return !0;
        b = b.oa;
      }
      return !1;
    };
    F.prototype.all = function (a) {
      for (var b = this.ba; null !== b; ) {
        if (!a(b.value)) return !1;
        b = b.oa;
      }
      return !0;
    };
    F.prototype.each = function (a) {
      for (var b = this.ba; null !== b; ) a(b.value), (b = b.oa);
      return this;
    };
    F.prototype.map = function (a) {
      for (var b = new F(), c = this.ba; null !== c; )
        b.add(a(c.value)), (c = c.oa);
      return b;
    };
    F.prototype.filter = function (a) {
      for (var b = new F(), c = this.ba; null !== c; ) {
        var d = c.value;
        a(d) && b.add(d);
        c = c.oa;
      }
      return b;
    };
    t = F.prototype;
    t.remove = function (a) {
      if (null === a) return !1;
      this.s && ua(this, a);
      var b = a;
      if (za(a) && ((b = lb(a)), void 0 === b)) return !1;
      a = this.Eb[b];
      if (void 0 === a) return !1;
      var c = a.oa,
        d = a.Fl;
      null !== c && (c.Fl = d);
      null !== d && (d.oa = c);
      this.ba === a && (this.ba = c);
      this.Se === a && (this.Se = d);
      delete this.Eb[b];
      this.Db--;
      this.ib();
      return !0;
    };
    t.delete = function (a) {
      return this.remove(a);
    };
    t.Eq = function (a) {
      if (null === a) return this;
      this.s && ua(this);
      if (Aa(a)) for (var b = a.length, c = 0; c < b; c++) this.remove(a[c]);
      else for (a = a.iterator; a.next(); ) this.remove(a.value);
      return this;
    };
    t.sA = function (a) {
      if (null === a || 0 === this.count) return this;
      this.s && ua(this);
      var b = new F();
      b.addAll(a);
      a = [];
      for (var c = this.iterator; c.next(); ) {
        var d = c.value;
        b.contains(d) || a.push(d);
      }
      this.Eq(a);
      return this;
    };
    t.clear = function () {
      this.s && ua(this);
      this.Eb = {};
      this.Db = 0;
      null !== this.Ga && this.Ga.reset();
      this.Se = this.ba = null;
      this.ib();
    };
    F.prototype.copy = function () {
      var a = new F(),
        b = this.Eb,
        c;
      for (c in b) a.add(b[c].value);
      return a;
    };
    F.prototype.na = function () {
      var a = Array(this.Db),
        b = this.Eb,
        c = 0,
        d;
      for (d in b) (a[c] = b[d].value), c++;
      return a;
    };
    F.prototype.ow = function () {
      var a = new E(),
        b = this.Eb,
        c;
      for (c in b) a.add(b[c].value);
      return a;
    };
    function Za(a) {
      a.__gohashid = qb++;
    }
    function ob(a) {
      var b = a.__gohashid;
      void 0 === b && ((b = qb++), (a.__gohashid = b));
      return b;
    }
    function lb(a) {
      return a.__gohashid;
    }
    ma.Object.defineProperties(F.prototype, {
      count: {
        get: function () {
          return this.Db;
        },
      },
      size: {
        get: function () {
          return this.Db;
        },
      },
      iterator: {
        get: function () {
          if (0 >= this.Db) return fb;
          var a = this.Ga;
          return null !== a ? (a.reset(), a) : new nb(this);
        },
      },
    });
    F.prototype.toList = F.prototype.ow;
    F.prototype.toArray = F.prototype.na;
    F.prototype.clear = F.prototype.clear;
    F.prototype.retainAll = F.prototype.sA;
    F.prototype.removeAll = F.prototype.Eq;
    F.prototype['delete'] = F.prototype.delete;
    F.prototype.remove = F.prototype.remove;
    F.prototype.first = F.prototype.first;
    F.prototype.containsAny = F.prototype.Xy;
    F.prototype.containsAll = F.prototype.Wy;
    F.prototype.has = F.prototype.has;
    F.prototype.contains = F.prototype.contains;
    F.prototype.addAll = F.prototype.addAll;
    F.prototype.add = F.prototype.add;
    F.prototype.thaw = F.prototype.ea;
    F.prototype.freeze = F.prototype.freeze;
    var qb = 1;
    F.className = 'Set';
    F.uniqueHash = Za;
    F.hashIdUnique = ob;
    F.hashId = lb;
    function sb(a) {
      this.fa = a;
      this.ia = a.xa;
      this.la = null;
    }
    sb.prototype.reset = function () {
      this.ia = this.fa.xa;
      this.la = null;
    };
    sb.prototype.next = function () {
      var a = this.fa;
      if (a.xa !== this.ia && null === this.key) return !1;
      var b = this.la;
      b = null === b ? a.ba : b.oa;
      if (null !== b)
        return (this.la = b), (this.value = this.key = a = b.key), !0;
      this.Bd();
      return !1;
    };
    sb.prototype.dd = function () {
      return this.next();
    };
    sb.prototype.first = function () {
      var a = this.fa;
      this.ia = a.xa;
      a = a.ba;
      return null !== a
        ? ((this.la = a), (this.value = this.key = a = a.key))
        : null;
    };
    sb.prototype.any = function (a) {
      var b = this.fa;
      this.la = null;
      for (b = b.ba; null !== b; ) {
        if (a(b.key)) return !0;
        b = b.oa;
      }
      return !1;
    };
    sb.prototype.all = function (a) {
      var b = this.fa;
      this.la = null;
      for (b = b.ba; null !== b; ) {
        if (!a(b.key)) return !1;
        b = b.oa;
      }
      return !0;
    };
    sb.prototype.each = function (a) {
      var b = this.fa;
      this.la = null;
      for (b = b.ba; null !== b; ) a(b.key), (b = b.oa);
      return this;
    };
    sb.prototype.map = function (a) {
      var b = this.fa;
      this.la = null;
      var c = new E();
      for (b = b.ba; null !== b; ) c.add(a(b.key)), (b = b.oa);
      return c.iterator;
    };
    sb.prototype.filter = function (a) {
      var b = this.fa;
      this.la = null;
      var c = new E();
      for (b = b.ba; null !== b; ) {
        var d = b.key;
        a(d) && c.add(d);
        b = b.oa;
      }
      return c.iterator;
    };
    sb.prototype.Bd = function () {
      this.value = this.key = null;
      this.ia = -1;
    };
    sb.prototype.toString = function () {
      return null !== this.la
        ? 'MapKeySetIterator@' + this.la.value
        : 'MapKeySetIterator';
    };
    ma.Object.defineProperties(sb.prototype, {
      iterator: {
        get: function () {
          return this;
        },
      },
      count: {
        get: function () {
          return this.fa.Db;
        },
      },
    });
    sb.prototype.first = sb.prototype.first;
    sb.prototype.hasNext = sb.prototype.dd;
    sb.prototype.next = sb.prototype.next;
    sb.prototype.reset = sb.prototype.reset;
    sb.className = 'MapKeySetIterator';
    function tb(a) {
      F.call(this);
      Za(this);
      this.s = !0;
      this.fa = a;
    }
    la(tb, F);
    t = tb.prototype;
    t.freeze = function () {
      return this;
    };
    t.ea = function () {
      return this;
    };
    t.toString = function () {
      return 'MapKeySet(' + this.fa.toString() + ')';
    };
    t.add = function () {
      B('This Set is read-only: ' + this.toString());
      return this;
    };
    t.contains = function (a) {
      return this.fa.contains(a);
    };
    t.has = function (a) {
      return this.contains(a);
    };
    t.remove = function () {
      B('This Set is read-only: ' + this.toString());
      return !1;
    };
    t.delete = function (a) {
      return this.remove(a);
    };
    t.clear = function () {
      B('This Set is read-only: ' + this.toString());
    };
    t.first = function () {
      var a = this.fa.ba;
      return null !== a ? a.key : null;
    };
    tb.prototype.any = function (a) {
      for (var b = this.fa.ba; null !== b; ) {
        if (a(b.key)) return !0;
        b = b.oa;
      }
      return !1;
    };
    tb.prototype.all = function (a) {
      for (var b = this.fa.ba; null !== b; ) {
        if (!a(b.key)) return !1;
        b = b.oa;
      }
      return !0;
    };
    tb.prototype.each = function (a) {
      for (var b = this.fa.ba; null !== b; ) a(b.key), (b = b.oa);
      return this;
    };
    tb.prototype.map = function (a) {
      for (var b = new F(), c = this.fa.ba; null !== c; )
        b.add(a(c.key)), (c = c.oa);
      return b;
    };
    tb.prototype.filter = function (a) {
      for (var b = new F(), c = this.fa.ba; null !== c; ) {
        var d = c.key;
        a(d) && b.add(d);
        c = c.oa;
      }
      return b;
    };
    tb.prototype.copy = function () {
      return new tb(this.fa);
    };
    tb.prototype.pw = function () {
      var a = new F(),
        b = this.fa.Eb,
        c;
      for (c in b) a.add(b[c].key);
      return a;
    };
    tb.prototype.na = function () {
      var a = this.fa.Eb,
        b = Array(this.fa.Db),
        c = 0,
        d;
      for (d in a) (b[c] = a[d].key), c++;
      return b;
    };
    tb.prototype.ow = function () {
      var a = new E(),
        b = this.fa.Eb,
        c;
      for (c in b) a.add(b[c].key);
      return a;
    };
    ma.Object.defineProperties(tb.prototype, {
      count: {
        get: function () {
          return this.fa.Db;
        },
      },
      size: {
        get: function () {
          return this.fa.Db;
        },
      },
      iterator: {
        get: function () {
          return 0 >= this.fa.Db ? fb : new sb(this.fa);
        },
      },
    });
    tb.prototype.toList = tb.prototype.ow;
    tb.prototype.toArray = tb.prototype.na;
    tb.prototype.toSet = tb.prototype.pw;
    tb.prototype.first = tb.prototype.first;
    tb.prototype.clear = tb.prototype.clear;
    tb.prototype['delete'] = tb.prototype.delete;
    tb.prototype.remove = tb.prototype.remove;
    tb.prototype.has = tb.prototype.has;
    tb.prototype.contains = tb.prototype.contains;
    tb.prototype.add = tb.prototype.add;
    tb.prototype.thaw = tb.prototype.ea;
    tb.prototype.freeze = tb.prototype.freeze;
    tb.className = 'MapKeySet';
    function ub(a) {
      this.fa = a;
      a.Re = null;
      this.ia = a.xa;
      this.la = null;
    }
    ub.prototype.reset = function () {
      var a = this.fa;
      a.Re = null;
      this.ia = a.xa;
      this.la = null;
    };
    ub.prototype.next = function () {
      var a = this.fa;
      if (a.xa !== this.ia && null === this.key) return !1;
      var b = this.la;
      b = null === b ? a.ba : b.oa;
      if (null !== b)
        return (this.la = b), (this.value = b.value), (this.key = b.key), !0;
      this.Bd();
      return !1;
    };
    ub.prototype.dd = function () {
      return this.next();
    };
    ub.prototype.first = function () {
      var a = this.fa;
      this.ia = a.xa;
      a = a.ba;
      if (null !== a) {
        this.la = a;
        var b = a.value;
        this.key = a.key;
        return (this.value = b);
      }
      return null;
    };
    ub.prototype.any = function (a) {
      var b = this.fa;
      this.la = b.Re = null;
      for (b = b.ba; null !== b; ) {
        if (a(b.value)) return !0;
        b = b.oa;
      }
      return !1;
    };
    ub.prototype.all = function (a) {
      var b = this.fa;
      this.la = b.Re = null;
      for (b = b.ba; null !== b; ) {
        if (!a(b.value)) return !1;
        b = b.oa;
      }
      return !0;
    };
    ub.prototype.each = function (a) {
      var b = this.fa;
      this.la = b.Re = null;
      for (b = b.ba; null !== b; ) a(b.value), (b = b.oa);
      return this;
    };
    ub.prototype.map = function (a) {
      var b = this.fa;
      this.la = b.Re = null;
      var c = new E();
      for (b = b.ba; null !== b; ) c.add(a(b.value)), (b = b.oa);
      return c.iterator;
    };
    ub.prototype.filter = function (a) {
      var b = this.fa;
      this.la = b.Re = null;
      var c = new E();
      for (b = b.ba; null !== b; ) {
        var d = b.value;
        a(d) && c.add(d);
        b = b.oa;
      }
      return c.iterator;
    };
    ub.prototype.Bd = function () {
      this.value = this.key = null;
      this.ia = -1;
      this.fa.Re = this;
    };
    ub.prototype.toString = function () {
      return null !== this.la
        ? 'MapValueSetIterator@' + this.la.value
        : 'MapValueSetIterator';
    };
    ma.Object.defineProperties(ub.prototype, {
      iterator: {
        get: function () {
          return this;
        },
      },
      count: {
        get: function () {
          return this.fa.Db;
        },
      },
    });
    ub.prototype.first = ub.prototype.first;
    ub.prototype.hasNext = ub.prototype.dd;
    ub.prototype.next = ub.prototype.next;
    ub.prototype.reset = ub.prototype.reset;
    ub.className = 'MapValueSetIterator';
    function pb(a, b) {
      this.key = a;
      this.value = b;
      this.Fl = this.oa = null;
    }
    pb.prototype.toString = function () {
      return '{' + this.key + ':' + this.value + '}';
    };
    pb.className = 'KeyValuePair';
    function vb(a) {
      this.fa = a;
      a.Ga = null;
      this.ia = a.xa;
      this.la = null;
    }
    vb.prototype.reset = function () {
      var a = this.fa;
      a.Ga = null;
      this.ia = a.xa;
      this.la = null;
    };
    vb.prototype.next = function () {
      var a = this.fa;
      if (a.xa !== this.ia && null === this.key) return !1;
      var b = this.la;
      b = null === b ? a.ba : b.oa;
      if (null !== b)
        return (this.la = b), (this.key = b.key), (this.value = b.value), !0;
      this.Bd();
      return !1;
    };
    vb.prototype.dd = function () {
      return this.next();
    };
    vb.prototype.first = function () {
      var a = this.fa;
      this.ia = a.xa;
      a = a.ba;
      return null !== a
        ? ((this.la = a), (this.key = a.key), (this.value = a.value), a)
        : null;
    };
    vb.prototype.any = function (a) {
      var b = this.fa;
      this.la = b.Ga = null;
      for (b = b.ba; null !== b; ) {
        if (a(b)) return !0;
        b = b.oa;
      }
      return !1;
    };
    vb.prototype.all = function (a) {
      var b = this.fa;
      this.la = b.Ga = null;
      for (b = b.ba; null !== b; ) {
        if (!a(b)) return !1;
        b = b.oa;
      }
      return !0;
    };
    vb.prototype.each = function (a) {
      var b = this.fa;
      this.la = b.Ga = null;
      for (b = b.ba; null !== b; ) a(b), (b = b.oa);
      return this;
    };
    vb.prototype.map = function (a) {
      var b = this.fa;
      this.la = b.Ga = null;
      var c = new E();
      for (b = b.ba; null !== b; ) c.add(a(b)), (b = b.oa);
      return c.iterator;
    };
    vb.prototype.filter = function (a) {
      var b = this.fa;
      this.la = b.Ga = null;
      var c = new E();
      for (b = b.ba; null !== b; ) a(b) && c.add(b), (b = b.oa);
      return c.iterator;
    };
    vb.prototype.Bd = function () {
      this.value = this.key = null;
      this.ia = -1;
      this.fa.Ga = this;
    };
    vb.prototype.toString = function () {
      return null !== this.la ? 'MapIterator@' + this.la : 'MapIterator';
    };
    ma.Object.defineProperties(vb.prototype, {
      iterator: {
        get: function () {
          return this;
        },
      },
      count: {
        get: function () {
          return this.fa.Db;
        },
      },
    });
    vb.prototype.first = vb.prototype.first;
    vb.prototype.hasNext = vb.prototype.dd;
    vb.prototype.next = vb.prototype.next;
    vb.prototype.reset = vb.prototype.reset;
    vb.className = 'MapIterator';
    function G(a) {
      Za(this);
      this.s = !1;
      this.Eb = {};
      this.Db = 0;
      this.Re = this.Ga = null;
      this.xa = 0;
      this.Se = this.ba = null;
      void 0 !== a &&
        ('function' === typeof a || 'string' === typeof a
          ? ya()
          : this.addAll(a));
    }
    t = G.prototype;
    t.ib = function () {
      var a = this.xa;
      a++;
      999999999 < a && (a = 0);
      this.xa = a;
    };
    t.freeze = function () {
      this.s = !0;
      return this;
    };
    t.ea = function () {
      this.s = !1;
      return this;
    };
    t.toString = function () {
      return 'Map()#' + lb(this);
    };
    t.add = function (a, b) {
      this.s && ua(this, a);
      var c = a;
      za(a) && (c = ob(a));
      var d = this.Eb[c];
      void 0 === d
        ? (this.Db++,
          (a = new pb(a, b)),
          (this.Eb[c] = a),
          (c = this.Se),
          null === c ? (this.ba = a) : ((a.Fl = c), (c.oa = a)),
          (this.Se = a),
          this.ib())
        : (d.value = b);
      return this;
    };
    t.set = function (a, b) {
      return this.add(a, b);
    };
    t.addAll = function (a) {
      if (null === a) return this;
      if (Aa(a))
        for (var b = a.length, c = 0; c < b; c++) {
          var d = a[c];
          this.add(d.key, d.value);
        }
      else if (a instanceof G)
        for (a = a.iterator; a.next(); ) this.add(a.key, a.value);
      else
        for (a = a.iterator; a.next(); ) (b = a.value), this.add(b.key, b.value);
      return this;
    };
    t.first = function () {
      return this.ba;
    };
    G.prototype.any = function (a) {
      for (var b = this.ba; null !== b; ) {
        if (a(b)) return !0;
        b = b.oa;
      }
      return !1;
    };
    G.prototype.all = function (a) {
      for (var b = this.ba; null !== b; ) {
        if (!a(b)) return !1;
        b = b.oa;
      }
      return !0;
    };
    G.prototype.each = function (a) {
      for (var b = this.ba; null !== b; ) a(b), (b = b.oa);
      return this;
    };
    G.prototype.map = function (a) {
      for (var b = new G(), c = this.ba; null !== c; )
        b.add(c.key, a(c)), (c = c.oa);
      return b;
    };
    G.prototype.filter = function (a) {
      for (var b = new G(), c = this.ba; null !== c; )
        a(c) && b.add(c.key, c.value), (c = c.oa);
      return b;
    };
    t = G.prototype;
    t.contains = function (a) {
      var b = a;
      return za(a) && ((b = lb(a)), void 0 === b) ? !1 : void 0 !== this.Eb[b];
    };
    t.has = function (a) {
      return this.contains(a);
    };
    t.H = function (a) {
      var b = a;
      if (za(a) && ((b = lb(a)), void 0 === b)) return null;
      a = this.Eb[b];
      return void 0 === a ? null : a.value;
    };
    t.get = function (a) {
      return this.H(a);
    };
    t.remove = function (a) {
      if (null === a) return !1;
      this.s && ua(this, a);
      var b = a;
      if (za(a) && ((b = lb(a)), void 0 === b)) return !1;
      a = this.Eb[b];
      if (void 0 === a) return !1;
      var c = a.oa,
        d = a.Fl;
      null !== c && (c.Fl = d);
      null !== d && (d.oa = c);
      this.ba === a && (this.ba = c);
      this.Se === a && (this.Se = d);
      delete this.Eb[b];
      this.Db--;
      this.ib();
      return !0;
    };
    t.delete = function (a) {
      return this.remove(a);
    };
    t.clear = function () {
      this.s && ua(this);
      this.Eb = {};
      this.Db = 0;
      null !== this.Ga && this.Ga.reset();
      null !== this.Re && this.Re.reset();
      this.Se = this.ba = null;
      this.ib();
    };
    G.prototype.copy = function () {
      var a = new G(),
        b = this.Eb,
        c;
      for (c in b) {
        var d = b[c];
        a.add(d.key, d.value);
      }
      return a;
    };
    G.prototype.na = function () {
      var a = this.Eb,
        b = Array(this.Db),
        c = 0,
        d;
      for (d in a) {
        var e = a[d];
        b[c] = new pb(e.key, e.value);
        c++;
      }
      return b;
    };
    G.prototype.Df = function () {
      return new tb(this);
    };
    ma.Object.defineProperties(G.prototype, {
      count: {
        get: function () {
          return this.Db;
        },
      },
      size: {
        get: function () {
          return this.Db;
        },
      },
      iterator: {
        get: function () {
          if (0 >= this.count) return fb;
          var a = this.Ga;
          return null !== a ? (a.reset(), a) : new vb(this);
        },
      },
      iteratorKeys: {
        get: function () {
          return 0 >= this.count ? fb : new sb(this);
        },
      },
      iteratorValues: {
        get: function () {
          if (0 >= this.count) return fb;
          var a = this.Re;
          return null !== a ? (a.reset(), a) : new ub(this);
        },
      },
    });
    G.prototype.toKeySet = G.prototype.Df;
    G.prototype.toArray = G.prototype.na;
    G.prototype.clear = G.prototype.clear;
    G.prototype['delete'] = G.prototype.delete;
    G.prototype.remove = G.prototype.remove;
    G.prototype.get = G.prototype.get;
    G.prototype.getValue = G.prototype.H;
    G.prototype.has = G.prototype.has;
    G.prototype.contains = G.prototype.contains;
    G.prototype.first = G.prototype.first;
    G.prototype.addAll = G.prototype.addAll;
    G.prototype.set = G.prototype.set;
    G.prototype.add = G.prototype.add;
    G.prototype.thaw = G.prototype.ea;
    G.prototype.freeze = G.prototype.freeze;
    G.className = 'Map';
    function H(a, b) {
      void 0 === a
        ? (this.y = this.x = 0)
        : 'number' === typeof a && 'number' === typeof b
        ? ((this.x = a), (this.y = b))
        : B('Invalid arguments to Point constructor: ' + a + ', ' + b);
      this.s = !1;
    }
    H.prototype.assign = function (a) {
      this.x = a.x;
      this.y = a.y;
      return this;
    };
    H.prototype.h = function (a, b) {
      this.x = a;
      this.y = b;
      return this;
    };
    H.prototype.Fg = function (a, b) {
      this.x = a;
      this.y = b;
      return this;
    };
    H.prototype.set = function (a) {
      this.x = a.x;
      this.y = a.y;
      return this;
    };
    H.prototype.copy = function () {
      var a = new H();
      a.x = this.x;
      a.y = this.y;
      return a;
    };
    t = H.prototype;
    t.ca = function () {
      this.s = !0;
      Object.freeze(this);
      return this;
    };
    t.G = function () {
      return this.s || Object.isFrozen(this) ? this : this.copy().freeze();
    };
    t.freeze = function () {
      this.s = !0;
      return this;
    };
    t.ea = function () {
      Object.isFrozen(this) && B('cannot thaw constant: ' + this);
      this.s = !1;
      return this;
    };
    function wb(a) {
      if ('string' === typeof a) {
        a = a.split(' ');
        for (var b = 0, c = 0; '' === a[b]; ) b++;
        var d = a[b++];
        d && (c = parseFloat(d));
        for (var e = 0; '' === a[b]; ) b++;
        (d = a[b++]) && (e = parseFloat(d));
        return new H(c, e);
      }
      return new H();
    }
    function xb(a) {
      return a.x.toString() + ' ' + a.y.toString();
    }
    t.toString = function () {
      return 'Point(' + this.x + ',' + this.y + ')';
    };
    t.A = function (a) {
      return a instanceof H ? this.x === a.x && this.y === a.y : !1;
    };
    t.Qi = function (a, b) {
      return this.x === a && this.y === b;
    };
    t.Ma = function (a) {
      return J.w(this.x, a.x) && J.w(this.y, a.y);
    };
    t.add = function (a) {
      this.x += a.x;
      this.y += a.y;
      return this;
    };
    t.$d = function (a) {
      this.x -= a.x;
      this.y -= a.y;
      return this;
    };
    t.offset = function (a, b) {
      this.x += a;
      this.y += b;
      return this;
    };
    H.prototype.rotate = function (a) {
      if (0 === a) return this;
      var b = this.x,
        c = this.y;
      if (0 === b && 0 === c) return this;
      360 <= a ? (a -= 360) : 0 > a && (a += 360);
      if (90 === a) {
        a = 0;
        var d = 1;
      } else
        180 === a
          ? ((a = -1), (d = 0))
          : 270 === a
          ? ((a = 0), (d = -1))
          : ((d = (a * Math.PI) / 180), (a = Math.cos(d)), (d = Math.sin(d)));
      this.x = a * b - d * c;
      this.y = d * b + a * c;
      return this;
    };
    t = H.prototype;
    t.scale = function (a, b) {
      this.x *= a;
      this.y *= b;
      return this;
    };
    t.Ae = function (a) {
      var b = a.x - this.x;
      a = a.y - this.y;
      return b * b + a * a;
    };
    t.cd = function (a, b) {
      a -= this.x;
      b -= this.y;
      return a * a + b * b;
    };
    t.normalize = function () {
      var a = this.x,
        b = this.y,
        c = Math.sqrt(a * a + b * b);
      0 < c && ((this.x = a / c), (this.y = b / c));
      return this;
    };
    t.Ta = function (a) {
      return yb(a.x - this.x, a.y - this.y);
    };
    t.direction = function (a, b) {
      return yb(a - this.x, b - this.y);
    };
    function yb(a, b) {
      if (0 === a) return 0 < b ? 90 : 0 > b ? 270 : 0;
      if (0 === b) return 0 < a ? 0 : 180;
      if (isNaN(a) || isNaN(b)) return 0;
      var c = (180 * Math.atan(Math.abs(b / a))) / Math.PI;
      0 > a ? (c = 0 > b ? c + 180 : 180 - c) : 0 > b && (c = 360 - c);
      return c;
    }
    t.mA = function (a, b, c, d) {
      J.Mh(a, b, c, d, this.x, this.y, this);
      return this;
    };
    t.nA = function (a, b) {
      J.Mh(a.x, a.y, b.x, b.y, this.x, this.y, this);
      return this;
    };
    t.yA = function (a, b, c, d) {
      J.lq(this.x, this.y, a, b, c, d, this);
      return this;
    };
    t.zA = function (a, b) {
      J.lq(this.x, this.y, a.x, a.y, b.width, b.height, this);
      return this;
    };
    t.cj = function (a, b) {
      this.x = a.x + b.x * a.width + b.offsetX;
      this.y = a.y + b.y * a.height + b.offsetY;
      return this;
    };
    t.yk = function (a, b, c, d, e) {
      this.x = a + e.x * c + e.offsetX;
      this.y = b + e.y * d + e.offsetY;
      return this;
    };
    t.transform = function (a) {
      a.ra(this);
      return this;
    };
    function zb(a, b) {
      b.Wd(a);
      return a;
    }
    function Ab(a, b, c, d, e, f) {
      var g = e - c,
        h = f - d,
        k = g * g + h * h;
      c -= a;
      d -= b;
      var l = -c * g - d * h;
      if (0 >= l || l >= k)
        return (g = e - a), (h = f - b), Math.min(c * c + d * d, g * g + h * h);
      a = g * d - h * c;
      return (a * a) / k;
    }
    function Bb(a, b, c, d) {
      a = c - a;
      b = d - b;
      return a * a + b * b;
    }
    function Cb(a, b, c, d) {
      a = c - a;
      b = d - b;
      if (0 === a) return 0 < b ? 90 : 0 > b ? 270 : 0;
      if (0 === b) return 0 < a ? 0 : 180;
      if (isNaN(a) || isNaN(b)) return 0;
      d = (180 * Math.atan(Math.abs(b / a))) / Math.PI;
      0 > a ? (d = 0 > b ? d + 180 : 180 - d) : 0 > b && (d = 360 - d);
      return d;
    }
    t.u = function () {
      return isFinite(this.x) && isFinite(this.y);
    };
    H.alloc = function () {
      var a = Db.pop();
      return void 0 === a ? new H() : a;
    };
    H.allocAt = function (a, b) {
      var c = Db.pop();
      if (void 0 === c) return new H(a, b);
      c.x = a;
      c.y = b;
      return c;
    };
    H.free = function (a) {
      Db.push(a);
    };
    H.prototype.isReal = H.prototype.u;
    H.prototype.setSpot = H.prototype.yk;
    H.prototype.setRectSpot = H.prototype.cj;
    H.prototype.snapToGridPoint = H.prototype.zA;
    H.prototype.snapToGrid = H.prototype.yA;
    H.prototype.projectOntoLineSegmentPoint = H.prototype.nA;
    H.prototype.projectOntoLineSegment = H.prototype.mA;
    H.prototype.direction = H.prototype.direction;
    H.prototype.directionPoint = H.prototype.Ta;
    H.prototype.normalize = H.prototype.normalize;
    H.prototype.distanceSquared = H.prototype.cd;
    H.prototype.distanceSquaredPoint = H.prototype.Ae;
    H.prototype.scale = H.prototype.scale;
    H.prototype.rotate = H.prototype.rotate;
    H.prototype.offset = H.prototype.offset;
    H.prototype.subtract = H.prototype.$d;
    H.prototype.add = H.prototype.add;
    H.prototype.equalsApprox = H.prototype.Ma;
    H.prototype.equalTo = H.prototype.Qi;
    H.prototype.equals = H.prototype.A;
    H.prototype.set = H.prototype.set;
    H.prototype.setTo = H.prototype.Fg;
    var Fb = null,
      Gb = null,
      Hb = null,
      Ib = null,
      Jb = null,
      Db = [];
    H.className = 'Point';
    H.parse = wb;
    H.stringify = xb;
    H.distanceLineSegmentSquared = Ab;
    H.distanceSquared = Bb;
    H.direction = Cb;
    H.Origin = Fb = new H(0, 0).ca();
    H.InfiniteTopLeft = Gb = new H(-Infinity, -Infinity).ca();
    H.InfiniteBottomRight = Hb = new H(Infinity, Infinity).ca();
    H.SixPoint = Ib = new H(6, 6).ca();
    H.NoPoint = Jb = new H(NaN, NaN).ca();
    H.parse = wb;
    H.stringify = xb;
    H.distanceLineSegmentSquared = Ab;
    H.distanceSquared = Bb;
    H.direction = Cb;
    function L(a, b) {
      void 0 === a
        ? (this.height = this.width = 0)
        : 'number' === typeof a &&
          (0 <= a || isNaN(a)) &&
          'number' === typeof b &&
          (0 <= b || isNaN(b))
        ? ((this.width = a), (this.height = b))
        : B('Invalid arguments to Size constructor: ' + a + ', ' + b);
      this.s = !1;
    }
    var Kb, Lb, Mb, Nb, Ob, Pb, Qb;
    L.prototype.assign = function (a) {
      this.width = a.width;
      this.height = a.height;
      return this;
    };
    L.prototype.h = function (a, b) {
      this.width = a;
      this.height = b;
      return this;
    };
    L.prototype.Fg = function (a, b) {
      this.width = a;
      this.height = b;
      return this;
    };
    L.prototype.set = function (a) {
      this.width = a.width;
      this.height = a.height;
      return this;
    };
    L.prototype.copy = function () {
      var a = new L();
      a.width = this.width;
      a.height = this.height;
      return a;
    };
    t = L.prototype;
    t.ca = function () {
      this.s = !0;
      Object.freeze(this);
      return this;
    };
    t.G = function () {
      return this.s || Object.isFrozen(this) ? this : this.copy().freeze();
    };
    t.freeze = function () {
      this.s = !0;
      return this;
    };
    t.ea = function () {
      Object.isFrozen(this) && B('cannot thaw constant: ' + this);
      this.s = !1;
      return this;
    };
    function Sb(a) {
      if ('string' === typeof a) {
        a = a.split(' ');
        for (var b = 0, c = 0; '' === a[b]; ) b++;
        var d = a[b++];
        d && (c = parseFloat(d));
        for (var e = 0; '' === a[b]; ) b++;
        (d = a[b++]) && (e = parseFloat(d));
        return new L(c, e);
      }
      return new L();
    }
    function Tb(a) {
      return a.width.toString() + ' ' + a.height.toString();
    }
    t.toString = function () {
      return 'Size(' + this.width + ',' + this.height + ')';
    };
    t.A = function (a) {
      return a instanceof L
        ? this.width === a.width && this.height === a.height
        : !1;
    };
    t.Qi = function (a, b) {
      return this.width === a && this.height === b;
    };
    t.Ma = function (a) {
      return J.w(this.width, a.width) && J.w(this.height, a.height);
    };
    t.u = function () {
      return isFinite(this.width) && isFinite(this.height);
    };
    L.alloc = function () {
      var a = Ub.pop();
      return void 0 === a ? new L() : a;
    };
    L.free = function (a) {
      Ub.push(a);
    };
    L.prototype.isReal = L.prototype.u;
    L.prototype.equalsApprox = L.prototype.Ma;
    L.prototype.equalTo = L.prototype.Qi;
    L.prototype.equals = L.prototype.A;
    L.prototype.set = L.prototype.set;
    L.prototype.setTo = L.prototype.Fg;
    var Ub = [];
    L.className = 'Size';
    L.parse = Sb;
    L.stringify = Tb;
    L.ZeroSize = Kb = new L(0, 0).ca();
    L.OneSize = Lb = new L(1, 1).ca();
    L.SixSize = Mb = new L(6, 6).ca();
    L.EightSize = Nb = new L(8, 8).ca();
    L.TenSize = Ob = new L(10, 10).ca();
    L.InfiniteSize = Pb = new L(Infinity, Infinity).ca();
    L.NoSize = Qb = new L(NaN, NaN).ca();
    L.parse = Sb;
    L.stringify = Tb;
    function N(a, b, c, d) {
      void 0 === a
        ? (this.height = this.width = this.y = this.x = 0)
        : a instanceof H
        ? ((c = a.x),
          (a = a.y),
          b instanceof H
            ? ((d = b.x),
              (b = b.y),
              (this.x = Math.min(c, d)),
              (this.y = Math.min(a, b)),
              (this.width = Math.abs(c - d)),
              (this.height = Math.abs(a - b)))
            : b instanceof L
            ? ((this.x = c),
              (this.y = a),
              (this.width = b.width),
              (this.height = b.height))
            : B('Incorrect arguments supplied to Rect constructor'))
        : 'number' === typeof a &&
          'number' === typeof b &&
          'number' === typeof c &&
          (0 <= c || isNaN(c)) &&
          'number' === typeof d &&
          (0 <= d || isNaN(d))
        ? ((this.x = a), (this.y = b), (this.width = c), (this.height = d))
        : B(
            'Invalid arguments to Rect constructor: ' +
              a +
              ', ' +
              b +
              ', ' +
              c +
              ', ' +
              d,
          );
      this.s = !1;
    }
    t = N.prototype;
    t.assign = function (a) {
      this.x = a.x;
      this.y = a.y;
      this.width = a.width;
      this.height = a.height;
      return this;
    };
    t.h = function (a, b, c, d) {
      this.x = a;
      this.y = b;
      this.width = c;
      this.height = d;
      return this;
    };
    function Vb(a, b, c) {
      a.width = b;
      a.height = c;
    }
    t.Fg = function (a, b, c, d) {
      this.x = a;
      this.y = b;
      this.width = c;
      this.height = d;
      return this;
    };
    t.set = function (a) {
      this.x = a.x;
      this.y = a.y;
      this.width = a.width;
      this.height = a.height;
      return this;
    };
    t.gd = function (a) {
      this.x = a.x;
      this.y = a.y;
      return this;
    };
    t.wA = function (a) {
      this.width = a.width;
      this.height = a.height;
      return this;
    };
    N.prototype.copy = function () {
      var a = new N();
      a.x = this.x;
      a.y = this.y;
      a.width = this.width;
      a.height = this.height;
      return a;
    };
    t = N.prototype;
    t.ca = function () {
      this.s = !0;
      Object.freeze(this);
      return this;
    };
    t.G = function () {
      return this.s || Object.isFrozen(this) ? this : this.copy().freeze();
    };
    t.freeze = function () {
      this.s = !0;
      return this;
    };
    t.ea = function () {
      Object.isFrozen(this) && B('cannot thaw constant: ' + this);
      this.s = !1;
      return this;
    };
    function Wb(a) {
      if ('string' === typeof a) {
        a = a.split(' ');
        for (var b = 0, c = 0; '' === a[b]; ) b++;
        var d = a[b++];
        d && (c = parseFloat(d));
        for (var e = 0; '' === a[b]; ) b++;
        (d = a[b++]) && (e = parseFloat(d));
        for (var f = 0; '' === a[b]; ) b++;
        (d = a[b++]) && (f = parseFloat(d));
        for (var g = 0; '' === a[b]; ) b++;
        (d = a[b++]) && (g = parseFloat(d));
        return new N(c, e, f, g);
      }
      return new N();
    }
    function Yb(a) {
      return (
        a.x.toString() +
        ' ' +
        a.y.toString() +
        ' ' +
        a.width.toString() +
        ' ' +
        a.height.toString()
      );
    }
    t.toString = function () {
      return (
        'Rect(' +
        this.x +
        ',' +
        this.y +
        ',' +
        this.width +
        ',' +
        this.height +
        ')'
      );
    };
    t.A = function (a) {
      return a instanceof N
        ? this.x === a.x &&
            this.y === a.y &&
            this.width === a.width &&
            this.height === a.height
        : !1;
    };
    t.Qi = function (a, b, c, d) {
      return (
        this.x === a && this.y === b && this.width === c && this.height === d
      );
    };
    t.Ma = function (a) {
      return (
        J.w(this.x, a.x) &&
        J.w(this.y, a.y) &&
        J.w(this.width, a.width) &&
        J.w(this.height, a.height)
      );
    };
    function Zb(a, b) {
      return (
        J.$(a.x, b.x) &&
        J.$(a.y, b.y) &&
        J.$(a.width, b.width) &&
        J.$(a.height, b.height)
      );
    }
    t.aa = function (a) {
      return (
        this.x <= a.x &&
        this.x + this.width >= a.x &&
        this.y <= a.y &&
        this.y + this.height >= a.y
      );
    };
    t.qf = function (a) {
      return (
        this.x <= a.x &&
        a.x + a.width <= this.x + this.width &&
        this.y <= a.y &&
        a.y + a.height <= this.y + this.height
      );
    };
    t.contains = function (a, b, c, d) {
      void 0 === c && (c = 0);
      void 0 === d && (d = 0);
      return (
        this.x <= a &&
        a + c <= this.x + this.width &&
        this.y <= b &&
        b + d <= this.y + this.height
      );
    };
    t.offset = function (a, b) {
      this.x += a;
      this.y += b;
      return this;
    };
    t.Tc = function (a, b) {
      return $b(this, b, a, b, a);
    };
    t.bq = function (a) {
      return $b(this, a.top, a.right, a.bottom, a.left);
    };
    t.nw = function (a) {
      return $b(this, -a.top, -a.right, -a.bottom, -a.left);
    };
    t.Qz = function (a, b, c, d) {
      return $b(this, a, b, c, d);
    };
    function $b(a, b, c, d, e) {
      var f = a.width;
      c + e <= -f
        ? ((a.x += f / 2), (a.width = 0))
        : ((a.x -= e), (a.width += c + e));
      c = a.height;
      b + d <= -c
        ? ((a.y += c / 2), (a.height = 0))
        : ((a.y -= b), (a.height += b + d));
      return a;
    }
    t.Uz = function (a) {
      return ac(this, a.x, a.y, a.width, a.height);
    };
    t.Gv = function (a, b, c, d) {
      return ac(this, a, b, c, d);
    };
    function ac(a, b, c, d, e) {
      var f = Math.max(a.x, b),
        g = Math.max(a.y, c);
      b = Math.min(a.x + a.width, b + d);
      c = Math.min(a.y + a.height, c + e);
      a.x = f;
      a.y = g;
      a.width = Math.max(0, b - f);
      a.height = Math.max(0, c - g);
      return a;
    }
    t.Fc = function (a) {
      return this.Hv(a.x, a.y, a.width, a.height);
    };
    t.Hv = function (a, b, c, d) {
      var e = this.width,
        f = this.x;
      if (
        Infinity !== e &&
        Infinity !== c &&
        ((e += f), (c += a), isNaN(c) || isNaN(e) || f > c || a > e)
      )
        return !1;
      a = this.height;
      c = this.y;
      return Infinity !== a &&
        Infinity !== d &&
        ((a += c), (d += b), isNaN(d) || isNaN(a) || c > d || b > a)
        ? !1
        : !0;
    };
    function dc(a, b) {
      var c = a.width,
        d = a.x,
        e = b.x - 10;
      if (d > b.width + 10 + 10 + e || e > c + d) return !1;
      c = a.height;
      a = a.y;
      d = b.y - 10;
      return a > b.height + 10 + 10 + d || d > c + a ? !1 : !0;
    }
    t.Ge = function (a) {
      return ec(this, a.x, a.y, 0, 0);
    };
    t.Gc = function (a) {
      return ec(this, a.x, a.y, a.width, a.height);
    };
    t.uw = function (a, b, c, d) {
      void 0 === c && (c = 0);
      void 0 === d && (d = 0);
      return ec(this, a, b, c, d);
    };
    function ec(a, b, c, d, e) {
      var f = Math.min(a.x, b),
        g = Math.min(a.y, c);
      b = Math.max(a.x + a.width, b + d);
      c = Math.max(a.y + a.height, c + e);
      a.x = f;
      a.y = g;
      a.width = b - f;
      a.height = c - g;
      return a;
    }
    t.yk = function (a, b, c) {
      this.x = a - c.offsetX - c.x * this.width;
      this.y = b - c.offsetY - c.y * this.height;
      return this;
    };
    function fc(a, b, c, d, e, f, g, h) {
      void 0 === g && (g = 0);
      void 0 === h && (h = 0);
      return a <= e && e + g <= a + c && b <= f && f + h <= b + d;
    }
    function gc(a, b, c, d, e, f, g, h) {
      return a > g + e || e > c + a ? !1 : b > h + f || f > d + b ? !1 : !0;
    }
    t.u = function () {
      return (
        isFinite(this.x) &&
        isFinite(this.y) &&
        isFinite(this.width) &&
        isFinite(this.height)
      );
    };
    t.Wz = function () {
      return 0 === this.width && 0 === this.height;
    };
    N.alloc = function () {
      var a = hc.pop();
      return void 0 === a ? new N() : a;
    };
    N.allocAt = function (a, b, c, d) {
      var e = hc.pop();
      return void 0 === e ? new N(a, b, c, d) : e.h(a, b, c, d);
    };
    N.free = function (a) {
      hc.push(a);
    };
    ma.Object.defineProperties(N.prototype, {
      left: {
        get: function () {
          return this.x;
        },
        set: function (a) {
          this.x = a;
        },
      },
      top: {
        get: function () {
          return this.y;
        },
        set: function (a) {
          this.y = a;
        },
      },
      right: {
        get: function () {
          return this.x + this.width;
        },
        set: function (a) {
          this.x += a - (this.x + this.width);
        },
      },
      bottom: {
        get: function () {
          return this.y + this.height;
        },
        set: function (a) {
          this.y += a - (this.y + this.height);
        },
      },
      position: {
        get: function () {
          return new H(this.x, this.y);
        },
        set: function (a) {
          this.x = a.x;
          this.y = a.y;
        },
      },
      size: {
        get: function () {
          return new L(this.width, this.height);
        },
        set: function (a) {
          this.width = a.width;
          this.height = a.height;
        },
      },
      center: {
        get: function () {
          return new H(this.x + this.width / 2, this.y + this.height / 2);
        },
        set: function (a) {
          this.x = a.x - this.width / 2;
          this.y = a.y - this.height / 2;
        },
      },
      centerX: {
        get: function () {
          return this.x + this.width / 2;
        },
        set: function (a) {
          this.x = a - this.width / 2;
        },
      },
      centerY: {
        get: function () {
          return this.y + this.height / 2;
        },
        set: function (a) {
          this.y = a - this.height / 2;
        },
      },
    });
    N.prototype.isEmpty = N.prototype.Wz;
    N.prototype.isReal = N.prototype.u;
    N.prototype.setSpot = N.prototype.yk;
    N.prototype.union = N.prototype.uw;
    N.prototype.unionRect = N.prototype.Gc;
    N.prototype.unionPoint = N.prototype.Ge;
    N.prototype.intersects = N.prototype.Hv;
    N.prototype.intersectsRect = N.prototype.Fc;
    N.prototype.intersect = N.prototype.Gv;
    N.prototype.intersectRect = N.prototype.Uz;
    N.prototype.grow = N.prototype.Qz;
    N.prototype.subtractMargin = N.prototype.nw;
    N.prototype.addMargin = N.prototype.bq;
    N.prototype.inflate = N.prototype.Tc;
    N.prototype.offset = N.prototype.offset;
    N.prototype.contains = N.prototype.contains;
    N.prototype.containsRect = N.prototype.qf;
    N.prototype.containsPoint = N.prototype.aa;
    N.prototype.equalsApprox = N.prototype.Ma;
    N.prototype.equalTo = N.prototype.Qi;
    N.prototype.equals = N.prototype.A;
    N.prototype.setSize = N.prototype.wA;
    N.prototype.setPoint = N.prototype.gd;
    N.prototype.set = N.prototype.set;
    N.prototype.setTo = N.prototype.Fg;
    var mc = null,
      nc = null,
      hc = [];
    N.className = 'Rect';
    N.parse = Wb;
    N.stringify = Yb;
    N.contains = fc;
    N.intersects = gc;
    N.ZeroRect = mc = new N(0, 0, 0, 0).ca();
    N.NoRect = nc = new N(NaN, NaN, NaN, NaN).ca();
    N.parse = Wb;
    N.stringify = Yb;
    N.contains = fc;
    N.intersects = gc;
    function oc(a, b, c, d) {
      void 0 === a
        ? (this.left = this.bottom = this.right = this.top = 0)
        : void 0 === b
        ? (this.left = this.bottom = this.right = this.top = a)
        : void 0 === c
        ? ((this.top = a), (this.right = b), (this.bottom = a), (this.left = b))
        : void 0 !== d
        ? ((this.top = a), (this.right = b), (this.bottom = c), (this.left = d))
        : B(
            'Invalid arguments to Margin constructor: ' +
              a +
              ', ' +
              b +
              ', ' +
              c +
              ', ' +
              d,
          );
      this.s = !1;
    }
    oc.prototype.assign = function (a) {
      this.top = a.top;
      this.right = a.right;
      this.bottom = a.bottom;
      this.left = a.left;
      return this;
    };
    oc.prototype.Fg = function (a, b, c, d) {
      this.top = a;
      this.right = b;
      this.bottom = c;
      this.left = d;
      return this;
    };
    oc.prototype.set = function (a) {
      this.top = a.top;
      this.right = a.right;
      this.bottom = a.bottom;
      this.left = a.left;
      return this;
    };
    oc.prototype.copy = function () {
      var a = new oc();
      a.top = this.top;
      a.right = this.right;
      a.bottom = this.bottom;
      a.left = this.left;
      return a;
    };
    t = oc.prototype;
    t.ca = function () {
      this.s = !0;
      Object.freeze(this);
      return this;
    };
    t.G = function () {
      return this.s || Object.isFrozen(this) ? this : this.copy().freeze();
    };
    t.freeze = function () {
      this.s = !0;
      return this;
    };
    t.ea = function () {
      Object.isFrozen(this) && B('cannot thaw constant: ' + this);
      this.s = !1;
      return this;
    };
    function pc(a) {
      if ('string' === typeof a) {
        a = a.split(' ');
        for (var b = 0, c = NaN; '' === a[b]; ) b++;
        var d = a[b++];
        d && (c = parseFloat(d));
        if (isNaN(c)) return new oc();
        for (var e = NaN; '' === a[b]; ) b++;
        (d = a[b++]) && (e = parseFloat(d));
        if (isNaN(e)) return new oc(c);
        for (var f = NaN; '' === a[b]; ) b++;
        (d = a[b++]) && (f = parseFloat(d));
        if (isNaN(f)) return new oc(c, e);
        for (var g = NaN; '' === a[b]; ) b++;
        (d = a[b++]) && (g = parseFloat(d));
        return isNaN(g) ? new oc(c, e) : new oc(c, e, f, g);
      }
      return new oc();
    }
    function qc(a) {
      return (
        a.top.toString() +
        ' ' +
        a.right.toString() +
        ' ' +
        a.bottom.toString() +
        ' ' +
        a.left.toString()
      );
    }
    t.toString = function () {
      return (
        'Margin(' +
        this.top +
        ',' +
        this.right +
        ',' +
        this.bottom +
        ',' +
        this.left +
        ')'
      );
    };
    t.A = function (a) {
      return a instanceof oc
        ? this.top === a.top &&
            this.right === a.right &&
            this.bottom === a.bottom &&
            this.left === a.left
        : !1;
    };
    t.Qi = function (a, b, c, d) {
      return (
        this.top === a && this.right === b && this.bottom === c && this.left === d
      );
    };
    t.Ma = function (a) {
      return (
        J.w(this.top, a.top) &&
        J.w(this.right, a.right) &&
        J.w(this.bottom, a.bottom) &&
        J.w(this.left, a.left)
      );
    };
    t.u = function () {
      return (
        isFinite(this.top) &&
        isFinite(this.right) &&
        isFinite(this.bottom) &&
        isFinite(this.left)
      );
    };
    oc.alloc = function () {
      var a = rc.pop();
      return void 0 === a ? new oc() : a;
    };
    oc.free = function (a) {
      rc.push(a);
    };
    oc.prototype.isReal = oc.prototype.u;
    oc.prototype.equalsApprox = oc.prototype.Ma;
    oc.prototype.equalTo = oc.prototype.Qi;
    oc.prototype.equals = oc.prototype.A;
    oc.prototype.set = oc.prototype.set;
    oc.prototype.setTo = oc.prototype.Fg;
    var sc = null,
      tc = null,
      rc = [];
    oc.className = 'Margin';
    oc.parse = pc;
    oc.stringify = qc;
    oc.ZeroMargin = sc = new oc(0, 0, 0, 0).ca();
    oc.TwoMargin = tc = new oc(2, 2, 2, 2).ca();
    oc.parse = pc;
    oc.stringify = qc;
    function O(a, b, c, d) {
      void 0 === a
        ? (this.offsetY = this.offsetX = this.y = this.x = 0)
        : (void 0 === b && (b = 0),
          void 0 === c && (c = 0),
          void 0 === d && (d = 0),
          (this.x = a),
          (this.y = b),
          (this.offsetX = c),
          (this.offsetY = d));
      this.s = !1;
    }
    var uc,
      vc,
      xc,
      yc,
      zc,
      Ac,
      Bc,
      Ec,
      Fc,
      Gc,
      Hc,
      Ic,
      Jc,
      Kc,
      Lc,
      Mc,
      Nc,
      Pc,
      Qc,
      Rc,
      Sc,
      Tc,
      Uc,
      Xc,
      Yc,
      Zc,
      $c,
      ad,
      bd,
      cd,
      dd,
      ed,
      fd,
      gd,
      hd,
      id;
    O.prototype.assign = function (a) {
      this.x = a.x;
      this.y = a.y;
      this.offsetX = a.offsetX;
      this.offsetY = a.offsetY;
      return this;
    };
    O.prototype.Fg = function (a, b, c, d) {
      this.x = a;
      this.y = b;
      this.offsetX = c;
      this.offsetY = d;
      return this;
    };
    O.prototype.set = function (a) {
      this.x = a.x;
      this.y = a.y;
      this.offsetX = a.offsetX;
      this.offsetY = a.offsetY;
      return this;
    };
    O.prototype.copy = function () {
      var a = new O();
      a.x = this.x;
      a.y = this.y;
      a.offsetX = this.offsetX;
      a.offsetY = this.offsetY;
      return a;
    };
    t = O.prototype;
    t.ca = function () {
      this.s = !0;
      Object.freeze(this);
      return this;
    };
    t.G = function () {
      return this.s || Object.isFrozen(this) ? this : this.copy().freeze();
    };
    t.freeze = function () {
      this.s = !0;
      return this;
    };
    t.ea = function () {
      Object.isFrozen(this) && B('cannot thaw constant: ' + this);
      this.s = !1;
      return this;
    };
    function jd(a, b) {
      a.x = NaN;
      a.y = NaN;
      a.offsetX = b;
      return a;
    }
    function kd(a) {
      if ('string' === typeof a) {
        a = a.trim();
        if ('None' === a) return uc;
        if ('TopLeft' === a) return vc;
        if ('Top' === a || 'TopCenter' === a || 'MiddleTop' === a) return xc;
        if ('TopRight' === a) return yc;
        if ('Left' === a || 'LeftCenter' === a || 'MiddleLeft' === a) return zc;
        if ('Center' === a) return Ac;
        if ('Right' === a || 'RightCenter' === a || 'MiddleRight' === a)
          return Bc;
        if ('BottomLeft' === a) return Ec;
        if ('Bottom' === a || 'BottomCenter' === a || 'MiddleBottom' === a)
          return Fc;
        if ('BottomRight' === a) return Gc;
        if ('TopSide' === a) return Hc;
        if ('LeftSide' === a) return Ic;
        if ('RightSide' === a) return Jc;
        if ('BottomSide' === a) return Kc;
        if ('TopBottomSides' === a) return Lc;
        if ('LeftRightSides' === a) return Mc;
        if ('TopLeftSides' === a) return Nc;
        if ('TopRightSides' === a) return Pc;
        if ('BottomLeftSides' === a) return Qc;
        if ('BottomRightSides' === a) return Rc;
        if ('NotTopSide' === a) return Sc;
        if ('NotLeftSide' === a) return Tc;
        if ('NotRightSide' === a) return Uc;
        if ('NotBottomSide' === a) return Xc;
        if ('AllSides' === a) return Yc;
        if ('Default' === a) return Zc;
        a = a.split(' ');
        for (var b = 0, c = 0; '' === a[b]; ) b++;
        var d = a[b++];
        void 0 !== d && 0 < d.length && (c = parseFloat(d));
        for (var e = 0; '' === a[b]; ) b++;
        d = a[b++];
        void 0 !== d && 0 < d.length && (e = parseFloat(d));
        for (var f = 0; '' === a[b]; ) b++;
        d = a[b++];
        void 0 !== d && 0 < d.length && (f = parseFloat(d));
        for (var g = 0; '' === a[b]; ) b++;
        d = a[b++];
        void 0 !== d && 0 < d.length && (g = parseFloat(d));
        return new O(c, e, f, g);
      }
      return new O();
    }
    function pd(a) {
      return a.cb()
        ? a.x.toString() +
            ' ' +
            a.y.toString() +
            ' ' +
            a.offsetX.toString() +
            ' ' +
            a.offsetY.toString()
        : a.toString();
    }
    t.toString = function () {
      return this.cb()
        ? 0 === this.offsetX && 0 === this.offsetY
          ? 'Spot(' + this.x + ',' + this.y + ')'
          : 'Spot(' +
            this.x +
            ',' +
            this.y +
            ',' +
            this.offsetX +
            ',' +
            this.offsetY +
            ')'
        : this.A(uc)
        ? 'None'
        : this.A(vc)
        ? 'TopLeft'
        : this.A(xc)
        ? 'Top'
        : this.A(yc)
        ? 'TopRight'
        : this.A(zc)
        ? 'Left'
        : this.A(Ac)
        ? 'Center'
        : this.A(Bc)
        ? 'Right'
        : this.A(Ec)
        ? 'BottomLeft'
        : this.A(Fc)
        ? 'Bottom'
        : this.A(Gc)
        ? 'BottomRight'
        : this.A(Hc)
        ? 'TopSide'
        : this.A(Ic)
        ? 'LeftSide'
        : this.A(Jc)
        ? 'RightSide'
        : this.A(Kc)
        ? 'BottomSide'
        : this.A(Lc)
        ? 'TopBottomSides'
        : this.A(Mc)
        ? 'LeftRightSides'
        : this.A(Nc)
        ? 'TopLeftSides'
        : this.A(Pc)
        ? 'TopRightSides'
        : this.A(Qc)
        ? 'BottomLeftSides'
        : this.A(Rc)
        ? 'BottomRightSides'
        : this.A(Sc)
        ? 'NotTopSide'
        : this.A(Tc)
        ? 'NotLeftSide'
        : this.A(Uc)
        ? 'NotRightSide'
        : this.A(Xc)
        ? 'NotBottomSide'
        : this.A(Yc)
        ? 'AllSides'
        : this.A(Zc)
        ? 'Default'
        : 'None';
    };
    t.A = function (a) {
      return a instanceof O
        ? (this.x === a.x || (isNaN(this.x) && isNaN(a.x))) &&
            (this.y === a.y || (isNaN(this.y) && isNaN(a.y))) &&
            this.offsetX === a.offsetX &&
            this.offsetY === a.offsetY
        : !1;
    };
    t.Sv = function () {
      return new O(
        0.5 - (this.x - 0.5),
        0.5 - (this.y - 0.5),
        -this.offsetX,
        -this.offsetY,
      );
    };
    t.vf = function (a) {
      if (!this.xf()) return !1;
      if (!a.xf())
        if (a.A($c)) a = Ic;
        else if (a.A(ad)) a = Jc;
        else if (a.A(bd)) a = Hc;
        else if (a.A(cd)) a = Kc;
        else return !1;
      a = a.offsetY;
      return (this.offsetY & a) === a;
    };
    t.cb = function () {
      return !isNaN(this.x) && !isNaN(this.y);
    };
    t.kc = function () {
      return isNaN(this.x) || isNaN(this.y);
    };
    t.xf = function () {
      return (
        isNaN(this.x) && isNaN(this.y) && 1 === this.offsetX && 0 !== this.offsetY
      );
    };
    t.wt = function () {
      return (
        isNaN(this.x) && isNaN(this.y) && 0 === this.offsetX && 0 === this.offsetY
      );
    };
    t.Nb = function () {
      return (
        isNaN(this.x) &&
        isNaN(this.y) &&
        -1 === this.offsetX &&
        0 === this.offsetY
      );
    };
    O.alloc = function () {
      var a = qd.pop();
      return void 0 === a ? new O() : a;
    };
    O.free = function (a) {
      qd.push(a);
    };
    O.prototype.isDefault = O.prototype.Nb;
    O.prototype.isNone = O.prototype.wt;
    O.prototype.isSide = O.prototype.xf;
    O.prototype.isNoSpot = O.prototype.kc;
    O.prototype.isSpot = O.prototype.cb;
    O.prototype.includesSide = O.prototype.vf;
    O.prototype.opposite = O.prototype.Sv;
    O.prototype.equals = O.prototype.A;
    O.prototype.set = O.prototype.set;
    O.prototype.setTo = O.prototype.Fg;
    var qd = [];
    O.className = 'Spot';
    O.parse = kd;
    O.stringify = pd;
    O.None = uc = jd(new O(0, 0, 0, 0), 0).ca();
    O.Default = Zc = jd(new O(0, 0, -1, 0), -1).ca();
    O.TopLeft = vc = new O(0, 0, 0, 0).ca();
    O.TopCenter = xc = new O(0.5, 0, 0, 0).ca();
    O.TopRight = yc = new O(1, 0, 0, 0).ca();
    O.LeftCenter = zc = new O(0, 0.5, 0, 0).ca();
    O.Center = Ac = new O(0.5, 0.5, 0, 0).ca();
    O.RightCenter = Bc = new O(1, 0.5, 0, 0).ca();
    O.BottomLeft = Ec = new O(0, 1, 0, 0).ca();
    O.BottomCenter = Fc = new O(0.5, 1, 0, 0).ca();
    O.BottomRight = Gc = new O(1, 1, 0, 0).ca();
    O.MiddleTop = dd = xc;
    O.MiddleLeft = ed = zc;
    O.MiddleRight = fd = Bc;
    O.MiddleBottom = gd = Fc;
    O.Top = bd = xc;
    O.Left = $c = zc;
    O.Right = ad = Bc;
    O.Bottom = cd = Fc;
    O.TopSide = Hc = jd(new O(0, 0, 1, 1), 1).ca();
    O.LeftSide = Ic = jd(new O(0, 0, 1, 2), 1).ca();
    O.RightSide = Jc = jd(new O(0, 0, 1, 4), 1).ca();
    O.BottomSide = Kc = jd(new O(0, 0, 1, 8), 1).ca();
    O.TopBottomSides = Lc = jd(new O(0, 0, 1, 9), 1).ca();
    O.LeftRightSides = Mc = jd(new O(0, 0, 1, 6), 1).ca();
    O.TopLeftSides = Nc = jd(new O(0, 0, 1, 3), 1).ca();
    O.TopRightSides = Pc = jd(new O(0, 0, 1, 5), 1).ca();
    O.BottomLeftSides = Qc = jd(new O(0, 0, 1, 10), 1).ca();
    O.BottomRightSides = Rc = jd(new O(0, 0, 1, 12), 1).ca();
    O.NotTopSide = Sc = jd(new O(0, 0, 1, 14), 1).ca();
    O.NotLeftSide = Tc = jd(new O(0, 0, 1, 13), 1).ca();
    O.NotRightSide = Uc = jd(new O(0, 0, 1, 11), 1).ca();
    O.NotBottomSide = Xc = jd(new O(0, 0, 1, 7), 1).ca();
    O.AllSides = Yc = jd(new O(0, 0, 1, 15), 1).ca();
    hd = new O(0.156, 0.156).ca();
    id = new O(0.844, 0.844).ca();
    O.parse = kd;
    O.stringify = pd;
    function rd() {
      this.m11 = 1;
      this.m21 = this.m12 = 0;
      this.m22 = 1;
      this.dy = this.dx = 0;
    }
    rd.prototype.set = function (a) {
      this.m11 = a.m11;
      this.m12 = a.m12;
      this.m21 = a.m21;
      this.m22 = a.m22;
      this.dx = a.dx;
      this.dy = a.dy;
      return this;
    };
    rd.prototype.copy = function () {
      var a = new rd();
      a.m11 = this.m11;
      a.m12 = this.m12;
      a.m21 = this.m21;
      a.m22 = this.m22;
      a.dx = this.dx;
      a.dy = this.dy;
      return a;
    };
    t = rd.prototype;
    t.toString = function () {
      return (
        'Transform(' +
        this.m11 +
        ',' +
        this.m12 +
        ',' +
        this.m21 +
        ',' +
        this.m22 +
        ',' +
        this.dx +
        ',' +
        this.dy +
        ')'
      );
    };
    t.A = function (a) {
      return (
        this.m11 === a.m11 &&
        this.m12 === a.m12 &&
        this.m21 === a.m21 &&
        this.m22 === a.m22 &&
        this.dx === a.dx &&
        this.dy === a.dy
      );
    };
    t.ut = function () {
      return (
        0 === this.dx &&
        0 === this.dy &&
        1 === this.m11 &&
        0 === this.m12 &&
        0 === this.m21 &&
        1 === this.m22
      );
    };
    t.reset = function () {
      this.m11 = 1;
      this.m21 = this.m12 = 0;
      this.m22 = 1;
      this.dy = this.dx = 0;
      return this;
    };
    t.multiply = function (a) {
      var b = this.m11 * a.m11 + this.m21 * a.m12,
        c = this.m12 * a.m11 + this.m22 * a.m12,
        d = this.m11 * a.m21 + this.m21 * a.m22,
        e = this.m12 * a.m21 + this.m22 * a.m22;
      this.dx = this.m11 * a.dx + this.m21 * a.dy + this.dx;
      this.dy = this.m12 * a.dx + this.m22 * a.dy + this.dy;
      this.m11 = b;
      this.m12 = c;
      this.m21 = d;
      this.m22 = e;
      return this;
    };
    t.Ov = function (a) {
      var b = 1 / (a.m11 * a.m22 - a.m12 * a.m21),
        c = a.m22 * b,
        d = -a.m12 * b,
        e = -a.m21 * b,
        f = a.m11 * b,
        g = b * (a.m21 * a.dy - a.m22 * a.dx);
      a = b * (a.m12 * a.dx - a.m11 * a.dy);
      b = this.m11 * c + this.m21 * d;
      c = this.m12 * c + this.m22 * d;
      d = this.m11 * e + this.m21 * f;
      e = this.m12 * e + this.m22 * f;
      this.dx = this.m11 * g + this.m21 * a + this.dx;
      this.dy = this.m12 * g + this.m22 * a + this.dy;
      this.m11 = b;
      this.m12 = c;
      this.m21 = d;
      this.m22 = e;
      return this;
    };
    t.tt = function () {
      var a = 1 / (this.m11 * this.m22 - this.m12 * this.m21),
        b = -this.m12 * a,
        c = -this.m21 * a,
        d = this.m11 * a,
        e = a * (this.m21 * this.dy - this.m22 * this.dx),
        f = a * (this.m12 * this.dx - this.m11 * this.dy);
      this.m11 = this.m22 * a;
      this.m12 = b;
      this.m21 = c;
      this.m22 = d;
      this.dx = e;
      this.dy = f;
      return this;
    };
    rd.prototype.rotate = function (a, b, c) {
      360 <= a ? (a -= 360) : 0 > a && (a += 360);
      if (0 === a) return this;
      this.translate(b, c);
      if (90 === a) {
        a = 0;
        var d = 1;
      } else
        180 === a
          ? ((a = -1), (d = 0))
          : 270 === a
          ? ((a = 0), (d = -1))
          : ((d = (a * Math.PI) / 180), (a = Math.cos(d)), (d = Math.sin(d)));
      var e = this.m12 * a + this.m22 * d,
        f = this.m11 * -d + this.m21 * a,
        g = this.m12 * -d + this.m22 * a;
      this.m11 = this.m11 * a + this.m21 * d;
      this.m12 = e;
      this.m21 = f;
      this.m22 = g;
      this.translate(-b, -c);
      return this;
    };
    t = rd.prototype;
    t.translate = function (a, b) {
      this.dx += this.m11 * a + this.m21 * b;
      this.dy += this.m12 * a + this.m22 * b;
      return this;
    };
    t.scale = function (a, b) {
      void 0 === b && (b = a);
      this.m11 *= a;
      this.m12 *= a;
      this.m21 *= b;
      this.m22 *= b;
      return this;
    };
    t.ra = function (a) {
      var b = a.x,
        c = a.y;
      return a.h(
        b * this.m11 + c * this.m21 + this.dx,
        b * this.m12 + c * this.m22 + this.dy,
      );
    };
    t.Wd = function (a) {
      var b = 1 / (this.m11 * this.m22 - this.m12 * this.m21),
        c = a.x,
        d = a.y;
      return a.h(
        c * this.m22 * b +
          d * -this.m21 * b +
          b * (this.m21 * this.dy - this.m22 * this.dx),
        c * -this.m12 * b +
          d * this.m11 * b +
          b * (this.m12 * this.dx - this.m11 * this.dy),
      );
    };
    t.tw = function (a) {
      var b = a.x,
        c = a.y,
        d = b + a.width,
        e = c + a.height,
        f = this.m11,
        g = this.m12,
        h = this.m21,
        k = this.m22,
        l = this.dx,
        m = this.dy,
        n = b * f + c * h + l,
        p = b * g + c * k + m,
        r = d * f + c * h + l,
        q = d * g + c * k + m;
      c = b * f + e * h + l;
      b = b * g + e * k + m;
      f = d * f + e * h + l;
      d = d * g + e * k + m;
      e = Math.min(n, r);
      n = Math.max(n, r);
      r = Math.min(p, q);
      p = Math.max(p, q);
      e = Math.min(e, c);
      n = Math.max(n, c);
      r = Math.min(r, b);
      p = Math.max(p, b);
      e = Math.min(e, f);
      n = Math.max(n, f);
      r = Math.min(r, d);
      p = Math.max(p, d);
      a.h(e, r, n - e, p - r);
      return a;
    };
    rd.alloc = function () {
      var a = sd.pop();
      return void 0 === a ? new rd() : a;
    };
    rd.free = function (a) {
      sd.push(a);
    };
    rd.prototype.transformRect = rd.prototype.tw;
    rd.prototype.invertedTransformPoint = rd.prototype.Wd;
    rd.prototype.transformPoint = rd.prototype.ra;
    rd.prototype.scale = rd.prototype.scale;
    rd.prototype.translate = rd.prototype.translate;
    rd.prototype.rotate = rd.prototype.rotate;
    rd.prototype.invert = rd.prototype.tt;
    rd.prototype.multiplyInverted = rd.prototype.Ov;
    rd.prototype.multiply = rd.prototype.multiply;
    rd.prototype.reset = rd.prototype.reset;
    rd.prototype.isIdentity = rd.prototype.ut;
    rd.prototype.equals = rd.prototype.A;
    rd.prototype.set = rd.prototype.set;
    var sd = [];
    rd.className = 'Transform';
    rd.xF = '54a702f3e53909c447824c6706603faf4c';
    var J = {
      FA: '7da71ca0ad381e90',
      Ig: ((Math.sqrt(2) - 1) / 3) * 4,
      Kw: null,
      sqrt: function (a) {
        if (0 >= a) return 0;
        var b = J.Kw;
        if (null === b) {
          b = [];
          for (var c = 0; 2e3 >= c; c++) b[c] = Math.sqrt(c);
          J.Kw = b;
        }
        return 1 > a
          ? ((c = 1 / a), 2e3 >= c ? 1 / b[c | 0] : Math.sqrt(a))
          : 2e3 >= a
          ? b[a | 0]
          : Math.sqrt(a);
      },
      w: function (a, b) {
        a -= b;
        return 0.5 > a && -0.5 < a;
      },
      $: function (a, b) {
        a -= b;
        return 5e-8 > a && -5e-8 < a;
      },
      Xb: function (a, b, c, d, e, f, g) {
        0 >= e && (e = 1e-6);
        if (a < c) {
          var h = a;
          var k = c;
        } else (h = c), (k = a);
        if (b < d) {
          var l = b;
          var m = d;
        } else (l = d), (m = b);
        if (a === c) return l <= g && g <= m && a - e <= f && f <= a + e;
        if (b === d) return h <= f && f <= k && b - e <= g && g <= b + e;
        k += e;
        h -= e;
        if (h <= f && f <= k && ((m += e), (l -= e), l <= g && g <= m))
          if (k - h > m - l)
            if (a - c > e || c - a > e) {
              if (
                ((f = ((d - b) / (c - a)) * (f - a) + b),
                f - e <= g && g <= f + e)
              )
                return !0;
            } else return !0;
          else if (b - d > e || d - b > e) {
            if (
              ((g = ((c - a) / (d - b)) * (g - b) + a), g - e <= f && f <= g + e)
            )
              return !0;
          } else return !0;
        return !1;
      },
      $s: function (a, b, c, d, e, f, g, h, k, l, m, n) {
        if (J.Xb(a, b, g, h, n, c, d) && J.Xb(a, b, g, h, n, e, f))
          return J.Xb(a, b, g, h, n, l, m);
        var p = (a + c) / 2,
          r = (b + d) / 2,
          q = (c + e) / 2,
          u = (d + f) / 2;
        e = (e + g) / 2;
        f = (f + h) / 2;
        d = (p + q) / 2;
        c = (r + u) / 2;
        q = (q + e) / 2;
        u = (u + f) / 2;
        var v = (d + q) / 2,
          w = (c + u) / 2;
        return (
          J.$s(a, b, p, r, d, c, v, w, k, l, m, n) ||
          J.$s(v, w, q, u, e, f, g, h, k, l, m, n)
        );
      },
      Sy: function (a, b, c, d, e, f, g, h, k) {
        var l = (c + e) / 2,
          m = (d + f) / 2;
        k.h(
          (((a + c) / 2 + l) / 2 + (l + (e + g) / 2) / 2) / 2,
          (((b + d) / 2 + m) / 2 + (m + (f + h) / 2) / 2) / 2,
        );
        return k;
      },
      Ry: function (a, b, c, d, e, f, g, h) {
        var k = (c + e) / 2,
          l = (d + f) / 2;
        return Cb(
          ((a + c) / 2 + k) / 2,
          ((b + d) / 2 + l) / 2,
          (k + (e + g) / 2) / 2,
          (l + (f + h) / 2) / 2,
        );
      },
      cm: function (a, b, c, d, e, f, g, h, k, l) {
        if (J.Xb(a, b, g, h, k, c, d) && J.Xb(a, b, g, h, k, e, f))
          ec(l, a, b, 0, 0), ec(l, g, h, 0, 0);
        else {
          var m = (a + c) / 2,
            n = (b + d) / 2,
            p = (c + e) / 2,
            r = (d + f) / 2;
          e = (e + g) / 2;
          f = (f + h) / 2;
          d = (m + p) / 2;
          c = (n + r) / 2;
          p = (p + e) / 2;
          r = (r + f) / 2;
          var q = (d + p) / 2,
            u = (c + r) / 2;
          J.cm(a, b, m, n, d, c, q, u, k, l);
          J.cm(q, u, p, r, e, f, g, h, k, l);
        }
        return l;
      },
      ze: function (a, b, c, d, e, f, g, h, k, l) {
        if (J.Xb(a, b, g, h, k, c, d) && J.Xb(a, b, g, h, k, e, f))
          0 === l.length && (l.push(a), l.push(b)), l.push(g), l.push(h);
        else {
          var m = (a + c) / 2,
            n = (b + d) / 2,
            p = (c + e) / 2,
            r = (d + f) / 2;
          e = (e + g) / 2;
          f = (f + h) / 2;
          d = (m + p) / 2;
          c = (n + r) / 2;
          p = (p + e) / 2;
          r = (r + f) / 2;
          var q = (d + p) / 2,
            u = (c + r) / 2;
          J.ze(a, b, m, n, d, c, q, u, k, l);
          J.ze(q, u, p, r, e, f, g, h, k, l);
        }
        return l;
      },
      Vv: function (a, b, c, d, e, f, g, h, k, l) {
        if (J.Xb(a, b, e, f, l, c, d)) return J.Xb(a, b, e, f, l, h, k);
        var m = (a + c) / 2,
          n = (b + d) / 2;
        c = (c + e) / 2;
        d = (d + f) / 2;
        var p = (m + c) / 2,
          r = (n + d) / 2;
        return (
          J.Vv(a, b, m, n, p, r, g, h, k, l) || J.Vv(p, r, c, d, e, f, g, h, k, l)
        );
      },
      LA: function (a, b, c, d, e, f, g) {
        g.h(((a + c) / 2 + (c + e) / 2) / 2, ((b + d) / 2 + (d + f) / 2) / 2);
        return g;
      },
      Uv: function (a, b, c, d, e, f, g, h) {
        if (J.Xb(a, b, e, f, g, c, d)) ec(h, a, b, 0, 0), ec(h, e, f, 0, 0);
        else {
          var k = (a + c) / 2,
            l = (b + d) / 2;
          c = (c + e) / 2;
          d = (d + f) / 2;
          var m = (k + c) / 2,
            n = (l + d) / 2;
          J.Uv(a, b, k, l, m, n, g, h);
          J.Uv(m, n, c, d, e, f, g, h);
        }
        return h;
      },
      Bq: function (a, b, c, d, e, f, g, h) {
        if (J.Xb(a, b, e, f, g, c, d))
          0 === h.length && (h.push(a), h.push(b)), h.push(e), h.push(f);
        else {
          var k = (a + c) / 2,
            l = (b + d) / 2;
          c = (c + e) / 2;
          d = (d + f) / 2;
          var m = (k + c) / 2,
            n = (l + d) / 2;
          J.Bq(a, b, k, l, m, n, g, h);
          J.Bq(m, n, c, d, e, f, g, h);
        }
        return h;
      },
      cq: function (a, b, c, d, e, f, g, h, k, l, m, n, p, r) {
        if (J.Xb(a, b, g, h, p, c, d) && J.Xb(a, b, g, h, p, e, f)) {
          var q = (a - g) * (l - n) - (b - h) * (k - m);
          if (0 === q) return !1;
          p = ((a * h - b * g) * (k - m) - (a - g) * (k * n - l * m)) / q;
          q = ((a * h - b * g) * (l - n) - (b - h) * (k * n - l * m)) / q;
          if ((k > m ? k - m : m - k) < (l > n ? l - n : n - l)) {
            if ((b < h ? (g = b) : ((g = h), (h = b)), q < g || q > h)) return !1;
          } else if ((a < g ? (h = a) : ((h = g), (g = a)), p < h || p > g))
            return !1;
          r.h(p, q);
          return !0;
        }
        q = (a + c) / 2;
        var u = (b + d) / 2;
        c = (c + e) / 2;
        d = (d + f) / 2;
        e = (e + g) / 2;
        f = (f + h) / 2;
        var v = (q + c) / 2,
          w = (u + d) / 2;
        c = (c + e) / 2;
        d = (d + f) / 2;
        var y = (v + c) / 2,
          z = (w + d) / 2,
          A = (m - k) * (m - k) + (n - l) * (n - l),
          C = !1;
        J.cq(a, b, q, u, v, w, y, z, k, l, m, n, p, r) &&
          ((a = (r.x - k) * (r.x - k) + (r.y - l) * (r.y - l)),
          a < A && ((A = a), (C = !0)));
        a = r.x;
        b = r.y;
        J.cq(y, z, c, d, e, f, g, h, k, l, m, n, p, r) &&
          ((r.x - k) * (r.x - k) + (r.y - l) * (r.y - l) < A
            ? (C = !0)
            : r.h(a, b));
        return C;
      },
      eq: function (a, b, c, d, e, f, g, h, k, l, m, n, p) {
        var r = 0;
        if (J.Xb(a, b, g, h, p, c, d) && J.Xb(a, b, g, h, p, e, f)) {
          p = (a - g) * (l - n) - (b - h) * (k - m);
          if (0 === p) return r;
          var q = ((a * h - b * g) * (k - m) - (a - g) * (k * n - l * m)) / p,
            u = ((a * h - b * g) * (l - n) - (b - h) * (k * n - l * m)) / p;
          if (q >= m) return r;
          if ((k > m ? k - m : m - k) < (l > n ? l - n : n - l)) {
            if ((b < h ? ((a = b), (b = h)) : (a = h), u < a || u > b)) return r;
          } else if ((a < g ? ((b = a), (a = g)) : (b = g), q < b || q > a))
            return r;
          0 < p ? r++ : 0 > p && r--;
        } else {
          q = (a + c) / 2;
          u = (b + d) / 2;
          var v = (c + e) / 2,
            w = (d + f) / 2;
          e = (e + g) / 2;
          f = (f + h) / 2;
          d = (q + v) / 2;
          c = (u + w) / 2;
          v = (v + e) / 2;
          w = (w + f) / 2;
          var y = (d + v) / 2,
            z = (c + w) / 2;
          r += J.eq(a, b, q, u, d, c, y, z, k, l, m, n, p);
          r += J.eq(y, z, v, w, e, f, g, h, k, l, m, n, p);
        }
        return r;
      },
      Mh: function (a, b, c, d, e, f, g) {
        if (J.$(a, c)) {
          b < d ? ((c = b), (b = d)) : (c = d);
          if (f < c) return g.h(a, c), !1;
          if (f > b) return g.h(a, b), !1;
          g.h(a, f);
          return !0;
        }
        if (J.$(b, d)) {
          a < c ? ((d = a), (a = c)) : (d = c);
          if (e < d) return g.h(d, b), !1;
          if (e > a) return g.h(a, b), !1;
          g.h(e, b);
          return !0;
        }
        e =
          ((a - e) * (a - c) + (b - f) * (b - d)) /
          ((c - a) * (c - a) + (d - b) * (d - b));
        if (-5e-6 > e) return g.h(a, b), !1;
        if (1.000005 < e) return g.h(c, d), !1;
        g.h(a + e * (c - a), b + e * (d - b));
        return !0;
      },
      De: function (a, b, c, d, e, f, g, h, k) {
        if (J.w(a, c) && J.w(b, d)) return k.h(a, b), !1;
        if (J.$(e, g))
          return J.$(a, c)
            ? (J.Mh(a, b, c, d, e, f, k), !1)
            : J.Mh(a, b, c, d, e, ((d - b) / (c - a)) * (e - a) + b, k);
        h = (h - f) / (g - e);
        if (J.$(a, c)) {
          c = h * (a - e) + f;
          b < d ? ((e = b), (b = d)) : (e = d);
          if (c < e) return k.h(a, e), !1;
          if (c > b) return k.h(a, b), !1;
          k.h(a, c);
          return !0;
        }
        g = (d - b) / (c - a);
        if (J.$(h, g)) return J.Mh(a, b, c, d, e, f, k), !1;
        e = (g * a - h * e + f - b) / (g - h);
        if (J.$(g, 0)) {
          a < c ? ((d = a), (a = c)) : (d = c);
          if (e < d) return k.h(d, b), !1;
          if (e > a) return k.h(a, b), !1;
          k.h(e, b);
          return !0;
        }
        return J.Mh(a, b, c, d, e, g * (e - a) + b, k);
      },
      KA: function (a, b, c, d, e) {
        return J.De(c.x, c.y, d.x, d.y, a.x, a.y, b.x, b.y, e);
      },
      JA: function (a, b, c, d, e, f, g, h, k, l) {
        function m(c, d) {
          var e = (c - a) * (c - a) + (d - b) * (d - b);
          e < n && ((n = e), k.h(c, d));
        }
        var n = Infinity;
        m(k.x, k.y);
        var p = 0,
          r = 0,
          q = 0,
          u = 0;
        e < g ? ((p = e), (r = g)) : ((p = g), (r = e));
        f < h ? ((q = e), (u = g)) : ((q = g), (u = e));
        p = (r - p) / 2 + l;
        l = (u - q) / 2 + l;
        e = (e + g) / 2;
        f = (f + h) / 2;
        if (0 === p || 0 === l) return k;
        if (0.5 > (c > a ? c - a : a - c)) {
          p = 1 - ((c - e) * (c - e)) / (p * p);
          if (0 > p) return k;
          p = Math.sqrt(p);
          d = -l * p + f;
          m(c, l * p + f);
          m(c, d);
        } else {
          c = (d - b) / (c - a);
          d = 1 / (p * p) + (c * c) / (l * l);
          h =
            (2 * c * (b - c * a)) / (l * l) -
            (2 * c * f) / (l * l) -
            (2 * e) / (p * p);
          p =
            h * h -
            4 *
              d *
              ((2 * c * a * f) / (l * l) -
                (2 * b * f) / (l * l) +
                (f * f) / (l * l) +
                (e * e) / (p * p) -
                1 +
                ((b - c * a) * (b - c * a)) / (l * l));
          if (0 > p) return k;
          p = Math.sqrt(p);
          l = (-h + p) / (2 * d);
          m(l, c * l - c * a + b);
          p = (-h - p) / (2 * d);
          m(p, c * p - c * a + b);
        }
        return k;
      },
      Sc: function (a, b, c, d, e, f, g, h, k) {
        var l = 1e21,
          m = a,
          n = b;
        if (J.De(a, b, a, d, e, f, g, h, k)) {
          var p = (k.x - e) * (k.x - e) + (k.y - f) * (k.y - f);
          p < l && ((l = p), (m = k.x), (n = k.y));
        }
        J.De(c, b, c, d, e, f, g, h, k) &&
          ((p = (k.x - e) * (k.x - e) + (k.y - f) * (k.y - f)),
          p < l && ((l = p), (m = k.x), (n = k.y)));
        J.De(a, b, c, b, e, f, g, h, k) &&
          ((b = (k.x - e) * (k.x - e) + (k.y - f) * (k.y - f)),
          b < l && ((l = b), (m = k.x), (n = k.y)));
        J.De(a, d, c, d, e, f, g, h, k) &&
          ((a = (k.x - e) * (k.x - e) + (k.y - f) * (k.y - f)),
          a < l && ((l = a), (m = k.x), (n = k.y)));
        k.h(m, n);
        return 1e21 > l;
      },
      IA: function (a, b, c, d, e, f, g, h, k) {
        c = a - c;
        g = e - g;
        0 === c || 0 === g
          ? 0 === c
            ? ((b = (f - h) / g), (h = a), (e = b * h + (f - b * e)))
            : ((f = (b - d) / c), (h = e), (e = f * h + (b - f * a)))
          : ((d = (b - d) / c),
            (h = (f - h) / g),
            (a = b - d * a),
            (h = (f - h * e - a) / (d - h)),
            (e = d * h + a));
        k.h(h, e);
        return k;
      },
      rt: function (a, b, c) {
        var d = b.x,
          e = b.y,
          f = c.x,
          g = c.y,
          h = a.left,
          k = a.right,
          l = a.top,
          m = a.bottom;
        return d === f
          ? (e < g ? ((f = e), (e = g)) : (f = g),
            h <= d && d <= k && f <= m && e >= l)
          : e === g
          ? (d < f ? ((g = d), (d = f)) : (g = f),
            l <= e && e <= m && g <= k && d >= h)
          : a.aa(b) ||
            a.aa(c) ||
            J.qt(h, l, k, l, d, e, f, g) ||
            J.qt(k, l, k, m, d, e, f, g) ||
            J.qt(k, m, h, m, d, e, f, g) ||
            J.qt(h, m, h, l, d, e, f, g)
          ? !0
          : !1;
      },
      qt: function (a, b, c, d, e, f, g, h) {
        return (
          0 >= J.ct(a, b, c, d, e, f) * J.ct(a, b, c, d, g, h) &&
          0 >= J.ct(e, f, g, h, a, b) * J.ct(e, f, g, h, c, d)
        );
      },
      ct: function (a, b, c, d, e, f) {
        c -= a;
        d -= b;
        a = e - a;
        b = f - b;
        f = a * d - b * c;
        0 === f &&
          ((f = a * c + b * d),
          0 < f && ((f = (a - c) * c + (b - d) * d), 0 > f && (f = 0)));
        return 0 > f ? -1 : 0 < f ? 1 : 0;
      },
      yq: function (a) {
        0 > a && (a += 360);
        360 <= a && (a -= 360);
        return a;
      },
      Gx: function (a, b, c, d, e, f) {
        var g = Math.PI;
        f || ((d *= g / 180), (e *= g / 180));
        var h = d > e ? -1 : 1;
        f = [];
        var k = g / 2,
          l = d;
        d = Math.min(2 * g, Math.abs(e - d));
        if (1e-5 > d)
          return (
            (k = l + h * Math.min(d, k)),
            (h = a + c * Math.cos(l)),
            (l = b + c * Math.sin(l)),
            (a += c * Math.cos(k)),
            (b += c * Math.sin(k)),
            (c = (h + a) / 2),
            (k = (l + b) / 2),
            f.push([h, l, c, k, c, k, a, b]),
            f
          );
        for (; 1e-5 < d; )
          (e = l + h * Math.min(d, k)),
            f.push(J.Zy(c, l, e, a, b)),
            (d -= Math.abs(e - l)),
            (l = e);
        return f;
      },
      Zy: function (a, b, c, d, e) {
        var f = (c - b) / 2,
          g = a * Math.cos(f),
          h = a * Math.sin(f),
          k = -h,
          l = g * g + k * k,
          m = l + g * g + k * h;
        l = ((4 / 3) * (Math.sqrt(2 * l * m) - m)) / (g * h - k * g);
        h = g - l * k;
        g = k + l * g;
        k = -g;
        l = f + b;
        f = Math.cos(l);
        l = Math.sin(l);
        return [
          d + a * Math.cos(b),
          e + a * Math.sin(b),
          d + h * f - g * l,
          e + h * l + g * f,
          d + h * f - k * l,
          e + h * l + k * f,
          d + a * Math.cos(c),
          e + a * Math.sin(c),
        ];
      },
      lq: function (a, b, c, d, e, f, g) {
        c = Math.floor((a - c) / e) * e + c;
        d = Math.floor((b - d) / f) * f + d;
        var h = c;
        c + e - a < e / 2 && (h = c + e);
        a = d;
        d + f - b < f / 2 && (a = d + f);
        g.h(h, a);
        return g;
      },
      Px: function (a, b) {
        var c = Math.max(a, b);
        a = Math.min(a, b);
        var d;
        do (b = c % a), (c = d = a), (a = b);
        while (0 < b);
        return d;
      },
      dz: function (a, b, c, d) {
        var e = 0 > c,
          f = 0 > d;
        if (a < b) {
          var g = 1;
          var h = 0;
        } else (g = 0), (h = 1);
        var k = 0 === g ? a : b;
        var l = 0 === g ? c : d;
        if (0 === g ? e : f) l = -l;
        g = h;
        c = 0 === g ? c : d;
        if (0 === g ? e : f) c = -c;
        return J.ez(k, 0 === g ? a : b, l, c, 0, 0);
      },
      ez: function (a, b, c, d, e, f) {
        if (0 < d)
          if (0 < c) {
            e = a * a;
            f = b * b;
            a *= c;
            var g = b * d,
              h = -f + g,
              k = -f + Math.sqrt(a * a + g * g);
            b = h;
            for (var l = 0; 9999999999 > l; ++l) {
              b = 0.5 * (h + k);
              if (b === h || b === k) break;
              var m = a / (b + e),
                n = g / (b + f);
              m = m * m + n * n - 1;
              if (0 < m) h = b;
              else if (0 > m) k = b;
              else break;
            }
            c = (e * c) / (b + e) - c;
            d = (f * d) / (b + f) - d;
            c = Math.sqrt(c * c + d * d);
          } else c = Math.abs(d - b);
        else
          (d = a * a - b * b),
            (f = a * c),
            f < d
              ? ((d = f / d),
                (f = b * Math.sqrt(Math.abs(1 - d * d))),
                (c = a * d - c),
                (c = Math.sqrt(c * c + f * f)))
              : (c = Math.abs(c - a));
        return c;
      },
      He: new db(),
      Nm: new db(),
      Ef: new db(),
      Ff: 0,
    };
    J.za = J.FA;
    function td(a) {
      Za(this);
      this.s = !1;
      void 0 === a && (a = ud);
      this.qa = a;
      this.zc = this.nc = this.$c = this.Zc = 0;
      this.rj = new E();
      this.Dr = this.rj.xa;
      this.jr = new N().freeze();
      this.pa = !0;
      this.Um = this.Hk = null;
      this.Vm = NaN;
      this.ff = vc;
      this.gf = Gc;
      this.kl = this.ll = NaN;
      this.Pf = vd;
    }
    td.prototype.copy = function () {
      var a = new td();
      a.qa = this.qa;
      a.Zc = this.Zc;
      a.$c = this.$c;
      a.nc = this.nc;
      a.zc = this.zc;
      for (var b = this.rj.j, c = b.length, d = a.rj, e = 0; e < c; e++) {
        var f = b[e].copy();
        d.add(f);
      }
      a.Dr = this.Dr;
      a.jr.assign(this.jr);
      a.pa = this.pa;
      a.Hk = this.Hk;
      a.Um = this.Um;
      a.Vm = this.Vm;
      a.ff = this.ff.G();
      a.gf = this.gf.G();
      a.ll = this.ll;
      a.kl = this.kl;
      a.Pf = this.Pf;
      return a;
    };
    t = td.prototype;
    t.ca = function () {
      this.freeze();
      Object.freeze(this);
      return this;
    };
    t.freeze = function () {
      this.s = !0;
      var a = this.figures;
      a.freeze();
      a = a.j;
      for (var b = a.length, c = 0; c < b; c++) a[c].freeze();
      return this;
    };
    t.ea = function () {
      Object.isFrozen(this) && B('cannot thaw constant: ' + this);
      this.s = !1;
      var a = this.figures;
      a.ea();
      a = a.j;
      for (var b = a.length, c = 0; c < b; c++) a[c].ea();
      return this;
    };
    t.Ma = function (a) {
      if (!(a instanceof td)) return !1;
      if (this.type !== a.type)
        return this.type === wd && a.type === ud
          ? xd(this, a)
          : a.type === wd && this.type === ud
          ? xd(a, this)
          : !1;
      if (this.type === ud) {
        var b = this.figures.j;
        a = a.figures.j;
        var c = b.length;
        if (c !== a.length) return !1;
        for (var d = 0; d < c; d++) if (!b[d].Ma(a[d])) return !1;
        return !0;
      }
      return (
        J.w(this.startX, a.startX) &&
        J.w(this.startY, a.startY) &&
        J.w(this.endX, a.endX) &&
        J.w(this.endY, a.endY)
      );
    };
    function xd(a, b) {
      return a.type !== wd || b.type !== ud
        ? !1
        : 1 === b.figures.count &&
          ((b = b.figures.L(0)),
          1 === b.segments.count &&
            J.w(a.startX, b.startX) &&
            J.w(a.startY, b.startY) &&
            ((b = b.segments.L(0)),
            b.type === Ed && J.w(a.endX, b.endX) && J.w(a.endY, b.endY)))
        ? !0
        : !1;
    }
    function Fd(a) {
      return a.toString();
    }
    t.bb = function (a) {
      a.classType === td && (this.type = a);
    };
    t.toString = function (a) {
      void 0 === a && (a = -1);
      switch (this.type) {
        case wd:
          return 0 > a
            ? 'M' +
                this.startX.toString() +
                ' ' +
                this.startY.toString() +
                'L' +
                this.endX.toString() +
                ' ' +
                this.endY.toString()
            : 'M' +
                this.startX.toFixed(a) +
                ' ' +
                this.startY.toFixed(a) +
                'L' +
                this.endX.toFixed(a) +
                ' ' +
                this.endY.toFixed(a);
        case Gd:
          var b = new N(this.startX, this.startY, 0, 0);
          b.uw(this.endX, this.endY, 0, 0);
          return 0 > a
            ? 'M' +
                b.x.toString() +
                ' ' +
                b.y.toString() +
                'H' +
                b.right.toString() +
                'V' +
                b.bottom.toString() +
                'H' +
                b.left.toString() +
                'z'
            : 'M' +
                b.x.toFixed(a) +
                ' ' +
                b.y.toFixed(a) +
                'H' +
                b.right.toFixed(a) +
                'V' +
                b.bottom.toFixed(a) +
                'H' +
                b.left.toFixed(a) +
                'z';
        case Hd:
          b = new N(this.startX, this.startY, 0, 0);
          b.uw(this.endX, this.endY, 0, 0);
          if (0 > a)
            return (
              (a = b.left.toString() + ' ' + (b.y + b.height / 2).toString()),
              'M' +
                a +
                'A' +
                (b.width / 2).toString() +
                ' ' +
                (b.height / 2).toString() +
                ' 0 0 1 ' +
                (b.right.toString() + ' ' + (b.y + b.height / 2).toString()) +
                'A' +
                (b.width / 2).toString() +
                ' ' +
                (b.height / 2).toString() +
                ' 0 0 1 ' +
                a
            );
          var c = b.left.toFixed(a) + ' ' + (b.y + b.height / 2).toFixed(a);
          return (
            'M' +
            c +
            'A' +
            (b.width / 2).toFixed(a) +
            ' ' +
            (b.height / 2).toFixed(a) +
            ' 0 0 1 ' +
            (b.right.toFixed(a) + ' ' + (b.y + b.height / 2).toFixed(a)) +
            'A' +
            (b.width / 2).toFixed(a) +
            ' ' +
            (b.height / 2).toFixed(a) +
            ' 0 0 1 ' +
            c
          );
        case ud:
          b = '';
          c = this.figures.j;
          for (var d = c.length, e = 0; e < d; e++) {
            var f = c[e];
            0 < e && (b += ' x ');
            f.isFilled && (b += 'F ');
            b += f.toString(a);
          }
          return b;
        default:
          return this.type.toString();
      }
    };
    function Id(a, b) {
      function c() {
        return u >= A - 1
          ? !0
          : null !== k[u + 1].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/);
      }
      function d() {
        u++;
        return k[u];
      }
      function e() {
        var a = new H(parseFloat(d()), parseFloat(d()));
        v === v.toLowerCase() && ((a.x = z.x + a.x), (a.y = z.y + a.y));
        return a;
      }
      function f() {
        return (z = e());
      }
      function g() {
        return (y = e());
      }
      function h() {
        var a = w.toLowerCase();
        return 'c' !== a && 's' !== a && 'q' !== a && 't' !== a
          ? z
          : new H(2 * z.x - y.x, 2 * z.y - y.y);
      }
      void 0 === b && (b = !1);
      a = a.replace(/,/gm, ' ');
      a = a.replace(
        /([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,
        '$1 $2',
      );
      a = a.replace(
        /([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,
        '$1 $2',
      );
      a = a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([^\s])/gm, '$1 $2');
      a = a.replace(/([^\s])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm, '$1 $2');
      a = a.replace(/([0-9])([+\-])/gm, '$1 $2');
      a = a.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm, '$1 $3 $4 ');
      a = a.replace(/[\s\r\t\n]+/gm, ' ');
      a = a.replace(/^\s+|\s+$/g, '');
      var k = a.split(' ');
      for (a = 0; a < k.length; a++) {
        var l = k[a];
        if (null !== l.match(/(\.[0-9]*)(\.)/gm)) {
          for (var m = Ea(), n = '', p = !1, r = 0; r < l.length; r++) {
            var q = l[r];
            '.' !== q || p
              ? '.' === q
                ? (m.push(n), (n = '.'))
                : (n += q)
              : ((p = !0), (n += q));
          }
          m.push(n);
          k.splice(a, 1);
          for (l = 0; l < m.length; l++) k.splice(a + l, 0, m[l]);
          a += m.length - 1;
          Ha(m);
        }
      }
      var u = -1,
        v = '',
        w = '';
      m = new H(0, 0);
      var y = new H(0, 0),
        z = new H(0, 0),
        A = k.length;
      a = Jd(null);
      n = l = !1;
      p = !0;
      for (r = null; !(u >= A - 1); )
        if (((w = v), (v = d()), '' !== v))
          switch (v.toUpperCase()) {
            case 'X':
              p = !0;
              n = l = !1;
              break;
            case 'M':
              r = f();
              null === a.ec || !0 === p
                ? (Kd(a, r.x, r.y, l, !n), (p = !1))
                : a.moveTo(r.x, r.y);
              for (m = z; !c(); ) (r = f()), a.lineTo(r.x, r.y);
              break;
            case 'L':
              for (; !c(); ) (r = f()), a.lineTo(r.x, r.y);
              break;
            case 'H':
              for (; !c(); )
                (z = new H(
                  (v === v.toLowerCase() ? z.x : 0) + parseFloat(d()),
                  z.y,
                )),
                  a.lineTo(z.x, z.y);
              break;
            case 'V':
              for (; !c(); )
                (z = new H(
                  z.x,
                  (v === v.toLowerCase() ? z.y : 0) + parseFloat(d()),
                )),
                  a.lineTo(z.x, z.y);
              break;
            case 'C':
              for (; !c(); ) {
                r = e();
                q = g();
                var C = f();
                Ld(a, r.x, r.y, q.x, q.y, C.x, C.y);
              }
              break;
            case 'S':
              for (; !c(); )
                (r = h()),
                  (q = g()),
                  (C = f()),
                  Ld(a, r.x, r.y, q.x, q.y, C.x, C.y);
              break;
            case 'Q':
              for (; !c(); ) (r = g()), (q = f()), Md(a, r.x, r.y, q.x, q.y);
              break;
            case 'T':
              for (; !c(); ) (y = r = h()), (q = f()), Md(a, r.x, r.y, q.x, q.y);
              break;
            case 'B':
              for (; !c(); ) {
                r = parseFloat(d());
                q = parseFloat(d());
                C = parseFloat(d());
                var I = parseFloat(d()),
                  P = parseFloat(d()),
                  K = P,
                  V = !1;
                c() ||
                  ((K = parseFloat(d())), c() || (V = 0 !== parseFloat(d())));
                v === v.toLowerCase() && ((C += z.x), (I += z.y));
                a.arcTo(r, q, C, I, P, K, V);
              }
              break;
            case 'A':
              for (; !c(); )
                (r = Math.abs(parseFloat(d()))),
                  (q = Math.abs(parseFloat(d()))),
                  (C = parseFloat(d())),
                  (I = !!parseFloat(d())),
                  (P = !!parseFloat(d())),
                  (K = f()),
                  Rd(a, r, q, C, I, P, K.x, K.y);
              break;
            case 'Z':
              Sd(a);
              z = m;
              break;
            case 'F':
              r = '';
              for (q = 1; k[u + q]; )
                if (null !== k[u + q].match(/[Uu]/)) q++;
                else if (
                  null === k[u + q].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/)
                )
                  q++;
                else {
                  r = k[u + q];
                  break;
                }
              r.match(/[Mm]/)
                ? (l = !0)
                : 0 < a.ec.segments.length && (a.ec.isFilled = !0);
              break;
            case 'U':
              r = '';
              for (q = 1; k[u + q]; )
                if (null !== k[u + q].match(/[Ff]/)) q++;
                else if (
                  null === k[u + q].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/)
                )
                  q++;
                else {
                  r = k[u + q];
                  break;
                }
              r.match(/[Mm]/) ? (n = !0) : a.Kq(!1);
          }
      m = a.lt;
      Td = a;
      if (b) for (b = m.figures.iterator; b.next(); ) b.value.isFilled = !0;
      return m;
    }
    function Ud(a, b) {
      for (var c = a.length, d = H.alloc(), e = 0; e < c; e++) {
        var f = a[e];
        d.x = f[0];
        d.y = f[1];
        b.ra(d);
        f[0] = d.x;
        f[1] = d.y;
        d.x = f[2];
        d.y = f[3];
        b.ra(d);
        f[2] = d.x;
        f[3] = d.y;
        d.x = f[4];
        d.y = f[5];
        b.ra(d);
        f[4] = d.x;
        f[5] = d.y;
        d.x = f[6];
        d.y = f[7];
        b.ra(d);
        f[6] = d.x;
        f[7] = d.y;
      }
      H.free(d);
    }
    t.Lv = function () {
      if (this.pa || this.Dr !== this.figures.xa) return !0;
      for (var a = this.figures.j, b = a.length, c = 0; c < b; c++)
        if (a[c].Lv()) return !0;
      return !1;
    };
    td.prototype.computeBounds = function () {
      this.pa = !1;
      this.Um = this.Hk = null;
      this.Vm = NaN;
      this.Dr = this.figures.xa;
      for (var a = this.figures.j, b = a.length, c = 0; c < b; c++) {
        var d = a[c];
        d.pa = !1;
        var e = d.segments;
        d.Hs = e.xa;
        d = e.j;
        e = d.length;
        for (var f = 0; f < e; f++) {
          var g = d[f];
          g.pa = !1;
          g.Je = null;
        }
      }
      a = this.jr;
      a.ea();
      isNaN(this.ll) || isNaN(this.kl)
        ? a.h(0, 0, 0, 0)
        : a.h(0, 0, this.ll, this.kl);
      Vd(this, a, !1);
      ec(a, 0, 0, 0, 0);
      a.freeze();
    };
    td.prototype.Fx = function () {
      var a = new N();
      Vd(this, a, !0);
      return a;
    };
    function Vd(a, b, c) {
      switch (a.type) {
        case wd:
        case Gd:
        case Hd:
          c ? b.h(a.Zc, a.$c, 0, 0) : ec(b, a.Zc, a.$c, 0, 0);
          ec(b, a.nc, a.zc, 0, 0);
          break;
        case ud:
          var d = a.figures;
          a = d.j;
          d = d.length;
          for (var e = 0; e < d; e++) {
            var f = a[e];
            c && 0 === e
              ? b.h(f.startX, f.startY, 0, 0)
              : ec(b, f.startX, f.startY, 0, 0);
            for (
              var g = f.segments.j,
                h = g.length,
                k = f.startX,
                l = f.startY,
                m = 0;
              m < h;
              m++
            ) {
              var n = g[m];
              switch (n.type) {
                case Ed:
                case Wd:
                  k = n.endX;
                  l = n.endY;
                  ec(b, k, l, 0, 0);
                  break;
                case Xd:
                  J.cm(
                    k,
                    l,
                    n.point1X,
                    n.point1Y,
                    n.point2X,
                    n.point2Y,
                    n.endX,
                    n.endY,
                    0.5,
                    b,
                  );
                  k = n.endX;
                  l = n.endY;
                  break;
                case Yd:
                  J.Uv(k, l, n.point1X, n.point1Y, n.endX, n.endY, 0.5, b);
                  k = n.endX;
                  l = n.endY;
                  break;
                case Zd:
                case $d:
                  var p = n.type === Zd ? ae(n, f) : be(n, f, k, l),
                    r = p.length;
                  if (0 === r) {
                    k = n.centerX;
                    l = n.centerY;
                    ec(b, k, l, 0, 0);
                    break;
                  }
                  n = null;
                  for (var q = 0; q < r; q++)
                    (n = p[q]),
                      J.cm(
                        n[0],
                        n[1],
                        n[2],
                        n[3],
                        n[4],
                        n[5],
                        n[6],
                        n[7],
                        0.5,
                        b,
                      );
                  null !== n && ((k = n[6]), (l = n[7]));
                  break;
                default:
                  B('Unknown Segment type: ' + n.type);
              }
            }
          }
          break;
        default:
          B('Unknown Geometry type: ' + a.type);
      }
    }
    td.prototype.normalize = function () {
      this.s && ua(this);
      var a = this.Fx();
      this.offset(-a.x, -a.y);
      return new H(-a.x, -a.y);
    };
    td.prototype.offset = function (a, b) {
      this.s && ua(this);
      this.transform(1, 0, 0, 1, a, b);
      return this;
    };
    td.prototype.scale = function (a, b) {
      this.s && ua(this);
      this.transform(a, 0, 0, b, 0, 0);
      return this;
    };
    td.prototype.rotate = function (a, b, c) {
      this.s && ua(this);
      void 0 === b && (b = 0);
      void 0 === c && (c = 0);
      var d = rd.alloc();
      d.reset();
      d.rotate(a, b, c);
      this.transform(d.m11, d.m12, d.m21, d.m22, d.dx, d.dy);
      rd.free(d);
      return this;
    };
    t = td.prototype;
    t.transform = function (a, b, c, d, e, f) {
      switch (this.type) {
        case wd:
        case Gd:
        case Hd:
          var g = this.Zc;
          var h = this.$c;
          this.Zc = g * a + h * c + e;
          this.$c = g * b + h * d + f;
          g = this.nc;
          h = this.zc;
          this.nc = g * a + h * c + e;
          this.zc = g * b + h * d + f;
          break;
        case ud:
          for (var k = this.figures.j, l = k.length, m = 0; m < l; m++) {
            var n = k[m];
            g = n.startX;
            h = n.startY;
            n.startX = g * a + h * c + e;
            n.startY = g * b + h * d + f;
            n = n.segments.j;
            for (var p = n.length, r = 0; r < p; r++) {
              var q = n[r];
              switch (q.type) {
                case Ed:
                case Wd:
                  g = q.endX;
                  h = q.endY;
                  q.endX = g * a + h * c + e;
                  q.endY = g * b + h * d + f;
                  break;
                case Xd:
                  g = q.point1X;
                  h = q.point1Y;
                  q.point1X = g * a + h * c + e;
                  q.point1Y = g * b + h * d + f;
                  g = q.point2X;
                  h = q.point2Y;
                  q.point2X = g * a + h * c + e;
                  q.point2Y = g * b + h * d + f;
                  g = q.endX;
                  h = q.endY;
                  q.endX = g * a + h * c + e;
                  q.endY = g * b + h * d + f;
                  break;
                case Yd:
                  g = q.point1X;
                  h = q.point1Y;
                  q.point1X = g * a + h * c + e;
                  q.point1Y = g * b + h * d + f;
                  g = q.endX;
                  h = q.endY;
                  q.endX = g * a + h * c + e;
                  q.endY = g * b + h * d + f;
                  break;
                case Zd:
                  g = q.centerX;
                  h = q.centerY;
                  q.centerX = g * a + h * c + e;
                  q.centerY = g * b + h * d + f;
                  0 !== b &&
                    ((g = (180 * Math.atan2(b, a)) / Math.PI),
                    0 > g && (g += 360),
                    (q.startAngle += g));
                  0 > a &&
                    ((q.startAngle = 180 - q.startAngle),
                    (q.sweepAngle = -q.sweepAngle));
                  0 > d &&
                    ((q.startAngle = -q.startAngle),
                    (q.sweepAngle = -q.sweepAngle));
                  q.radiusX *= Math.sqrt(a * a + c * c);
                  void 0 !== q.radiusY && (q.radiusY *= Math.sqrt(b * b + d * d));
                  break;
                case $d:
                  g = q.endX;
                  h = q.endY;
                  q.endX = g * a + h * c + e;
                  q.endY = g * b + h * d + f;
                  0 !== b &&
                    ((g = (180 * Math.atan2(b, a)) / Math.PI),
                    0 > g && (g += 360),
                    (q.xAxisRotation += g));
                  0 > a &&
                    ((q.xAxisRotation = 180 - q.xAxisRotation),
                    (q.isClockwiseArc = !q.isClockwiseArc));
                  0 > d &&
                    ((q.xAxisRotation = -q.xAxisRotation),
                    (q.isClockwiseArc = !q.isClockwiseArc));
                  q.radiusX *= Math.sqrt(a * a + c * c);
                  q.radiusY *= Math.sqrt(b * b + d * d);
                  break;
                default:
                  B('Unknown Segment type: ' + q.type);
              }
            }
          }
      }
      this.pa = !0;
      return this;
    };
    t.aa = function (a, b, c, d) {
      var e = a.x;
      a = a.y;
      for (
        var f = this.bounds.x - 20,
          g = 0,
          h,
          k,
          l,
          m,
          n,
          p = this.figures.j,
          r = p.length,
          q = 0;
        q < r;
        q++
      ) {
        var u = p[q];
        if (u.isFilled) {
          if (c && u.aa(e, a, b)) return !0;
          var v = u.segments;
          h = u.startX;
          k = u.startY;
          for (var w = h, y = k, z = v.j, A = 0; A <= v.length; A++) {
            var C = void 0;
            if (A !== v.length) {
              C = z[A];
              var I = C.type;
              m = C.endX;
              n = C.endY;
            } else (I = Ed), (m = w), (n = y);
            switch (I) {
              case Wd:
                w = ce(e, a, f, a, h, k, w, y);
                if (isNaN(w)) return !0;
                g += w;
                w = m;
                y = n;
                break;
              case Ed:
                h = ce(e, a, f, a, h, k, m, n);
                if (isNaN(h)) return !0;
                g += h;
                break;
              case Xd:
                l = J.eq(
                  h,
                  k,
                  C.point1X,
                  C.point1Y,
                  C.point2X,
                  C.point2Y,
                  m,
                  n,
                  f,
                  a,
                  e,
                  a,
                  0.5,
                );
                g += l;
                break;
              case Yd:
                l = J.eq(
                  h,
                  k,
                  (h + 2 * C.point1X) / 3,
                  (k + 2 * C.point1Y) / 3,
                  (2 * C.point1X + m) / 3,
                  (2 * C.point1Y + n) / 3,
                  m,
                  n,
                  f,
                  a,
                  e,
                  a,
                  0.5,
                );
                g += l;
                break;
              case Zd:
              case $d:
                I = C.type === Zd ? ae(C, u) : be(C, u, h, k);
                var P = I.length;
                if (0 === P) {
                  h = ce(e, a, f, a, h, k, C.centerX, C.centerY);
                  if (isNaN(h)) return !0;
                  g += h;
                  break;
                }
                C = null;
                for (var K = 0; K < P; K++) {
                  C = I[K];
                  if (0 === K) {
                    l = ce(e, a, f, a, h, k, C[0], C[1]);
                    if (isNaN(l)) return !0;
                    g += l;
                  }
                  l = J.eq(
                    C[0],
                    C[1],
                    C[2],
                    C[3],
                    C[4],
                    C[5],
                    C[6],
                    C[7],
                    f,
                    a,
                    e,
                    a,
                    0.5,
                  );
                  g += l;
                }
                null !== C && ((m = C[6]), (n = C[7]));
                break;
              default:
                B('Unknown Segment type: ' + C.type);
            }
            h = m;
            k = n;
          }
          if (0 !== g) return !0;
          g = 0;
        } else if (u.aa(e, a, d ? b : b + 2)) return !0;
      }
      return 0 !== g;
    };
    function ce(a, b, c, d, e, f, g, h) {
      if (J.Xb(e, f, g, h, 0.05, a, b)) return NaN;
      var k = (a - c) * (f - h);
      if (0 === k) return 0;
      var l = ((a * d - b * c) * (e - g) - (a - c) * (e * h - f * g)) / k;
      b = ((a * d - b * c) * (f - h)) / k;
      if (l >= a) return 0;
      if ((e > g ? e - g : g - e) < (f > h ? f - h : h - f))
        if (f < h) {
          if (b < f || b > h) return 0;
        } else {
          if (b < h || b > f) return 0;
        }
      else if (e < g) {
        if (l < e || l > g) return 0;
      } else if (l < g || l > e) return 0;
      return 0 < k ? 1 : -1;
    }
    function de(a, b, c, d) {
      a = a.figures.j;
      for (var e = a.length, f = 0; f < e; f++) if (a[f].aa(b, c, d)) return !0;
      return !1;
    }
    t.Bv = function (a, b) {
      0 > a ? (a = 0) : 1 < a && (a = 1);
      void 0 === b && (b = new H());
      if (this.type === wd)
        return (
          b.h(
            this.startX + a * (this.endX - this.startX),
            this.startY + a * (this.endY - this.startY),
          ),
          b
        );
      for (
        var c = this.flattenedSegments,
          d = this.flattenedLengths,
          e = c.length,
          f = this.flattenedTotalLength * a,
          g = 0,
          h = 0;
        h < e;
        h++
      ) {
        var k = d[h],
          l = k.length;
        for (a = 0; a < l; a++) {
          var m = k[a];
          if (g + m >= f)
            return (
              (d = f - g),
              (d = 0 === m ? 0 : d / m),
              (c = c[h]),
              (h = c[2 * a]),
              (e = c[2 * a + 1]),
              b.h(h + (c[2 * a + 2] - h) * d, e + (c[2 * a + 3] - e) * d),
              b
            );
          g += m;
        }
      }
      return b;
    };
    t.Qx = function (a) {
      0 > a ? (a = 0) : 1 < a && (a = 1);
      if (this.type === wd)
        return (
          (180 * Math.atan2(this.endY - this.startY, this.endX - this.startX)) /
          Math.PI
        );
      for (
        var b = this.flattenedSegments,
          c = this.flattenedLengths,
          d = b.length,
          e = this.flattenedTotalLength * a,
          f = 0,
          g = 0;
        g < d;
        g++
      ) {
        var h = c[g],
          k = h.length;
        for (a = 0; a < k; a++) {
          var l = h[a];
          if (f + l >= e)
            return (
              (e = b[g]),
              (b = e[2 * a]),
              (c = e[2 * a + 1]),
              (d = e[2 * a + 2]),
              (a = e[2 * a + 3]),
              1 > Math.abs(d - b) && 1 > Math.abs(a - c)
                ? 0
                : 1 > Math.abs(d - b)
                ? 0 <= a - c
                  ? 90
                  : 270
                : 1 > Math.abs(a - c)
                ? 0 <= d - b
                  ? 0
                  : 180
                : (180 * Math.atan2(a - c, d - b)) / Math.PI
            );
          f += l;
        }
      }
      return NaN;
    };
    t.Cv = function (a, b) {
      0 > a ? (a = 0) : 1 < a && (a = 1);
      void 0 === b && (b = []);
      b.length = 3;
      if (this.type === wd)
        return (
          (b[0] = this.startX + a * (this.endX - this.startX)),
          (b[1] = this.startY + a * (this.endY - this.startY)),
          (b[2] =
            (180 * Math.atan2(this.endY - this.startY, this.endX - this.startX)) /
            Math.PI),
          b
        );
      for (
        var c = this.flattenedSegments,
          d = this.flattenedLengths,
          e = c.length,
          f = this.flattenedTotalLength * a,
          g = 0,
          h = 0;
        h < e;
        h++
      ) {
        var k = d[h],
          l = k.length;
        for (a = 0; a < l; a++) {
          var m = k[a];
          if (g + m >= f)
            return (
              (d = f - g),
              (d = 0 === m ? 0 : d / m),
              (m = c[h]),
              (c = m[2 * a]),
              (h = m[2 * a + 1]),
              (e = m[2 * a + 2]),
              (a = m[2 * a + 3]),
              (b[0] = c + (e - c) * d),
              (b[1] = h + (a - h) * d),
              (b[2] =
                1 > Math.abs(e - c) && 1 > Math.abs(a - h)
                  ? 0
                  : 1 > Math.abs(e - c)
                  ? 0 <= a - h
                    ? 90
                    : 270
                  : 1 > Math.abs(a - h)
                  ? 0 <= e - c
                    ? 0
                    : 180
                  : (180 * Math.atan2(a - h, e - c)) / Math.PI),
              b
            );
          g += m;
        }
      }
      return b;
    };
    t.Rx = function (a) {
      if (this.type === wd) {
        var b = this.startX,
          c = this.startY,
          d = this.endX,
          e = this.endY;
        if (b !== d || c !== e) {
          var f = a.x;
          a = a.y;
          if (b === d) {
            if (c < e) {
              var g = c;
              d = e;
            } else (g = e), (d = c);
            return a <= g
              ? g === c
                ? 0
                : 1
              : a >= d
              ? d === c
                ? 0
                : 1
              : Math.abs(a - c) / (d - g);
          }
          if (c === e)
            return (
              b < d ? (g = b) : ((g = d), (d = b)),
              f <= g
                ? g === b
                  ? 0
                  : 1
                : f >= d
                ? d === b
                  ? 0
                  : 1
                : Math.abs(f - b) / (d - g)
            );
          g = (d - b) * (d - b) + (e - c) * (e - c);
          var h = H.alloc();
          J.Mh(b, c, d, e, f, a, h);
          a = h.x;
          f = h.y;
          H.free(h);
          return Math.sqrt(((a - b) * (a - b) + (f - c) * (f - c)) / g);
        }
      } else if (this.type === Gd) {
        g = this.startX;
        h = this.startY;
        var k = this.endX;
        e = this.endY;
        if (g !== k || h !== e) {
          b = k - g;
          c = e - h;
          f = 2 * b + 2 * c;
          d = a.x;
          a = a.y;
          d = Math.min(Math.max(d, g), k);
          a = Math.min(Math.max(a, h), e);
          g = Math.abs(d - g);
          k = Math.abs(d - k);
          h = Math.abs(a - h);
          e = Math.abs(a - e);
          var l = Math.min(g, k, h, e);
          if (l === h) return d / f;
          if (l === k) return (b + a) / f;
          if (l === e) return (2 * b + c - d) / f;
          if (l === g) return (2 * b + 2 * c - a) / f;
        }
      } else {
        b = this.flattenedSegments;
        c = this.flattenedLengths;
        f = this.flattenedTotalLength;
        d = H.alloc();
        e = Infinity;
        h = g = 0;
        k = b.length;
        for (var m = (l = 0), n = 0; n < k; n++)
          for (var p = b[n], r = c[n], q = p.length, u = 0; u < q; u += 2) {
            var v = p[u],
              w = p[u + 1];
            if (0 !== u) {
              J.Mh(l, m, v, w, a.x, a.y, d);
              var y = (d.x - a.x) * (d.x - a.x) + (d.y - a.y) * (d.y - a.y);
              y < e &&
                ((e = y),
                (g = h),
                (g += Math.sqrt((d.x - l) * (d.x - l) + (d.y - m) * (d.y - m))));
              h += r[(u - 2) / 2];
            }
            l = v;
            m = w;
          }
        H.free(d);
        a = g / f;
        return 0 > a ? 0 : 1 < a ? 1 : a;
      }
      return 0;
    };
    function ee(a) {
      if (null === a.Hk) {
        var b = (a.Hk = []),
          c = (a.Um = []),
          d = [],
          e = [];
        if (a.type === wd)
          d.push(a.startX),
            d.push(a.startY),
            d.push(a.endX),
            d.push(a.endY),
            b.push(d),
            e.push(
              Math.sqrt(
                (a.startX - a.endX) * (a.startX - a.endX) +
                  (a.startY - a.endY) * (a.startY - a.endY),
              ),
            ),
            c.push(e);
        else if (a.type === Gd)
          d.push(a.startX),
            d.push(a.startY),
            d.push(a.endX),
            d.push(a.startY),
            d.push(a.endX),
            d.push(a.endY),
            d.push(a.startX),
            d.push(a.endY),
            d.push(a.startX),
            d.push(a.startY),
            b.push(d),
            e.push(Math.abs(a.startX - a.endX)),
            e.push(Math.abs(a.startY - a.endY)),
            e.push(Math.abs(a.startX - a.endX)),
            e.push(Math.abs(a.startY - a.endY)),
            c.push(e);
        else if (a.type === Hd) {
          var f = new fe();
          f.startX = a.endX;
          f.startY = (a.startY + a.endY) / 2;
          var g = new ge(Zd);
          g.startAngle = 0;
          g.sweepAngle = 360;
          g.centerX = (a.startX + a.endX) / 2;
          g.centerY = (a.startY + a.endY) / 2;
          g.radiusX = Math.abs(a.startX - a.endX) / 2;
          g.radiusY = Math.abs(a.startY - a.endY) / 2;
          f.add(g);
          a = ae(g, f);
          e = a.length;
          if (0 === e) d.push(g.centerX), d.push(g.centerY);
          else {
            g = f.startX;
            f = f.startY;
            for (var h = 0; h < e; h++) {
              var k = a[h];
              J.ze(g, f, k[2], k[3], k[4], k[5], k[6], k[7], 0.5, d);
              g = k[6];
              f = k[7];
            }
          }
          b.push(d);
          c.push(le(d));
        } else
          for (a = a.figures.iterator; a.next(); ) {
            e = a.value;
            d = [];
            d.push(e.startX);
            d.push(e.startY);
            g = e.startX;
            f = e.startY;
            h = g;
            k = f;
            for (var l = e.segments.j, m = l.length, n = 0; n < m; n++) {
              var p = l[n];
              switch (p.type) {
                case Wd:
                  4 <= d.length && (b.push(d), c.push(le(d)));
                  d = [];
                  d.push(p.endX);
                  d.push(p.endY);
                  g = p.endX;
                  f = p.endY;
                  h = g;
                  k = f;
                  break;
                case Ed:
                  d.push(p.endX);
                  d.push(p.endY);
                  g = p.endX;
                  f = p.endY;
                  break;
                case Xd:
                  J.ze(
                    g,
                    f,
                    p.point1X,
                    p.point1Y,
                    p.point2X,
                    p.point2Y,
                    p.endX,
                    p.endY,
                    0.5,
                    d,
                  );
                  g = p.endX;
                  f = p.endY;
                  break;
                case Yd:
                  J.Bq(g, f, p.point1X, p.point1Y, p.endX, p.endY, 0.5, d);
                  g = p.endX;
                  f = p.endY;
                  break;
                case Zd:
                  var r = ae(p, e),
                    q = r.length;
                  if (0 === q) {
                    d.push(p.centerX);
                    d.push(p.centerY);
                    g = p.centerX;
                    f = p.centerY;
                    break;
                  }
                  for (var u = 0; u < q; u++) {
                    var v = r[u];
                    J.ze(g, f, v[2], v[3], v[4], v[5], v[6], v[7], 0.5, d);
                    g = v[6];
                    f = v[7];
                  }
                  break;
                case $d:
                  r = be(p, e, g, f);
                  q = r.length;
                  if (0 === q) {
                    d.push(p.centerX);
                    d.push(p.centerY);
                    g = p.centerX;
                    f = p.centerY;
                    break;
                  }
                  for (u = 0; u < q; u++)
                    (v = r[u]),
                      J.ze(g, f, v[2], v[3], v[4], v[5], v[6], v[7], 0.5, d),
                      (g = v[6]),
                      (f = v[7]);
                  break;
                default:
                  B('Segment not of valid type: ' + p.type);
              }
              p.isClosed && (d.push(h), d.push(k));
            }
            4 <= d.length && (b.push(d), c.push(le(d)));
          }
      }
    }
    function le(a) {
      for (var b = [], c = 0, d = 0, e = a.length, f = 0; f < e; f += 2) {
        var g = a[f],
          h = a[f + 1];
        0 !== f && b.push(Math.sqrt(Bb(c, d, g, h)));
        c = g;
        d = h;
      }
      return b;
    }
    t.add = function (a) {
      this.rj.add(a);
      return this;
    };
    t.Jm = function (a, b, c, d, e, f, g, h) {
      this.s && ua(this);
      this.ff = new O(a, b, e, f).freeze();
      this.gf = new O(c, d, g, h).freeze();
      return this;
    };
    ma.Object.defineProperties(td.prototype, {
      flattenedSegments: {
        get: function () {
          ee(this);
          return this.Hk;
        },
      },
      flattenedLengths: {
        get: function () {
          ee(this);
          return this.Um;
        },
      },
      flattenedTotalLength: {
        get: function () {
          var a = this.Vm;
          if (isNaN(a)) {
            if (this.type === wd) {
              a = Math.abs(this.endX - this.startX);
              var b = Math.abs(this.endY - this.startY);
              a = Math.sqrt(a * a + b * b);
            } else if (this.type === Gd)
              a =
                2 * Math.abs(this.endX - this.startX) +
                2 * Math.abs(this.endY - this.startY);
            else {
              b = this.flattenedLengths;
              for (var c = b.length, d = (a = 0); d < c; d++)
                for (var e = b[d], f = e.length, g = 0; g < f; g++) a += e[g];
            }
            this.Vm = a;
          }
          return a;
        },
      },
      type: {
        get: function () {
          return this.qa;
        },
        set: function (a) {
          this.qa !== a && (this.s && ua(this, a), (this.qa = a), (this.pa = !0));
        },
      },
      startX: {
        get: function () {
          return this.Zc;
        },
        set: function (a) {
          this.Zc !== a && (this.s && ua(this, a), (this.Zc = a), (this.pa = !0));
        },
      },
      startY: {
        get: function () {
          return this.$c;
        },
        set: function (a) {
          this.$c !== a && (this.s && ua(this, a), (this.$c = a), (this.pa = !0));
        },
      },
      endX: {
        get: function () {
          return this.nc;
        },
        set: function (a) {
          this.nc !== a && (this.s && ua(this, a), (this.nc = a), (this.pa = !0));
        },
      },
      endY: {
        get: function () {
          return this.zc;
        },
        set: function (a) {
          this.zc !== a && (this.s && ua(this, a), (this.zc = a), (this.pa = !0));
        },
      },
      figures: {
        get: function () {
          return this.rj;
        },
        set: function (a) {
          this.rj !== a && (this.s && ua(this, a), (this.rj = a), (this.pa = !0));
        },
      },
      spot1: {
        get: function () {
          return this.ff;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.ff = a.G();
        },
      },
      spot2: {
        get: function () {
          return this.gf;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.gf = a.G();
        },
      },
      defaultStretch: {
        get: function () {
          return this.Pf;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.Pf = a;
        },
      },
      bounds: {
        get: function () {
          this.Lv() && this.computeBounds();
          return this.jr;
        },
      },
    });
    td.prototype.setSpots = td.prototype.Jm;
    td.prototype.add = td.prototype.add;
    td.prototype.getFractionForPoint = td.prototype.Rx;
    td.prototype.getPointAndAngleAlongPath = td.prototype.Cv;
    td.prototype.getAngleAlongPath = td.prototype.Qx;
    td.prototype.getPointAlongPath = td.prototype.Bv;
    td.prototype.transform = td.prototype.transform;
    td.prototype.rotate = td.prototype.rotate;
    td.prototype.scale = td.prototype.scale;
    td.prototype.offset = td.prototype.offset;
    td.prototype.normalize = td.prototype.normalize;
    td.prototype.computeBoundsWithoutOrigin = td.prototype.Fx;
    td.prototype.equalsApprox = td.prototype.Ma;
    var wd = new D(td, 'Line', 0),
      Gd = new D(td, 'Rectangle', 1),
      Hd = new D(td, 'Ellipse', 2),
      ud = new D(td, 'Path', 3);
    td.className = 'Geometry';
    td.stringify = Fd;
    td.fillPath = function (a) {
      a = a.split(/[Xx]/);
      for (var b = a.length, c = '', d = 0; d < b; d++) {
        var e = a[d];
        c =
          null !== e.match(/[Ff]/)
            ? 0 === d
              ? c + e
              : c + ('X' + (' ' === e[0] ? '' : ' ') + e)
            : c + ((0 === d ? '' : 'X ') + 'F' + (' ' === e[0] ? '' : ' ') + e);
      }
      return c;
    };
    td.parse = Id;
    td.Line = wd;
    td.Rectangle = Gd;
    td.Ellipse = Hd;
    td.Path = ud;
    function fe(a, b, c, d) {
      Za(this);
      this.s = !1;
      void 0 === c && (c = !0);
      this.Or = c;
      void 0 === d && (d = !0);
      this.Sr = d;
      void 0 !== a ? (this.Zc = a) : (this.Zc = 0);
      void 0 !== b ? (this.$c = b) : (this.$c = 0);
      this.Ml = new E();
      this.Hs = this.Ml.xa;
      this.pa = !0;
    }
    fe.prototype.copy = function () {
      var a = new fe();
      a.Or = this.Or;
      a.Sr = this.Sr;
      a.Zc = this.Zc;
      a.$c = this.$c;
      for (var b = this.Ml.j, c = b.length, d = a.Ml, e = 0; e < c; e++) {
        var f = b[e].copy();
        d.add(f);
      }
      a.Hs = this.Hs;
      a.pa = this.pa;
      return a;
    };
    t = fe.prototype;
    t.Ma = function (a) {
      if (
        !(
          a instanceof fe &&
          J.w(this.startX, a.startX) &&
          J.w(this.startY, a.startY)
        )
      )
        return !1;
      var b = this.segments.j;
      a = a.segments.j;
      var c = b.length;
      if (c !== a.length) return !1;
      for (var d = 0; d < c; d++) if (!b[d].Ma(a[d])) return !1;
      return !0;
    };
    t.toString = function (a) {
      void 0 === a && (a = -1);
      var b =
        0 > a
          ? 'M' + this.startX.toString() + ' ' + this.startY.toString()
          : 'M' + this.startX.toFixed(a) + ' ' + this.startY.toFixed(a);
      for (var c = this.segments.j, d = c.length, e = 0; e < d; e++)
        b += ' ' + c[e].toString(a);
      return b;
    };
    t.freeze = function () {
      this.s = !0;
      var a = this.segments;
      a.freeze();
      var b = a.j;
      a = a.length;
      for (var c = 0; c < a; c++) b[c].freeze();
      return this;
    };
    t.ea = function () {
      this.s = !1;
      var a = this.segments;
      a.ea();
      a = a.j;
      for (var b = a.length, c = 0; c < b; c++) a[c].ea();
      return this;
    };
    t.Lv = function () {
      if (this.pa) return !0;
      var a = this.segments;
      if (this.Hs !== a.xa) return !0;
      a = a.j;
      for (var b = a.length, c = 0; c < b; c++) if (a[c].pa) return !0;
      return !1;
    };
    t.add = function (a) {
      this.Ml.add(a);
      return this;
    };
    t.aa = function (a, b, c) {
      for (
        var d = this.startX,
          e = this.startY,
          f = d,
          g = e,
          h = this.segments.j,
          k = h.length,
          l = 0;
        l < k;
        l++
      ) {
        var m = h[l];
        switch (m.type) {
          case Wd:
            f = m.endX;
            g = m.endY;
            d = m.endX;
            e = m.endY;
            break;
          case Ed:
            if (J.Xb(d, e, m.endX, m.endY, c, a, b)) return !0;
            d = m.endX;
            e = m.endY;
            break;
          case Xd:
            if (
              J.$s(
                d,
                e,
                m.point1X,
                m.point1Y,
                m.point2X,
                m.point2Y,
                m.endX,
                m.endY,
                0.5,
                a,
                b,
                c,
              )
            )
              return !0;
            d = m.endX;
            e = m.endY;
            break;
          case Yd:
            if (J.Vv(d, e, m.point1X, m.point1Y, m.endX, m.endY, 0.5, a, b, c))
              return !0;
            d = m.endX;
            e = m.endY;
            break;
          case Zd:
          case $d:
            var n = m.type === Zd ? ae(m, this) : be(m, this, d, e),
              p = n.length;
            if (0 === p) {
              if (J.Xb(d, e, m.centerX, m.centerY, c, a, b)) return !0;
              d = m.centerX;
              e = m.centerY;
              break;
            }
            for (var r = null, q = 0; q < p; q++)
              if (
                ((r = n[q]),
                (0 === q && J.Xb(d, e, r[0], r[1], c, a, b)) ||
                  J.$s(
                    r[0],
                    r[1],
                    r[2],
                    r[3],
                    r[4],
                    r[5],
                    r[6],
                    r[7],
                    0.5,
                    a,
                    b,
                    c,
                  ))
              )
                return !0;
            null !== r && ((d = r[6]), (e = r[7]));
            break;
          default:
            B('Unknown Segment type: ' + m.type);
        }
        if (m.isClosed && (d !== f || e !== g) && J.Xb(d, e, f, g, c, a, b))
          return !0;
      }
      return !1;
    };
    ma.Object.defineProperties(fe.prototype, {
      isFilled: {
        get: function () {
          return this.Or;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.Or = a;
        },
      },
      isShadowed: {
        get: function () {
          return this.Sr;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.Sr = a;
        },
      },
      startX: {
        get: function () {
          return this.Zc;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.Zc = a;
          this.pa = !0;
        },
      },
      startY: {
        get: function () {
          return this.$c;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.$c = a;
          this.pa = !0;
        },
      },
      segments: {
        get: function () {
          return this.Ml;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.Ml = a;
          this.pa = !0;
        },
      },
    });
    fe.prototype.add = fe.prototype.add;
    fe.prototype.equalsApprox = fe.prototype.Ma;
    fe.className = 'PathFigure';
    function ge(a, b, c, d, e, f, g, h) {
      Za(this);
      this.s = !1;
      void 0 === a && (a = Ed);
      this.qa = a;
      void 0 !== b ? (this.nc = b) : (this.nc = 0);
      void 0 !== c ? (this.zc = c) : (this.zc = 0);
      void 0 === d && (d = 0);
      void 0 === e && (e = 0);
      void 0 === f && (f = 0);
      void 0 === g && (g = 0);
      a === $d
        ? ((a = f % 360),
          0 > a && (a += 360),
          (this.we = a),
          (this.Di = 0),
          (this.Ei = Math.max(d, 0)),
          (this.lh = Math.max(e, 0)),
          (this.tl = 'boolean' === typeof g ? !!g : !1),
          (this.Lk = !!h))
        : ((this.we = d),
          (this.Di = e),
          a === Zd && (f = Math.max(f, 0)),
          (this.Ei = f),
          'number' === typeof g
            ? (a === Zd && (g = Math.max(g, 0)), (this.lh = g))
            : (this.lh = 0),
          (this.Lk = this.tl = !1));
      this.wj = !1;
      this.pa = !0;
      this.Je = null;
    }
    ge.prototype.copy = function () {
      var a = new ge();
      a.qa = this.qa;
      a.nc = this.nc;
      a.zc = this.zc;
      a.we = this.we;
      a.Di = this.Di;
      a.Ei = this.Ei;
      a.lh = this.lh;
      a.tl = this.tl;
      a.Lk = this.Lk;
      a.wj = this.wj;
      a.pa = this.pa;
      return a;
    };
    t = ge.prototype;
    t.Ma = function (a) {
      if (
        !(a instanceof ge) ||
        this.type !== a.type ||
        this.isClosed !== a.isClosed
      )
        return !1;
      switch (this.type) {
        case Wd:
        case Ed:
          return J.w(this.endX, a.endX) && J.w(this.endY, a.endY);
        case Xd:
          return (
            J.w(this.endX, a.endX) &&
            J.w(this.endY, a.endY) &&
            J.w(this.point1X, a.point1X) &&
            J.w(this.point1Y, a.point1Y) &&
            J.w(this.point2X, a.point2X) &&
            J.w(this.point2Y, a.point2Y)
          );
        case Yd:
          return (
            J.w(this.endX, a.endX) &&
            J.w(this.endY, a.endY) &&
            J.w(this.point1X, a.point1X) &&
            J.w(this.point1Y, a.point1Y)
          );
        case Zd:
          return (
            J.w(this.startAngle, a.startAngle) &&
            J.w(this.sweepAngle, a.sweepAngle) &&
            J.w(this.centerX, a.centerX) &&
            J.w(this.centerY, a.centerY) &&
            J.w(this.radiusX, a.radiusX) &&
            J.w(this.radiusY, a.radiusY)
          );
        case $d:
          return (
            this.isClockwiseArc === a.isClockwiseArc &&
            this.isLargeArc === a.isLargeArc &&
            J.w(this.xAxisRotation, a.xAxisRotation) &&
            J.w(this.endX, a.endX) &&
            J.w(this.endY, a.endY) &&
            J.w(this.radiusX, a.radiusX) &&
            J.w(this.radiusY, a.radiusY)
          );
        default:
          return !1;
      }
    };
    t.bb = function (a) {
      a.classType === ge && (this.type = a);
    };
    t.toString = function (a) {
      void 0 === a && (a = -1);
      switch (this.type) {
        case Wd:
          a =
            0 > a
              ? 'M' + this.endX.toString() + ' ' + this.endY.toString()
              : 'M' + this.endX.toFixed(a) + ' ' + this.endY.toFixed(a);
          break;
        case Ed:
          a =
            0 > a
              ? 'L' + this.endX.toString() + ' ' + this.endY.toString()
              : 'L' + this.endX.toFixed(a) + ' ' + this.endY.toFixed(a);
          break;
        case Xd:
          a =
            0 > a
              ? 'C' +
                this.point1X.toString() +
                ' ' +
                this.point1Y.toString() +
                ' ' +
                this.point2X.toString() +
                ' ' +
                this.point2Y.toString() +
                ' ' +
                this.endX.toString() +
                ' ' +
                this.endY.toString()
              : 'C' +
                this.point1X.toFixed(a) +
                ' ' +
                this.point1Y.toFixed(a) +
                ' ' +
                this.point2X.toFixed(a) +
                ' ' +
                this.point2Y.toFixed(a) +
                ' ' +
                this.endX.toFixed(a) +
                ' ' +
                this.endY.toFixed(a);
          break;
        case Yd:
          a =
            0 > a
              ? 'Q' +
                this.point1X.toString() +
                ' ' +
                this.point1Y.toString() +
                ' ' +
                this.endX.toString() +
                ' ' +
                this.endY.toString()
              : 'Q' +
                this.point1X.toFixed(a) +
                ' ' +
                this.point1Y.toFixed(a) +
                ' ' +
                this.endX.toFixed(a) +
                ' ' +
                this.endY.toFixed(a);
          break;
        case Zd:
          a =
            0 > a
              ? 'B' +
                this.startAngle.toString() +
                ' ' +
                this.sweepAngle.toString() +
                ' ' +
                this.centerX.toString() +
                ' ' +
                this.centerY.toString() +
                ' ' +
                this.radiusX.toString() +
                ' ' +
                this.radiusY.toString()
              : 'B' +
                this.startAngle.toFixed(a) +
                ' ' +
                this.sweepAngle.toFixed(a) +
                ' ' +
                this.centerX.toFixed(a) +
                ' ' +
                this.centerY.toFixed(a) +
                ' ' +
                this.radiusX.toFixed(a) +
                ' ' +
                this.radiusY.toFixed(a);
          break;
        case $d:
          a =
            0 > a
              ? 'A' +
                this.radiusX.toString() +
                ' ' +
                this.radiusY.toString() +
                ' ' +
                this.xAxisRotation.toString() +
                ' ' +
                (this.isLargeArc ? 1 : 0) +
                ' ' +
                (this.isClockwiseArc ? 1 : 0) +
                ' ' +
                this.endX.toString() +
                ' ' +
                this.endY.toString()
              : 'A' +
                this.radiusX.toFixed(a) +
                ' ' +
                this.radiusY.toFixed(a) +
                ' ' +
                this.xAxisRotation.toFixed(a) +
                ' ' +
                (this.isLargeArc ? 1 : 0) +
                ' ' +
                (this.isClockwiseArc ? 1 : 0) +
                ' ' +
                this.endX.toFixed(a) +
                ' ' +
                this.endY.toFixed(a);
          break;
        default:
          a = this.type.toString();
      }
      return a + (this.wj ? 'z' : '');
    };
    t.freeze = function () {
      this.s = !0;
      return this;
    };
    t.ea = function () {
      this.s = !1;
      return this;
    };
    t.close = function () {
      this.wj = !0;
      return this;
    };
    function ae(a, b) {
      if (null !== a.Je && !1 === b.pa) return a.Je;
      var c = a.radiusX,
        d = a.radiusY;
      void 0 === d && (d = c);
      if (0 === c || 0 === d) return (a.Je = []), a.Je;
      b = a.we;
      var e = a.Di,
        f = J.Gx(
          0,
          0,
          c < d ? c : d,
          a.startAngle,
          a.startAngle + a.sweepAngle,
          !1,
        );
      if (c !== d) {
        var g = rd.alloc();
        g.reset();
        c < d ? g.scale(1, d / c) : g.scale(c / d, 1);
        Ud(f, g);
        rd.free(g);
      }
      c = f.length;
      for (d = 0; d < c; d++)
        (g = f[d]),
          (g[0] += b),
          (g[1] += e),
          (g[2] += b),
          (g[3] += e),
          (g[4] += b),
          (g[5] += e),
          (g[6] += b),
          (g[7] += e);
      a.Je = f;
      return a.Je;
    }
    function be(a, b, c, d) {
      function e(a, b, c, d) {
        return (
          (a * d < b * c ? -1 : 1) *
          Math.acos(
            (a * c + b * d) /
              (Math.sqrt(a * a + b * b) * Math.sqrt(c * c + d * d)),
          )
        );
      }
      if (null !== a.Je && !1 === b.pa) return a.Je;
      b = a.Ei;
      var f = a.lh;
      0 === b && (b = 1e-4);
      0 === f && (f = 1e-4);
      var g = (Math.PI / 180) * a.we,
        h = a.tl,
        k = a.Lk,
        l = a.nc,
        m = a.zc,
        n = Math.cos(g),
        p = Math.sin(g),
        r = (n * (c - l)) / 2 + (p * (d - m)) / 2;
      g = (-p * (c - l)) / 2 + (n * (d - m)) / 2;
      var q = (r * r) / (b * b) + (g * g) / (f * f);
      1 < q && ((b *= Math.sqrt(q)), (f *= Math.sqrt(q)));
      q =
        (h === k ? -1 : 1) *
        Math.sqrt(
          (b * b * f * f - b * b * g * g - f * f * r * r) /
            (b * b * g * g + f * f * r * r),
        );
      isNaN(q) && (q = 0);
      h = (q * b * g) / f;
      q = (q * -f * r) / b;
      isNaN(h) && (h = 0);
      isNaN(q) && (q = 0);
      c = (c + l) / 2 + n * h - p * q;
      d = (d + m) / 2 + p * h + n * q;
      m = e(1, 0, (r - h) / b, (g - q) / f);
      n = (r - h) / b;
      l = (g - q) / f;
      r = (-r - h) / b;
      h = (-g - q) / f;
      g = e(n, l, r, h);
      r = (n * r + l * h) / (Math.sqrt(n * n + l * l) * Math.sqrt(r * r + h * h));
      -1 >= r ? (g = Math.PI) : 1 <= r && (g = 0);
      !k && 0 < g && (g -= 2 * Math.PI);
      k && 0 > g && (g += 2 * Math.PI);
      k = b > f ? 1 : b / f;
      r = b > f ? f / b : 1;
      b = J.Gx(0, 0, b > f ? b : f, m, m + g, !0);
      f = rd.alloc();
      f.reset();
      f.translate(c, d);
      f.rotate(a.we, 0, 0);
      f.scale(k, r);
      Ud(b, f);
      rd.free(f);
      a.Je = b;
      return a.Je;
    }
    ma.Object.defineProperties(ge.prototype, {
      isClosed: {
        get: function () {
          return this.wj;
        },
        set: function (a) {
          this.wj !== a && ((this.wj = a), (this.pa = !0));
        },
      },
      type: {
        get: function () {
          return this.qa;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.qa = a;
          this.pa = !0;
        },
      },
      endX: {
        get: function () {
          return this.nc;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.nc = a;
          this.pa = !0;
        },
      },
      endY: {
        get: function () {
          return this.zc;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.zc = a;
          this.pa = !0;
        },
      },
      point1X: {
        get: function () {
          return this.we;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.we = a;
          this.pa = !0;
        },
      },
      point1Y: {
        get: function () {
          return this.Di;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.Di = a;
          this.pa = !0;
        },
      },
      point2X: {
        get: function () {
          return this.Ei;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.Ei = a;
          this.pa = !0;
        },
      },
      point2Y: {
        get: function () {
          return this.lh;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.lh = a;
          this.pa = !0;
        },
      },
      centerX: {
        get: function () {
          return this.we;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.we = a;
          this.pa = !0;
        },
      },
      centerY: {
        get: function () {
          return this.Di;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.Di = a;
          this.pa = !0;
        },
      },
      radiusX: {
        get: function () {
          return this.Ei;
        },
        set: function (a) {
          0 > a && va(a, '>= zero', ge, 'radiusX');
          this.s && ua(this, a);
          this.Ei = a;
          this.pa = !0;
        },
      },
      radiusY: {
        get: function () {
          return this.lh;
        },
        set: function (a) {
          0 > a && va(a, '>= zero', ge, 'radiusY');
          this.s && ua(this, a);
          this.lh = a;
          this.pa = !0;
        },
      },
      startAngle: {
        get: function () {
          return this.nc;
        },
        set: function (a) {
          this.nc !== a &&
            (this.s && ua(this, a),
            (a %= 360),
            0 > a && (a += 360),
            (this.nc = a),
            (this.pa = !0));
        },
      },
      sweepAngle: {
        get: function () {
          return this.zc;
        },
        set: function (a) {
          this.s && ua(this, a);
          360 < a && (a = 360);
          -360 > a && (a = -360);
          this.zc = a;
          this.pa = !0;
        },
      },
      isClockwiseArc: {
        get: function () {
          return this.Lk;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.Lk = a;
          this.pa = !0;
        },
      },
      isLargeArc: {
        get: function () {
          return this.tl;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.tl = a;
          this.pa = !0;
        },
      },
      xAxisRotation: {
        get: function () {
          return this.we;
        },
        set: function (a) {
          a %= 360;
          0 > a && (a += 360);
          this.s && ua(this, a);
          this.we = a;
          this.pa = !0;
        },
      },
    });
    ge.prototype.equalsApprox = ge.prototype.Ma;
    var Wd = new D(ge, 'Move', 0),
      Ed = new D(ge, 'Line', 1),
      Xd = new D(ge, 'Bezier', 2),
      Yd = new D(ge, 'QuadraticBezier', 3),
      Zd = new D(ge, 'Arc', 4),
      $d = new D(ge, 'SvgArc', 4);
    ge.className = 'PathSegment';
    ge.Move = Wd;
    ge.Line = Ed;
    ge.Bezier = Xd;
    ge.QuadraticBezier = Yd;
    ge.Arc = Zd;
    ge.SvgArc = $d;
    function me() {
      this.B = null;
      this.Zu = new H(0, 0).freeze();
      this.iu = new H(0, 0).freeze();
      this.br = this.fs = 0;
      this.cr = 1;
      this.Wr = '';
      this.Vs = this.wr = !1;
      this.tr = this.er = 0;
      this.Mg = this.Hr = this.Qr = !1;
      this.Cr = null;
      this.Qs = 0;
      this.ad = this.Ps = null;
    }
    me.prototype.copy = function () {
      var a = new me();
      return this.clone(a);
    };
    me.prototype.clone = function (a) {
      a.B = this.B;
      a.Zu.assign(this.viewPoint);
      a.iu.assign(this.documentPoint);
      a.fs = this.fs;
      a.br = this.br;
      a.cr = this.cr;
      a.Wr = this.Wr;
      a.wr = this.wr;
      a.Vs = this.Vs;
      a.er = this.er;
      a.tr = this.tr;
      a.Qr = this.Qr;
      a.Hr = this.Hr;
      a.Mg = this.Mg;
      a.Cr = this.Cr;
      a.Qs = this.Qs;
      a.Ps = this.Ps;
      a.ad = this.ad;
      return a;
    };
    me.prototype.toString = function () {
      var a = '^';
      0 !== this.modifiers && (a += 'M:' + this.modifiers);
      0 !== this.button && (a += 'B:' + this.button);
      '' !== this.key && (a += 'K:' + this.key);
      0 !== this.clickCount && (a += 'C:' + this.clickCount);
      0 !== this.delta && (a += 'D:' + this.delta);
      this.handled && (a += 'h');
      this.bubbles && (a += 'b');
      null !== this.documentPoint && (a += '@' + this.documentPoint.toString());
      return a;
    };
    me.prototype.oq = function (a, b) {
      var c = this.diagram;
      if (null === c) return b;
      ne(c, this.event, a, b);
      return b;
    };
    me.prototype.Gz = function (a, b) {
      var c = this.diagram;
      if (null === c) return b;
      ne(c, this.event, a, b);
      b.assign(c.Pt(b));
      return b;
    };
    ma.Object.defineProperties(me.prototype, {
      diagram: {
        get: function () {
          return this.B;
        },
        set: function (a) {
          this.B = a;
        },
      },
      viewPoint: {
        get: function () {
          return this.Zu;
        },
        set: function (a) {
          this.Zu.assign(a);
        },
      },
      documentPoint: {
        get: function () {
          return this.iu;
        },
        set: function (a) {
          this.iu.assign(a);
        },
      },
      modifiers: {
        get: function () {
          return this.fs;
        },
        set: function (a) {
          this.fs = a;
        },
      },
      button: {
        get: function () {
          return this.br;
        },
        set: function (a) {
          this.br = a;
          if (null === this.event)
            switch (a) {
              case 0:
                this.buttons = 1;
                break;
              case 1:
                this.buttons = 4;
                break;
              case 2:
                this.buttons = 2;
            }
        },
      },
      buttons: {
        get: function () {
          return this.cr;
        },
        set: function (a) {
          this.cr = a;
        },
      },
      key: {
        get: function () {
          return this.Wr;
        },
        set: function (a) {
          this.Wr = a;
        },
      },
      down: {
        get: function () {
          return this.wr;
        },
        set: function (a) {
          this.wr = a;
        },
      },
      up: {
        get: function () {
          return this.Vs;
        },
        set: function (a) {
          this.Vs = a;
        },
      },
      clickCount: {
        get: function () {
          return this.er;
        },
        set: function (a) {
          this.er = a;
        },
      },
      delta: {
        get: function () {
          return this.tr;
        },
        set: function (a) {
          this.tr = a;
        },
      },
      isMultiTouch: {
        get: function () {
          return this.Qr;
        },
        set: function (a) {
          this.Qr = a;
        },
      },
      handled: {
        get: function () {
          return this.Hr;
        },
        set: function (a) {
          this.Hr = a;
        },
      },
      bubbles: {
        get: function () {
          return this.Mg;
        },
        set: function (a) {
          this.Mg = a;
        },
      },
      event: {
        get: function () {
          return this.Cr;
        },
        set: function (a) {
          this.Cr = a;
        },
      },
      isTouchEvent: {
        get: function () {
          var a = x.TouchEvent,
            b = this.event;
          return a && b instanceof a
            ? !0
            : (a = x.PointerEvent) &&
                b instanceof a &&
                ('touch' === b.pointerType || 'pen' === b.pointerType);
        },
      },
      timestamp: {
        get: function () {
          return this.Qs;
        },
        set: function (a) {
          this.Qs = a;
        },
      },
      targetDiagram: {
        get: function () {
          return this.Ps;
        },
        set: function (a) {
          this.Ps = a;
        },
      },
      targetObject: {
        get: function () {
          return this.ad;
        },
        set: function (a) {
          this.ad = a;
        },
      },
      control: {
        get: function () {
          return 0 !== (this.modifiers & 1);
        },
        set: function (a) {
          this.modifiers = a ? this.modifiers | 1 : this.modifiers & -2;
        },
      },
      shift: {
        get: function () {
          return 0 !== (this.modifiers & 4);
        },
        set: function (a) {
          this.modifiers = a ? this.modifiers | 4 : this.modifiers & -5;
        },
      },
      alt: {
        get: function () {
          return 0 !== (this.modifiers & 2);
        },
        set: function (a) {
          this.modifiers = a ? this.modifiers | 2 : this.modifiers & -3;
        },
      },
      meta: {
        get: function () {
          return 0 !== (this.modifiers & 8);
        },
        set: function (a) {
          this.modifiers = a ? this.modifiers | 8 : this.modifiers & -9;
        },
      },
      left: {
        get: function () {
          var a = this.event;
          return null === a ||
            ('mousedown' !== a.type &&
              'mouseup' !== a.type &&
              'pointerdown' !== a.type &&
              'pointerup' !== a.type)
            ? 0 !== (this.buttons & 1)
            : 0 === this.button;
        },
        set: function (a) {
          this.buttons = a ? this.buttons | 1 : this.buttons & -2;
        },
      },
      right: {
        get: function () {
          var a = this.event;
          return null === a ||
            ('mousedown' !== a.type &&
              'mouseup' !== a.type &&
              'pointerdown' !== a.type &&
              'pointerup' !== a.type)
            ? 0 !== (this.buttons & 2)
            : 2 === this.button;
        },
        set: function (a) {
          this.buttons = a ? this.buttons | 2 : this.buttons & -3;
        },
      },
      middle: {
        get: function () {
          var a = this.event;
          return null === a ||
            ('mousedown' !== a.type &&
              'mouseup' !== a.type &&
              'pointerdown' !== a.type &&
              'pointerup' !== a.type)
            ? 0 !== (this.buttons & 4)
            : 1 === this.button;
        },
        set: function (a) {
          this.buttons = a ? this.buttons | 4 : this.buttons & -5;
        },
      },
    });
    me.prototype.getMultiTouchDocumentPoint = me.prototype.Gz;
    me.prototype.getMultiTouchViewPoint = me.prototype.oq;
    me.className = 'InputEvent';
    function oe() {
      this.B = null;
      this.Ra = '';
      this.ps = this.Os = null;
    }
    oe.prototype.copy = function () {
      var a = new oe();
      a.B = this.B;
      a.Ra = this.Ra;
      a.Os = this.Os;
      a.ps = this.ps;
      return a;
    };
    oe.prototype.toString = function () {
      var a = '*' + this.name;
      null !== this.subject && (a += ':' + this.subject.toString());
      null !== this.parameter && (a += '(' + this.parameter.toString() + ')');
      return a;
    };
    ma.Object.defineProperties(oe.prototype, {
      diagram: {
        get: function () {
          return this.B;
        },
        set: function (a) {
          this.B = a;
        },
      },
      name: {
        get: function () {
          return this.Ra;
        },
        set: function (a) {
          this.Ra = a;
        },
      },
      subject: {
        get: function () {
          return this.Os;
        },
        set: function (a) {
          this.Os = a;
        },
      },
      parameter: {
        get: function () {
          return this.ps;
        },
        set: function (a) {
          this.ps = a;
        },
      },
    });
    oe.className = 'DiagramEvent';
    function pe() {
      this.dn = qe;
      this.Ze = this.es = '';
      this.No = this.Oo = this.Uo = this.Vo = this.To = this.B = this.bc = null;
    }
    pe.prototype.clear = function () {
      this.No = this.Oo = this.Uo = this.Vo = this.To = this.B = this.bc = null;
    };
    pe.prototype.copy = function () {
      var a = new pe();
      a.dn = this.dn;
      a.es = this.es;
      a.Ze = this.Ze;
      a.bc = this.bc;
      a.B = this.B;
      a.To = this.To;
      var b = this.Vo;
      a.Vo = za(b) && 'function' === typeof b.G ? b.G() : b;
      b = this.Uo;
      a.Uo = za(b) && 'function' === typeof b.G ? b.G() : b;
      b = this.Oo;
      a.Oo = za(b) && 'function' === typeof b.G ? b.G() : b;
      b = this.No;
      a.No = za(b) && 'function' === typeof b.G ? b.G() : b;
      return a;
    };
    pe.prototype.bb = function (a) {
      a.classType === pe && (this.change = a);
    };
    pe.prototype.toString = function () {
      var a = '';
      a =
        this.change === re
          ? a + '* '
          : this.change === qe
          ? a + (null !== this.model ? '!m' : '!d')
          : a + ((null !== this.model ? '!m' : '!d') + this.change);
      this.propertyName &&
        'string' === typeof this.propertyName &&
        (a += ' ' + this.propertyName);
      this.modelChange &&
        this.modelChange !== this.propertyName &&
        (a += ' ' + this.modelChange);
      a += ': ';
      this.change === re
        ? null !== this.oldValue && (a += ' ' + this.oldValue)
        : (null !== this.object && (a += Ja(this.object)),
          null !== this.oldValue && (a += '  old: ' + Ja(this.oldValue)),
          null !== this.oldParam && (a += ' ' + this.oldParam),
          null !== this.newValue && (a += '  new: ' + Ja(this.newValue)),
          null !== this.newParam && (a += ' ' + this.newParam));
      return a;
    };
    pe.prototype.H = function (a) {
      return a ? this.oldValue : this.newValue;
    };
    pe.prototype.Iz = function (a) {
      return a ? this.oldParam : this.newParam;
    };
    pe.prototype.canUndo = function () {
      return null !== this.model || null !== this.diagram ? !0 : !1;
    };
    pe.prototype.undo = function () {
      this.canUndo() &&
        (null !== this.model
          ? this.model.Yj(this, !0)
          : null !== this.diagram && this.diagram.Yj(this, !0));
    };
    pe.prototype.canRedo = function () {
      return null !== this.model || null !== this.diagram ? !0 : !1;
    };
    pe.prototype.redo = function () {
      this.canRedo() &&
        (null !== this.model
          ? this.model.Yj(this, !1)
          : null !== this.diagram && this.diagram.Yj(this, !1));
    };
    ma.Object.defineProperties(pe.prototype, {
      model: {
        get: function () {
          return this.bc;
        },
        set: function (a) {
          this.bc = a;
        },
      },
      diagram: {
        get: function () {
          return this.B;
        },
        set: function (a) {
          this.B = a;
        },
      },
      change: {
        get: function () {
          return this.dn;
        },
        set: function (a) {
          this.dn = a;
        },
      },
      modelChange: {
        get: function () {
          return this.es;
        },
        set: function (a) {
          this.es = a;
        },
      },
      propertyName: {
        get: function () {
          return this.Ze;
        },
        set: function (a) {
          this.Ze = a;
        },
      },
      isTransactionFinished: {
        get: function () {
          return (
            this.dn === re &&
            ('CommittedTransaction' === this.Ze ||
              'FinishedUndo' === this.Ze ||
              'FinishedRedo' === this.Ze)
          );
        },
      },
      object: {
        get: function () {
          return this.To;
        },
        set: function (a) {
          this.To = a;
        },
      },
      oldValue: {
        get: function () {
          return this.Vo;
        },
        set: function (a) {
          this.Vo = a;
        },
      },
      oldParam: {
        get: function () {
          return this.Uo;
        },
        set: function (a) {
          this.Uo = a;
        },
      },
      newValue: {
        get: function () {
          return this.Oo;
        },
        set: function (a) {
          this.Oo = a;
        },
      },
      newParam: {
        get: function () {
          return this.No;
        },
        set: function (a) {
          this.No = a;
        },
      },
    });
    pe.prototype.redo = pe.prototype.redo;
    pe.prototype.canRedo = pe.prototype.canRedo;
    pe.prototype.undo = pe.prototype.undo;
    pe.prototype.canUndo = pe.prototype.canUndo;
    pe.prototype.getParam = pe.prototype.Iz;
    pe.prototype.getValue = pe.prototype.H;
    pe.prototype.clear = pe.prototype.clear;
    var re = new D(pe, 'Transaction', -1),
      qe = new D(pe, 'Property', 0),
      se = new D(pe, 'Insert', 1),
      te = new D(pe, 'Remove', 2);
    pe.className = 'ChangedEvent';
    pe.Transaction = re;
    pe.Property = qe;
    pe.Insert = se;
    pe.Remove = te;
    function ue() {
      this.v = new E().freeze();
      this.Ra = '';
      this.l = !1;
    }
    ue.prototype.toString = function (a) {
      var b =
        'Transaction: ' +
        this.name +
        ' ' +
        this.changes.count.toString() +
        (this.isComplete ? '' : ', incomplete');
      if (void 0 !== a && 0 < a) {
        a = this.changes.count;
        for (var c = 0; c < a; c++) {
          var d = this.changes.L(c);
          null !== d && (b += '\n  ' + d.toString());
        }
      }
      return b;
    };
    ue.prototype.clear = function () {
      var a = this.changes;
      a.ea();
      for (var b = a.count - 1; 0 <= b; b--) {
        var c = a.L(b);
        null !== c && c.clear();
      }
      a.clear();
      a.freeze();
    };
    ue.prototype.canUndo = function () {
      return this.isComplete;
    };
    ue.prototype.undo = function () {
      if (this.canUndo())
        for (var a = this.changes.count - 1; 0 <= a; a--) {
          var b = this.changes.L(a);
          null !== b && b.undo();
        }
    };
    ue.prototype.canRedo = function () {
      return this.isComplete;
    };
    ue.prototype.redo = function () {
      if (this.canRedo())
        for (var a = this.changes.count, b = 0; b < a; b++) {
          var c = this.changes.L(b);
          null !== c && c.redo();
        }
    };
    ma.Object.defineProperties(ue.prototype, {
      changes: {
        get: function () {
          return this.v;
        },
      },
      name: {
        get: function () {
          return this.Ra;
        },
        set: function (a) {
          this.Ra = a;
        },
      },
      isComplete: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.l = a;
        },
      },
    });
    ue.prototype.redo = ue.prototype.redo;
    ue.prototype.canRedo = ue.prototype.canRedo;
    ue.prototype.undo = ue.prototype.undo;
    ue.prototype.canUndo = ue.prototype.canUndo;
    ue.prototype.clear = ue.prototype.clear;
    ue.className = 'Transaction';
    function ve() {
      this.Fu = new F();
      this.Kc = !1;
      this.I = new E().freeze();
      this.Gd = -1;
      this.v = 999;
      this.me = !1;
      this.qr = null;
      this.Li = 0;
      this.l = !1;
      this.se = new E().freeze();
      this.Bl = new E();
      this.pu = !0;
      this.zu = !1;
    }
    ve.prototype.toString = function (a) {
      var b =
        'UndoManager ' +
        this.historyIndex +
        '<' +
        this.history.count +
        '<=' +
        this.maxHistoryLength;
      b += '[';
      for (var c = this.nestedTransactionNames.count, d = 0; d < c; d++)
        0 < d && (b += ' '), (b += this.nestedTransactionNames.L(d));
      b += ']';
      if (void 0 !== a && 0 < a)
        for (c = this.history.count, d = 0; d < c; d++)
          b += '\n ' + this.history.L(d).toString(a - 1);
      return b;
    };
    ve.prototype.clear = function () {
      var a = this.history;
      a.ea();
      for (var b = a.count - 1; 0 <= b; b--) {
        var c = a.L(b);
        null !== c && c.clear();
      }
      a.clear();
      this.Gd = -1;
      a.freeze();
      this.me = !1;
      this.qr = null;
      this.Li = 0;
      this.se.ea();
      this.se.clear();
      this.se.freeze();
      this.Bl.clear();
    };
    ve.prototype.copyProperties = function (a) {
      this.isEnabled = a.isEnabled;
      this.maxHistoryLength = a.maxHistoryLength;
      this.checksTransactionLevel = a.checksTransactionLevel;
    };
    t = ve.prototype;
    t.wx = function (a) {
      this.Fu.add(a);
    };
    t.ey = function (a) {
      this.Fu.remove(a);
    };
    t.ta = function (a) {
      void 0 === a && (a = '');
      null === a && (a = '');
      if (this.isUndoingRedoing) return !1;
      !0 === this.pu &&
        ((this.pu = !1),
        this.Li++,
        this.yb('StartingFirstTransaction', a, this.currentTransaction),
        0 < this.Li && this.Li--);
      this.isEnabled &&
        (this.se.ea(),
        this.se.add(a),
        this.se.freeze(),
        null === this.currentTransaction
          ? this.Bl.add(0)
          : this.Bl.add(this.currentTransaction.changes.count));
      this.Li++;
      var b = 1 === this.transactionLevel;
      b && this.yb('StartedTransaction', a, this.currentTransaction);
      return b;
    };
    t.Ua = function (a) {
      void 0 === a && (a = '');
      return we(this, !0, a);
    };
    t.Bf = function () {
      return we(this, !1, '');
    };
    function we(a, b, c) {
      if (a.isUndoingRedoing) return !1;
      a.checksTransactionLevel &&
        1 > a.transactionLevel &&
        wa('Ending transaction without having started a transaction: ' + c);
      var d = 1 === a.transactionLevel;
      d && b && a.yb('CommittingTransaction', c, a.currentTransaction);
      var e = 0;
      if (0 < a.transactionLevel && (a.Li--, a.isEnabled)) {
        var f = a.se.count;
        0 < f &&
          ('' === c && (c = a.se.L(0)), a.se.ea(), a.se.mb(f - 1), a.se.freeze());
        f = a.Bl.count;
        0 < f && ((e = a.Bl.L(f - 1)), a.Bl.mb(f - 1));
      }
      f = a.currentTransaction;
      if (d) {
        if (b) {
          a.zu = !1;
          if (a.isEnabled && null !== f) {
            b = f;
            b.isComplete = !0;
            b.name = c;
            d = a.history;
            d.ea();
            for (e = d.count - 1; e > a.historyIndex; e--)
              (f = d.L(e)), null !== f && f.clear(), d.mb(e), (a.zu = !0);
            e = a.maxHistoryLength;
            0 <= e &&
              (0 === e
                ? d.clear()
                : d.count >= e &&
                  ((f = d.L(0)), null !== f && f.clear(), d.mb(0), a.Gd--));
            0 !== e && (d.add(b), a.Gd++);
            d.freeze();
            f = b;
          }
          a.yb('CommittedTransaction', c, f);
        } else {
          a.me = !0;
          try {
            a.isEnabled && null !== f && ((f.isComplete = !0), f.undo());
          } finally {
            a.yb('RolledBackTransaction', c, f), (a.me = !1);
          }
          null !== f && f.clear();
        }
        a.qr = null;
        return !0;
      }
      if (a.isEnabled && !b && null !== f) {
        a = e;
        c = f.changes;
        for (b = c.count - 1; b >= a; b--)
          (d = c.L(b)), null !== d && d.undo(), c.ea(), c.mb(b);
        c.freeze();
      }
      return !1;
    }
    ve.prototype.canUndo = function () {
      if (!this.isEnabled || 0 < this.transactionLevel) return !1;
      var a = this.transactionToUndo;
      return null !== a && a.canUndo() ? !0 : !1;
    };
    ve.prototype.undo = function () {
      if (this.canUndo()) {
        var a = this.transactionToUndo;
        try {
          (this.me = !0), this.yb('StartingUndo', 'Undo', a), this.Gd--, a.undo();
        } catch (b) {
          wa('undo error: ' + b.toString());
        } finally {
          this.yb('FinishedUndo', 'Undo', a), (this.me = !1);
        }
      }
    };
    ve.prototype.canRedo = function () {
      if (!this.isEnabled || 0 < this.transactionLevel) return !1;
      var a = this.transactionToRedo;
      return null !== a && a.canRedo() ? !0 : !1;
    };
    ve.prototype.redo = function () {
      if (this.canRedo()) {
        var a = this.transactionToRedo;
        try {
          (this.me = !0), this.yb('StartingRedo', 'Redo', a), this.Gd++, a.redo();
        } catch (b) {
          wa('redo error: ' + b.toString());
        } finally {
          this.yb('FinishedRedo', 'Redo', a), (this.me = !1);
        }
      }
    };
    ve.prototype.yb = function (a, b, c) {
      void 0 === c && (c = null);
      var d = new pe();
      d.change = re;
      d.propertyName = a;
      d.object = c;
      d.oldValue = b;
      for (a = this.models; a.next(); ) (b = a.value), (d.model = b), b.at(d);
    };
    ve.prototype.Fv = function (a) {
      if (this.isEnabled && !this.isUndoingRedoing && !this.skipsEvent(a)) {
        var b = this.currentTransaction;
        null === b && (this.qr = b = new ue());
        var c = a.copy();
        b = b.changes;
        b.ea();
        b.add(c);
        b.freeze();
        this.checksTransactionLevel &&
          0 >= this.transactionLevel &&
          !this.pu &&
          ((a = a.diagram),
          (null !== a && !1 === a.lk) ||
            wa('Change not within a transaction: ' + c.toString()));
      }
    };
    ve.prototype.skipsEvent = function (a) {
      if (null === a || 0 > a.change.value) return !0;
      a = a.object;
      if (void 0 !== a.layer) {
        if (((a = a.layer), null !== a && a.isTemporary)) return !0;
      } else if (a.isTemporary) return !0;
      return !1;
    };
    ma.Object.defineProperties(ve.prototype, {
      models: {
        get: function () {
          return this.Fu.iterator;
        },
      },
      isEnabled: {
        get: function () {
          return this.Kc;
        },
        set: function (a) {
          this.Kc = a;
        },
      },
      transactionToUndo: {
        get: function () {
          return 0 <= this.historyIndex &&
            this.historyIndex <= this.history.count - 1
            ? this.history.L(this.historyIndex)
            : null;
        },
      },
      transactionToRedo: {
        get: function () {
          return this.historyIndex < this.history.count - 1
            ? this.history.L(this.historyIndex + 1)
            : null;
        },
      },
      isUndoingRedoing: {
        get: function () {
          return this.me;
        },
      },
      history: {
        get: function () {
          return this.I;
        },
      },
      maxHistoryLength: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v = a;
        },
      },
      historyIndex: {
        get: function () {
          return this.Gd;
        },
      },
      currentTransaction: {
        get: function () {
          return this.qr;
        },
      },
      transactionLevel: {
        get: function () {
          return this.Li;
        },
      },
      isInTransaction: {
        get: function () {
          return 0 < this.Li;
        },
      },
      checksTransactionLevel: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.l = a;
        },
      },
      nestedTransactionNames: {
        get: function () {
          return this.se;
        },
      },
    });
    ve.prototype.handleChanged = ve.prototype.Fv;
    ve.prototype.redo = ve.prototype.redo;
    ve.prototype.undo = ve.prototype.undo;
    ve.prototype.canUndo = ve.prototype.canUndo;
    ve.prototype.rollbackTransaction = ve.prototype.Bf;
    ve.prototype.commitTransaction = ve.prototype.Ua;
    ve.prototype.startTransaction = ve.prototype.ta;
    ve.prototype.removeModel = ve.prototype.ey;
    ve.prototype.addModel = ve.prototype.wx;
    ve.prototype.clear = ve.prototype.clear;
    ve.className = 'UndoManager';
    function xe() {
      Za(this);
      this.B = ye;
      this.Ra = '';
      this.Kc = !0;
      this.hd = !1;
      this.Jw = null;
      this.Gy = new me();
      this.Ys = -1;
    }
    xe.prototype.toString = function () {
      return '' !== this.name ? this.name + ' Tool' : Ia(this.constructor);
    };
    xe.prototype.updateAdornments = function () {};
    xe.prototype.canStart = function () {
      return this.isEnabled;
    };
    xe.prototype.doStart = function () {};
    xe.prototype.doActivate = function () {
      this.isActive = !0;
    };
    xe.prototype.doDeactivate = function () {
      this.isActive = !1;
    };
    xe.prototype.doStop = function () {};
    xe.prototype.doCancel = function () {
      this.transactionResult = null;
      this.stopTool();
    };
    xe.prototype.stopTool = function () {
      var a = this.diagram;
      a.currentTool === this && ((a.currentTool = null), (a.currentCursor = ''));
    };
    xe.prototype.doMouseDown = function () {
      !this.isActive && this.canStart() && this.doActivate();
    };
    xe.prototype.doMouseMove = function () {};
    xe.prototype.doMouseUp = function () {
      this.stopTool();
    };
    xe.prototype.doMouseWheel = function () {};
    xe.prototype.canStartMultiTouch = function () {
      return !0;
    };
    xe.prototype.standardPinchZoomStart = function () {
      var a = this.diagram,
        b = a.lastInput,
        c = b.oq(0, H.allocAt(NaN, NaN)),
        d = b.oq(1, H.allocAt(NaN, NaN));
      if (c.u() && d.u() && (this.doCancel(), a.mm('hasGestureZoom'))) {
        a.Dl = a.scale;
        var e = d.x - c.x,
          f = d.y - c.y;
        a.Su = Math.sqrt(e * e + f * f);
        b.bubbles = !1;
      }
      H.free(c);
      H.free(d);
    };
    xe.prototype.standardPinchZoomMove = function () {
      var a = this.diagram,
        b = a.lastInput,
        c = b.oq(0, H.allocAt(NaN, NaN)),
        d = b.oq(1, H.allocAt(NaN, NaN));
      if (c.u() && d.u() && (this.doCancel(), a.mm('hasGestureZoom'))) {
        var e = d.x - c.x,
          f = d.y - c.y;
        f = Math.sqrt(e * e + f * f) / a.Su;
        e = new H(
          (Math.min(d.x, c.x) + Math.max(d.x, c.x)) / 2,
          (Math.min(d.y, c.y) + Math.max(d.y, c.y)) / 2,
        );
        f *= a.Dl;
        var g = a.commandHandler;
        if (f !== a.scale && g.canResetZoom(f)) {
          var h = a.zoomPoint;
          a.zoomPoint = e;
          g.resetZoom(f);
          a.zoomPoint = h;
        }
        b.bubbles = !1;
      }
      H.free(c);
      H.free(d);
    };
    xe.prototype.doKeyDown = function () {
      'Esc' === this.diagram.lastInput.key && this.doCancel();
    };
    xe.prototype.doKeyUp = function () {};
    xe.prototype.ta = function (a) {
      void 0 === a && (a = this.name);
      this.transactionResult = null;
      return this.diagram.ta(a);
    };
    xe.prototype.Hg = function () {
      var a = this.diagram;
      return null === this.transactionResult
        ? a.Bf()
        : a.Ua(this.transactionResult);
    };
    xe.prototype.standardMouseSelect = function () {
      var a = this.diagram;
      if (a.allowSelect) {
        var b = a.lastInput,
          c = a.km(b.documentPoint, !1);
        if (null !== c)
          if (Wa ? b.meta : b.control) {
            a.R('ChangingSelection', a.selection);
            for (b = c; null !== b && !b.canSelect(); ) b = b.containingGroup;
            null !== b && (b.isSelected = !b.isSelected);
            a.R('ChangedSelection', a.selection);
          } else if (b.shift) {
            if (!c.isSelected) {
              a.R('ChangingSelection', a.selection);
              for (b = c; null !== b && !b.canSelect(); ) b = b.containingGroup;
              null !== b && (b.isSelected = !0);
              a.R('ChangedSelection', a.selection);
            }
          } else {
            if (!c.isSelected) {
              for (b = c; null !== b && !b.canSelect(); ) b = b.containingGroup;
              null !== b && a.select(b);
            }
          }
        else !b.left || (Wa ? b.meta : b.control) || b.shift || a.iv();
      }
    };
    xe.prototype.standardMouseClick = function (a, b) {
      void 0 === a && (a = null);
      void 0 === b &&
        (b = function (a) {
          return !a.layer.isTemporary;
        });
      var c = this.diagram,
        d = c.lastInput;
      a = c.Tb(d.documentPoint, a, b);
      d.targetObject = a;
      ze(a, d, c);
      return d.handled;
    };
    function ze(a, b, c) {
      b.handled = !1;
      if (null === a || a.Eg()) {
        var d = 0;
        b.left
          ? (d = 1 === b.clickCount ? 1 : 2 === b.clickCount ? 2 : 1)
          : b.right && 1 === b.clickCount && (d = 3);
        var e = 'ObjectSingleClicked';
        if (null !== a) {
          switch (d) {
            case 1:
              e = 'ObjectSingleClicked';
              break;
            case 2:
              e = 'ObjectDoubleClicked';
              break;
            case 3:
              e = 'ObjectContextClicked';
          }
          0 !== d && c.R(e, a);
        } else {
          switch (d) {
            case 1:
              e = 'BackgroundSingleClicked';
              break;
            case 2:
              e = 'BackgroundDoubleClicked';
              break;
            case 3:
              e = 'BackgroundContextClicked';
          }
          0 !== d && c.R(e);
        }
        if (null !== a)
          for (; null !== a; ) {
            c = null;
            switch (d) {
              case 1:
                c = a.click;
                break;
              case 2:
                c = a.doubleClick ? a.doubleClick : a.click;
                break;
              case 3:
                c = a.contextClick;
            }
            if (null !== c && (c(b, a), b.handled)) break;
            a = a.panel;
          }
        else {
          a = null;
          switch (d) {
            case 1:
              a = c.click;
              break;
            case 2:
              a = c.doubleClick ? c.doubleClick : c.click;
              break;
            case 3:
              a = c.contextClick;
          }
          null !== a && a(b);
        }
      }
    }
    xe.prototype.standardMouseOver = function () {
      var a = this.diagram,
        b = a.lastInput;
      if (!0 !== a.animationManager.jc) {
        var c = a.skipsUndoManager;
        a.skipsUndoManager = !0;
        var d = a.viewportBounds.aa(b.documentPoint)
          ? a.Tb(b.documentPoint, null, null)
          : null;
        b.targetObject = d;
        var e = !1;
        if (d !== a.mj) {
          var f = a.mj,
            g = f;
          a.mj = d;
          this.doCurrentObjectChanged(f, d);
          for (b.handled = !1; null !== f; ) {
            var h = f.mouseLeave;
            if (null !== h) {
              if (d === f) break;
              if (null !== d && d.Dg(f)) break;
              h(b, f, d);
              e = !0;
              if (b.handled) break;
            }
            f = f.panel;
          }
          f = g;
          for (b.handled = !1; null !== d; ) {
            g = d.mouseEnter;
            if (null !== g) {
              if (f === d) break;
              if (null !== f && f.Dg(d)) break;
              g(b, d, f);
              e = !0;
              if (b.handled) break;
            }
            d = d.panel;
          }
          d = a.mj;
        }
        if (null !== d) {
          f = d;
          for (g = ''; null !== f; ) {
            g = f.cursor;
            if ('' !== g) break;
            f = f.panel;
          }
          a.currentCursor = g;
          b.handled = !1;
          for (f = d; null !== f; ) {
            d = f.mouseOver;
            if (null !== d && (d(b, f), (e = !0), b.handled)) break;
            f = f.panel;
          }
        } else
          (a.currentCursor = ''),
            (d = a.mouseOver),
            null !== d && (d(b), (e = !0));
        e && a.Yb();
        a.skipsUndoManager = c;
      }
    };
    xe.prototype.doCurrentObjectChanged = function () {};
    xe.prototype.standardMouseWheel = function () {
      var a = this.diagram,
        b = a.lastInput,
        c = b.delta;
      if (0 !== c && a.documentBounds.u()) {
        var d = a.commandHandler,
          e = a.toolManager.mouseWheelBehavior;
        if (null !== d && ((e === Ae && !b.shift) || (e === Be && b.control))) {
          if (0 < c ? d.canIncreaseZoom() : d.canDecreaseZoom())
            (e = a.zoomPoint),
              (a.zoomPoint = b.viewPoint),
              0 < c ? d.increaseZoom() : d.decreaseZoom(),
              (a.zoomPoint = e);
          b.bubbles = !1;
        } else if ((e === Ae && b.shift) || (e === Be && !b.control)) {
          d = a.position.copy();
          var f = 0 < c ? c : -c,
            g = b.event,
            h = g.deltaMode;
          e = g.deltaX;
          g = g.deltaY;
          if (Ta || Ua || Va)
            (h = 1),
              0 < e && (e = 3),
              0 > e && (e = -3),
              0 < g && (g = 3),
              0 > g && (g = -3);
          if (
            void 0 === h ||
            void 0 === e ||
            void 0 === g ||
            (0 === e && 0 === g) ||
            b.shift
          )
            !b.shift && a.allowVerticalScroll
              ? ((f = 3 * f * a.scrollVerticalLineChange),
                0 < c ? a.scroll('pixel', 'up', f) : a.scroll('pixel', 'down', f))
              : b.shift &&
                a.allowHorizontalScroll &&
                ((f = 3 * f * a.scrollHorizontalLineChange),
                0 < c
                  ? a.scroll('pixel', 'left', f)
                  : a.scroll('pixel', 'right', f));
          else {
            switch (h) {
              case 0:
                c = 'pixel';
                break;
              case 1:
                c = 'line';
                break;
              case 2:
                c = 'page';
                break;
              default:
                c = 'pixel';
            }
            0 !== e &&
              a.allowHorizontalScroll &&
              ((e *= a.scrollHorizontalLineChange / 16),
              0 < e ? a.scroll(c, 'left', -e) : a.scroll(c, 'right', e));
            0 !== g &&
              a.allowVerticalScroll &&
              ((g *= a.scrollVerticalLineChange / 16),
              0 < g ? a.scroll(c, 'up', -g) : a.scroll(c, 'down', g));
          }
          a.position.A(d) || (b.bubbles = !1);
        }
      }
    };
    xe.prototype.standardWaitAfter = function (a, b) {
      void 0 === b && (b = this.diagram.lastInput);
      this.cancelWaitAfter();
      var c = this,
        d = b.clone(this.Gy);
      this.Ys = sa(function () {
        c.doWaitAfter(d);
      }, a);
    };
    xe.prototype.cancelWaitAfter = function () {
      -1 !== this.Ys && x.clearTimeout(this.Ys);
      this.Ys = -1;
    };
    xe.prototype.doWaitAfter = function () {};
    xe.prototype.findToolHandleAt = function (a, b) {
      a = this.diagram.Tb(a, function (a) {
        for (; null !== a && !(a.panel instanceof Ce); ) a = a.panel;
        return a;
      });
      return null === a ? null : a.part.category === b ? a : null;
    };
    xe.prototype.isBeyondDragSize = function (a, b) {
      var c = this.diagram;
      void 0 === a && (a = c.firstInput.viewPoint);
      void 0 === b && (b = c.lastInput.viewPoint);
      var d = c.toolManager.dragSize,
        e = d.width;
      d = d.height;
      c.firstInput.isTouchEvent && ((e += 6), (d += 6));
      return Math.abs(b.x - a.x) > e || Math.abs(b.y - a.y) > d;
    };
    ma.Object.defineProperties(xe.prototype, {
      diagram: {
        get: function () {
          return this.B;
        },
        set: function (a) {
          a instanceof R && (this.B = a);
        },
      },
      name: {
        get: function () {
          return this.Ra;
        },
        set: function (a) {
          this.Ra = a;
        },
      },
      isEnabled: {
        get: function () {
          return this.Kc;
        },
        set: function (a) {
          this.Kc = a;
        },
      },
      isActive: {
        get: function () {
          return this.hd;
        },
        set: function (a) {
          this.hd = a;
        },
      },
      transactionResult: {
        get: function () {
          return this.Jw;
        },
        set: function (a) {
          this.Jw = a;
        },
      },
    });
    xe.prototype.stopTransaction = xe.prototype.Hg;
    xe.prototype.startTransaction = xe.prototype.ta;
    xe.className = 'Tool';
    function Oa() {
      xe.call(this);
      this.name = 'ToolManager';
      this.yd = new E();
      this.be = new E();
      this.hj = new E();
      this.Y = this.Ja = 850;
      this.v = new L(2, 2).ca();
      this.eb = 5e3;
      this.La = Be;
      this.I = De;
      this.pr = this.l = null;
      this.Qj = -1;
    }
    la(Oa, xe);
    Oa.prototype.initializeStandardTools = function () {};
    Oa.prototype.updateAdornments = function (a) {
      var b = this.currentToolTip;
      if (b instanceof Ce && this.pr === a) {
        var c = b.adornedObject;
        (null !== a ? c.part === a : null === c)
          ? this.showToolTip(b, c)
          : this.hideToolTip();
      }
    };
    Oa.prototype.doMouseDown = function () {
      var a = this.diagram,
        b = a.lastInput;
      b.isTouchEvent && this.gestureBehavior === Ke && (b.bubbles = !1);
      if (b.isMultiTouch) {
        this.cancelWaitAfter();
        if (this.gestureBehavior === Le) {
          b.bubbles = !0;
          return;
        }
        if (this.gestureBehavior === Ke) return;
        if (a.currentTool.canStartMultiTouch()) {
          a.currentTool.standardPinchZoomStart();
          return;
        }
      }
      for (var c = this.mouseDownTools.length, d = 0; d < c; d++) {
        var e = this.mouseDownTools.L(d);
        e.diagram = this.diagram;
        if (e.canStart()) {
          a.doFocus();
          a.currentTool = e;
          a.currentTool === e && (e.isActive || e.doActivate(), e.doMouseDown());
          return;
        }
      }
      1 === a.lastInput.button &&
        (this.mouseWheelBehavior === Be
          ? (this.mouseWheelBehavior = Ae)
          : this.mouseWheelBehavior === Ae && (this.mouseWheelBehavior = Be));
      this.doActivate();
      this.standardWaitAfter(this.holdDelay, b);
    };
    Oa.prototype.doMouseMove = function () {
      var a = this.diagram,
        b = a.lastInput;
      if (b.isMultiTouch) {
        if (this.gestureBehavior === Le) {
          b.bubbles = !0;
          return;
        }
        if (this.gestureBehavior === Ke) return;
        if (a.currentTool.canStartMultiTouch()) {
          a.currentTool.standardPinchZoomMove();
          return;
        }
      }
      if (this.isActive)
        for (var c = this.mouseMoveTools.length, d = 0; d < c; d++) {
          var e = this.mouseMoveTools.L(d);
          e.diagram = this.diagram;
          if (e.canStart()) {
            a.doFocus();
            a.currentTool = e;
            a.currentTool === e &&
              (e.isActive || e.doActivate(), e.doMouseMove());
            return;
          }
        }
      Me(this, a);
      a = b.event;
      null === a ||
        ('mousemove' !== a.type && 'pointermove' !== a.type && a.cancelable) ||
        (b.bubbles = !0);
    };
    function Me(a, b) {
      a.standardMouseOver();
      a.isBeyondDragSize() &&
        a.standardWaitAfter(a.isActive ? a.holdDelay : a.hoverDelay, b.lastInput);
    }
    Oa.prototype.doCurrentObjectChanged = function (a, b) {
      a = this.currentToolTip;
      null === a ||
        (null !== b && a instanceof Ce && (b === a || b.Dg(a))) ||
        this.hideToolTip();
    };
    Oa.prototype.doWaitAfter = function (a) {
      var b = this.diagram;
      b.Ba &&
        (this.doMouseHover(),
        this.isActive || this.doToolTip(),
        a.isTouchEvent &&
          !b.lastInput.handled &&
          ((a = a.copy()),
          (a.button = 2),
          (a.buttons = 2),
          (b.lastInput = a),
          (b.Pj = !0),
          b.doMouseUp()));
    };
    Oa.prototype.doMouseHover = function () {
      var a = this.diagram,
        b = a.lastInput;
      null === b.targetObject &&
        (b.targetObject = a.Tb(b.documentPoint, null, null));
      var c = b.targetObject;
      if (null !== c)
        for (b.handled = !1; null !== c; ) {
          a = this.isActive ? c.mouseHold : c.mouseHover;
          if (null !== a && (a(b, c), b.handled)) break;
          c = c.panel;
        }
      else (c = this.isActive ? a.mouseHold : a.mouseHover), null !== c && c(b);
    };
    Oa.prototype.doToolTip = function () {
      var a = this.diagram,
        b = a.lastInput;
      null === b.targetObject &&
        (b.targetObject = a.Tb(b.documentPoint, null, null));
      b = b.targetObject;
      if (null !== b) {
        if (
          ((a = this.currentToolTip), !(a instanceof Ce) || (b !== a && !b.Dg(a)))
        ) {
          for (; null !== b; ) {
            a = b.toolTip;
            if (null !== a) {
              this.showToolTip(a, b);
              return;
            }
            b = b.panel;
          }
          this.hideToolTip();
        }
      } else
        (b = a.toolTip),
          null !== b ? this.showToolTip(b, null) : this.hideToolTip();
    };
    Oa.prototype.showToolTip = function (a, b) {
      var c = this.diagram;
      a !== this.currentToolTip && this.hideToolTip();
      if (a instanceof Ce) {
        a.layerName = 'Tool';
        a.selectable = !1;
        a.scale = 1 / c.scale;
        a.category = 'ToolTip';
        null !== a.placeholder && (a.placeholder.scale = c.scale);
        var d = a.diagram;
        null !== d && d !== c && d.remove(a);
        c.add(a);
        null !== b ? (a.adornedObject = b) : (a.data = c.model);
        a.zb();
        this.positionToolTip(a, b);
      } else a instanceof Ne && a !== this.currentToolTip && a.show(b, c, this);
      this.currentToolTip = a;
      -1 !== this.Qj && (x.clearTimeout(this.Qj), (this.Qj = -1));
      a = this.toolTipDuration;
      if (0 < a && Infinity !== a) {
        var e = this;
        this.Qj = sa(function () {
          e.hideToolTip();
        }, a);
      }
    };
    Oa.prototype.positionToolTip = function (a) {
      if (null === a.placeholder) {
        var b = this.diagram,
          c = b.lastInput.documentPoint.copy(),
          d = a.measuredBounds,
          e = b.viewportBounds;
        b.lastInput.isTouchEvent && (c.x -= d.width);
        c.x + d.width > e.right && (c.x -= d.width + 5 / b.scale);
        c.x < e.x && (c.x = e.x);
        c.y =
          c.y + 20 / b.scale + d.height > e.bottom
            ? c.y - (d.height + 5 / b.scale)
            : c.y + 20 / b.scale;
        c.y < e.y && (c.y = e.y);
        a.position = c;
      }
    };
    Oa.prototype.hideToolTip = function () {
      -1 !== this.Qj && (x.clearTimeout(this.Qj), (this.Qj = -1));
      var a = this.diagram,
        b = this.currentToolTip;
      null !== b &&
        (b instanceof Ce
          ? (a.remove(b),
            null !== this.pr && this.pr.Af(b.category),
            (b.data = null),
            (b.adornedObject = null))
          : b instanceof Ne && null !== b.hide && b.hide(a, this),
        (this.currentToolTip = null));
    };
    Oa.prototype.doMouseUp = function () {
      this.cancelWaitAfter();
      var a = this.diagram;
      if (this.isActive)
        for (var b = this.mouseUpTools.length, c = 0; c < b; c++) {
          var d = this.mouseUpTools.L(c);
          d.diagram = this.diagram;
          if (d.canStart()) {
            a.doFocus();
            a.currentTool = d;
            a.currentTool === d && (d.isActive || d.doActivate(), d.doMouseUp());
            return;
          }
        }
      a.doFocus();
      this.doDeactivate();
    };
    Oa.prototype.doMouseWheel = function () {
      this.standardMouseWheel();
    };
    Oa.prototype.doKeyDown = function () {
      var a = this.diagram;
      null !== a.commandHandler && a.commandHandler.doKeyDown();
    };
    Oa.prototype.doKeyUp = function () {
      var a = this.diagram;
      null !== a.commandHandler && a.commandHandler.doKeyUp();
    };
    Oa.prototype.findTool = function (a) {
      for (var b = this.mouseDownTools.length, c = 0; c < b; c++) {
        var d = this.mouseDownTools.L(c);
        if (d.name === a) return d;
      }
      b = this.mouseMoveTools.length;
      for (c = 0; c < b; c++)
        if (((d = this.mouseMoveTools.L(c)), d.name === a)) return d;
      b = this.mouseUpTools.length;
      for (c = 0; c < b; c++)
        if (((d = this.mouseUpTools.L(c)), d.name === a)) return d;
      return null;
    };
    Oa.prototype.replaceTool = function (a, b) {
      null !== b && (b.diagram = this.diagram);
      for (var c = this.mouseDownTools.length, d = 0; d < c; d++) {
        var e = this.mouseDownTools.L(d);
        if (e.name === a)
          return (
            null !== b ? this.mouseDownTools.fd(d, b) : this.mouseDownTools.mb(d),
            e
          );
      }
      c = this.mouseMoveTools.length;
      for (d = 0; d < c; d++)
        if (((e = this.mouseMoveTools.L(d)), e.name === a))
          return (
            null !== b ? this.mouseMoveTools.fd(d, b) : this.mouseMoveTools.mb(d),
            e
          );
      c = this.mouseUpTools.length;
      for (d = 0; d < c; d++)
        if (((e = this.mouseUpTools.L(d)), e.name === a))
          return (
            null !== b ? this.mouseUpTools.fd(d, b) : this.mouseUpTools.mb(d), e
          );
      return null;
    };
    Oa.prototype.Va = function (a, b, c) {
      null !== b && ((b.name = a), (b.diagram = this.diagram));
      this.findTool(a) ? this.replaceTool(a, b) : null !== b && c.add(b);
    };
    ma.Object.defineProperties(Oa.prototype, {
      mouseWheelBehavior: {
        get: function () {
          return this.La;
        },
        set: function (a) {
          this.La = a;
        },
      },
      gestureBehavior: {
        get: function () {
          return this.I;
        },
        set: function (a) {
          this.I = a;
        },
      },
      currentToolTip: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.l = a;
          this.pr = null !== a && a instanceof Ce ? a.adornedPart : null;
        },
      },
      mouseDownTools: {
        get: function () {
          return this.yd;
        },
      },
      mouseMoveTools: {
        get: function () {
          return this.be;
        },
      },
      mouseUpTools: {
        get: function () {
          return this.hj;
        },
      },
      hoverDelay: {
        get: function () {
          return this.Ja;
        },
        set: function (a) {
          this.Ja = a;
        },
      },
      holdDelay: {
        get: function () {
          return this.Y;
        },
        set: function (a) {
          this.Y = a;
        },
      },
      dragSize: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v = a.G();
        },
      },
      toolTipDuration: {
        get: function () {
          return this.eb;
        },
        set: function (a) {
          this.eb = a;
        },
      },
    });
    Oa.prototype.replaceStandardTool = Oa.prototype.Va;
    var Be = new D(Oa, 'WheelScroll', 0),
      Ae = new D(Oa, 'WheelZoom', 1),
      Oe = new D(Oa, 'WheelNone', 2),
      De = new D(Oa, 'GestureZoom', 3),
      Ke = new D(Oa, 'GestureCancel', 4),
      Le = new D(Oa, 'GestureNone', 5);
    Oa.className = 'ToolManager';
    Oa.WheelScroll = Be;
    Oa.WheelZoom = Ae;
    Oa.WheelNone = Oe;
    Oa.GestureZoom = De;
    Oa.GestureCancel = Ke;
    Oa.GestureNone = Le;
    function Pe() {
      xe.call(this);
      this.name = 'Dragging';
      this.I = this.be = !0;
      this.v = this.eb = this.Ja = this.og = null;
      this.Bn = this.hj = !1;
      this.Rl = new H(NaN, NaN);
      this.Ms = new H();
      this.yd = !0;
      this.Wk = 100;
      this.Tg = [];
      this.Rq = new F().freeze();
      this.La = new Qe();
      this.ko = null;
      this.Y = 'copy';
      this.Om = '';
      this.Ph = 'no-drop';
    }
    la(Pe, xe);
    Pe.prototype.canStart = function () {
      if (!this.isEnabled) return !1;
      var a = this.diagram;
      if (
        (a.isReadOnly && !a.allowDragOut) ||
        (!a.allowMove && !a.allowCopy && !a.allowDragOut) ||
        !a.allowSelect
      )
        return !1;
      var b = a.lastInput;
      return !b.left ||
        (a.currentTool !== this &&
          (!this.isBeyondDragSize() ||
            (b.isTouchEvent && b.timestamp - a.firstInput.timestamp < this.Wk)))
        ? !1
        : null !== this.findDraggablePart();
    };
    Pe.prototype.findDraggablePart = function () {
      var a = this.diagram;
      a = a.km(a.firstInput.documentPoint, !1);
      if (null === a) return null;
      for (; null !== a && !a.canSelect(); ) a = a.containingGroup;
      return null !== a && (a.canMove() || a.canCopy()) ? a : null;
    };
    Pe.prototype.standardMouseSelect = function () {
      var a = this.diagram;
      if (a.allowSelect) {
        var b = a.km(a.firstInput.documentPoint, !1);
        if (null !== b) {
          for (; null !== b && !b.canSelect(); ) b = b.containingGroup;
          this.currentPart = b;
          null === this.currentPart ||
            this.currentPart.isSelected ||
            (a.R('ChangingSelection', a.selection),
            (b = a.lastInput),
            (Wa ? b.meta : b.control) || b.shift || Re(a),
            (this.currentPart.isSelected = !0),
            a.R('ChangedSelection', a.selection));
        }
      }
    };
    Pe.prototype.doActivate = function () {
      var a = this.diagram;
      this.ko = null;
      null === this.currentPart && this.standardMouseSelect();
      var b = this.currentPart;
      null !== b &&
        (b.canMove() || b.canCopy()) &&
        ((Se = null),
        (this.isActive = !0),
        this.Rl.set(a.position),
        Te(this, a.selection),
        (this.Tg.length = 0),
        (this.draggedParts = this.computeEffectiveCollection(
          a.selection,
          this.dragOptions,
        )),
        (a.Ot = !0),
        !0 === a.Be('temporaryPixelRatio') && 30 < a.zx && Ue(a),
        Ve(a, this.draggedParts),
        this.ta('Drag'),
        (this.startPoint = a.firstInput.documentPoint),
        (a.isMouseCaptured = !0),
        a.allowDragOut &&
          ((this.isDragOutStarted = !0),
          (this.Bn = !1),
          (Se = this),
          (We = this.diagram),
          this.doSimulatedDragOut()));
    };
    function Te(a, b) {
      if (a.dragsLink) {
        var c = a.diagram;
        c.allowRelink &&
          (c.model.jk() && 1 === b.count && b.first() instanceof S
            ? ((a.draggedLink = b.first()),
              a.draggedLink.canRelinkFrom() &&
                a.draggedLink.canRelinkTo() &&
                a.draggedLink.Zj(),
              (a.og = c.toolManager.findTool('Relinking')),
              null === a.og && ((a.og = new Xe()), (a.og.diagram = c)))
            : ((a.draggedLink = null), (a.og = null)));
      }
    }
    Pe.prototype.computeEffectiveCollection = function (a, b) {
      return this.diagram.commandHandler.computeEffectiveCollection(a, b);
    };
    Pe.prototype.qd = function (a) {
      return void 0 === a
        ? new Ye(Fb)
        : this.isGridSnapEnabled
        ? new Ye(new H(Math.round(a.x), Math.round(a.y)))
        : new Ye(a.copy());
    };
    Pe.prototype.doDeactivate = function () {
      this.isActive = !1;
      var a = this.diagram;
      a.Cf();
      ef(this);
      ff(a, this.draggedParts);
      this.draggedParts = this.currentPart = this.ko = null;
      this.Bn = this.isDragOutStarted = !1;
      if (0 < gf.count) {
        for (var b = gf, c = b.length, d = 0; d < c; d++) {
          var e = b.L(d);
          hf(e);
          jf(e);
          ef(e);
          e.diagram.Cf();
        }
        b.clear();
      }
      hf(this);
      this.Rl.h(NaN, NaN);
      Se = We = null;
      jf(this);
      a.isMouseCaptured = !1;
      a.currentCursor = '';
      a.Ot = !1;
      this.Hg();
      kf(a, !0);
    };
    function ef(a) {
      var b = a.diagram,
        c = b.skipsUndoManager;
      b.skipsUndoManager = !0;
      lf(a, b.lastInput, null);
      b.skipsUndoManager = c;
      a.Tg.length = 0;
    }
    function mf() {
      var a = Se;
      jf(a);
      nf(a);
      var b = a.diagram;
      a.Rl.u() && (b.position = a.Rl);
      b.Cf();
    }
    Pe.prototype.doCancel = function () {
      jf(this);
      nf(this);
      var a = this.diagram;
      this.Rl.u() && (a.position = this.Rl);
      this.stopTool();
    };
    Pe.prototype.doKeyDown = function () {
      this.isActive &&
        ('Esc' === this.diagram.lastInput.key
          ? this.doCancel()
          : this.doMouseMove());
    };
    Pe.prototype.doKeyUp = function () {
      this.isActive && this.doMouseMove();
    };
    function of(a, b) {
      var c = Infinity,
        d = Infinity,
        e = -Infinity,
        f = -Infinity;
      for (a = a.iterator; a.next(); ) {
        var g = a.value;
        if (g.Vb() && g.isVisible()) {
          var h = g.location;
          g = h.x;
          h = h.y;
          isNaN(g) ||
            isNaN(h) ||
            (g < c && (c = g),
            h < d && (d = h),
            g > e && (e = g),
            h > f && (f = h));
        }
      }
      Infinity === c ? b.h(0, 0, 0, 0) : b.h(c, d, e - c, f - d);
    }
    function pf(a, b) {
      if (null === a.copiedParts) {
        var c = a.diagram;
        if (
          (!b || (!c.isReadOnly && !c.isModelReadOnly)) &&
          null !== a.draggedParts
        ) {
          var d = c.undoManager;
          d.isEnabled && d.isInTransaction
            ? null !== d.currentTransaction &&
              0 < d.currentTransaction.changes.count &&
              (c.undoManager.Bf(), c.ta('Drag'))
            : nf(a);
          c.skipsUndoManager = !b;
          c.partManager.addsToTemporaryLayer = !b;
          a.startPoint = c.firstInput.documentPoint;
          b = a.copiesEffectiveCollection ? a.draggedParts.Df() : c.selection;
          c = c.dk(b, c, !0);
          for (b = c.iterator; b.next(); ) b.value.location = b.key.location;
          b = N.alloc();
          of(c, b);
          N.free(b);
          b = new G();
          for (d = a.draggedParts.iterator; d.next(); ) {
            var e = d.key;
            e.Vb() &&
              e.canCopy() &&
              ((e = c.H(e)), null !== e && (e.zb(), b.add(e, a.qd(e.location))));
          }
          for (c = c.iterator; c.next(); )
            (d = c.value), d instanceof S && d.canCopy() && b.add(d, a.qd());
          a.copiedParts = b;
          Te(a, b.Df());
          null !== a.draggedLink &&
            ((c = a.draggedLink),
            (b = c.routeBounds),
            qf(
              c,
              a.startPoint.x - (b.x + b.width / 2),
              a.startPoint.y - (b.y + b.height / 2),
            ));
        }
      }
    }
    function jf(a) {
      var b = a.diagram;
      if (
        null !== a.copiedParts &&
        (b.Jt(a.copiedParts.Df(), !1),
        (a.copiedParts = null),
        null !== a.draggedParts)
      )
        for (var c = a.draggedParts.iterator; c.next(); )
          c.key instanceof S && (c.value.point = new H(0, 0));
      b.skipsUndoManager = !1;
      b.partManager.addsToTemporaryLayer = !1;
      a.startPoint = b.firstInput.documentPoint;
    }
    function hf(a) {
      if (null !== a.draggedLink) {
        if (a.dragsLink && null !== a.og) {
          var b = a.og;
          b.diagram.remove(b.temporaryFromNode);
          b.diagram.remove(b.temporaryToNode);
        }
        a.draggedLink = null;
        a.og = null;
      }
    }
    function rf(a, b, c) {
      var d = a.diagram,
        e = a.startPoint,
        f = H.alloc();
      f.assign(d.lastInput.documentPoint);
      a.moveParts(b, f.$d(e), c);
      H.free(f);
      !0 === d.Be('temporaryPixelRatio') &&
        null === d.vh &&
        30 < d.zx &&
        (Ue(d), d.Ht());
    }
    Pe.prototype.moveParts = function (a, b, c) {
      var d = this.diagram;
      null !== d && sf(d, a, b, this.dragOptions, c);
    };
    function nf(a) {
      if (null !== a.draggedParts) {
        for (var b = a.diagram, c = a.draggedParts.iterator; c.next(); ) {
          var d = c.key;
          d.Vb() && (d.location = c.value.point);
        }
        for (c = a.draggedParts.iterator; c.next(); )
          if (((d = c.key), d instanceof S && d.suspendsRouting)) {
            var e = c.value.point;
            a.draggedParts.add(d, a.qd());
            qf(d, -e.x, -e.y);
          }
        b.ud();
      }
    }
    function tf(a, b) {
      if (null === b) return !0;
      b = b.part;
      return null === b ||
        b instanceof Ce ||
        b.layer.isTemporary ||
        (a.draggedParts && a.draggedParts.contains(b)) ||
        (a.copiedParts && a.copiedParts.contains(b))
        ? !0
        : !1;
    }
    function uf(a, b) {
      var c = a.diagram;
      a.dragsLink &&
        (null !== a.draggedLink &&
          ((a.draggedLink.fromNode = null), (a.draggedLink.toNode = null)),
        vf(a, !1));
      var d = wf(c, b, null, function (b) {
          return !tf(a, b);
        }),
        e = c.lastInput;
      e.targetObject = d;
      a.doUpdateCursor(d);
      var f = c.skipsUndoManager,
        g = !1;
      try {
        c.skipsUndoManager = !0;
        g = lf(a, e, d);
        if (!a.isActive && null === Se) return;
        var h = null !== d ? d.part : null;
        if (
          null === h ||
          (c.handlesDragDropForTopLevelParts &&
            h.isTopLevel &&
            !(h instanceof xf))
        ) {
          var k = c.mouseDragOver;
          null !== k && (k(e), (g = !0));
        }
        if (!a.isActive && null === Se) return;
        a.doDragOver(b, d);
        if (!a.isActive && null === Se) return;
      } finally {
        (c.skipsUndoManager = f), g && c.ud();
      }
      a.ko = d;
      c.isReadOnly ||
        (!c.allowMove && !c.allowCopy) ||
        (!c.allowHorizontalScroll && !c.allowVerticalScroll) ||
        c.ft(e.viewPoint);
    }
    Pe.prototype.doUpdateCursor = function (a) {
      var b = this.diagram;
      this.ko !== a &&
        (!this.diagram.currentTool.isActive || this.mayCopy()
          ? (b.currentCursor = this.copyCursor)
          : this.mayMove()
          ? (b.currentCursor = this.moveCursor)
          : this.mayDragOut() && (b.currentCursor = this.nodropCursor));
    };
    function lf(a, b, c) {
      var d = !1,
        e = a.Tg.length,
        f = 0 < e ? a.Tg[0] : null;
      if (c === f) return !1;
      b.handled = !1;
      for (var g = 0; g < e; g++) {
        var h = a.Tg[g],
          k = h.mouseDragLeave;
        if (null !== k && (k(b, h, c), (d = !0), b.handled)) break;
      }
      a.Tg.length = 0;
      if ((!a.isActive && null === Se) || null === c) return d;
      b.handled = !1;
      for (e = c; null !== e; ) a.Tg.push(e), (e = yf(e));
      e = a.Tg.length;
      for (
        c = 0;
        c < e &&
        ((g = a.Tg[c]),
        (h = g.mouseDragEnter),
        null === h || (h(b, g, f), (d = !0), !b.handled));
        c++
      );
      return d;
    }
    function yf(a) {
      var b = a.panel;
      return null !== b
        ? b
        : a instanceof T &&
          !(a instanceof xf) &&
          ((a = a.containingGroup), null !== a && a.handlesDragDropForMembers)
        ? a
        : null;
    }
    function zf(a, b, c) {
      var d = a.og;
      if (null === d) return null;
      var e = a.diagram.Ag(b, d.portGravity, function (a) {
        return d.findValidLinkablePort(a, c);
      });
      a = H.alloc();
      var f = Infinity,
        g = null;
      for (e = e.iterator; e.next(); ) {
        var h = e.value;
        if (null !== h.part) {
          var k = h.ga(Ac, a);
          k = b.Ae(k);
          k < f && ((g = h), (f = k));
        }
      }
      H.free(a);
      return g;
    }
    function vf(a, b) {
      var c = a.draggedLink;
      if (null !== c && !(2 > c.pointsCount)) {
        var d = a.diagram;
        if (!d.isReadOnly) {
          var e = a.og;
          if (null !== e) {
            var f = null,
              g = null;
            null === c.fromNode &&
              ((f = zf(a, c.i(0), !1)), null !== f && (g = f.part));
            var h = null,
              k = null;
            null === c.toNode &&
              ((h = zf(a, c.i(c.pointsCount - 1), !0)),
              null !== h && (k = h.part));
            e.isValidLink(g, f, k, h)
              ? b
                ? ((c.defaultFromPoint = c.i(0)),
                  (c.defaultToPoint = c.i(c.pointsCount - 1)),
                  (c.suspendsRouting = !1),
                  (c.fromNode = g),
                  null !== f && (c.fromPortId = f.portId),
                  (c.toNode = k),
                  null !== h && (c.toPortId = h.portId),
                  c.fromPort !== d.Yx && d.R('LinkRelinked', c, d.Yx),
                  c.toPort !== d.Zx && d.R('LinkRelinked', c, d.Zx))
                : Ff(e, g, f, k, h)
              : Ff(e, null, null, null, null);
          }
        }
      }
    }
    Pe.prototype.doDragOver = function () {};
    function Gf(a, b) {
      var c = a.diagram;
      a.dragsLink && vf(a, !0);
      ef(a);
      var d = wf(c, b, null, function (b) {
          return !tf(a, b);
        }),
        e = c.lastInput;
      e.targetObject = d;
      if (null !== d) {
        e.handled = !1;
        for (var f = d; null !== f; ) {
          var g = f.mouseDrop;
          if (null !== g && (g(e, f), e.handled)) break;
          Hf(a, e, f);
          f = yf(f);
        }
      } else (f = c.mouseDrop), null !== f && f(e);
      if (a.isActive || null !== Se) {
        for (e = (a.copiedParts || a.draggedParts).iterator; e.next(); )
          (f = e.key),
            f instanceof U &&
              f.linksConnected.each(function (a) {
                a.suspendsRouting = !1;
              });
        a.doDropOnto(b, d);
        if (a.isActive || null !== Se) {
          b = N.alloc();
          for (d = c.selection.iterator; d.next(); )
            (e = d.value), e instanceof U && If(c, e, b);
          N.free(b);
        }
      }
    }
    function Hf(a, b, c) {
      a = a.diagram;
      c = c.part;
      !a.handlesDragDropForTopLevelParts ||
        !c.isTopLevel ||
        c instanceof xf ||
        ((c = a.mouseDrop), null !== c && c(b));
    }
    function If(a, b, c) {
      var d = !1;
      b.getAvoidableRect(c);
      a.viewportBounds.qf(c) && (d = !0);
      a = a.xv(
        c,
        function (a) {
          return a.part;
        },
        function (a) {
          return a instanceof S;
        },
        !0,
        function (a) {
          return a instanceof S;
        },
        d,
      );
      if (0 !== a.count)
        for (a = a.iterator; a.next(); )
          (c = a.value), !c.Xd(b) && c.isAvoiding && c.Oa();
    }
    Pe.prototype.doDropOnto = function () {};
    Pe.prototype.doMouseMove = function () {
      if (this.isActive) {
        var a = this.diagram,
          b = a.lastInput;
        this.simulatedMouseMove(b.event, b.documentPoint, b.targetDiagram) ||
          null === this.currentPart ||
          null === this.draggedParts ||
          (this.mayCopy()
            ? (pf(this, !1),
              Ve(a, this.copiedParts),
              rf(this, this.copiedParts, !1),
              ff(a, this.copiedParts))
            : this.mayMove()
            ? (jf(this), rf(this, this.draggedParts, !0))
            : this.mayDragOut()
            ? (pf(this, !1), rf(this, this.copiedParts, !1))
            : jf(this),
          uf(this, a.lastInput.documentPoint));
      }
    };
    Pe.prototype.doMouseUp = function () {
      if (this.isActive) {
        var a = this.diagram,
          b = a.lastInput;
        if (!this.simulatedMouseUp(b.event, b.documentPoint, b.targetDiagram)) {
          b = !1;
          var c = this.mayCopy();
          c && null !== this.copiedParts
            ? (jf(this),
              pf(this, !0),
              Ve(a, this.copiedParts),
              rf(this, this.copiedParts, !1),
              ff(a, this.copiedParts),
              null !== this.copiedParts &&
                (a.R('ChangingSelection', a.selection),
                Re(a),
                this.copiedParts.iteratorKeys.each(function (a) {
                  a.isSelected = !0;
                })))
            : ((b = !0),
              jf(this),
              this.mayMove() &&
                (rf(this, this.draggedParts, !0),
                uf(this, a.lastInput.documentPoint)));
          this.Bn = !0;
          Gf(this, a.lastInput.documentPoint);
          if (this.isActive) {
            var d = c ? this.copiedParts.Df() : this.draggedParts.Df();
            this.copiedParts = null;
            b && Jf(this);
            a.Na();
            ff(a, this.draggedParts);
            this.transactionResult = c ? 'Copy' : 'Move';
            a.R(c ? 'SelectionCopied' : 'SelectionMoved', d);
          }
          this.stopTool();
          c && a.R('ChangedSelection', a.selection);
        }
      }
    };
    Pe.prototype.simulatedMouseMove = function (a, b, c) {
      if (null === Se) return !1;
      var d = Se.diagram;
      c instanceof R || (c = null);
      var e = We;
      c !== e &&
        (null !== e &&
          e !== d &&
          (e.Cf(),
          (Se.isDragOutStarted = !1),
          (e = e.toolManager.findTool('Dragging')),
          null !== e && e.doSimulatedDragLeave()),
        (We = c),
        null !== c &&
          c !== d &&
          (mf(),
          (e = c.toolManager.findTool('Dragging')),
          null !== e && (gf.contains(e) || gf.add(e), e.doSimulatedDragEnter())));
      if (null === c || c === d || !c.allowDrop || c.isReadOnly || !c.allowInsert)
        return !1;
      d = c.toolManager.findTool('Dragging');
      null !== d &&
        (null !== a &&
          (void 0 !== a.targetTouches &&
            (0 < a.targetTouches.length
              ? (a = a.targetTouches[0])
              : 0 < a.changedTouches.length && (a = a.changedTouches[0])),
          (b = c.getMouse(a))),
        (c.lastInput.documentPoint = b),
        (c.lastInput.viewPoint = c.Mq(b)),
        (c.lastInput.down = !1),
        (c.lastInput.up = !1),
        d.doSimulatedDragOver());
      return !0;
    };
    Pe.prototype.simulatedMouseUp = function (a, b, c) {
      if (null === Se) return !1;
      var d = We,
        e = Se.diagram;
      if (null === c) return Se.doCancel(), !0;
      if (c !== d) {
        var f = d.toolManager.findTool('Dragging');
        if (null !== d && d !== e && null !== f)
          return d.Cf(), (Se.isDragOutStarted = !1), f.doSimulatedDragLeave(), !1;
        We = c;
        d = c.toolManager.findTool('Dragging');
        null !== d &&
          (mf(), gf.contains(d) || gf.add(d), d.doSimulatedDragEnter());
      }
      return c !== this.diagram
        ? (null !== a
            ? (void 0 !== a.targetTouches &&
                (0 < a.targetTouches.length
                  ? (a = a.targetTouches[0])
                  : 0 < a.changedTouches.length && (a = a.changedTouches[0])),
              (b = c.getMouse(a)))
            : null === b && (b = new H()),
          (c.lastInput.documentPoint = b),
          (c.lastInput.viewPoint = c.Mq(b)),
          (c.lastInput.down = !1),
          (c.lastInput.up = !0),
          (a = c.toolManager.findTool('Dragging')),
          null !== a && a.doSimulatedDrop(),
          (a = Se),
          null !== a &&
            ((c = a.mayCopy()),
            (a.transactionResult = c ? 'Copy' : 'Move'),
            a.stopTool()),
          !0)
        : !1;
    };
    function Jf(a) {
      if (null !== a.draggedParts)
        for (var b = a.draggedParts.iterator; b.next(); ) {
          var c = b.key;
          c instanceof U &&
            ((c = c.containingGroup),
            null === c ||
              null === c.placeholder ||
              a.draggedParts.contains(c) ||
              c.placeholder.o());
        }
    }
    Pe.prototype.mayCopy = function () {
      if (!this.isCopyEnabled) return !1;
      var a = this.diagram;
      if (
        a.isReadOnly ||
        a.isModelReadOnly ||
        !a.allowInsert ||
        !a.allowCopy ||
        (Wa ? !a.lastInput.alt : !a.lastInput.control)
      )
        return !1;
      for (a = a.selection.iterator; a.next(); ) {
        var b = a.value;
        if (b.Vb() && b.canCopy()) return !0;
      }
      return null !== this.draggedLink &&
        this.dragsLink &&
        this.draggedLink.canCopy()
        ? !0
        : !1;
    };
    Pe.prototype.mayDragOut = function () {
      if (!this.isCopyEnabled) return !1;
      var a = this.diagram;
      if (!a.allowDragOut || !a.allowCopy || a.allowMove) return !1;
      for (a = a.selection.iterator; a.next(); ) {
        var b = a.value;
        if (b.Vb() && b.canCopy()) return !0;
      }
      return null !== this.draggedLink &&
        this.dragsLink &&
        this.draggedLink.canCopy()
        ? !0
        : !1;
    };
    Pe.prototype.mayMove = function () {
      var a = this.diagram;
      if (a.isReadOnly || !a.allowMove) return !1;
      for (a = a.selection.iterator; a.next(); ) {
        var b = a.value;
        if (b.Vb() && b.canMove()) return !0;
      }
      return null !== this.draggedLink &&
        this.dragsLink &&
        this.draggedLink.canMove()
        ? !0
        : !1;
    };
    Pe.prototype.computeBorder = function (a, b, c) {
      return this.Bn ||
        null === this.draggedParts ||
        this.draggedParts.contains(a)
        ? null
        : c.assign(b);
    };
    Pe.prototype.Dz = function () {
      return Se;
    };
    Pe.prototype.mayDragIn = function () {
      var a = this.diagram;
      if (!a.allowDrop || a.isReadOnly || a.isModelReadOnly || !a.allowInsert)
        return !1;
      var b = Se;
      return null === b || b.diagram.model.dataFormat !== a.model.dataFormat
        ? !1
        : !0;
    };
    Pe.prototype.doSimulatedDragEnter = function () {
      if (this.mayDragIn()) {
        var a = this.diagram;
        a.animationManager.Uc();
        Kf(a);
        a.animationManager.Uc();
        var b = Se;
        null !== b && (b.diagram.Ot = !1);
        this.doUpdateCursor(a.grid);
      }
    };
    Pe.prototype.doSimulatedDragLeave = function () {
      var a = Se;
      null !== a && a.doSimulatedDragOut();
      this.doCancel();
    };
    Pe.prototype.doSimulatedDragOver = function () {
      var a = this.diagram,
        b = Se;
      null !== b &&
        null !== b.draggedParts &&
        this.mayDragIn() &&
        (Lf(this, b.draggedParts.Df(), !1, a.firstInput),
        rf(this, this.copiedParts, !1),
        uf(this, a.lastInput.documentPoint));
    };
    Pe.prototype.doSimulatedDrop = function () {
      var a = this.diagram,
        b = Se;
      if (null !== b) {
        var c = b.diagram;
        b.Bn = !0;
        jf(this);
        this.mayDragIn() &&
          (a.R('ChangingSelection', a.selection),
          this.ta('Drop'),
          Lf(this, b.draggedParts.Df(), !0, a.lastInput),
          rf(this, this.copiedParts, !1),
          null !== this.copiedParts &&
            (Re(a),
            this.copiedParts.iteratorKeys.each(function (a) {
              a.isSelected = !0;
            })),
          Gf(this, a.lastInput.documentPoint),
          a.Na(),
          (b = a.selection),
          null !== this.copiedParts
            ? (this.transactionResult = 'ExternalCopy')
            : (b = new F()),
          (this.copiedParts = null),
          a.doFocus(),
          a.R('ExternalObjectsDropped', b, c),
          this.Hg(),
          a.R('ChangedSelection', a.selection));
      }
    };
    function Lf(a, b, c, d) {
      if (null === a.copiedParts) {
        var e = a.diagram;
        if (!e.isReadOnly && !e.isModelReadOnly) {
          e.skipsUndoManager = !c;
          e.partManager.addsToTemporaryLayer = !c;
          a.startPoint = d.documentPoint;
          c = e.dk(b, e, !0);
          var f = N.alloc();
          of(b, f);
          d = f.x + f.width / 2;
          e = f.y + f.height / 2;
          N.free(f);
          f = a.Ms;
          var g = new G(),
            h = H.alloc();
          for (b = b.iterator; b.next(); ) {
            var k = b.value,
              l = c.H(k);
            k.Vb() && k.canCopy()
              ? ((k = k.location),
                h.h(f.x - (d - k.x), f.y - (e - k.y)),
                (l.location = h),
                l.zb(),
                g.add(l, a.qd(h)))
              : l instanceof S &&
                k.canCopy() &&
                (qf(l, f.x - d, f.y - e), g.add(l, a.qd()));
          }
          H.free(h);
          a.copiedParts = g;
          Te(a, g.Df());
          null !== a.draggedLink &&
            ((c = a.draggedLink),
            (d = c.routeBounds),
            qf(
              c,
              a.startPoint.x - (d.x + d.width / 2),
              a.startPoint.y - (d.y + d.height / 2),
            ));
        }
      }
    }
    Pe.prototype.doSimulatedDragOut = function () {
      var a = this.diagram;
      a.Ot = !1;
      this.mayCopy() || this.mayMove()
        ? (a.currentCursor = '')
        : (a.currentCursor = this.nodropCursor);
      this.ko = null;
    };
    Pe.prototype.computeMove = function (a, b, c, d) {
      c = this.diagram;
      return null !== c ? c.computeMove(a, b, this.dragOptions, d) : new H();
    };
    ma.Object.defineProperties(Pe.prototype, {
      isCopyEnabled: {
        get: function () {
          return this.be;
        },
        set: function (a) {
          this.be = a;
        },
      },
      copiesEffectiveCollection: {
        get: function () {
          return this.I;
        },
        set: function (a) {
          this.I = a;
        },
      },
      dragOptions: {
        get: function () {
          return this.La;
        },
        set: function (a) {
          this.La = a;
        },
      },
      isGridSnapEnabled: {
        get: function () {
          return this.dragOptions.isGridSnapEnabled;
        },
        set: function (a) {
          this.dragOptions.isGridSnapEnabled = a;
        },
      },
      isComplexRoutingRealtime: {
        get: function () {
          return this.yd;
        },
        set: function (a) {
          this.yd = a;
        },
      },
      isGridSnapRealtime: {
        get: function () {
          return this.dragOptions.isGridSnapRealtime;
        },
        set: function (a) {
          this.dragOptions.isGridSnapRealtime = a;
        },
      },
      gridSnapCellSize: {
        get: function () {
          return this.dragOptions.gridSnapCellSize;
        },
        set: function (a) {
          this.dragOptions.gridSnapCellSize.A(a) ||
            ((a = a.G()), (this.dragOptions.gridSnapCellSize = a));
        },
      },
      gridSnapCellSpot: {
        get: function () {
          return this.dragOptions.gridSnapCellSpot;
        },
        set: function (a) {
          this.dragOptions.gridSnapCellSpot.A(a) ||
            ((a = a.G()), (this.dragOptions.gridSnapCellSpot = a));
        },
      },
      gridSnapOrigin: {
        get: function () {
          return this.dragOptions.gridSnapOrigin;
        },
        set: function (a) {
          this.dragOptions.gridSnapOrigin.A(a) ||
            ((a = a.G()), (this.dragOptions.gridSnapOrigin = a));
        },
      },
      dragsLink: {
        get: function () {
          return this.dragOptions.dragsLink;
        },
        set: function (a) {
          this.dragOptions.dragsLink = a;
        },
      },
      dragsTree: {
        get: function () {
          return this.dragOptions.dragsTree;
        },
        set: function (a) {
          this.dragOptions.dragsTree = a;
        },
      },
      copyCursor: {
        get: function () {
          return this.Y;
        },
        set: function (a) {
          this.Y = a;
        },
      },
      moveCursor: {
        get: function () {
          return this.Om;
        },
        set: function (a) {
          this.Om = a;
        },
      },
      nodropCursor: {
        get: function () {
          return this.Ph;
        },
        set: function (a) {
          this.Ph = a;
        },
      },
      currentPart: {
        get: function () {
          return this.Ja;
        },
        set: function (a) {
          this.Ja = a;
        },
      },
      copiedParts: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v = a;
        },
      },
      draggedParts: {
        get: function () {
          return this.eb;
        },
        set: function (a) {
          this.eb = a;
        },
      },
      draggingParts: {
        get: function () {
          return null !== this.copiedParts
            ? this.copiedParts.Df()
            : null !== this.draggedParts
            ? this.draggedParts.Df()
            : this.Rq;
        },
      },
      draggedLink: {
        get: function () {
          return this.diagram.draggedLink;
        },
        set: function (a) {
          this.diagram.draggedLink = a;
        },
      },
      isDragOutStarted: {
        get: function () {
          return this.hj;
        },
        set: function (a) {
          this.hj = a;
        },
      },
      startPoint: {
        get: function () {
          return this.Ms;
        },
        set: function (a) {
          this.Ms.A(a) || this.Ms.assign(a);
        },
      },
      delay: {
        get: function () {
          return this.Wk;
        },
        set: function (a) {
          this.Wk = a;
        },
      },
    });
    Pe.prototype.getDraggingSource = Pe.prototype.Dz;
    var gf = null,
      Se = null,
      We = null;
    Pe.className = 'DraggingTool';
    gf = new E();
    La(
      'draggingTool',
      function () {
        return this.findTool('Dragging');
      },
      function (a) {
        this.Va('Dragging', a, this.mouseMoveTools);
      },
    );
    Oa.prototype.doCancel = function () {
      null !== Se && Se.doCancel();
      xe.prototype.doCancel.call(this);
    };
    function Mf() {
      xe.call(this);
      this.hj = 100;
      this.Y = !1;
      this.gi = 'pointer';
      var a = new S(),
        b = new W();
      b.isPanelMain = !0;
      b.stroke = 'blue';
      a.add(b);
      b = new W();
      b.toArrow = 'Standard';
      b.fill = 'blue';
      b.stroke = 'blue';
      a.add(b);
      a.layerName = 'Tool';
      this.Gw = a;
      a = new U();
      b = new W();
      b.portId = '';
      b.figure = 'Rectangle';
      b.fill = null;
      b.stroke = 'magenta';
      b.strokeWidth = 2;
      b.desiredSize = Lb;
      a.add(b);
      a.selectable = !1;
      a.layerName = 'Tool';
      this.Ew = a;
      this.Fw = b;
      a = new U();
      b = new W();
      b.portId = '';
      b.figure = 'Rectangle';
      b.fill = null;
      b.stroke = 'magenta';
      b.strokeWidth = 2;
      b.desiredSize = Lb;
      a.add(b);
      a.selectable = !1;
      a.layerName = 'Tool';
      this.Hw = a;
      this.Iw = b;
      this.be = this.yd = this.La = this.Ja = this.eb = null;
      this.I = !0;
      this.wy = new G();
      this.Om = this.xi = this.Rq = null;
    }
    la(Mf, xe);
    Mf.prototype.doStop = function () {
      this.diagram.Cf();
      this.originalToPort =
        this.originalToNode =
        this.originalFromPort =
        this.originalFromNode =
        this.originalLink =
          null;
      this.validPortsCache.clear();
      this.targetPort = null;
    };
    Mf.prototype.copyPortProperties = function (a, b, c, d, e) {
      if (null !== a && null !== b && null !== c && null !== d) {
        var f = b.tf(),
          g = L.alloc();
        g.width = b.naturalBounds.width * f;
        g.height = b.naturalBounds.height * f;
        d.desiredSize = g;
        L.free(g);
        e
          ? ((d.toSpot = b.toSpot), (d.toEndSegmentLength = b.toEndSegmentLength))
          : ((d.fromSpot = b.fromSpot),
            (d.fromEndSegmentLength = b.fromEndSegmentLength));
        c.locationSpot = Ac;
        f = H.alloc();
        c.location = b.ga(Ac, f);
        H.free(f);
        d.angle = b.Wi();
        null !== this.portTargeted && this.portTargeted(a, b, c, d, e);
      }
    };
    Mf.prototype.setNoTargetPortProperties = function (a, b, c) {
      null !== b && ((b.desiredSize = Lb), (b.fromSpot = uc), (b.toSpot = uc));
      null !== a && (a.location = this.diagram.lastInput.documentPoint);
      null !== this.portTargeted && this.portTargeted(null, null, a, b, c);
    };
    Mf.prototype.doMouseDown = function () {
      this.isActive && this.doMouseMove();
    };
    Mf.prototype.doMouseMove = function () {
      if (this.isActive) {
        var a = this.diagram;
        this.targetPort = this.findTargetPort(this.isForwards);
        if (null !== this.targetPort && this.targetPort.part instanceof U) {
          var b = this.targetPort.part;
          this.isForwards
            ? this.copyPortProperties(
                b,
                this.targetPort,
                this.temporaryToNode,
                this.temporaryToPort,
                !0,
              )
            : this.copyPortProperties(
                b,
                this.targetPort,
                this.temporaryFromNode,
                this.temporaryFromPort,
                !1,
              );
        } else
          this.isForwards
            ? this.setNoTargetPortProperties(
                this.temporaryToNode,
                this.temporaryToPort,
                !0,
              )
            : this.setNoTargetPortProperties(
                this.temporaryFromNode,
                this.temporaryFromPort,
                !1,
              );
        (a.allowHorizontalScroll || a.allowVerticalScroll) &&
          a.ft(a.lastInput.viewPoint);
      }
    };
    Mf.prototype.findValidLinkablePort = function (a, b) {
      if (null === a) return null;
      var c = a.part;
      if (!(c instanceof U)) return null;
      for (; null !== a; ) {
        var d = b ? a.toLinkable : a.fromLinkable;
        if (
          !0 === d &&
          (null !== a.portId || a instanceof U) &&
          (b ? this.isValidTo(c, a) : this.isValidFrom(c, a))
        )
          return a;
        if (!1 === d) break;
        a = a.panel;
      }
      return null;
    };
    Mf.prototype.findTargetPort = function (a) {
      var b = this.diagram,
        c = b.lastInput.documentPoint,
        d = this.portGravity;
      0 >= d && (d = 0.1);
      var e = this,
        f = b.Ag(
          c,
          d,
          function (b) {
            return e.findValidLinkablePort(b, a);
          },
          null,
          !0,
        );
      d = Infinity;
      b = null;
      for (f = f.iterator; f.next(); ) {
        var g = f.value,
          h = g.part;
        if (h instanceof U) {
          var k = g.ga(Ac, H.alloc()),
            l = c.x - k.x,
            m = c.y - k.y;
          H.free(k);
          k = l * l + m * m;
          k < d &&
            ((l = this.validPortsCache.H(g)),
            null !== l
              ? l && ((b = g), (d = k))
              : (a &&
                  this.isValidLink(
                    this.originalFromNode,
                    this.originalFromPort,
                    h,
                    g,
                  )) ||
                (!a &&
                  this.isValidLink(
                    h,
                    g,
                    this.originalToNode,
                    this.originalToPort,
                  ))
              ? (this.validPortsCache.add(g, !0), (b = g), (d = k))
              : this.validPortsCache.add(g, !1));
        }
      }
      return null !== b &&
        ((c = b.part), c instanceof U && (null === c.layer || c.layer.allowLink))
        ? b
        : null;
    };
    Mf.prototype.isValidFrom = function (a, b) {
      if (null === a || null === b) return this.isUnconnectedLinkValid;
      if (
        this.diagram.currentTool === this &&
        ((null !== a.layer && !a.layer.allowLink) || !0 !== b.fromLinkable)
      )
        return !1;
      var c = b.fromMaxLinks;
      if (Infinity > c) {
        if (
          null !== this.originalLink &&
          a === this.originalFromNode &&
          b === this.originalFromPort
        )
          return !0;
        b = b.portId;
        null === b && (b = '');
        if (a.kq(b).count >= c) return !1;
      }
      return !0;
    };
    Mf.prototype.isValidTo = function (a, b) {
      if (null === a || null === b) return this.isUnconnectedLinkValid;
      if (
        this.diagram.currentTool === this &&
        ((null !== a.layer && !a.layer.allowLink) || !0 !== b.toLinkable)
      )
        return !1;
      var c = b.toMaxLinks;
      if (Infinity > c) {
        if (
          null !== this.originalLink &&
          a === this.originalToNode &&
          b === this.originalToPort
        )
          return !0;
        b = b.portId;
        null === b && (b = '');
        if (a.td(b).count >= c) return !1;
      }
      return !0;
    };
    Mf.prototype.isInSameNode = function (a, b) {
      if (null === a || null === b) return !1;
      if (a === b) return !0;
      a = a.part;
      b = b.part;
      return null !== a && a === b;
    };
    Mf.prototype.isLinked = function (a, b) {
      if (null === a || null === b) return !1;
      var c = a.part;
      if (!(c instanceof U)) return !1;
      a = a.portId;
      null === a && (a = '');
      var d = b.part;
      if (!(d instanceof U)) return !1;
      b = b.portId;
      null === b && (b = '');
      for (b = d.td(b); b.next(); )
        if (((d = b.value), d.fromNode === c && d.fromPortId === a)) return !0;
      return !1;
    };
    Mf.prototype.isValidLink = function (a, b, c, d) {
      if (
        !this.isValidFrom(a, b) ||
        !this.isValidTo(c, d) ||
        !(
          null === b ||
          null === d ||
          (((b.fromLinkableSelfNode && d.toLinkableSelfNode) ||
            !this.isInSameNode(b, d)) &&
            ((b.fromLinkableDuplicates && d.toLinkableDuplicates) ||
              !this.isLinked(b, d)))
        ) ||
        (null !== this.originalLink &&
          ((null !== a && this.isLabelDependentOnLink(a, this.originalLink)) ||
            (null !== c && this.isLabelDependentOnLink(c, this.originalLink)))) ||
        (null !== a &&
          null !== c &&
          ((null === a.data && null !== c.data) ||
            (null !== a.data && null === c.data))) ||
        !this.isValidCycle(a, c, this.originalLink)
      )
        return !1;
      if (null !== a) {
        var e = a.linkValidation;
        if (null !== e && !e(a, b, c, d, this.originalLink)) return !1;
      }
      if (
        null !== c &&
        ((e = c.linkValidation), null !== e && !e(a, b, c, d, this.originalLink))
      )
        return !1;
      e = this.linkValidation;
      return null !== e ? e(a, b, c, d, this.originalLink) : !0;
    };
    Mf.prototype.isLabelDependentOnLink = function (a, b) {
      if (null === a) return !1;
      var c = a.labeledLink;
      if (null === c) return !1;
      if (c === b) return !0;
      var d = new F();
      d.add(a);
      return Nf(this, c, b, d);
    };
    function Nf(a, b, c, d) {
      if (b === c) return !0;
      var e = b.fromNode;
      if (null !== e && e.isLinkLabel && (d.add(e), Nf(a, e.labeledLink, c, d)))
        return !0;
      b = b.toNode;
      return null !== b && b.isLinkLabel && (d.add(b), Nf(a, b.labeledLink, c, d))
        ? !0
        : !1;
    }
    Mf.prototype.isValidCycle = function (a, b, c) {
      void 0 === c && (c = null);
      if (null === a || null === b) return this.isUnconnectedLinkValid;
      var d = this.diagram.validCycle;
      if (d !== Of) {
        if (d === Pf) {
          d = c || this.temporaryLink;
          if (null !== d && !d.isTreeLink) return !0;
          for (d = b.linksConnected; d.next(); ) {
            var e = d.value;
            if (e !== c && e.isTreeLink && e.toNode === b) return !1;
          }
          return !Qf(this, a, b, c, !0);
        }
        if (d === Rf) {
          d = c || this.temporaryLink;
          if (null !== d && !d.isTreeLink) return !0;
          for (d = a.linksConnected; d.next(); )
            if (((e = d.value), e !== c && e.isTreeLink && e.fromNode === a))
              return !1;
          return !Qf(this, a, b, c, !0);
        }
        if (d === Sf)
          return (
            a === b
              ? (a = !0)
              : ((d = new F()), d.add(b), (a = Tf(this, d, a, b, c))),
            !a
          );
        if (d === Uf) return !Qf(this, a, b, c, !1);
        if (d === Vf)
          return (
            a === b
              ? (a = !0)
              : ((d = new F()), d.add(b), (a = Wf(this, d, a, b, c))),
            !a
          );
      }
      return !0;
    };
    function Qf(a, b, c, d, e) {
      if (b === c) return !0;
      if (null === b || null === c) return !1;
      for (var f = b.linksConnected; f.next(); ) {
        var g = f.value;
        if (
          g !== d &&
          (!e || g.isTreeLink) &&
          g.toNode === b &&
          ((g = g.fromNode), g !== b && Qf(a, g, c, d, e))
        )
          return !0;
      }
      return !1;
    }
    function Tf(a, b, c, d, e) {
      if (c === d) return !0;
      if (null === c || null === d || b.contains(c)) return !1;
      b.add(c);
      for (var f = c.linksConnected; f.next(); ) {
        var g = f.value;
        if (
          g !== e &&
          g.toNode === c &&
          ((g = g.fromNode), g !== c && Tf(a, b, g, d, e))
        )
          return !0;
      }
      return !1;
    }
    function Wf(a, b, c, d, e) {
      if (c === d) return !0;
      if (null === c || null === d || b.contains(c)) return !1;
      b.add(c);
      for (var f = c.linksConnected; f.next(); ) {
        var g = f.value;
        if (g !== e) {
          var h = g.fromNode;
          g = g.toNode;
          h = h === c ? g : h;
          if (h !== c && Wf(a, b, h, d, e)) return !0;
        }
      }
      return !1;
    }
    ma.Object.defineProperties(Mf.prototype, {
      portGravity: {
        get: function () {
          return this.hj;
        },
        set: function (a) {
          0 <= a && (this.hj = a);
        },
      },
      isUnconnectedLinkValid: {
        get: function () {
          return this.Y;
        },
        set: function (a) {
          this.Y = a;
        },
      },
      linkingCursor: {
        get: function () {
          return this.gi;
        },
        set: function (a) {
          this.gi = a;
        },
      },
      temporaryLink: {
        get: function () {
          return this.Gw;
        },
        set: function (a) {
          this.Gw = a;
        },
      },
      temporaryFromNode: {
        get: function () {
          return this.Ew;
        },
        set: function (a) {
          this.Ew = a;
        },
      },
      temporaryFromPort: {
        get: function () {
          return this.Fw;
        },
        set: function (a) {
          this.Fw = a;
        },
      },
      temporaryToNode: {
        get: function () {
          return this.Hw;
        },
        set: function (a) {
          this.Hw = a;
        },
      },
      temporaryToPort: {
        get: function () {
          return this.Iw;
        },
        set: function (a) {
          this.Iw = a;
        },
      },
      originalLink: {
        get: function () {
          return this.eb;
        },
        set: function (a) {
          this.eb = a;
        },
      },
      originalFromNode: {
        get: function () {
          return this.Ja;
        },
        set: function (a) {
          this.Ja = a;
        },
      },
      originalFromPort: {
        get: function () {
          return this.La;
        },
        set: function (a) {
          this.La = a;
        },
      },
      originalToNode: {
        get: function () {
          return this.yd;
        },
        set: function (a) {
          this.yd = a;
        },
      },
      originalToPort: {
        get: function () {
          return this.be;
        },
        set: function (a) {
          this.be = a;
        },
      },
      isForwards: {
        get: function () {
          return this.I;
        },
        set: function (a) {
          this.I = a;
        },
      },
      validPortsCache: {
        get: function () {
          return this.wy;
        },
      },
      targetPort: {
        get: function () {
          return this.Rq;
        },
        set: function (a) {
          this.Rq = a;
        },
      },
      linkValidation: {
        get: function () {
          return this.xi;
        },
        set: function (a) {
          this.xi = a;
        },
      },
      portTargeted: {
        get: function () {
          return this.Om;
        },
        set: function (a) {
          this.Om = a;
        },
      },
    });
    Mf.className = 'LinkingBaseTool';
    function Xf() {
      Mf.call(this);
      this.name = 'Linking';
      this.v = {};
      this.l = null;
      this.J = Yf;
      this.Ph = null;
    }
    la(Xf, Mf);
    Xf.prototype.canStart = function () {
      if (!this.isEnabled) return !1;
      var a = this.diagram;
      return a.isReadOnly ||
        a.isModelReadOnly ||
        !a.allowLink ||
        !a.model.vt() ||
        !a.lastInput.left ||
        (a.currentTool !== this && !this.isBeyondDragSize())
        ? !1
        : null !== this.findLinkablePort();
    };
    Xf.prototype.findLinkablePort = function () {
      var a = this.diagram,
        b = this.startObject;
      null === b && (b = a.Tb(a.firstInput.documentPoint, null, null));
      if (null === b || !(b.part instanceof U)) return null;
      a = this.direction;
      if (a === Yf || a === Zf) {
        var c = this.findValidLinkablePort(b, !1);
        if (null !== c) return (this.isForwards = !0), c;
      }
      if (a === Yf || a === $f)
        if (((b = this.findValidLinkablePort(b, !0)), null !== b))
          return (this.isForwards = !1), b;
      return null;
    };
    Xf.prototype.doActivate = function () {
      var a = this.diagram,
        b = this.findLinkablePort();
      null !== b &&
        (this.ta(this.name),
        (a.isMouseCaptured = !0),
        (a.currentCursor = this.linkingCursor),
        this.isForwards
          ? (null === this.temporaryToNode ||
              this.temporaryToNode.location.u() ||
              (this.temporaryToNode.location = a.lastInput.documentPoint),
            (this.originalFromPort = b),
            (b = this.originalFromPort.part),
            b instanceof U && (this.originalFromNode = b),
            this.copyPortProperties(
              this.originalFromNode,
              this.originalFromPort,
              this.temporaryFromNode,
              this.temporaryFromPort,
              !1,
            ))
          : (null === this.temporaryFromNode ||
              this.temporaryFromNode.location.u() ||
              (this.temporaryFromNode.location = a.lastInput.documentPoint),
            (this.originalToPort = b),
            (b = this.originalToPort.part),
            b instanceof U && (this.originalToNode = b),
            this.copyPortProperties(
              this.originalToNode,
              this.originalToPort,
              this.temporaryToNode,
              this.temporaryToPort,
              !0,
            )),
        a.add(this.temporaryFromNode),
        a.add(this.temporaryToNode),
        null !== this.temporaryLink &&
          (null !== this.temporaryFromNode &&
            (this.temporaryLink.fromNode = this.temporaryFromNode),
          null !== this.temporaryToNode &&
            (this.temporaryLink.toNode = this.temporaryToNode),
          (this.temporaryLink.isTreeLink = this.isNewTreeLink()),
          this.temporaryLink.Oa(),
          a.add(this.temporaryLink)),
        (this.isActive = !0));
    };
    Xf.prototype.doDeactivate = function () {
      this.isActive = !1;
      var a = this.diagram;
      a.remove(this.temporaryLink);
      a.remove(this.temporaryFromNode);
      a.remove(this.temporaryToNode);
      a.isMouseCaptured = !1;
      a.currentCursor = '';
      this.Hg();
    };
    Xf.prototype.doStop = function () {
      Mf.prototype.doStop.call(this);
      this.startObject = null;
    };
    Xf.prototype.doMouseUp = function () {
      var a = this.diagram;
      if (this.isActive) {
        var b = (this.transactionResult = null),
          c = null,
          d = null,
          e = null,
          f = null;
        try {
          var g = (this.targetPort = this.findTargetPort(this.isForwards));
          if (null !== g) {
            var h = g.part;
            h instanceof U &&
              (this.isForwards
                ? (null !== this.originalFromNode &&
                    ((b = this.originalFromNode), (c = this.originalFromPort)),
                  (d = h),
                  (e = g))
                : ((b = h),
                  (c = g),
                  null !== this.originalToNode &&
                    ((d = this.originalToNode), (e = this.originalToPort))));
          } else
            this.isForwards
              ? null !== this.originalFromNode &&
                this.isUnconnectedLinkValid &&
                ((b = this.originalFromNode), (c = this.originalFromPort))
              : null !== this.originalToNode &&
                this.isUnconnectedLinkValid &&
                ((d = this.originalToNode), (e = this.originalToPort));
          null !== b || null !== d
            ? ((f = this.insertLink(b, c, d, e)),
              null !== f
                ? (null === g &&
                    (this.isForwards
                      ? (f.defaultToPoint = a.lastInput.documentPoint)
                      : (f.defaultFromPoint = a.lastInput.documentPoint)),
                  a.allowSelect &&
                    (a.R('ChangingSelection', a.selection), (f.isSelected = !0)),
                  (this.transactionResult = this.name),
                  a.R('LinkDrawn', f))
                : (a.model.fq(), this.doNoLink(b, c, d, e)))
            : this.isForwards
            ? this.doNoLink(
                this.originalFromNode,
                this.originalFromPort,
                null,
                null,
              )
            : this.doNoLink(null, null, this.originalToNode, this.originalToPort);
        } finally {
          this.stopTool(),
            f && a.allowSelect && a.R('ChangedSelection', a.selection);
        }
      }
    };
    Xf.prototype.isNewTreeLink = function () {
      var a = this.archetypeLinkData;
      if (null === a) return !0;
      if (a instanceof S) return a.isTreeLink;
      var b = this.diagram;
      if (null === b) return !0;
      a = b.partManager.getLinkCategoryForData(a);
      b = b.partManager.findLinkTemplateForCategory(a);
      return null !== b ? b.isTreeLink : !0;
    };
    Xf.prototype.insertLink = function (a, b, c, d) {
      return this.diagram.partManager.insertLink(a, b, c, d);
    };
    Xf.prototype.doNoLink = function () {};
    ma.Object.defineProperties(Xf.prototype, {
      archetypeLinkData: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v = a;
        },
      },
      archetypeLabelNodeData: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.l = a;
        },
      },
      direction: {
        get: function () {
          return this.J;
        },
        set: function (a) {
          this.J = a;
        },
      },
      startObject: {
        get: function () {
          return this.Ph;
        },
        set: function (a) {
          this.Ph = a;
        },
      },
    });
    var Yf = new D(Xf, 'Either', 0),
      Zf = new D(Xf, 'ForwardsOnly', 0),
      $f = new D(Xf, 'BackwardsOnly', 0);
    Xf.className = 'LinkingTool';
    Xf.Either = Yf;
    Xf.ForwardsOnly = Zf;
    Xf.BackwardsOnly = $f;
    function Xe() {
      Mf.call(this);
      this.name = 'Relinking';
      var a = new W();
      a.figure = 'Diamond';
      a.desiredSize = Nb;
      a.fill = 'lightblue';
      a.stroke = 'dodgerblue';
      a.cursor = this.linkingCursor;
      a.segmentIndex = 0;
      this.v = a;
      a = new W();
      a.figure = 'Diamond';
      a.desiredSize = Nb;
      a.fill = 'lightblue';
      a.stroke = 'dodgerblue';
      a.cursor = this.linkingCursor;
      a.segmentIndex = -1;
      this.Ph = a;
      this.l = null;
      this.jx = new N();
    }
    la(Xe, Mf);
    Xe.prototype.updateAdornments = function (a) {
      if (null !== a && a instanceof S) {
        var b = 'RelinkFrom',
          c = null;
        if (a.isSelected && !this.diagram.isReadOnly) {
          var d = a.selectionObject;
          null !== d &&
            a.canRelinkFrom() &&
            a.actualBounds.u() &&
            a.isVisible() &&
            d.actualBounds.u() &&
            d.yf() &&
            ((c = a.gk(b)),
            null === c && ((c = this.makeAdornment(d, !1)), a.Dh(b, c)));
        }
        null === c && a.Af(b);
        b = 'RelinkTo';
        c = null;
        a.isSelected &&
          !this.diagram.isReadOnly &&
          ((d = a.selectionObject),
          null !== d &&
            a.canRelinkTo() &&
            a.actualBounds.u() &&
            a.isVisible() &&
            d.actualBounds.u() &&
            d.yf() &&
            ((c = a.gk(b)),
            null === c ? ((c = this.makeAdornment(d, !0)), a.Dh(b, c)) : c.o()));
        null === c && a.Af(b);
      }
    };
    Xe.prototype.makeAdornment = function (a, b) {
      var c = new Ce();
      c.type = X.Link;
      b = b ? this.toHandleArchetype : this.fromHandleArchetype;
      null !== b && c.add(b.copy());
      c.adornedObject = a;
      return c;
    };
    Xe.prototype.canStart = function () {
      if (!this.isEnabled) return !1;
      var a = this.diagram;
      if (
        a.isReadOnly ||
        a.isModelReadOnly ||
        !a.allowRelink ||
        !a.model.vt() ||
        !a.lastInput.left
      )
        return !1;
      var b = this.findToolHandleAt(a.firstInput.documentPoint, 'RelinkFrom');
      null === b &&
        (b = this.findToolHandleAt(a.firstInput.documentPoint, 'RelinkTo'));
      return null !== b;
    };
    Xe.prototype.doActivate = function () {
      var a = this.diagram;
      if (null === this.originalLink) {
        var b = this.handle;
        null === b &&
          ((b = this.findToolHandleAt(a.firstInput.documentPoint, 'RelinkFrom')),
          null === b &&
            (b = this.findToolHandleAt(a.firstInput.documentPoint, 'RelinkTo')));
        if (null === b) return;
        var c = b.part;
        if (!(c instanceof Ce && c.adornedPart instanceof S)) return;
        this.handle = b;
        this.isForwards = null === c || 'RelinkTo' === c.category;
        this.originalLink = c.adornedPart;
      }
      this.ta(this.name);
      a.isMouseCaptured = !0;
      a.currentCursor = this.linkingCursor;
      this.originalFromPort = this.originalLink.fromPort;
      this.originalFromNode = this.originalLink.fromNode;
      this.originalToPort = this.originalLink.toPort;
      this.originalToNode = this.originalLink.toNode;
      this.jx.set(this.originalLink.actualBounds);
      null !== this.originalLink &&
        0 < this.originalLink.pointsCount &&
        (null === this.originalLink.fromNode &&
          (null !== this.temporaryFromPort &&
            (this.temporaryFromPort.desiredSize = Kb),
          null !== this.temporaryFromNode &&
            (this.temporaryFromNode.location = this.originalLink.i(0))),
        null === this.originalLink.toNode &&
          (null !== this.temporaryToPort &&
            (this.temporaryToPort.desiredSize = Kb),
          null !== this.temporaryToNode &&
            (this.temporaryToNode.location = this.originalLink.i(
              this.originalLink.pointsCount - 1,
            ))));
      this.copyPortProperties(
        this.originalFromNode,
        this.originalFromPort,
        this.temporaryFromNode,
        this.temporaryFromPort,
        !1,
      );
      this.copyPortProperties(
        this.originalToNode,
        this.originalToPort,
        this.temporaryToNode,
        this.temporaryToPort,
        !0,
      );
      a.add(this.temporaryFromNode);
      a.add(this.temporaryToNode);
      null !== this.temporaryLink &&
        (null !== this.temporaryFromNode &&
          (this.temporaryLink.fromNode = this.temporaryFromNode),
        null !== this.temporaryToNode &&
          (this.temporaryLink.toNode = this.temporaryToNode),
        this.copyLinkProperties(this.originalLink, this.temporaryLink),
        this.temporaryLink.Oa(),
        a.add(this.temporaryLink));
      this.isActive = !0;
    };
    Xe.prototype.copyLinkProperties = function (a, b) {
      if (null !== a && null !== b) {
        b.adjusting = a.adjusting;
        b.corner = a.corner;
        var c = a.curve;
        if (c === ag || c === bg) c = cg;
        b.curve = c;
        b.curviness = a.curviness;
        b.isTreeLink = a.isTreeLink;
        b.points = a.points;
        b.routing = a.routing;
        b.smoothness = a.smoothness;
        b.fromSpot = a.fromSpot;
        b.fromEndSegmentLength = a.fromEndSegmentLength;
        b.fromShortLength = a.fromShortLength;
        b.toSpot = a.toSpot;
        b.toEndSegmentLength = a.toEndSegmentLength;
        b.toShortLength = a.toShortLength;
      }
    };
    Xe.prototype.doDeactivate = function () {
      this.isActive = !1;
      var a = this.diagram;
      a.remove(this.temporaryLink);
      a.remove(this.temporaryFromNode);
      a.remove(this.temporaryToNode);
      a.isMouseCaptured = !1;
      a.currentCursor = '';
      this.Hg();
    };
    Xe.prototype.doStop = function () {
      Mf.prototype.doStop.call(this);
      this.handle = null;
    };
    Xe.prototype.doMouseUp = function () {
      if (this.isActive) {
        var a = this.diagram;
        this.transactionResult = null;
        var b = this.originalFromNode,
          c = this.originalFromPort,
          d = this.originalToNode,
          e = this.originalToPort,
          f = this.originalLink;
        this.targetPort = this.findTargetPort(this.isForwards);
        if (null !== this.targetPort) {
          var g = this.targetPort.part;
          g instanceof U &&
            (this.isForwards
              ? ((d = g), (e = this.targetPort))
              : ((b = g), (c = this.targetPort)));
        } else
          this.isUnconnectedLinkValid
            ? this.isForwards
              ? (e = d = null)
              : (c = b = null)
            : (f = null);
        null !== f
          ? (this.reconnectLink(
              f,
              this.isForwards ? d : b,
              this.isForwards ? e : c,
              this.isForwards,
            ),
            null === this.targetPort &&
              (this.isForwards
                ? (f.defaultToPoint = a.lastInput.documentPoint)
                : (f.defaultFromPoint = a.lastInput.documentPoint),
              f.Oa()),
            a.allowSelect && (f.isSelected = !0),
            (this.transactionResult = this.name),
            a.R(
              'LinkRelinked',
              f,
              this.isForwards ? this.originalToPort : this.originalFromPort,
            ))
          : this.doNoRelink(this.originalLink, this.isForwards);
        this.originalLink.sq(this.jx);
      }
      this.stopTool();
    };
    Xe.prototype.reconnectLink = function (a, b, c, d) {
      c = null !== c && null !== c.portId ? c.portId : '';
      d
        ? ((a.toNode = b), (a.toPortId = c))
        : ((a.fromNode = b), (a.fromPortId = c));
      return !0;
    };
    Xe.prototype.doNoRelink = function () {};
    function Ff(a, b, c, d, e) {
      null !== b
        ? (a.copyPortProperties(
            b,
            c,
            a.temporaryFromNode,
            a.temporaryFromPort,
            !1,
          ),
          a.diagram.add(a.temporaryFromNode))
        : a.diagram.remove(a.temporaryFromNode);
      null !== d
        ? (a.copyPortProperties(d, e, a.temporaryToNode, a.temporaryToPort, !0),
          a.diagram.add(a.temporaryToNode))
        : a.diagram.remove(a.temporaryToNode);
    }
    ma.Object.defineProperties(Xe.prototype, {
      fromHandleArchetype: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v = a;
        },
      },
      toHandleArchetype: {
        get: function () {
          return this.Ph;
        },
        set: function (a) {
          this.Ph = a;
        },
      },
      handle: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          if (null !== a && !(a.part instanceof Ce))
            throw Error('new handle is not in an Adornment: ' + a);
          this.l = a;
        },
      },
    });
    Xe.className = 'RelinkingTool';
    La(
      'linkingTool',
      function () {
        return this.findTool('Linking');
      },
      function (a) {
        this.Va('Linking', a, this.mouseMoveTools);
      },
    );
    La(
      'relinkingTool',
      function () {
        return this.findTool('Relinking');
      },
      function (a) {
        this.Va('Relinking', a, this.mouseDownTools);
      },
    );
    function pg() {
      xe.call(this);
      this.name = 'LinkReshaping';
      var a = new W();
      a.figure = 'Rectangle';
      a.desiredSize = Mb;
      a.fill = 'lightblue';
      a.stroke = 'dodgerblue';
      this.v = a;
      a = new W();
      a.figure = 'Diamond';
      a.desiredSize = Nb;
      a.fill = 'lightblue';
      a.stroke = 'dodgerblue';
      a.cursor = 'move';
      this.I = a;
      this.Y = 3;
      this.Xt = this.l = null;
      this.El = new H();
      this.os = new E();
    }
    la(pg, xe);
    pg.prototype.Dv = function (a) {
      return a && a.vs && 0 !== a.vs.value ? a.vs : qg;
    };
    pg.prototype.Im = function (a, b) {
      a.vs = b;
    };
    pg.prototype.updateAdornments = function (a) {
      if (null !== a && a instanceof S) {
        var b = null;
        if (a.isSelected && !this.diagram.isReadOnly) {
          var c = a.path;
          null !== c &&
            a.canReshape() &&
            a.actualBounds.u() &&
            a.isVisible() &&
            c.actualBounds.u() &&
            c.yf() &&
            ((b = a.gk(this.name)),
            null === b || b.gx !== a.pointsCount || b.tx !== a.resegmentable) &&
            ((b = this.makeAdornment(c)),
            null !== b &&
              ((b.gx = a.pointsCount),
              (b.tx = a.resegmentable),
              a.Dh(this.name, b)));
        }
        null === b && a.Af(this.name);
      }
    };
    pg.prototype.makeAdornment = function (a) {
      var b = a.part,
        c = b.pointsCount,
        d = b.isOrthogonal,
        e = null;
      if (null !== b.points && 1 < c) {
        e = new Ce();
        e.type = X.Link;
        c = b.firstPickIndex;
        var f = b.lastPickIndex,
          g = d ? 1 : 0;
        if (b.resegmentable && b.computeCurve() !== rg)
          for (var h = c + g; h < f - g; h++) {
            var k = this.makeResegmentHandle(a, h);
            null !== k &&
              ((k.segmentIndex = h),
              (k.segmentFraction = 0.5),
              (k.fromMaxLinks = 999),
              e.add(k));
          }
        for (g = c + 1; g < f; g++)
          if (((h = this.makeHandle(a, g)), null !== h)) {
            h.segmentIndex = g;
            if (g !== c)
              if (g === c + 1 && d) {
                k = b.i(c);
                var l = b.i(c + 1);
                J.w(k.x, l.x) && J.w(k.y, l.y) && (l = b.i(c - 1));
                J.w(k.x, l.x)
                  ? (this.Im(h, sg), (h.cursor = 'n-resize'))
                  : J.w(k.y, l.y) && (this.Im(h, tg), (h.cursor = 'w-resize'));
              } else
                g === f - 1 && d
                  ? ((k = b.i(f - 1)),
                    (l = b.i(f)),
                    J.w(k.x, l.x) && J.w(k.y, l.y) && (k = b.i(f + 1)),
                    J.w(k.x, l.x)
                      ? (this.Im(h, sg), (h.cursor = 'n-resize'))
                      : J.w(k.y, l.y) &&
                        (this.Im(h, tg), (h.cursor = 'w-resize')))
                  : g !== f && (this.Im(h, ug), (h.cursor = 'move'));
            e.add(h);
          }
        e.adornedObject = a;
      }
      return e;
    };
    pg.prototype.makeHandle = function () {
      var a = this.handleArchetype;
      return null === a ? null : a.copy();
    };
    pg.prototype.makeResegmentHandle = function () {
      var a = this.midHandleArchetype;
      return null === a ? null : a.copy();
    };
    pg.prototype.canStart = function () {
      if (!this.isEnabled) return !1;
      var a = this.diagram;
      return !a.isReadOnly && a.allowReshape && a.lastInput.left
        ? null !== this.findToolHandleAt(a.firstInput.documentPoint, this.name)
        : !1;
    };
    pg.prototype.doActivate = function () {
      var a = this.diagram;
      null === this.handle &&
        (this.handle = this.findToolHandleAt(
          a.firstInput.documentPoint,
          this.name,
        ));
      if (null !== this.handle) {
        var b = this.handle.part.adornedPart;
        if (b instanceof S) {
          this.Xt = b;
          a.isMouseCaptured = !0;
          this.ta(this.name);
          if (b.resegmentable && 999 === this.handle.fromMaxLinks) {
            var c = b.points.copy(),
              d = this.getResegmentingPoint();
            c.Lb(this.handle.segmentIndex + 1, d);
            b.isOrthogonal && c.Lb(this.handle.segmentIndex + 1, d);
            b.points = c;
            b.Mb();
            b.updateAdornments();
            this.handle = this.findToolHandleAt(
              a.firstInput.documentPoint,
              this.name,
            );
            if (null === this.handle) {
              this.doDeactivate();
              return;
            }
          }
          this.El = b.i(this.handle.segmentIndex);
          this.os = b.points.copy();
          this.isActive = !0;
        }
      }
    };
    pg.prototype.doDeactivate = function () {
      this.Hg();
      this.Xt = this.handle = null;
      this.isActive = this.diagram.isMouseCaptured = !1;
    };
    pg.prototype.doCancel = function () {
      var a = this.adornedLink;
      null !== a && (a.points = this.os);
      this.stopTool();
    };
    pg.prototype.getResegmentingPoint = function () {
      return this.handle.ga(Ac);
    };
    pg.prototype.doMouseMove = function () {
      var a = this.diagram;
      this.isActive &&
        ((a = this.computeReshape(a.lastInput.documentPoint)), this.reshape(a));
    };
    pg.prototype.doMouseUp = function () {
      var a = this.diagram;
      if (this.isActive) {
        var b = this.computeReshape(a.lastInput.documentPoint);
        this.reshape(b);
        b = this.adornedLink;
        if (null !== b && b.resegmentable) {
          var c = this.handle.segmentIndex,
            d = b.i(c - 1),
            e = b.i(c),
            f = b.i(c + 1);
          if (b.isOrthogonal) {
            if (c > b.firstPickIndex + 1 && c < b.lastPickIndex - 1) {
              var g = b.i(c - 2);
              if (
                Math.abs(d.x - e.x) < this.resegmentingDistance &&
                Math.abs(d.y - e.y) < this.resegmentingDistance &&
                (vg(this, g, d, e, f, !0) || vg(this, g, d, e, f, !1))
              ) {
                var h = b.points.copy();
                vg(this, g, d, e, f, !0)
                  ? (h.fd(c - 2, new H(g.x, (f.y + g.y) / 2)),
                    h.fd(c + 1, new H(f.x, (f.y + g.y) / 2)))
                  : (h.fd(c - 2, new H((f.x + g.x) / 2, g.y)),
                    h.fd(c + 1, new H((f.x + g.x) / 2, f.y)));
                h.mb(c);
                h.mb(c - 1);
                b.points = h;
                b.Mb();
              } else
                (g = b.i(c + 2)),
                  Math.abs(e.x - f.x) < this.resegmentingDistance &&
                    Math.abs(e.y - f.y) < this.resegmentingDistance &&
                    (vg(this, d, e, f, g, !0) || vg(this, d, e, f, g, !1)) &&
                    ((h = b.points.copy()),
                    vg(this, d, e, f, g, !0)
                      ? (h.fd(c - 1, new H(d.x, (d.y + g.y) / 2)),
                        h.fd(c + 2, new H(g.x, (d.y + g.y) / 2)))
                      : (h.fd(c - 1, new H((d.x + g.x) / 2, d.y)),
                        h.fd(c + 2, new H((d.x + g.x) / 2, g.y))),
                    h.mb(c + 1),
                    h.mb(c),
                    (b.points = h),
                    b.Mb());
            }
          } else
            (g = H.alloc()),
              J.Mh(d.x, d.y, f.x, f.y, e.x, e.y, g) &&
                g.Ae(e) < this.resegmentingDistance * this.resegmentingDistance &&
                ((d = b.points.copy()), d.mb(c), (b.points = d), b.Mb()),
              H.free(g);
        }
        a.Na();
        this.transactionResult = this.name;
        a.R('LinkReshaped', this.adornedLink, this.os);
      }
      this.stopTool();
    };
    function vg(a, b, c, d, e, f) {
      return f
        ? Math.abs(b.y - c.y) < a.resegmentingDistance &&
            Math.abs(c.y - d.y) < a.resegmentingDistance &&
            Math.abs(d.y - e.y) < a.resegmentingDistance
        : Math.abs(b.x - c.x) < a.resegmentingDistance &&
            Math.abs(c.x - d.x) < a.resegmentingDistance &&
            Math.abs(d.x - e.x) < a.resegmentingDistance;
    }
    pg.prototype.reshape = function (a) {
      var b = this.adornedLink;
      b.Oh();
      var c = this.handle.segmentIndex,
        d = this.Dv(this.handle);
      if (b.isOrthogonal)
        if (c === b.firstPickIndex + 1)
          (c = b.firstPickIndex + 1),
            d === sg
              ? (b.K(c, b.i(c - 1).x, a.y), b.K(c + 1, b.i(c + 2).x, a.y))
              : d === tg &&
                (b.K(c, a.x, b.i(c - 1).y), b.K(c + 1, a.x, b.i(c + 2).y));
        else if (c === b.lastPickIndex - 1)
          (c = b.lastPickIndex - 1),
            d === sg
              ? (b.K(c - 1, b.i(c - 2).x, a.y), b.K(c, b.i(c + 1).x, a.y))
              : d === tg &&
                (b.K(c - 1, a.x, b.i(c - 2).y), b.K(c, a.x, b.i(c + 1).y));
        else {
          d = c;
          var e = b.i(d),
            f = b.i(d - 1),
            g = b.i(d + 1);
          J.w(f.x, e.x) && J.w(e.y, g.y)
            ? (J.w(f.x, b.i(d - 2).x) && !J.w(f.y, b.i(d - 2).y)
                ? (b.m(d, a.x, f.y), c++, d++)
                : b.K(d - 1, a.x, f.y),
              J.w(g.y, b.i(d + 2).y) && !J.w(g.x, b.i(d + 2).x)
                ? b.m(d + 1, g.x, a.y)
                : b.K(d + 1, g.x, a.y))
            : J.w(f.y, e.y) && J.w(e.x, g.x)
            ? (J.w(f.y, b.i(d - 2).y) && !J.w(f.x, b.i(d - 2).x)
                ? (b.m(d, f.x, a.y), c++, d++)
                : b.K(d - 1, f.x, a.y),
              J.w(g.x, b.i(d + 2).x) && !J.w(g.y, b.i(d + 2).y)
                ? b.m(d + 1, a.x, g.y)
                : b.K(d + 1, a.x, g.y))
            : J.w(f.x, e.x) && J.w(e.x, g.x)
            ? (J.w(f.x, b.i(d - 2).x) && !J.w(f.y, b.i(d - 2).y)
                ? (b.m(d, a.x, f.y), c++, d++)
                : b.K(d - 1, a.x, f.y),
              J.w(g.x, b.i(d + 2).x) && !J.w(g.y, b.i(d + 2).y)
                ? b.m(d + 1, a.x, g.y)
                : b.K(d + 1, a.x, g.y))
            : J.w(f.y, e.y) &&
              J.w(e.y, g.y) &&
              (J.w(f.y, b.i(d - 2).y) && !J.w(f.x, b.i(d - 2).x)
                ? (b.m(d, f.x, a.y), c++, d++)
                : b.K(d - 1, f.x, a.y),
              J.w(g.y, b.i(d + 2).y) && !J.w(g.x, b.i(d + 2).x)
                ? b.m(d + 1, g.x, a.y)
                : b.K(d + 1, g.x, a.y));
          b.K(c, a.x, a.y);
        }
      else
        b.K(c, a.x, a.y),
          (d = b.fromNode),
          (e = b.fromPort),
          null !== d &&
            ((f = d.findVisibleNode()),
            null !== f && f !== d && ((d = f), (e = d.port))),
          1 === c &&
            b.computeSpot(!0, e).kc() &&
            ((f = e.ga(Ac, H.alloc())),
            (d = b.getLinkPointFromPoint(d, e, f, a, !0, H.alloc())),
            b.K(0, d.x, d.y),
            H.free(f),
            H.free(d)),
          (d = b.toNode),
          (e = b.toPort),
          null !== d &&
            ((f = d.findVisibleNode()),
            null !== f && f !== d && ((d = f), (e = d.port))),
          c === b.pointsCount - 2 &&
            b.computeSpot(!1, e).kc() &&
            ((c = e.ga(Ac, H.alloc())),
            (a = b.getLinkPointFromPoint(d, e, c, a, !1, H.alloc())),
            b.K(b.pointsCount - 1, a.x, a.y),
            H.free(c),
            H.free(a));
      b.pf();
    };
    pg.prototype.computeReshape = function (a) {
      var b = this.adornedLink,
        c = this.handle.segmentIndex;
      switch (this.Dv(this.handle)) {
        case ug:
          return a;
        case sg:
          return new H(b.i(c).x, a.y);
        case tg:
          return new H(a.x, b.i(c).y);
        default:
        case qg:
          return b.i(c);
      }
    };
    ma.Object.defineProperties(pg.prototype, {
      handleArchetype: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v = a;
        },
      },
      midHandleArchetype: {
        get: function () {
          return this.I;
        },
        set: function (a) {
          this.I = a;
        },
      },
      handle: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          if (null !== a && !(a.part instanceof Ce))
            throw Error('new handle is not in an Adornment: ' + a);
          this.l = a;
        },
      },
      adornedLink: {
        get: function () {
          return this.Xt;
        },
      },
      resegmentingDistance: {
        get: function () {
          return this.Y;
        },
        set: function (a) {
          this.Y = a;
        },
      },
      originalPoint: {
        get: function () {
          return this.El;
        },
      },
      originalPoints: {
        get: function () {
          return this.os;
        },
      },
    });
    pg.prototype.setReshapingBehavior = pg.prototype.Im;
    pg.prototype.getReshapingBehavior = pg.prototype.Dv;
    var qg = new D(pg, 'None', 0),
      tg = new D(pg, 'Horizontal', 1),
      sg = new D(pg, 'Vertical', 2),
      ug = new D(pg, 'All', 3);
    pg.className = 'LinkReshapingTool';
    pg.None = qg;
    pg.Horizontal = tg;
    pg.Vertical = sg;
    pg.All = ug;
    La(
      'linkReshapingTool',
      function () {
        return this.findTool('LinkReshaping');
      },
      function (a) {
        this.Va('LinkReshaping', a, this.mouseDownTools);
      },
    );
    function wg() {
      xe.call(this);
      this.name = 'Resizing';
      this.dg = new L(1, 1).freeze();
      this.cg = new L(9999, 9999).freeze();
      this.Ng = new L(NaN, NaN).freeze();
      this.I = !1;
      this.ce = null;
      var a = new W();
      a.alignmentFocus = Ac;
      a.figure = 'Rectangle';
      a.desiredSize = Mb;
      a.fill = 'lightblue';
      a.stroke = 'dodgerblue';
      a.strokeWidth = 1;
      a.cursor = 'pointer';
      this.v = a;
      this.l = null;
      this.El = new H();
      this.ix = new L();
      this.Wo = new H();
      this.nu = new L(0, 0);
      this.mu = new L(Infinity, Infinity);
      this.lu = new L(1, 1);
      this.ex = !0;
    }
    la(wg, xe);
    wg.prototype.updateAdornments = function (a) {
      if (!(null === a || a instanceof S)) {
        if (a.isSelected && !this.diagram.isReadOnly) {
          var b = a.resizeObject,
            c = a.gk(this.name);
          if (
            null !== b &&
            a.canResize() &&
            a.actualBounds.u() &&
            a.isVisible() &&
            b.actualBounds.u() &&
            b.yf()
          ) {
            if (null === c || c.adornedObject !== b) c = this.makeAdornment(b);
            if (null !== c) {
              b = b.Wi();
              xg(a) && this.updateResizeHandles(c, b);
              a.Dh(this.name, c);
              return;
            }
          }
        }
        a.Af(this.name);
      }
    };
    wg.prototype.makeAdornment = function (a) {
      var b = a.part.resizeAdornmentTemplate;
      if (null === b) {
        b = new Ce();
        b.type = X.Spot;
        b.locationSpot = Ac;
        var c = new yg();
        c.isPanelMain = !0;
        b.add(c);
        b.add(this.makeHandle(a, vc));
        b.add(this.makeHandle(a, yc));
        b.add(this.makeHandle(a, Gc));
        b.add(this.makeHandle(a, Ec));
        b.add(this.makeHandle(a, dd));
        b.add(this.makeHandle(a, fd));
        b.add(this.makeHandle(a, gd));
        b.add(this.makeHandle(a, ed));
      } else if ((zg(b), (b = b.copy()), null === b)) return null;
      b.adornedObject = a;
      return b;
    };
    wg.prototype.makeHandle = function (a, b) {
      a = this.handleArchetype;
      if (null === a) return null;
      a = a.copy();
      a.alignment = b;
      return a;
    };
    wg.prototype.updateResizeHandles = function (a, b) {
      if (null !== a)
        if (
          !a.alignment.Nb() &&
          ('pointer' === a.cursor || 0 < a.cursor.indexOf('resize'))
        )
          a: {
            var c = a.alignment;
            c.kc() && (c = Ac);
            if (0 >= c.x) b = 0 >= c.y ? b + 225 : 1 <= c.y ? b + 135 : b + 180;
            else if (1 <= c.x) 0 >= c.y ? (b += 315) : 1 <= c.y && (b += 45);
            else if (0 >= c.y) b += 270;
            else if (1 <= c.y) b += 90;
            else break a;
            0 > b ? (b += 360) : 360 <= b && (b -= 360);
            a.cursor =
              22.5 > b
                ? 'e-resize'
                : 67.5 > b
                ? 'se-resize'
                : 112.5 > b
                ? 's-resize'
                : 157.5 > b
                ? 'sw-resize'
                : 202.5 > b
                ? 'w-resize'
                : 247.5 > b
                ? 'nw-resize'
                : 292.5 > b
                ? 'n-resize'
                : 337.5 > b
                ? 'ne-resize'
                : 'e-resize';
          }
        else if (a instanceof X)
          for (a = a.elements; a.next(); ) this.updateResizeHandles(a.value, b);
    };
    wg.prototype.canStart = function () {
      if (!this.isEnabled) return !1;
      var a = this.diagram;
      return !a.isReadOnly && a.allowResize && a.lastInput.left
        ? null !== this.findToolHandleAt(a.firstInput.documentPoint, this.name)
        : !1;
    };
    wg.prototype.doActivate = function () {
      var a = this.diagram;
      null === this.handle &&
        (this.handle = this.findToolHandleAt(
          a.firstInput.documentPoint,
          this.name,
        ));
      null !== this.handle &&
        ((this.adornedObject = this.handle.part.adornedObject),
        null !== this.adornedObject &&
          (this.El.set(this.adornedObject.ga(this.handle.alignment.Sv())),
          this.Wo.set(this.adornedObject.part.location),
          this.ix.set(this.adornedObject.desiredSize),
          (this.lu = this.computeCellSize()),
          (this.nu = this.computeMinSize()),
          (this.mu = this.computeMaxSize()),
          (a.isMouseCaptured = !0),
          (this.ex = a.animationManager.isEnabled),
          (a.animationManager.isEnabled = !1),
          this.ta(this.name),
          (this.isActive = !0)));
    };
    wg.prototype.doDeactivate = function () {
      var a = this.diagram;
      this.Hg();
      this.ce = this.handle = null;
      this.isActive = a.isMouseCaptured = !1;
      a.animationManager.isEnabled = this.ex;
    };
    wg.prototype.doCancel = function () {
      null !== this.adornedObject &&
        ((this.adornedObject.desiredSize = this.originalDesiredSize),
        (this.adornedObject.part.location = this.originalLocation));
      this.stopTool();
    };
    wg.prototype.doMouseMove = function () {
      var a = this.diagram;
      if (this.isActive) {
        var b = this.nu,
          c = this.mu,
          d = this.lu,
          e = this.adornedObject.nt(a.lastInput.documentPoint, H.alloc()),
          f = this.computeReshape();
        b = this.computeResize(e, this.handle.alignment, b, c, d, f);
        this.resize(b);
        a.ud();
        H.free(e);
      }
    };
    wg.prototype.doMouseUp = function () {
      var a = this.diagram;
      if (this.isActive) {
        var b = this.nu,
          c = this.mu,
          d = this.lu,
          e = this.adornedObject.nt(a.lastInput.documentPoint, H.alloc()),
          f = this.computeReshape();
        b = this.computeResize(e, this.handle.alignment, b, c, d, f);
        this.resize(b);
        H.free(e);
        a.Na();
        this.transactionResult = this.name;
        a.R('PartResized', this.adornedObject, this.originalDesiredSize);
      }
      this.stopTool();
    };
    wg.prototype.resize = function (a) {
      var b = this.diagram,
        c = this.adornedObject,
        d = c.part;
      c.desiredSize = a.size;
      d.zb();
      a = this.adornedObject.ga(this.handle.alignment.Sv());
      d instanceof xf
        ? ((c = new E()), c.add(d), b.moveParts(c, this.El.copy().$d(a), !0))
        : (d.location = d.location.copy().$d(a).add(this.El));
    };
    wg.prototype.computeResize = function (a, b, c, d, e, f) {
      b.kc() && (b = Ac);
      var g = this.adornedObject.naturalBounds,
        h = g.x,
        k = g.y,
        l = g.x + g.width,
        m = g.y + g.height,
        n = 1;
      if (!f) {
        n = g.width;
        var p = g.height;
        0 >= n && (n = 1);
        0 >= p && (p = 1);
        n = p / n;
      }
      p = H.alloc();
      J.lq(a.x, a.y, h, k, e.width, e.height, p);
      a = g.copy();
      0 >= b.x
        ? 0 >= b.y
          ? ((a.x = Math.max(p.x, l - d.width)),
            (a.x = Math.min(a.x, l - c.width)),
            (a.width = Math.max(l - a.x, c.width)),
            (a.y = Math.max(p.y, m - d.height)),
            (a.y = Math.min(a.y, m - c.height)),
            (a.height = Math.max(m - a.y, c.height)),
            f ||
              (1 <= a.height / a.width
                ? ((a.height = Math.max(
                    Math.min(n * a.width, d.height),
                    c.height,
                  )),
                  (a.width = a.height / n))
                : ((a.width = Math.max(Math.min(a.height / n, d.width), c.width)),
                  (a.height = n * a.width)),
              (a.x = l - a.width),
              (a.y = m - a.height)))
          : 1 <= b.y
          ? ((a.x = Math.max(p.x, l - d.width)),
            (a.x = Math.min(a.x, l - c.width)),
            (a.width = Math.max(l - a.x, c.width)),
            (a.height = Math.max(Math.min(p.y - k, d.height), c.height)),
            f ||
              (1 <= a.height / a.width
                ? ((a.height = Math.max(
                    Math.min(n * a.width, d.height),
                    c.height,
                  )),
                  (a.width = a.height / n))
                : ((a.width = Math.max(Math.min(a.height / n, d.width), c.width)),
                  (a.height = n * a.width)),
              (a.x = l - a.width)))
          : ((a.x = Math.max(p.x, l - d.width)),
            (a.x = Math.min(a.x, l - c.width)),
            (a.width = l - a.x),
            f ||
              ((a.height = Math.max(Math.min(n * a.width, d.height), c.height)),
              (a.width = a.height / n),
              (a.y = k + 0.5 * (m - k - a.height))))
        : 1 <= b.x
        ? 0 >= b.y
          ? ((a.width = Math.max(Math.min(p.x - h, d.width), c.width)),
            (a.y = Math.max(p.y, m - d.height)),
            (a.y = Math.min(a.y, m - c.height)),
            (a.height = Math.max(m - a.y, c.height)),
            f ||
              (1 <= a.height / a.width
                ? ((a.height = Math.max(
                    Math.min(n * a.width, d.height),
                    c.height,
                  )),
                  (a.width = a.height / n))
                : ((a.width = Math.max(Math.min(a.height / n, d.width), c.width)),
                  (a.height = n * a.width)),
              (a.y = m - a.height)))
          : 1 <= b.y
          ? ((a.width = Math.max(Math.min(p.x - h, d.width), c.width)),
            (a.height = Math.max(Math.min(p.y - k, d.height), c.height)),
            f ||
              (1 <= a.height / a.width
                ? ((a.height = Math.max(
                    Math.min(n * a.width, d.height),
                    c.height,
                  )),
                  (a.width = a.height / n))
                : ((a.width = Math.max(Math.min(a.height / n, d.width), c.width)),
                  (a.height = n * a.width))))
          : ((a.width = Math.max(Math.min(p.x - h, d.width), c.width)),
            f ||
              ((a.height = Math.max(Math.min(n * a.width, d.height), c.height)),
              (a.width = a.height / n),
              (a.y = k + 0.5 * (m - k - a.height))))
        : 0 >= b.y
        ? ((a.y = Math.max(p.y, m - d.height)),
          (a.y = Math.min(a.y, m - c.height)),
          (a.height = m - a.y),
          f ||
            ((a.width = Math.max(Math.min(a.height / n, d.width), c.width)),
            (a.height = n * a.width),
            (a.x = h + 0.5 * (l - h - a.width))))
        : 1 <= b.y &&
          ((a.height = Math.max(Math.min(p.y - k, d.height), c.height)),
          f ||
            ((a.width = Math.max(Math.min(a.height / n, d.width), c.width)),
            (a.height = n * a.width),
            (a.x = h + 0.5 * (l - h - a.width))));
      H.free(p);
      return a;
    };
    wg.prototype.computeReshape = function () {
      var a = Ag;
      this.adornedObject instanceof W && (a = Bg(this.adornedObject));
      return !(a === Cg || this.diagram.lastInput.shift);
    };
    wg.prototype.computeMinSize = function () {
      var a = this.adornedObject.minSize.copy(),
        b = this.minSize;
      !isNaN(b.width) && b.width > a.width && (a.width = b.width);
      !isNaN(b.height) && b.height > a.height && (a.height = b.height);
      return a;
    };
    wg.prototype.computeMaxSize = function () {
      var a = this.adornedObject.maxSize.copy(),
        b = this.maxSize;
      !isNaN(b.width) && b.width < a.width && (a.width = b.width);
      !isNaN(b.height) && b.height < a.height && (a.height = b.height);
      return a;
    };
    wg.prototype.computeCellSize = function () {
      var a = new L(NaN, NaN),
        b = this.adornedObject.part;
      null !== b &&
        ((b = b.resizeCellSize),
        !isNaN(b.width) && 0 < b.width && (a.width = b.width),
        !isNaN(b.height) && 0 < b.height && (a.height = b.height));
      b = this.cellSize;
      isNaN(a.width) && !isNaN(b.width) && 0 < b.width && (a.width = b.width);
      isNaN(a.height) &&
        !isNaN(b.height) &&
        0 < b.height &&
        (a.height = b.height);
      b = this.diagram;
      (isNaN(a.width) || isNaN(a.height)) &&
        b &&
        ((b = b.grid),
        null !== b &&
          b.visible &&
          this.isGridSnapEnabled &&
          ((b = b.gridCellSize),
          isNaN(a.width) && !isNaN(b.width) && 0 < b.width && (a.width = b.width),
          isNaN(a.height) &&
            !isNaN(b.height) &&
            0 < b.height &&
            (a.height = b.height)));
      if (isNaN(a.width) || 0 === a.width || Infinity === a.width) a.width = 1;
      if (isNaN(a.height) || 0 === a.height || Infinity === a.height)
        a.height = 1;
      return a;
    };
    ma.Object.defineProperties(wg.prototype, {
      handleArchetype: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v = a;
        },
      },
      handle: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          if (null !== a && !(a.part instanceof Ce))
            throw Error('new handle is not in an Adornment: ' + a);
          this.l = a;
        },
      },
      adornedObject: {
        get: function () {
          return this.ce;
        },
        set: function (a) {
          if (null !== a && a.part instanceof Ce)
            throw Error('new handle must not be in an Adornment: ' + a);
          this.ce = a;
        },
      },
      minSize: {
        get: function () {
          return this.dg;
        },
        set: function (a) {
          if (!this.dg.A(a)) {
            var b = a.width;
            isNaN(b) && (b = 0);
            a = a.height;
            isNaN(a) && (a = 0);
            this.dg.h(b, a);
          }
        },
      },
      maxSize: {
        get: function () {
          return this.cg;
        },
        set: function (a) {
          if (!this.cg.A(a)) {
            var b = a.width;
            isNaN(b) && (b = Infinity);
            a = a.height;
            isNaN(a) && (a = Infinity);
            this.cg.h(b, a);
          }
        },
      },
      cellSize: {
        get: function () {
          return this.Ng;
        },
        set: function (a) {
          this.Ng.A(a) || this.Ng.assign(a);
        },
      },
      isGridSnapEnabled: {
        get: function () {
          return this.I;
        },
        set: function (a) {
          this.I = a;
        },
      },
      originalDesiredSize: {
        get: function () {
          return this.ix;
        },
      },
      originalLocation: {
        get: function () {
          return this.Wo;
        },
      },
    });
    wg.className = 'ResizingTool';
    La(
      'resizingTool',
      function () {
        return this.findTool('Resizing');
      },
      function (a) {
        this.Va('Resizing', a, this.mouseDownTools);
      },
    );
    function Dg() {
      xe.call(this);
      this.name = 'Rotating';
      this.La = 45;
      this.Ja = 2;
      this.Wo = new H();
      this.ce = null;
      var a = new W();
      a.figure = 'Ellipse';
      a.desiredSize = Nb;
      a.fill = 'lightblue';
      a.stroke = 'dodgerblue';
      a.strokeWidth = 1;
      a.cursor = 'pointer';
      this.v = a;
      this.l = null;
      this.hx = 0;
      this.Lu = new H(NaN, NaN);
      this.I = 0;
      this.Y = 50;
    }
    la(Dg, xe);
    Dg.prototype.updateAdornments = function (a) {
      if (null !== a) {
        if (a.Lh()) {
          var b = a.rotateObject;
          if (b === a || b === a.path || b.isPanelMain) return;
        }
        if (
          a.isSelected &&
          !this.diagram.isReadOnly &&
          ((b = a.rotateObject),
          null !== b &&
            a.canRotate() &&
            a.actualBounds.u() &&
            a.isVisible() &&
            b.actualBounds.u() &&
            b.yf())
        ) {
          var c = a.gk(this.name);
          if (null === c || c.adornedObject !== b) c = this.makeAdornment(b);
          if (null !== c) {
            c.angle = b.Wi();
            null === c.placeholder &&
              (c.location = this.computeAdornmentLocation(b));
            a.Dh(this.name, c);
            return;
          }
        }
        a.Af(this.name);
      }
    };
    Dg.prototype.makeAdornment = function (a) {
      var b = a.part.rotateAdornmentTemplate;
      if (null === b) {
        b = new Ce();
        b.type = X.Position;
        b.locationSpot = Ac;
        var c = this.handleArchetype;
        null !== c && b.add(c.copy());
      } else if ((zg(b), (b = b.copy()), null === b)) return null;
      b.adornedObject = a;
      return b;
    };
    Dg.prototype.canStart = function () {
      if (!this.isEnabled) return !1;
      var a = this.diagram;
      return !a.isReadOnly && a.allowRotate && a.lastInput.left
        ? null !== this.findToolHandleAt(a.firstInput.documentPoint, this.name)
        : !1;
    };
    Dg.prototype.doActivate = function () {
      var a = this.diagram;
      if (null === this.adornedObject) {
        null === this.handle &&
          (this.handle = this.findToolHandleAt(
            a.firstInput.documentPoint,
            this.name,
          ));
        if (null === this.handle) return;
        this.adornedObject = this.handle.part.adornedObject;
      }
      null !== this.adornedObject &&
        ((this.hx = this.adornedObject.angle),
        (this.Lu = this.computeRotationPoint(this.adornedObject)),
        (this.Wo = this.adornedObject.part.location.copy()),
        (a.isMouseCaptured = !0),
        (a.delaysLayout = !0),
        this.ta(this.name),
        (this.isActive = !0));
    };
    Dg.prototype.computeRotationPoint = function (a) {
      var b = a.part,
        c = b.locationObject;
      return b.rotationSpot.cb()
        ? a.ga(b.rotationSpot)
        : a === b || a === c
        ? c.ga(b.locationSpot)
        : a.ga(Ac);
    };
    Dg.prototype.computeAdornmentLocation = function (a) {
      var b = this.rotationPoint;
      b.u() || (b = this.computeRotationPoint(a));
      b = a.nt(b);
      var c = this.handleAngle;
      0 > c ? (c += 360) : 360 <= c && (c -= 360);
      c = Math.round(45 * Math.round(c / 45));
      var d = this.handleDistance;
      0 === c
        ? (b.x = a.naturalBounds.width + d)
        : 45 === c
        ? ((b.x = a.naturalBounds.width + d), (b.y = a.naturalBounds.height + d))
        : 90 === c
        ? (b.y = a.naturalBounds.height + d)
        : 135 === c
        ? ((b.x = -d), (b.y = a.naturalBounds.height + d))
        : 180 === c
        ? (b.x = -d)
        : 225 === c
        ? ((b.x = -d), (b.y = -d))
        : 270 === c
        ? (b.y = -d)
        : 315 === c && ((b.x = a.naturalBounds.width + d), (b.y = -d));
      return a.ga(b);
    };
    Dg.prototype.doDeactivate = function () {
      var a = this.diagram;
      this.Hg();
      this.ce = this.handle = null;
      this.Lu = new H(NaN, NaN);
      this.isActive = a.isMouseCaptured = !1;
    };
    Dg.prototype.doCancel = function () {
      this.diagram.delaysLayout = !1;
      this.rotate(this.originalAngle);
      this.stopTool();
    };
    Dg.prototype.doMouseMove = function () {
      var a = this.diagram;
      this.isActive &&
        ((a = this.computeRotate(a.lastInput.documentPoint)), this.rotate(a));
    };
    Dg.prototype.doMouseUp = function () {
      var a = this.diagram;
      if (this.isActive) {
        a.delaysLayout = !1;
        var b = this.computeRotate(a.lastInput.documentPoint);
        this.rotate(b);
        a.Na();
        this.transactionResult = this.name;
        a.R('PartRotated', this.adornedObject, this.originalAngle);
      }
      this.stopTool();
    };
    Dg.prototype.rotate = function (a) {
      var b = this.adornedObject;
      if (null !== b) {
        b.angle = a;
        b = b.part;
        b.zb();
        var c = b.locationObject,
          d = b.rotateObject;
        if (c === d || c.Dg(d))
          (c = this.Wo.copy()),
            (b.location = c
              .$d(this.rotationPoint)
              .rotate(a - this.originalAngle)
              .add(this.rotationPoint));
      }
    };
    Dg.prototype.computeRotate = function (a) {
      a = this.rotationPoint.Ta(a) - this.handleAngle;
      var b = this.adornedObject.panel;
      null !== b && (a -= b.Wi());
      360 <= a ? (a -= 360) : 0 > a && (a += 360);
      b = Math.min(Math.abs(this.snapAngleMultiple), 180);
      var c = Math.min(Math.abs(this.snapAngleEpsilon), b / 2);
      !this.diagram.lastInput.shift &&
        0 < b &&
        0 < c &&
        (a % b < c
          ? (a = Math.floor(a / b) * b)
          : a % b > b - c && (a = (Math.floor(a / b) + 1) * b));
      360 <= a ? (a -= 360) : 0 > a && (a += 360);
      return a;
    };
    ma.Object.defineProperties(Dg.prototype, {
      handleArchetype: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v = a;
        },
      },
      handle: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          if (null !== a && !(a.part instanceof Ce))
            throw Error('new handle is not in an Adornment: ' + a);
          this.l = a;
        },
      },
      adornedObject: {
        get: function () {
          return this.ce;
        },
        set: function (a) {
          if (null !== a && a.part instanceof Ce)
            throw Error('new handle must not be in an Adornment: ' + a);
          this.ce = a;
        },
      },
      snapAngleMultiple: {
        get: function () {
          return this.La;
        },
        set: function (a) {
          this.La = a;
        },
      },
      snapAngleEpsilon: {
        get: function () {
          return this.Ja;
        },
        set: function (a) {
          this.Ja = a;
        },
      },
      originalAngle: {
        get: function () {
          return this.hx;
        },
      },
      rotationPoint: {
        get: function () {
          return this.Lu;
        },
      },
      handleAngle: {
        get: function () {
          return this.I;
        },
        set: function (a) {
          this.I = a;
        },
      },
      handleDistance: {
        get: function () {
          return this.Y;
        },
        set: function (a) {
          this.Y = a;
        },
      },
    });
    Dg.className = 'RotatingTool';
    La(
      'rotatingTool',
      function () {
        return this.findTool('Rotating');
      },
      function (a) {
        this.Va('Rotating', a, this.mouseDownTools);
      },
    );
    function Eg() {
      xe.call(this);
      this.name = 'ClickSelecting';
    }
    la(Eg, xe);
    Eg.prototype.canStart = function () {
      return !this.isEnabled || this.isBeyondDragSize() ? !1 : !0;
    };
    Eg.prototype.doMouseUp = function () {
      this.isActive &&
        (this.standardMouseSelect(),
        !this.standardMouseClick() &&
          this.diagram.lastInput.isTouchEvent &&
          this.diagram.toolManager.doToolTip());
      this.stopTool();
    };
    Eg.className = 'ClickSelectingTool';
    function Fg() {
      xe.call(this);
      this.name = 'Action';
      this.Ck = null;
    }
    la(Fg, xe);
    Fg.prototype.canStart = function () {
      if (!this.isEnabled) return !1;
      var a = this.diagram,
        b = a.lastInput,
        c = a.Tb(b.documentPoint, function (a) {
          for (; null !== a.panel && !a.isActionable; ) a = a.panel;
          return a;
        });
      if (null !== c) {
        if (!c.isActionable) return !1;
        this.Ck = c;
        a.mj = a.Tb(b.documentPoint, null, null);
        return !0;
      }
      return !1;
    };
    Fg.prototype.doMouseDown = function () {
      if (this.isActive) {
        var a = this.diagram.lastInput,
          b = this.Ck;
        null !== b &&
          ((a.targetObject = b), null !== b.actionDown && b.actionDown(a, b));
      } else this.canStart() && this.doActivate();
    };
    Fg.prototype.doMouseMove = function () {
      if (this.isActive) {
        var a = this.diagram.lastInput,
          b = this.Ck;
        null !== b &&
          ((a.targetObject = b), null !== b.actionMove && b.actionMove(a, b));
      }
    };
    Fg.prototype.doMouseUp = function () {
      if (this.isActive) {
        var a = this.diagram.lastInput,
          b = this.Ck;
        if (null === b) return;
        a.targetObject = b;
        null !== b.actionUp && b.actionUp(a, b);
        this.standardMouseClick(
          function (a) {
            for (; null !== a.panel && (!a.isActionable || a !== b); )
              a = a.panel;
            return a;
          },
          function (a) {
            return a === b;
          },
        );
      }
      this.stopTool();
    };
    Fg.prototype.doCancel = function () {
      var a = this.diagram.lastInput,
        b = this.Ck;
      null !== b &&
        ((a.targetObject = b),
        null !== b.actionCancel && b.actionCancel(a, b),
        this.stopTool());
    };
    Fg.prototype.doStop = function () {
      this.Ck = null;
    };
    Fg.className = 'ActionTool';
    function Gg() {
      xe.call(this);
      this.name = 'ClickCreating';
      this.ij = null;
      this.v = !0;
      this.l = !1;
      this.Xw = new H(0, 0);
    }
    la(Gg, xe);
    Gg.prototype.canStart = function () {
      if (!this.isEnabled || null === this.archetypeNodeData) return !1;
      var a = this.diagram;
      if (
        a.isReadOnly ||
        a.isModelReadOnly ||
        !a.allowInsert ||
        !a.lastInput.left ||
        this.isBeyondDragSize()
      )
        return !1;
      if (this.isDoubleClick) {
        if (
          (1 === a.lastInput.clickCount &&
            (this.Xw = a.lastInput.viewPoint.copy()),
          2 !== a.lastInput.clickCount || this.isBeyondDragSize(this.Xw))
        )
          return !1;
      } else if (1 !== a.lastInput.clickCount) return !1;
      return a.currentTool !== this &&
        null !== a.km(a.lastInput.documentPoint, !0)
        ? !1
        : !0;
    };
    Gg.prototype.doMouseUp = function () {
      var a = this.diagram;
      this.isActive && this.insertPart(a.lastInput.documentPoint);
      this.stopTool();
    };
    Gg.prototype.insertPart = function (a) {
      var b = this.diagram,
        c = this.archetypeNodeData;
      if (null === c) return null;
      var d = null;
      try {
        b.R('ChangingSelection', b.selection);
        this.ta(this.name);
        if (c instanceof T)
          c.Vb() && (zg(c), (d = c.copy()), null !== d && b.add(d));
        else if (null !== c) {
          var e = b.model.copyNodeData(c);
          za(e) && (b.model.mf(e), (d = b.vc(e)));
        }
        if (null !== d) {
          var f = H.allocAt(a.x, a.y);
          this.isGridSnapEnabled && Hg(this.diagram, d, a, f);
          d.location = f;
          b.allowSelect && (Re(b), (d.isSelected = !0));
          H.free(f);
        }
        b.Na();
        this.transactionResult = this.name;
        b.R('PartCreated', d);
      } finally {
        this.Hg(), b.R('ChangedSelection', b.selection);
      }
      return d;
    };
    ma.Object.defineProperties(Gg.prototype, {
      archetypeNodeData: {
        get: function () {
          return this.ij;
        },
        set: function (a) {
          this.ij = a;
        },
      },
      isDoubleClick: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v = a;
        },
      },
      isGridSnapEnabled: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.l = a;
        },
      },
    });
    Gg.className = 'ClickCreatingTool';
    function Ig() {
      xe.call(this);
      this.name = 'DragSelecting';
      this.Wk = 175;
      this.v = !1;
      var a = new T();
      a.layerName = 'Tool';
      a.selectable = !1;
      var b = new W();
      b.name = 'SHAPE';
      b.figure = 'Rectangle';
      b.fill = null;
      b.stroke = 'magenta';
      a.add(b);
      this.l = a;
    }
    la(Ig, xe);
    Ig.prototype.canStart = function () {
      if (!this.isEnabled) return !1;
      var a = this.diagram;
      if (!a.allowSelect) return !1;
      var b = a.lastInput;
      return !b.left ||
        (a.currentTool !== this &&
          (!this.isBeyondDragSize() ||
            b.timestamp - a.firstInput.timestamp < this.delay ||
            null !== a.km(b.documentPoint, !0)))
        ? !1
        : !0;
    };
    Ig.prototype.doActivate = function () {
      var a = this.diagram;
      this.isActive = !0;
      a.isMouseCaptured = !0;
      a.skipsUndoManager = !0;
      a.add(this.box);
      this.doMouseMove();
    };
    Ig.prototype.doDeactivate = function () {
      var a = this.diagram;
      a.Cf();
      a.remove(this.box);
      a.skipsUndoManager = !1;
      this.isActive = a.isMouseCaptured = !1;
    };
    Ig.prototype.doMouseMove = function () {
      var a = this.diagram;
      if (this.isActive && null !== this.box) {
        var b = this.computeBoxBounds(),
          c = this.box.Xa('SHAPE');
        null === c && (c = this.box.Ab());
        var d = L.alloc().h(b.width, b.height);
        b = H.allocAt(b.x, b.y);
        c.desiredSize = d;
        this.box.position = b;
        L.free(d);
        H.free(b);
        (a.allowHorizontalScroll || a.allowVerticalScroll) &&
          a.ft(a.lastInput.viewPoint);
      }
    };
    Ig.prototype.doMouseUp = function () {
      if (this.isActive) {
        var a = this.diagram;
        a.remove(this.box);
        try {
          (a.currentCursor = 'wait'),
            a.R('ChangingSelection', a.selection),
            this.selectInRect(this.computeBoxBounds()),
            a.R('ChangedSelection', a.selection);
        } finally {
          a.currentCursor = '';
        }
      }
      this.stopTool();
    };
    Ig.prototype.computeBoxBounds = function () {
      var a = this.diagram;
      return new N(a.firstInput.documentPoint, a.lastInput.documentPoint);
    };
    Ig.prototype.selectInRect = function (a) {
      var b = this.diagram,
        c = b.lastInput;
      a = b.Ox(a, this.isPartialInclusion);
      if (Wa ? c.meta : c.control)
        if (c.shift)
          for (a = a.iterator; a.next(); )
            (b = a.value), b.isSelected && (b.isSelected = !1);
        else
          for (a = a.iterator; a.next(); )
            (b = a.value), (b.isSelected = !b.isSelected);
      else if (c.shift)
        for (a = a.iterator; a.next(); )
          (b = a.value), b.isSelected || (b.isSelected = !0);
      else {
        c = new E();
        for (b = b.selection.iterator; b.next(); ) {
          var d = b.value;
          a.contains(d) || c.add(d);
        }
        for (b = c.iterator; b.next(); ) b.value.isSelected = !1;
        for (a = a.iterator; a.next(); )
          (b = a.value), b.isSelected || (b.isSelected = !0);
      }
    };
    ma.Object.defineProperties(Ig.prototype, {
      delay: {
        get: function () {
          return this.Wk;
        },
        set: function (a) {
          this.Wk = a;
        },
      },
      isPartialInclusion: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v = a;
        },
      },
      box: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.l = a;
        },
      },
    });
    Ig.className = 'DragSelectingTool';
    function Jg() {
      xe.call(this);
      this.name = 'Panning';
      this.Iu = new H();
      this.Fy = new H();
      this.Mg = !1;
      var a = this;
      this.mx = function () {
        var b = a.diagram;
        null !== b && b.removeEventListener(x.document, 'scroll', a.mx, !1);
        a.stopTool();
      };
    }
    la(Jg, xe);
    Jg.prototype.canStart = function () {
      if (!this.isEnabled) return !1;
      var a = this.diagram;
      return (!a.allowHorizontalScroll && !a.allowVerticalScroll) ||
        !a.lastInput.left ||
        (a.currentTool !== this && !this.isBeyondDragSize())
        ? !1
        : !0;
    };
    Jg.prototype.doActivate = function () {
      var a = this.diagram;
      this.Mg
        ? ((a.lastInput.bubbles = !0),
          a.addEventListener(x.document, 'scroll', this.mx, !1))
        : ((a.currentCursor = 'move'),
          (a.isMouseCaptured = !0),
          this.Iu.assign(a.position));
      this.isActive = !0;
    };
    Jg.prototype.doDeactivate = function () {
      var a = this.diagram;
      a.currentCursor = '';
      this.isActive = a.isMouseCaptured = !1;
    };
    Jg.prototype.doCancel = function () {
      var a = this.diagram;
      a.position = this.Iu;
      a.isMouseCaptured = !1;
      this.stopTool();
    };
    Jg.prototype.doMouseMove = function () {
      this.move();
    };
    Jg.prototype.doMouseUp = function () {
      this.move();
      this.stopTool();
    };
    Jg.prototype.move = function () {
      var a = this.diagram;
      if (this.isActive && a)
        if (this.Mg) a.lastInput.bubbles = !0;
        else {
          var b = a.position,
            c = a.firstInput.documentPoint,
            d = a.lastInput.documentPoint,
            e = b.x + c.x - d.x;
          c = b.y + c.y - d.y;
          a.allowHorizontalScroll || (e = b.x);
          a.allowVerticalScroll || (c = b.y);
          a.position = this.Fy.h(e, c);
        }
    };
    ma.Object.defineProperties(Jg.prototype, {
      bubbles: {
        get: function () {
          return this.Mg;
        },
        set: function (a) {
          this.Mg = a;
        },
      },
      originalPosition: {
        get: function () {
          return this.Iu;
        },
      },
    });
    Jg.className = 'PanningTool';
    La(
      'clickCreatingTool',
      function () {
        return this.findTool('ClickCreating');
      },
      function (a) {
        this.Va('ClickCreating', a, this.mouseUpTools);
      },
    );
    La(
      'clickSelectingTool',
      function () {
        return this.findTool('ClickSelecting');
      },
      function (a) {
        this.Va('ClickSelecting', a, this.mouseUpTools);
      },
    );
    La(
      'panningTool',
      function () {
        return this.findTool('Panning');
      },
      function (a) {
        this.Va('Panning', a, this.mouseMoveTools);
      },
    );
    La(
      'dragSelectingTool',
      function () {
        return this.findTool('DragSelecting');
      },
      function (a) {
        this.Va('DragSelecting', a, this.mouseMoveTools);
      },
    );
    La(
      'actionTool',
      function () {
        return this.findTool('Action');
      },
      function (a) {
        this.Va('Action', a, this.mouseDownTools);
      },
    );
    function Ne() {
      this.Y = this.I = this.l = this.v = null;
    }
    ma.Object.defineProperties(Ne.prototype, {
      mainElement: {
        get: function () {
          return this.I;
        },
        set: function (a) {
          this.I = a;
        },
      },
      show: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v !== a && (this.v = a);
        },
      },
      hide: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.l !== a && (this.l = a);
        },
      },
      valueFunction: {
        get: function () {
          return this.Y;
        },
        set: function (a) {
          this.Y = a;
        },
      },
    });
    Ne.className = 'HTMLInfo';
    function Kg(a, b, c) {
      this.text = a;
      this.Ex = b;
      this.visible = c;
    }
    Kg.className = 'ContextMenuButtonInfo';
    function Lg() {
      xe.call(this);
      this.name = 'ContextMenu';
      this.v = this.cu = this.l = null;
      this.bx = new H();
      this.du = null;
      this.xu = !1;
      var a = this;
      this.Xu = function () {
        a.stopTool();
      };
    }
    la(Lg, xe);
    function Mg(a) {
      var b = new Ne();
      b.show = function (a, b, c) {
        c.showDefaultContextMenu();
      };
      b.hide = function (a, b) {
        b.hideDefaultContextMenu();
      };
      Ng = b;
      a.Xu = function () {
        a.stopTool();
      };
      b = ta('div');
      var c = ta('div');
      b.style.cssText =
        'top: 0px;z-index:10002;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px';
      c.style.cssText =
        'z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;';
      var d = ta('style');
      x.document.getElementsByTagName('head')[0].appendChild(d);
      d.sheet.insertRule('.goCXul { list-style: none; }', 0);
      d.sheet.insertRule(
        '.goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }',
        0,
      );
      d.sheet.insertRule(
        '.goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }',
        0,
      );
      d = a.diagram;
      null !== d &&
        (d.addEventListener(b, 'contextmenu', Og, !1),
        d.addEventListener(b, 'selectstart', Og, !1),
        d.addEventListener(c, 'contextmenu', Og, !1));
      b.className = 'goCXforeground';
      c.className = 'goCXbackground';
      x.document.body &&
        (x.document.body.appendChild(b), x.document.body.appendChild(c));
      Pg = b;
      Qg = c;
      Rg = !0;
    }
    function Og(a) {
      a.preventDefault();
      return !1;
    }
    Lg.prototype.canStart = function () {
      if (!this.isEnabled) return !1;
      var a = this.diagram;
      return this.isBeyondDragSize() || !a.lastInput.right
        ? !1
        : (a.lastInput.isTouchEvent && null !== this.defaultTouchContextMenu) ||
          null !== this.findObjectWithContextMenu()
        ? !0
        : !1;
    };
    Lg.prototype.doStart = function () {
      this.bx.set(this.diagram.firstInput.documentPoint);
    };
    Lg.prototype.doStop = function () {
      this.hideContextMenu();
      this.currentObject = null;
    };
    Lg.prototype.findObjectWithContextMenu = function (a) {
      void 0 === a && (a = null);
      var b = this.diagram,
        c = b.lastInput,
        d = null;
      a instanceof R ||
        (a instanceof Y
          ? (d = a)
          : (d = b.Tb(c.documentPoint, null, function (a) {
              return !a.layer.isTemporary;
            })));
      if (null !== d) {
        for (a = d; null !== a; ) {
          if (null !== a.contextMenu) return a;
          a = a.panel;
        }
        if (b.lastInput.isTouchEvent && this.defaultTouchContextMenu)
          return d.part;
      } else if (null !== b.contextMenu) return b;
      return null;
    };
    Lg.prototype.doActivate = function () {};
    Lg.prototype.doMouseDown = function () {
      xe.prototype.doMouseDown.call(this);
      if (this.isActive && this.currentContextMenu instanceof Ce) {
        var a = this.diagram.toolManager.findTool('Action');
        null !== a &&
          a.canStart() &&
          (a.doActivate(), a.doMouseDown(), a.doDeactivate());
      }
      this.diagram.toolManager.mouseDownTools.contains(this) && Sg(this);
    };
    Lg.prototype.doMouseUp = function () {
      if (this.isActive && this.currentContextMenu instanceof Ce) {
        var a = this.diagram.toolManager.findTool('Action');
        null !== a &&
          a.canStart() &&
          (a.doActivate(), a.doCancel(), a.doDeactivate());
      }
      Sg(this);
    };
    function Sg(a) {
      var b = a.diagram;
      if (a.isActive) {
        var c = a.currentContextMenu;
        if (null !== c) {
          if (!(c instanceof Ne)) {
            var d = b.Tb(b.lastInput.documentPoint, null, null);
            null !== d && d.Dg(c) && a.standardMouseClick(null, null);
          }
          a.stopTool();
          a.canStart() && ((b.currentTool = a), a.doMouseUp());
        }
      } else a.canStart() && (Tg(a, !0), a.isActive || a.stopTool());
    }
    function Tg(a, b, c) {
      void 0 === c && (c = null);
      if (
        !a.xu &&
        ((a.xu = !0),
        b && a.standardMouseSelect(),
        (b = a.standardMouseClick()),
        (a.xu = !1),
        !b)
      )
        if (
          ((a.isActive = !0),
          (b = Ng),
          null === c && (c = a.findObjectWithContextMenu()),
          null !== c)
        ) {
          var d = c.contextMenu;
          null !== d
            ? ((a.currentObject = c instanceof Y ? c : null),
              a.showContextMenu(d, a.currentObject))
            : null !== b && a.showContextMenu(b, a.currentObject);
        } else null !== b && a.showContextMenu(b, null);
    }
    Lg.prototype.doMouseMove = function () {
      var a = this.diagram.toolManager.findTool('Action');
      null !== a && a.doMouseMove();
      this.isActive && this.diagram.toolManager.doMouseMove();
    };
    Lg.prototype.showContextMenu = function (a, b) {
      var c = this.diagram;
      a !== this.currentContextMenu && this.hideContextMenu();
      if (a instanceof Ce) {
        a.layerName = 'Tool';
        a.selectable = !1;
        a.scale = 1 / c.scale;
        a.category = this.name;
        null !== a.placeholder && (a.placeholder.scale = c.scale);
        var d = a.diagram;
        null !== d && d !== c && d.remove(a);
        c.add(a);
        null !== b ? (a.adornedObject = b) : (a.data = c.model);
        a.zb();
        this.positionContextMenu(a, b);
      } else a instanceof Ne && a.show(b, c, this);
      this.currentContextMenu = a;
    };
    Lg.prototype.positionContextMenu = function (a) {
      if (null === a.placeholder) {
        var b = this.diagram,
          c = b.lastInput.documentPoint.copy(),
          d = a.measuredBounds,
          e = b.viewportBounds;
        b.lastInput.isTouchEvent && (c.x -= d.width);
        c.x + d.width > e.right && (c.x -= d.width + 5 / b.scale);
        c.x < e.x && (c.x = e.x);
        c.y + d.height > e.bottom && (c.y -= d.height + 5 / b.scale);
        c.y < e.y && (c.y = e.y);
        a.position = c;
      }
    };
    Lg.prototype.hideContextMenu = function () {
      var a = this.diagram,
        b = this.currentContextMenu;
      null !== b &&
        (b instanceof Ce
          ? (a.remove(b),
            null !== this.cu && this.cu.Af(b.category),
            (b.data = null),
            (b.adornedObject = null))
          : b instanceof Ne &&
            (null !== b.hide
              ? b.hide(a, this)
              : null !== b.mainElement && (b.mainElement.style.display = 'none')),
        (this.currentContextMenu = null),
        this.standardMouseOver());
    };
    function Ug(a) {
      var b = new E();
      b.add(
        new Kg(
          'Copy',
          function (a) {
            a.commandHandler.copySelection();
          },
          function (a) {
            return a.commandHandler.canCopySelection();
          },
        ),
      );
      b.add(
        new Kg(
          'Cut',
          function (a) {
            a.commandHandler.cutSelection();
          },
          function (a) {
            return a.commandHandler.canCutSelection();
          },
        ),
      );
      b.add(
        new Kg(
          'Delete',
          function (a) {
            a.commandHandler.deleteSelection();
          },
          function (a) {
            return a.commandHandler.canDeleteSelection();
          },
        ),
      );
      b.add(
        new Kg(
          'Paste',
          function (b) {
            b.commandHandler.pasteSelection(a.mouseDownPoint);
          },
          function (b) {
            return b.commandHandler.canPasteSelection(a.mouseDownPoint);
          },
        ),
      );
      b.add(
        new Kg(
          'Select All',
          function (a) {
            a.commandHandler.selectAll();
          },
          function (a) {
            return a.commandHandler.canSelectAll();
          },
        ),
      );
      b.add(
        new Kg(
          'Undo',
          function (a) {
            a.commandHandler.undo();
          },
          function (a) {
            return a.commandHandler.canUndo();
          },
        ),
      );
      b.add(
        new Kg(
          'Redo',
          function (a) {
            a.commandHandler.redo();
          },
          function (a) {
            return a.commandHandler.canRedo();
          },
        ),
      );
      b.add(
        new Kg(
          'Scroll To Part',
          function (a) {
            a.commandHandler.scrollToPart();
          },
          function (a) {
            return a.commandHandler.canScrollToPart();
          },
        ),
      );
      b.add(
        new Kg(
          'Zoom To Fit',
          function (a) {
            a.commandHandler.zoomToFit();
          },
          function (a) {
            return a.commandHandler.canZoomToFit();
          },
        ),
      );
      b.add(
        new Kg(
          'Reset Zoom',
          function (a) {
            a.commandHandler.resetZoom();
          },
          function (a) {
            return a.commandHandler.canResetZoom();
          },
        ),
      );
      b.add(
        new Kg(
          'Group Selection',
          function (a) {
            a.commandHandler.groupSelection();
          },
          function (a) {
            return a.commandHandler.canGroupSelection();
          },
        ),
      );
      b.add(
        new Kg(
          'Ungroup Selection',
          function (a) {
            a.commandHandler.ungroupSelection();
          },
          function (a) {
            return a.commandHandler.canUngroupSelection();
          },
        ),
      );
      b.add(
        new Kg(
          'Edit Text',
          function (a) {
            a.commandHandler.editTextBlock();
          },
          function (a) {
            return a.commandHandler.canEditTextBlock();
          },
        ),
      );
      return b;
    }
    Lg.prototype.showDefaultContextMenu = function () {
      var a = this.diagram;
      null === this.du && (this.du = Ug(this));
      Pg.innerHTML = '';
      Qg.addEventListener('click', this.Xu, !1);
      var b = this,
        c = ta('ul');
      c.className = 'goCXul';
      Pg.appendChild(c);
      c.innerHTML = '';
      for (var d = this.du.iterator; d.next(); ) {
        var e = d.value,
          f = e.visible;
        if ('function' === typeof e.Ex && ('function' !== typeof f || f(a))) {
          f = ta('li');
          f.className = 'goCXli';
          var g = ta('a');
          g.className = 'goCXa';
          g.href = '#';
          g.yy = e.Ex;
          g.addEventListener(
            'click',
            function (c) {
              this.yy(a);
              b.stopTool();
              c.preventDefault();
              return !1;
            },
            !1,
          );
          g.textContent = e.text;
          f.appendChild(g);
          c.appendChild(f);
        }
      }
      Pg.style.display = 'block';
      Qg.style.display = 'block';
    };
    Lg.prototype.hideDefaultContextMenu = function () {
      if (null !== this.currentContextMenu && this.currentContextMenu === Ng) {
        Pg.style.display = 'none';
        Qg.style.display = 'none';
        var a = this.diagram;
        null !== a && a.removeEventListener(Qg, 'click', this.Xu, !1);
        this.currentContextMenu = null;
      }
    };
    ma.Object.defineProperties(Lg.prototype, {
      currentContextMenu: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.l = a;
          this.cu = a instanceof Ce ? a.adornedPart : null;
        },
      },
      defaultTouchContextMenu: {
        get: function () {
          !1 === Rg && null === Ng && Vg && Mg(this);
          return Ng;
        },
        set: function (a) {
          null === a && (Rg = !0);
          Ng = a;
        },
      },
      currentObject: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v = a;
        },
      },
      mouseDownPoint: {
        get: function () {
          return this.bx;
        },
      },
    });
    var Ng = null,
      Rg = !1,
      Qg = null,
      Pg = null;
    Lg.className = 'ContextMenuTool';
    La(
      'contextMenuTool',
      function () {
        return this.findTool('ContextMenu');
      },
      function (a) {
        this.Va('ContextMenu', a, this.mouseUpTools);
      },
    );
    function Wg() {
      xe.call(this);
      this.name = 'TextEditing';
      this.wh = new Xg();
      this.La = null;
      this.Ja = Yg;
      this.Ji = null;
      this.ia = Zg;
      this.I = 1;
      this.Y = !0;
      this.v = null;
      this.l = new Ne();
      this.hu = null;
      $g(this, this.l);
    }
    la(Wg, xe);
    function $g(a, b) {
      if (Vg) {
        var c = ta('textarea');
        a.hu = c;
        c.addEventListener(
          'input',
          function () {
            if (null !== a.textBlock) {
              var b = a.Xx(this.value);
              this.style.width = 20 + b.measuredBounds.width * this.AA + 'px';
              this.rows = b.lineCount;
            }
          },
          !1,
        );
        c.addEventListener(
          'keydown',
          function (b) {
            if (null !== a.textBlock) {
              var c = b.which;
              13 === c
                ? (!1 === a.textBlock.isMultiline && b.preventDefault(),
                  a.acceptText(ah))
                : 9 === c
                ? (a.acceptText(bh), b.preventDefault())
                : 27 === c &&
                  (a.doCancel(), null !== a.diagram && a.diagram.doFocus());
            }
          },
          !1,
        );
        c.addEventListener(
          'focus',
          function () {
            if (null !== a.currentTextEditor && a.state !== Zg) {
              var b = a.hu;
              a.ia === ch && (a.ia = dh);
              'function' === typeof b.select &&
                a.selectsTextOnActivate &&
                (b.select(), b.setSelectionRange(0, 9999));
            }
          },
          !1,
        );
        c.addEventListener(
          'blur',
          function () {
            if (null !== a.currentTextEditor && a.state !== Zg) {
              var b = a.hu;
              'function' === typeof b.focus && b.focus();
              'function' === typeof b.select &&
                a.selectsTextOnActivate &&
                (b.select(), b.setSelectionRange(0, 9999));
            }
          },
          !1,
        );
        b.valueFunction = function () {
          return c.value;
        };
        b.mainElement = c;
        b.show = function (a, b, f) {
          if (a instanceof Xg && f instanceof Wg)
            if (f.state === eh) (c.style.border = '3px solid red'), c.focus();
            else {
              var d = a.ga(Ac),
                e = b.position,
                k = b.scale,
                l = a.tf() * k;
              l < f.minimumEditorScale && (l = f.minimumEditorScale);
              var m = a.naturalBounds.width * l + 6,
                n = a.naturalBounds.height * l + 2,
                p = (d.x - e.x) * k;
              d = (d.y - e.y) * k;
              c.value = a.text;
              b.div.style.font = a.font;
              c.style.position = 'absolute';
              c.style.zIndex = '100';
              c.style.font = 'inherit';
              c.style.fontSize = 100 * l + '%';
              c.style.lineHeight = 'normal';
              c.style.width = m + 'px';
              c.style.left = ((p - m / 2) | 0) - 1 + 'px';
              c.style.top = ((d - n / 2) | 0) - 1 + 'px';
              c.style.textAlign = a.textAlign;
              c.style.margin = '0';
              c.style.padding = '1px';
              c.style.border = '0';
              c.style.outline = 'none';
              c.style.whiteSpace = 'pre-wrap';
              c.style.overflow = 'hidden';
              c.rows = a.lineCount;
              c.AA = l;
              c.className = 'goTXarea';
              b.div.appendChild(c);
              c.focus();
              f.selectsTextOnActivate &&
                (c.select(), c.setSelectionRange(0, 9999));
            }
        };
        b.hide = function (a) {
          a.div.removeChild(c);
        };
      }
    }
    Wg.prototype.canStart = function () {
      if (!this.isEnabled) return !1;
      var a = this.diagram;
      if (
        null === a ||
        a.isReadOnly ||
        !a.lastInput.left ||
        this.isBeyondDragSize()
      )
        return !1;
      var b = a.Tb(a.lastInput.documentPoint);
      if (!(null !== b && b instanceof Xg && b.editable && b.part.canEdit()))
        return !1;
      b = b.part;
      return null === b ||
        (this.starting === Yg && !b.isSelected) ||
        (this.starting === fh && 2 > a.lastInput.clickCount)
        ? !1
        : !0;
    };
    Wg.prototype.doStart = function () {
      this.isActive || null === this.textBlock || this.doActivate();
    };
    Wg.prototype.doActivate = function () {
      if (!this.isActive) {
        var a = this.diagram;
        if (null !== a) {
          var b = this.textBlock;
          null === b && (b = a.Tb(a.lastInput.documentPoint));
          if (
            null !== b &&
            b instanceof Xg &&
            ((this.textBlock = b), null !== b.part)
          ) {
            this.isActive = !0;
            this.ia = ch;
            var c = this.defaultTextEditor;
            null !== b.textEditor && (c = b.textEditor);
            this.wh = this.textBlock.copy();
            var d = new N(this.textBlock.ga(vc), this.textBlock.ga(Gc));
            a.fw(d);
            c.show(b, a, this);
            this.currentTextEditor = c;
          }
        }
      }
    };
    Wg.prototype.doCancel = function () {
      this.stopTool();
    };
    Wg.prototype.doMouseUp = function () {
      !this.isActive && this.canStart() && this.doActivate();
    };
    Wg.prototype.doMouseDown = function () {
      this.isActive && this.acceptText(gh);
    };
    Wg.prototype.acceptText = function (a) {
      switch (a) {
        case gh:
          if (this.ia === hh)
            this.currentTextEditor instanceof HTMLElement &&
              this.currentTextEditor.focus();
          else if (this.ia === ch || this.ia === eh || this.ia === dh)
            (this.ia = ih), rh(this);
          break;
        case sh:
        case ah:
        case bh:
          if (ah !== a || !0 !== this.textBlock.isMultiline)
            if (this.ia === ch || this.ia === eh || this.ia === dh)
              (this.ia = ih), rh(this);
      }
    };
    function rh(a) {
      var b = a.textBlock,
        c = a.diagram,
        d = a.currentTextEditor;
      if (null !== b && null !== d) {
        var e = b.text,
          f = '';
        null !== d.valueFunction && (f = d.valueFunction());
        if (a.isValidText(b, e, f))
          a.ta(a.name),
            (a.ia = hh),
            (a.transactionResult = a.name),
            (b.text = f),
            (d = a.textBlock),
            null !== d.textEdited && d.textEdited(d, e, f),
            null !== c && c.R('TextEdited', b, e),
            a.Hg(),
            a.stopTool(),
            null !== c && c.doFocus();
        else {
          a.ia = eh;
          var g = a.textBlock;
          null !== g.errorFunction && g.errorFunction(a, e, f);
          d.show(b, c, a);
        }
      }
    }
    Wg.prototype.doDeactivate = function () {
      var a = this.diagram;
      null !== a &&
        ((this.ia = Zg),
        (this.textBlock = null),
        null !== this.currentTextEditor && this.currentTextEditor.hide(a, this),
        (this.isActive = !1));
    };
    Wg.prototype.isValidText = function (a, b, c) {
      var d = this.textValidation;
      if (null !== d && !d(a, b, c)) return !1;
      d = a.textValidation;
      return null === d || d(a, b, c) ? !0 : !1;
    };
    Wg.prototype.Xx = function (a) {
      var b = this.wh;
      b.text = a;
      b.measure(this.textBlock.ti, Infinity);
      return b;
    };
    ma.Object.defineProperties(Wg.prototype, {
      textBlock: {
        get: function () {
          return this.La;
        },
        set: function (a) {
          this.La = a;
        },
      },
      currentTextEditor: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v = a;
        },
      },
      defaultTextEditor: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.l = a;
        },
      },
      starting: {
        get: function () {
          return this.Ja;
        },
        set: function (a) {
          this.Ja = a;
        },
      },
      textValidation: {
        get: function () {
          return this.Ji;
        },
        set: function (a) {
          this.Ji = a;
        },
      },
      minimumEditorScale: {
        get: function () {
          return this.I;
        },
        set: function (a) {
          this.I = a;
        },
      },
      selectsTextOnActivate: {
        get: function () {
          return this.Y;
        },
        set: function (a) {
          this.Y = a;
        },
      },
      state: {
        get: function () {
          return this.ia;
        },
        set: function (a) {
          this.ia !== a && (this.ia = a);
        },
      },
    });
    Wg.prototype.measureTemporaryTextBlock = Wg.prototype.Xx;
    var sh = new D(Wg, 'LostFocus', 0),
      gh = new D(Wg, 'MouseDown', 1),
      bh = new D(Wg, 'Tab', 2),
      ah = new D(Wg, 'Enter', 3),
      th = new D(Wg, 'SingleClick', 0),
      Yg = new D(Wg, 'SingleClickSelected', 1),
      fh = new D(Wg, 'DoubleClick', 2),
      Zg = new D(Wg, 'StateNone', 0),
      ch = new D(Wg, 'StateActive', 1),
      dh = new D(Wg, 'StateEditing', 2),
      ih = new D(Wg, 'StateValidating', 3),
      eh = new D(Wg, 'StateInvalid', 4),
      hh = new D(Wg, 'StateValidated', 5);
    Wg.className = 'TextEditingTool';
    Wg.LostFocus = sh;
    Wg.MouseDown = gh;
    Wg.Tab = bh;
    Wg.Enter = ah;
    Wg.SingleClick = th;
    Wg.SingleClickSelected = Yg;
    Wg.DoubleClick = fh;
    Wg.StateNone = Zg;
    Wg.StateActive = ch;
    Wg.StateEditing = dh;
    Wg.StateValidating = ih;
    Wg.StateInvalid = eh;
    Wg.StateValidated = hh;
    La(
      'textEditingTool',
      function () {
        return this.findTool('TextEditing');
      },
      function (a) {
        this.Va('TextEditing', a, this.mouseUpTools);
      },
    );
    function uh() {
      vh || (wh(), (vh = !0));
      this.B = ye;
      this.hl = this.Xe = this.jc = this.Tr = this.hc = !1;
      this.sx = !0;
      this.il = xh;
      this.oi = this.Kc = !0;
      this.Ug = 600;
      this.Pw = this.qx = !1;
      this.Ie = new F();
      this.Ad = new yh();
      this.Ad.Hc = this;
      this.Dk = new F();
      this.Tu = new F();
      this.Rs = new F();
    }
    uh.prototype.Zd = function (a) {
      this.B = a;
    };
    uh.prototype.canStart = function () {
      return !0;
    };
    function zh(a, b) {
      Ah(a, b) && (a.Xe = !0);
    }
    function Ah(a, b) {
      if (!a.Kc || !a.canStart(b)) return !1;
      a.Ie.add(b);
      a.defaultAnimation.isAnimating && a.Uc();
      return (a.jc = !0);
    }
    function Bh(a) {
      if (a.Kc && a.jc) {
        var b = a.Ad,
          c = a.B,
          d = a.Ie.contains('Model');
        d &&
          ((a.hl = !0),
          a.il === xh
            ? ((b.isViewportUnconstrained = !0),
              b.qc.clear(),
              b.add(c, 'position', c.position.copy().offset(0, -200), c.position),
              b.add(c, 'opacity', 0, 1))
            : a.il === Ch && b.qc.clear(),
          c.R('InitialAnimationStarting', a));
        (d && !a.oi) || 0 === b.qc.count
          ? (a.Ie.clear(),
            (a.jc = !1),
            (a.Xe = !1),
            b.qc.clear(),
            Dh(b),
            (a.hl = !1),
            c.N())
          : (a.Ie.clear(),
            (c.Pc = !1),
            x.requestAnimationFrame(function () {
              !1 === a.jc ||
                b.hc ||
                (c.Be('temporaryPixelRatio') && Ue(c),
                Eh(c),
                (a.jc = !1),
                (a.Xe = !1),
                (a.sx = d && a.il === Fh && c.Nu.A(c.ma) ? !0 : !1),
                b.start(),
                Gh(a),
                c.Na(),
                Hh(b, 0),
                Kf(c, !0),
                Ih(a),
                c.R('AnimationStarting', a));
            }));
      }
    }
    function Jh(a, b, c, d) {
      (b instanceof S && (null !== b.fromNode || null !== b.toNode)) ||
        a.Ad.add(b, 'position', c, d, !1);
    }
    t = uh.prototype;
    t.Dt = function (a) {
      return this.Ad.Dt(a);
    };
    t.Jv = function (a) {
      return this.Ad.Jv(a);
    };
    function Kh(a, b) {
      function c() {
        0 < e.Rs.count && (d.addAll(e.Rs), e.Rs.clear(), (e.hc = !0));
        if (!1 !== e.hc && 0 !== d.count) {
          e.Tu.addAll(d);
          for (var a = e.Tu.iterator; a.next(); ) {
            var b = a.value;
            if (!1 !== b.hc) {
              a: if (0 < b.Yl.count) var h = !0;
              else {
                for (h = b.qc.iterator; h.next(); ) {
                  var k = h.key;
                  if ((k instanceof Y && null !== k.diagram) || k instanceof R) {
                    h = !0;
                    break a;
                  }
                }
                h = !1;
              }
              h ? Lh(b, !1) : (b.ql = !0);
            }
          }
          e.Tu.clear();
          Gh(e);
          Kf(e.B);
          Ih(e);
          x.requestAnimationFrame(c);
        }
      }
      var d = a.Dk,
        e = a;
      a.hc
        ? a.Rs.add(b)
        : ((a.hc = !0),
          d.add(b),
          x.requestAnimationFrame(function () {
            c();
          }));
    }
    function Mh(a) {
      for (a = a.Dk.iterator; a.next(); ) a.value.ql = !1;
    }
    function Gh(a) {
      if (!a.Tr) {
        var b = a.B;
        a.qx = b.skipsUndoManager;
        a.Pw = b.skipsModelSourceBindings;
        b.skipsUndoManager = !0;
        b.skipsModelSourceBindings = !0;
        a.Tr = !0;
      }
    }
    function Ih(a) {
      var b = a.B;
      b.skipsUndoManager = a.qx;
      b.skipsModelSourceBindings = a.Pw;
      a.Tr = !1;
    }
    t.Uc = function (a) {
      var b = this.Ad;
      !0 === this.jc &&
        ((this.hl = this.Xe = this.jc = !1),
        this.Ie.clear(),
        0 < b.qc.count && this.B.Yb());
      if (this.hc && this.Kc) {
        if ((b.hm(!0), b.qc.clear(), Dh(b), !0 === a))
          for (a = this.Dk.na(), b = 0; b < a.length; b++) a[b].hm(!0);
      } else b.qc.clear(), Dh(b);
    };
    t.hm = function (a) {
      a === this.defaultAnimation && this.defaultAnimation.qc.clear();
      this.Dk.remove(a);
      0 === this.Dk.count && ((this.hc = !1), this.B.Yb());
      a === this.defaultAnimation &&
        (this.defaultAnimation.qc.clear(), this.B.R('AnimationFinished', this));
    };
    t.Vj = function (a, b) {
      this.Xe &&
        (this.Ie.contains('Expand Tree') ||
          this.Ie.contains('Expand SubGraph')) &&
        this.Ad.Vj(a, b);
    };
    t.Tj = function (a, b) {
      this.Xe &&
        (this.Ie.contains('Collapse Tree') ||
          this.Ie.contains('Collapse SubGraph')) &&
        (this.Ad.Tj(a, b), Nh(this.Ad, b, 'position', b.position, b.position));
    };
    function Oh(a, b, c) {
      a.Xe &&
        !b.A(c) &&
        (a.B.lk || (b = c.copy()), Nh(a.Ad, a.B, 'position', b, c));
    }
    function Ph(a, b, c, d, e) {
      null === a && (a = 'rgba(0,0,0,0)');
      null === b && (b = 'rgba(0,0,0,0)');
      Qh(a);
      Rh();
      var f = Sh.l,
        g = Sh.I,
        h = Sh.v;
      a = Sh.Y;
      Qh(b);
      Rh();
      var k = Sh.I,
        l = Sh.v;
      b = Sh.Y;
      f = e(c, f, Sh.l - f, d);
      g = e(c, g, k - g, d);
      h = e(c, h, l - h, d);
      c = e(c, a, b - a, d);
      return 'hsla(' + f + ', ' + g + '%, ' + h + '%, ' + c + ')';
    }
    function wh() {
      var a = new G();
      a.add('position:diagram', function (a, c, d, e, f, g) {
        a.position = new H(e(f, c.x, d.x - c.x, g), e(f, c.y, d.y - c.y, g));
      });
      a.add('position', function (a, c, d, e, f, g) {
        f !== g
          ? a.Jq(e(f, c.x, d.x - c.x, g), e(f, c.y, d.y - c.y, g), !1)
          : (a.position = new H(
              e(f, c.x, d.x - c.x, g),
              e(f, c.y, d.y - c.y, g),
            ));
      });
      a.add('location', function (a, c, d, e, f, g) {
        f !== g
          ? a.Jq(e(f, c.x, d.x - c.x, g), e(f, c.y, d.y - c.y, g), !0)
          : (a.location = new H(
              e(f, c.x, d.x - c.x, g),
              e(f, c.y, d.y - c.y, g),
            ));
      });
      a.add('position:placeholder', function (a, c, d, e, f, g) {
        f !== g
          ? a.Jq(e(f, c.x, d.x - c.x, g), e(f, c.y, d.y - c.y, g), !1)
          : (a.position = new H(
              e(f, c.x, d.x - c.x, g),
              e(f, c.y, d.y - c.y, g),
            ));
      });
      a.add('position:node', function (a, c, d, e, f, g) {
        var b = a.actualBounds,
          k = d.actualBounds;
        d = k.x + k.width / 2 - b.width / 2;
        b = k.y + k.height / 2 - b.height / 2;
        f !== g
          ? a.Jq(e(f, c.x, d - c.x, g), e(f, c.y, b - c.y, g), !1)
          : (a.position = new H(e(f, c.x, d - c.x, g), e(f, c.y, b - c.y, g)));
      });
      a.add('desiredSize', function (a, c, d, e, f, g) {
        a.desiredSize = new N(
          e(f, c.width, d.width - c.width, g),
          e(f, c.height, d.height - c.height, g),
        );
      });
      a.add('width', function (a, c, d, e, f, g) {
        a.width = e(f, c, d - c, g);
      });
      a.add('height', function (a, c, d, e, f, g) {
        a.height = e(f, c, d - c, g);
      });
      a.add('fill', function (a, c, d, e, f, g) {
        a.fill = Ph(c, d, f, g, e);
      });
      a.add('stroke', function (a, c, d, e, f, g) {
        a.stroke = Ph(c, d, f, g, e);
      });
      a.add('strokeWidth', function (a, c, d, e, f, g) {
        a.strokeWidth = e(f, c, d - c, g);
      });
      a.add('strokeDashOffset', function (a, c, d, e, f, g) {
        a.strokeDashOffset = e(f, c, d - c, g);
      });
      a.add('background', function (a, c, d, e, f, g) {
        a.background = Ph(c, d, f, g, e);
      });
      a.add('areaBackground', function (a, c, d, e, f, g) {
        a.areaBackground = Ph(c, d, f, g, e);
      });
      a.add('opacity', function (a, c, d, e, f, g) {
        a.opacity = e(f, c, d - c, g);
      });
      a.add('scale', function (a, c, d, e, f, g) {
        a.scale = e(f, c, d - c, g);
      });
      a.add('angle', function (a, c, d, e, f, g) {
        a.angle = e(f, c, d - c, g);
      });
      Th = a;
    }
    ma.Object.defineProperties(uh.prototype, {
      animationReasons: {
        get: function () {
          return this.Ie;
        },
      },
      isEnabled: {
        get: function () {
          return this.Kc;
        },
        set: function (a) {
          this.Kc = a;
        },
      },
      duration: {
        get: function () {
          return this.Ug;
        },
        set: function (a) {
          1 > a && va(a, '>= 1', uh, 'duration');
          this.Ug = a;
        },
      },
      isAnimating: {
        get: function () {
          return this.hc;
        },
      },
      isTicking: {
        get: function () {
          return this.Tr;
        },
      },
      isInitial: {
        get: function () {
          return this.oi;
        },
        set: function (a) {
          this.oi = a;
        },
      },
      defaultAnimation: {
        get: function () {
          return this.Ad;
        },
      },
      activeAnimations: {
        get: function () {
          return this.Dk;
        },
      },
      initialAnimationStyle: {
        get: function () {
          return this.il;
        },
        set: function (a) {
          this.il = a;
        },
      },
    });
    uh.prototype.stopAnimation = uh.prototype.Uc;
    var Th = null,
      vh = !1,
      xh = new D(uh, 'Default', 1),
      Fh = new D(uh, 'AnimateLocations', 2),
      Ch = new D(uh, 'None', 3);
    uh.className = 'AnimationManager';
    uh.defineAnimationEffect = function (a, b) {
      vh || (wh(), (vh = !0));
      Th.add(a, b);
    };
    uh.Default = xh;
    uh.AnimateLocations = Fh;
    uh.None = Ch;
    function yh() {
      this.Yu = this.px = this.Hc = this.B = null;
      this.ql = this.hc = this.l = !1;
      this.Gn = this.rd = 0;
      this.mr = this.ku = Uh;
      this.pl = this.kp = !1;
      this.Mu = 1;
      this.Ku = 0;
      this.kd = this.Ug = NaN;
      this.Sw = 0;
      this.Hn = null;
      this.v = Fb;
      this.qc = new G();
      this.Gu = new G();
      this.Yl = new F();
      this.Hu = new F();
      this.Qw = Vh;
    }
    yh.prototype.suspend = function () {
      this.ql = !0;
    };
    yh.prototype.advanceTo = function (a, b) {
      b && (this.ql = !1);
      this.kp && a >= this.kd && ((this.pl = !0), (a -= this.kd));
      this.Sw = a;
      Lh(this, !0);
      Gh(this.Hc);
      Kf(this.B);
      Ih(this.Hc);
      this.B.zf();
    };
    function Dh(a) {
      a.Gu.clear();
      a.pl = !1;
      a.Ku = 0;
      a.kd = NaN;
      0 < a.Yl.count && a.Yl.clear();
      0 < a.Hu.count && a.Hu.clear();
    }
    t = yh.prototype;
    t.start = function () {
      if (0 !== this.qc.count && !this.hc) {
        for (var a = this.B, b = this.qc.iterator; b.next(); ) {
          var c = b.value.end,
            d = b.key;
          if (c['position:placeholder']) {
            var e = d.findVisibleNode();
            if (e instanceof xf && null !== e.placeholder) {
              var f = e.placeholder;
              e = f.ga(vc);
              f = f.padding;
              e.x += f.left;
              e.y += f.top;
              c['position:placeholder'] = e;
            }
          }
          null === a &&
            (d instanceof R ? (a = d) : d instanceof Y && (a = d.diagram));
        }
        null !== a &&
          ((this.B = a),
          (b = this.Hc = a.animationManager),
          (this.kd = isNaN(this.Ug) ? b.duration : this.Ug),
          (this.mr = this.ku),
          b.hl &&
            b.il === xh &&
            this === b.defaultAnimation &&
            ((this.mr = Wh),
            (this.kd = isNaN(this.Ug)
              ? 600 === b.duration
                ? 900
                : b.duration
              : this.Ug)),
          (this.Qw = a.scrollMode),
          this.isViewportUnconstrained && (a.Gi = Xh),
          Gh(b),
          this.Yl.each(function (b) {
            b.data = null;
            a.add(b);
          }),
          Ih(b),
          (this.hc = !0),
          (this.rd = +new Date()),
          (this.Gn = this.rd + this.kd),
          Kh(b, this));
      }
    };
    t.Ny = function (a, b) {
      a.Vb() && (this.Yl.add(a), (this.B = b));
    };
    t.add = function (a, b, c, d, e) {
      ('position' === b && c.A(d)) ||
        (null === this.B &&
          (a instanceof R
            ? (this.B = a)
            : a instanceof Y && null !== a.diagram && (this.B = a.diagram)),
        (a instanceof T && !a.isAnimated) || Nh(this, a, b, c, d, e));
    };
    function Nh(a, b, c, d, e, f) {
      var g = a.qc;
      b instanceof R && 'position' === c && (c = 'position:diagram');
      if (g.contains(b)) {
        var h = g.H(b);
        var k = h.start;
        var l = h.end;
        void 0 === k[c] && (k[c] = Yh(d));
        l[c] = Yh(e);
      } else
        (k = {}),
          (l = {}),
          (k[c] = Yh(d)),
          (l[c] = Yh(e)),
          (h = k.position),
          b instanceof Y &&
            h instanceof H &&
            !h.u() &&
            b.diagram.animationManager.Ie.contains('Expand SubGraph') &&
            h.assign(l.position),
          (h = new Zh(k, l, f)),
          g.add(b, h);
      g = k[c];
      g instanceof H && !g.u() && g.assign(a.v);
      f && 0 === c.indexOf('position:') && b instanceof T
        ? (h.rv.location = Yh(b.location))
        : f && (h.rv[c] = Yh(d));
    }
    function Yh(a) {
      return a instanceof H ? a.copy() : a instanceof L ? a.copy() : a;
    }
    t.Dt = function (a) {
      if (!this.hc) return !1;
      a = this.qc.H(a);
      return null !== a && a.Xv;
    };
    t.Jv = function (a) {
      if (!this.hc) return !1;
      a = this.qc.H(a);
      return null !== a && (a.start.position || a.start.location);
    };
    function Lh(a, b) {
      if (!a.ql || b) {
        var c = a.Hc;
        if (!1 !== a.hc) {
          var d = +new Date(),
            e = d > a.Gn ? a.kd : d - a.rd;
          b &&
            ((e = a.Sw),
            e < a.kd
              ? ((a.rd = +new Date() - e), (a.Gn = a.rd + a.kd))
              : (e = a.kd));
          Gh(c);
          Hh(a, e);
          Kf(a.B, !0);
          Ih(c);
          d > a.Gn &&
            (a.kp && !a.pl
              ? ((a.rd = +new Date()), (a.Gn = a.rd + a.kd), (a.pl = !0))
              : a.hm(!1));
        }
      }
    }
    function Hh(a, b) {
      for (var c = a.kd, d = a.qc.iterator, e = a.pl; d.next(); ) {
        var f = d.key;
        if (!(f instanceof Y && null === f.diagram)) {
          var g = d.value,
            h = e ? g.end : g.start;
          g = e ? g.start : g.end;
          var k = Th,
            l;
          for (l in g)
            ('position' === l &&
              (g['position:placeholder'] || g['position:node'])) ||
              null === k.get(l) ||
              k.get(l)(f, h[l], g[l], a.mr, b, c, a);
        }
      }
    }
    t.stop = function () {
      this.hc && this.hm(!0);
    };
    t.hm = function (a) {
      null !== this.Yu && this.Yu.rp.remove(this.px);
      if (this.hc) {
        var b = this.B,
          c = this.Hc;
        this.ql = this.hc = c.hl = !1;
        Gh(c);
        for (var d = this.qc, e = this.Yl.iterator; e.next(); ) b.remove(e.value);
        for (e = this.Hu.iterator; e.next(); ) e.value.o();
        e = this.kp;
        d = d.iterator;
        for (var f = Th; d.next(); ) {
          var g = d.key,
            h = d.value,
            k = e ? h.end : h.start,
            l = e ? h.start : h.end,
            m = h.rv,
            n;
          for (n in l)
            if (null !== f.get(n)) {
              var p = n;
              !h.mv ||
                ('position:node' !== p && 'position:placeholder' !== p) ||
                (p = 'position');
              f.get(p)(
                g,
                k[n],
                void 0 !== m[n] ? m[n] : h.mv ? k[n] : l[n],
                this.mr,
                this.kd,
                this.kd,
                this,
              );
            }
          h.mv &&
            void 0 !== m.location &&
            g instanceof T &&
            (g.location = m.location);
          h.Xv && g instanceof T && g.Ob(!1);
        }
        if (c.defaultAnimation === this)
          for (n = this.B.links; n.next(); )
            (e = n.value),
              null === e.ph
                ? ((d = e.path), null !== d && ((e.yc = !1), e.o(), d.o()))
                : ((e.points = e.ph), (e.ph = null));
        b.yt.clear();
        kf(b, !1);
        b.Na();
        b.N();
        Kf(b, !0);
        this.isViewportUnconstrained && (b.scrollMode = this.Qw);
        Ih(c);
        this.Ku++;
        !a && this.Mu > this.Ku
          ? ((this.pl = !1), this.start())
          : (this.Hn && this.Hn(this), Dh(this), c.hm(this), b.Yb());
      }
    };
    t.Vj = function (a, b) {
      var c = b.actualBounds,
        d = null;
      b instanceof xf && (d = b.placeholder);
      null !== d
        ? ((c = d.ga(vc)),
          (d = d.padding),
          (c.x += d.left),
          (c.y += d.top),
          this.add(a, 'position', c, a.position, !1))
        : this.add(
            a,
            'position',
            new H(c.x + c.width / 2, c.y + c.height / 2),
            a.position,
            !1,
          );
      this.add(a, 'scale', 0.01, a.scale, !1);
      if (a instanceof xf)
        for (a = a.memberParts; a.next(); )
          (d = a.value), d instanceof U && this.Vj(d, b);
    };
    t.Tj = function (a, b) {
      if (a.isVisible()) {
        var c = null;
        b instanceof xf && (c = b.placeholder);
        null !== c
          ? this.add(a, 'position:placeholder', a.position, c, !0)
          : this.add(a, 'position:node', a.position, b, !0);
        this.add(a, 'scale', a.scale, 0.01, !0);
        c = this.qc;
        c.contains(a) && (c.H(a).Xv = !0);
        if (a instanceof xf)
          for (a = a.memberParts; a.next(); )
            (c = a.value), c instanceof U && this.Tj(c, b);
      }
    };
    t.Jz = function (a) {
      var b = this.Gu.get(a);
      null === b && ((b = {}), this.Gu.add(a, b));
      return b;
    };
    ma.Object.defineProperties(yh.prototype, {
      duration: {
        get: function () {
          return this.Ug;
        },
        set: function (a) {
          1 > a && va(a, '>= 1', yh, 'duration');
          this.Ug = a;
        },
      },
      reversible: {
        get: function () {
          return this.kp;
        },
        set: function (a) {
          this.kp = a;
        },
      },
      runCount: {
        get: function () {
          return this.Mu;
        },
        set: function (a) {
          0 < a
            ? (this.Mu = a)
            : B('Animation.runCount value must be a positive integer.');
        },
      },
      finished: {
        get: function () {
          return this.Hn;
        },
        set: function (a) {
          this.Hn !== a && (this.Hn = a);
        },
      },
      easing: {
        get: function () {
          return this.ku;
        },
        set: function (a) {
          this.ku = a;
        },
      },
      isViewportUnconstrained: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.l = a;
        },
      },
      isAnimating: {
        get: function () {
          return this.hc;
        },
      },
    });
    yh.prototype.getTemporaryState = yh.prototype.Jz;
    yh.prototype.stop = yh.prototype.stop;
    yh.prototype.add = yh.prototype.add;
    yh.prototype.addTemporaryPart = yh.prototype.Ny;
    function Uh(a, b, c, d) {
      a /= d / 2;
      return 1 > a ? (c / 2) * a * a + b : (-c / 2) * (--a * (a - 2) - 1) + b;
    }
    function Wh(a, b, c, d) {
      return a === d ? b + c : c * (-Math.pow(2, (-10 * a) / d) + 1) + b;
    }
    yh.className = 'Animation';
    yh.EaseLinear = function (a, b, c, d) {
      return (c * a) / d + b;
    };
    yh.EaseInOutQuad = Uh;
    yh.EaseInQuad = function (a, b, c, d) {
      return c * (a /= d) * a + b;
    };
    yh.EaseOutQuad = function (a, b, c, d) {
      return -c * (a /= d) * (a - 2) + b;
    };
    yh.EaseInExpo = function (a, b, c, d) {
      return 0 === a ? b : c * Math.pow(2, 10 * (a / d - 1)) + b;
    };
    yh.EaseOutExpo = Wh;
    function Zh(a, b, c) {
      this.start = a;
      this.end = b;
      this.rv = {};
      this.mv = c;
      this.Xv = !1;
    }
    Zh.className = 'AnimationState';
    function $h(a, b, c) {
      this.ad = null;
      this.Ze = a;
      this.Lp = c || ai;
      this.Ik = null;
      void 0 !== b && ((this.Ik = b), void 0 === c && (this.Lp = bi));
    }
    $h.prototype.copy = function () {
      var a = new $h(this.Ze);
      a.Lp = this.Lp;
      var b = this.Ik;
      if (null !== b) {
        var c = {};
        void 0 !== b.duration && (c.Kx = b.duration);
        void 0 !== b.finished && (c.Kx = b.finished);
        void 0 !== b.easing && (c.Kx = b.easing);
        a.Ik = c;
      }
      return a;
    };
    function ci(a, b) {
      a = a.Ik;
      null !== a &&
        (a.duration && (b.duration = a.duration),
        a.finished && (b.finished = a.finished),
        a.easing && (b.easing = a.easing));
    }
    ma.Object.defineProperties($h.prototype, {
      propertyName: {
        get: function () {
          return this.Ze;
        },
        set: function (a) {
          this.Ze = a;
        },
      },
      animationSettings: {
        get: function () {
          return this.Ik;
        },
        set: function (a) {
          this.Ik = a;
        },
      },
      startCondition: {
        get: function () {
          return this.Lp;
        },
        set: function (a) {
          this.Lp = a;
        },
      },
    });
    var ai = new D($h, 'Default', 1),
      bi = new D($h, 'Immediate', 2),
      di = new D($h, 'Bundled', 3);
    $h.className = 'AnimationTrigger';
    $h.Default = ai;
    $h.Immediate = bi;
    $h.Bundled = di;
    function ei() {
      Za(this);
      this.B = null;
      this.Ca = new E();
      this.Ra = '';
      this.jb = 1;
      this.v = !1;
      this.Bi =
        this.I =
        this.ai =
        this.$h =
        this.Zh =
        this.Yh =
        this.Wh =
        this.Xh =
        this.Vh =
        this.ci =
        this.Uh =
        this.bi =
        this.Th =
        this.Sh =
          !0;
      this.l = !1;
      this.Xo = [];
    }
    t = ei.prototype;
    t.clear = function () {
      this.Ca.clear();
      this.Xo.length = 0;
    };
    t.Zd = function (a) {
      this.B = a;
    };
    t.toString = function (a) {
      void 0 === a && (a = 0);
      var b = 'Layer "' + this.name + '"';
      if (0 >= a) return b;
      for (
        var c = 0, d = 0, e = 0, f = 0, g = 0, h = this.Ca.iterator;
        h.next();
  
      ) {
        var k = h.value;
        k instanceof xf
          ? e++
          : k instanceof U
          ? d++
          : k instanceof S
          ? f++
          : k instanceof Ce
          ? g++
          : c++;
      }
      h = '';
      0 < c && (h += c + ' Parts ');
      0 < d && (h += d + ' Nodes ');
      0 < e && (h += e + ' Groups ');
      0 < f && (h += f + ' Links ');
      0 < g && (h += g + ' Adornments ');
      if (1 < a)
        for (a = this.Ca.iterator; a.next(); )
          (c = a.value),
            (h += '\n    ' + c.toString()),
            (d = c.data),
            null !== d && lb(d) && (h += ' #' + lb(d)),
            c instanceof U
              ? (h += ' ' + Ja(d))
              : c instanceof S &&
                (h += ' ' + Ja(c.fromNode) + ' ' + Ja(c.toNode));
      return b + ' ' + this.Ca.count + ': ' + h;
    };
    t.Tb = function (a, b, c) {
      void 0 === b && (b = null);
      void 0 === c && (c = null);
      if (!1 === this.Bi) return null;
      var d = !1;
      null !== this.diagram && this.diagram.viewportBounds.aa(a) && (d = !0);
      for (var e = H.alloc(), f = this.Ca.j, g = f.length; g--; ) {
        var h = f[g];
        if (
          (!0 !== d || !1 !== xg(h)) &&
          h.isVisible() &&
          (e.assign(a),
          zb(e, h.sd),
          (h = h.Tb(e, b, c)),
          null !== h &&
            (null !== b && (h = b(h)), null !== h && (null === c || c(h))))
        )
          return H.free(e), h;
      }
      H.free(e);
      return null;
    };
    t.Si = function (a, b, c, d) {
      void 0 === b && (b = null);
      void 0 === c && (c = null);
      d instanceof E || d instanceof F || (d = new F());
      if (!1 === this.Bi) return d;
      var e = !1;
      null !== this.diagram && this.diagram.viewportBounds.aa(a) && (e = !0);
      for (var f = H.alloc(), g = this.Ca.j, h = g.length; h--; ) {
        var k = g[h];
        if ((!0 !== e || !1 !== xg(k)) && k.isVisible()) {
          f.assign(a);
          zb(f, k.sd);
          var l = k;
          k.Si(f, b, c, d) &&
            (null !== b && (l = b(l)),
            null === l || (null !== c && !c(l)) || d.add(l));
        }
      }
      H.free(f);
      return d;
    };
    t.sf = function (a, b, c, d, e) {
      void 0 === b && (b = null);
      void 0 === c && (c = null);
      void 0 === d && (d = !1);
      e instanceof E || e instanceof F || (e = new F());
      if (!1 === this.Bi) return e;
      var f = !1;
      null !== this.diagram && this.diagram.viewportBounds.qf(a) && (f = !0);
      for (var g = this.Ca.j, h = g.length; h--; ) {
        var k = g[h];
        if ((!0 !== f || !1 !== xg(k)) && k.isVisible()) {
          var l = k;
          k.sf(a, b, c, d, e) &&
            (null !== b && (l = b(l)),
            null === l || (null !== c && !c(l)) || e.add(l));
        }
      }
      return e;
    };
    t.xv = function (a, b, c, d, e, f, g) {
      if (!1 === this.Bi) return e;
      for (var h = this.Ca.j, k = h.length; k--; ) {
        var l = h[k];
        if ((!0 !== g || !1 !== xg(l)) && f(l) && l.isVisible()) {
          var m = l;
          l.sf(a, b, c, d, e) &&
            (null !== b && (m = b(m)),
            null === m || (null !== c && !c(m)) || e.add(m));
        }
      }
      return e;
    };
    t.Ag = function (a, b, c, d, e, f) {
      void 0 === c && (c = null);
      void 0 === d && (d = null);
      void 0 === e && (e = !0);
      if (!1 !== e && !0 !== e) {
        if (e instanceof E || e instanceof F) f = e;
        e = !0;
      }
      f instanceof E || f instanceof F || (f = new F());
      if (!1 === this.Bi) return f;
      var g = !1;
      null !== this.diagram && this.diagram.viewportBounds.aa(a) && (g = !0);
      for (var h = H.alloc(), k = H.alloc(), l = this.Ca.j, m = l.length; m--; ) {
        var n = l[m];
        if ((!0 !== g || !1 !== xg(n)) && n.isVisible()) {
          h.assign(a);
          zb(h, n.sd);
          k.h(a.x + b, a.y);
          zb(k, n.sd);
          var p = n;
          n.Ag(h, k, c, d, e, f) &&
            (null !== c && (p = c(p)),
            null === p || (null !== d && !d(p)) || f.add(p));
        }
      }
      H.free(h);
      H.free(k);
      return f;
    };
    t.xd = function (a, b) {
      if (this.visible) {
        var c = void 0 === b ? a.viewportBounds : b;
        var d = this.Ca.j,
          e = d.length;
        a = Ea();
        b = Ea();
        for (var f = 0; f < e; f++) {
          var g = d[f];
          g.$w = f;
          (g instanceof S && !1 === g.yc) ||
            (g instanceof Ce && null !== g.adornedPart) ||
            (dc(g.actualBounds, c)
              ? (g.xd(!0), a.push(g))
              : (g.xd(!1),
                null !== g.adornments && 0 < g.adornments.count && b.push(g)));
        }
        for (c = 0; c < a.length; c++)
          for (d = a[c], fi(d), d = d.adornments; d.next(); )
            (e = d.value), e.measure(Infinity, Infinity), e.arrange(), e.xd(!0);
        for (c = 0; c < b.length; c++)
          (d = b[c]), d.updateAdornments(), gi(d, !0);
        Ha(a);
        Ha(b);
      }
    };
    function hi(a, b) {
      var c = 1;
      1 !== a.jb && ((c = b.globalAlpha), (b.globalAlpha = c * a.jb));
      return c;
    }
    t.tb = function (a, b, c) {
      if (
        this.visible &&
        0 !== this.jb &&
        (void 0 === c && (c = !0), c || !this.isTemporary)
      ) {
        c = this.Ca.j;
        var d = c.length;
        if (0 !== d) {
          var e = hi(this, a),
            f = this.Xo;
          f.length = 0;
          for (var g = b.scale, h = 0; h < d; h++) {
            var k = c[h];
            if (xg(k)) {
              if (k instanceof S && (k.isOrthogonal && f.push(k), !1 === k.yc))
                continue;
              var l = k.actualBounds;
              l.width * g > b.Md || l.height * g > b.Md ? k.tb(a, b) : ii(a, k);
            }
          }
          a.globalAlpha = e;
        }
      }
    };
    function ii(a, b) {
      var c = b.actualBounds,
        d = b.naturalBounds;
      if (
        0 !== c.width &&
        0 !== c.height &&
        !isNaN(c.x) &&
        !isNaN(c.y) &&
        b.isVisible()
      ) {
        var e = b.transform;
        null !== b.areaBackground &&
          (ji(b, a, b.areaBackground, !0, !0, d, c),
          a.fillRect(c.x, c.y, c.width, c.height));
        null === b.areaBackground &&
          null === b.background &&
          (ji(b, a, 'rgba(0,0,0,0.3)', !0, !1, d, c),
          a.fillRect(c.x, c.y, c.width, c.height));
        null !== b.background &&
          (a.transform(e.m11, e.m12, e.m21, e.m22, e.dx, e.dy),
          ji(b, a, b.background, !0, !1, d, c),
          a.fillRect(0, 0, d.width / 2, d.height / 2),
          e.ut() ||
            ((b = 1 / (e.m11 * e.m22 - e.m12 * e.m21)),
            a.transform(
              e.m22 * b,
              -e.m12 * b,
              -e.m21 * b,
              e.m11 * b,
              b * (e.m21 * e.dy - e.m22 * e.dx),
              b * (e.m12 * e.dx - e.m11 * e.dy),
            )));
      }
    }
    t.g = function (a, b, c, d, e) {
      var f = this.diagram;
      null !== f && f.Ya(qe, a, this, b, c, d, e);
    };
    t.$i = function (a, b, c) {
      var d = this.Ca;
      b.ui = this;
      if (a >= d.count) a = d.count;
      else if (d.L(a) === b) return -1;
      d.Lb(a, b);
      b.qq(c);
      d = this.diagram;
      null !== d && (c ? d.N() : d.$i(b));
      ki(this, a, b);
      return a;
    };
    t.Ec = function (a, b, c) {
      if (!c && b.layer !== this && null !== b.layer) return b.layer.Ec(a, b, c);
      var d = this.Ca;
      if (0 > a || a >= d.length) {
        if (((a = d.indexOf(b)), 0 > a)) return -1;
      } else if (d.L(a) !== b && ((a = d.indexOf(b)), 0 > a)) return -1;
      b.rq(c);
      d.mb(a);
      d = this.diagram;
      null !== d && (c ? d.N() : d.Ec(b));
      b.ui = null;
      return a;
    };
    function ki(a, b, c) {
      b = li(a, b, c);
      if (c instanceof xf && null !== c && isNaN(c.zOrder)) {
        if (0 !== c.memberParts.count) {
          for (var d = -1, e = a.Ca.j, f = e.length, g = 0; g < f; g++) {
            var h = e[g];
            if (h === c && ((b = g), 0 <= d)) break;
            if (0 > d && h.containingGroup === c && ((d = g), 0 <= b)) break;
          }
          !(0 > d) && d < b && ((e = a.Ca), e.mb(b), e.Lb(d, c));
        }
        c = c.containingGroup;
        null !== c && ki(a, -1, c);
      }
    }
    function li(a, b, c) {
      var d = c.zOrder;
      if (isNaN(d)) return b;
      a = a.Ca;
      var e = a.count;
      if (1 >= e) return b;
      0 > b && (b = a.indexOf(c));
      if (0 > b) return -1;
      for (var f = b - 1, g = NaN; 0 <= f; ) {
        g = a.L(f).zOrder;
        if (!isNaN(g)) break;
        f--;
      }
      for (var h = b + 1, k = NaN; h < e; ) {
        k = a.L(h).zOrder;
        if (!isNaN(k)) break;
        h++;
      }
      if (!isNaN(g) && g > d)
        for (;;) {
          if (-1 === f || g <= d) {
            f++;
            if (f === b) break;
            a.mb(b);
            a.Lb(f, c);
            return f;
          }
          for (g = NaN; 0 <= --f && ((g = a.L(f).zOrder), isNaN(g)); );
        }
      else if (!isNaN(k) && k < d)
        for (;;) {
          if (h === e || k >= d) {
            h--;
            if (h === b) break;
            a.mb(b);
            a.Lb(h, c);
            return h;
          }
          for (k = NaN; ++h < e && ((k = a.L(h).zOrder), isNaN(k)); );
        }
      return b;
    }
    ma.Object.defineProperties(ei.prototype, {
      parts: {
        get: function () {
          return this.Ca.iterator;
        },
      },
      partsBackwards: {
        get: function () {
          return this.Ca.iteratorBackwards;
        },
      },
      diagram: {
        get: function () {
          return this.B;
        },
      },
      name: {
        get: function () {
          return this.Ra;
        },
        set: function (a) {
          var b = this.Ra;
          if (b !== a) {
            var c = this.diagram;
            if (null !== c)
              for (
                '' === b && B('Cannot rename default Layer to: ' + a),
                  c = c.layers;
                c.next();
  
              )
                c.value.name === a &&
                  B('Layer.name is already present in this diagram: ' + a);
            this.Ra = a;
            this.g('name', b, a);
            for (a = this.Ca.iterator; a.next(); ) a.value.layerName = this.Ra;
          }
        },
      },
      opacity: {
        get: function () {
          return this.jb;
        },
        set: function (a) {
          var b = this.jb;
          b !== a &&
            ((0 > a || 1 < a) && va(a, '0 <= value <= 1', ei, 'opacity'),
            (this.jb = a),
            this.g('opacity', b, a),
            (a = this.diagram),
            null !== a && a.N());
        },
      },
      isTemporary: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          var b = this.v;
          b !== a && ((this.v = a), this.g('isTemporary', b, a));
        },
      },
      visible: {
        get: function () {
          return this.I;
        },
        set: function (a) {
          var b = this.I;
          if (b !== a) {
            this.I = a;
            this.g('visible', b, a);
            for (b = this.Ca.iterator; b.next(); ) b.value.Ob(a);
            a = this.diagram;
            null !== a && a.N();
          }
        },
      },
      pickable: {
        get: function () {
          return this.Bi;
        },
        set: function (a) {
          var b = this.Bi;
          b !== a && ((this.Bi = a), this.g('pickable', b, a));
        },
      },
      isBoundsIncluded: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.l !== a &&
            ((this.l = a), null !== this.diagram && this.diagram.Na());
        },
      },
      allowCopy: {
        get: function () {
          return this.Sh;
        },
        set: function (a) {
          var b = this.Sh;
          b !== a && ((this.Sh = a), this.g('allowCopy', b, a));
        },
      },
      allowDelete: {
        get: function () {
          return this.Th;
        },
        set: function (a) {
          var b = this.Th;
          b !== a && ((this.Th = a), this.g('allowDelete', b, a));
        },
      },
      allowTextEdit: {
        get: function () {
          return this.bi;
        },
        set: function (a) {
          var b = this.bi;
          b !== a && ((this.bi = a), this.g('allowTextEdit', b, a));
        },
      },
      allowGroup: {
        get: function () {
          return this.Uh;
        },
        set: function (a) {
          var b = this.Uh;
          b !== a && ((this.Uh = a), this.g('allowGroup', b, a));
        },
      },
      allowUngroup: {
        get: function () {
          return this.ci;
        },
        set: function (a) {
          var b = this.ci;
          b !== a && ((this.ci = a), this.g('allowUngroup', b, a));
        },
      },
      allowLink: {
        get: function () {
          return this.Vh;
        },
        set: function (a) {
          var b = this.Vh;
          b !== a && ((this.Vh = a), this.g('allowLink', b, a));
        },
      },
      allowRelink: {
        get: function () {
          return this.Xh;
        },
        set: function (a) {
          var b = this.Xh;
          b !== a && ((this.Xh = a), this.g('allowRelink', b, a));
        },
      },
      allowMove: {
        get: function () {
          return this.Wh;
        },
        set: function (a) {
          var b = this.Wh;
          b !== a && ((this.Wh = a), this.g('allowMove', b, a));
        },
      },
      allowReshape: {
        get: function () {
          return this.Yh;
        },
        set: function (a) {
          var b = this.Yh;
          b !== a && ((this.Yh = a), this.g('allowReshape', b, a));
        },
      },
      allowResize: {
        get: function () {
          return this.Zh;
        },
        set: function (a) {
          var b = this.Zh;
          b !== a && ((this.Zh = a), this.g('allowResize', b, a));
        },
      },
      allowRotate: {
        get: function () {
          return this.$h;
        },
        set: function (a) {
          var b = this.$h;
          b !== a && ((this.$h = a), this.g('allowRotate', b, a));
        },
      },
      allowSelect: {
        get: function () {
          return this.ai;
        },
        set: function (a) {
          var b = this.ai;
          b !== a && ((this.ai = a), this.g('allowSelect', b, a));
        },
      },
    });
    ei.prototype.findObjectsNear = ei.prototype.Ag;
    ei.prototype.findObjectsIn = ei.prototype.sf;
    ei.prototype.findObjectsAt = ei.prototype.Si;
    ei.prototype.findObjectAt = ei.prototype.Tb;
    ei.className = 'Layer';
    function R(a) {
      function b() {
        c.removeEventListener(x.document, 'DOMContentLoaded', b, !1);
        c.setRTL();
      }
      1 < arguments.length &&
        B(
          'Diagram constructor can only take one optional argument, the DIV HTML element or its id.',
        );
      mi || (ni(), (mi = !0));
      Za(this);
      ye = this;
      Qa = [];
      this.Gb = !0;
      this.Hc = new uh();
      this.Hc.Zd(this);
      this.kb = 17;
      this.ol = this.Pu = !1;
      this.ys = 'default';
      this.Fa = null;
      var c = this;
      Vg &&
        (null !== x.document.body
          ? this.setRTL()
          : c.addEventListener(x.document, 'DOMContentLoaded', b, !1));
      this.Ia = new E();
      this.ua = this.va = 0;
      this.Ba = null;
      this.lx = new G();
      this.$e = this.Wc = null;
      this.dw();
      this.vj = null;
      this.cw();
      this.jb = 1;
      this.ma = new H(NaN, NaN).freeze();
      this.Nu = new H(NaN, NaN);
      this.yn = this.ya = 1;
      this.Kr = new H(NaN, NaN).freeze();
      this.Lr = NaN;
      this.ds = 1e-4;
      this.bs = 100;
      this.lb = new rd();
      this.Zs = new H(NaN, NaN).freeze();
      this.Fr = new N(NaN, NaN, NaN, NaN).freeze();
      this.Fi = new oc(0, 0, 0, 0).freeze();
      this.Gi = Vh;
      this.Gs = !1;
      this.zs = this.us = null;
      this.Lg = oi;
      this.lj = Zc;
      this.Wf = oi;
      this.Xn = Zc;
      this.Mr = this.Jr = vc;
      this.gc = !0;
      this.ml = !1;
      this.ld = new F();
      this.Sg = new G();
      this.Yk = !0;
      this.$m = 250;
      this.jj = -1;
      this.bn = new oc(16, 16, 16, 16).freeze();
      this.pj = this.Pc = !1;
      this.sj = !0;
      this.Tf = new me();
      this.Tf.diagram = this;
      this.Qd = new me();
      this.Qd.diagram = this;
      this.eh = new me();
      this.eh.diagram = this;
      this.qe = this.Lf = null;
      this.Pj = !1;
      this.ur = this.vr = null;
      this.Wm =
        x.PointerEvent &&
        (Ta || Ua || Va) &&
        x.navigator &&
        !1 !== x.navigator.msPointerEnabled;
      pi(this);
      this.Ah = new F();
      this.Ur = !0;
      this.Us = qi;
      this.uu = !1;
      this.Ws = Of;
      this.v = null;
      ri.add('Model', yi);
      this.nr = this.rr = this.Ss = null;
      this.xn = this.lr = 'auto';
      this.eg =
        this.gs =
        this.gg =
        this.hg =
        this.jg =
        this.Nf =
        this.Rf =
        this.Mf =
          null;
      this.Ir = !1;
      this.Of = this.ug = this.ig = this.fg = null;
      this.hs = !1;
      this.ss = {};
      this.Kj = [null, null];
      this.fr = null;
      this.sr = this.Ks = this.Ru = this.sg = !1;
      this.yu = !0;
      this.ni = this.Qb = !1;
      this.bc = null;
      var d = this;
      this.I = function (a) {
        var b = d.partManager;
        if (a.model === b.diagram.model && b.diagram.Z) {
          b.diagram.Z = !1;
          try {
            var c = a.change;
            '' === a.modelChange &&
              c === qe &&
              b.updateDataBindings(a.object, a.propertyName);
          } finally {
            b.diagram.Z = !0;
          }
        }
      };
      this.Y = function (a) {
        d.partManager.doModelChanged(a);
      };
      this.av = !0;
      this.Gd = -2;
      this.Ci = new G();
      this.rs = new E();
      this.Yf = !1;
      this.Th = this.Sh = this.Tq = this.Kc = !0;
      this.Uq = !1;
      this.$q =
        this.Yq =
        this.ai =
        this.$h =
        this.Zh =
        this.Yh =
        this.Wh =
        this.Xh =
        this.Vh =
        this.Xq =
        this.ci =
        this.Uh =
        this.bi =
        this.Vq =
          !0;
      this.Xf = this.wu = !1;
      this.Zq = this.Wq = this.el = this.dl = !0;
      this.Fs = this.Bs = 16;
      this.As = this.tp = !1;
      this.vp = this.Ds = null;
      this.Cs = this.Es = 0;
      this.ab = new oc(5).freeze();
      this.Qu = new F().freeze();
      this.cs = 999999999;
      this.ru = new F().freeze();
      this.bh = this.mi = this.li = !0;
      this.Qe = this.je = !1;
      this.ic = null;
      this.Hf = !0;
      this.ke = !1;
      this.ax = new F();
      this.su = new F();
      this.Hb = null;
      this.Dl = 1;
      this.Su = 0;
      this.Sd = { scale: 1, position: new H(), bounds: new N(), Mv: !1 };
      this.$u = new N(NaN, NaN, NaN, NaN).freeze();
      this.$l = new L(NaN, NaN).freeze();
      this.zn = new N(NaN, NaN, NaN, NaN).freeze();
      this.Vr = !1;
      this.qo =
        this.Vn =
        this.Qo =
        this.fu =
        this.eu =
        this.gu =
        this.$f =
        this.ah =
        this.We =
        this.yr =
          null;
      zi(this);
      this.Fb = null;
      this.Un = !1;
      this.mj = null;
      this.partManager = new yi();
      this.toolManager = new Oa();
      this.toolManager.initializeStandardTools();
      this.currentTool = this.defaultTool = this.toolManager;
      this.xr = null;
      this.Rk = new Qe();
      this.ns = this.ms = null;
      this.Np = !1;
      this.commandHandler = Ai();
      this.model = Bi();
      this.sg = !0;
      Ci(this);
      this.layout = new Di();
      this.sg = !1;
      this.Uw = this.ju = null;
      this.Rb = 1;
      this.vh = null;
      this.Md = 1;
      this.Ho = 0;
      this.Io = [0, 0, 0, 0, 0];
      this.Jo = 0;
      this.md = 1;
      this.Aj = 0;
      this.lo = new H();
      this.Ts = 500;
      this.an = new H();
      this.le = !1;
      this.preventDefault =
        this.Ht =
        this.vm =
        this.wm =
        this.um =
        this.tm =
        this.sk =
        this.uk =
        this.tk =
        this.qk =
        this.rk =
        this.yw =
        this.qw =
        this.rw =
        this.sw =
        this.oh =
        this.Il =
        this.nh =
        this.Hl =
          null;
      this.$n = !1;
      this.ki = new Ei();
      this.Op = !1;
      void 0 !== a && Fi(this, a);
      this.In = null;
      this.Jn = Jb;
      this.Gb = !1;
    }
    R.prototype.clear = function () {
      this.animationManager.Uc();
      this.model.clear();
      Gi = null;
      Hi = '';
      Ii(this, !1);
      this.Na();
      Ji(this);
      this.N();
    };
    function Ii(a, b) {
      a.animationManager.Uc(!0);
      a.Qu = new F().freeze();
      a.ru = new F().freeze();
      var c = a.skipsUndoManager;
      null !== a.model && (a.skipsUndoManager = !0);
      var d = null;
      null !== a.Fb && ((d = a.Fb.part), null !== d && a.remove(d));
      var e = [],
        f = a.Ia.length;
      if (b) {
        for (b = 0; b < f; b++)
          for (var g = a.Ia.j[b].parts; g.next(); ) {
            var h = g.value;
            h !== d && null === h.data && e.push(h);
          }
        for (b = 0; b < e.length; b++) a.remove(e[b]);
      }
      for (b = 0; b < f; b++) a.Ia.j[b].clear();
      a.partManager.clear();
      a.ld.clear();
      a.Sg.clear();
      a.Ah.clear();
      a.mj = null;
      Ga = [];
      null !== d && (a.add(d), a.partManager.parts.remove(d));
      null !== a.model && (a.skipsUndoManager = c);
      return e;
    }
    function Ai() {
      return null;
    }
    R.prototype.reset = function () {
      this.clear();
      this.Gb = !0;
      this.Hc = new uh();
      this.Hc.Zd(this);
      this.kb = 17;
      this.ol = this.Pu = !1;
      this.ys = 'default';
      this.Ia = new E();
      this.lx = new G();
      this.$e = null;
      this.dw();
      this.vj = null;
      this.cw();
      this.jb = 1;
      this.ma = new H(NaN, NaN).freeze();
      this.Nu = new H(NaN, NaN);
      this.yn = this.ya = 1;
      this.Kr = new H(NaN, NaN).freeze();
      this.Lr = NaN;
      this.ds = 1e-4;
      this.bs = 100;
      this.lb = new rd();
      this.Zs = new H(NaN, NaN).freeze();
      this.Fr = new N(NaN, NaN, NaN, NaN).freeze();
      this.Fi = new oc(0, 0, 0, 0).freeze();
      this.Gi = Vh;
      this.Gs = !1;
      this.zs = this.us = null;
      this.Lg = oi;
      this.lj = Zc;
      this.Wf = oi;
      this.Xn = Zc;
      this.Mr = this.Jr = vc;
      this.gc = !0;
      this.ml = !1;
      this.ld = new F();
      this.Sg = new G();
      this.Yk = !0;
      this.$m = 250;
      this.jj = -1;
      this.bn = new oc(16, 16, 16, 16).freeze();
      this.pj = this.Pc = !1;
      this.sj = !0;
      this.Tf = new me();
      this.Tf.diagram = this;
      this.Qd = new me();
      this.Qd.diagram = this;
      this.eh = new me();
      this.eh.diagram = this;
      this.qe = this.Lf = null;
      this.Pj = !1;
      this.ur = this.vr = null;
      this.Wm =
        x.PointerEvent &&
        (Ta || Ua || Va) &&
        x.navigator &&
        !1 !== x.navigator.msPointerEnabled;
      pi(this);
      this.Ah = new F();
      this.Ur = !0;
      this.Us = qi;
      this.uu = !1;
      this.Ws = Of;
      this.nr = this.rr = this.Ss = null;
      this.xn = this.lr = 'auto';
      this.eg =
        this.gs =
        this.gg =
        this.hg =
        this.jg =
        this.Nf =
        this.Rf =
        this.Mf =
          null;
      this.Ir = !1;
      this.Of = this.ug = this.ig = this.fg = null;
      this.hs = !1;
      this.ss = {};
      this.Kj = [null, null];
      this.fr = null;
      this.sr = this.Ks = this.Ru = this.sg = !1;
      this.yu = !0;
      this.ni = this.Qb = !1;
      this.av = !0;
      this.Gd = -2;
      this.Ci = new G();
      this.rs = new E();
      this.Yf = !1;
      this.Th = this.Sh = this.Tq = this.Kc = !0;
      this.Uq = !1;
      this.$q =
        this.Yq =
        this.ai =
        this.$h =
        this.Zh =
        this.Yh =
        this.Wh =
        this.Xh =
        this.Vh =
        this.Xq =
        this.ci =
        this.Uh =
        this.bi =
        this.Vq =
          !0;
      this.Xf = this.wu = !1;
      this.Zq = this.Wq = this.el = this.dl = !0;
      this.Fs = this.Bs = 16;
      this.As = this.tp = !1;
      this.Cs = this.Es = 0;
      this.ab = new oc(5).freeze();
      this.Qu = new F().freeze();
      this.cs = 999999999;
      this.ru = new F().freeze();
      this.bh = this.mi = this.li = !0;
      this.Qe = this.je = !1;
      this.ic = null;
      this.Hf = !0;
      this.ke = !1;
      this.ax = new F();
      this.su = new F();
      this.Hb = null;
      this.Dl = 1;
      this.Su = 0;
      this.Sd = { scale: 1, position: new H(), bounds: new N(), Mv: !1 };
      this.$u = new N(NaN, NaN, NaN, NaN).freeze();
      this.$l = new L(NaN, NaN).freeze();
      this.zn = new N(NaN, NaN, NaN, NaN).freeze();
      this.Vr = !1;
      this.qo =
        this.Vn =
        this.Qo =
        this.fu =
        this.eu =
        this.gu =
        this.$f =
        this.ah =
        this.We =
          null;
      zi(this);
      this.Fb = null;
      this.Un = !1;
      this.mj = null;
      this.partManager = new yi();
      this.toolManager = new Oa();
      this.toolManager.initializeStandardTools();
      this.currentTool = this.defaultTool = this.toolManager;
      this.xr = null;
      this.Rk = new Qe();
      this.ns = this.ms = null;
      this.Np = !1;
      this.commandHandler = Ai();
      this.sg = !0;
      Ci(this);
      this.layout = new Di();
      this.sg = !1;
      this.model = Bi();
      this.model.undoManager = new ve();
      this.ke = !1;
      this.sj = !0;
      this.Pc = !1;
      this.Rb = 1;
      this.vh = null;
      this.Md = 1;
      this.Ho = 0;
      this.Io = [0, 0, 0, 0, 0];
      this.Jo = 0;
      this.md = 1;
      this.Aj = 0;
      this.lo = new H();
      this.Ts = 500;
      this.an = new H();
      this.le = !1;
      this.oh = this.Il = this.nh = this.Hl = null;
      this.Op = this.$n = !1;
      this.In = null;
      this.Jn = Jb;
      this.Gb = !1;
      this.N();
    };
    function zi(a) {
      a.We = new G();
      var b = new U(),
        c = new Xg();
      c.bind(new Ki('text', '', Ja));
      b.add(c);
      a.gu = b;
      a.We.add('', b);
      b = new U();
      c = new Xg();
      c.stroke = 'brown';
      c.bind(new Ki('text', '', Ja));
      b.add(c);
      a.We.add('Comment', b);
      b = new U();
      b.selectable = !1;
      b.avoidable = !1;
      c = new W();
      c.figure = 'Ellipse';
      c.fill = 'black';
      c.stroke = null;
      c.desiredSize = new L(3, 3).ca();
      b.add(c);
      a.We.add('LinkLabel', b);
      a.ah = new G();
      b = new xf();
      b.selectionObjectName = 'GROUPPANEL';
      b.type = X.Vertical;
      c = new Xg();
      c.font = 'bold 12pt sans-serif';
      c.bind(new Ki('text', '', Ja));
      b.add(c);
      c = new X(X.Auto);
      c.name = 'GROUPPANEL';
      var d = new W();
      d.figure = 'Rectangle';
      d.fill = 'rgba(128,128,128,0.2)';
      d.stroke = 'black';
      c.add(d);
      d = new yg();
      d.padding = new oc(5, 5, 5, 5).ca();
      c.add(d);
      b.add(c);
      a.eu = b;
      a.ah.add('', b);
      a.$f = new G();
      b = new S();
      c = new W();
      c.isPanelMain = !0;
      b.add(c);
      c = new W();
      c.toArrow = 'Standard';
      c.fill = 'black';
      c.stroke = null;
      c.strokeWidth = 0;
      b.add(c);
      a.fu = b;
      a.$f.add('', b);
      b = new S();
      c = new W();
      c.isPanelMain = !0;
      c.stroke = 'brown';
      b.add(c);
      a.$f.add('Comment', b);
      b = new Ce();
      b.type = X.Auto;
      c = new W();
      c.fill = null;
      c.stroke = 'dodgerblue';
      c.strokeWidth = 3;
      b.add(c);
      c = new yg();
      c.margin = new oc(1.5, 1.5, 1.5, 1.5).ca();
      b.add(c);
      a.Qo = b;
      a.Vn = b;
      b = new Ce();
      b.type = X.Link;
      c = new W();
      c.isPanelMain = !0;
      c.fill = null;
      c.stroke = 'dodgerblue';
      c.strokeWidth = 3;
      b.add(c);
      a.qo = b;
    }
    R.prototype.setRTL = function (a) {
      a = void 0 === a ? this.div : a;
      null === a && (a = x.document.body);
      var b = ta('div');
      b.dir = 'rtl';
      b.style.cssText =
        'font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;';
      b.textContent = 'A';
      a.appendChild(b);
      var c = 'reverse';
      0 < b.scrollLeft
        ? (c = 'default')
        : ((b.scrollLeft = 1), 0 === b.scrollLeft && (c = 'negative'));
      a.removeChild(b);
      this.ys = c;
    };
    R.prototype.setScrollWidth = function (a) {
      a = void 0 === a ? this.div : a;
      null === a && (a = x.document.body);
      var b = 0;
      if (Vg) {
        var c = Li;
        b = Mi;
        null === c &&
          ((c = Li = ta('p')),
          (c.style.width = '100%'),
          (c.style.height = '200px'),
          (c.style.boxSizing = 'content-box'),
          (b = Mi = ta('div')),
          (b.style.position = 'absolute'),
          (b.style.visibility = 'hidden'),
          (b.style.width = '200px'),
          (b.style.height = '150px'),
          (b.style.boxSizing = 'content-box'),
          b.appendChild(c));
        b.style.overflow = 'hidden';
        a.appendChild(b);
        var d = c.offsetWidth;
        b.style.overflow = 'scroll';
        c = c.offsetWidth;
        d === c && (c = b.clientWidth);
        a.removeChild(b);
        b = d - c;
        0 !== b || Xa || (b = 11);
      }
      this.kb = b;
      this.Pu = !0;
    };
    R.prototype.bb = function (a) {
      a.classType === R && (this.autoScale = a);
    };
    R.prototype.toString = function (a) {
      void 0 === a && (a = 0);
      var b = '';
      this.div && this.div.id && (b = this.div.id);
      b = 'Diagram "' + b + '"';
      if (0 >= a) return b;
      for (var c = this.Ia.iterator; c.next(); )
        b += '\n  ' + c.value.toString(a - 1);
      return b;
    };
    R.prototype.addEventListener = function (a, b, c, d) {
      a.addEventListener(b, c, d);
    };
    R.prototype.removeEventListener = function (a, b, c, d) {
      a.removeEventListener(b, c, d);
    };
    function Ni(a) {
      var b = a.Ba.Da;
      b instanceof HTMLCanvasElement &&
        (a.Wm
          ? (a.addEventListener(b, 'pointerdown', a.tm, !1),
            a.addEventListener(b, 'pointermove', a.um, !1),
            a.addEventListener(b, 'pointerup', a.wm, !1),
            a.addEventListener(b, 'pointerout', a.vm, !1))
          : (a.addEventListener(b, 'touchstart', a.sw, !1),
            a.addEventListener(b, 'touchmove', a.rw, !1),
            a.addEventListener(b, 'touchend', a.qw, !1),
            a.addEventListener(b, 'mousemove', a.rk, !1),
            a.addEventListener(b, 'mousedown', a.qk, !1),
            a.addEventListener(b, 'mouseup', a.tk, !1),
            a.addEventListener(b, 'mouseout', a.sk, !1)),
        a.addEventListener(b, 'mouseenter', a.fz, !1),
        a.addEventListener(b, 'mouseleave', a.gz, !1),
        a.addEventListener(b, 'wheel', a.uk, !1),
        a.addEventListener(b, 'keydown', a.Zz, !1),
        a.addEventListener(b, 'keyup', a.$z, !1),
        a.addEventListener(b, 'blur', a.Ty, !1),
        a.addEventListener(b, 'focus', a.Uy, !1),
        a.addEventListener(
          b,
          'selectstart',
          function (a) {
            a.preventDefault();
            return !1;
          },
          !1,
        ),
        a.addEventListener(
          b,
          'contextmenu',
          function (a) {
            a.preventDefault();
            return !1;
          },
          !1,
        ),
        a.addEventListener(
          b,
          'gesturestart',
          function (b) {
            a.toolManager.gestureBehavior !== Le &&
              (a.toolManager.gestureBehavior === Ke
                ? b.preventDefault()
                : (a.le && a.lastInput.handled) ||
                  (b.preventDefault(),
                  (a.Dl = a.scale),
                  a.currentTool.doCancel()));
          },
          !1,
        ),
        a.addEventListener(
          b,
          'gesturechange',
          function (b) {
            if (a.toolManager.gestureBehavior !== Le)
              if (a.toolManager.gestureBehavior === Ke) b.preventDefault();
              else if (!a.le || !a.lastInput.handled) {
                b.preventDefault();
                var c = b.scale;
                if (null !== a.Dl) {
                  var e = a.Ba.getBoundingClientRect();
                  b = new H(
                    b.pageX - window.scrollX - (a.va / e.width) * e.left,
                    b.pageY - window.scrollY - (a.ua / e.height) * e.top,
                  );
                  c = a.Dl * c;
                  e = a.commandHandler;
                  if (c !== a.scale && e.canResetZoom(c)) {
                    var f = a.zoomPoint;
                    a.zoomPoint = b;
                    e.resetZoom(c);
                    a.zoomPoint = f;
                  }
                }
              }
          },
          !1,
        ),
        a.addEventListener(x, 'resize', a.yw, !1));
    }
    function Ue(a) {
      30 < a.Ho && (a.vh = 1);
    }
    function kf(a, b) {
      null !== a.vh &&
        ((a.vh = null),
        b && a.Ht(),
        (a.Ho = 0),
        (a.Io = [0, 0, 0, 0, 0]),
        (a.Jo = 0));
    }
    R.prototype.computePixelRatio = function () {
      return null !== this.vh ? this.vh : x.devicePixelRatio || 1;
    };
    R.prototype.doMouseMove = function () {
      this.currentTool.doMouseMove();
    };
    R.prototype.doMouseDown = function () {
      this.currentTool.doMouseDown();
    };
    R.prototype.doMouseUp = function () {
      this.currentTool.doMouseUp();
    };
    R.prototype.doMouseWheel = function () {
      this.currentTool.doMouseWheel();
    };
    R.prototype.doKeyDown = function () {
      this.currentTool.doKeyDown();
    };
    R.prototype.doKeyUp = function () {
      this.currentTool.doKeyUp();
    };
    R.prototype.doFocus = function () {
      this.focus();
    };
    R.prototype.focus = function () {
      if (this.Ba)
        if (this.scrollsPageOnFocus) this.Ba.focus();
        else {
          var a = x.scrollX || x.pageXOffset,
            b = x.scrollY || x.pageYOffset;
          this.Ba.focus();
          x.scrollTo(a, b);
        }
    };
    R.prototype.Uy = function () {
      this.B.R('GainedFocus');
    };
    R.prototype.Ty = function () {
      this.B.R('LostFocus');
    };
    function Eh(a) {
      if (null !== a.Ba) {
        var b = a.Fa;
        if (0 !== b.clientWidth && 0 !== b.clientHeight) {
          a.Pu || a.setScrollWidth();
          var c = a.Qe ? a.kb : 0,
            d = a.je ? a.kb : 0,
            e = a.Rb;
          a.Rb = a.computePixelRatio();
          a.Rb !== e && ((a.ml = !0), a.Yb());
          if (b.clientWidth !== a.va + c || b.clientHeight !== a.ua + d)
            (a.mi = !0),
              (a.gc = !0),
              (b = a.layout),
              null !== b &&
                b.isViewportSized &&
                a.autoScale === oi &&
                ((a.pj = !0), b.C()),
              a.Qb || a.Yb();
        }
      }
    }
    function Ci(a) {
      var b = new ei();
      b.name = 'Background';
      a.am(b);
      b = new ei();
      b.name = '';
      a.am(b);
      b = new ei();
      b.name = 'Foreground';
      a.am(b);
      b = new ei();
      b.name = 'Adornment';
      b.isTemporary = !0;
      a.am(b);
      b = new ei();
      b.name = 'Tool';
      b.isTemporary = !0;
      b.isBoundsIncluded = !0;
      a.am(b);
      b = new ei();
      b.name = 'Grid';
      b.allowSelect = !1;
      b.pickable = !1;
      b.isTemporary = !0;
      a.vx(b, a.jm('Background'));
    }
    function Oi(a) {
      a.Fb = new X(X.Grid);
      a.Fb.name = 'GRID';
      var b = new W();
      b.figure = 'LineH';
      b.stroke = 'lightgray';
      b.strokeWidth = 0.5;
      b.interval = 1;
      a.Fb.add(b);
      b = new W();
      b.figure = 'LineH';
      b.stroke = 'gray';
      b.strokeWidth = 0.5;
      b.interval = 5;
      a.Fb.add(b);
      b = new W();
      b.figure = 'LineH';
      b.stroke = 'gray';
      b.strokeWidth = 1;
      b.interval = 10;
      a.Fb.add(b);
      b = new W();
      b.figure = 'LineV';
      b.stroke = 'lightgray';
      b.strokeWidth = 0.5;
      b.interval = 1;
      a.Fb.add(b);
      b = new W();
      b.figure = 'LineV';
      b.stroke = 'gray';
      b.strokeWidth = 0.5;
      b.interval = 5;
      a.Fb.add(b);
      b = new W();
      b.figure = 'LineV';
      b.stroke = 'gray';
      b.strokeWidth = 1;
      b.interval = 10;
      a.Fb.add(b);
      b = new T();
      b.add(a.Fb);
      b.layerName = 'Grid';
      b.zOrder = 0;
      b.isInDocumentBounds = !1;
      b.isAnimated = !1;
      b.pickable = !1;
      b.locationObjectName = 'GRID';
      a.add(b);
      a.partManager.parts.remove(b);
      a.Fb.visible = !1;
    }
    function Pi() {
      this.B.As
        ? (this.B.As = !1)
        : this.B.isEnabled
        ? this.B.Hx(this)
        : Qi(this.B);
    }
    function Ri(a) {
      this.B.isEnabled
        ? ((this.B.Es = a.target.scrollTop), (this.B.Cs = a.target.scrollLeft))
        : Qi(this.B);
    }
    R.prototype.Hx = function (a) {
      if (null !== this.Ba) {
        this.tp = !0;
        var b = this.documentBounds,
          c = this.viewportBounds,
          d = this.Fi,
          e = b.x - d.left,
          f = b.y - d.top,
          g = b.width + d.left + d.right,
          h = b.height + d.top + d.bottom,
          k = b.right + d.right;
        d = b.bottom + d.bottom;
        var l = c.x;
        b = c.y;
        var m = c.width,
          n = c.height,
          p = c.right,
          r = c.bottom;
        c = this.scale;
        var q = a.scrollLeft;
        if (this.ol)
          switch (this.ys) {
            case 'negative':
              q = q + a.scrollWidth - a.clientWidth;
              break;
            case 'reverse':
              q = a.scrollWidth - q - a.clientWidth;
          }
        var u = q;
        m < g || n < h
          ? ((q = H.allocAt(this.position.x, this.position.y)),
            this.allowHorizontalScroll &&
              this.Cs !== u &&
              ((q.x = u / c + e), (this.Cs = u)),
            this.allowVerticalScroll &&
              this.Es !== a.scrollTop &&
              ((q.y = a.scrollTop / c + f), (this.Es = a.scrollTop)),
            (this.position = q),
            H.free(q),
            (this.mi = this.tp = !1))
          : ((q = H.alloc()),
            a.By &&
              this.allowHorizontalScroll &&
              (e < l && (this.position = q.h(u + e, this.position.y)),
              k > p &&
                (this.position = q.h(
                  -(this.Ds.scrollWidth - this.va) + u - this.va / c + k,
                  this.position.y,
                ))),
            a.Cy &&
              this.allowVerticalScroll &&
              (f < b && (this.position = q.h(this.position.x, a.scrollTop + f)),
              d > r &&
                (this.position = q.h(
                  this.position.x,
                  -(this.Ds.scrollHeight - this.ua) +
                    a.scrollTop -
                    this.ua / c +
                    d,
                ))),
            H.free(q),
            Si(this),
            (this.mi = this.tp = !1),
            (b = this.documentBounds),
            (c = this.viewportBounds),
            (k = b.right),
            (p = c.right),
            (d = b.bottom),
            (r = c.bottom),
            (e = b.x),
            (l = c.x),
            (f = b.y),
            (b = c.y),
            m >= g && e >= l && k <= p && (this.vp.style.width = '1px'),
            n >= h && f >= b && d <= r && (this.vp.style.height = '1px'));
      }
    };
    R.prototype.computeBounds = function () {
      0 < this.ld.count && Ti(this);
      return Ui(this);
    };
    function Ui(a) {
      if (a.fixedBounds.u()) {
        var b = a.fixedBounds.copy();
        b.bq(a.ab);
        return b;
      }
      for (var c = !0, d = a.Ia.j, e = d.length, f = 0; f < e; f++) {
        var g = d[f];
        if (g.visible && (!g.isTemporary || g.isBoundsIncluded)) {
          g = g.Ca.j;
          for (var h = g.length, k = 0; k < h; k++) {
            var l = g[k];
            l.isInDocumentBounds &&
              l.isVisible() &&
              ((l = l.actualBounds),
              l.u() && (c ? ((c = !1), (b = l.copy())) : b.Gc(l)));
          }
        }
      }
      c && (b = new N(0, 0, 0, 0));
      b.bq(a.ab);
      return b;
    }
    R.prototype.computePartsBounds = function (a, b) {
      void 0 === b && (b = !1);
      var c = null;
      if (Aa(a))
        for (var d = 0; d < a.length; d++) {
          var e = a[d];
          (!b && e instanceof S) ||
            (e.zb(),
            null === c ? (c = e.actualBounds.copy()) : c.Gc(e.actualBounds));
        }
      else
        for (a = a.iterator; a.next(); )
          (d = a.value),
            (!b && d instanceof S) ||
              (d.zb(),
              null === c ? (c = d.actualBounds.copy()) : c.Gc(d.actualBounds));
      return null === c ? new N(NaN, NaN, 0, 0) : c;
    };
    function Vi(a, b) {
      if ((b || a.ke) && !a.Gb && null !== a.Ba && a.documentBounds.u()) {
        if (b) {
          var c = a.initialPosition;
          if (c.u()) {
            a.position = c;
            return;
          }
          c = H.alloc();
          c.cj(a.documentBounds, a.initialDocumentSpot);
          var d = a.viewportBounds;
          d = N.allocAt(0, 0, d.width, d.height);
          var e = H.alloc();
          e.cj(d, a.initialViewportSpot);
          e.h(c.x - e.x, c.y - e.y);
          a.position = e;
          N.free(d);
          H.free(e);
          H.free(c);
        }
        a.Gb = !0;
        c = a.Lg;
        b && a.Wf !== oi && (c = a.Wf);
        d = c !== oi ? Wi(a, c) : a.scale;
        c = a.viewportBounds.copy();
        e = a.va / d;
        var f = a.ua / d,
          g = a.lj,
          h = a.Xn;
        b && !g.cb() && (h.cb() || h.Nb()) && (g = h.Nb() ? Ac : h);
        Xi(a, a.documentBounds, e, f, g, b);
        b = a.scale;
        a.scale = d;
        a.Gb = !1;
        d = a.viewportBounds;
        d.Ma(c) || a.Aq(c, d, b, !1);
        Yi(a);
        Zi(a, !0, !1);
      }
    }
    function Wi(a, b) {
      var c = a.yn;
      if (null === a.Ba) return c;
      Ji(a);
      var d = a.documentBounds;
      if (!d.u()) return c;
      var e = d.width;
      d = d.height;
      var f = a.va + (a.Qe ? a.kb : 0),
        g = a.ua + (a.je ? a.kb : 0),
        h = f / e,
        k = g / d;
      return b === $i
        ? ((b = Math.min(k, h)),
          b > c && (b = c),
          b < a.minScale && (b = a.minScale),
          b > a.maxScale && (b = a.maxScale),
          b)
        : b === aj
        ? ((b = k > h ? (g - a.kb) / d : (f - a.kb) / e),
          b > c && (b = c),
          b < a.minScale && (b = a.minScale),
          b > a.maxScale && (b = a.maxScale),
          b)
        : a.scale;
    }
    R.prototype.zoomToFit = function () {
      var a = this.Gi;
      this.Gi = Vh;
      this.scale = Wi(this, $i);
      a !== Vh &&
        (Vi(this, !1),
        Xi(
          this,
          this.documentBounds,
          this.va / this.ya,
          this.ua / this.ya,
          this.lj,
          !1,
        ));
      this.Gi = a;
    };
    t = R.prototype;
    t.GA = function (a, b) {
      void 0 === b && (b = $i);
      var c = a.width,
        d = a.height;
      if (!(0 === c || 0 === d || (isNaN(c) && isNaN(d)))) {
        var e = 1;
        if (b === $i || b === aj)
          if (isNaN(c)) e = (this.viewportBounds.height * this.scale) / d;
          else if (isNaN(d)) e = (this.viewportBounds.width * this.scale) / c;
          else {
            e = this.va;
            var f = this.ua;
            e =
              b === aj
                ? f / d > e / c
                  ? (f - (this.je ? this.kb : 0)) / d
                  : (e - (this.Qe ? this.kb : 0)) / c
                : Math.min(f / d, e / c);
          }
        this.scale = e;
        this.position = new H(a.x, a.y);
      }
    };
    t.Oy = function (a, b) {
      Ji(this);
      var c = this.documentBounds,
        d = this.viewportBounds;
      this.position = new H(
        c.x + (a.x * c.width + a.offsetX) - (b.x * d.width - b.offsetX),
        c.y + (a.y * c.height + a.offsetY) - (b.y * d.height - b.offsetY),
      );
    };
    t.Cz = function (a) {
      if (a instanceof Y) {
        this.In = a;
        var b = H.alloc();
        this.Jn = this.Mq(a.ga(vc, b));
        H.free(b);
      } else (this.In = null), (this.Jn = Jb);
    };
    function Xi(a, b, c, d, e, f) {
      var g = H.allocAt(a.ma.x, a.ma.y),
        h = g.x,
        k = g.y;
      if (null !== a.In) {
        var l = H.alloc();
        l = a.In.ga(vc, l);
        h = l.x - a.Jn.x / a.scale;
        k = l.y - a.Jn.y / a.scale;
        e = uc;
        H.free(l);
      }
      if (f || a.scrollMode === Vh)
        e.cb() &&
          (c > b.width &&
            (h = b.x + (e.x * b.width + e.offsetX) - (e.x * c - e.offsetX)),
          d > b.height &&
            (k = b.y + (e.y * b.height + e.offsetY) - (e.y * d - e.offsetY))),
          (e = a.Fi),
          (f = c - b.width),
          c < b.width + e.left + e.right
            ? ((h = Math.min(h + c / 2, b.right + Math.max(f, e.right) - c / 2)),
              (h = Math.max(h, b.left - Math.max(f, e.left) + c / 2)),
              (h -= c / 2))
            : h > b.left
            ? (h = b.left)
            : h < b.right - c && (h = b.right - c),
          (c = d - b.height),
          d < b.height + e.top + e.bottom
            ? ((k = Math.min(
                k + d / 2,
                b.bottom + Math.max(c, e.bottom) - d / 2,
              )),
              (k = Math.max(k, b.top - Math.max(c, e.top) + d / 2)),
              (k -= d / 2))
            : k > b.top
            ? (k = b.top)
            : k < b.bottom - d && (k = b.bottom - d);
      g.x = isFinite(h) ? h : -a.ab.left;
      g.y = isFinite(k) ? k : -a.ab.top;
      null !== a.positionComputation &&
        ((b = a.positionComputation(a, g)), (g.x = b.x), (g.y = b.y));
      a.Hc.jc && Oh(a.Hc, a.ma, g);
      a.ma.h(g.x, g.y);
      H.free(g);
    }
    t.km = function (a, b) {
      void 0 === b && (b = !0);
      if (b) {
        if (
          ((a = wf(
            this,
            a,
            function (a) {
              return a.part;
            },
            function (a) {
              return a.canSelect();
            },
          )),
          a instanceof T)
        )
          return a;
      } else if (
        ((a = wf(this, a, function (a) {
          return a.part;
        })),
        a instanceof T)
      )
        return a;
      return null;
    };
    t.Tb = function (a, b, c) {
      void 0 === b && (b = null);
      void 0 === c && (c = null);
      Ti(this);
      for (var d = this.Ia.iteratorBackwards; d.next(); ) {
        var e = d.value;
        if (e.visible && ((e = e.Tb(a, b, c)), null !== e)) return e;
      }
      return null;
    };
    function wf(a, b, c, d) {
      void 0 === c && (c = null);
      void 0 === d && (d = null);
      Ti(a);
      for (a = a.Ia.iteratorBackwards; a.next(); ) {
        var e = a.value;
        if (e.visible && !e.isTemporary && ((e = e.Tb(b, c, d)), null !== e))
          return e;
      }
      return null;
    }
    t.pz = function (a, b, c) {
      void 0 === b && (b = !0);
      return bj(
        this,
        a,
        function (a) {
          return a.part;
        },
        b
          ? function (a) {
              return a instanceof T && a.canSelect();
            }
          : null,
        c,
      );
    };
    function bj(a, b, c, d, e) {
      void 0 === c && (c = null);
      void 0 === d && (d = null);
      e instanceof E || e instanceof F || (e = new F());
      Ti(a);
      for (a = a.Ia.iteratorBackwards; a.next(); ) {
        var f = a.value;
        f.visible && !f.isTemporary && f.Si(b, c, d, e);
      }
      return e;
    }
    t.Si = function (a, b, c, d) {
      void 0 === b && (b = null);
      void 0 === c && (c = null);
      d instanceof E || d instanceof F || (d = new F());
      Ti(this);
      for (var e = this.Ia.iteratorBackwards; e.next(); ) {
        var f = e.value;
        f.visible && f.Si(a, b, c, d);
      }
      return d;
    };
    t.Ox = function (a, b, c, d) {
      void 0 === b && (b = !1);
      void 0 === c && (c = !0);
      return cj(
        this,
        a,
        function (a) {
          return a instanceof T && (!c || a.canSelect());
        },
        b,
        d,
      );
    };
    t.sf = function (a, b, c, d, e) {
      void 0 === b && (b = null);
      void 0 === c && (c = null);
      void 0 === d && (d = !1);
      e instanceof E || e instanceof F || (e = new F());
      Ti(this);
      for (var f = this.Ia.iteratorBackwards; f.next(); ) {
        var g = f.value;
        g.visible && g.sf(a, b, c, d, e);
      }
      return e;
    };
    t.xv = function (a, b, c, d, e, f) {
      var g = new F();
      Ti(this);
      for (var h = this.Ia.iteratorBackwards; h.next(); ) {
        var k = h.value;
        k.visible && k.xv(a, b, c, d, g, e, f);
      }
      return g;
    };
    function cj(a, b, c, d, e) {
      var f = null;
      void 0 === f && (f = null);
      void 0 === c && (c = null);
      void 0 === d && (d = !1);
      e instanceof E || e instanceof F || (e = new F());
      Ti(a);
      for (a = a.Ia.iteratorBackwards; a.next(); ) {
        var g = a.value;
        g.visible && !g.isTemporary && g.sf(b, f, c, d, e);
      }
      return e;
    }
    t.qz = function (a, b, c, d, e) {
      void 0 === c && (c = !0);
      void 0 === d && (d = !0);
      return dj(
        this,
        a,
        b,
        function (a) {
          return a instanceof T && (!d || a.canSelect());
        },
        c,
        e,
      );
    };
    t.Ag = function (a, b, c, d, e, f) {
      void 0 === c && (c = null);
      void 0 === d && (d = null);
      void 0 === e && (e = !0);
      if (!1 !== e && !0 !== e) {
        if (e instanceof E || e instanceof F) f = e;
        e = !0;
      }
      f instanceof E || f instanceof F || (f = new F());
      Ti(this);
      for (var g = this.Ia.iteratorBackwards; g.next(); ) {
        var h = g.value;
        h.visible && h.Ag(a, b, c, d, e, f);
      }
      return f;
    };
    function dj(a, b, c, d, e, f) {
      var g = null;
      void 0 === g && (g = null);
      void 0 === d && (d = null);
      void 0 === e && (e = !0);
      if (!1 !== e && !0 !== e) {
        if (e instanceof E || e instanceof F) f = e;
        e = !0;
      }
      f instanceof E || f instanceof F || (f = new F());
      Ti(a);
      for (a = a.Ia.iteratorBackwards; a.next(); ) {
        var h = a.value;
        h.visible && !h.isTemporary && h.Ag(b, c, g, d, e, f);
      }
      return f;
    }
    R.prototype.acceptEvent = function (a) {
      return ej(this, a, a instanceof MouseEvent);
    };
    function ej(a, b, c) {
      var d = a.Qd;
      a.Qd = a.eh;
      a.eh = d;
      d.diagram = a;
      d.event = b;
      c
        ? fj(a, b, d)
        : ((d.viewPoint = a.Qd.viewPoint),
          (d.documentPoint = a.Qd.documentPoint));
      a = 0;
      b.ctrlKey && (a += 1);
      b.altKey && (a += 2);
      b.shiftKey && (a += 4);
      b.metaKey && (a += 8);
      d.modifiers = a;
      d.button = b.button;
      void 0 === b.buttons || Sa || (d.buttons = b.buttons);
      Wa && 0 === b.button && b.ctrlKey && (d.button = 2);
      d.down = !1;
      d.up = !1;
      d.clickCount = 1;
      d.delta = 0;
      d.handled = !1;
      d.bubbles = !1;
      d.timestamp = b.timeStamp;
      d.isMultiTouch = !1;
      d.targetDiagram = gj(b);
      d.targetObject = null;
      return d;
    }
    function gj(a) {
      var b = a.target.B;
      if (!b) {
        var c = a.path;
        c || 'function' !== typeof a.composedPath || (c = a.composedPath());
        c && c[0] && (b = c[0].B);
      }
      return b ? b : null;
    }
    function hj(a, b, c, d) {
      var e = ij(a, b, !0, !1, !0, d);
      fj(a, c, e);
      e.targetDiagram = gj(b);
      e.targetObject = null;
      d || e.clone(a.Tf);
      return e;
    }
    function jj(a, b, c, d) {
      var e;
      d = ij(a, b, !1, !1, !1, d);
      null !== c
        ? ((e = x.document.elementFromPoint(c.clientX, c.clientY)) && e.B
            ? ((b = c), (c = e.B))
            : ((b = void 0 !== b.targetTouches ? b.targetTouches[0] : b),
              (c = a)),
          (d.targetDiagram = c),
          fj(a, b, d))
        : null !== a.Qd
        ? ((d.documentPoint = a.Qd.documentPoint),
          (d.viewPoint = a.Qd.viewPoint),
          (d.targetDiagram = a.Qd.targetDiagram))
        : null !== a.Tf &&
          ((d.documentPoint = a.Tf.documentPoint),
          (d.viewPoint = a.Tf.viewPoint),
          (d.targetDiagram = a.Tf.targetDiagram));
      d.targetObject = null;
      return d;
    }
    function ij(a, b, c, d, e, f) {
      var g = a.Qd;
      a.Qd = a.eh;
      a.eh = g;
      g.diagram = a;
      g.clickCount = 1;
      var h = (g.delta = 0);
      b.ctrlKey && (h += 1);
      b.altKey && (h += 2);
      b.shiftKey && (h += 4);
      b.metaKey && (h += 8);
      g.modifiers = h;
      g.button = 0;
      g.buttons = 1;
      g.event = b;
      g.timestamp = b.timeStamp;
      a.Wm &&
        b instanceof x.PointerEvent &&
        'touch' !== b.pointerType &&
        ((g.button = b.button),
        void 0 === b.buttons || Sa || (g.buttons = b.buttons),
        Wa && 0 === b.button && b.ctrlKey && (g.button = 2));
      g.down = c;
      g.up = d;
      g.handled = !1;
      g.bubbles = e;
      g.isMultiTouch = f;
      return g;
    }
    function kj(a, b) {
      if (a.bubbles) return !0;
      void 0 !== b.stopPropagation && b.stopPropagation();
      !1 !== b.cancelable && b.preventDefault();
      b.cancelBubble = !0;
      return !1;
    }
    R.prototype.Zz = function (a) {
      var b = this.B;
      if (!this.B.isEnabled) return !1;
      var c = ej(b, a, !1);
      c.key = String.fromCharCode(a.which);
      c.down = !0;
      switch (a.which) {
        case 8:
          c.key = 'Backspace';
          break;
        case 33:
          c.key = 'PageUp';
          break;
        case 34:
          c.key = 'PageDown';
          break;
        case 35:
          c.key = 'End';
          break;
        case 36:
          c.key = 'Home';
          break;
        case 37:
          c.key = 'Left';
          break;
        case 38:
          c.key = 'Up';
          break;
        case 39:
          c.key = 'Right';
          break;
        case 40:
          c.key = 'Down';
          break;
        case 45:
          c.key = 'Insert';
          break;
        case 46:
          c.key = 'Del';
          break;
        case 48:
          c.key = '0';
          break;
        case 187:
        case 61:
        case 107:
          c.key = 'Add';
          break;
        case 189:
        case 173:
        case 109:
          c.key = 'Subtract';
          break;
        case 27:
          c.key = 'Esc';
      }
      b.doKeyDown();
      return kj(c, a);
    };
    R.prototype.$z = function (a) {
      var b = this.B;
      if (!b.isEnabled) return !1;
      var c = ej(b, a, !1);
      c.key = String.fromCharCode(a.which);
      c.up = !0;
      switch (a.which) {
        case 8:
          c.key = 'Backspace';
          break;
        case 33:
          c.key = 'PageUp';
          break;
        case 34:
          c.key = 'PageDown';
          break;
        case 35:
          c.key = 'End';
          break;
        case 36:
          c.key = 'Home';
          break;
        case 37:
          c.key = 'Left';
          break;
        case 38:
          c.key = 'Up';
          break;
        case 39:
          c.key = 'Right';
          break;
        case 40:
          c.key = 'Down';
          break;
        case 45:
          c.key = 'Insert';
          break;
        case 46:
          c.key = 'Del';
      }
      b.doKeyUp();
      return kj(c, a);
    };
    R.prototype.fz = function (a) {
      var b = this.B;
      if (!b.isEnabled) return !1;
      var c = ej(b, a, !0);
      null !== b.mouseEnter && b.mouseEnter(c);
      return kj(c, a);
    };
    R.prototype.gz = function (a) {
      var b = this.B;
      if (!b.isEnabled) return !1;
      var c = ej(b, a, !0);
      null !== b.mouseLeave && b.mouseLeave(c);
      return kj(c, a);
    };
    R.prototype.getMouse = function (a) {
      var b = this.Ba;
      if (null === b) return new H(0, 0);
      var c = b.getBoundingClientRect();
      b = a.clientX - (this.va / c.width) * c.left;
      a = a.clientY - (this.ua / c.height) * c.top;
      return null !== this.lb ? zb(new H(b, a), this.lb) : new H(b, a);
    };
    function fj(a, b, c) {
      var d = a.Ba,
        e = a.va,
        f = a.ua,
        g = 0,
        h = 0;
      null !== d &&
        ((d = d.getBoundingClientRect()),
        (g = b.clientX - (e / d.width) * d.left),
        (h = b.clientY - (f / d.height) * d.top));
      c.viewPoint.h(g, h);
      null !== a.lb
        ? ((b = H.allocAt(g, h)),
          a.lb.Wd(b),
          c.documentPoint.assign(b),
          H.free(b))
        : c.documentPoint.h(g, h);
    }
    function ne(a, b, c, d) {
      if (void 0 !== b.targetTouches) {
        if (2 > b.targetTouches.length) return;
        b = b.targetTouches[c];
      } else if (null !== a.Kj[0]) b = a.Kj[c];
      else return;
      c = a.Ba;
      null !== c &&
        ((c = c.getBoundingClientRect()),
        d.h(
          b.clientX - (a.va / c.width) * c.left,
          b.clientY - (a.ua / c.height) * c.top,
        ));
    }
    t = R.prototype;
    t.Na = function () {
      this.li || ((this.li = !0), this.Yb(!0));
    };
    function lj(a) {
      a.Qb || Ti(a);
      Ji(a);
    }
    t.zf = function () {
      this.Gb || this.Qb || (this.N(), Yi(this), Si(this), this.Na(), this.ud());
    };
    t.Yz = function () {
      return this.Pc;
    };
    t.az = function (a) {
      void 0 === a && (a = null);
      var b = this.animationManager,
        c = b.isEnabled;
      b.Uc();
      b.isEnabled = !1;
      Kf(this);
      this.ke = !1;
      b.isEnabled = c;
      null !== a &&
        sa(function () {
          zh(b, 'Model');
          a();
        }, 1);
    };
    t.Yb = function (a) {
      void 0 === a && (a = !1);
      if (!0 !== this.Pc && !(this.Gb || (!1 === a && this.Qb))) {
        this.Pc = !0;
        var b = this;
        x.requestAnimationFrame(function () {
          b.Pc && b.ud();
        });
      }
    };
    t.ud = function () {
      if (!this.sj || this.Pc) this.sj && (this.sj = !1), Kf(this);
    };
    function Zi(a, b, c) {
      a.animationManager.defaultAnimation.isAnimating ||
        a.Gb ||
        !a.mi ||
        Qi(a) ||
        (b && Ti(a), c && Vi(a, !1));
    }
    function Kf(a, b) {
      if (!a.Qb && ((a.Pc = !1), null !== a.Fa || a.$l.u())) {
        a.Qb = !0;
        var c = a.animationManager,
          d = a.rs;
        if (!c.isAnimating && 0 !== d.length) {
          for (var e = d.j, f = e.length, g = 0; g < f; g++) {
            var h = e[g];
            mj(h, !1);
            h.o();
          }
          d.clear();
        }
        d = a.su;
        0 < d.count &&
          (d.each(function (a) {
            a.xw();
          }),
          d.clear());
        e = d = !1;
        c.isAnimating &&
          ((e = !0), (d = a.skipsUndoManager), (a.skipsUndoManager = !0));
        c.jc || Eh(a);
        null !== a.Fb &&
          (a.Fb.visible && !a.Un && (nj(a), (a.Un = !0)),
          !a.Fb.visible && a.Un && (a.Un = !1));
        Ti(a);
        f = !1;
        if (!a.ke || a.Hf)
          a.ke
            ? oj(a, !a.pj)
            : (a.ta('Initial Layout'), !1 === c.isEnabled && c.Uc(), oj(a, !1)),
            (f = !0);
        a.pj = !1;
        Ti(a);
        a.Ks || lj(a);
        g = !1;
        f
          ? (a.ke || ((g = a.ke = !0), pj(a)), a.R('LayoutCompleted'))
          : c.hl &&
            c.sx &&
            (a.Wf !== oi
              ? (a.scale = Wi(a, a.Wf))
              : a.Lg !== oi
              ? (a.scale = Wi(a, a.Lg))
              : ((c = a.initialScale), isFinite(c) && 0 < c && (a.scale = c)),
            Vi(a, !0));
        Ti(a);
        Zi(a, !0, !1);
        f &&
          g &&
          (a.Ua('Initial Layout'),
          a.skipsUndoManager || a.undoManager.clear(),
          sa(function () {
            a.isModified = !1;
          }, 1));
        a.hv();
        b || a.tb(a.Wc);
        e && (a.skipsUndoManager = d);
        a.Qb = !1;
      }
    }
    function pj(a) {
      if (a.Wf !== oi) a.scale = Wi(a, a.Wf);
      else if (a.Lg !== oi) a.scale = Wi(a, a.Lg);
      else {
        var b = a.initialScale;
        isFinite(b) && 0 < b && (a.scale = b);
      }
      Vi(a, !0);
      a.Nu.assign(a.ma);
      b = a.Ia.j;
      a.xd(b, b.length, a);
      a.R('InitialLayoutCompleted');
      nj(a);
    }
    function Ti(a) {
      if ((a.Qb || !a.animationManager.isTicking) && 0 !== a.ld.count) {
        for (var b = 0; 23 > b; b++) {
          var c = a.ld.iterator;
          if (null === c || 0 === a.ld.count) break;
          a.ld = new F();
          a.xw(c, a.ld);
        }
        a.nodes.each(function (a) {
          a instanceof xf && (0 !== (a.P & 65536)) !== !1 && (a.P = a.P ^ 65536);
        });
      }
    }
    t.xw = function (a, b) {
      for (a.reset(); a.next(); ) {
        var c = a.value;
        !c.Vb() ||
          c instanceof xf ||
          (c.aj() ? (c.measure(Infinity, Infinity), c.arrange()) : b.add(c));
      }
      for (a.reset(); a.next(); )
        (c = a.value), c instanceof xf && c.isVisible() && qj(this, c);
      for (a.reset(); a.next(); )
        (c = a.value),
          c instanceof S &&
            c.isVisible() &&
            (c.aj() ? (c.measure(Infinity, Infinity), c.arrange()) : b.add(c));
      for (a.reset(); a.next(); )
        (c = a.value),
          c instanceof Ce &&
            c.isVisible() &&
            (c.aj() ? (c.measure(Infinity, Infinity), c.arrange()) : b.add(c));
    };
    function qj(a, b) {
      for (var c = Ea(), d = Ea(), e = b.memberParts; e.next(); ) {
        var f = e.value;
        f.isVisible() &&
          (f instanceof xf
            ? (rj(f) || sj(f) || tj(f)) && qj(a, f)
            : f instanceof S
            ? f.fromNode === b || f.toNode === b
              ? d.push(f)
              : c.push(f)
            : (f.measure(Infinity, Infinity), f.arrange()));
      }
      a = c.length;
      for (e = 0; e < a; e++)
        (f = c[e]), f.measure(Infinity, Infinity), f.arrange();
      Ha(c);
      b.measure(Infinity, Infinity);
      b.arrange();
      a = d.length;
      for (b = 0; b < a; b++)
        (c = d[b]), c.measure(Infinity, Infinity), c.arrange();
      Ha(d);
    }
    t.xd = function (a, b, c, d) {
      if (this.bh || this.animationManager.isAnimating)
        for (var e = 0; e < b; e++) a[e].xd(c, d);
    };
    t.tb = function (a, b) {
      void 0 === b && (b = null);
      if (null !== this.Fa) {
        null === this.Ba && B('No canvas specified');
        var c = this.animationManager;
        if (!c.jc && (!c.isAnimating || c.isTicking)) {
          var d = new Date();
          uj(this);
          if ('0' !== this.Fa.style.opacity) {
            var e = a !== this.Wc,
              f = this.Ia.j,
              g = f.length,
              h = this;
            this.xd(f, g, h);
            if (e) a.Qc(!0), Si(this);
            else if (!this.gc && null === b && !c.isAnimating) return;
            g = this.ma;
            var k = this.ya,
              l = Math.round(g.x * k) / k,
              m = Math.round(g.y * k) / k;
            c = this.lb;
            c.reset();
            1 !== k && c.scale(k);
            (0 === g.x && 0 === g.y) || c.translate(-l, -m);
            k = this.Rb;
            a.setTransform(1, 0, 0, 1, 0, 0);
            a.scale(k, k);
            a.clearRect(0, 0, this.va, this.ua);
            a.setTransform(1, 0, 0, 1, 0, 0);
            a.scale(k, k);
            a.transform(c.m11, c.m12, c.m21, c.m22, c.dx, c.dy);
            vj(this, a);
            a.globalAlpha = this.jb;
            l =
              null !== b
                ? function (c) {
                    var d = b;
                    if (c.visible && 0 !== c.jb) {
                      var e = c.Ca.j,
                        f = e.length;
                      if (0 !== f) {
                        var g = hi(c, a);
                        c = c.Xo;
                        c.length = 0;
                        for (var k = h.scale, l = 0; l < f; l++) {
                          var m = e[l];
                          if (xg(m) && !d.contains(m)) {
                            if (
                              m instanceof S &&
                              (m.isOrthogonal && c.push(m), !1 === m.yc)
                            )
                              continue;
                            var n = m.actualBounds;
                            n.width * k > h.Md || n.height * k > h.Md
                              ? m.tb(a, h)
                              : ii(a, m);
                          }
                        }
                        a.globalAlpha = g;
                      }
                    }
                  }
                : function (b) {
                    b.tb(a, h);
                  };
            g = f.length;
            for (m = 0; m < g; m++)
              a.setTransform(1, 0, 0, 1, 0, 0),
                a.scale(k, k),
                a.transform(c.m11, c.m12, c.m21, c.m22, c.dx, c.dy),
                l(f[m]);
            this.ki && wj(this.ki, this) && this.yr();
            e ? (this.Wc.Qc(!0), Si(this)) : (this.gc = this.bh = !1);
            e = +new Date() - +d;
            if (null === this.vh) {
              d = this.Io;
              d[this.Jo] = e;
              this.Jo = (this.Jo + 1) % d.length;
              for (f = e = 0; f < this.Io.length; f++) e += this.Io[f];
              this.Ho = e / d.length;
            }
          }
        }
      }
    };
    function xj(a, b, c, d, e, f, g, h, k, l) {
      if (null !== a.Fa) {
        null === a.Ba && B('No canvas specified');
        void 0 === g && (g = null);
        void 0 === h && (h = null);
        void 0 === k && (k = !1);
        void 0 === l && (l = !1);
        uj(a);
        a.Wc.Qc(!0);
        Si(a);
        a.ni = !0;
        var m = a.ya;
        a.ya = e;
        var n = a.Ia.j,
          p = n.length;
        try {
          var r = new N(f.x, f.y, d.width / e, d.height / e),
            q = r.copy();
          q.bq(c);
          nj(a, q);
          Ti(a);
          a.xd(n, p, a, r);
          var u = a.Rb;
          b.setTransform(1, 0, 0, 1, 0, 0);
          b.scale(u, u);
          b.clearRect(0, 0, d.width, d.height);
          null !== h &&
            '' !== h &&
            ((b.fillStyle = h), b.fillRect(0, 0, d.width, d.height));
          var v = rd.alloc();
          v.reset();
          v.translate(c.left, c.top);
          v.scale(e);
          (0 === f.x && 0 === f.y) || v.translate(-f.x, -f.y);
          b.setTransform(v.m11, v.m12, v.m21, v.m22, v.dx, v.dy);
          rd.free(v);
          vj(a, b);
          b.globalAlpha = a.jb;
          if (null !== g) {
            var w = new F(),
              y = g.iterator;
            for (y.reset(); y.next(); ) {
              var z = y.value;
              (!1 === l && 'Grid' === z.layer.name) || null === z || w.add(z);
            }
            var A = function (c) {
              var d = k;
              if (
                c.visible &&
                0 !== c.jb &&
                (void 0 === d && (d = !0), d || !c.isTemporary)
              ) {
                d = c.Ca.j;
                var e = d.length;
                if (0 !== e) {
                  var f = hi(c, b);
                  c = c.Xo;
                  c.length = 0;
                  for (var g = a.scale, h = 0; h < e; h++) {
                    var l = d[h];
                    if (xg(l) && w.contains(l)) {
                      if (
                        l instanceof S &&
                        (l.isOrthogonal && c.push(l), !1 === l.yc)
                      )
                        continue;
                      var m = l.actualBounds;
                      m.width * g > a.Md || m.height * g > a.Md
                        ? l.tb(b, a)
                        : ii(b, l);
                    }
                  }
                  b.globalAlpha = f;
                }
              }
            };
          } else if (!k && l) {
            var C = a.grid.part,
              I = C.layer;
            A = function (c) {
              c === I ? C.tb(b, a) : c.tb(b, a, k);
            };
          } else
            A = function (c) {
              c.tb(b, a, k);
            };
          for (c = 0; c < p; c++) A(n[c]);
          a.ni = !1;
          a.ki && wj(a.ki, a) && a.yr();
        } finally {
          (a.ya = m), a.Wc.Qc(!0), Si(a), a.xd(n, p, a), nj(a);
        }
      }
    }
    t.Be = function (a) {
      return this.$e[a];
    };
    t.my = function (a, b) {
      'minDrawingLength' === a && (this.Md = b);
      this.$e[a] = b;
      this.zf();
    };
    t.dw = function () {
      this.$e = new db();
      this.$e.drawShadows = !0;
      this.$e.textGreeking = !0;
      this.$e.viewportOptimizations = Xa || Ta || Ua ? !1 : !0;
      this.$e.temporaryPixelRatio = !0;
      this.$e.pictureRatioOptimization = !0;
      this.Md = this.$e.minDrawingLength = 1;
    };
    function vj(a, b) {
      a = a.$e;
      null !== a &&
        (void 0 !== a.imageSmoothingEnabled && b.ly(!!a.imageSmoothingEnabled),
        (a = a.defaultFont),
        void 0 !== a && null !== a && (b.font = a));
    }
    t.mm = function (a) {
      return this.vj[a];
    };
    t.vA = function (a, b) {
      this.vj[a] = b;
    };
    t.cw = function () {
      this.vj = new db();
      this.vj.extraTouchArea = 10;
      this.vj.extraTouchThreshold = 10;
      this.vj.hasGestureZoom = !0;
    };
    t.lw = function (a) {
      yj(this, a);
    };
    function yj(a, b) {
      var c = a instanceof X,
        d = a instanceof R,
        e;
      for (e in b) {
        '' === e && B('Setting properties requires non-empty property names');
        var f = a,
          g = e;
        if (c || d) {
          var h = e.indexOf('.');
          if (0 < h) {
            var k = e.substring(0, h);
            if (c) f = a.Xa(k);
            else if (((f = a[k]), void 0 === f || null === f))
              f = a.toolManager[k];
            za(f)
              ? (g = e.substr(h + 1))
              : B(
                  'Unable to find object named: ' +
                    k +
                    ' in ' +
                    a.toString() +
                    ' when trying to set property: ' +
                    e,
                );
          }
        }
        if ('_' !== g[0] && !Ka(f, g))
          if (d && 'ModelChanged' === g) {
            a.xx(b[g]);
            continue;
          } else if (d && 'Changed' === g) {
            a.Eh(b[g]);
            continue;
          } else if (d && Ka(a.toolManager, g)) f = a.toolManager;
          else if (d && zj(a, g)) {
            a.Uj(g, b[g]);
            continue;
          } else if (a instanceof Z && 'Changed' === g) {
            a.Eh(b[g]);
            continue;
          } else
            B(
              'Trying to set undefined property "' +
                g +
                '" on object: ' +
                f.toString(),
            );
        f[g] = b[e];
        '_' === g[0] && f instanceof Y && f.ux(g);
      }
    }
    t.hv = function () {
      if (0 === this.undoManager.transactionLevel && 0 !== this.Sg.count) {
        for (; 0 < this.Sg.count; ) {
          var a = this.Sg;
          this.Sg = new G();
          for (a = a.iterator; a.next(); ) {
            var b = a.key;
            b.sq(a.value);
            b.cc();
          }
        }
        this.N();
      }
    };
    t.N = function (a) {
      void 0 === a && (a = null);
      if (null === a) (this.gc = !0), this.Yb();
      else {
        var b = this.viewportBounds;
        null !== a && a.u() && b.Fc(a) && ((this.gc = !0), this.Yb());
      }
      this.R('InvalidateDraw');
    };
    t.Tx = function (a, b) {
      if (!0 !== this.gc) {
        this.gc = !0;
        var c = !0 === this.Be('temporaryPixelRatio');
        if (
          !0 === this.Be('viewportOptimizations') &&
          this.scrollMode !== Xh &&
          this.Fi.Qi(0, 0, 0, 0) &&
          b.width === a.width &&
          b.height === a.height
        ) {
          var d = this.scale,
            e = Math.max(a.x, b.x),
            f = Math.max(a.y, b.y);
          d = N.allocAt(
            e,
            f,
            Math.max(0, Math.min(a.x + a.width, b.x + b.width) - e) * d,
            Math.max(0, Math.min(a.y + a.height, b.y + b.height) - f) * d,
          );
          if (!this.Op && 0 < d.width && 0 < d.height) {
            if (
              !(
                this.Qb ||
                ((this.Pc = !1),
                null === this.Fa ||
                  ((this.Qb = !0),
                  this.hv(),
                  this.documentBounds.u() || Aj(this, this.computeBounds()),
                  (e = this.Ba),
                  null === e || e instanceof Bj))
              )
            ) {
              var g = this.Rb;
              f = this.va * g;
              var h = this.ua * g,
                k = this.scale * g,
                l = Math.round(Math.round(b.x * k) - Math.round(a.x * k));
              b = Math.round(Math.round(b.y * k) - Math.round(a.y * k));
              k = this.ju;
              a = this.Uw;
              k.width !== f && (k.width = f);
              k.height !== h && (k.height = h);
              a.clearRect(0, 0, f, h);
              k = 190 * g;
              var m = 70 * g,
                n = Math.max(l, 0),
                p = Math.max(b, 0),
                r = Math.floor(f - n),
                q = Math.floor(h - p);
              a.drawImage(e.Da, n, p, r, q, 0, 0, r, q);
              wj(this.ki, this) && a.clearRect(0, 0, k, m);
              e = Ea();
              a = Ea();
              q = Math.abs(l);
              r = Math.abs(b);
              var u = 0 === n ? 0 : f - q;
              n = H.allocAt(u, 0);
              q = H.allocAt(q + u, h);
              a.push(
                new N(
                  Math.min(n.x, q.x),
                  Math.min(n.y, q.y),
                  Math.abs(n.x - q.x),
                  Math.abs(n.y - q.y),
                ),
              );
              var v = this.lb;
              v.reset();
              v.scale(g, g);
              1 !== this.ya && v.scale(this.ya);
              g = this.ma;
              (0 !== g.x || 0 !== g.y) &&
                isFinite(g.x) &&
                isFinite(g.y) &&
                v.translate(-g.x, -g.y);
              zb(n, v);
              zb(q, v);
              e.push(
                new N(
                  Math.min(n.x, q.x),
                  Math.min(n.y, q.y),
                  Math.abs(n.x - q.x),
                  Math.abs(n.y - q.y),
                ),
              );
              u = 0 === p ? 0 : h - r;
              n.h(0, u);
              q.h(f, r + u);
              a.push(
                new N(
                  Math.min(n.x, q.x),
                  Math.min(n.y, q.y),
                  Math.abs(n.x - q.x),
                  Math.abs(n.y - q.y),
                ),
              );
              zb(n, v);
              zb(q, v);
              e.push(
                new N(
                  Math.min(n.x, q.x),
                  Math.min(n.y, q.y),
                  Math.abs(n.x - q.x),
                  Math.abs(n.y - q.y),
                ),
              );
              wj(this.ki, this) &&
                ((f = 0 < l ? 0 : -l),
                (h = 0 < b ? 0 : -b),
                n.h(f, h),
                q.h(k + f, m + h),
                a.push(
                  new N(
                    Math.min(n.x, q.x),
                    Math.min(n.y, q.y),
                    Math.abs(n.x - q.x),
                    Math.abs(n.y - q.y),
                  ),
                ),
                zb(n, v),
                zb(q, v),
                e.push(
                  new N(
                    Math.min(n.x, q.x),
                    Math.min(n.y, q.y),
                    Math.abs(n.x - q.x),
                    Math.abs(n.y - q.y),
                  ),
                ));
              H.free(n);
              H.free(q);
              Zi(this, !1, !0);
              null === this.Fa && B('No div specified');
              null === this.Ba && B('No canvas specified');
              if (!this.animationManager.jc && ((f = this.Wc), this.gc)) {
                uj(this);
                h = this.Rb;
                f.setTransform(1, 0, 0, 1, 0, 0);
                f.clearRect(0, 0, this.va * h, this.ua * h);
                f.drawImage(
                  this.ju.Da,
                  0 < l ? 0 : Math.round(-l),
                  0 < b ? 0 : Math.round(-b),
                );
                l = this.ma;
                g = this.ya;
                k = Math.round(l.x * g) / g;
                m = Math.round(l.y * g) / g;
                b = this.lb;
                b.reset();
                1 !== g && b.scale(g);
                (0 === l.x && 0 === l.y) || b.translate(-k, -m);
                f.save();
                f.beginPath();
                l = a.length;
                for (g = 0; g < l; g++)
                  (k = a[g]),
                    0 !== k.width &&
                      0 !== k.height &&
                      f.rect(
                        Math.floor(k.x),
                        Math.floor(k.y),
                        Math.ceil(k.width),
                        Math.ceil(k.height),
                      );
                f.clip();
                f.setTransform(1, 0, 0, 1, 0, 0);
                f.scale(h, h);
                f.transform(b.m11, b.m12, b.m21, b.m22, b.dx, b.dy);
                b = this.Ia.j;
                l = b.length;
                this.xd(b, l, this);
                vj(this, f);
                f.globalAlpha = this.jb;
                for (h = 0; h < l; h++)
                  if (((n = b[h]), (g = e), n.visible && 0 !== n.jb)) {
                    k = hi(n, f);
                    m = n.Xo;
                    m.length = 0;
                    p = this.scale;
                    n = n.Ca.j;
                    r = n.length;
                    q = g.length;
                    for (v = 0; v < r; v++)
                      if (((u = n[v]), xg(u))) {
                        if (
                          u instanceof S &&
                          (u.isOrthogonal && m.push(u), !1 === u.yc)
                        )
                          continue;
                        var w = Cj(u, u.actualBounds);
                        a: {
                          var y = 2 / p;
                          for (var z = 4 / p, A = 0; A < q; A++) {
                            var C = g[A];
                            if (
                              0 !== C.width &&
                              0 !== C.height &&
                              w.Hv(C.x - y, C.y - y, C.width + z, C.height + z)
                            ) {
                              y = !0;
                              break a;
                            }
                          }
                          y = !1;
                        }
                        y &&
                          (w.width * p > this.Md || w.height * p > this.Md
                            ? u.tb(f, this)
                            : ii(f, u));
                      }
                    f.globalAlpha = k;
                  }
                f.restore();
                f.Qc(!0);
                this.ki && wj(this.ki, this) && this.yr();
                this.gc = this.bh = !1;
                this.Ht();
              }
              Ha(e);
              Ha(a);
              this.Qb = !1;
            }
          } else this.ud();
          N.free(d);
          c && (Ue(this), this.ud(), kf(this, !0));
        } else c ? (Ue(this), this.ud(), kf(this, !0)) : this.ud();
      }
    };
    function Yi(a) {
      !1 === a.mi && (a.mi = !0);
    }
    function Si(a) {
      !1 === a.bh && (a.bh = !0);
    }
    function uj(a) {
      !1 !== a.ml && ((a.ml = !1), Dj(a, a.va, a.ua));
    }
    function Dj(a, b, c) {
      var d = a.Rb;
      a.Ba.resize(b * d, c * d, b, c) && ((a.gc = !0), a.Wc.Qc(!0));
    }
    function Qi(a) {
      var b = a.Ba;
      if (null === b) return !0;
      var c = a.Fa,
        d = a.va,
        e = a.ua,
        f = a.$u.copy();
      if (isNaN(f.width) || isNaN(f.height)) return !0;
      var g = !1,
        h = a.Qe ? a.kb : 0,
        k = a.je ? a.kb : 0,
        l = c.clientWidth || d + h,
        m = c.clientHeight || e + k;
      if (l !== d + h || m !== e + k)
        (a.Qe = !1),
          (a.je = !1),
          (k = h = 0),
          (a.va = l),
          (a.ua = m),
          (g = a.ml = !0);
      if (!(g || a.Qe || a.je || a.dl || a.el)) return !0;
      a.mi = !1;
      var n = a.viewportBounds,
        p = a.documentBounds,
        r = 0,
        q = 0,
        u = 0,
        v = 0;
      c = n.width;
      var w = n.height,
        y = a.Fi;
      a.contentAlignment.cb()
        ? (p.width > c && ((r = y.left), (q = y.right)),
          p.height > w && ((u = y.top), (v = y.bottom)))
        : ((r = y.left), (q = y.right), (u = y.top), (v = y.bottom));
      y = p.width + r + q;
      var z = p.height + u + v;
      r = p.x - r;
      var A = n.x;
      q = p.right + q;
      var C = n.right + h;
      u = p.y - u;
      var I = n.y;
      p = p.bottom + v;
      n = n.bottom + k;
      var P = '1px',
        K = '1px';
      v = a.scale;
      l = y > l / v;
      m = z > m / v;
      a.scrollMode === Vh &&
        (l || m) &&
        (l &&
          a.hasHorizontalScrollbar &&
          a.allowHorizontalScroll &&
          ((l = 1),
          r + 1 < A && (l = Math.max((A - r) * v + a.va, l)),
          q > C + 1 && (l = Math.max((q - C) * v + a.va, l)),
          c + h + 1 < y && (l = Math.max((y - c) * v + a.va, l)),
          (P = l.toString() + 'px')),
        m &&
          a.hasVerticalScrollbar &&
          a.allowVerticalScroll &&
          ((l = 1),
          u + 1 < I && (l = Math.max((I - u) * v + a.ua, l)),
          p > n + 1 && (l = Math.max((p - n) * v + a.ua, l)),
          w + k + 1 < z && (l = Math.max((z - w) * v + a.ua, l)),
          (K = l.toString() + 'px')));
      l = '1px' !== P;
      m = '1px' !== K;
      (l && m) ||
        (!l && !m) ||
        (m && (C -= a.kb),
        l && (n -= a.kb),
        y < c + h ||
          !a.hasHorizontalScrollbar ||
          !a.allowHorizontalScroll ||
          ((h = 1),
          r + 1 < A && (h = Math.max((A - r) * v + a.va, h)),
          q > C + 1 && (h = Math.max((q - C) * v + a.va, h)),
          c + 1 < y && (h = Math.max((y - c) * v + a.va, h)),
          (P = h.toString() + 'px')),
        (l = '1px' !== P),
        (h = a.ua),
        l !== a.je && (h = l ? a.ua - a.kb : a.ua + a.kb),
        z < w + k ||
          !a.hasVerticalScrollbar ||
          !a.allowVerticalScroll ||
          ((k = 1),
          u + 1 < I && (k = Math.max((I - u) * v + h, k)),
          p > n + 1 && (k = Math.max((p - n) * v + h, k)),
          w + 1 < z && (k = Math.max((z - w) * v + h, k)),
          (K = k.toString() + 'px')),
        (m = '1px' !== K));
      if (a.tp && l === a.je && m === a.Qe)
        return (d === a.va && e === a.ua) || a.ud(), !1;
      l !== a.je &&
        ('1px' === P ? (a.ua = a.ua + a.kb) : (a.ua = Math.max(a.ua - a.kb, 1)),
        (g = !0));
      a.je = l;
      a.vp.style.width = P;
      m !== a.Qe &&
        ('1px' === K ? (a.va = a.va + a.kb) : (a.va = Math.max(a.va - a.kb, 1)),
        (g = !0),
        a.ol &&
          ((k = H.alloc()),
          m
            ? ((b.style.left = a.kb + 'px'),
              (a.position = k.h(a.ma.x + a.kb / a.scale, a.ma.y)))
            : ((b.style.left = '0px'),
              (a.position = k.h(a.ma.x - a.kb / a.scale, a.ma.y))),
          H.free(k)));
      a.Qe = m;
      a.vp.style.height = K;
      a.As = !0;
      g && (a.ml = !0);
      b = a.Ds;
      k = b.scrollLeft;
      a.hasHorizontalScrollbar &&
        a.allowHorizontalScroll &&
        (c + 1 < y
          ? (k = (a.position.x - r) * v)
          : r + 1 < A
          ? (k = b.scrollWidth - b.clientWidth)
          : q > C + 1 && (k = a.position.x * v));
      if (a.ol)
        switch (a.ys) {
          case 'negative':
            k = -(b.scrollWidth - k - b.clientWidth);
            break;
          case 'reverse':
            k = b.scrollWidth - k - b.clientWidth;
        }
      b.scrollLeft = k;
      a.hasVerticalScrollbar &&
        a.allowVerticalScroll &&
        (w + 1 < z
          ? (b.scrollTop = (a.position.y - u) * v)
          : u + 1 < I
          ? (b.scrollTop = b.scrollHeight - b.clientHeight)
          : p > n + 1 && (b.scrollTop = a.position.y * v));
      l = a.va;
      m = a.ua;
      b.style.width = l + (a.Qe ? a.kb : 0) + 'px';
      b.style.height = m + (a.je ? a.kb : 0) + 'px';
      return d !== l || e !== m || a.animationManager.jc
        ? (a.Aq(f, a.viewportBounds, v, g), !1)
        : !0;
    }
    t.add = function (a) {
      var b = a.diagram;
      if (
        b !== this &&
        (null !== b &&
          B(
            'Cannot add part ' +
              a.toString() +
              ' to ' +
              this.toString() +
              '. It is already a part of ' +
              b.toString(),
          ),
        (b = this.jm(a.layerName)),
        null === b && (b = this.jm('')),
        null === b &&
          B(
            'Cannot add a Part when unable find a Layer named "' +
              a.layerName +
              '" and there is no default Layer',
          ),
        a.layer !== b)
      ) {
        var c = b.$i(99999999, a, a.diagram === this);
        0 <= c && this.Ya(se, 'parts', b, null, a, null, c);
        b.isTemporary || this.Na();
        a.C(1);
        c = a.layerChanged;
        null !== c && c(a, null, b);
      }
    };
    t.$i = function (a) {
      this.partManager.$i(a);
      var b = this;
      Ej(a, function (a) {
        Fj(b, a);
      });
      (a instanceof Ce || (a instanceof xf && null !== a.placeholder)) && a.o();
      null !== a.data &&
        Ej(a, function (a) {
          Gj(b.partManager, a);
        });
      (!0 !== sj(a) && !0 !== tj(a)) || this.ld.add(a);
      Hj(a, !0, this);
      Ij(a)
        ? (a.actualBounds.u() && this.N(Cj(a, a.actualBounds)), this.Na())
        : a.isVisible() && a.actualBounds.u() && this.N(Cj(a, a.actualBounds));
      this.Yb();
    };
    t.Ec = function (a) {
      a.Zj();
      this.partManager.Ec(a);
      var b = this;
      null !== a.data &&
        Ej(a, function (a) {
          Jj(b.partManager, a, b);
        });
      this.ld.remove(a);
      Ij(a)
        ? (a.actualBounds.u() && this.N(Cj(a, a.actualBounds)), this.Na())
        : a.isVisible() && a.actualBounds.u() && this.N(Cj(a, a.actualBounds));
      this.Yb();
    };
    t.remove = function (a) {
      Kj(this, a, !0);
    };
    function Kj(a, b, c) {
      var d = b.layer;
      null !== d &&
        d.diagram === a &&
        ((b.isSelected = !1),
        (b.isHighlighted = !1),
        b.C(2),
        c && b.ek(),
        (c = d.Ec(-1, b, !1)),
        0 <= c && a.Ya(te, 'parts', d, b, null, c, null),
        (a = b.layerChanged),
        null !== a && a(b, d, null));
    }
    t.Jt = function (a, b) {
      if (Aa(a))
        for (var c = a.length, d = 0; d < c; d++) {
          var e = a[d];
          (b && !e.canDelete()) || this.remove(e);
        }
      else
        for (c = new F(), c.addAll(a), a = c.iterator; a.next(); )
          (c = a.value), (b && !c.canDelete()) || this.remove(c);
    };
    t.dk = function (a, b, c) {
      return this.partManager.dk(a, b, c);
    };
    R.prototype.moveParts = function (a, b, c, d) {
      void 0 === d && (d = Lj(this));
      if (null !== this.toolManager) {
        var e = new G();
        if (null !== a)
          if (Aa(a)) for (var f = 0; f < a.length; f++) Mj(this, e, a[f], c, d);
          else for (a = a.iterator; a.next(); ) Mj(this, e, a.value, c, d);
        else {
          for (a = this.parts; a.next(); ) Mj(this, e, a.value, c, d);
          for (a = this.nodes; a.next(); ) Mj(this, e, a.value, c, d);
          for (a = this.links; a.next(); ) Mj(this, e, a.value, c, d);
        }
        sf(this, e, b, d, c);
      }
    };
    function Mj(a, b, c, d, e, f) {
      if (
        !b.contains(c) &&
        (void 0 === f && (f = !1), !d || f || c.canMove() || c.canCopy())
      )
        if ((void 0 === e && (e = Lj(a)), c instanceof U)) {
          b.add(c, a.qd(e, c, c.location));
          if (c instanceof xf)
            for (f = c.memberParts; f.next(); ) Mj(a, b, f.value, d, e, e.Oz);
          for (f = c.linksConnected; f.next(); ) {
            var g = f.value;
            if (!b.contains(g)) {
              var h = g.fromNode,
                k = g.toNode;
              null !== h &&
                b.contains(h) &&
                null !== k &&
                b.contains(k) &&
                Mj(a, b, g, d, e);
            }
          }
          if (e.dragsTree) for (c = c.yv(); c.next(); ) Mj(a, b, c.value, d, e);
        } else if (c instanceof S)
          for (b.add(c, a.qd(e, c)), c = c.labelNodes; c.next(); )
            Mj(a, b, c.value, d, e);
        else c instanceof Ce || b.add(c, a.qd(e, c, c.location));
    }
    function sf(a, b, c, d, e) {
      if (null !== b && 0 !== b.count) {
        var f = H.alloc(),
          g = H.alloc();
        g.assign(c);
        isNaN(g.x) && (g.x = 0);
        isNaN(g.y) && (g.y = 0);
        (c = a.Np) || Ve(a, b);
        for (var h = Ea(), k = Ea(), l = b.iterator, m = H.alloc(); l.next(); ) {
          var n = l.key,
            p = l.value;
          if (n.Vb()) {
            var r = Nj(a, n, b);
            if (null !== r) h.push(new Oj(n, p, r));
            else if (!e || n.canMove())
              (r = p.point),
                f.assign(r),
                a.computeMove(n, f.add(g), d, m),
                (n.location = m),
                void 0 === p.shifted && (p.shifted = new H()),
                p.shifted.assign(m.$d(r));
          } else l.key instanceof S && k.push(l.la);
        }
        H.free(m);
        e = h.length;
        for (l = 0; l < e; l++)
          (n = h[l]),
            f.assign(n.info.point),
            void 0 === n.Ev.shifted && (n.Ev.shifted = new H()),
            (n.node.location = f.add(n.Ev.shifted));
        e = H.alloc();
        l = H.alloc();
        n = k.length;
        for (p = 0; p < n; p++) {
          var q = k[p];
          r = q.key;
          if (r instanceof S)
            if (r.suspendsRouting) {
              r.ph = null;
              m = r.fromNode;
              var u = r.toNode;
              if (null !== a.draggedLink && d.dragsLink)
                if (((u = q.value.point), null === r.dragComputation))
                  b.add(r, a.qd(d, r, g)), qf(r, g.x - u.x, g.y - u.y);
                else {
                  q = H.allocAt(0, 0);
                  (m = r.i(0)) && m.u() && q.assign(m);
                  var v = (m = H.alloc().assign(q).add(g));
                  d.isGridSnapEnabled &&
                    (d.isGridSnapRealtime || a.lastInput.up) &&
                    ((v = H.alloc()), Hg(a, r, m, v, d));
                  m.assign(r.dragComputation(r, m, v)).$d(q);
                  b.add(r, a.qd(d, r, m));
                  qf(r, m.x - u.x, m.y - u.y);
                  H.free(q);
                  H.free(m);
                  v !== m && H.free(v);
                }
              else
                null !== m &&
                  (e.assign(m.location),
                  (v = b.H(m)),
                  null !== v && e.$d(v.point)),
                  null !== u &&
                    (l.assign(u.location),
                    (v = b.H(u)),
                    null !== v && l.$d(v.point)),
                  null !== m && null !== u
                    ? e.Ma(l)
                      ? ((m = q.value.point),
                        (u = f),
                        u.assign(e),
                        u.$d(m),
                        b.add(r, a.qd(d, r, e)),
                        qf(r, u.x, u.y))
                      : ((r.suspendsRouting = !1), r.Oa())
                    : ((q = q.value.point),
                      (m = null !== m ? e : null !== u ? l : g),
                      b.add(r, a.qd(d, r, m)),
                      qf(r, m.x - q.x, m.y - q.y));
            } else if (null === r.fromNode || null === r.toNode)
              (m = q.value.point),
                b.add(r, a.qd(d, r, g)),
                qf(r, g.x - m.x, g.y - m.y);
        }
        H.free(f);
        H.free(g);
        H.free(e);
        H.free(l);
        Ha(h);
        Ha(k);
        c || (Ti(a), ff(a, b));
      }
    }
    R.prototype.computeMove = function (a, b, c, d) {
      void 0 === d && (d = new H());
      d.assign(b);
      if (null === a) return d;
      var e = b,
        f = c.isGridSnapEnabled;
      f &&
        (c.isGridSnapRealtime || this.lastInput.up) &&
        ((e = H.alloc()), Hg(this, a, b, e, c));
      c = null !== a.dragComputation ? a.dragComputation(a, b, e) : e;
      var g = a.minLocation,
        h = g.x;
      isNaN(h) && (h = f ? Math.round(a.location.x) : a.location.x);
      g = g.y;
      isNaN(g) && (g = f ? Math.round(a.location.y) : a.location.y);
      var k = a.maxLocation,
        l = k.x;
      isNaN(l) && (l = f ? Math.round(a.location.x) : a.location.x);
      k = k.y;
      isNaN(k) && (k = f ? Math.round(a.location.y) : a.location.y);
      d.h(Math.max(h, Math.min(c.x, l)), Math.max(g, Math.min(c.y, k)));
      e !== b && H.free(e);
      return d;
    };
    function Lj(a) {
      var b = a.toolManager.findTool('Dragging');
      return null !== b ? b.dragOptions : a.Rk;
    }
    function Hg(a, b, c, d, e) {
      void 0 === e && (e = Lj(a));
      d.assign(c);
      if (null !== b) {
        var f = a.grid;
        b = e.gridSnapCellSize;
        a = b.width;
        b = b.height;
        var g = e.gridSnapOrigin,
          h = g.x;
        g = g.y;
        e = e.gridSnapCellSpot;
        if (null !== f) {
          var k = f.gridCellSize;
          isNaN(a) && (a = k.width);
          isNaN(b) && (b = k.height);
          f = f.gridOrigin;
          isNaN(h) && (h = f.x);
          isNaN(g) && (g = f.y);
        }
        f = H.allocAt(0, 0);
        f.yk(0, 0, a, b, e);
        J.lq(c.x, c.y, h + f.x, g + f.y, a, b, d);
        H.free(f);
      }
    }
    function Ve(a, b) {
      if (null !== b)
        for (a.Np = !0, a = b.iterator; a.next(); )
          (b = a.key), b instanceof S && (b.suspendsRouting = !0);
    }
    function ff(a, b) {
      if (null !== b) {
        for (b = b.iterator; b.next(); ) {
          var c = b.key;
          c instanceof S && ((c.suspendsRouting = !1), Pj(c) && c.Oa());
        }
        a.Np = !1;
      }
    }
    function Nj(a, b, c) {
      b = b.containingGroup;
      if (null !== b) {
        a = Nj(a, b, c);
        if (null !== a) return a;
        a = c.H(b);
        if (null !== a) return a;
      }
      return null;
    }
    t = R.prototype;
    t.qd = function (a, b, c) {
      if (void 0 === c) return new Ye(Fb);
      var d = a.isGridSnapEnabled;
      a.Pz || null === b.containingGroup || (d = !1);
      return d
        ? new Ye(new H(Math.round(c.x), Math.round(c.y)))
        : new Ye(c.copy());
    };
    function Qj(a, b, c) {
      null !== b.diagram &&
        b.diagram !== a &&
        B('Cannot share a Layer with another Diagram: ' + b + ' of ' + b.diagram);
      null === c
        ? null !== b.diagram &&
          B('Cannot add an existing Layer to this Diagram again: ' + b)
        : (c.diagram !== a &&
            B(
              'Existing Layer must be in this Diagram: ' +
                c +
                ' not in ' +
                c.diagram,
            ),
          b === c && B('Cannot move a Layer before or after itself: ' + b));
      if (b.diagram !== a) {
        b = b.name;
        a = a.Ia;
        c = a.count;
        for (var d = 0; d < c; d++)
          a.L(d).name === b &&
            B(
              "Cannot add Layer with the name '" +
                b +
                "'; a Layer with the same name is already present in this Diagram.",
            );
      }
    }
    t.am = function (a) {
      Qj(this, a, null);
      a.Zd(this);
      var b = this.Ia,
        c = b.count - 1;
      if (!a.isTemporary) for (; 0 <= c && b.L(c).isTemporary; ) c--;
      b.Lb(c + 1, a);
      null !== this.bc && this.Ya(se, 'layers', this, null, a, null, c + 1);
      this.N();
      this.Na();
    };
    t.vx = function (a, b) {
      Qj(this, a, b);
      a.Zd(this);
      var c = this.Ia,
        d = c.indexOf(a);
      0 <= d &&
        (c.remove(a),
        null !== this.bc && this.Ya(te, 'layers', this, a, null, d, null));
      var e = c.count,
        f;
      for (f = 0; f < e; f++)
        if (c.L(f) === b) {
          c.Lb(f, a);
          break;
        }
      null !== this.bc && this.Ya(se, 'layers', this, null, a, null, f);
      this.N();
      0 > d && this.Na();
    };
    t.Iy = function (a, b) {
      Qj(this, a, b);
      a.Zd(this);
      var c = this.Ia,
        d = c.indexOf(a);
      0 <= d &&
        (c.remove(a),
        null !== this.bc && this.Ya(te, 'layers', this, a, null, d, null));
      var e = c.count,
        f;
      for (f = 0; f < e; f++)
        if (c.L(f) === b) {
          c.Lb(f + 1, a);
          break;
        }
      null !== this.bc && this.Ya(se, 'layers', this, null, a, null, f + 1);
      this.N();
      0 > d && this.Na();
    };
    t.oA = function (a) {
      a.diagram !== this &&
        B(
          'Cannot remove a Layer from another Diagram: ' + a + ' of ' + a.diagram,
        );
      if ('' !== a.name) {
        var b = this.Ia,
          c = b.indexOf(a);
        if (b.remove(a)) {
          for (b = a.Ca.copy().iterator; b.next(); ) {
            var d = b.value,
              e = d.layerName;
            e !== a.name ? (d.layerName = e) : (d.layerName = '');
          }
          null !== this.bc && this.Ya(te, 'layers', this, a, null, c, null);
          this.N();
          this.Na();
        }
      }
    };
    t.jm = function (a) {
      for (var b = this.layers; b.next(); ) {
        var c = b.value;
        if (c.name === a) return c;
      }
      return null;
    };
    t.xx = function (a) {
      null === this.qe && (this.qe = new E());
      this.qe.add(a);
      this.model.Eh(a);
    };
    t.qA = function (a) {
      null !== this.qe &&
        (this.qe.remove(a), 0 === this.qe.count && (this.qe = null));
      this.model.xk(a);
    };
    t.Eh = function (a) {
      null === this.Lf && (this.Lf = new E());
      this.Lf.add(a);
    };
    t.xk = function (a) {
      null !== this.Lf &&
        (this.Lf.remove(a), 0 === this.Lf.count && (this.Lf = null));
    };
    t.at = function (a) {
      this.skipsUndoManager ||
        this.model.skipsUndoManager ||
        this.model.undoManager.Fv(a);
      a.change !== re && (this.isModified = !0);
      if (null !== this.Lf)
        for (var b = this.Lf, c = b.length, d = 0; d < c; d++) b.L(d)(a);
    };
    t.Ya = function (a, b, c, d, e, f, g) {
      void 0 === f && (f = null);
      void 0 === g && (g = null);
      var h = new pe();
      h.diagram = this;
      h.change = a;
      h.propertyName = b;
      h.object = c;
      h.oldValue = d;
      h.oldParam = f;
      h.newValue = e;
      h.newParam = g;
      this.at(h);
    };
    t.g = function (a, b, c, d, e) {
      this.Ya(qe, a, this, b, c, d, e);
    };
    t.Yj = function (a, b) {
      if (null !== a && a.diagram === this) {
        var c = this.skipsModelSourceBindings;
        try {
          this.skipsModelSourceBindings = !0;
          var d = a.change;
          if (d === qe) {
            var e = a.object;
            Rj(e, a.propertyName, a.H(b));
            if (e instanceof Y) {
              var f = e.part;
              null !== f && f.Mb();
            }
            this.isModified = !0;
          } else if (d === se) {
            var g = a.object,
              h = a.newParam,
              k = a.newValue;
            if (g instanceof X)
              if ('number' === typeof h && k instanceof Y) {
                b ? g.Ec(h) : g.Lb(h, k);
                var l = g.part;
                null !== l && l.Mb();
              } else {
                if ('number' === typeof h && k instanceof Sj)
                  if (b) k.isRow ? g.aw(h) : g.Zv(h);
                  else {
                    var m = k.isRow
                      ? g.getRowDefinition(k.index)
                      : g.getColumnDefinition(k.index);
                    m.dt(k);
                  }
              }
            else if (g instanceof ei) {
              var n = !0 === a.oldParam;
              'number' === typeof h &&
                k instanceof T &&
                (b
                  ? ((k.isSelected = !1),
                    (k.isHighlighted = !1),
                    k.Mb(),
                    g.Ec(n ? h : -1, k, n))
                  : g.$i(h, k, n));
            } else
              g instanceof R
                ? 'number' === typeof h &&
                  k instanceof ei &&
                  (b ? this.Ia.mb(h) : (k.Zd(this), this.Ia.Lb(h, k)))
                : B('unknown ChangedEvent.Insert object: ' + a.toString());
            this.isModified = !0;
          } else if (d === te) {
            var p = a.object,
              r = a.oldParam,
              q = a.oldValue;
            if (p instanceof X)
              'number' === typeof r && q instanceof Y
                ? b
                  ? p.Lb(r, q)
                  : p.Ec(r)
                : 'number' === typeof r &&
                  q instanceof Sj &&
                  (b
                    ? ((m = q.isRow
                        ? p.getRowDefinition(q.index)
                        : p.getColumnDefinition(q.index)),
                      m.dt(q))
                    : q.isRow
                    ? p.aw(r)
                    : p.Zv(r));
            else if (p instanceof ei) {
              var u = !0 === a.newParam;
              'number' === typeof r &&
                q instanceof T &&
                (b
                  ? 0 > p.Ca.indexOf(q) && p.$i(r, q, u)
                  : ((q.isSelected = !1),
                    (q.isHighlighted = !1),
                    q.Mb(),
                    p.Ec(u ? r : -1, q, u)));
            } else
              p instanceof R
                ? 'number' === typeof r &&
                  q instanceof ei &&
                  (b ? (q.Zd(this), this.Ia.Lb(r, q)) : this.Ia.mb(r))
                : B('unknown ChangedEvent.Remove object: ' + a.toString());
            this.isModified = !0;
          } else d !== re && B('unknown ChangedEvent: ' + a.toString());
        } finally {
          this.skipsModelSourceBindings = c;
        }
      }
    };
    t.ta = function (a) {
      return this.undoManager.ta(a);
    };
    t.Ua = function (a) {
      return this.undoManager.Ua(a);
    };
    t.Bf = function () {
      return this.undoManager.Bf();
    };
    R.prototype.commit = function (a, b) {
      void 0 === b && (b = '');
      var c = this.skipsUndoManager;
      null === b && ((this.skipsUndoManager = !0), (b = ''));
      this.undoManager.ta(b);
      var d = !1;
      try {
        a(this), (d = !0);
      } finally {
        d ? this.undoManager.Ua(b) : this.undoManager.Bf(),
          (this.skipsUndoManager = c);
      }
    };
    R.prototype.updateAllTargetBindings = function (a) {
      this.partManager.updateAllTargetBindings(a);
    };
    t = R.prototype;
    t.Oq = function () {
      this.partManager.Oq();
    };
    function dk(a, b, c) {
      var d = a.animationManager;
      if (a.Gb || a.Qb) (a.ya = c), d.Xe && d.Ad.add(d.B, 'scale', b, a.ya);
      else if (((a.Gb = !0), null === a.Ba)) a.ya = c;
      else {
        var e = a.viewportBounds.copy(),
          f = a.va,
          g = a.ua;
        e.width = a.va / b;
        e.height = a.ua / b;
        var h = a.zoomPoint.x,
          k = a.zoomPoint.y,
          l = a.contentAlignment;
        isNaN(h) &&
          (l.xf()
            ? l.vf(Ic)
              ? (h = 0)
              : l.vf(Jc) && (h = f - 1)
            : (h = l.cb() ? l.x * (f - 1) : f / 2));
        isNaN(k) &&
          (l.xf()
            ? l.vf(Hc)
              ? (k = 0)
              : l.vf(Kc) && (k = g - 1)
            : (k = l.cb() ? l.y * (g - 1) : g / 2));
        null === a.scaleComputation ||
          a.animationManager.isAnimating ||
          (c = a.scaleComputation(a, c));
        c < a.minScale && (c = a.minScale);
        c > a.maxScale && (c = a.maxScale);
        f = H.allocAt(a.ma.x + h / b - h / c, a.ma.y + k / b - k / c);
        a.position = f;
        H.free(f);
        a.ya = c;
        a.Aq(e, a.viewportBounds, b, !1);
        a.Gb = !1;
        Vi(a, !1);
        d.Xe && d.Ad.add(d.B, 'scale', b, a.ya);
        a.N();
        Yi(a);
      }
    }
    t.Aq = function (a, b, c, d) {
      if (!a.A(b)) {
        void 0 === d && (d = !1);
        d || Yi(this);
        Si(this);
        var e = this.layout;
        null === e ||
          !e.isViewportSized ||
          this.autoScale !== oi ||
          d ||
          (a.width === b.width && a.height === b.height) ||
          e.C();
        e = this.currentTool;
        !0 === this.Xf &&
          e instanceof Oa &&
          ((this.lastInput.documentPoint = this.Pt(this.lastInput.viewPoint)),
          Me(e, this));
        this.Gb || this.Tx(a, b);
        nj(this);
        this.Sd.scale = c;
        this.Sd.position.x = a.x;
        this.Sd.position.y = a.y;
        this.Sd.bounds.assign(a);
        this.Sd.Mv = d;
        this.R('ViewportBoundsChanged', this.Sd, a);
        this.isVirtualized &&
          this.links.each(function (a) {
            a.isAvoiding && a.actualBounds.Fc(b) && a.Oa();
          });
      }
    };
    function nj(a, b) {
      void 0 === b && (b = null);
      var c = a.Fb;
      if (null !== c && c.visible) {
        for (
          var d = L.alloc(), e = 1, f = 1, g = c.W.j, h = g.length, k = 0;
          k < h;
          k++
        ) {
          var l = g[k],
            m = l.interval;
          2 > m ||
            (hk(l.figure)
              ? (f = (f * m) / J.Px(f, m))
              : (e = (e * m) / J.Px(e, m)));
        }
        g = c.gridCellSize;
        d.h(f * g.width, e * g.height);
        if (null !== b) (e = b.width), (f = b.height), (a = b.x), (g = b.y);
        else {
          b = N.alloc();
          a = a.viewportBounds;
          b.h(a.x, a.y, a.width, a.height);
          if (!b.u()) {
            N.free(b);
            return;
          }
          e = b.width;
          f = b.height;
          a = b.x;
          g = b.y;
          N.free(b);
        }
        c.width = e + 2 * d.width;
        c.height = f + 2 * d.height;
        b = H.alloc();
        J.lq(a, g, 0, 0, d.width, d.height, b);
        b.offset(-d.width, -d.height);
        L.free(d);
        c.part.location = b;
        H.free(b);
      }
    }
    t.iv = function () {
      var a = 0 < this.selection.count;
      a && this.R('ChangingSelection', this.selection);
      Re(this);
      a && this.R('ChangedSelection', this.selection);
    };
    function Re(a) {
      a = a.selection;
      if (0 < a.count) {
        for (var b = a.na(), c = b.length, d = 0; d < c; d++)
          b[d].isSelected = !1;
        a.ea();
        a.clear();
        a.freeze();
      }
    }
    t.select = function (a) {
      null !== a &&
        a.layer.diagram === this &&
        (!a.isSelected || 1 < this.selection.count) &&
        (this.R('ChangingSelection', this.selection),
        Re(this),
        (a.isSelected = !0),
        this.R('ChangedSelection', this.selection));
    };
    t.uA = function (a) {
      this.R('ChangingSelection', this.selection);
      Re(this);
      if (Aa(a))
        for (var b = a.length, c = 0; c < b; c++) {
          var d = a[c];
          d instanceof T ||
            B(
              'Diagram.selectCollection given something that is not a Part: ' + d,
            );
          d.isSelected = !0;
        }
      else
        for (a = a.iterator; a.next(); )
          (b = a.value),
            b instanceof T ||
              B(
                'Diagram.selectCollection given something that is not a Part: ' +
                  b,
              ),
            (b.isSelected = !0);
      this.R('ChangedSelection', this.selection);
    };
    t.Ax = function () {
      var a = this.highlighteds;
      if (0 < a.count) {
        for (var b = a.na(), c = b.length, d = 0; d < c; d++)
          b[d].isHighlighted = !1;
        a.ea();
        a.clear();
        a.freeze();
      }
    };
    t.Rz = function (a) {
      null !== a &&
        a.layer.diagram === this &&
        (!a.isHighlighted || 1 < this.highlighteds.count) &&
        (this.Ax(), (a.isHighlighted = !0));
    };
    t.Sz = function (a) {
      a = new F().addAll(a);
      for (var b = this.highlighteds.copy().Eq(a).iterator; b.next(); )
        b.value.isHighlighted = !1;
      for (a = a.iterator; a.next(); )
        (b = a.value),
          b instanceof T ||
            B(
              'Diagram.highlightCollection given something that is not a Part: ' +
                b,
            ),
          (b.isHighlighted = !0);
    };
    t.scroll = function (a, b, c) {
      void 0 === c && (c = 1);
      var d = 'up' === b || 'down' === b,
        e = 0;
      if ('pixel' === a) e = c;
      else if ('line' === a)
        e =
          c *
          (d ? this.scrollVerticalLineChange : this.scrollHorizontalLineChange);
      else if ('page' === a)
        (a = d ? this.viewportBounds.height : this.viewportBounds.width),
          (a *= this.scale),
          0 !== a &&
            (e =
              c *
              Math.max(
                a -
                  (d
                    ? this.scrollVerticalLineChange
                    : this.scrollHorizontalLineChange),
                0,
              ));
      else {
        if ('document' === a) {
          e = this.documentBounds;
          c = this.viewportBounds;
          d = H.alloc();
          'up' === b
            ? (this.position = d.h(c.x, e.y))
            : 'left' === b
            ? (this.position = d.h(e.x, c.y))
            : 'down' === b
            ? (this.position = d.h(c.x, e.bottom - c.height))
            : 'right' === b && (this.position = d.h(e.right - c.width, c.y));
          H.free(d);
          return;
        }
        B(
          "scrolling unit must be 'pixel', 'line', 'page', or 'document', not: " +
            a,
        );
      }
      e /= this.scale;
      c = this.position.copy();
      'up' === b
        ? (c.y = this.position.y - e)
        : 'down' === b
        ? (c.y = this.position.y + e)
        : 'left' === b
        ? (c.x = this.position.x - e)
        : 'right' === b
        ? (c.x = this.position.x + e)
        : B(
            "scrolling direction must be 'up', 'down', 'left', or 'right', not: " +
              b,
          );
      this.position = c;
    };
    t.fw = function (a) {
      var b = this.viewportBounds;
      b.qf(a) ||
        ((a = a.center),
        (a.x -= b.width / 2),
        (a.y -= b.height / 2),
        (this.position = a));
    };
    t.bt = function (a) {
      var b = this.viewportBounds;
      a = a.center;
      a.x -= b.width / 2;
      a.y -= b.height / 2;
      this.position = a;
    };
    t.Mq = function (a) {
      var b = this.lb;
      b.reset();
      1 !== this.ya && b.scale(this.ya);
      var c = this.ma;
      (0 !== c.x || 0 !== c.y) &&
        isFinite(c.x) &&
        isFinite(c.y) &&
        b.translate(-c.x, -c.y);
      return a.copy().transform(this.lb);
    };
    t.DA = function (a) {
      var b = this.lb,
        c = a.x,
        d = a.y,
        e = c + a.width,
        f = d + a.height,
        g = b.m11,
        h = b.m12,
        k = b.m21,
        l = b.m22,
        m = b.dx,
        n = b.dy,
        p = c * g + d * k + m;
      b = c * h + d * l + n;
      var r = e * g + d * k + m;
      a = e * h + d * l + n;
      d = c * g + f * k + m;
      c = c * h + f * l + n;
      g = e * g + f * k + m;
      e = e * h + f * l + n;
      f = Math.min(p, r);
      p = Math.max(p, r);
      r = Math.min(b, a);
      b = Math.max(b, a);
      f = Math.min(f, d);
      p = Math.max(p, d);
      r = Math.min(r, c);
      b = Math.max(b, c);
      f = Math.min(f, g);
      p = Math.max(p, g);
      r = Math.min(r, e);
      b = Math.max(b, e);
      return new N(f, r, p - f, b - r);
    };
    t.Pt = function (a) {
      var b = this.lb;
      b.reset();
      1 !== this.ya && b.scale(this.ya);
      var c = this.ma;
      (0 !== c.x || 0 !== c.y) &&
        isFinite(c.x) &&
        isFinite(c.y) &&
        b.translate(-c.x, -c.y);
      return zb(a.copy(), this.lb);
    };
    function ik(a) {
      var b = a.isModified;
      a.av !== b && ((a.av = b), a.R('Modified'));
    }
    function jk(a) {
      a = ri.get(a);
      return null !== a ? new a() : new yi();
    }
    R.prototype.doModelChanged = function (a) {
      if (a.model === this.model) {
        var b = a.change,
          c = a.propertyName;
        if (b === re && 'S' === c[0])
          if ('StartingFirstTransaction' === c) {
            var d = this;
            a = this.toolManager;
            a.mouseDownTools.each(function (a) {
              a.diagram = d;
            });
            a.mouseMoveTools.each(function (a) {
              a.diagram = d;
            });
            a.mouseUpTools.each(function (a) {
              a.diagram = d;
            });
            this.Qb || this.ke || ((this.pj = !0), this.sj && (this.Pc = !0));
          } else
            'StartingUndo' === c || 'StartingRedo' === c
              ? ((a = this.animationManager),
                a.defaultAnimation.isAnimating &&
                  !this.skipsUndoManager &&
                  a.Uc(),
                this.R('ChangingSelection', this.selection))
              : 'StartedTransaction' === c &&
                ((a = this.animationManager),
                a.defaultAnimation.isAnimating &&
                  !this.skipsUndoManager &&
                  a.Uc());
        else if (this.Z) {
          this.Z = !1;
          try {
            if ('' === a.modelChange && b === re) {
              if ('FinishedUndo' === c || 'FinishedRedo' === c)
                this.R('ChangedSelection', this.selection), Ti(this);
              var e = this.animationManager;
              'RolledBackTransaction' === c && e.Uc();
              this.pj = !0;
              this.ud();
              (0 !== this.undoManager.transactionLevel &&
                1 !== this.undoManager.transactionLevel) ||
                Bh(e);
              'CommittedTransaction' === c &&
                this.undoManager.zu &&
                (this.Gd = Math.min(this.Gd, this.undoManager.historyIndex - 1));
              var f = a.isTransactionFinished;
              f && (ik(this), this.yt.clear(), Mh(this.animationManager));
              if (!this.hs && f) {
                this.hs = !0;
                var g = this;
                sa(function () {
                  g.currentTool.standardMouseOver();
                  g.hs = !1;
                }, 10);
              }
            }
          } finally {
            this.Z = !0;
          }
        }
      }
    };
    function Fj(a, b) {
      b = b.W.j;
      for (var c = b.length, d = 0; d < c; d++) kk(a, b[d]);
    }
    function kk(a, b) {
      if (b instanceof lk) {
        var c = b.element;
        if (null !== c && c instanceof HTMLImageElement) {
          var d = b.Vg;
          null !== d &&
            (d.cl instanceof Event && null !== b.Ac && b.Ac(b, d.cl),
            !0 === d.Pr &&
              (null !== b.hf && b.hf(b, d.Ou),
              null !== b.diagram && b.diagram.rs.add(b)));
          c = c.getAttribute('src');
          d = a.Ci.H(c);
          if (null === d) (d = []), d.push(b), a.Ci.add(c, d);
          else {
            for (a = 0; a < d.length; a++) if (d[a] === b) return;
            d.push(b);
          }
        }
      }
    }
    function mk(a, b) {
      if (b instanceof lk) {
        var c = b.element;
        if (null !== c && c instanceof HTMLImageElement) {
          c = c.getAttribute('src');
          var d = a.Ci.H(c);
          if (null !== d)
            for (var e = 0; e < d.length; e++)
              if (d[e] === b) {
                d.splice(e, 1);
                0 === d.length && (a.Ci.remove(c), nk(c));
                break;
              }
        }
      }
    }
    R.prototype.wd = function () {
      this.partManager.wd();
    };
    R.prototype.Tj = function (a, b) {
      this.Hc.Tj(a, b);
    };
    R.prototype.Vj = function (a, b) {
      this.Hc.Vj(a, b);
    };
    R.prototype.findPartForKey = function (a) {
      return this.partManager.findPartForKey(a);
    };
    R.prototype.Kb = function (a) {
      return this.partManager.Kb(a);
    };
    R.prototype.findLinkForKey = function (a) {
      return this.partManager.findLinkForKey(a);
    };
    t = R.prototype;
    t.vc = function (a) {
      return this.partManager.vc(a);
    };
    t.Ri = function (a) {
      return this.partManager.Ri(a);
    };
    t.uc = function (a) {
      return this.partManager.uc(a);
    };
    t.jt = function (a) {
      for (var b = [], c = 0; c < arguments.length; ++c) b[c] = arguments[c];
      return this.partManager.jt.apply(
        this.partManager,
        b instanceof Array ? b : da(ba(b)),
      );
    };
    t.it = function (a) {
      for (var b = [], c = 0; c < arguments.length; ++c) b[c] = arguments[c];
      return this.partManager.it.apply(
        this.partManager,
        b instanceof Array ? b : da(ba(b)),
      );
    };
    function Aj(a, b) {
      a.li = !1;
      var c = a.zn;
      c.A(b) ||
        ((b = b.G()),
        (a.zn = b),
        Vi(a, !1),
        a.R('DocumentBoundsChanged', null, c.copy()),
        Yi(a));
    }
    function Ji(a) {
      a.li && Aj(a, a.computeBounds());
    }
    t.vz = function () {
      for (var a = new F(), b = this.nodes; b.next(); ) {
        var c = b.value;
        c.isTopLevel && a.add(c);
      }
      for (b = this.links; b.next(); ) (c = b.value), c.isTopLevel && a.add(c);
      return a.iterator;
    };
    t.uz = function () {
      return this.Ah.iterator;
    };
    t.cA = function (a) {
      Ti(this);
      a && ok(this, !0);
      this.pj = !0;
      Kf(this);
    };
    function ok(a, b) {
      for (var c = a.Ah.iterator; c.next(); ) pk(a, c.value, b);
      null !== a.layout && (b ? (a.layout.isValidLayout = !1) : a.layout.C());
    }
    function pk(a, b, c) {
      if (null !== b) {
        for (var d = b.Al.iterator; d.next(); ) pk(a, d.value, c);
        null !== b.layout && (c ? (b.layout.isValidLayout = !1) : b.layout.C());
      }
    }
    function oj(a, b) {
      if (a.Hf && !a.sr) {
        var c = a.Z;
        a.Z = !0;
        var d = a.undoManager.transactionLevel,
          e = a.layout;
        try {
          0 === d && a.ta('Layout');
          var f = a.animationManager;
          1 >= d && !f.isAnimating && !f.jc && (b || zh(f, 'Layout'));
          a.Hf = !1;
          for (var g = a.Ah.iterator; g.next(); ) qk(a, g.value, b, d);
          e.isValidLayout ||
            (!b || e.isRealtime || null === e.isRealtime || 0 === d
              ? (e.doLayout(a), Ti(a), (e.isValidLayout = !0))
              : (a.Hf = !0));
        } finally {
          0 === d && a.Ua('Layout'), (a.Hf = !e.isValidLayout), (a.Z = c);
        }
      }
    }
    function qk(a, b, c, d) {
      if (null !== b) {
        for (var e = b.Al.iterator; e.next(); ) qk(a, e.value, c, d);
        e = b.layout;
        null === e ||
          e.isValidLayout ||
          (!c || e.isRealtime || 0 === d
            ? ((b.vk = !b.location.u()),
              e.doLayout(b),
              b.C(32),
              qj(a, b),
              (e.isValidLayout = !0))
            : (a.Hf = !0));
      }
    }
    t.Bz = function () {
      for (var a = new E(), b = this.nodes; b.next(); ) {
        var c = b.value;
        c.isTopLevel && null === c.Ui() && a.add(c);
      }
      return a.iterator;
    };
    function pi(a) {
      function b(a) {
        var b = a.toLowerCase(),
          e = new E();
        c.add(a, e);
        c.add(b, e);
        d.add(a, a);
        d.add(b, a);
      }
      var c = new G(),
        d = new G();
      b('InitialAnimationStarting');
      b('AnimationStarting');
      b('AnimationFinished');
      b('BackgroundSingleClicked');
      b('BackgroundDoubleClicked');
      b('BackgroundContextClicked');
      b('ClipboardChanged');
      b('ClipboardPasted');
      b('DocumentBoundsChanged');
      b('ExternalObjectsDropped');
      b('GainedFocus');
      b('InitialLayoutCompleted');
      b('LayoutCompleted');
      b('LinkDrawn');
      b('LinkRelinked');
      b('LinkReshaped');
      b('LostFocus');
      b('Modified');
      b('ObjectSingleClicked');
      b('ObjectDoubleClicked');
      b('ObjectContextClicked');
      b('PartCreated');
      b('PartResized');
      b('PartRotated');
      b('SelectionMoved');
      b('SelectionCopied');
      b('SelectionDeleting');
      b('SelectionDeleted');
      b('SelectionGrouped');
      b('SelectionUngrouped');
      b('ChangingSelection');
      b('ChangedSelection');
      b('SubGraphCollapsed');
      b('SubGraphExpanded');
      b('TextEdited');
      b('TreeCollapsed');
      b('TreeExpanded');
      b('ViewportBoundsChanged');
      b('InvalidateDraw');
      a.vr = c;
      a.ur = d;
    }
    function zj(a, b) {
      var c = a.ur.H(b);
      return null !== c ? c : a.ur.H(b.toLowerCase());
    }
    function rk(a, b) {
      var c = a.vr.H(b);
      if (null !== c) return c;
      c = a.vr.H(b.toLowerCase());
      if (null !== c) return c;
      B('Unknown DiagramEvent name: ' + b);
      return null;
    }
    t.Uj = function (a, b) {
      a = rk(this, a);
      null !== a && a.add(b);
    };
    t.ym = function (a, b) {
      a = rk(this, a);
      null !== a && a.remove(b);
    };
    t.R = function (a, b, c) {
      var d = rk(this, a),
        e = new oe();
      e.diagram = this;
      a = zj(this, a);
      null !== a && (e.name = a);
      void 0 !== b && (e.subject = b);
      void 0 !== c && (e.parameter = c);
      b = d.length;
      if (1 === b) d.L(0)(e);
      else if (0 !== b) for (d = d.na(), c = 0; c < b; c++) (0, d[c])(e);
    };
    function sk(a) {
      if (a.animationManager.isAnimating) return !1;
      var b = a.currentTool;
      return b === a.toolManager.findTool('Dragging')
        ? !a.Np || b.isComplexRoutingRealtime
        : !0;
    }
    t.mk = function (a, b) {
      void 0 === b && (b = null);
      return tk(this, !1, null, b).mk(a.x, a.y, a.width, a.height);
    };
    R.prototype.computeOccupiedArea = function () {
      return this.isVirtualized
        ? this.viewportBounds.copy()
        : this.li
        ? Ui(this)
        : this.documentBounds.copy();
    };
    function tk(a, b, c, d) {
      null === a.Hb && (a.Hb = new uk());
      if (a.Hb.st || a.Hb.group !== c || a.Hb.py !== d) {
        if (null === c) {
          b = a.computeOccupiedArea();
          b.Tc(100, 100);
          a.Hb.initialize(b);
          b = N.alloc();
          for (var e = a.nodes; e.next(); ) {
            var f = e.value,
              g = f.layer;
            null !== g && g.visible && !g.isTemporary && vk(a, f, d, b);
          }
          N.free(b);
        } else {
          0 < c.memberParts.count &&
            ((b = a.computePartsBounds(c.memberParts, !1)),
            b.Tc(20, 20),
            a.Hb.initialize(b));
          b = N.alloc();
          for (e = c.memberParts; e.next(); )
            (f = e.value), f instanceof U && vk(a, f, d, b);
          N.free(b);
        }
        a.Hb.group = c;
        a.Hb.py = d;
        a.Hb.st = !1;
      } else b && wk(a.Hb);
      return a.Hb;
    }
    function vk(a, b, c, d) {
      if (b !== c)
        if (b.isVisible() && b.avoidable && !b.isLinkLabel) {
          var e = b.getAvoidableRect(d),
            f = a.Hb.em;
          c = a.Hb.dm;
          d = e.x + e.width;
          b = e.y + e.height;
          for (var g = e.x; g < d; g += f) {
            for (var h = e.y; h < b; h += c) xk(a.Hb, g, h);
            xk(a.Hb, g, b);
          }
          for (e = e.y; e < b; e += c) xk(a.Hb, d, e);
          xk(a.Hb, d, b);
        } else if (b instanceof xf)
          for (b = b.memberParts; b.next(); )
            (e = b.value), e instanceof U && vk(a, e, c, d);
    }
    function yk(a, b) {
      null !== a.Hb &&
        !a.Hb.st &&
        (void 0 === b && (b = null),
        null === b || (b.avoidable && !b.isLinkLabel)) &&
        (a.Hb.st = !0);
    }
    t = R.prototype;
    t.ft = function (a) {
      this.an.assign(a);
      zk(this, this.an).Ma(this.position) ? this.Cf() : Ak(this);
    };
    function Ak(a) {
      -1 === a.jj &&
        (a.jj = sa(function () {
          if (-1 !== a.jj && (a.Cf(), null !== a.lastInput.event)) {
            var b = zk(a, a.an);
            b.Ma(a.position) ||
              ((a.position = b),
              (a.lastInput.documentPoint = a.Pt(a.an)),
              a.doMouseMove(),
              (a.li = !0),
              Aj(a, a.documentBounds.copy().Gc(a.computeBounds())),
              (a.gc = !0),
              a.ud(),
              Ak(a));
          }
        }, a.$m));
    }
    t.Cf = function () {
      -1 !== this.jj && (x.clearTimeout(this.jj), (this.jj = -1));
    };
    function zk(a, b) {
      var c = a.position,
        d = a.bn;
      if (0 >= d.top && 0 >= d.left && 0 >= d.right && 0 >= d.bottom) return c;
      var e = a.viewportBounds,
        f = a.scale;
      e = N.allocAt(0, 0, e.width * f, e.height * f);
      var g = H.allocAt(0, 0);
      if (b.x >= e.x && b.x < e.x + d.left) {
        var h = Math.max(a.scrollHorizontalLineChange, 1);
        h |= 0;
        g.x -= h;
        b.x < e.x + d.left / 2 && (g.x -= h);
        b.x < e.x + d.left / 4 && (g.x -= 4 * h);
      } else
        b.x <= e.x + e.width &&
          b.x > e.x + e.width - d.right &&
          ((h = Math.max(a.scrollHorizontalLineChange, 1)),
          (h |= 0),
          (g.x += h),
          b.x > e.x + e.width - d.right / 2 && (g.x += h),
          b.x > e.x + e.width - d.right / 4 && (g.x += 4 * h));
      b.y >= e.y && b.y < e.y + d.top
        ? ((a = Math.max(a.scrollVerticalLineChange, 1)),
          (a |= 0),
          (g.y -= a),
          b.y < e.y + d.top / 2 && (g.y -= a),
          b.y < e.y + d.top / 4 && (g.y -= 4 * a))
        : b.y <= e.y + e.height &&
          b.y > e.y + e.height - d.bottom &&
          ((a = Math.max(a.scrollVerticalLineChange, 1)),
          (a |= 0),
          (g.y += a),
          b.y > e.y + e.height - d.bottom / 2 && (g.y += a),
          b.y > e.y + e.height - d.bottom / 4 && (g.y += 4 * a));
      g.Ma(Fb) || (c = new H(c.x + g.x / f, c.y + g.y / f));
      N.free(e);
      H.free(g);
      return c;
    }
    t.At = function () {
      return null;
    };
    t.Nv = function () {
      return null;
    };
    t.My = function (a, b) {
      this.lx.add(a, b);
    };
    function Bk(a, b, c) {
      function d() {
        var a = +new Date();
        f = !0;
        for (g.reset(); g.next(); )
          if (!g.value[0].wl) {
            f = !1;
            break;
          }
        f || a - l > k ? b(c, e, h) : x.requestAnimationFrame(d);
      }
      for (var e = c.callback, f = !0, g = a.Ci.iterator; g.next(); )
        if (!g.value[0].wl) {
          f = !1;
          break;
        }
      if ('function' !== typeof e || f) return b(c, e, a);
      var h = a,
        k = c.callbackTimeout || 300,
        l = +new Date();
      x.requestAnimationFrame(function () {
        d();
      });
      return null;
    }
    t.eA = function (a) {
      if (!Vg) return null;
      void 0 === a && (a = new db());
      a.returnType = 'Image';
      return this.Vx(a);
    };
    t.Vx = function (a) {
      void 0 === a && (a = new db());
      return Bk(this, this.fA, a);
    };
    t.fA = function (a, b, c) {
      var d = Ck(c, a, 'canvas', null);
      if (null === d) return null;
      c = d.V.canvas;
      var e = null;
      if (null !== c)
        switch (
          ((e = a.returnType),
          void 0 === e ? (e = 'string') : (e = e.toLowerCase()),
          e)
        ) {
          case 'imagedata':
            e = d.getImageData(0, 0, c.width, c.height);
            break;
          case 'image':
            d = (a.document || document).createElement('img');
            d.src = c.toDataURL(a.type, a.details);
            e = d;
            break;
          case 'blob':
            'function' !== typeof b &&
              B(
                'Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.',
              );
            if ('function' === typeof c.toBlob)
              return c.toBlob(b, a.type, a.details), 'toBlob';
            if ('function' === typeof c.msToBlob)
              return b(c.msToBlob()), 'msToBlob';
            b(null);
            return null;
          default:
            e = c.toDataURL(a.type, a.details);
        }
      return 'function' === typeof b ? (b(e), null) : e;
    };
    function Ck(a, b, c, d) {
      a.animationManager.Uc();
      a.ud();
      if (null === a.Ba) return null;
      'object' !== typeof b && B('properties argument must be an Object.');
      var e = b.size || null,
        f = b.scale || null;
      void 0 !== b.scale && isNaN(b.scale) && (f = 'NaN');
      var g = b.maxSize;
      void 0 === b.maxSize &&
        (g = 'SVG' === c ? new L(Infinity, Infinity) : new L(2e3, 2e3));
      var h = b.position || null,
        k = b.parts || null,
        l = void 0 === b.padding ? 1 : b.padding,
        m = b.background || null,
        n = b.omitTemporary;
      void 0 === n && (n = !0);
      var p = b.document || document,
        r = b.elementFinished || null,
        q = b.showTemporary;
      void 0 === q && (q = !n);
      b = b.showGrid;
      void 0 === b && (b = q);
      null !== e && isNaN(e.width) && isNaN(e.height) && (e = null);
      'number' === typeof l
        ? (l = new oc(l))
        : l instanceof oc || B('MakeImage padding must be a Margin or a number.');
      l.left = Math.max(l.left, 0);
      l.right = Math.max(l.right, 0);
      l.top = Math.max(l.top, 0);
      l.bottom = Math.max(l.bottom, 0);
      a.Wc.Qc(!0);
      n = new Dk(null, p);
      var u = n.context;
      if (!(e || f || k || h)) {
        n.width = a.va + Math.ceil(l.left + l.right);
        n.height = a.ua + Math.ceil(l.top + l.bottom);
        if ('SVG' === c) {
          if (null === d) return null;
          d.resize(n.width, n.height, n.width, n.height);
          d.ownerDocument = p;
          d.iq = r;
          xj(a, d.context, l, new L(n.width, n.height), a.ya, a.ma, k, m, q, b);
          return d.context;
        }
        a.Yk = !1;
        xj(a, u, l, new L(n.width, n.height), a.ya, a.ma, k, m, q, b);
        a.Yk = !0;
        return n.context;
      }
      var v = a.yn,
        w = a.documentBounds.copy();
      w.nw(a.ab);
      if (q)
        for (var y = a.Ia.j, z = y.length, A = 0; A < z; A++) {
          var C = y[A];
          if (C.visible && C.isTemporary) {
            C = C.Ca.j;
            for (var I = C.length, P = 0; P < I; P++) {
              var K = C[P];
              K.isInDocumentBounds &&
                K.isVisible() &&
                ((K = K.actualBounds), K.u() && w.Gc(K));
            }
          }
        }
      y = new H(w.x, w.y);
      if (null !== k) {
        z = !0;
        A = k.iterator;
        for (A.reset(); A.next(); )
          if (
            ((C = A.value),
            C instanceof T &&
              ((I = C.layer),
              (null === I || I.visible) &&
                (null === I || q || !I.isTemporary) &&
                C.isVisible() &&
                ((C = C.actualBounds), C.u())))
          )
            if (z) {
              z = !1;
              var V = C.copy();
            } else V.Gc(C);
        z && (V = new N(0, 0, 0, 0));
        w.width = V.width;
        w.height = V.height;
        y.x = V.x;
        y.y = V.y;
      }
      null !== h && h.u() && ((y = h), f || (f = v));
      V = h = 0;
      null !== l && ((h = l.left + l.right), (V = l.top + l.bottom));
      z = A = 0;
      null !== e &&
        ((A = e.width),
        (z = e.height),
        isFinite(A) && (A = Math.max(0, A - h)),
        isFinite(z) && (z = Math.max(0, z - V)));
      null !== e && null !== f
        ? ('NaN' === f && (f = v),
          e.u()
            ? ((e = A), (w = z))
            : isNaN(z)
            ? ((e = A), (w = w.height * f))
            : ((e = w.width * f), (w = z)))
        : null !== e
        ? e.u()
          ? ((f = Math.min(A / w.width, z / w.height)), (e = A), (w = z))
          : isNaN(z)
          ? ((f = A / w.width), (e = A), (w = w.height * f))
          : ((f = z / w.height), (e = w.width * f), (w = z))
        : null !== f
        ? 'NaN' === f && g.u()
          ? ((f = Math.min((g.width - h) / w.width, (g.height - V) / w.height)),
            f > v
              ? ((f = v), (e = w.width), (w = w.height))
              : ((e = g.width), (w = g.height)))
          : ((e = w.width * f), (w = w.height * f))
        : ((f = v), (e = w.width), (w = w.height));
      null !== l ? ((e += h), (w += V)) : (l = new oc(0));
      null !== g &&
        ((v = g.width),
        (g = g.height),
        isNaN(v) && (v = 2e3),
        isNaN(g) && (g = 2e3),
        isFinite(v) && (e = Math.min(e, v)),
        isFinite(g) && (w = Math.min(w, g)));
      n.width = Math.ceil(e);
      n.height = Math.ceil(w);
      if ('SVG' === c) {
        if (null === d) return null;
        d.resize(n.width, n.height, n.width, n.height);
        d.ownerDocument = p;
        d.iq = r;
        xj(a, d.context, l, new L(Math.ceil(e), Math.ceil(w)), f, y, k, m, q, b);
        return d.context;
      }
      a.Yk = !1;
      xj(a, u, l, new L(Math.ceil(e), Math.ceil(w)), f, y, k, m, q, b);
      a.Yk = !0;
      return n.context;
    }
    ma.Object.defineProperties(R.prototype, {
      div: {
        get: function () {
          return this.Fa;
        },
        set: function (a) {
          if (this.Fa !== a) {
            Qa = [];
            var b = this.Fa;
            null !== b
              ? ((b.B = void 0),
                (b.innerHTML = ''),
                null !== this.Ba &&
                  ((b = this.Ba.Da),
                  this.removeEventListener(b, 'touchstart', this.sw, !1),
                  this.removeEventListener(b, 'touchmove', this.rw, !1),
                  this.removeEventListener(b, 'touchend', this.qw, !1),
                  this.Ba.Ix()),
                (b = this.toolManager),
                null !== b &&
                  (b.mouseDownTools.each(function (a) {
                    a.cancelWaitAfter();
                  }),
                  b.mouseMoveTools.each(function (a) {
                    a.cancelWaitAfter();
                  }),
                  b.mouseUpTools.each(function (a) {
                    a.cancelWaitAfter();
                  })),
                b.cancelWaitAfter(),
                this.currentTool.doCancel(),
                (this.Wc = this.Ba = null),
                this.removeEventListener(x, 'resize', this.yw, !1),
                this.removeEventListener(x, 'mousemove', this.rk, !0),
                this.removeEventListener(x, 'mousedown', this.qk, !0),
                this.removeEventListener(x, 'mouseup', this.tk, !0),
                this.removeEventListener(x, 'wheel', this.uk, !0),
                this.removeEventListener(x, 'mouseout', this.sk, !0),
                ye === this && (ye = null))
              : (this.ke = !1);
            this.Fa = null;
            if (null !== a) {
              if ((b = a.B)) b.div = null;
              Fi(this, a);
              this.zf();
            }
          }
        },
      },
      zx: {
        get: function () {
          return this.Ho;
        },
      },
      lk: {
        get: function () {
          return this.ke;
        },
      },
      draggedLink: {
        get: function () {
          return this.xr;
        },
        set: function (a) {
          this.xr !== a &&
            ((this.xr = a),
            null !== a && ((this.ms = a.fromPort), (this.ns = a.toPort)));
        },
      },
      Yx: {
        get: function () {
          return this.ms;
        },
        set: function (a) {
          this.ms = a;
        },
      },
      Zx: {
        get: function () {
          return this.ns;
        },
        set: function (a) {
          this.ns = a;
        },
      },
      animationManager: {
        get: function () {
          return this.Hc;
        },
      },
      undoManager: {
        get: function () {
          return this.bc.undoManager;
        },
      },
      skipsUndoManager: {
        get: function () {
          return this.sg;
        },
        set: function (a) {
          this.sg = a;
          this.bc.skipsUndoManager = a;
        },
      },
      delaysLayout: {
        get: function () {
          return this.sr;
        },
        set: function (a) {
          this.sr = a;
        },
      },
      opacity: {
        get: function () {
          return this.jb;
        },
        set: function (a) {
          var b = this.jb;
          b !== a &&
            ((0 > a || 1 < a) && va(a, '0 <= value <= 1', R, 'opacity'),
            (this.jb = a),
            this.g('opacity', b, a),
            this.N());
        },
      },
      validCycle: {
        get: function () {
          return this.Ws;
        },
        set: function (a) {
          var b = this.Ws;
          b !== a && ((this.Ws = a), this.g('validCycle', b, a));
        },
      },
      layers: {
        get: function () {
          return this.Ia.iterator;
        },
      },
      isModelReadOnly: {
        get: function () {
          var a = this.bc;
          return null === a ? !1 : a.isReadOnly;
        },
        set: function (a) {
          var b = this.bc;
          null !== b && (b.isReadOnly = a);
        },
      },
      isReadOnly: {
        get: function () {
          return this.Yf;
        },
        set: function (a) {
          var b = this.Yf;
          b !== a && ((this.Yf = a), this.g('isReadOnly', b, a));
        },
      },
      isEnabled: {
        get: function () {
          return this.Kc;
        },
        set: function (a) {
          var b = this.Kc;
          b !== a && ((this.Kc = a), this.g('isEnabled', b, a));
        },
      },
      allowClipboard: {
        get: function () {
          return this.Tq;
        },
        set: function (a) {
          var b = this.Tq;
          b !== a && ((this.Tq = a), this.g('allowClipboard', b, a));
        },
      },
      allowCopy: {
        get: function () {
          return this.Sh;
        },
        set: function (a) {
          var b = this.Sh;
          b !== a && ((this.Sh = a), this.g('allowCopy', b, a));
        },
      },
      allowDelete: {
        get: function () {
          return this.Th;
        },
        set: function (a) {
          var b = this.Th;
          b !== a && ((this.Th = a), this.g('allowDelete', b, a));
        },
      },
      allowDragOut: {
        get: function () {
          return this.Uq;
        },
        set: function (a) {
          var b = this.Uq;
          b !== a && ((this.Uq = a), this.g('allowDragOut', b, a));
        },
      },
      allowDrop: {
        get: function () {
          return this.Vq;
        },
        set: function (a) {
          var b = this.Vq;
          b !== a && ((this.Vq = a), this.g('allowDrop', b, a));
        },
      },
      allowTextEdit: {
        get: function () {
          return this.bi;
        },
        set: function (a) {
          var b = this.bi;
          b !== a && ((this.bi = a), this.g('allowTextEdit', b, a));
        },
      },
      allowGroup: {
        get: function () {
          return this.Uh;
        },
        set: function (a) {
          var b = this.Uh;
          b !== a && ((this.Uh = a), this.g('allowGroup', b, a));
        },
      },
      allowUngroup: {
        get: function () {
          return this.ci;
        },
        set: function (a) {
          var b = this.ci;
          b !== a && ((this.ci = a), this.g('allowUngroup', b, a));
        },
      },
      allowInsert: {
        get: function () {
          return this.Xq;
        },
        set: function (a) {
          var b = this.Xq;
          b !== a && ((this.Xq = a), this.g('allowInsert', b, a));
        },
      },
      allowLink: {
        get: function () {
          return this.Vh;
        },
        set: function (a) {
          var b = this.Vh;
          b !== a && ((this.Vh = a), this.g('allowLink', b, a));
        },
      },
      allowRelink: {
        get: function () {
          return this.Xh;
        },
        set: function (a) {
          var b = this.Xh;
          b !== a && ((this.Xh = a), this.g('allowRelink', b, a));
        },
      },
      allowMove: {
        get: function () {
          return this.Wh;
        },
        set: function (a) {
          var b = this.Wh;
          b !== a && ((this.Wh = a), this.g('allowMove', b, a));
        },
      },
      allowReshape: {
        get: function () {
          return this.Yh;
        },
        set: function (a) {
          var b = this.Yh;
          b !== a && ((this.Yh = a), this.g('allowReshape', b, a));
        },
      },
      allowResize: {
        get: function () {
          return this.Zh;
        },
        set: function (a) {
          var b = this.Zh;
          b !== a && ((this.Zh = a), this.g('allowResize', b, a));
        },
      },
      allowRotate: {
        get: function () {
          return this.$h;
        },
        set: function (a) {
          var b = this.$h;
          b !== a && ((this.$h = a), this.g('allowRotate', b, a));
        },
      },
      allowSelect: {
        get: function () {
          return this.ai;
        },
        set: function (a) {
          var b = this.ai;
          b !== a && ((this.ai = a), this.g('allowSelect', b, a));
        },
      },
      allowUndo: {
        get: function () {
          return this.Yq;
        },
        set: function (a) {
          var b = this.Yq;
          b !== a && ((this.Yq = a), this.g('allowUndo', b, a));
        },
      },
      allowZoom: {
        get: function () {
          return this.$q;
        },
        set: function (a) {
          var b = this.$q;
          b !== a && ((this.$q = a), this.g('allowZoom', b, a));
        },
      },
      hasVerticalScrollbar: {
        get: function () {
          return this.el;
        },
        set: function (a) {
          var b = this.el;
          b !== a &&
            ((this.el = a),
            Yi(this),
            this.N(),
            this.g('hasVerticalScrollbar', b, a),
            Vi(this, !1));
        },
      },
      hasHorizontalScrollbar: {
        get: function () {
          return this.dl;
        },
        set: function (a) {
          var b = this.dl;
          b !== a &&
            ((this.dl = a),
            Yi(this),
            this.N(),
            this.g('hasHorizontalScrollbar', b, a),
            Vi(this, !1));
        },
      },
      allowHorizontalScroll: {
        get: function () {
          return this.Wq;
        },
        set: function (a) {
          var b = this.Wq;
          b !== a &&
            ((this.Wq = a), this.g('allowHorizontalScroll', b, a), Vi(this, !1));
        },
      },
      allowVerticalScroll: {
        get: function () {
          return this.Zq;
        },
        set: function (a) {
          var b = this.Zq;
          b !== a &&
            ((this.Zq = a), this.g('allowVerticalScroll', b, a), Vi(this, !1));
        },
      },
      scrollHorizontalLineChange: {
        get: function () {
          return this.Bs;
        },
        set: function (a) {
          var b = this.Bs;
          b !== a &&
            (0 > a && va(a, '>= 0', R, 'scrollHorizontalLineChange'),
            (this.Bs = a),
            this.g('scrollHorizontalLineChange', b, a));
        },
      },
      scrollVerticalLineChange: {
        get: function () {
          return this.Fs;
        },
        set: function (a) {
          var b = this.Fs;
          b !== a &&
            (0 > a && va(a, '>= 0', R, 'scrollVerticalLineChange'),
            (this.Fs = a),
            this.g('scrollVerticalLineChange', b, a));
        },
      },
      lastInput: {
        get: function () {
          return this.eh;
        },
        set: function (a) {
          this.eh = a;
        },
      },
      firstInput: {
        get: function () {
          return this.Tf;
        },
        set: function (a) {
          this.Tf = a;
        },
      },
      currentCursor: {
        get: function () {
          return this.lr;
        },
        set: function (a) {
          '' === a && (a = this.xn);
          if (this.lr !== a) {
            var b = this.Ba,
              c = this.Fa;
            if (null !== b) {
              this.lr = a;
              var d = b.style.cursor;
              b.style.cursor = a;
              c.style.cursor = a;
              b.style.cursor === d &&
                ((b.style.cursor = '-webkit-' + a),
                (c.style.cursor = '-webkit-' + a),
                b.style.cursor === d &&
                  ((b.style.cursor = '-moz-' + a),
                  (c.style.cursor = '-moz-' + a),
                  b.style.cursor === d &&
                    ((b.style.cursor = a), (c.style.cursor = a))));
            }
          }
        },
      },
      defaultCursor: {
        get: function () {
          return this.xn;
        },
        set: function (a) {
          '' === a && (a = 'auto');
          var b = this.xn;
          b !== a && ((this.xn = a), this.g('defaultCursor', b, a));
        },
      },
      click: {
        get: function () {
          return this.Mf;
        },
        set: function (a) {
          var b = this.Mf;
          b !== a && ((this.Mf = a), this.g('click', b, a));
        },
      },
      doubleClick: {
        get: function () {
          return this.Rf;
        },
        set: function (a) {
          var b = this.Rf;
          b !== a && ((this.Rf = a), this.g('doubleClick', b, a));
        },
      },
      contextClick: {
        get: function () {
          return this.Nf;
        },
        set: function (a) {
          var b = this.Nf;
          b !== a && ((this.Nf = a), this.g('contextClick', b, a));
        },
      },
      mouseOver: {
        get: function () {
          return this.jg;
        },
        set: function (a) {
          var b = this.jg;
          b !== a && ((this.jg = a), this.g('mouseOver', b, a));
        },
      },
      mouseHover: {
        get: function () {
          return this.hg;
        },
        set: function (a) {
          var b = this.hg;
          b !== a && ((this.hg = a), this.g('mouseHover', b, a));
        },
      },
      mouseHold: {
        get: function () {
          return this.gg;
        },
        set: function (a) {
          var b = this.gg;
          b !== a && ((this.gg = a), this.g('mouseHold', b, a));
        },
      },
      mouseDragOver: {
        get: function () {
          return this.gs;
        },
        set: function (a) {
          var b = this.gs;
          b !== a && ((this.gs = a), this.g('mouseDragOver', b, a));
        },
      },
      mouseDrop: {
        get: function () {
          return this.eg;
        },
        set: function (a) {
          var b = this.eg;
          b !== a && ((this.eg = a), this.g('mouseDrop', b, a));
        },
      },
      handlesDragDropForTopLevelParts: {
        get: function () {
          return this.Ir;
        },
        set: function (a) {
          var b = this.Ir;
          b !== a &&
            ((this.Ir = a), this.g('handlesDragDropForTopLevelParts', b, a));
        },
      },
      mouseEnter: {
        get: function () {
          return this.fg;
        },
        set: function (a) {
          var b = this.fg;
          b !== a && ((this.fg = a), this.g('mouseEnter', b, a));
        },
      },
      mouseLeave: {
        get: function () {
          return this.ig;
        },
        set: function (a) {
          var b = this.ig;
          b !== a && ((this.ig = a), this.g('mouseLeave', b, a));
        },
      },
      toolTip: {
        get: function () {
          return this.ug;
        },
        set: function (a) {
          var b = this.ug;
          b !== a && ((this.ug = a), this.g('toolTip', b, a));
        },
      },
      contextMenu: {
        get: function () {
          return this.Of;
        },
        set: function (a) {
          var b = this.Of;
          b !== a && ((this.Of = a), this.g('contextMenu', b, a));
        },
      },
      commandHandler: {
        get: function () {
          return this.fr;
        },
        set: function (a) {
          this.fr !== a && ((this.fr = a), a.Zd(this));
        },
      },
      toolManager: {
        get: function () {
          return this.Ss;
        },
        set: function (a) {
          this.Ss !== a && ((this.Ss = a), (a.diagram = this));
        },
      },
      defaultTool: {
        get: function () {
          return this.rr;
        },
        set: function (a) {
          var b = this.rr;
          b !== a &&
            ((this.rr = a),
            (a.diagram = this),
            this.currentTool === b && (this.currentTool = a));
        },
      },
      currentTool: {
        get: function () {
          return this.nr;
        },
        set: function (a) {
          var b = this.nr;
          null !== b &&
            (b.isActive && b.doDeactivate(), b.cancelWaitAfter(), b.doStop());
          null === a && (a = this.defaultTool);
          null !== a && ((this.nr = a), (a.diagram = this), a.doStart());
        },
      },
      selection: {
        get: function () {
          return this.Qu;
        },
      },
      maxSelectionCount: {
        get: function () {
          return this.cs;
        },
        set: function (a) {
          var b = this.cs;
          if (b !== a)
            if (0 <= a && !isNaN(a)) {
              if (
                ((this.cs = a),
                this.g('maxSelectionCount', b, a),
                !this.undoManager.isUndoingRedoing &&
                  ((a = this.selection.count - a), 0 < a))
              ) {
                this.R('ChangingSelection', this.selection);
                b = this.selection.na();
                for (var c = 0; c < a; c++) b[c].isSelected = !1;
                this.R('ChangedSelection', this.selection);
              }
            } else va(a, '>= 0', R, 'maxSelectionCount');
        },
      },
      nodeSelectionAdornmentTemplate: {
        get: function () {
          return this.Qo;
        },
        set: function (a) {
          var b = this.Qo;
          b !== a &&
            ((this.Qo = a), this.g('nodeSelectionAdornmentTemplate', b, a));
        },
      },
      groupSelectionAdornmentTemplate: {
        get: function () {
          return this.Vn;
        },
        set: function (a) {
          var b = this.Vn;
          b !== a &&
            ((this.Vn = a), this.g('groupSelectionAdornmentTemplate', b, a));
        },
      },
      linkSelectionAdornmentTemplate: {
        get: function () {
          return this.qo;
        },
        set: function (a) {
          var b = this.qo;
          b !== a &&
            ((this.qo = a), this.g('linkSelectionAdornmentTemplate', b, a));
        },
      },
      highlighteds: {
        get: function () {
          return this.ru;
        },
      },
      isModified: {
        get: function () {
          var a = this.undoManager;
          return a.isEnabled
            ? null !== a.currentTransaction
              ? !0
              : this.$n && this.Gd !== a.historyIndex
            : this.$n;
        },
        set: function (a) {
          if (this.$n !== a) {
            this.$n = a;
            var b = this.undoManager;
            !a && b.isEnabled && (this.Gd = b.historyIndex);
            a || ik(this);
          }
        },
      },
      model: {
        get: function () {
          return this.bc;
        },
        set: function (a) {
          var b = this.bc;
          if (b !== a) {
            this.currentTool.doCancel();
            null !== b &&
              b.undoManager !== a.undoManager &&
              b.undoManager.isInTransaction &&
              B(
                'Do not replace a Diagram.model while a transaction is in progress.',
              );
            this.animationManager.Uc(!0);
            var c = Ii(this, !0);
            this.ke = !1;
            this.sj = !0;
            this.Gd = -2;
            this.Pc = !1;
            var d = this.Qb;
            this.Qb = !0;
            zh(this.animationManager, 'Model');
            null !== b &&
              (null !== this.qe &&
                this.qe.each(function (a) {
                  b.xk(a);
                }),
              b.xk(this.Y));
            this.bc = a;
            this.partManager = jk(this.bc.constructor.type);
            for (var e = 0; e < c.length; e++) this.add(c[e]);
            a.Eh(this.I);
            this.partManager.addAllModeledParts();
            a.xk(this.I);
            a.Eh(this.Y);
            null !== this.qe &&
              this.qe.each(function (b) {
                a.Eh(b);
              });
            this.Qb = d;
            this.Gb || this.N();
            null !== b && a.undoManager.copyProperties(b.undoManager);
          }
        },
      },
      Z: {
        get: function () {
          return this.yu;
        },
        set: function (a) {
          this.yu = a;
        },
      },
      yt: {
        get: function () {
          return this.ax;
        },
      },
      skipsModelSourceBindings: {
        get: function () {
          return this.Ru;
        },
        set: function (a) {
          this.Ru = a;
        },
      },
      Ot: {
        get: function () {
          return this.Ks;
        },
        set: function (a) {
          this.Ks = a;
        },
      },
      nodeTemplate: {
        get: function () {
          return this.We.H('');
        },
        set: function (a) {
          var b = this.We.H('');
          b !== a &&
            (this.We.add('', a),
            this.g('nodeTemplate', b, a),
            this.undoManager.isUndoingRedoing || this.wd());
        },
      },
      nodeTemplateMap: {
        get: function () {
          return this.We;
        },
        set: function (a) {
          var b = this.We;
          b !== a &&
            ((this.We = a),
            this.g('nodeTemplateMap', b, a),
            this.undoManager.isUndoingRedoing || this.wd());
        },
      },
      groupTemplate: {
        get: function () {
          return this.ah.H('');
        },
        set: function (a) {
          var b = this.ah.H('');
          b !== a &&
            (this.ah.add('', a),
            this.g('groupTemplate', b, a),
            this.undoManager.isUndoingRedoing || this.wd());
        },
      },
      groupTemplateMap: {
        get: function () {
          return this.ah;
        },
        set: function (a) {
          var b = this.ah;
          b !== a &&
            ((this.ah = a),
            this.g('groupTemplateMap', b, a),
            this.undoManager.isUndoingRedoing || this.wd());
        },
      },
      linkTemplate: {
        get: function () {
          return this.$f.H('');
        },
        set: function (a) {
          var b = this.$f.H('');
          b !== a &&
            (this.$f.add('', a),
            this.g('linkTemplate', b, a),
            this.undoManager.isUndoingRedoing || this.wd());
        },
      },
      linkTemplateMap: {
        get: function () {
          return this.$f;
        },
        set: function (a) {
          var b = this.$f;
          b !== a &&
            ((this.$f = a),
            this.g('linkTemplateMap', b, a),
            this.undoManager.isUndoingRedoing || this.wd());
        },
      },
      isMouseCaptured: {
        get: function () {
          return this.wu;
        },
        set: function (a) {
          var b = this.Ba;
          null !== b &&
            ((b = b.Da),
            b instanceof SVGElement ||
              (a
                ? ((this.lastInput.bubbles = !1),
                  this.Wm
                    ? (this.removeEventListener(b, 'pointermove', this.um, !1),
                      this.removeEventListener(b, 'pointerdown', this.tm, !1),
                      this.removeEventListener(b, 'pointerup', this.wm, !1),
                      this.removeEventListener(b, 'pointerout', this.vm, !1),
                      this.addEventListener(x, 'pointermove', this.um, !0),
                      this.addEventListener(x, 'pointerdown', this.tm, !0),
                      this.addEventListener(x, 'pointerup', this.wm, !0),
                      this.addEventListener(x, 'pointerout', this.vm, !0))
                    : (this.removeEventListener(b, 'mousemove', this.rk, !1),
                      this.removeEventListener(b, 'mousedown', this.qk, !1),
                      this.removeEventListener(b, 'mouseup', this.tk, !1),
                      this.removeEventListener(b, 'mouseout', this.sk, !1),
                      this.addEventListener(x, 'mousemove', this.rk, !0),
                      this.addEventListener(x, 'mousedown', this.qk, !0),
                      this.addEventListener(x, 'mouseup', this.tk, !0),
                      this.addEventListener(x, 'mouseout', this.sk, !0)),
                  this.removeEventListener(b, 'wheel', this.uk, !1),
                  this.addEventListener(x, 'wheel', this.uk, !0),
                  this.addEventListener(
                    x,
                    'selectstart',
                    this.preventDefault,
                    !1,
                  ))
                : (this.Wm
                    ? (this.removeEventListener(x, 'pointermove', this.um, !0),
                      this.removeEventListener(x, 'pointerdown', this.tm, !0),
                      this.removeEventListener(x, 'pointerup', this.wm, !0),
                      this.removeEventListener(x, 'pointerout', this.vm, !0),
                      this.addEventListener(b, 'pointermove', this.um, !1),
                      this.addEventListener(b, 'pointerdown', this.tm, !1),
                      this.addEventListener(b, 'pointerup', this.wm, !1),
                      this.addEventListener(b, 'pointerout', this.vm, !1))
                    : (this.removeEventListener(x, 'mousemove', this.rk, !0),
                      this.removeEventListener(x, 'mousedown', this.qk, !0),
                      this.removeEventListener(x, 'mouseup', this.tk, !0),
                      this.removeEventListener(x, 'mouseout', this.sk, !0),
                      this.addEventListener(b, 'mousemove', this.rk, !1),
                      this.addEventListener(b, 'mousedown', this.qk, !1),
                      this.addEventListener(b, 'mouseup', this.tk, !1),
                      this.addEventListener(b, 'mouseout', this.sk, !1)),
                  this.removeEventListener(x, 'wheel', this.uk, !0),
                  this.removeEventListener(
                    x,
                    'selectstart',
                    this.preventDefault,
                    !1,
                  ),
                  this.addEventListener(b, 'wheel', this.uk, !1)),
              (this.wu = a)));
        },
      },
      position: {
        get: function () {
          return this.ma;
        },
        set: function (a) {
          var b = H.alloc().assign(this.ma);
          if (!b.A(a)) {
            var c = this.viewportBounds.copy();
            this.ma.assign(a);
            Oh(this.animationManager, b, this.ma);
            this.Gb ||
              (null === this.Ba && !this.$l.u()) ||
              ((this.Gb = !0),
              (a = this.scale),
              Xi(this, this.zn, this.va / a, this.ua / a, this.lj, !1),
              (this.Gb = !1));
            this.Gb || this.Aq(c, this.viewportBounds, this.ya, !1);
          }
          H.free(b);
        },
      },
      initialPosition: {
        get: function () {
          return this.Kr;
        },
        set: function (a) {
          this.Kr.A(a) || (this.Kr = a.G());
        },
      },
      initialScale: {
        get: function () {
          return this.Lr;
        },
        set: function (a) {
          this.Lr !== a && (this.Lr = a);
        },
      },
      grid: {
        get: function () {
          null === this.Fb && Oi(this);
          return this.Fb;
        },
        set: function (a) {
          var b = this.Fb;
          if (b !== a) {
            null === b && (Oi(this), (b = this.Fb));
            a.type !== X.Grid &&
              B('Diagram.grid must be a Panel of type Panel.Grid');
            var c = b.panel;
            null !== c && c.remove(b);
            this.Fb = a;
            a.name = 'GRID';
            null !== c && c.add(a);
            nj(this);
            this.N();
            this.g('grid', b, a);
          }
        },
      },
      viewportBounds: {
        get: function () {
          var a = this.$u,
            b = this.ma,
            c = this.ya;
          if (null === this.Ba)
            return this.$l.u() && a.h(b.x, b.y, this.va / c, this.ua / c), a;
          a.h(b.x, b.y, Math.max(this.va, 0) / c, Math.max(this.ua, 0) / c);
          return a;
        },
      },
      viewSize: {
        get: function () {
          return this.$l;
        },
        set: function (a) {
          var b = this.viewSize;
          b.A(a) ||
            ((this.$l = a = a.G()),
            (this.va = a.width),
            (this.ua = a.height),
            this.Na(),
            this.g('viewSize', b, a));
        },
      },
      fixedBounds: {
        get: function () {
          return this.Fr;
        },
        set: function (a) {
          var b = this.Fr;
          b.A(a) ||
            ((-Infinity !== a.width &&
              Infinity !== a.height &&
              -Infinity !== a.height) ||
              B('fixedBounds width/height must not be Infinity'),
            (this.Fr = a = a.G()),
            this.Na(),
            this.g('fixedBounds', b, a));
        },
      },
      scrollMargin: {
        get: function () {
          return this.Fi;
        },
        set: function (a) {
          'number' === typeof a && (a = new oc(a));
          var b = this.Fi;
          b.A(a) ||
            ((this.Fi = a = a.G()), this.g('scrollMargin', b, a), this.zf());
        },
      },
      scrollMode: {
        get: function () {
          return this.Gi;
        },
        set: function (a) {
          var b = this.Gi;
          b !== a &&
            ((this.Gi = a),
            a === Vh && Vi(this, !1),
            this.g('scrollMode', b, a),
            this.N());
        },
      },
      scrollsPageOnFocus: {
        get: function () {
          return this.Gs;
        },
        set: function (a) {
          var b = this.Gs;
          b !== a && ((this.Gs = a), this.g('scrollsPageOnFocus', b, a));
        },
      },
      positionComputation: {
        get: function () {
          return this.us;
        },
        set: function (a) {
          var b = this.us;
          b !== a &&
            ((this.us = a), Vi(this, !1), this.g('positionComputation', b, a));
        },
      },
      scaleComputation: {
        get: function () {
          return this.zs;
        },
        set: function (a) {
          var b = this.zs;
          b !== a &&
            ((this.zs = a),
            dk(this, this.scale, this.scale),
            this.g('scaleComputation', b, a));
        },
      },
      documentBounds: {
        get: function () {
          return this.zn;
        },
      },
      isVirtualized: {
        get: function () {
          return this.Vr;
        },
        set: function (a) {
          var b = this.Vr;
          b !== a && ((this.Vr = a), this.g('isVirtualized', b, a));
        },
      },
      scale: {
        get: function () {
          return this.ya;
        },
        set: function (a) {
          var b = this.ya;
          b !== a && dk(this, b, a);
        },
      },
      defaultScale: {
        get: function () {
          return this.yn;
        },
        set: function (a) {
          this.yn = a;
        },
      },
      autoScale: {
        get: function () {
          return this.Lg;
        },
        set: function (a) {
          var b = this.Lg;
          b !== a &&
            ((this.Lg = a), this.g('autoScale', b, a), a !== oi && Vi(this, !1));
        },
      },
      initialAutoScale: {
        get: function () {
          return this.Wf;
        },
        set: function (a) {
          var b = this.Wf;
          b !== a && ((this.Wf = a), this.g('initialAutoScale', b, a));
        },
      },
      initialViewportSpot: {
        get: function () {
          return this.Mr;
        },
        set: function (a) {
          var b = this.Mr;
          b !== a &&
            (a.cb() || B('initialViewportSpot must be a specific Spot: ' + a),
            (this.Mr = a),
            this.g('initialViewportSpot', b, a));
        },
      },
      initialDocumentSpot: {
        get: function () {
          return this.Jr;
        },
        set: function (a) {
          var b = this.Jr;
          b !== a &&
            (a.cb() || B('initialViewportSpot must be a specific Spot: ' + a),
            (this.Jr = a),
            this.g('initialDocumentSpot', b, a));
        },
      },
      minScale: {
        get: function () {
          return this.ds;
        },
        set: function (a) {
          var b = this.ds;
          b !== a &&
            (0 < a
              ? ((this.ds = a),
                this.g('minScale', b, a),
                a > this.scale && (this.scale = a))
              : va(a, '> 0', R, 'minScale'));
        },
      },
      maxScale: {
        get: function () {
          return this.bs;
        },
        set: function (a) {
          var b = this.bs;
          b !== a &&
            (0 < a
              ? ((this.bs = a),
                this.g('maxScale', b, a),
                a < this.scale && (this.scale = a))
              : va(a, '> 0', R, 'maxScale'));
        },
      },
      zoomPoint: {
        get: function () {
          return this.Zs;
        },
        set: function (a) {
          this.Zs.A(a) || (this.Zs = a = a.G());
        },
      },
      contentAlignment: {
        get: function () {
          return this.lj;
        },
        set: function (a) {
          var b = this.lj;
          b.A(a) ||
            ((this.lj = a = a.G()),
            this.g('contentAlignment', b, a),
            Vi(this, !1));
        },
      },
      initialContentAlignment: {
        get: function () {
          return this.Xn;
        },
        set: function (a) {
          var b = this.Xn;
          b.A(a) ||
            ((this.Xn = a = a.G()), this.g('initialContentAlignment', b, a));
        },
      },
      padding: {
        get: function () {
          return this.ab;
        },
        set: function (a) {
          'number' === typeof a && (a = new oc(a));
          var b = this.ab;
          b.A(a) || ((this.ab = a = a.G()), this.Na(), this.g('padding', b, a));
        },
      },
      partManager: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          var b = this.v;
          b !== a &&
            (null !== a.diagram &&
              B('Cannot share PartManagers between Diagrams: ' + a.toString()),
            null !== b && b.Zd(null),
            (this.v = a),
            a.Zd(this));
        },
      },
      nodes: {
        get: function () {
          return this.partManager.nodes.iterator;
        },
      },
      links: {
        get: function () {
          return this.partManager.links.iterator;
        },
      },
      parts: {
        get: function () {
          return this.partManager.parts.iterator;
        },
      },
      layout: {
        get: function () {
          return this.ic;
        },
        set: function (a) {
          var b = this.ic;
          b !== a &&
            ((this.ic = a),
            (a.diagram = this),
            (a.group = null),
            (this.Hf = !0),
            this.g('layout', b, a),
            this.Yb());
        },
      },
      isTreePathToChildren: {
        get: function () {
          return this.Ur;
        },
        set: function (a) {
          var b = this.Ur;
          if (
            b !== a &&
            ((this.Ur = a),
            this.g('isTreePathToChildren', b, a),
            !this.undoManager.isUndoingRedoing)
          )
            for (a = this.nodes; a.next(); ) Ek(a.value);
        },
      },
      treeCollapsePolicy: {
        get: function () {
          return this.Us;
        },
        set: function (a) {
          var b = this.Us;
          b !== a &&
            (a !== qi &&
              a !== Fk &&
              a !== Gk &&
              B('Unknown Diagram.treeCollapsePolicy: ' + a),
            (this.Us = a),
            this.g('treeCollapsePolicy', b, a));
        },
      },
      Ce: {
        get: function () {
          return this.uu;
        },
        set: function (a) {
          this.uu = a;
        },
      },
      autoScrollInterval: {
        get: function () {
          return this.$m;
        },
        set: function (a) {
          var b = this.$m;
          b !== a && ((this.$m = a), this.g('autoScrollInterval', b, a));
        },
      },
      autoScrollRegion: {
        get: function () {
          return this.bn;
        },
        set: function (a) {
          'number' === typeof a && (a = new oc(a));
          var b = this.bn;
          b.A(a) ||
            ((this.bn = a = a.G()), this.Na(), this.g('autoScrollRegion', b, a));
        },
      },
    });
    ma.Object.defineProperties(R, {
      licenseKey: {
        get: function () {
          return Hk.Wb();
        },
        set: function (a) {
          Hk.add(a);
        },
      },
      version: {
        get: function () {
          return Ik;
        },
      },
    });
    R.prototype.makeImageData = R.prototype.Vx;
    R.prototype.makeImage = R.prototype.eA;
    R.prototype.addRenderer = R.prototype.My;
    R.prototype.makeSVG = R.prototype.Nv;
    R.prototype.makeSvg = R.prototype.At;
    R.prototype.stopAutoScroll = R.prototype.Cf;
    R.prototype.doAutoScroll = R.prototype.ft;
    R.prototype.isUnoccupied = R.prototype.mk;
    R.prototype.raiseDiagramEvent = R.prototype.R;
    R.prototype.removeDiagramListener = R.prototype.ym;
    R.prototype.addDiagramListener = R.prototype.Uj;
    R.prototype.findTreeRoots = R.prototype.Bz;
    R.prototype.layoutDiagram = R.prototype.cA;
    R.prototype.findTopLevelGroups = R.prototype.uz;
    R.prototype.findTopLevelNodesAndLinks = R.prototype.vz;
    R.prototype.findLinksByExample = R.prototype.it;
    R.prototype.findNodesByExample = R.prototype.jt;
    R.prototype.findLinkForData = R.prototype.uc;
    R.prototype.findNodeForData = R.prototype.Ri;
    R.prototype.findPartForData = R.prototype.vc;
    R.prototype.findLinkForKey = R.prototype.findLinkForKey;
    R.prototype.findNodeForKey = R.prototype.Kb;
    R.prototype.findPartForKey = R.prototype.findPartForKey;
    R.prototype.rebuildParts = R.prototype.wd;
    R.prototype.transformViewToDoc = R.prototype.Pt;
    R.prototype.transformRectDocToView = R.prototype.DA;
    R.prototype.transformDocToView = R.prototype.Mq;
    R.prototype.centerRect = R.prototype.bt;
    R.prototype.scrollToRect = R.prototype.fw;
    R.prototype.scroll = R.prototype.scroll;
    R.prototype.highlightCollection = R.prototype.Sz;
    R.prototype.highlight = R.prototype.Rz;
    R.prototype.clearHighlighteds = R.prototype.Ax;
    R.prototype.selectCollection = R.prototype.uA;
    R.prototype.select = R.prototype.select;
    R.prototype.clearSelection = R.prototype.iv;
    R.prototype.updateAllRelationshipsFromData = R.prototype.Oq;
    R.prototype.updateAllTargetBindings = R.prototype.updateAllTargetBindings;
    R.prototype.commit = R.prototype.commit;
    R.prototype.rollbackTransaction = R.prototype.Bf;
    R.prototype.commitTransaction = R.prototype.Ua;
    R.prototype.startTransaction = R.prototype.ta;
    R.prototype.raiseChanged = R.prototype.g;
    R.prototype.raiseChangedEvent = R.prototype.Ya;
    R.prototype.removeChangedListener = R.prototype.xk;
    R.prototype.addChangedListener = R.prototype.Eh;
    R.prototype.removeModelChangedListener = R.prototype.qA;
    R.prototype.addModelChangedListener = R.prototype.xx;
    R.prototype.findLayer = R.prototype.jm;
    R.prototype.removeLayer = R.prototype.oA;
    R.prototype.addLayerAfter = R.prototype.Iy;
    R.prototype.addLayerBefore = R.prototype.vx;
    R.prototype.addLayer = R.prototype.am;
    R.prototype.moveParts = R.prototype.moveParts;
    R.prototype.copyParts = R.prototype.dk;
    R.prototype.removeParts = R.prototype.Jt;
    R.prototype.remove = R.prototype.remove;
    R.prototype.add = R.prototype.add;
    R.prototype.clearDelayedGeometries = R.prototype.hv;
    R.prototype.setProperties = R.prototype.lw;
    R.prototype.resetInputOptions = R.prototype.cw;
    R.prototype.setInputOption = R.prototype.vA;
    R.prototype.getInputOption = R.prototype.mm;
    R.prototype.resetRenderingHints = R.prototype.dw;
    R.prototype.setRenderingHint = R.prototype.my;
    R.prototype.getRenderingHint = R.prototype.Be;
    R.prototype.maybeUpdate = R.prototype.ud;
    R.prototype.requestUpdate = R.prototype.Yb;
    R.prototype.delayInitialization = R.prototype.az;
    R.prototype.isUpdateRequested = R.prototype.Yz;
    R.prototype.redraw = R.prototype.zf;
    R.prototype.invalidateDocumentBounds = R.prototype.Na;
    R.prototype.findObjectsNear = R.prototype.Ag;
    R.prototype.findPartsNear = R.prototype.qz;
    R.prototype.findObjectsIn = R.prototype.sf;
    R.prototype.findPartsIn = R.prototype.Ox;
    R.prototype.findObjectsAt = R.prototype.Si;
    R.prototype.findPartsAt = R.prototype.pz;
    R.prototype.findObjectAt = R.prototype.Tb;
    R.prototype.findPartAt = R.prototype.km;
    R.prototype.focusObject = R.prototype.Cz;
    R.prototype.alignDocument = R.prototype.Oy;
    R.prototype.zoomToRect = R.prototype.GA;
    R.prototype.zoomToFit = R.prototype.zoomToFit;
    R.prototype.diagramScroll = R.prototype.Hx;
    R.prototype.focus = R.prototype.focus;
    R.prototype.reset = R.prototype.reset;
    R.useDOM = function (a) {
      Vg = a ? void 0 !== x.document : !1;
    };
    R.isUsingDOM = function () {
      return Vg;
    };
    var ye = null,
      ri = new G(),
      Mi = null,
      Li = null,
      Vg = void 0 !== x.document,
      Gi = null,
      Hi = '',
      oi = new D(R, 'None', 0),
      $i = new D(R, 'Uniform', 1),
      aj = new D(R, 'UniformToFill', 2),
      Of = new D(R, 'CycleAll', 10),
      Sf = new D(R, 'CycleNotDirected', 11),
      Uf = new D(R, 'CycleNotDirectedFast', 12),
      Vf = new D(R, 'CycleNotUndirected', 13),
      Pf = new D(R, 'CycleDestinationTree', 14),
      Rf = new D(R, 'CycleSourceTree', 15),
      Vh = new D(R, 'DocumentScroll', 1),
      Xh = new D(R, 'InfiniteScroll', 2),
      qi = new D(R, 'TreeParentCollapsed', 21),
      Fk = new D(R, 'AllParentsCollapsed', 22),
      Gk = new D(R, 'AnyParentsCollapsed', 23),
      Hk = new E(),
      Ik = '2.1.5',
      Jk = null,
      mi = !1;
    function ni() {
      if (Vg) {
        var a = x.document.createElement('canvas'),
          b = a.getContext('2d'),
          c = Ra('7ca11abfd022028846');
        b[c] = Ra('398c3597c01238');
        for (
          var d = [
              '5da73c80a36455d5038e4972187c3cae51fd22',
              qa.Dx + '4ae6247590da4bb21c324ba3a84e385776',
              rd.xF + 'fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387',
              J.za,
            ],
            e = 1;
          5 > e;
          e++
        )
          b[Ra('7ca11abfd7330390')](Ra(d[e - 1]), 10, 15 * e);
        b[c] = Ra('39f046ebb36e4b');
        for (c = 1; 5 > c; c++)
          b[Ra('7ca11abfd7330390')](Ra(d[c - 1]), 10, 15 * c);
        Jk = a;
      }
    }
    R.className = 'Diagram';
    R.fromDiv = function (a) {
      var b = a;
      'string' === typeof a && (b = x.document.getElementById(a));
      return b instanceof HTMLDivElement && b.B instanceof R ? b.B : null;
    };
    R.inherit = function (a, b) {
      function c() {}
      if (Object.getPrototypeOf(a).prototype)
        throw Error(
          'Used go.Diagram.inherit defining already defined class \n' + a,
        );
      c.prototype = b.prototype;
      a.prototype = new c();
      a.prototype.constructor = a;
    };
    R.None = oi;
    R.Uniform = $i;
    R.UniformToFill = aj;
    R.CycleAll = Of;
    R.CycleNotDirected = Sf;
    R.CycleNotDirectedFast = Uf;
    R.CycleNotUndirected = Vf;
    R.CycleDestinationTree = Pf;
    R.CycleSourceTree = Rf;
    R.DocumentScroll = Vh;
    R.InfiniteScroll = Xh;
    R.TreeParentCollapsed = qi;
    R.AllParentsCollapsed = Fk;
    R.AnyParentsCollapsed = Gk;
    function Ei() {
      this.Dy = null;
      this.l = 'zz@orderNum';
      '63ad05bbe23a1786468a4c741b6d2' === this._tk
        ? (this.Ne = this.l = !0)
        : (this.Ne = null);
    }
    function wj(a, b) {
      b.Wc.setTransform(b.Rb, 0, 0, b.Rb, 0, 0);
      if (null === a.Ne) {
        b = 'f';
        var c = x[Ra('76a715b2f73f148a')][Ra('72ba13b5')];
        a.Ne = !0;
        if (Vg) {
          var d = R[Ra('76a115b6ed251eaf4692')];
          if (d)
            for (var e = Hk.iterator; e.next(); ) {
              d = e.value;
              d = Ra(d).split(Ra('39e9'));
              if (6 > d.length) break;
              var f = Ra(d[1]).split('.');
              if ('7da71ca0' !== d[4]) break;
              var g = Ra(qa[Ra('6cae19')]).split('.');
              if (f[0] > g[0] || (f[0] === g[0] && f[1] >= g[1])) {
                f = c[Ra('76ad18b4f73e')];
                for (g = c[Ra('73a612b6fb191d')](Ra('35e7')) + 2; g < f; g++)
                  b += c[g];
                f = b[Ra('73a612b6fb191d')](Ra(d[2]));
                0 > f &&
                  Ra(d[2]) !== Ra('7da71ca0ad381e90') &&
                  (f = b[Ra('73a612b6fb191d')](Ra('76a715b2ef3e149757')));
                0 > f && (f = b[Ra('73a612b6fb191d')](Ra('76a715b2ef3e149757')));
                0 > f &&
                  (f = c[Ra('73a612b6fb191d')](Ra('7baa19a6f76c1988428554')));
                a.Ne = !(
                  (0 <= f && f < b[Ra('73a612b6fb191d')](Ra('35'))) ||
                  -1 === b[Ra('73a612b6fb191d')](Ra('35'))
                );
                if (!a.Ne) break;
                f = Ra(d[2]);
                if ('#' !== f[0]) break;
                g = x.document.createElement('div');
                for (var h = d[0].replace(/[A-Za-z]/g, ''); 4 > h.length; )
                  h += '9';
                h = h.substr(h.length - 4);
                d = '';
                d += ['gsh', 'gsf'][parseInt(h.substr(0, 1), 10) % 2];
                d += ['Header', 'Background', 'Display', 'Feedback'][
                  parseInt(h.substr(0, 1), 10) % 4
                ];
                g[Ra('79a417a0f0181a8946')] = d;
                if (x.document[Ra('78a712aa')]) {
                  x.document[Ra('78a712aa')][Ra('7bb806b6ed32388c4a875b')](g);
                  h = x
                    .getComputedStyle(g)
                    .getPropertyValue(Ra('78a704b7e62456904c9b12701b6532a8'));
                  x.document[Ra('78a712aa')][Ra('68ad1bbcf533388c4a875b')](g);
                  if (!h) break;
                  if (
                    -1 !== h.indexOf(parseInt(f[1] + f[2], 16)) &&
                    -1 !== h.indexOf(parseInt(f[3] + f[4], 16))
                  ) {
                    a.Ne = !1;
                    break;
                  } else if (Sa || Ta || Ua || Va)
                    for (
                      d = '.' + d, f = 0;
                      f < document.styleSheets.length;
                      f++
                    ) {
                      g =
                        document.styleSheets[f].rules ||
                        document.styleSheets[f].cssRules;
                      for (var k in g)
                        if (d === g[k].selectorText) {
                          a.Ne = !1;
                          break;
                        }
                    }
                } else (a.Ne = null), (a.Ne = !1);
              }
            }
          else {
            k = c[Ra('76ad18b4f73e')];
            for (e = c[Ra('73a612b6fb191d')](Ra('35e7')) + 2; e < k; e++)
              b += c[e];
            c = b[Ra('73a612b6fb191d')](Ra('7da71ca0ad381e90'));
            a.Ne = !(0 <= c && c < b[Ra('73a612b6fb191d')](Ra('35')));
          }
        }
      }
      return 0 < a.Ne && a !== a.Dy ? !0 : !1;
    }
    function Fi(a, b) {
      if (Vg) {
        (void 0 !== b && null !== b) ||
          B('Diagram setup requires an argument DIV.');
        null !== a.Fa && B('Diagram has already completed setup.');
        'string' === typeof b
          ? (a.Fa = x.document.getElementById(b))
          : b instanceof HTMLDivElement
          ? (a.Fa = b)
          : B('No DIV or DIV id supplied: ' + b);
        null === a.Fa && B('Invalid DIV id; could not get element with id: ' + b);
        void 0 !== a.Fa.B &&
          B('Invalid div id; div already has a Diagram associated with it.');
        'static' === x.getComputedStyle(a.Fa, null).position &&
          (a.Fa.style.position = 'relative');
        a.Fa.style['-webkit-tap-highlight-color'] = 'rgba(255, 255, 255, 0)';
        a.Fa.style['-ms-touch-action'] = 'none';
        a.Fa.innerHTML = '';
        a.Fa.B = a;
        var c = a.Op ? new Bj(a) : new Dk(a);
        void 0 !== c.style &&
          ((c.style.position = 'absolute'),
          (c.style.top = '0px'),
          (c.style.left = '0px'),
          'rtl' ===
            x.getComputedStyle(a.Fa, null).getPropertyValue('direction') &&
            (a.ol = !0),
          (c.style.zIndex = '2'),
          (c.style.userSelect = 'none'),
          (c.style.webkitUserSelect = 'none'),
          (c.style.MozUserSelect = 'none'));
        a.Ba = c;
        a.Wc = c.context;
        b = a.Wc;
        a.Rb = a.computePixelRatio();
        a.va = a.Fa.clientWidth || 1;
        a.ua = a.Fa.clientHeight || 1;
        Dj(a, a.va, a.ua);
        // a.yr = b.V[Ra('7eba17a4ca3b1a8346')][Ra('78a118b7')](b.V, Jk, 4, 4);
        a.yr = function () {
          return true;
        };
        a.Fa.insertBefore(c.Da, a.Fa.firstChild);
        c = new Dk(null);
        c.width = 1;
        c.height = 1;
        a.ju = c;
        a.Uw = c.context;
        if (Vg) {
          c = ta('div');
          var d = ta('div');
          c.style.position = 'absolute';
          c.style.overflow = 'auto';
          c.style.width = a.va + 'px';
          c.style.height = a.ua + 'px';
          c.style.zIndex = '1';
          d.style.position = 'absolute';
          d.style.width = '1px';
          d.style.height = '1px';
          a.Fa.appendChild(c);
          c.appendChild(d);
          c.onscroll = Pi;
          c.onmousedown = Ri;
          c.ontouchstart = Ri;
          c.B = a;
          c.By = !0;
          c.Cy = !0;
          a.Ds = c;
          a.vp = d;
        }
        a.Ht = ra(function () {
          a.vh = null;
          a.N();
        }, 300);
        a.yw = ra(function () {
          Eh(a);
        }, 250);
        a.preventDefault = function (a) {
          a.preventDefault();
          return !1;
        };
        a.rk = function (b) {
          if (a.isEnabled) {
            a.Xf = !0;
            var c = ej(a, b, !0);
            a.doMouseMove();
            a.currentTool.isBeyondDragSize() && (a.md = 0);
            kj(c, b);
          }
        };
        a.qk = function (b) {
          if (a.isEnabled)
            if (((a.Xf = !0), a.le)) b.preventDefault();
            else {
              var c = ej(a, b, !0);
              c.down = !0;
              c.clickCount = b.detail;
              if (Ta || Ua)
                b.timeStamp - a.Aj < a.Ts && !a.currentTool.isBeyondDragSize()
                  ? a.md++
                  : (a.md = 1),
                  (a.Aj = b.timeStamp),
                  (c.clickCount = a.md);
              c.clone(a.firstInput);
              a.doMouseDown();
              1 === b.button ? b.preventDefault() : kj(c, b);
            }
        };
        a.tk = function (b) {
          if (a.isEnabled)
            if (a.le && 2 === b.button) b.preventDefault();
            else if ((a.le && 0 === b.button && (a.le = !1), a.Pj))
              b.preventDefault();
            else {
              a.Xf = !0;
              var c = ej(a, b, !0);
              c.up = !0;
              c.clickCount = b.detail;
              if (Ta || Ua) c.clickCount = a.md;
              c.bubbles = b.bubbles;
              c.targetDiagram = gj(b);
              a.doMouseUp();
              a.Cf();
              kj(c, b);
            }
        };
        a.uk = function (b) {
          if (a.isEnabled) {
            var c = ej(a, b, !0);
            c.bubbles = !0;
            var d = 0,
              e = 0;
            c.delta = 0;
            void 0 !== b.deltaX
              ? (0 !== b.deltaX && (d = 0 < b.deltaX ? 1 : -1),
                0 !== b.deltaY && (e = 0 < b.deltaY ? 1 : -1),
                (c.delta = Math.abs(b.deltaX) > Math.abs(b.deltaY) ? -d : -e))
              : void 0 !== b.wheelDeltaX
              ? (0 !== b.wheelDeltaX && (d = 0 < b.wheelDeltaX ? -1 : 1),
                0 !== b.wheelDeltaY && (e = 0 < b.wheelDeltaY ? -1 : 1),
                (c.delta =
                  Math.abs(b.wheelDeltaX) > Math.abs(b.wheelDeltaY) ? -d : -e))
              : void 0 !== b.wheelDelta &&
                0 !== b.wheelDelta &&
                (c.delta = 0 < b.wheelDelta ? 1 : -1);
            a.doMouseWheel();
            kj(c, b);
          }
        };
        a.sk = function (b) {
          a.isEnabled &&
            ((a.Xf = !1),
            ej(a, b, !0),
            (b = a.currentTool),
            b.cancelWaitAfter(),
            b.standardMouseOver());
        };
        a.sw = function (b) {
          if (a.isEnabled) {
            a.Pj = !1;
            a.le = !0;
            var c = hj(a, b, b.targetTouches[0], 1 < b.touches.length),
              d = null;
            0 < b.targetTouches.length
              ? (d = b.targetTouches[0])
              : 0 < b.changedTouches.length && (d = b.changedTouches[0]);
            if (null !== d) {
              var e = d.screenX;
              d = d.screenY;
              var k = a.lo;
              b.timeStamp - a.Aj < a.Ts &&
              !(25 < Math.abs(k.x - e) || 25 < Math.abs(k.y - d))
                ? a.md++
                : (a.md = 1);
              c.clickCount = a.md;
              a.Aj = b.timeStamp;
              a.lo.h(e, d);
            }
            a.doMouseDown();
            kj(c, b);
          }
        };
        a.rw = function (b) {
          if (a.isEnabled) {
            var c = null;
            0 < b.targetTouches.length
              ? (c = b.targetTouches[0])
              : 0 < b.changedTouches.length && (c = b.changedTouches[0]);
            c = jj(a, b, c, 1 < b.touches.length);
            a.doMouseMove();
            kj(c, b);
          }
        };
        a.qw = function (b) {
          if (a.isEnabled)
            if (a.Pj) b.preventDefault();
            else if (!(1 < b.touches.length)) {
              var c = null,
                d = null;
              0 < b.targetTouches.length
                ? (d = b.targetTouches[0])
                : 0 < b.changedTouches.length && (d = b.changedTouches[0]);
              var e = ij(a, b, !1, !0, !1, !1);
              null !== d &&
                ((c = x.document.elementFromPoint(d.clientX, d.clientY)),
                null !== c && c.B instanceof R && c.B !== a && fj(c.B, d, e),
                fj(a, d, e),
                (e.clickCount = a.md));
              null === c
                ? (e.targetDiagram = gj(b))
                : c.B
                ? (e.targetDiagram = c.B)
                : (e.targetDiagram = null);
              e.targetObject = null;
              a.doMouseUp();
              kj(e, b);
              a.le = !1;
            }
        };
        a.tm = function (b) {
          if (a.isEnabled) {
            a.Xf = !0;
            var c = a.ss;
            void 0 === c[b.pointerId] && (c[b.pointerId] = b);
            c = a.Kj;
            var d = !1;
            if (null !== c[0] && c[0].pointerId === b.pointerId) c[0] = b;
            else if (null !== c[1] && c[1].pointerId === b.pointerId)
              (c[1] = b), (d = !0);
            else if (null === c[0]) c[0] = b;
            else if (null === c[1]) (c[1] = b), (d = !0);
            else {
              b.preventDefault();
              return;
            }
            if ('touch' === b.pointerType || 'pen' === b.pointerType)
              (a.Pj = !1), (a.le = !0);
            c = hj(a, b, b, d);
            d = a.lo;
            var e =
              'touch' === b.pointerType || 'pen' === b.pointerType ? 25 : 10;
            b.timeStamp - a.Aj < a.Ts &&
            !(Math.abs(d.x - b.screenX) > e || Math.abs(d.y - b.screenY) > e)
              ? a.md++
              : (a.md = 1);
            c.clickCount = a.md;
            a.Aj = b.timeStamp;
            a.lo.Fg(b.screenX, b.screenY);
            a.doMouseDown();
            1 === b.button ? b.preventDefault() : kj(c, b);
          }
        };
        a.um = function (b) {
          if (a.isEnabled) {
            a.Xf = !0;
            var c = a.Kj;
            if (null !== c[0] && c[0].pointerId === b.pointerId) c[0] = b;
            else {
              if (null !== c[1] && c[1].pointerId === b.pointerId) {
                c[1] = b;
                return;
              }
              if (null === c[0]) c[0] = b;
              else return;
            }
            c[0].pointerId === b.pointerId &&
              ((c = jj(a, b, b, null !== c[1])),
              (c.targetDiagram = gj(b)),
              a.doMouseMove(),
              kj(c, b));
          }
        };
        a.wm = function (b) {
          if (a.isEnabled) {
            a.Xf = !0;
            var c = 'touch' === b.pointerType || 'pen' === b.pointerType,
              d = a.ss;
            if (c && a.Pj) delete d[b.pointerId], b.preventDefault();
            else if (
              ((d = a.Kj), null !== d[0] && d[0].pointerId === b.pointerId)
            ) {
              d[0] = null;
              d = ij(a, b, !1, !0, !0, !1);
              var e = x.document.elementFromPoint(b.clientX, b.clientY);
              null !== e && e.B instanceof R && e.B !== a && fj(e.B, b, d);
              fj(a, b, d);
              d.clickCount = a.md;
              null === e
                ? (d.targetDiagram = gj(b))
                : e.B
                ? (d.targetDiagram = e.B)
                : (d.targetDiagram = null);
              d.targetObject = null;
              a.doMouseUp();
              kj(d, b);
              c && (a.le = !1);
            } else
              null !== d[1] && d[1].pointerId === b.pointerId && (d[1] = null);
          }
        };
        a.vm = function (b) {
          if (a.isEnabled) {
            a.Xf = !1;
            var c = a.ss;
            c[b.pointerId] && delete c[b.pointerId];
            c = a.Kj;
            null !== c[0] && c[0].pointerId === b.pointerId && (c[0] = null);
            null !== c[1] && c[1].pointerId === b.pointerId && (c[1] = null);
            'touch' !== b.pointerType &&
              'pen' !== b.pointerType &&
              ((b = a.currentTool), b.cancelWaitAfter(), b.standardMouseOver());
          }
        };
        b.Qc(!0);
        Ni(a);
      }
    }
    Ei.className = 'DiagramHelper';
    function Ye(a) {
      this.l = void 0 === a ? new H() : a;
      this.v = new H();
    }
    ma.Object.defineProperties(Ye.prototype, {
      point: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.l = a;
        },
      },
      shifted: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v = a;
        },
      },
    });
    Ye.className = 'DraggingInfo';
    function Oj(a, b, c) {
      this.node = a;
      this.info = b;
      this.Ev = c;
    }
    Oj.className = 'DraggingNodeInfoPair';
    function Qe() {
      this.reset();
    }
    Qe.prototype.reset = function () {
      this.isGridSnapEnabled = !1;
      this.isGridSnapRealtime = !0;
      this.gridSnapCellSize = new L(NaN, NaN).freeze();
      this.gridSnapCellSpot = vc;
      this.gridSnapOrigin = new H(NaN, NaN).freeze();
      this.Pz = this.dragsTree = this.dragsLink = !1;
      this.Oz = !0;
    };
    function Kk(a) {
      1 < arguments.length &&
        B(
          'Palette constructor can only take one optional argument, the DIV HTML element or its id.',
        );
      R.call(this, a);
      this.allowDragOut = !0;
      this.allowMove = !1;
      this.isReadOnly = !0;
      this.contentAlignment = xc;
      this.layout = new Lk();
    }
    la(Kk, R);
    Kk.className = 'Palette';
    function Mk(a) {
      1 < arguments.length &&
        B(
          'Overview constructor can only take one optional argument, the DIV HTML element or its id.',
        );
      R.call(this, a);
      this.animationManager.isEnabled = !1;
      this.Gb = !0;
      this.kg = null;
      this.el = this.dl = !1;
      this.zr = !0;
      this.my('drawShadows', !1);
      var b = new T(),
        c = new W();
      c.stroke = 'magenta';
      c.strokeWidth = 2;
      c.fill = 'transparent';
      c.name = 'BOXSHAPE';
      b.selectable = !0;
      b.selectionAdorned = !1;
      b.selectionObjectName = 'BOXSHAPE';
      b.locationObjectName = 'BOXSHAPE';
      b.resizeObjectName = 'BOXSHAPE';
      b.cursor = 'move';
      b.add(c);
      this.l = b;
      this.allowDelete = this.allowCopy = !1;
      this.allowSelect = !0;
      this.autoScrollRegion = new oc(0, 0, 0, 0);
      this.ma.h(0, 0);
      this.Vu = new Dk(null);
      this.Ey = this.Vu.context;
      this.toolManager.Va('Dragging', new Nk(), this.toolManager.mouseMoveTools);
      var d = this;
      this.click = function () {
        var a = d.kg;
        if (null !== a) {
          var b = a.viewportBounds,
            c = d.lastInput.documentPoint;
          a.position = new H(c.x - b.width / 2, c.y - b.height / 2);
        }
      };
      this.hd = function () {
        d.Na();
        Ok(d);
      };
      this.La = function () {
        null !== d.kg && (d.Na(), d.N());
      };
      this.eb = function () {
        d.N();
      };
      this.Ja = function () {
        null !== d.kg && Ok(d);
      };
      this.autoScale = $i;
      this.Gb = !1;
    }
    la(Mk, R);
    function Pk(a) {
      a.Gb ||
        a.Qb ||
        !1 !== a.Pc ||
        ((a.Pc = !0),
        x.requestAnimationFrame(function () {
          if (a.Pc && !a.Qb && ((a.Pc = !1), null !== a.Fa)) {
            a.Qb = !0;
            Ti(a);
            a.documentBounds.u() || Aj(a, a.computeBounds());
            null === a.Fa && B('No div specified');
            null === a.Ba && B('No canvas specified');
            fi(a.box);
            if (a.gc) {
              var b = a.kg;
              if (
                null !== b &&
                !b.animationManager.isAnimating &&
                !b.animationManager.jc
              ) {
                b = a.Wc;
                var c = a.Vu;
                b.setTransform(1, 0, 0, 1, 0, 0);
                b.clearRect(0, 0, a.Ba.width, a.Ba.height);
                b.drawImage(c.Da, 0, 0);
                c = a.lb;
                c.reset();
                1 !== a.scale && c.scale(a.scale);
                (0 === a.position.x && 0 === a.position.y) ||
                  c.translate(-a.position.x, -a.position.y);
                b.scale(a.Rb, a.Rb);
                b.transform(c.m11, c.m12, c.m21, c.m22, c.dx, c.dy);
                c = a.Ia.j;
                for (var d = c.length, e = 0; e < d; e++) c[e].tb(b, a);
                a.bh = !1;
                a.gc = !1;
              }
            }
            a.Qb = !1;
          }
        }));
    }
    Mk.prototype.computePixelRatio = function () {
      return 1;
    };
    Mk.prototype.tb = function () {
      null === this.Fa && B('No div specified');
      null === this.Ba && B('No canvas specified');
      if (!(this.Ba instanceof Bj) && (fi(this.box), this.gc)) {
        var a = this.kg;
        if (null !== a && !a.animationManager.isAnimating) {
          uj(this);
          var b = a.grid;
          null === b ||
            !b.visible ||
            isNaN(b.width) ||
            isNaN(b.height) ||
            ((b = N.alloc().assign(this.viewportBounds).Gc(a.viewportBounds)),
            nj(a, b),
            N.free(b),
            Ti(a));
          var c = this.Ba;
          b = this.Wc;
          var d = this.Vu,
            e = this.Ey;
          d.width = c.width;
          d.height = c.height;
          b.Qc(!0);
          b.setTransform(1, 0, 0, 1, 0, 0);
          b.clearRect(0, 0, c.width, c.height);
          d = this.lb;
          d.reset();
          1 !== this.scale && d.scale(this.scale);
          (0 === this.position.x && 0 === this.position.y) ||
            d.translate(-this.position.x, -this.position.y);
          b.scale(this.Rb, this.Rb);
          b.transform(d.m11, d.m12, d.m21, d.m22, d.dx, d.dy);
          d = this.zr;
          var f = this.viewportBounds;
          a = a.Ia.j;
          for (var g = a.length, h = 0; h < g; h++) {
            var k = a[h],
              l = d;
            if (
              k.visible &&
              0 !== k.jb &&
              (void 0 === l && (l = !0), l || !k.isTemporary)
            ) {
              l = hi(k, b);
              var m = this.scale;
              k = k.Ca.j;
              for (var n = k.length, p = 0; p < n; p++) {
                var r = k[p],
                  q = r.actualBounds;
                q.Fc(f) &&
                  (q.width * m > this.Md || q.height * m > this.Md
                    ? r.tb(b, this)
                    : ii(b, r));
              }
              b.globalAlpha = l;
            }
          }
          e.drawImage(c.Da, 0, 0);
          c = this.Ia.j;
          e = c.length;
          for (d = 0; d < e; d++) c[d].tb(b, this);
          this.gc = this.bh = !1;
        }
      }
    };
    function Ok(a) {
      var b = a.box;
      if (null !== b) {
        var c = a.kg;
        if (null !== c) {
          a.gc = !0;
          c = c.viewportBounds;
          var d = b.selectionObject,
            e = L.alloc();
          e.h(c.width, c.height);
          d.desiredSize = e;
          L.free(e);
          a = 2 / a.scale;
          d instanceof W && (d.strokeWidth = a);
          b.location = new H(c.x - a / 2, c.y - a / 2);
          b.isSelected = !0;
        }
      }
    }
    Mk.prototype.computeBounds = function () {
      var a = this.kg;
      if (null === a) return mc;
      var b = a.documentBounds.copy();
      b.Gc(a.viewportBounds);
      return b;
    };
    Mk.prototype.Tx = function () {
      !0 !== this.gc && ((this.gc = !0), Pk(this));
    };
    Mk.prototype.Aq = function (a, b, c, d) {
      this.Gb ||
        (Si(this),
        this.N(),
        Yi(this),
        this.Na(),
        Ok(this),
        (this.Sd.scale = c),
        (this.Sd.position.x = a.x),
        (this.Sd.position.y = a.y),
        this.Sd.bounds.assign(a),
        (this.Sd.Mv = d),
        this.R('ViewportBoundsChanged', this.Sd, a));
    };
    ma.Object.defineProperties(Mk.prototype, {
      observed: {
        get: function () {
          return this.kg;
        },
        set: function (a) {
          var b = this.kg;
          a instanceof Mk &&
            B('Overview.observed Diagram may not be an Overview itself: ' + a);
          b !== a &&
            (null !== b &&
              (this.remove(this.box),
              b.ym('ViewportBoundsChanged', this.hd),
              b.ym('DocumentBoundsChanged', this.La),
              b.ym('InvalidateDraw', this.eb),
              b.ym('AnimationFinished', this.Ja)),
            (this.kg = a),
            null !== a &&
              (a.Uj('ViewportBoundsChanged', this.hd),
              a.Uj('DocumentBoundsChanged', this.La),
              a.Uj('InvalidateDraw', this.eb),
              a.Uj('AnimationFinished', this.Ja),
              this.add(this.box),
              Ok(this)),
            this.Na(),
            this.g('observed', b, a));
        },
      },
      box: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          var b = this.l;
          b !== a &&
            ((this.l = a),
            this.remove(b),
            this.add(this.l),
            Ok(this),
            this.g('box', b, a));
        },
      },
      drawsTemporaryLayers: {
        get: function () {
          return this.zr;
        },
        set: function (a) {
          this.zr !== a && ((this.zr = a), this.zf());
        },
      },
    });
    Mk.className = 'Overview';
    function Nk() {
      Pe.call(this);
      this.l = null;
    }
    la(Nk, Pe);
    Nk.prototype.canStart = function () {
      if (!this.isEnabled) return !1;
      var a = this.diagram;
      if (null === a || !a.allowMove || !a.allowSelect) return !1;
      var b = a.observed;
      if (null === b) return !1;
      var c = a.lastInput;
      if (
        !c.left ||
        (a.currentTool !== this &&
          (!this.isBeyondDragSize() ||
            (c.isTouchEvent &&
              c.timestamp - a.firstInput.timestamp < this.delay)))
      )
        return !1;
      null === this.findDraggablePart() &&
        ((c = b.viewportBounds),
        (this.l = new H(c.width / 2, c.height / 2)),
        (a = a.firstInput.documentPoint),
        (b.position = new H(a.x - this.l.x, a.y - this.l.y)));
      return !0;
    };
    Nk.prototype.doActivate = function () {
      this.l = null;
      Pe.prototype.doActivate.call(this);
    };
    Nk.prototype.moveParts = function () {
      var a = this.diagram,
        b = a.observed;
      if (null !== b) {
        var c = a.box;
        if (null !== c) {
          if (null === this.l) {
            var d = a.firstInput.documentPoint;
            c = c.location;
            this.l = new H(d.x - c.x, d.y - c.y);
          }
          a = a.lastInput.documentPoint;
          b.position = new H(a.x - this.l.x, a.y - this.l.y);
        }
      }
    };
    Nk.className = 'OverviewDraggingTool';
    function Qk() {
      Za(this);
      this.B = ye;
      this.eb = this.I = this.v = !0;
      this.Y = this.Ja = this.hd = this.La = !1;
      this.yi = this.l = null;
      this.be = 1.05;
      this.Au = NaN;
      this.Zw = null;
      this.cv = NaN;
      this.bv = mc;
      this.pg = null;
      this.yd = 200;
    }
    Qk.prototype.toString = function () {
      return 'CommandHandler';
    };
    Qk.prototype.Zd = function (a) {
      this.B = a;
    };
    Qk.prototype.doKeyDown = function () {
      var a = this.diagram,
        b = a.lastInput,
        c = Wa ? b.meta : b.control,
        d = b.shift,
        e = b.alt,
        f = b.key;
      !c || ('C' !== f && 'Insert' !== f)
        ? (c && 'X' === f) || (d && 'Del' === f)
          ? this.canCutSelection() && this.cutSelection()
          : (c && 'V' === f) || (d && 'Insert' === f)
          ? this.canPasteSelection() && this.pasteSelection()
          : (c && 'Y' === f) || (e && d && 'Backspace' === f)
          ? this.canRedo() && this.redo()
          : (c && 'Z' === f) || (e && 'Backspace' === f)
          ? this.canUndo() && this.undo()
          : 'Del' === f || 'Backspace' === f
          ? this.canDeleteSelection() && this.deleteSelection()
          : c && 'A' === f
          ? this.canSelectAll() && this.selectAll()
          : 'Esc' === f
          ? this.canStopCommand() && this.stopCommand()
          : 'Up' === f
          ? a.allowVerticalScroll &&
            (c ? a.scroll('pixel', 'up') : a.scroll('line', 'up'))
          : 'Down' === f
          ? a.allowVerticalScroll &&
            (c ? a.scroll('pixel', 'down') : a.scroll('line', 'down'))
          : 'Left' === f
          ? a.allowHorizontalScroll &&
            (c ? a.scroll('pixel', 'left') : a.scroll('line', 'left'))
          : 'Right' === f
          ? a.allowHorizontalScroll &&
            (c ? a.scroll('pixel', 'right') : a.scroll('line', 'right'))
          : 'PageUp' === f
          ? d && a.allowHorizontalScroll
            ? a.scroll('page', 'left')
            : a.allowVerticalScroll && a.scroll('page', 'up')
          : 'PageDown' === f
          ? d && a.allowHorizontalScroll
            ? a.scroll('page', 'right')
            : a.allowVerticalScroll && a.scroll('page', 'down')
          : 'Home' === f
          ? c && a.allowVerticalScroll
            ? a.scroll('document', 'up')
            : !c && a.allowHorizontalScroll && a.scroll('document', 'left')
          : 'End' === f
          ? c && a.allowVerticalScroll
            ? a.scroll('document', 'down')
            : !c && a.allowHorizontalScroll && a.scroll('document', 'right')
          : ' ' === f
          ? this.canScrollToPart() && this.scrollToPart()
          : 'Subtract' === f
          ? this.canDecreaseZoom() && this.decreaseZoom()
          : 'Add' === f
          ? this.canIncreaseZoom() && this.increaseZoom()
          : c && '0' === f
          ? this.canResetZoom() && this.resetZoom()
          : d && 'Z' === f
          ? this.canZoomToFit() && this.zoomToFit()
          : c && !d && 'G' === f
          ? this.canGroupSelection() && this.groupSelection()
          : c && d && 'G' === f
          ? this.canUngroupSelection() && this.ungroupSelection()
          : b.event && 113 === b.event.which
          ? this.canEditTextBlock() && this.editTextBlock()
          : b.event && 93 === b.event.which
          ? this.canShowContextMenu() && this.showContextMenu()
          : (b.bubbles = !0)
        : this.canCopySelection() && this.copySelection();
    };
    Qk.prototype.doKeyUp = function () {
      this.diagram.lastInput.bubbles = !0;
    };
    Qk.prototype.stopCommand = function () {
      var a = this.diagram,
        b = a.currentTool;
      b instanceof Oa && a.allowSelect && a.iv();
      null !== b && b.doCancel();
    };
    Qk.prototype.canStopCommand = function () {
      return !0;
    };
    Qk.prototype.selectAll = function () {
      var a = this.diagram;
      a.N();
      try {
        a.currentCursor = 'wait';
        a.R('ChangingSelection', a.selection);
        for (var b = a.parts; b.next(); ) b.value.isSelected = !0;
        for (var c = a.nodes; c.next(); ) c.value.isSelected = !0;
        for (var d = a.links; d.next(); ) d.value.isSelected = !0;
      } finally {
        a.R('ChangedSelection', a.selection), (a.currentCursor = '');
      }
    };
    Qk.prototype.canSelectAll = function () {
      return this.diagram.allowSelect;
    };
    Qk.prototype.deleteSelection = function () {
      var a = this.diagram;
      try {
        a.currentCursor = 'wait';
        a.R('ChangingSelection', a.selection);
        a.ta('Delete');
        a.R('SelectionDeleting', a.selection);
        for (var b = new F(), c = a.selection.iterator; c.next(); )
          Rk(
            b,
            c.value,
            !0,
            this.deletesTree ? Infinity : 0,
            this.deletesConnectedLinks ? null : !1,
            function (a) {
              return a.canDelete();
            },
          );
        a.Jt(b, !0);
        a.R('SelectionDeleted', b);
      } finally {
        a.Ua('Delete'),
          a.R('ChangedSelection', a.selection),
          (a.currentCursor = '');
      }
    };
    Qk.prototype.canDeleteSelection = function () {
      var a = this.diagram;
      return a.isReadOnly ||
        a.isModelReadOnly ||
        !a.allowDelete ||
        0 === a.selection.count
        ? !1
        : !0;
    };
    Qk.prototype.copySelection = function () {
      var a = this.diagram,
        b = new F();
      for (a = a.selection.iterator; a.next(); )
        Rk(
          b,
          a.value,
          !0,
          this.copiesTree ? Infinity : 0,
          this.copiesConnectedLinks,
          function (a) {
            return a.canCopy();
          },
        );
      this.copyToClipboard(b);
    };
    Qk.prototype.canCopySelection = function () {
      var a = this.diagram;
      return a.allowCopy && a.allowClipboard && 0 !== a.selection.count ? !0 : !1;
    };
    Qk.prototype.cutSelection = function () {
      this.copySelection();
      this.deleteSelection();
    };
    Qk.prototype.canCutSelection = function () {
      var a = this.diagram;
      return !a.isReadOnly &&
        !a.isModelReadOnly &&
        a.allowCopy &&
        a.allowDelete &&
        a.allowClipboard &&
        0 !== a.selection.count
        ? !0
        : !1;
    };
    Qk.prototype.copyToClipboard = function (a) {
      var b = this.diagram,
        c = null;
      if (null === a) (Gi = null), (Hi = '');
      else {
        c = b.model;
        var d = !1,
          e = !1,
          f = null;
        try {
          c.qm() && ((d = c.ck), (c.ck = this.copiesParentKey)),
            c.jk() && ((e = c.bk), (c.bk = this.copiesGroupKey)),
            (f = b.dk(a, null, !0));
        } finally {
          c.qm() && (c.ck = d),
            c.jk() && (c.bk = e),
            (c = new E()),
            c.addAll(f),
            (Gi = c),
            (Hi = b.model.dataFormat);
        }
      }
      b.R('ClipboardChanged', c);
    };
    Qk.prototype.pasteFromClipboard = function () {
      var a = new F(),
        b = Gi;
      if (null === b) return a;
      var c = this.diagram;
      if (Hi !== c.model.dataFormat) return a;
      var d = c.model,
        e = !1,
        f = !1,
        g = null;
      try {
        d.qm() && ((e = d.ck), (d.ck = this.copiesParentKey)),
          d.jk() && ((f = d.bk), (d.bk = this.copiesGroupKey)),
          (g = c.dk(b, c, !1));
      } finally {
        for (
          d.qm() && (d.ck = e), d.jk() && (d.bk = f), b = g.iterator;
          b.next();
  
        )
          (c = b.value),
            (d = b.key),
            c.location.u() ||
              (d.location.u()
                ? (c.location = d.location)
                : !c.position.u() && d.position.u() && (c.position = d.position)),
            a.add(c);
      }
      return a;
    };
    Qk.prototype.pasteSelection = function (a) {
      void 0 === a && (a = null);
      var b = this.diagram;
      try {
        b.currentCursor = 'wait';
        b.R('ChangingSelection', b.selection);
        b.ta('Paste');
        var c = this.pasteFromClipboard();
        0 < c.count && Re(b);
        for (var d = c.iterator; d.next(); ) d.value.isSelected = !0;
        if (null !== a) {
          var e = b.computePartsBounds(b.selection);
          if (e.u()) {
            var f = this.computeEffectiveCollection(b.selection, b.Rk);
            sf(b, f, new H(a.x - e.centerX, a.y - e.centerY), b.Rk, !1);
          }
        }
        b.R('ClipboardPasted', c);
      } finally {
        b.Ua('Paste'),
          b.R('ChangedSelection', b.selection),
          (b.currentCursor = '');
      }
    };
    Qk.prototype.canPasteSelection = function () {
      var a = this.diagram;
      return a.isReadOnly ||
        a.isModelReadOnly ||
        !a.allowInsert ||
        !a.allowClipboard ||
        null === Gi ||
        0 === Gi.count ||
        Hi !== a.model.dataFormat
        ? !1
        : !0;
    };
    Qk.prototype.undo = function () {
      this.diagram.undoManager.undo();
    };
    Qk.prototype.canUndo = function () {
      var a = this.diagram;
      return a.isReadOnly || a.isModelReadOnly
        ? !1
        : a.allowUndo && a.undoManager.canUndo();
    };
    Qk.prototype.redo = function () {
      this.diagram.undoManager.redo();
    };
    Qk.prototype.canRedo = function () {
      var a = this.diagram;
      return a.isReadOnly || a.isModelReadOnly
        ? !1
        : a.allowUndo && a.undoManager.canRedo();
    };
    Qk.prototype.decreaseZoom = function (a) {
      void 0 === a && (a = 1 / this.zoomFactor);
      var b = this.diagram;
      b.autoScale === oi &&
        ((a = b.scale * a), a < b.minScale || a > b.maxScale || (b.scale = a));
    };
    Qk.prototype.canDecreaseZoom = function (a) {
      void 0 === a && (a = 1 / this.zoomFactor);
      var b = this.diagram;
      if (b.autoScale !== oi) return !1;
      a = b.scale * a;
      return a < b.minScale || a > b.maxScale ? !1 : b.allowZoom;
    };
    Qk.prototype.increaseZoom = function (a) {
      void 0 === a && (a = this.zoomFactor);
      var b = this.diagram;
      b.autoScale === oi &&
        ((a = b.scale * a), a < b.minScale || a > b.maxScale || (b.scale = a));
    };
    Qk.prototype.canIncreaseZoom = function (a) {
      void 0 === a && (a = this.zoomFactor);
      var b = this.diagram;
      if (b.autoScale !== oi) return !1;
      a = b.scale * a;
      return a < b.minScale || a > b.maxScale ? !1 : b.allowZoom;
    };
    Qk.prototype.resetZoom = function (a) {
      void 0 === a && (a = this.defaultScale);
      var b = this.diagram;
      a < b.minScale || a > b.maxScale || (b.scale = a);
    };
    Qk.prototype.canResetZoom = function (a) {
      void 0 === a && (a = this.defaultScale);
      var b = this.diagram;
      return a < b.minScale || a > b.maxScale ? !1 : b.allowZoom;
    };
    Qk.prototype.zoomToFit = function () {
      var a = this.diagram,
        b = a.animationManager;
      b.Uc();
      a.zf();
      var c = a.position,
        d = a.scale;
      zh(b, 'Zoom To Fit');
      d === this.cv && !isNaN(this.Au) && a.documentBounds.A(this.bv)
        ? ((a.scale = this.Au),
          (a.position = this.Zw),
          (this.cv = NaN),
          (this.bv = mc))
        : ((this.Au = d),
          (this.Zw = c.copy()),
          a.zoomToFit(),
          (this.cv = a.scale),
          (this.bv = a.documentBounds.copy()));
      Bh(b);
    };
    Qk.prototype.canZoomToFit = function () {
      return this.diagram.allowZoom;
    };
    Qk.prototype.scrollToPart = function (a) {
      void 0 === a && (a = null);
      var b = this.diagram;
      Ji(b);
      if (null === a) {
        try {
          null !== this.pg &&
            (this.pg.next() ? (a = this.pg.value) : (this.pg = null));
        } catch (k) {
          this.pg = null;
        }
        null === a &&
          (0 < b.highlighteds.count
            ? (this.pg = b.highlighteds.iterator)
            : 0 < b.selection.count && (this.pg = b.selection.iterator),
          null !== this.pg && this.pg.next() && (a = this.pg.value));
      }
      if (null !== a) {
        var c = b.animationManager;
        zh(c, 'Scroll To Part');
        var d = this.scrollToPartPause;
        if (0 < d) {
          var e = Sk(this, a, [a]);
          if (1 === e.length)
            b.ta(), b.bt(a.actualBounds), b.Ua('Scroll To Part');
          else {
            var f = function () {
                b.ta();
                for (
                  var a = e.pop();
                  0 < e.length &&
                  a instanceof U &&
                  a.isTreeExpanded &&
                  (!(a instanceof xf) || a.isSubGraphExpanded);
  
                )
                  a = e.pop();
                0 < e.length
                  ? (a instanceof T && b.fw(a.actualBounds),
                    a instanceof U &&
                      !a.isTreeExpanded &&
                      (a.isTreeExpanded = !0),
                    a instanceof xf &&
                      !a.isSubGraphExpanded &&
                      (a.isSubGraphExpanded = !0))
                  : (a instanceof T && b.bt(a.actualBounds),
                    b.ym('LayoutCompleted', g));
                b.Ua('Scroll To Part');
              },
              g = function () {
                sa(f, (c.isEnabled ? c.duration : 0) + d);
              };
            b.Uj('LayoutCompleted', g);
            f();
          }
        } else {
          var h = b.position.copy();
          b.bt(a.actualBounds);
          h.Ma(b.position) && c.Uc();
        }
      }
    };
    function Sk(a, b, c) {
      if (b.isVisible()) return c;
      if (b instanceof Ce) Sk(a, b.adornedPart, c);
      else if (b instanceof S) {
        var d = b.fromNode;
        null !== d && Sk(a, d, c);
        b = b.toNode;
        null !== b && Sk(a, b, c);
      } else
        b instanceof U &&
          ((d = b.labeledLink),
          null !== d && Sk(a, d, c),
          (d = b.Bg()),
          null !== d &&
            (d.isTreeExpanded || d.wasTreeExpanded || c.push(d), Sk(a, d, c))),
          (b = b.containingGroup),
          null !== b &&
            (b.isSubGraphExpanded || b.wasSubGraphExpanded || c.push(b),
            Sk(a, b, c));
      return c;
    }
    Qk.prototype.canScrollToPart = function (a) {
      void 0 === a && (a = null);
      if (null !== a && !(a instanceof T)) return !1;
      a = this.diagram;
      return 0 === a.selection.count && 0 === a.highlighteds.count
        ? !1
        : a.allowHorizontalScroll && a.allowVerticalScroll;
    };
    Qk.prototype.collapseTree = function (a) {
      void 0 === a && (a = null);
      var b = this.diagram;
      try {
        b.ta('Collapse Tree');
        zh(b.animationManager, 'Collapse Tree');
        var c = new E();
        if (null !== a && a.isTreeExpanded) a.collapseTree(), c.add(a);
        else if (null === a)
          for (var d = b.selection.iterator; d.next(); ) {
            var e = d.value;
            e instanceof U && e.isTreeExpanded && (e.collapseTree(), c.add(e));
          }
        b.R('TreeCollapsed', c);
      } finally {
        b.Ua('Collapse Tree');
      }
    };
    Qk.prototype.canCollapseTree = function (a) {
      void 0 === a && (a = null);
      var b = this.diagram;
      if (b.isReadOnly) return !1;
      if (null !== a) {
        if (!(a instanceof U && a.isTreeExpanded)) return !1;
        if (0 < a.mq().count) return !0;
      } else
        for (a = b.selection.iterator; a.next(); )
          if (
            ((b = a.value),
            b instanceof U && b.isTreeExpanded && 0 < b.mq().count)
          )
            return !0;
      return !1;
    };
    Qk.prototype.expandTree = function (a) {
      void 0 === a && (a = null);
      var b = this.diagram;
      try {
        b.ta('Expand Tree');
        zh(b.animationManager, 'Expand Tree');
        var c = new E();
        if (null !== a && !a.isTreeExpanded) a.expandTree(), c.add(a);
        else if (null === a)
          for (var d = b.selection.iterator; d.next(); ) {
            var e = d.value;
            e instanceof U && !e.isTreeExpanded && (e.expandTree(), c.add(e));
          }
        b.R('TreeExpanded', c);
      } finally {
        b.Ua('Expand Tree');
      }
    };
    Qk.prototype.canExpandTree = function (a) {
      void 0 === a && (a = null);
      var b = this.diagram;
      if (b.isReadOnly) return !1;
      if (null !== a) {
        if (!(a instanceof U) || a.isTreeExpanded) return !1;
        if (0 < a.mq().count) return !0;
      } else
        for (a = b.selection.iterator; a.next(); )
          if (
            ((b = a.value),
            b instanceof U && !b.isTreeExpanded && 0 < b.mq().count)
          )
            return !0;
      return !1;
    };
    Qk.prototype.groupSelection = function () {
      var a = this.diagram,
        b = a.model;
      if (b.kk()) {
        var c = this.archetypeGroupData;
        if (null !== c) {
          var d = null;
          try {
            a.currentCursor = 'wait';
            a.R('ChangingSelection', a.selection);
            a.ta('Group');
            for (var e = new E(), f = a.selection.iterator; f.next(); ) {
              var g = f.value;
              g.Vb() && g.canGroup() && e.add(g);
            }
            for (var h = new E(), k = e.iterator; k.next(); ) {
              var l = k.value;
              f = !1;
              for (var m = e.iterator; m.next(); )
                if (l.Xd(m.value)) {
                  f = !0;
                  break;
                }
              f || h.add(l);
            }
            if (0 < h.count) {
              var n = h.first().containingGroup;
              if (null !== n)
                for (; null !== n; ) {
                  e = !1;
                  for (var p = h.iterator; p.next(); )
                    if (!p.value.Xd(n)) {
                      e = !0;
                      break;
                    }
                  if (e) n = n.containingGroup;
                  else break;
                }
              if (c instanceof xf) zg(c), (d = c.copy()), null !== d && a.add(d);
              else if (b.Kv(c)) {
                var r = b.copyNodeData(c);
                za(r) && (b.mf(r), (d = a.Ri(r)));
              }
              if (null !== d) {
                null !== n && this.isValidMember(n, d) && (d.containingGroup = n);
                for (var q = h.iterator; q.next(); ) {
                  var u = q.value;
                  this.isValidMember(d, u) && (u.containingGroup = d);
                }
                Re(a);
                d.isSelected = !0;
              }
            }
            a.R('SelectionGrouped', d);
          } finally {
            a.Ua('Group'),
              a.R('ChangedSelection', a.selection),
              (a.currentCursor = '');
          }
        }
      }
    };
    Qk.prototype.canGroupSelection = function () {
      var a = this.diagram;
      if (
        a.isReadOnly ||
        a.isModelReadOnly ||
        !a.allowInsert ||
        !a.allowGroup ||
        !a.model.kk() ||
        null === this.archetypeGroupData
      )
        return !1;
      for (a = a.selection.iterator; a.next(); ) {
        var b = a.value;
        if (b.Vb() && b.canGroup()) return !0;
      }
      return !1;
    };
    function Tk(a) {
      var b = Ea();
      for (a = a.iterator; a.next(); ) {
        var c = a.value;
        c instanceof S || b.push(c);
      }
      a = new F();
      c = b.length;
      for (var d = 0; d < c; d++) {
        for (var e = b[d], f = !0, g = 0; g < c; g++)
          if (e.Xd(b[g])) {
            f = !1;
            break;
          }
        f && a.add(e);
      }
      Ha(b);
      return a;
    }
    Qk.prototype.isValidMember = function (a, b) {
      if (null === b || a === b || b instanceof S) return !1;
      if (null !== a) {
        if (a === b || a.Xd(b)) return !1;
        var c = a.memberValidation;
        if (
          (null !== c && !c(a, b)) ||
          (null === a.data && null !== b.data) ||
          (null !== a.data && null === b.data)
        )
          return !1;
      }
      c = this.memberValidation;
      return null !== c ? c(a, b) : !0;
    };
    Qk.prototype.ungroupSelection = function (a) {
      void 0 === a && (a = null);
      var b = this.diagram,
        c = b.model;
      if (c.kk())
        try {
          b.currentCursor = 'wait';
          b.R('ChangingSelection', b.selection);
          b.ta('Ungroup');
          var d = new E();
          if (null !== a) d.add(a);
          else
            for (var e = b.selection.iterator; e.next(); ) {
              var f = e.value;
              f instanceof xf && f.canUngroup() && d.add(f);
            }
          var g = new E();
          if (0 < d.count) {
            Re(b);
            for (var h = d.iterator; h.next(); ) {
              var k = h.value;
              k.expandSubGraph();
              var l = k.containingGroup,
                m = null !== l && null !== l.data ? c.ja(l.data) : void 0;
              g.addAll(k.memberParts);
              for (var n = g.iterator; n.next(); ) {
                var p = n.value;
                p.isSelected = !0;
                if (!(p instanceof S)) {
                  var r = p.data;
                  null !== r ? c.Mt(r, m) : (p.containingGroup = l);
                }
              }
              b.remove(k);
            }
          }
          b.R('SelectionUngrouped', d, g);
        } finally {
          b.Ua('Ungroup'),
            b.R('ChangedSelection', b.selection),
            (b.currentCursor = '');
        }
    };
    Qk.prototype.canUngroupSelection = function (a) {
      void 0 === a && (a = null);
      var b = this.diagram;
      if (
        b.isReadOnly ||
        b.isModelReadOnly ||
        !b.allowDelete ||
        !b.allowUngroup ||
        !b.model.kk()
      )
        return !1;
      if (null !== a) {
        if (!(a instanceof xf)) return !1;
        if (a.canUngroup()) return !0;
      } else
        for (a = b.selection.iterator; a.next(); )
          if (((b = a.value), b instanceof xf && b.canUngroup())) return !0;
      return !1;
    };
    Qk.prototype.addTopLevelParts = function (a, b) {
      var c = !0;
      for (a = Tk(a).iterator; a.next(); ) {
        var d = a.value;
        null !== d.containingGroup &&
          (!b || this.isValidMember(null, d)
            ? (d.containingGroup = null)
            : (c = !1));
      }
      return c;
    };
    Qk.prototype.collapseSubGraph = function (a) {
      void 0 === a && (a = null);
      var b = this.diagram;
      try {
        b.ta('Collapse SubGraph');
        zh(b.animationManager, 'Collapse SubGraph');
        var c = new E();
        if (null !== a && a.isSubGraphExpanded) a.collapseSubGraph(), c.add(a);
        else if (null === a)
          for (var d = b.selection.iterator; d.next(); ) {
            var e = d.value;
            e instanceof xf &&
              e.isSubGraphExpanded &&
              (e.collapseSubGraph(), c.add(e));
          }
        b.R('SubGraphCollapsed', c);
      } finally {
        b.Ua('Collapse SubGraph');
      }
    };
    Qk.prototype.canCollapseSubGraph = function (a) {
      void 0 === a && (a = null);
      var b = this.diagram;
      if (b.isReadOnly) return !1;
      if (null !== a) return a instanceof xf && a.isSubGraphExpanded ? !0 : !1;
      for (a = b.selection.iterator; a.next(); )
        if (((b = a.value), b instanceof xf && b.isSubGraphExpanded)) return !0;
      return !1;
    };
    Qk.prototype.expandSubGraph = function (a) {
      void 0 === a && (a = null);
      var b = this.diagram;
      try {
        b.ta('Expand SubGraph');
        zh(b.animationManager, 'Expand SubGraph');
        var c = new E();
        if (null !== a && !a.isSubGraphExpanded) a.expandSubGraph(), c.add(a);
        else if (null === a)
          for (var d = b.selection.iterator; d.next(); ) {
            var e = d.value;
            e instanceof xf &&
              !e.isSubGraphExpanded &&
              (e.expandSubGraph(), c.add(e));
          }
        b.R('SubGraphExpanded', c);
      } finally {
        b.Ua('Expand SubGraph');
      }
    };
    Qk.prototype.canExpandSubGraph = function (a) {
      void 0 === a && (a = null);
      var b = this.diagram;
      if (b.isReadOnly) return !1;
      if (null !== a) return a instanceof xf && !a.isSubGraphExpanded ? !0 : !1;
      for (a = b.selection.iterator; a.next(); )
        if (((b = a.value), b instanceof xf && !b.isSubGraphExpanded)) return !0;
      return !1;
    };
    Qk.prototype.editTextBlock = function (a) {
      void 0 === a && (a = null);
      var b = this.diagram,
        c = b.toolManager.findTool('TextEditing');
      if (null !== c) {
        if (null === a) {
          a = null;
          for (var d = b.selection.iterator; d.next(); ) {
            var e = d.value;
            if (e.canEdit()) {
              a = e;
              break;
            }
          }
          if (null === a) return;
          a = a.im(function (a) {
            return a instanceof Xg && a.editable;
          });
        }
        null !== a &&
          ((b.currentTool = null), (c.textBlock = a), (b.currentTool = c));
      }
    };
    Qk.prototype.canEditTextBlock = function (a) {
      void 0 === a && (a = null);
      var b = this.diagram;
      if (
        b.isReadOnly ||
        b.isModelReadOnly ||
        !b.allowTextEdit ||
        null === b.toolManager.findTool('TextEditing')
      )
        return !1;
      if (null !== a) {
        if (!(a instanceof Xg)) return !1;
        a = a.part;
        if (null !== a && a.canEdit()) return !0;
      } else
        for (b = b.selection.iterator; b.next(); )
          if (
            ((a = b.value),
            a.canEdit() &&
              ((a = a.im(function (a) {
                return a instanceof Xg && a.editable;
              })),
              null !== a))
          )
            return !0;
      return !1;
    };
    Qk.prototype.showContextMenu = function (a) {
      var b = this.diagram,
        c = b.toolManager.findTool('ContextMenu');
      if (
        null !== c &&
        (void 0 === a && (a = 0 < b.selection.count ? b.selection.first() : b),
        (a = c.findObjectWithContextMenu(a)),
        null !== a)
      ) {
        var d = b.lastInput,
          e = null;
        a instanceof Y
          ? (e = a.ga(Ac))
          : b.viewportBounds.aa(d.documentPoint) ||
            ((e = b.viewportBounds),
            (e = new H(e.x + e.width / 2, e.y + e.height / 2)));
        null !== e &&
          ((d.viewPoint = b.Mq(e)),
          (d.documentPoint = e),
          (d.left = !1),
          (d.right = !0),
          (d.up = !0));
        b.currentTool = c;
        Tg(c, !1, a);
      }
    };
    Qk.prototype.canShowContextMenu = function (a) {
      var b = this.diagram,
        c = b.toolManager.findTool('ContextMenu');
      if (null === c) return !1;
      void 0 === a && (a = 0 < b.selection.count ? b.selection.first() : b);
      return null === c.findObjectWithContextMenu(a) ? !1 : !0;
    };
    Qk.prototype.computeEffectiveCollection = function (a, b) {
      var c = this.diagram,
        d = c.toolManager.findTool('Dragging'),
        e = c.currentTool === d;
      void 0 === b && (b = e ? d.dragOptions : c.Rk);
      d = new G();
      if (null === a) return d;
      for (var f = a.iterator; f.next(); ) Mj(c, d, f.value, e, b);
      if (null !== c.draggedLink && b.dragsLink) return d;
      for (f = a.iterator; f.next(); )
        (a = f.value),
          a instanceof S &&
            ((b = a.fromNode),
            null === b || d.contains(b)
              ? ((b = a.toNode), null === b || d.contains(b) || d.remove(a))
              : d.remove(a));
      return d;
    };
    ma.Object.defineProperties(Qk.prototype, {
      diagram: {
        get: function () {
          return this.B;
        },
      },
      copiesClipboardData: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v = a;
        },
      },
      copiesConnectedLinks: {
        get: function () {
          return this.I;
        },
        set: function (a) {
          this.I = a;
        },
      },
      deletesConnectedLinks: {
        get: function () {
          return this.eb;
        },
        set: function (a) {
          this.eb = a;
        },
      },
      copiesTree: {
        get: function () {
          return this.La;
        },
        set: function (a) {
          this.La = a;
        },
      },
      deletesTree: {
        get: function () {
          return this.hd;
        },
        set: function (a) {
          this.hd = a;
        },
      },
      copiesParentKey: {
        get: function () {
          return this.Ja;
        },
        set: function (a) {
          this.Ja = a;
        },
      },
      copiesGroupKey: {
        get: function () {
          return this.Y;
        },
        set: function (a) {
          this.Y = a;
        },
      },
      archetypeGroupData: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.l = a;
        },
      },
      memberValidation: {
        get: function () {
          return this.yi;
        },
        set: function (a) {
          this.yi = a;
        },
      },
      defaultScale: {
        get: function () {
          return this.diagram.defaultScale;
        },
        set: function (a) {
          this.diagram.defaultScale = a;
        },
      },
      zoomFactor: {
        get: function () {
          return this.be;
        },
        set: function (a) {
          1 < a || B('zoomFactor must be larger than 1.0, not: ' + a);
          this.be = a;
        },
      },
      scrollToPartPause: {
        get: function () {
          return this.yd;
        },
        set: function (a) {
          this.yd = a;
        },
      },
    });
    Qk.className = 'CommandHandler';
    Ai = function () {
      return new Qk();
    };
    function Y() {
      Za(this);
      this.F = 4225027;
      this.jb = 1;
      this.ng = null;
      this.Ra = '';
      this.dc = this.gb = null;
      this.ma = new H(NaN, NaN).freeze();
      this.Jc = Qb;
      this.dg = Kb;
      this.cg = Pb;
      this.lb = new rd();
      this.Rh = new rd();
      this.ag = new rd();
      this.ya = this.Xk = 1;
      this.Zb = 0;
      this.xe = Uk;
      this.gh = sc;
      this.oc = new N(NaN, NaN, NaN, NaN).freeze();
      this.vb = new N(NaN, NaN, NaN, NaN).freeze();
      this.pc = new N(0, 0, NaN, NaN).freeze();
      this.O = this.bp = this.cp = null;
      this.Gk = this.wb = Zc;
      this.op = 0;
      this.pp = 1;
      this.Og = 0;
      this.gn = 1;
      this.Jp = null;
      this.wp = -Infinity;
      this.Jl = 0;
      this.Kl = Fb;
      this.Ll = cg;
      this.gi = '';
      this.Za = this.M = null;
      this.Kk = -1;
      this.Nl = this.jd = this.fi = this.Ql = null;
      this.vs = Ag;
      this.rp = this.Kg = this.Jj = null;
    }
    var vd, Ag, Cg, Uk, Vk, Wk, Xk, Yk, Zk, $k;
    Y.prototype.cloneProtected = function (a) {
      a.F = this.F | 6144;
      a.jb = this.jb;
      a.Ra = this.Ra;
      a.gb = this.gb;
      a.dc = this.dc;
      a.Kg = this.Kg;
      a.ma.assign(this.ma);
      a.Jc = this.Jc.G();
      a.dg = this.dg.G();
      a.cg = this.cg.G();
      a.ag = this.ag.copy();
      a.ya = this.ya;
      a.Zb = this.Zb;
      a.xe = this.xe;
      a.gh = this.gh.G();
      a.oc.assign(this.oc);
      a.vb.assign(this.vb);
      a.pc.assign(this.pc);
      a.bp = this.bp;
      null !== this.O && (a.O = this.O.copy());
      a.wb = this.wb.G();
      a.Gk = this.Gk.G();
      a.op = this.op;
      a.pp = this.pp;
      a.Og = this.Og;
      a.gn = this.gn;
      a.Jp = this.Jp;
      a.wp = this.wp;
      a.Jl = this.Jl;
      a.Kl = this.Kl.G();
      a.Ll = this.Ll;
      a.gi = this.gi;
      null !== this.M && (a.M = this.M.copy());
      a.Za = this.Za;
      a.Kk = this.Kk;
      null !== this.fi && (a.fi = Ba(this.fi));
      null !== this.jd && (a.jd = this.jd.copy());
      a.Nl = this.Nl;
    };
    Y.prototype.ux = function (a) {
      var b = this.fi;
      if (Aa(b))
        for (var c = 0; c < b.length; c++) {
          if (b[c] === a) return;
        }
      else this.fi = b = [];
      b.push(a);
    };
    Y.prototype.rf = function (a) {
      a.cp = null;
      a.Jj = null;
      a.o();
    };
    Y.prototype.clone = function () {
      var a = new this.constructor();
      this.cloneProtected(a);
      if (null !== this.fi)
        for (var b = 0; b < this.fi.length; b++) {
          var c = this.fi[b];
          a[c] = this[c];
        }
      return a;
    };
    Y.prototype.copy = function () {
      return this.clone();
    };
    t = Y.prototype;
    t.bb = function (a) {
      a.classType === S
        ? 0 === a.name.indexOf('Orient')
          ? (this.segmentOrientation = a)
          : B(
              'Unknown Link enum value for GraphObject.segmentOrientation property: ' +
                a,
            )
        : a.classType === Y && (this.stretch = a);
    };
    t.toString = function () {
      return Ia(this.constructor) + '#' + lb(this);
    };
    function al(a) {
      null === a.M && (a.M = new bl());
    }
    t.Dc = function () {
      if (null === this.O) {
        var a = new cl();
        a.Yg = uc;
        a.zh = uc;
        a.Wg = 10;
        a.xh = 10;
        a.Xg = 0;
        a.yh = 0;
        this.O = a;
      }
    };
    t.Ya = function (a, b, c, d, e, f, g) {
      var h = this.part;
      if (
        null !== h &&
        (h.wk(a, b, c, d, e, f, g),
        c === this && a === qe && dl(this) && el(this, h, b),
        (f = this.diagram),
        null !== this.Kg &&
          null !== f &&
          f.lk &&
          !f.undoManager.isUndoingRedoing &&
          f.currentTool === f.toolManager &&
          ((a = this.Kg.get(b)),
          null === a ||
            f.animationManager.isTicking ||
            (null === this.rp && (this.rp = new G()),
            (g = 0 === f.undoManager.transactionLevel),
            a.startCondition === bi
              ? (g = !0)
              : a.startCondition === di && (g = !1),
            g
              ? ((f = new yh()),
                ci(a, f),
                (g = this.rp.get(a)),
                null !== g && g.stop(),
                this.rp.add(a, f),
                (f.Yu = this),
                (f.px = a),
                f.add(this, b, d, e),
                f.start())
              : (Ah(f.animationManager, 'Trigger'),
                f.animationManager.defaultAnimation.add(this, b, d, e)))),
        this instanceof X && c === h && 0 !== (h.F & 16777216) && null !== h.data)
      )
        for (c = this.W.j, d = c.length, e = 0; e < d; e++)
          (h = c[e]),
            h instanceof X &&
              Ej(h, function (a) {
                null !== a.data && 0 !== (a.F & 16777216) && a.Aa(b);
              });
    };
    function el(a, b, c) {
      var d = a.Ti();
      if (null !== d)
        for (var e = a.Za.iterator; e.next(); ) {
          var f = e.value,
            g = null;
          if (null !== f.sourceName) {
            g = fl(f, d, a);
            if (null === g) continue;
            f.Pq(a, g, c, null);
          } else if (f.isToModel) {
            var h = b.diagram;
            null === h ||
              h.skipsModelSourceBindings ||
              f.Pq(a, h.model.modelData, c, d);
          } else {
            h = d.data;
            if (null === h) continue;
            var k = b.diagram;
            null === k || k.skipsModelSourceBindings || f.Pq(a, h, c, d);
          }
          g === a && ((h = d.ht(f.fj)), null !== h && f.ww(h, g, c));
        }
    }
    t.ht = function (a) {
      return this.Kk === a ? this : null;
    };
    t.g = function (a, b, c) {
      this.Ya(qe, a, this, b, c);
    };
    function gl(a, b, c, d, e) {
      var f = a.oc,
        g = a.ag;
      g.reset();
      hl(a, g, b, c, d, e);
      a.ag = g;
      f.h(b, c, d, e);
      g.ut() || g.tw(f);
    }
    function il(a, b, c, d) {
      if (!1 === a.pickable) return !1;
      d.multiply(a.transform);
      return c ? a.Fc(b, d) : a.Hh(b, d);
    }
    t.Nx = function (a, b, c) {
      if (!1 === this.pickable) return !1;
      var d = this.naturalBounds;
      b = a.Ae(b);
      return c
        ? Ab(a.x, a.y, 0, 0, 0, d.height) <= b ||
            Ab(a.x, a.y, 0, d.height, d.width, d.height) <= b ||
            Ab(a.x, a.y, d.width, d.height, d.width, 0) <= b ||
            Ab(a.x, a.y, d.width, 0, 0, 0) <= b
        : a.cd(0, 0) <= b &&
            a.cd(0, d.height) <= b &&
            a.cd(d.width, 0) <= b &&
            a.cd(d.width, d.height) <= b;
    };
    t.ae = function () {
      return !0;
    };
    t.aa = function (a) {
      var b = H.alloc();
      b.assign(a);
      this.transform.ra(b);
      var c = this.actualBounds;
      if (!c.u()) return H.free(b), !1;
      var d = this.diagram;
      if (null !== d && d.le) {
        var e = d.mm('extraTouchThreshold'),
          f = d.mm('extraTouchArea'),
          g = f / 2,
          h = this.naturalBounds;
        d = this.tf() * d.scale;
        var k = 1 / d;
        if (h.width * d < e && h.height * d < e)
          return (
            (a = fc(
              c.x - g * k,
              c.y - g * k,
              c.width + f * k,
              c.height + f * k,
              b.x,
              b.y,
            )),
            H.free(b),
            a
          );
      }
      e = !1;
      if (
        this instanceof Ce || this instanceof W
          ? fc(c.x - 5, c.y - 5, c.width + 10, c.height + 10, b.x, b.y)
          : c.aa(b)
      )
        this.jd && !this.jd.aa(b)
          ? (e = !1)
          : null !== this.dc && c.aa(b)
          ? (e = !0)
          : null !== this.gb && this.pc.aa(a)
          ? (e = !0)
          : (e = this.Ih(a));
      H.free(b);
      return e;
    };
    t.Ih = function (a) {
      var b = this.naturalBounds;
      return fc(0, 0, b.width, b.height, a.x, a.y);
    };
    t.qf = function (a) {
      if (0 === this.angle) return this.actualBounds.qf(a);
      var b = this.naturalBounds;
      b = N.allocAt(0, 0, b.width, b.height);
      var c = this.transform,
        d = !1,
        e = H.allocAt(a.x, a.y);
      b.aa(c.Wd(e)) &&
        (e.h(a.x, a.bottom),
        b.aa(c.Wd(e)) &&
          (e.h(a.right, a.bottom),
          b.aa(c.Wd(e)) && (e.h(a.right, a.y), b.aa(c.Wd(e)) && (d = !0))));
      H.free(e);
      N.free(b);
      return d;
    };
    t.Hh = function (a, b) {
      if (void 0 === b) return a.qf(this.actualBounds);
      var c = this.naturalBounds,
        d = !1,
        e = H.allocAt(0, 0);
      a.aa(b.ra(e)) &&
        (e.h(0, c.height),
        a.aa(b.ra(e)) &&
          (e.h(c.width, c.height),
          a.aa(b.ra(e)) && (e.h(c.width, 0), a.aa(b.ra(e)) && (d = !0))));
      H.free(e);
      return d;
    };
    t.Fc = function (a, b) {
      if (void 0 === b && ((b = this.transform), 0 === this.angle))
        return a.Fc(this.actualBounds);
      var c = this.naturalBounds,
        d = H.allocAt(0, 0),
        e = H.allocAt(0, c.height),
        f = H.allocAt(c.width, c.height),
        g = H.allocAt(c.width, 0),
        h = !1;
      if (a.aa(b.ra(d)) || a.aa(b.ra(e)) || a.aa(b.ra(f)) || a.aa(b.ra(g)))
        h = !0;
      else {
        c = N.allocAt(0, 0, c.width, c.height);
        var k = H.allocAt(a.x, a.y);
        c.aa(b.Wd(k))
          ? (h = !0)
          : (k.h(a.x, a.bottom),
            c.aa(b.Wd(k))
              ? (h = !0)
              : (k.h(a.right, a.bottom),
                c.aa(b.Wd(k))
                  ? (h = !0)
                  : (k.h(a.right, a.y), c.aa(b.Wd(k)) && (h = !0))));
        H.free(k);
        N.free(c);
        !h &&
          (J.rt(a, d, e) || J.rt(a, e, f) || J.rt(a, f, g) || J.rt(a, g, d)) &&
          (h = !0);
      }
      H.free(d);
      H.free(e);
      H.free(f);
      H.free(g);
      return h;
    };
    t.ga = function (a, b) {
      void 0 === b && (b = new H());
      if (a instanceof O) {
        var c = this.naturalBounds;
        b.h(a.x * c.width + a.offsetX, a.y * c.height + a.offsetY);
      } else b.set(a);
      this.sd.ra(b);
      return b;
    };
    t.nq = function (a) {
      void 0 === a && (a = new N());
      var b = this.naturalBounds,
        c = this.sd,
        d = H.allocAt(0, 0).transform(c);
      a.h(d.x, d.y, 0, 0);
      d.h(b.width, 0).transform(c);
      ec(a, d.x, d.y, 0, 0);
      d.h(b.width, b.height).transform(c);
      ec(a, d.x, d.y, 0, 0);
      d.h(0, b.height).transform(c);
      ec(a, d.x, d.y, 0, 0);
      H.free(d);
      return a;
    };
    t.Wi = function () {
      var a = this.sd;
      1 === a.m11 && 0 === a.m12
        ? (a = 0)
        : ((a = (180 * Math.atan2(a.m12, a.m11)) / Math.PI), 0 > a && (a += 360));
      return a;
    };
    t.tf = function () {
      if ((0 !== (this.F & 4096)) === !1) return this.Xk;
      var a = this.ya;
      return null !== this.panel ? a * this.panel.tf() : a;
    };
    t.nt = function (a, b) {
      void 0 === b && (b = new H());
      b.assign(a);
      this.sd.Wd(b);
      return b;
    };
    t.Sc = function (a, b, c) {
      return this.ik(a.x, a.y, b.x, b.y, c);
    };
    t.ik = function (a, b, c, d, e) {
      var f = this.transform,
        g = 1 / (f.m11 * f.m22 - f.m12 * f.m21),
        h = f.m22 * g,
        k = -f.m12 * g,
        l = -f.m21 * g,
        m = f.m11 * g,
        n = g * (f.m21 * f.dy - f.m22 * f.dx),
        p = g * (f.m12 * f.dx - f.m11 * f.dy);
      if (null !== this.areaBackground)
        return (
          (f = this.actualBounds),
          J.Sc(f.left, f.top, f.right, f.bottom, a, b, c, d, e)
        );
      g = a * h + b * l + n;
      a = a * k + b * m + p;
      b = c * h + d * l + n;
      c = c * k + d * m + p;
      e.h(0, 0);
      d = this.naturalBounds;
      c = J.Sc(0, 0, d.width, d.height, g, a, b, c, e);
      e.transform(f);
      return c;
    };
    Y.prototype.measure = function (a, b, c, d) {
      if (!1 !== rj(this)) {
        var e = this.gh,
          f = e.right + e.left;
        e = e.top + e.bottom;
        a = Math.max(a - f, 0);
        b = Math.max(b - e, 0);
        c = Math.max((c || 0) - f, 0);
        d = Math.max((d || 0) - e, 0);
        f = this.angle;
        e = this.desiredSize;
        var g = 0;
        this instanceof W && (g = this.strokeWidth);
        90 === f || 270 === f
          ? ((a = isFinite(e.height) ? e.height + g : a),
            (b = isFinite(e.width) ? e.width + g : b))
          : ((a = isFinite(e.width) ? e.width + g : a),
            (b = isFinite(e.height) ? e.height + g : b));
        e = c || 0;
        g = d || 0;
        var h = this instanceof X;
        switch (jl(this, !0)) {
          case Ag:
            g = e = 0;
            h && (b = a = Infinity);
            break;
          case vd:
            isFinite(a) && a > c && (e = a);
            isFinite(b) && b > d && (g = b);
            break;
          case Vk:
            isFinite(a) && a > c && (e = a);
            g = 0;
            h && (b = Infinity);
            break;
          case Wk:
            isFinite(b) && b > d && (g = b), (e = 0), h && (a = Infinity);
        }
        h = this.maxSize;
        var k = this.minSize;
        e > h.width && k.width < h.width && (e = h.width);
        g > h.height && k.height < h.height && (g = h.height);
        c = Math.max(e / this.scale, k.width);
        d = Math.max(g / this.scale, k.height);
        h.width < c && (c = Math.min(k.width, c));
        h.height < d && (d = Math.min(k.height, d));
        a = Math.min(h.width, a);
        b = Math.min(h.height, b);
        a = Math.max(c, a);
        b = Math.max(d, b);
        if (90 === f || 270 === f)
          (f = a), (a = b), (b = f), (f = c), (c = d), (d = f);
        this.oc.ea();
        this.sm(a, b, c, d);
        this.oc.freeze();
        this.oc.u() ||
          B(
            'Non-real measuredBounds has been set. Object ' +
              this +
              ', measuredBounds: ' +
              this.oc.toString(),
          );
        mj(this, !1);
      }
    };
    Y.prototype.sm = function () {};
    Y.prototype.wf = function () {
      return !1;
    };
    Y.prototype.arrange = function (a, b, c, d, e) {
      this.nl();
      var f = N.alloc();
      f.assign(this.vb);
      this.vb.ea();
      !1 === sj(this) ? this.vb.h(a, b, c, d) : this.Gh(a, b, c, d);
      this.vb.freeze();
      void 0 === e ? (this.jd = null) : (this.jd = e);
      c = !1;
      if (void 0 !== e) c = !0;
      else if (
        ((e = this.panel),
        null === e ||
          (e.type !== X.TableRow && e.type !== X.TableColumn) ||
          (e = e.panel),
        null !== e &&
          ((e = e.pc),
          (d = this.measuredBounds),
          null !== this.areaBackground && (d = this.vb),
          (c = b + d.height),
          (d = a + d.width),
          (c = !(
            0 <= a + 0.05 &&
            d <= e.width + 0.05 &&
            0 <= b + 0.05 &&
            c <= e.height + 0.05
          )),
          this instanceof Xg &&
            ((a = this.naturalBounds), this.$r > a.height || this.qb > a.width)))
      )
        c = !0;
      this.F = c ? this.F | 256 : this.F & -257;
      this.vb.u() ||
        B(
          'Non-real actualBounds has been set. Object ' +
            this +
            ', actualBounds: ' +
            this.vb.toString(),
        );
      this.Et(f, this.vb);
      kl(this, !1);
      N.free(f);
    };
    t = Y.prototype;
    t.Gh = function () {};
    function ll(a, b, c, d, e) {
      a.vb.h(b, c, d, e);
      if (!a.desiredSize.u()) {
        var f = a.oc;
        c = a.gh;
        b = c.right + c.left;
        var g = c.top + c.bottom;
        c = f.width + b;
        f = f.height + g;
        d += b;
        e += g;
        b = jl(a, !0);
        c === d && f === e && (b = Ag);
        switch (b) {
          case Ag:
            if (c > d || f > e)
              mj(a, !0), a.measure(c > d ? d : c, f > e ? e : f, 0, 0);
            break;
          case vd:
            mj(a, !0);
            a.measure(d, e, 0, 0);
            break;
          case Vk:
            mj(a, !0);
            a.measure(d, f, 0, 0);
            break;
          case Wk:
            mj(a, !0), a.measure(c, e, 0, 0);
        }
      }
    }
    t.Et = function (a, b) {
      var c = this.part;
      null !== c &&
        null !== c.diagram &&
        ((c.selectionObject !== this &&
          c.resizeObject !== this &&
          c.rotateObject !== this) ||
          ml(c, !0),
        this.N(),
        Zb(a, b) || (c.Kh(), this.So(c)));
    };
    t.So = function (a) {
      null !== this.portId && (ml(a, !0), a instanceof U && nl(a, this));
    };
    t.tb = function (a, b) {
      if (this.visible) {
        var c =
            this instanceof X &&
            (this.type === X.TableRow || this.type === X.TableColumn),
          d = this.vb;
        if (
          c ||
          (0 !== d.width && 0 !== d.height && !isNaN(d.x) && !isNaN(d.y))
        ) {
          var e = this.opacity;
          if (0 !== e) {
            var f = 1;
            1 !== e && ((f = a.globalAlpha), (a.globalAlpha = f * e));
            if (!this.Jx(a, b))
              if (c) ol(this, a, b);
              else {
                this instanceof S && this.pk(!1);
                c = this.transform;
                var g = this.panel;
                (0 !== (this.F & 4096)) === !0 && pl(this);
                var h = this.part,
                  k = !1,
                  l = 0;
                if (h && b.Be('drawShadows') && (k = h.isShadowed)) {
                  var m = h.shadowOffset;
                  l = Math.max(m.y, m.x) * b.scale * b.Rb;
                }
                if (!(m = b.ni || !this.wf())) {
                  var n = this.naturalBounds;
                  m = this.Rh;
                  var p = m.m11,
                    r = m.m21,
                    q = m.dx,
                    u = m.m12,
                    v = m.m22,
                    w = m.dy,
                    y,
                    z = (y = 0);
                  m = y * p + z * r + q;
                  var A = y * u + z * v + w;
                  y = n.width + l;
                  z = 0;
                  var C = y * p + z * r + q;
                  y = y * u + z * v + w;
                  z = Math.min(m, C);
                  var I = Math.min(A, y);
                  var P = Math.max(m + 0, C) - z;
                  var K = Math.max(A + 0, y) - I;
                  m = z;
                  A = I;
                  y = n.width + l;
                  z = n.height + l;
                  C = y * p + z * r + q;
                  y = y * u + z * v + w;
                  z = Math.min(m, C);
                  I = Math.min(A, y);
                  P = Math.max(m + P, C) - z;
                  K = Math.max(A + K, y) - I;
                  m = z;
                  A = I;
                  y = 0;
                  z = n.height + l;
                  C = y * p + z * r + q;
                  y = y * u + z * v + w;
                  z = Math.min(m, C);
                  I = Math.min(A, y);
                  P = Math.max(m + P, C) - z;
                  K = Math.max(A + K, y) - I;
                  m = z;
                  A = I;
                  l = b.viewportBounds;
                  n = l.x;
                  p = l.y;
                  m = !(
                    m > l.width + n ||
                    n > P + m ||
                    A > l.height + p ||
                    p > K + A
                  );
                }
                if (m) {
                  m = 0 !== (this.F & 256);
                  a.clipInsteadOfFill && (m = !1);
                  this instanceof Xg && (a.font = this.font);
                  if (m) {
                    A = g.ae() ? g.naturalBounds : g.actualBounds;
                    null !== this.jd
                      ? ((n = this.jd),
                        (P = n.x),
                        (K = n.y),
                        (l = n.width),
                        (n = n.height))
                      : ((P = Math.max(d.x, A.x)),
                        (K = Math.max(d.y, A.y)),
                        (l = Math.min(d.right, A.right) - P),
                        (n = Math.min(d.bottom, A.bottom) - K));
                    if (P > d.width + d.x || d.x > A.width + A.x) {
                      1 !== e && (a.globalAlpha = f);
                      return;
                    }
                    a.save();
                    a.beginPath();
                    a.rect(P, K, l, n);
                    a.clip();
                  }
                  if (this.wf()) {
                    if (!h.isVisible()) {
                      1 !== e && (a.globalAlpha = f);
                      return;
                    }
                    k &&
                      ((A = h.shadowOffset),
                      a.mw(
                        A.x * b.scale * b.Rb,
                        A.y * b.scale * b.Rb,
                        h.shadowBlur,
                      ),
                      ql(a),
                      (a.shadowColor = h.shadowColor));
                  }
                  !0 === this.shadowVisible
                    ? ql(a)
                    : !1 === this.shadowVisible && rl(a);
                  h = this.naturalBounds;
                  null !== this.dc &&
                    (ji(this, a, this.dc, !0, !0, h, d),
                    this.dc instanceof sl && this.dc.type === tl
                      ? (a.beginPath(),
                        a.rect(d.x, d.y, d.width, d.height),
                        a.Vd(this.dc))
                      : a.fillRect(d.x, d.y, d.width, d.height));
                  a.transform(c.m11, c.m12, c.m21, c.m22, c.dx, c.dy);
                  k &&
                    ((null !== g && 0 !== (g.F & 512)) ||
                      (null !== g &&
                        (g.type === X.Auto || g.type === X.Spot) &&
                        g.Ab() !== this)) &&
                    null === this.shadowVisible &&
                    rl(a);
                  null !== this.gb &&
                    ((l = this.naturalBounds),
                    (P = A = 0),
                    (K = l.width),
                    (l = l.height),
                    (n = 0),
                    this instanceof W &&
                      ((l = this.ka.bounds),
                      (A = l.x),
                      (P = l.y),
                      (K = l.width),
                      (l = l.height),
                      (n = this.strokeWidth)),
                    ji(this, a, this.gb, !0, !1, h, d),
                    this.gb instanceof sl && this.gb.type === tl
                      ? (a.beginPath(),
                        a.rect(A - n / 2, P - n / 2, K + n, l + n),
                        a.Vd(this.gb))
                      : a.fillRect(A - n / 2, P - n / 2, K + n, l + n));
                  k &&
                  (null !== this.gb ||
                    null !== this.dc ||
                    (null !== g && 0 !== (g.F & 512)) ||
                    (null !== g &&
                      (g.type === X.Auto || g.type === X.Spot) &&
                      g.Ab() !== this))
                    ? (ul(this, !0), null === this.shadowVisible && rl(a))
                    : ul(this, !1);
                  this.Pi(a, b);
                  k && (0 !== (this.F & 512)) === !0 && ql(a);
                  this.wf() && k && rl(a);
                  m
                    ? (a.restore(), this instanceof X ? a.Qc(!0) : a.Qc(!1))
                    : c.ut() ||
                      ((b = 1 / (c.m11 * c.m22 - c.m12 * c.m21)),
                      a.transform(
                        c.m22 * b,
                        -c.m12 * b,
                        -c.m21 * b,
                        c.m11 * b,
                        b * (c.m21 * c.dy - c.m22 * c.dx),
                        b * (c.m12 * c.dx - c.m11 * c.dy),
                      ));
                }
              }
            1 !== e && (a.globalAlpha = f);
          }
        }
      }
    };
    t.Jx = function () {
      return !1;
    };
    function ol(a, b, c) {
      var d = a.vb,
        e = a.pc;
      null !== a.dc &&
        (ji(a, b, a.dc, !0, !0, e, d),
        a.dc instanceof sl && a.dc.type === tl
          ? (b.beginPath(), b.rect(d.x, d.y, d.width, d.height), b.Vd(a.dc))
          : b.fillRect(d.x, d.y, d.width, d.height));
      null !== a.gb &&
        (ji(a, b, a.gb, !0, !1, e, d),
        a.gb instanceof sl && a.gb.type === tl
          ? (b.beginPath(), b.rect(d.x, d.y, d.width, d.height), b.Vd(a.gb))
          : b.fillRect(d.x, d.y, d.width, d.height));
      a.Pi(b, c);
    }
    t.Pi = function () {};
    function ji(a, b, c, d, e, f, g) {
      if (null !== c) {
        var h = 1,
          k = 1;
        if ('string' === typeof c) d ? (b.fillStyle = c) : (b.strokeStyle = c);
        else if (c.type === vl)
          d ? (b.fillStyle = c.color) : (b.strokeStyle = c.color);
        else {
          h = f.width;
          k = f.height;
          e && ((h = g.width), (k = g.height));
          if (
            (f = b instanceof wl) &&
            c.ee &&
            (c.type === xl || (c.Nk === h && c.au === k))
          )
            var l = c.ee;
          else {
            var m = 0,
              n = 0,
              p = 0,
              r = 0,
              q = 0,
              u = 0;
            u = q = 0;
            e && ((q = g.x), (u = g.y));
            m = c.start.x * h + c.start.offsetX;
            n = c.start.y * k + c.start.offsetY;
            p = c.end.x * h + c.end.offsetX;
            r = c.end.y * k + c.end.offsetY;
            m += q;
            p += q;
            n += u;
            r += u;
            if (c.type === yl) l = b.createLinearGradient(m, n, p, r);
            else if (c.type === tl)
              (u = isNaN(c.endRadius) ? Math.max(h, k) / 2 : c.endRadius),
                isNaN(c.startRadius)
                  ? ((q = 0), (u = Math.max(h, k) / 2))
                  : (q = c.startRadius),
                (l = b.createRadialGradient(m, n, q, p, r, u));
            else if (c.type === xl)
              try {
                l = b.createPattern(c.pattern, 'repeat');
              } catch (w) {
                l = null;
              }
            if (c.type !== xl && ((e = c.colorStops), null !== e))
              for (e = e.iterator; e.next(); ) l.addColorStop(e.key, e.value);
            if (
              f &&
              ((c.ee = l),
              null !== l && ((c.Nk = h), (c.au = k)),
              null === l && c.type === xl && -1 !== c.Nk)
            ) {
              c.Nk = -1;
              var v = a.diagram;
              null !== v &&
                -1 === c.Nk &&
                sa(function () {
                  v.zf();
                }, 600);
            }
          }
          d ? (b.fillStyle = l) : (b.strokeStyle = l);
        }
      }
    }
    t.Dg = function (a) {
      if (a instanceof X)
        a: {
          if (this !== a && null !== a)
            for (var b = this.panel; null !== b; ) {
              if (b === a) {
                a = !0;
                break a;
              }
              b = b.panel;
            }
          a = !1;
        }
      else a = !1;
      return a;
    };
    t.yf = function () {
      if (!this.visible) return !1;
      var a = this.panel;
      return null !== a ? a.yf() : !0;
    };
    t.Eg = function () {
      for (
        var a = this instanceof X ? this : this.panel;
        null !== a && a.isEnabled;
  
      )
        a = a.panel;
      return null === a;
    };
    function pl(a) {
      if ((0 !== (a.F & 2048)) === !0) {
        var b = a.lb;
        b.reset();
        if (!a.vb.u() || !a.oc.u()) {
          zl(a, !1);
          return;
        }
        b.translate(a.vb.x - a.oc.x, a.vb.y - a.oc.y);
        if (1 !== a.scale || 0 !== a.angle) {
          var c = a.naturalBounds;
          hl(a, b, c.x, c.y, c.width, c.height);
        }
        zl(a, !1);
        Al(a, !0);
      }
      (0 !== (a.F & 4096)) === !0 &&
        ((b = a.panel),
        null === b
          ? (a.Rh.set(a.lb), (a.Xk = a.scale), Al(a, !1))
          : null !== b.sd &&
            ((c = a.Rh),
            c.reset(),
            b.ae()
              ? c.multiply(b.Rh)
              : null !== b.panel && c.multiply(b.panel.Rh),
            c.multiply(a.lb),
            (a.Xk = a.scale * b.Xk),
            Al(a, !1)));
    }
    function hl(a, b, c, d, e, f) {
      1 !== a.scale && b.scale(a.scale);
      if (0 !== a.Zb) {
        var g = Ac;
        a.wf() && a.locationSpot.cb() && (g = a.locationSpot);
        var h = H.alloc();
        if (a instanceof T && a.locationObject !== a)
          for (
            c = a.locationObject,
              d = c.naturalBounds,
              h.yk(d.x, d.y, d.width, d.height, g),
              c.ag.ra(h),
              h.offset(-c.measuredBounds.x, -c.measuredBounds.y),
              g = c.panel;
            null !== g && g !== a;
  
          )
            g.ag.ra(h),
              h.offset(-g.measuredBounds.x, -g.measuredBounds.y),
              (g = g.panel);
        else h.yk(c, d, e, f, g);
        b.rotate(a.Zb, h.x, h.y);
        H.free(h);
      }
    }
    t.o = function (a) {
      void 0 === a && (a = !1);
      if (!0 !== rj(this)) {
        mj(this, !0);
        kl(this, !0);
        var b = this.panel;
        null === b || a || b.o();
      }
    };
    t.om = function () {
      !0 !== rj(this) && (mj(this, !0), kl(this, !0));
    };
    function Bl(a) {
      if (!1 === sj(a)) {
        var b = a.panel;
        null !== b
          ? b.o()
          : a.wf() &&
            ((b = a.diagram),
            null !== b && (b.ld.add(a), a instanceof U && a.ed(), b.Yb()));
        kl(a, !0);
      }
    }
    t.nl = function () {
      (0 !== (this.F & 2048)) === !1 && (zl(this, !0), Al(this, !0));
    };
    t.Iv = function () {
      Al(this, !0);
    };
    t.N = function () {
      var a = this.part;
      null !== a && a.N();
    };
    function jl(a, b) {
      var c = a.stretch,
        d = a.panel;
      if (null !== d && d.type === X.Table)
        return Cl(
          a,
          d.getRowDefinition(a.row),
          d.getColumnDefinition(a.column),
          b,
        );
      if (null !== d && d.type === X.Auto && d.Ab() === a) return Dl(a, vd, b);
      if (c === Uk) {
        if (null !== d) {
          if (d.type === X.Spot && d.Ab() === a) return Dl(a, vd, b);
          c = d.defaultStretch;
          return c === Uk ? Dl(a, Ag, b) : Dl(a, c, b);
        }
        return Dl(a, Ag, b);
      }
      return Dl(a, c, b);
    }
    function Cl(a, b, c, d) {
      var e = a.stretch;
      if (e !== Uk) return Dl(a, e, d);
      var f = (e = null);
      switch (b.stretch) {
        case Wk:
          f = !0;
          break;
        case vd:
          f = !0;
      }
      switch (c.stretch) {
        case Vk:
          e = !0;
          break;
        case vd:
          e = !0;
      }
      b = a.panel.defaultStretch;
      null === e && (e = b === Vk || b === vd);
      null === f && (f = b === Wk || b === vd);
      return !0 === e && !0 === f
        ? Dl(a, vd, d)
        : !0 === e
        ? Dl(a, Vk, d)
        : !0 === f
        ? Dl(a, Wk, d)
        : Dl(a, Ag, d);
    }
    function Dl(a, b, c) {
      if (c) return b;
      if (b === Ag) return Ag;
      c = a.desiredSize;
      if (c.u()) return Ag;
      a = a.angle;
      if (!isNaN(c.width))
        if (90 !== a && 270 !== a) {
          if (b === Vk) return Ag;
          if (b === vd) return Wk;
        } else {
          if (b === Wk) return Ag;
          if (b === vd) return Vk;
        }
      if (!isNaN(c.height))
        if (90 !== a && 270 !== a) {
          if (b === Wk) return Ag;
          if (b === vd) return Vk;
        } else {
          if (b === Vk) return Ag;
          if (b === vd) return Wk;
        }
      return b;
    }
    function ul(a, b) {
      a.F = b ? a.F | 512 : a.F & -513;
    }
    function dl(a) {
      return 0 !== (a.F & 1024);
    }
    function El(a, b) {
      a.F = b ? a.F | 1024 : a.F & -1025;
    }
    function zl(a, b) {
      a.F = b ? a.F | 2048 : a.F & -2049;
    }
    function Al(a, b) {
      a.F = b ? a.F | 4096 : a.F & -4097;
    }
    function rj(a) {
      return 0 !== (a.F & 8192);
    }
    function mj(a, b) {
      a.F = b ? a.F | 8192 : a.F & -8193;
    }
    function sj(a) {
      return 0 !== (a.F & 16384);
    }
    function kl(a, b) {
      a.F = b ? a.F | 16384 : a.F & -16385;
    }
    t.bj = function (a) {
      this.ng = a;
    };
    t.kw = function () {};
    t.jw = function (a) {
      this.ma.assign(a);
      Bl(this);
      return !0;
    };
    t.Jq = function (a, b) {
      if (this.ma.x !== a || this.ma.y !== b) this.ma.h(a, b), this.nl();
    };
    function Fl(a) {
      var b = a.part;
      if (b instanceof U && (null !== a.portId || a === b.port)) {
        var c = b.diagram;
        null === c || c.undoManager.isUndoingRedoing || nl(b, a);
      }
    }
    function Gl(a) {
      var b = a.diagram;
      null === b ||
        b.undoManager.isUndoingRedoing ||
        (a instanceof X
          ? a instanceof U
            ? a.ed()
            : a.Km(a, function (a) {
                Fl(a);
              })
          : Fl(a));
    }
    t.bind = function (a) {
      a.ad = this;
      var b = this.Ti();
      null !== b &&
        Hl(b) &&
        B(
          'Cannot add a Binding to a template that has already been copied: ' + a,
        );
      null === this.Za && (this.Za = new E());
      this.Za.add(a);
    };
    t.Ti = function () {
      for (var a = this instanceof X ? this : this.panel; null !== a; ) {
        if (null !== a.di) return a;
        a = a.panel;
      }
      return null;
    };
    t.lw = function (a) {
      yj(this, a);
    };
    function Il(a, b) {
      b.ad = a;
      null === a.Kg && (a.Kg = new G());
      a.Kg.add(b.propertyName, b);
    }
    function Jl(a, b) {
      for (var c = 1; c < arguments.length; ++c);
      c = arguments;
      var d = null,
        e = null;
      if ('function' === typeof a) e = a;
      else if ('string' === typeof a) {
        var f = Kl.H(a);
        'function' === typeof f
          ? ((c = Ba(arguments)),
            (d = f(c)),
            za(d) ||
              B(
                'GraphObject.make invoked object builder "' +
                  a +
                  '", but it did not return an Object',
              ))
          : (e = x.go[a]);
      }
      null === d &&
        ((void 0 !== e && null !== e && e.constructor) ||
          B(
            'GraphObject.make requires a class function or GoJS class name or name of an object builder, not: ' +
              a,
          ),
        (d = new e()));
      e = 1;
      if (d instanceof R && 1 < c.length) {
        f = d;
        var g = c[1];
        if ('string' === typeof g || g instanceof HTMLDivElement) Fi(f, g), e++;
      }
      for (; e < c.length; e++)
        (f = c[e]),
          void 0 === f
            ? B(
                'Undefined value at argument ' +
                  e +
                  ' for object being constructed by GraphObject.make: ' +
                  d,
              )
            : Ll(d, f);
      return d;
    }
    function Ll(a, b) {
      if ('string' === typeof b)
        if (a instanceof Xg) a.text = b;
        else if (a instanceof W) a.figure = b;
        else if (a instanceof lk) a.source = b;
        else if (a instanceof X) (b = Ml.H(b)), null !== b && (a.type = b);
        else if (a instanceof sl) {
          var c = $a(sl, b);
          null !== c
            ? (a.type = c)
            : B('Unknown Brush type as an argument to GraphObject.make: ' + b);
        } else
          a instanceof td
            ? ((b = $a(td, b)), null !== b && (a.type = b))
            : a instanceof ge && ((b = $a(ge, b)), null !== b && (a.type = b));
      else if (b instanceof Y)
        a instanceof X ||
          B('A GraphObject can only be added to a Panel, not to: ' + a),
          a.add(b);
      else if (b instanceof Sj) {
        var d;
        b.isRow && 'function' === typeof a.getRowDefinition
          ? (d = a.getRowDefinition(b.index))
          : b.isRow ||
            'function' !== typeof a.getColumnDefinition ||
            (d = a.getColumnDefinition(b.index));
        d instanceof Sj
          ? d.dt(b)
          : B(
              'A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: ' +
                a,
            );
      } else if (b instanceof D) 'function' === typeof a.bb && a.bb(b);
      else if (b instanceof Nl) a.type = b;
      else if (b instanceof Ki)
        a instanceof Y
          ? a.bind(b)
          : a instanceof Sj
          ? a.bind(b)
          : B(
              'A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: ' +
                a,
            );
      else if (b instanceof $h)
        a instanceof Y
          ? Il(a, b)
          : B(
              'An AnimationTrigger can only be applied to a GraphObject, not to: ' +
                a,
            );
      else if (b instanceof fe)
        a instanceof td
          ? a.figures.add(b)
          : B('A PathFigure can only be added to a Geometry, not to: ' + a);
      else if (b instanceof ge)
        a instanceof fe
          ? a.segments.add(b)
          : B('A PathSegment can only be added to a PathFigure, not to: ' + a);
      else if (b instanceof Di)
        a instanceof R
          ? (a.layout = b)
          : a instanceof xf
          ? (a.layout = b)
          : B(
              'A Layout can only be assigned to a Diagram or a Group, not to: ' +
                a,
            );
      else if (Array.isArray(b)) for (c = 0; c < b.length; c++) Ll(a, b[c]);
      else if ('object' === typeof b && null !== b)
        if (a instanceof sl) {
          c = new db();
          for (var e in b)
            (d = parseFloat(e)),
              isNaN(d) ? (c[e] = b[e]) : a.addColorStop(d, b[e]);
          yj(a, c);
        } else if (a instanceof Sj) {
          void 0 !== b.row
            ? ((e = b.row),
              (void 0 === e ||
                null === e ||
                Infinity === e ||
                isNaN(e) ||
                0 > e) &&
                B(
                  'Must specify non-negative integer row for RowColumnDefinition ' +
                    b +
                    ', not: ' +
                    e,
                ),
              (a.isRow = !0),
              (a.index = e))
            : void 0 !== b.column &&
              ((e = b.column),
              (void 0 === e ||
                null === e ||
                Infinity === e ||
                isNaN(e) ||
                0 > e) &&
                B(
                  'Must specify non-negative integer column for RowColumnDefinition ' +
                    b +
                    ', not: ' +
                    e,
                ),
              (a.isRow = !1),
              (a.index = e));
          e = new db();
          for (c in b) 'row' !== c && 'column' !== c && (e[c] = b[c]);
          yj(a, e);
        } else yj(a, b);
      else
        B(
          'Unknown initializer "' +
            b +
            '" for object being constructed by GraphObject.make: ' +
            a,
        );
    }
    function Ol(a, b) {
      Kl.add(a, b);
    }
    function Pl(a, b, c) {
      void 0 === c && (c = null);
      var d = a[1];
      if ('function' === typeof c ? c(d) : 'string' === typeof d)
        return a.splice(1, 1), d;
      if (void 0 === b)
        throw Error(
          'no ' +
            ('function' === typeof c ? 'satisfactory' : 'string') +
            ' argument for GraphObject builder ' +
            a[0],
        );
      return b;
    }
    ma.Object.defineProperties(Y.prototype, {
      shadowVisible: {
        get: function () {
          return this.Nl;
        },
        set: function (a) {
          var b = this.Nl;
          b !== a && ((this.Nl = a), this.N(), this.g('shadowVisible', b, a));
        },
      },
      enabledChanged: {
        get: function () {
          return null !== this.M ? this.M.En : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.En;
          b !== a && ((this.M.En = a), this.g('enabledChanged', b, a));
        },
      },
      segmentOrientation: {
        get: function () {
          return this.Ll;
        },
        set: function (a) {
          var b = this.Ll;
          b !== a &&
            ((this.Ll = a),
            this.o(),
            this.g('segmentOrientation', b, a),
            a === cg && (this.angle = 0));
        },
      },
      segmentIndex: {
        get: function () {
          return this.wp;
        },
        set: function (a) {
          a = Math.round(a);
          var b = this.wp;
          b !== a && ((this.wp = a), this.o(), this.g('segmentIndex', b, a));
        },
      },
      segmentFraction: {
        get: function () {
          return this.Jl;
        },
        set: function (a) {
          isNaN(a) ? (a = 0) : 0 > a ? (a = 0) : 1 < a && (a = 1);
          var b = this.Jl;
          b !== a && ((this.Jl = a), this.o(), this.g('segmentFraction', b, a));
        },
      },
      segmentOffset: {
        get: function () {
          return this.Kl;
        },
        set: function (a) {
          var b = this.Kl;
          b.A(a) ||
            ((this.Kl = a = a.G()), this.o(), this.g('segmentOffset', b, a));
        },
      },
      stretch: {
        get: function () {
          return this.xe;
        },
        set: function (a) {
          var b = this.xe;
          b !== a && ((this.xe = a), this.o(), this.g('stretch', b, a));
        },
      },
      name: {
        get: function () {
          return this.Ra;
        },
        set: function (a) {
          var b = this.Ra;
          b !== a &&
            ((this.Ra = a),
            null !== this.part && (this.part.Fj = null),
            this.g('name', b, a));
        },
      },
      opacity: {
        get: function () {
          return this.jb;
        },
        set: function (a) {
          var b = this.jb;
          b !== a &&
            ((0 > a || 1 < a) && va(a, '0 <= value <= 1', Y, 'opacity'),
            (this.jb = a),
            this.g('opacity', b, a),
            (a = this.diagram),
            (b = this.part),
            null !== a && null !== b && a.N(Cj(b, b.actualBounds)));
        },
      },
      visible: {
        get: function () {
          return 0 !== (this.F & 1);
        },
        set: function (a) {
          var b = 0 !== (this.F & 1);
          b !== a &&
            ((this.F ^= 1),
            this.g('visible', b, a),
            (b = this.panel),
            null !== b ? b.o() : this.wf() && this.Ob(a),
            this.N(),
            Gl(this));
        },
      },
      pickable: {
        get: function () {
          return 0 !== (this.F & 2);
        },
        set: function (a) {
          var b = 0 !== (this.F & 2);
          b !== a && ((this.F ^= 2), this.g('pickable', b, a));
        },
      },
      fromLinkableDuplicates: {
        get: function () {
          return 0 !== (this.F & 4);
        },
        set: function (a) {
          var b = 0 !== (this.F & 4);
          b !== a && ((this.F ^= 4), this.g('fromLinkableDuplicates', b, a));
        },
      },
      fromLinkableSelfNode: {
        get: function () {
          return 0 !== (this.F & 8);
        },
        set: function (a) {
          var b = 0 !== (this.F & 8);
          b !== a && ((this.F ^= 8), this.g('fromLinkableSelfNode', b, a));
        },
      },
      toLinkableDuplicates: {
        get: function () {
          return 0 !== (this.F & 16);
        },
        set: function (a) {
          var b = 0 !== (this.F & 16);
          b !== a && ((this.F ^= 16), this.g('toLinkableDuplicates', b, a));
        },
      },
      toLinkableSelfNode: {
        get: function () {
          return 0 !== (this.F & 32);
        },
        set: function (a) {
          var b = 0 !== (this.F & 32);
          b !== a && ((this.F ^= 32), this.g('toLinkableSelfNode', b, a));
        },
      },
      isPanelMain: {
        get: function () {
          return 0 !== (this.F & 64);
        },
        set: function (a) {
          var b = 0 !== (this.F & 64);
          b !== a && ((this.F ^= 64), this.o(), this.g('isPanelMain', b, a));
        },
      },
      isActionable: {
        get: function () {
          return 0 !== (this.F & 128);
        },
        set: function (a) {
          var b = 0 !== (this.F & 128);
          b !== a && ((this.F ^= 128), this.g('isActionable', b, a));
        },
      },
      areaBackground: {
        get: function () {
          return this.dc;
        },
        set: function (a) {
          var b = this.dc;
          b !== a &&
            (null !== a && Ql(a, 'GraphObject.areaBackground'),
            a instanceof sl && a.freeze(),
            (this.dc = a),
            this.N(),
            this.g('areaBackground', b, a));
        },
      },
      background: {
        get: function () {
          return this.gb;
        },
        set: function (a) {
          var b = this.gb;
          b !== a &&
            (null !== a && Ql(a, 'GraphObject.background'),
            a instanceof sl && a.freeze(),
            (this.gb = a),
            this.N(),
            this.g('background', b, a));
        },
      },
      part: {
        get: function () {
          if (this.wf()) return this;
          if (null !== this.Jj) return this.Jj;
          var a;
          for (a = this.panel; a; ) {
            if (a instanceof T) return (this.Jj = a);
            a = a.panel;
          }
          return null;
        },
      },
      svg: {
        get: function () {
          return this.Op;
        },
        set: function (a) {
          this.Op = a;
        },
      },
      panel: {
        get: function () {
          return this.ng;
        },
      },
      layer: {
        get: function () {
          var a = this.part;
          return null !== a ? a.layer : null;
        },
      },
      diagram: {
        get: function () {
          var a = this.part;
          return null !== a ? a.diagram : null;
        },
      },
      position: {
        get: function () {
          return this.ma;
        },
        set: function (a) {
          var b = a.x,
            c = a.y,
            d = this.ma,
            e = d.x,
            f = d.y;
          (e === b || (isNaN(e) && isNaN(b))) &&
          (f === c || (isNaN(f) && isNaN(c)))
            ? this.kw()
            : ((a = a.copy()), this.jw(a, d) && this.g('position', d.copy(), a));
        },
      },
      actualBounds: {
        get: function () {
          return this.vb;
        },
      },
      scale: {
        get: function () {
          return this.ya;
        },
        set: function (a) {
          var b = this.ya;
          b !== a &&
            (0 >= a &&
              B(
                'GraphObject.scale for ' +
                  this +
                  ' must be greater than zero, not: ' +
                  a,
              ),
            (this.ya = a),
            this.o(),
            this.g('scale', b, a));
        },
      },
      angle: {
        get: function () {
          return this.Zb;
        },
        set: function (a) {
          var b = this.Zb;
          b !== a &&
            ((a %= 360),
            0 > a && (a += 360),
            b !== a &&
              ((this.Zb = a), Gl(this), this.o(), this.g('angle', b, a)));
        },
      },
      desiredSize: {
        get: function () {
          return this.Jc;
        },
        set: function (a) {
          var b = a.width,
            c = a.height,
            d = this.Jc,
            e = d.width,
            f = d.height;
          ((e === b || (isNaN(e) && isNaN(b))) &&
            (f === c || (isNaN(f) && isNaN(c)))) ||
            ((this.Jc = a = a.G()),
            this.o(),
            this instanceof W && this.cc(),
            this.g('desiredSize', d, a),
            dl(this) &&
              ((a = this.part),
              null !== a && (el(this, a, 'width'), el(this, a, 'height'))));
        },
      },
      width: {
        get: function () {
          return this.Jc.width;
        },
        set: function (a) {
          var b = this.Jc.width;
          b === a ||
            (isNaN(b) && isNaN(a)) ||
            ((b = this.Jc),
            (this.Jc = a = new L(a, this.Jc.height).freeze()),
            this.o(),
            this instanceof W && this.cc(),
            this.g('desiredSize', b, a),
            dl(this) && ((a = this.part), null !== a && el(this, a, 'width')));
        },
      },
      height: {
        get: function () {
          return this.Jc.height;
        },
        set: function (a) {
          var b = this.Jc.height;
          b === a ||
            (isNaN(b) && isNaN(a)) ||
            ((b = this.Jc),
            (this.Jc = a = new L(this.Jc.width, a).freeze()),
            this.o(),
            this instanceof W && this.cc(),
            this.g('desiredSize', b, a),
            dl(this) && ((a = this.part), null !== a && el(this, a, 'height')));
        },
      },
      minSize: {
        get: function () {
          return this.dg;
        },
        set: function (a) {
          var b = this.dg;
          b.A(a) ||
            ((a = a.copy()),
            isNaN(a.width) && (a.width = 0),
            isNaN(a.height) && (a.height = 0),
            a.freeze(),
            (this.dg = a),
            this.o(),
            this.g('minSize', b, a));
        },
      },
      maxSize: {
        get: function () {
          return this.cg;
        },
        set: function (a) {
          var b = this.cg;
          b.A(a) ||
            ((a = a.copy()),
            isNaN(a.width) && (a.width = Infinity),
            isNaN(a.height) && (a.height = Infinity),
            a.freeze(),
            (this.cg = a),
            this.o(),
            this.g('maxSize', b, a));
        },
      },
      measuredBounds: {
        get: function () {
          return this.oc;
        },
      },
      naturalBounds: {
        get: function () {
          return this.pc;
        },
      },
      margin: {
        get: function () {
          return this.gh;
        },
        set: function (a) {
          'number' === typeof a && (a = new oc(a));
          var b = this.gh;
          b.A(a) || ((this.gh = a = a.G()), this.o(), this.g('margin', b, a));
        },
      },
      transform: {
        get: function () {
          (0 !== (this.F & 2048)) === !0 && pl(this);
          return this.lb;
        },
      },
      sd: {
        get: function () {
          (0 !== (this.F & 4096)) === !0 && pl(this);
          return this.Rh;
        },
      },
      alignment: {
        get: function () {
          return this.wb;
        },
        set: function (a) {
          var b = this.wb;
          b.A(a) ||
            (a.kc() &&
              !a.Nb() &&
              B(
                'GraphObject.alignment for ' +
                  this +
                  ' must be a real Spot or Spot.Default, not: ' +
                  a,
              ),
            (this.wb = a = a.G()),
            Bl(this),
            this.g('alignment', b, a));
        },
      },
      column: {
        get: function () {
          return this.Og;
        },
        set: function (a) {
          a = Math.round(a);
          var b = this.Og;
          b !== a &&
            (0 > a && va(a, '>= 0', Y, 'column'),
            (this.Og = a),
            this.o(),
            this.g('column', b, a));
        },
      },
      columnSpan: {
        get: function () {
          return this.gn;
        },
        set: function (a) {
          a = Math.round(a);
          var b = this.gn;
          b !== a &&
            (1 > a && va(a, '>= 1', Y, 'columnSpan'),
            (this.gn = a),
            this.o(),
            this.g('columnSpan', b, a));
        },
      },
      row: {
        get: function () {
          return this.op;
        },
        set: function (a) {
          a = Math.round(a);
          var b = this.op;
          b !== a &&
            (0 > a && va(a, '>= 0', Y, 'row'),
            (this.op = a),
            this.o(),
            this.g('row', b, a));
        },
      },
      rowSpan: {
        get: function () {
          return this.pp;
        },
        set: function (a) {
          a = Math.round(a);
          var b = this.pp;
          b !== a &&
            (1 > a && va(a, '>= 1', Y, 'rowSpan'),
            (this.pp = a),
            this.o(),
            this.g('rowSpan', b, a));
        },
      },
      spanAllocation: {
        get: function () {
          return this.Jp;
        },
        set: function (a) {
          var b = this.Jp;
          b !== a && ((this.Jp = a), this.o(), this.g('spanAllocation', b, a));
        },
      },
      alignmentFocus: {
        get: function () {
          return this.Gk;
        },
        set: function (a) {
          var b = this.Gk;
          b.A(a) ||
            ((this.Gk = a = a.G()), this.o(), this.g('alignmentFocus', b, a));
        },
      },
      portId: {
        get: function () {
          return this.bp;
        },
        set: function (a) {
          var b = this.bp;
          if (b !== a) {
            var c = this.part;
            null === c ||
              c instanceof U ||
              (B('Cannot set portID on a Link: ' + a), (c = null));
            null !== b && null !== c && Rl(c, this);
            this.bp = a;
            null !== a && null !== c && ((c.Jh = !0), Sl(c, this));
            this.g('portId', b, a);
          }
        },
      },
      toSpot: {
        get: function () {
          return null !== this.O ? this.O.zh : uc;
        },
        set: function (a) {
          this.Dc();
          var b = this.O.zh;
          b.A(a) ||
            ((a = a.G()), (this.O.zh = a), this.g('toSpot', b, a), Fl(this));
        },
      },
      toEndSegmentLength: {
        get: function () {
          return null !== this.O ? this.O.xh : 10;
        },
        set: function (a) {
          this.Dc();
          var b = this.O.xh;
          b !== a &&
            (0 > a && va(a, '>= 0', Y, 'toEndSegmentLength'),
            (this.O.xh = a),
            this.g('toEndSegmentLength', b, a),
            Fl(this));
        },
      },
      toShortLength: {
        get: function () {
          return null !== this.O ? this.O.yh : 0;
        },
        set: function (a) {
          this.Dc();
          var b = this.O.yh;
          b !== a && ((this.O.yh = a), this.g('toShortLength', b, a), Fl(this));
        },
      },
      toLinkable: {
        get: function () {
          return null !== this.O ? this.O.Sp : null;
        },
        set: function (a) {
          this.Dc();
          var b = this.O.Sp;
          b !== a && ((this.O.Sp = a), this.g('toLinkable', b, a));
        },
      },
      toMaxLinks: {
        get: function () {
          return null !== this.O ? this.O.Tp : Infinity;
        },
        set: function (a) {
          this.Dc();
          var b = this.O.Tp;
          b !== a &&
            (0 > a && va(a, '>= 0', Y, 'toMaxLinks'),
            (this.O.Tp = a),
            this.g('toMaxLinks', b, a));
        },
      },
      fromSpot: {
        get: function () {
          return null !== this.O ? this.O.Yg : uc;
        },
        set: function (a) {
          this.Dc();
          var b = this.O.Yg;
          b.A(a) ||
            ((a = a.G()), (this.O.Yg = a), this.g('fromSpot', b, a), Fl(this));
        },
      },
      fromEndSegmentLength: {
        get: function () {
          return null !== this.O ? this.O.Wg : 10;
        },
        set: function (a) {
          this.Dc();
          var b = this.O.Wg;
          b !== a &&
            (0 > a && va(a, '>= 0', Y, 'fromEndSegmentLength'),
            (this.O.Wg = a),
            this.g('fromEndSegmentLength', b, a),
            Fl(this));
        },
      },
      fromShortLength: {
        get: function () {
          return null !== this.O ? this.O.Xg : 0;
        },
        set: function (a) {
          this.Dc();
          var b = this.O.Xg;
          b !== a && ((this.O.Xg = a), this.g('fromShortLength', b, a), Fl(this));
        },
      },
      fromLinkable: {
        get: function () {
          return null !== this.O ? this.O.Kn : null;
        },
        set: function (a) {
          this.Dc();
          var b = this.O.Kn;
          b !== a && ((this.O.Kn = a), this.g('fromLinkable', b, a));
        },
      },
      fromMaxLinks: {
        get: function () {
          return null !== this.O ? this.O.Ln : Infinity;
        },
        set: function (a) {
          this.Dc();
          var b = this.O.Ln;
          b !== a &&
            (0 > a && va(a, '>= 0', Y, 'fromMaxLinks'),
            (this.O.Ln = a),
            this.g('fromMaxLinks', b, a));
        },
      },
      cursor: {
        get: function () {
          return this.gi;
        },
        set: function (a) {
          var b = this.gi;
          b !== a && ((this.gi = a), this.g('cursor', b, a));
        },
      },
      click: {
        get: function () {
          return null !== this.M ? this.M.Mf : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.Mf;
          b !== a && ((this.M.Mf = a), this.g('click', b, a));
        },
      },
      doubleClick: {
        get: function () {
          return null !== this.M ? this.M.Rf : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.Rf;
          b !== a && ((this.M.Rf = a), this.g('doubleClick', b, a));
        },
      },
      contextClick: {
        get: function () {
          return null !== this.M ? this.M.Nf : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.Nf;
          b !== a && ((this.M.Nf = a), this.g('contextClick', b, a));
        },
      },
      mouseEnter: {
        get: function () {
          return null !== this.M ? this.M.fg : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.fg;
          b !== a && ((this.M.fg = a), this.g('mouseEnter', b, a));
        },
      },
      mouseLeave: {
        get: function () {
          return null !== this.M ? this.M.ig : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.ig;
          b !== a && ((this.M.ig = a), this.g('mouseLeave', b, a));
        },
      },
      mouseOver: {
        get: function () {
          return null !== this.M ? this.M.jg : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.jg;
          b !== a && ((this.M.jg = a), this.g('mouseOver', b, a));
        },
      },
      mouseHover: {
        get: function () {
          return null !== this.M ? this.M.hg : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.hg;
          b !== a && ((this.M.hg = a), this.g('mouseHover', b, a));
        },
      },
      mouseHold: {
        get: function () {
          return null !== this.M ? this.M.gg : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.gg;
          b !== a && ((this.M.gg = a), this.g('mouseHold', b, a));
        },
      },
      mouseDragEnter: {
        get: function () {
          return null !== this.M ? this.M.Eo : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.Eo;
          b !== a && ((this.M.Eo = a), this.g('mouseDragEnter', b, a));
        },
      },
      mouseDragLeave: {
        get: function () {
          return null !== this.M ? this.M.Fo : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.Fo;
          b !== a && ((this.M.Fo = a), this.g('mouseDragLeave', b, a));
        },
      },
      mouseDrop: {
        get: function () {
          return null !== this.M ? this.M.eg : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.eg;
          b !== a && ((this.M.eg = a), this.g('mouseDrop', b, a));
        },
      },
      actionDown: {
        get: function () {
          return null !== this.M ? this.M.Qm : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.Qm;
          b !== a && ((this.M.Qm = a), this.g('actionDown', b, a));
        },
      },
      actionMove: {
        get: function () {
          return null !== this.M ? this.M.Rm : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.Rm;
          b !== a && ((this.M.Rm = a), this.g('actionMove', b, a));
        },
      },
      actionUp: {
        get: function () {
          return null !== this.M ? this.M.Sm : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.Sm;
          b !== a && ((this.M.Sm = a), this.g('actionUp', b, a));
        },
      },
      actionCancel: {
        get: function () {
          return null !== this.M ? this.M.Pm : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.Pm;
          b !== a && ((this.M.Pm = a), this.g('actionCancel', b, a));
        },
      },
      toolTip: {
        get: function () {
          return null !== this.M ? this.M.ug : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.ug;
          b !== a && ((this.M.ug = a), this.g('toolTip', b, a));
        },
      },
      contextMenu: {
        get: function () {
          return null !== this.M ? this.M.Of : null;
        },
        set: function (a) {
          al(this);
          var b = this.M.Of;
          b !== a && ((this.M.Of = a), this.g('contextMenu', b, a));
        },
      },
    });
    Y.prototype.setProperties = Y.prototype.lw;
    Y.prototype.findTemplateBinder = Y.prototype.Ti;
    Y.prototype.bind = Y.prototype.bind;
    Y.prototype.isEnabledObject = Y.prototype.Eg;
    Y.prototype.isVisibleObject = Y.prototype.yf;
    Y.prototype.isContainedBy = Y.prototype.Dg;
    Y.prototype.getNearestIntersectionPoint = Y.prototype.Sc;
    Y.prototype.getLocalPoint = Y.prototype.nt;
    Y.prototype.getDocumentScale = Y.prototype.tf;
    Y.prototype.getDocumentAngle = Y.prototype.Wi;
    Y.prototype.getDocumentBounds = Y.prototype.nq;
    Y.prototype.getDocumentPoint = Y.prototype.ga;
    Y.prototype.intersectsRect = Y.prototype.Fc;
    Y.prototype.containedInRect = Y.prototype.Hh;
    Y.prototype.containsRect = Y.prototype.qf;
    Y.prototype.containsPoint = Y.prototype.aa;
    Y.prototype.raiseChanged = Y.prototype.g;
    Y.prototype.raiseChangedEvent = Y.prototype.Ya;
    Y.prototype.addCopyProperty = Y.prototype.ux;
    var Kl = null;
    Y.className = 'GraphObject';
    Kl = new G();
    Ol('Button', function () {
      function a(a, b) {
        return (
          null !==
          a.diagram.Tb(
            a.documentPoint,
            function (a) {
              for (; null !== a.panel && !a.isActionable; ) a = a.panel;
              return a;
            },
            function (a) {
              return a === b;
            },
          )
        );
      }
      var b = Jl(
        X,
        X.Auto,
        {
          isActionable: !0,
          enabledChanged: function (a, b) {
            if (a instanceof X) {
              var c = a.Xa('ButtonBorder');
              null !== c &&
                (c.fill = b ? a._buttonFillNormal : a._buttonFillDisabled);
            }
          },
          cursor: 'pointer',
          _buttonFillNormal: '#F5F5F5',
          _buttonStrokeNormal: '#BDBDBD',
          _buttonFillOver: '#E0E0E0',
          _buttonStrokeOver: '#9E9E9E',
          _buttonFillPressed: '#BDBDBD',
          _buttonStrokePressed: '#9E9E9E',
          _buttonFillDisabled: '#E5E5E5',
        },
        Jl(W, {
          name: 'ButtonBorder',
          figure: 'RoundedRectangle',
          spot1: new O(0, 0, 2.76142374915397, 2.761423749153969),
          spot2: new O(1, 1, -2.76142374915397, -2.761423749153969),
          parameter1: 2,
          parameter2: 2,
          fill: '#F5F5F5',
          stroke: '#BDBDBD',
        }),
      );
      b.mouseEnter = function (a, b) {
        if (
          b.Eg() &&
          b instanceof X &&
          ((a = b.Xa('ButtonBorder')), a instanceof W)
        ) {
          var c = b._buttonFillOver;
          b._buttonFillNormal = a.fill;
          a.fill = c;
          c = b._buttonStrokeOver;
          b._buttonStrokeNormal = a.stroke;
          a.stroke = c;
        }
      };
      b.mouseLeave = function (a, b) {
        b.Eg() &&
          b instanceof X &&
          ((a = b.Xa('ButtonBorder')),
          a instanceof W &&
            ((a.fill = b._buttonFillNormal), (a.stroke = b._buttonStrokeNormal)));
      };
      b.actionDown = function (a, b) {
        if (
          b.Eg() &&
          b instanceof X &&
          null !== b._buttonFillPressed &&
          0 === a.button
        ) {
          var c = b.Xa('ButtonBorder');
          if (c instanceof W) {
            a = a.diagram;
            var d = a.skipsUndoManager;
            a.skipsUndoManager = !0;
            var g = b._buttonFillPressed;
            b._buttonFillOver = c.fill;
            c.fill = g;
            g = b._buttonStrokePressed;
            b._buttonStrokeOver = c.stroke;
            c.stroke = g;
            a.skipsUndoManager = d;
          }
        }
      };
      b.actionUp = function (b, d) {
        if (
          d.Eg() &&
          d instanceof X &&
          null !== d._buttonFillPressed &&
          0 === b.button
        ) {
          var c = d.Xa('ButtonBorder');
          if (c instanceof W) {
            var f = b.diagram,
              g = f.skipsUndoManager;
            f.skipsUndoManager = !0;
            a(b, d)
              ? ((c.fill = d._buttonFillOver), (c.stroke = d._buttonStrokeOver))
              : ((c.fill = d._buttonFillNormal),
                (c.stroke = d._buttonStrokeNormal));
            f.skipsUndoManager = g;
          }
        }
      };
      b.actionCancel = function (b, d) {
        if (d.Eg() && d instanceof X && null !== d._buttonFillPressed) {
          var c = d.Xa('ButtonBorder');
          if (c instanceof W) {
            var f = b.diagram,
              g = f.skipsUndoManager;
            f.skipsUndoManager = !0;
            a(b, d)
              ? ((c.fill = d._buttonFillOver), (c.stroke = d._buttonStrokeOver))
              : ((c.fill = d._buttonFillNormal),
                (c.stroke = d._buttonStrokeNormal));
            f.skipsUndoManager = g;
          }
        }
      };
      b.actionMove = function (b, d) {
        if (d.Eg() && d instanceof X && null !== d._buttonFillPressed) {
          var c = b.diagram;
          if (
            0 === c.firstInput.button &&
            (c.currentTool.standardMouseOver(),
            a(b, d) && ((b = d.Xa('ButtonBorder')), b instanceof W))
          ) {
            var f = c.skipsUndoManager;
            c.skipsUndoManager = !0;
            var g = d._buttonFillPressed;
            b.fill !== g && (b.fill = g);
            g = d._buttonStrokePressed;
            b.stroke !== g && (b.stroke = g);
            c.skipsUndoManager = f;
          }
        }
      };
      return b;
    });
    Ol('TreeExpanderButton', function () {
      var a = Jl(
        'Button',
        { _treeExpandedFigure: 'MinusLine', _treeCollapsedFigure: 'PlusLine' },
        Jl(
          W,
          {
            name: 'ButtonIcon',
            figure: 'MinusLine',
            stroke: '#424242',
            strokeWidth: 2,
            desiredSize: Nb,
          },
          new Ki('figure', 'isTreeExpanded', function (a, c) {
            c = c.panel;
            return a ? c._treeExpandedFigure : c._treeCollapsedFigure;
          }).zq(),
        ),
        { visible: !1 },
        new Ki('visible', 'isTreeLeaf', function (a) {
          return !a;
        }).zq(),
      );
      a.click = function (a, c) {
        c = c.part;
        c instanceof Ce && (c = c.adornedPart);
        if (c instanceof U) {
          var b = c.diagram;
          if (null !== b) {
            b = b.commandHandler;
            if (c.isTreeExpanded) {
              if (!b.canCollapseTree(c)) return;
            } else if (!b.canExpandTree(c)) return;
            a.handled = !0;
            c.isTreeExpanded ? b.collapseTree(c) : b.expandTree(c);
          }
        }
      };
      return a;
    });
    Ol('SubGraphExpanderButton', function () {
      var a = Jl(
        'Button',
        {
          _subGraphExpandedFigure: 'MinusLine',
          _subGraphCollapsedFigure: 'PlusLine',
        },
        Jl(
          W,
          {
            name: 'ButtonIcon',
            figure: 'MinusLine',
            stroke: '#424242',
            strokeWidth: 2,
            desiredSize: Nb,
          },
          new Ki('figure', 'isSubGraphExpanded', function (a, c) {
            c = c.panel;
            return a ? c._subGraphExpandedFigure : c._subGraphCollapsedFigure;
          }).zq(),
        ),
      );
      a.click = function (a, c) {
        c = c.part;
        c instanceof Ce && (c = c.adornedPart);
        if (c instanceof xf) {
          var b = c.diagram;
          if (null !== b) {
            b = b.commandHandler;
            if (c.isSubGraphExpanded) {
              if (!b.canCollapseSubGraph(c)) return;
            } else if (!b.canExpandSubGraph(c)) return;
            a.handled = !0;
            c.isSubGraphExpanded ? b.collapseSubGraph(c) : b.expandSubGraph(c);
          }
        }
      };
      return a;
    });
    Ol('ToolTip', function () {
      return Jl(
        Ce,
        X.Auto,
        {
          isShadowed: !0,
          shadowColor: 'rgba(0, 0, 0, .4)',
          shadowOffset: new H(0, 3),
          shadowBlur: 5,
        },
        Jl(W, {
          name: 'Border',
          figure: 'RoundedRectangle',
          parameter1: 1,
          parameter2: 1,
          fill: '#F5F5F5',
          stroke: '#F0F0F0',
          spot1: new O(0, 0, 4, 6),
          spot2: new O(1, 1, -4, -4),
        }),
      );
    });
    Ol('ContextMenu', function () {
      return Jl(
        Ce,
        X.Vertical,
        {
          background: '#F5F5F5',
          isShadowed: !0,
          shadowColor: 'rgba(0, 0, 0, .4)',
          shadowOffset: new H(0, 3),
          shadowBlur: 5,
        },
        new Ki('background', '', function (a) {
          return null !== a.adornedPart && null !== a.placeholder
            ? null
            : '#F5F5F5';
        }),
      );
    });
    Ol('ContextMenuButton', function () {
      var a = Jl('Button');
      a.stretch = Vk;
      var b = a.Xa('ButtonBorder');
      b instanceof W &&
        ((b.figure = 'Rectangle'),
        (b.strokeWidth = 0),
        (b.spot1 = new O(0, 0, 2, 3)),
        (b.spot2 = new O(1, 1, -2, -2)));
      return a;
    });
    Ol('PanelExpanderButton', function (a) {
      var b = Pl(a, 'COLLAPSIBLE'),
        c = Jl(
          'Button',
          {
            _buttonExpandedFigure: 'M0 0 M0 6 L4 2 8 6 M8 8',
            _buttonCollapsedFigure: 'M0 0 M0 2 L4 6 8 2 M8 8',
            _buttonFillNormal: 'rgba(0, 0, 0, 0)',
            _buttonStrokeNormal: null,
            _buttonFillOver: 'rgba(0, 0, 0, .2)',
            _buttonStrokeOver: null,
            _buttonFillPressed: 'rgba(0, 0, 0, .4)',
            _buttonStrokePressed: null,
          },
          Jl(
            W,
            { name: 'ButtonIcon', strokeWidth: 2 },
            new Ki('geometryString', 'visible', function (a) {
              return a ? c._buttonExpandedFigure : c._buttonCollapsedFigure;
            }).zq(b),
          ),
        );
      a = c.Xa('ButtonBorder');
      a instanceof W && ((a.stroke = null), (a.fill = 'rgba(0, 0, 0, 0)'));
      c.click = function (a, c) {
        var d = c.diagram;
        if (null !== d && !d.isReadOnly) {
          var e = c.Ti();
          null === e && (e = c.part);
          null !== e &&
            ((c = e.Xa(b)),
            null !== c &&
              ((a.handled = !0),
              d.ta('Collapse/Expand Panel'),
              (c.visible = !c.visible),
              d.Ua('Collapse/Expand Panel')));
        }
      };
      return c;
    });
    Ol('CheckBoxButton', function (a) {
      var b = Pl(a);
      a = Jl(
        'Button',
        { desiredSize: new L(14, 14) },
        Jl(
          W,
          {
            name: 'ButtonIcon',
            geometryString: 'M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2',
            strokeWidth: 2,
            stretch: vd,
            geometryStretch: Cg,
            visible: !1,
          },
          '' !== b ? new Ki('visible', b).Wx() : [],
        ),
      );
      a.click = function (a, d) {
        if (d instanceof X) {
          var c = a.diagram;
          if (!(null === c || c.isReadOnly || ('' !== b && c.model.isReadOnly))) {
            a.handled = !0;
            var f = d.Xa('ButtonIcon');
            c.ta('checkbox');
            f.visible = !f.visible;
            'function' === typeof d._doClick && d._doClick(a, d);
            c.Ua('checkbox');
          }
        }
      };
      return a;
    });
    Ol('CheckBox', function (a) {
      a = Pl(a);
      a = Jl('CheckBoxButton', a, {
        name: 'Button',
        isActionable: !1,
        margin: new oc(0, 1, 0, 0),
      });
      var b = Jl(X, 'Horizontal', a, {
        isActionable: !0,
        cursor: a.cursor,
        margin: 1,
        _buttonFillNormal: a._buttonFillNormal,
        _buttonStrokeNormal: a._buttonStrokeNormal,
        _buttonFillOver: a._buttonFillOver,
        _buttonStrokeOver: a._buttonStrokeOver,
        _buttonFillPressed: a._buttonFillPressed,
        _buttonStrokePressed: a._buttonStrokePressed,
        _buttonFillDisabled: a._buttonFillDisabled,
        mouseEnter: a.mouseEnter,
        mouseLeave: a.mouseLeave,
        actionDown: a.actionDown,
        actionUp: a.actionUp,
        actionCancel: a.actionCancel,
        actionMove: a.actionMove,
        click: a.click,
        _buttonClick: a.click,
      });
      a.mouseEnter = null;
      a.mouseLeave = null;
      a.actionDown = null;
      a.actionUp = null;
      a.actionCancel = null;
      a.actionMove = null;
      a.click = null;
      return b;
    });
    Y.None = Ag = new D(Y, 'None', 0);
    Y.Default = Uk = new D(Y, 'Default', 0);
    Y.Vertical = Wk = new D(Y, 'Vertical', 4);
    Y.Horizontal = Vk = new D(Y, 'Horizontal', 5);
    Y.Fill = vd = new D(Y, 'Fill', 3);
    Y.Uniform = Cg = new D(Y, 'Uniform', 1);
    Y.UniformToFill = Xk = new D(Y, 'UniformToFill', 2);
    Y.FlipVertical = Yk = new D(Y, 'FlipVertical', 1);
    Y.FlipHorizontal = Zk = new D(Y, 'FlipHorizontal', 2);
    Y.FlipBoth = $k = new D(Y, 'FlipBoth', 3);
    Y.make = Jl;
    Y.getBuilders = function () {
      var a = new G(),
        b;
      for (b in Kl)
        if (b !== b.toLowerCase()) {
          var c = Kl.H(b);
          'function' === typeof c && a.add(b, c);
        }
      a.freeze();
      return a;
    };
    Y.defineBuilder = Ol;
    Y.takeBuilderArgument = Pl;
    function bl() {
      this.En =
        this.Of =
        this.ug =
        this.Pm =
        this.Sm =
        this.Rm =
        this.Qm =
        this.eg =
        this.Fo =
        this.Eo =
        this.gg =
        this.hg =
        this.jg =
        this.ig =
        this.fg =
        this.Nf =
        this.Rf =
        this.Mf =
          null;
    }
    bl.prototype.copy = function () {
      var a = new bl();
      a.Mf = this.Mf;
      a.Rf = this.Rf;
      a.Nf = this.Nf;
      a.fg = this.fg;
      a.ig = this.ig;
      a.jg = this.jg;
      a.hg = this.hg;
      a.gg = this.gg;
      a.Eo = this.Eo;
      a.Fo = this.Fo;
      a.eg = this.eg;
      a.Qm = this.Qm;
      a.Rm = this.Rm;
      a.Sm = this.Sm;
      a.Pm = this.Pm;
      a.ug = this.ug;
      a.Of = this.Of;
      a.En = this.En;
      return a;
    };
    bl.className = 'GraphObjectEventHandlers';
    function Tl() {
      this.Ka = [1, 0, 0, 1, 0, 0];
    }
    Tl.prototype.copy = function () {
      var a = new Tl();
      a.Ka[0] = this.Ka[0];
      a.Ka[1] = this.Ka[1];
      a.Ka[2] = this.Ka[2];
      a.Ka[3] = this.Ka[3];
      a.Ka[4] = this.Ka[4];
      a.Ka[5] = this.Ka[5];
      return a;
    };
    Tl.prototype.translate = function (a, b) {
      this.Ka[4] += this.Ka[0] * a + this.Ka[2] * b;
      this.Ka[5] += this.Ka[1] * a + this.Ka[3] * b;
    };
    Tl.prototype.scale = function (a, b) {
      this.Ka[0] *= a;
      this.Ka[1] *= a;
      this.Ka[2] *= b;
      this.Ka[3] *= b;
    };
    Tl.className = 'STransform';
    function Ul(a) {
      this.type = a;
      this.r2 = this.y2 = this.x2 = this.r1 = this.y1 = this.x1 = 0;
      this.Cx = [];
      this.pattern = null;
    }
    Ul.prototype.addColorStop = function (a, b) {
      this.Cx.push({ offset: a, color: b });
    };
    Ul.className = 'SGradient';
    function Bj(a, b) {
      this.ownerDocument = a = void 0 === b ? x.document : b;
      this.jA = 'http://www.w3.org/2000/svg';
      void 0 !== a &&
        ((this.Da = this.ub('svg', {
          width: '1px',
          height: '1px',
          viewBox: '0 0 1 1',
        })),
        this.Da.setAttributeNS(
          'http://www.w3.org/2000/xmlns/',
          'xmlns',
          'http://www.w3.org/2000/svg',
        ),
        this.Da.setAttributeNS(
          'http://www.w3.org/2000/xmlns/',
          'xmlns:xlink',
          'http://www.w3.org/1999/xlink',
        ));
      this.iq = null;
      this.context = new Vl(this);
    }
    Bj.prototype.resize = function (a, b, c, d) {
      return this.width !== a || this.height !== b
        ? ((this.style.width = c + 'px'),
          (this.style.height = d + 'px'),
          this.Da.setAttributeNS(null, 'width', c + 'px'),
          this.Da.setAttributeNS(null, 'height', d + 'px'),
          this.Da.setAttributeNS(null, 'viewBox', '0 0 ' + c + ' ' + d),
          this.context.Cu.firstElementChild.setAttributeNS(
            null,
            'width',
            c + 'px',
          ),
          this.context.Cu.firstElementChild.setAttributeNS(
            null,
            'height',
            d + 'px',
          ),
          !0)
        : !1;
    };
    Bj.prototype.ub = function (a, b, c) {
      a = this.ownerDocument.createElementNS(this.jA, a);
      if (za(b))
        for (var d in b)
          a.setAttributeNS(
            'href' === d ? 'http://www.w3.org/1999/xlink' : '',
            d,
            b[d],
          );
      void 0 !== c && (a.textContent = c);
      return a;
    };
    Bj.prototype.getBoundingClientRect = function () {
      return this.Da.getBoundingClientRect();
    };
    Bj.prototype.focus = function () {
      this.Da.focus();
    };
    Bj.prototype.Ix = function () {
      this.ownerDocument = null;
    };
    ma.Object.defineProperties(Bj.prototype, {
      width: {
        get: function () {
          return this.Da.width.baseVal.value;
        },
        set: function (a) {
          this.Da.width = a;
        },
      },
      height: {
        get: function () {
          return this.Da.height.baseVal.value;
        },
        set: function (a) {
          this.Da.height = a;
        },
      },
      style: {
        get: function () {
          return this.Da.style;
        },
      },
    });
    Bj.className = 'SVGSurface';
    function Vl(a) {
      this.zk = a;
      this.svg = a.Da;
      this.stack = [];
      this.wc = [];
      this.fillStyle = '#000000';
      this.font = '10px sans-serif';
      this.globalAlpha = 1;
      this.lineCap = 'butt';
      this.lineDashOffset = 0;
      this.lineJoin = 'miter';
      this.lineWidth = 1;
      this.miterLimit = 10;
      this.shadowBlur = 0;
      this.shadowColor = 'rgba(0, 0, 0, 0)';
      this.shadowOffsetY = this.shadowOffsetX = 0;
      this.strokeStyle = '#000000';
      this.textAlign = 'start';
      this.clipInsteadOfFill = !1;
      this.bf = this.Fp = this.Ep = 0;
      this.tq = null;
      this.path = [];
      this.vu = !1;
      this.sh = null;
      this.th = 0;
      this.Ud = new Tl();
      Wl(this, 1, 0, 0, 1, 0, 0);
      var b = qb++,
        c = this.ub('clipPath', { id: 'mainClip' + b });
      c.appendChild(
        this.ub('rect', { x: 0, y: 0, width: a.width, height: a.height }),
      );
      this.Cu = c;
      this.zk.Da.appendChild(c);
      this.wc[0].setAttributeNS(null, 'clip-path', 'url(#mainClip' + b + ')');
      this.lA = {};
    }
    t = Vl.prototype;
    t.reset = function () {
      this.stack = [];
      this.wc = [];
      this.fillStyle = '#000000';
      this.font = '10px sans-serif';
      this.globalAlpha = 1;
      this.lineCap = 'butt';
      this.lineDashOffset = 0;
      this.lineJoin = 'miter';
      this.lineWidth = 1;
      this.miterLimit = 10;
      this.shadowBlur = 0;
      this.shadowColor = 'rgba(0, 0, 0, 0)';
      this.shadowOffsetY = this.shadowOffsetX = 0;
      this.strokeStyle = '#000000';
      this.textAlign = 'start';
      this.clipInsteadOfFill = !1;
      this.bf = this.Fp = this.Ep = 0;
      this.tq = null;
      this.path = [];
      this.Ud = new Tl();
      Wl(this, 1, 0, 0, 1, 0, 0);
      var a = qb++,
        b = this.ub('clipPath', { id: 'mainClip' + a });
      b.appendChild(
        this.ub('rect', {
          x: 0,
          y: 0,
          width: this.zk.width,
          height: this.zk.height,
        }),
      );
      this.Cu = b;
      this.zk.Da.appendChild(b);
      this.wc[0].setAttributeNS(null, 'clip-path', 'url(#mainClip' + a + ')');
    };
    t.arc = function (a, b, c, d, e, f, g, h) {
      var k = 2 * Math.PI,
        l = k - 1e-6,
        m = c * Math.cos(d),
        n = c * Math.sin(d),
        p = a + m,
        r = b + n,
        q = f ? 0 : 1;
      d = f ? d - e : e - d;
      (1e-6 < Math.abs(g - p) || 1e-6 < Math.abs(h - r)) &&
        this.path.push(['L', p, +r]);
      0 > d && (d = (d % k) + k);
      d > l
        ? (this.path.push(['A', c, c, 0, 1, q, a - m, b - n]),
          this.path.push(['A', c, c, 0, 1, q, p, r]))
        : 1e-6 < d &&
          this.path.push([
            'A',
            c,
            c,
            0,
            +(d >= Math.PI),
            q,
            a + c * Math.cos(e),
            b + c * Math.sin(e),
          ]);
    };
    t.beginPath = function () {
      this.path = [];
    };
    t.bezierCurveTo = function (a, b, c, d, e, f) {
      this.path.push(['C', a, b, c, d, e, f]);
    };
    t.clearRect = function () {};
    t.clip = function () {
      this.addPath('clipPath', this.path, this.Ud);
      this.addPath('clipPath', this.path, new Tl());
    };
    t.closePath = function () {
      this.path.push(['z']);
    };
    t.createLinearGradient = function (a, b, c, d) {
      var e = new Ul('linear');
      e.x1 = a;
      e.y1 = b;
      e.x2 = c;
      e.y2 = d;
      return e;
    };
    t.createPattern = function (a) {
      var b = '';
      a instanceof HTMLCanvasElement && (b = a.toDataURL());
      a instanceof HTMLImageElement && (b = a.getAttribute('src'));
      var c = this.lA;
      if (c[b]) return 'url(#' + c[b] + ')';
      var d = 'PATTERN' + qb++,
        e = { x: 0, y: 0, width: a.width, height: a.height, href: b };
      a = this.ub('pattern', {
        width: a.width,
        height: a.height,
        id: d,
        patternUnits: 'userSpaceOnUse',
      });
      a.appendChild(this.ub('image', e));
      this.svg.appendChild(a);
      c[b] = d;
      return 'url(#' + d + ')';
    };
    t.createRadialGradient = function (a, b, c, d, e, f) {
      var g = new Ul('radial');
      g.x1 = a;
      g.y1 = b;
      g.r1 = c;
      g.x2 = d;
      g.y2 = e;
      g.r2 = f;
      return g;
    };
    t.drawImage = function (a, b, c, d, e, f, g, h, k) {
      var l = '';
      a instanceof HTMLCanvasElement && (l = a.toDataURL());
      a instanceof HTMLImageElement && (l = a.getAttribute('src'));
      var m = a instanceof HTMLImageElement ? a.naturalWidth : a.width,
        n = a instanceof HTMLImageElement ? a.naturalHeight : a.height;
      void 0 === d && ((f = b), (g = c), (h = d = m), (k = e = n));
      d = d || 0;
      e = e || 0;
      f = f || 0;
      g = g || 0;
      h = h || 0;
      k = k || 0;
      l = {
        x: 0,
        y: 0,
        width: m || d,
        height: n || e,
        href: l,
        preserveAspectRatio: 'xMidYMid slice',
      };
      (J.$(d, h) && J.$(e, k)) || (l.preserveAspectRatio = 'none');
      a = '';
      h /= d;
      k /= e;
      if (0 !== f || 0 !== g) a += ' translate(' + f + ', ' + g + ')';
      if (1 !== h || 1 !== k) a += ' scale(' + h + ', ' + k + ')';
      if (0 !== b || 0 !== c) a += ' translate(' + -b + ', ' + -c + ')';
      if (0 !== b || 0 !== c || d !== m || e !== n)
        (f = 'CLIP' + qb++),
          (g = this.ub('clipPath', { id: f })),
          g.appendChild(this.ub('rect', { x: b, y: c, width: d, height: e })),
          this.svg.appendChild(g),
          (l['clip-path'] = 'url(#' + f + ')');
      Xl(this, 'image', l, this.Ud, a);
      this.addElement('image', l);
    };
    t.fill = function () {
      this.addPath('fill', this.path, this.Ud);
    };
    t.Vd = function () {
      this.clipInsteadOfFill ? this.clip() : this.fill();
    };
    t.fillRect = function (a, b, c, d) {
      a = [a, b, c, d];
      a = { x: a[0], y: a[1], width: a[2], height: a[3] };
      Xl(this, 'fill', a, this.Ud);
      this.addElement('rect', a);
    };
    t.fillText = function (a, b, c) {
      a = [a, b, c];
      b = this.textAlign;
      'left' === b
        ? (b = 'start')
        : 'right' === b
        ? (b = 'end')
        : 'center' === b && (b = 'middle');
      b = { x: a[1], y: a[2], style: 'font: ' + this.font, 'text-anchor': b };
      Xl(this, 'fill', b, this.Ud);
      this.addElement('text', b, a[0]);
    };
    t.lineTo = function (a, b) {
      this.path.push(['L', a, b]);
    };
    t.moveTo = function (a, b) {
      this.path.push(['M', a, b]);
    };
    t.quadraticCurveTo = function (a, b, c, d) {
      this.path.push(['Q', a, b, c, d]);
    };
    t.rect = function (a, b, c, d) {
      this.path.push(
        ['M', a, b],
        ['L', a + c, b],
        ['L', a + c, b + d],
        ['L', a, b + d],
        ['z'],
      );
    };
    t.restore = function () {
      this.Ud = this.stack.pop();
      this.path = this.stack.pop();
      var a = this.stack.pop();
      this.fillStyle = a.fillStyle;
      this.font = a.font;
      this.globalAlpha = a.globalAlpha;
      this.lineCap = a.lineCap;
      this.lineDashOffset = a.lineDashOffset;
      this.lineJoin = a.lineJoin;
      this.lineWidth = a.lineWidth;
      this.miterLimit = a.miterLimit;
      this.shadowBlur = a.shadowBlur;
      this.shadowColor = a.shadowColor;
      this.shadowOffsetX = a.shadowOffsetX;
      this.shadowOffsetY = a.shadowOffsetY;
      this.strokeStyle = a.strokeStyle;
      this.textAlign = a.textAlign;
    };
    t.save = function () {
      this.stack.push({
        fillStyle: this.fillStyle,
        font: this.font,
        globalAlpha: this.globalAlpha,
        lineCap: this.lineCap,
        lineDashOffset: this.lineDashOffset,
        lineJoin: this.lineJoin,
        lineWidth: this.lineWidth,
        miterLimit: this.miterLimit,
        shadowBlur: this.shadowBlur,
        shadowColor: this.shadowColor,
        shadowOffsetX: this.shadowOffsetX,
        shadowOffsetY: this.shadowOffsetY,
        strokeStyle: this.strokeStyle,
        textAlign: this.textAlign,
      });
      for (var a = [], b = 0; b < this.path.length; b++) a.push(this.path[b]);
      this.stack.push(a);
      this.stack.push(this.Ud.copy());
    };
    t.setTransform = function (a, b, c, d, e, f) {
      (1 === a && 0 === b && 0 === c && 1 === d && 0 === e && 0 === f) ||
        Wl(this, a, b, c, d, e, f);
    };
    t.scale = function (a, b) {
      this.Ud.scale(a, b);
    };
    t.translate = function (a, b) {
      this.Ud.translate(a, b);
    };
    t.transform = function () {};
    t.stroke = function () {
      this.addPath('stroke', this.path, this.Ud);
    };
    t.ej = function () {
      this.clipInsteadOfFill || this.stroke();
    };
    t.ub = function (a, b, c) {
      return this.zk.ub(a, b, c);
    };
    t.addElement = function (a, b, c) {
      a = this.ub(a, b, c);
      0 < this.wc.length
        ? this.wc[this.wc.length - 1].appendChild(a)
        : this.svg.appendChild(a);
      return (this.tq = a);
    };
    function Xl(a, b, c, d, e) {
      1 !== a.globalAlpha && (c.opacity = a.globalAlpha);
      'fill' === b
        ? (a.fillStyle instanceof Ul
            ? (c.fill = Yl(a, a.fillStyle))
            : (/^rgba\(/.test(a.fillStyle) &&
                ((b =
                  /^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(
                    a.fillStyle,
                  )),
                (c.fill = 'rgb(' + b[1] + ',' + b[2] + ',' + b[3] + ')'),
                (c['fill-opacity'] = b[4])),
              (c.fill = a.fillStyle)),
          (c.stroke = 'none'))
        : 'stroke' === b &&
          ((c.fill = 'none'),
          a.strokeStyle instanceof Ul
            ? (c.stroke = Yl(a, a.strokeStyle))
            : (/^rgba\(/.test(a.strokeStyle) &&
                ((b =
                  /^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(
                    a.strokeStyle,
                  )),
                (c.stroke = 'rgb(' + b[1] + ',' + b[2] + ',' + b[3] + ')'),
                (c['stroke-opacity'] = b[4])),
              (c.stroke = a.strokeStyle)),
          (c['stroke-width'] = a.lineWidth),
          (c['stroke-linecap'] = a.lineCap),
          (c['stroke-linejoin'] = a.lineJoin),
          (c['stroke-miterlimit'] = a.miterLimit));
      a = d.Ka;
      a =
        'matrix(' +
        a[0] +
        ', ' +
        a[1] +
        ', ' +
        a[2] +
        ', ' +
        a[3] +
        ', ' +
        a[4] +
        ', ' +
        a[5] +
        ')';
      void 0 !== e && (a += e);
      c.transform = a;
    }
    function Yl(a, b) {
      var c = 'GRAD' + qb++;
      if ('linear' === b.type)
        var d = a.ub('linearGradient', {
          x1: b.x1,
          x2: b.x2,
          y1: b.y1,
          y2: b.y2,
          id: c,
          gradientUnits: 'userSpaceOnUse',
        });
      else if ('radial' === b.type)
        d = a.ub('radialGradient', {
          x1: b.x1,
          x2: b.x2,
          y1: b.y1,
          y2: b.y2,
          r1: b.r1,
          r2: b.r2,
          id: c,
        });
      else throw Error('invalid gradient');
      var e = b.Cx;
      b = e.length;
      for (var f = [], g = 0; g < b; g++) {
        var h = e[g],
          k = h.color;
        h = { offset: h.offset, 'stop-color': k };
        /^rgba\(/.test(k) &&
          ((k =
            /^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(
              k,
            )),
          (h['stop-color'] = 'rgb(' + k[1] + ',' + k[2] + ',' + k[3] + ')'),
          (h['stop-opacity'] = k[4]));
        f.push(h);
      }
      f.sort(function (a, b) {
        return a.offset > b.offset ? 1 : -1;
      });
      for (e = 0; e < b; e++) d.appendChild(a.ub('stop', f[e]));
      a.svg.appendChild(d);
      return 'url(#' + c + ')';
    }
    t.addPath = function (a, b, c) {
      for (var d = [], e = 0; e < b.length; e++) {
        var f = Ba(b[e]),
          g = [f.shift()];
        if ('A' === g[0])
          g.push(
            f.shift() + ',' + f.shift(),
            f.shift(),
            f.shift() + ',' + f.shift(),
            f.shift() + ',' + f.shift(),
          );
        else for (; f.length; ) g.push(f.shift() + ',' + f.shift());
        d.push(g.join(' '));
      }
      b = { d: d.join(' ') };
      'stroke' === a &&
        this.vu &&
        ((b['stroke-dasharray'] = this.sh.toString()),
        (b['stroke-dashoffset'] = this.th));
      Xl(this, a, b, c);
      'clipPath' === a
        ? ((a = 'CLIP' + qb++),
          (c = this.ub('clipPath', { id: a })),
          c.appendChild(this.ub('path', b)),
          this.svg.appendChild(c),
          0 < this.wc.length &&
            this.wc[this.wc.length - 1].setAttributeNS(
              null,
              'clip-path',
              'url(#' + a + ')',
            ))
        : this.addElement('path', b);
    };
    function Wl(a, b, c, d, e, f, g) {
      var h = new Tl();
      h.Ka = [b, c, d, e, f, g];
      b = {};
      Xl(a, 'g', b, h);
      h = a.addElement('g', b);
      a.wc.push(h);
    }
    t.Kq = function () {
      if (
        0 !== this.shadowOffsetX ||
        0 !== this.shadowOffsetY ||
        0 !== this.shadowBlur
      ) {
        var a = 'SHADOW' + qb++,
          b = this.addElement(
            'filter',
            { id: a, x: '-100%', y: '-100%', width: '300%', height: '300%' },
            null,
          );
        var c = this.ub('feGaussianBlur', {
          in: 'SourceAlpha',
          result: 'blur',
          MA: this.shadowBlur / 2,
        });
        var d = this.ub('feFlood', {
          in: 'blur',
          result: 'flood',
          'flood-color': this.shadowColor,
        });
        var e = this.ub('feComposite', {
          in: 'flood',
          in2: 'blur',
          operator: 'in',
          result: 'comp',
        });
        var f = this.ub('feOffset', {
          in: 'comp',
          result: 'offsetBlur',
          dx: this.shadowOffsetX,
          dy: this.shadowOffsetY,
        });
        var g = this.ub('feMerge', {});
        g.appendChild(this.ub('feMergeNode', { in: 'offsetBlur' }));
        g.appendChild(this.ub('feMergeNode', { in: 'SourceGraphic' }));
        b.appendChild(c);
        b.appendChild(d);
        b.appendChild(e);
        b.appendChild(f);
        b.appendChild(g);
        0 < this.wc.length &&
          this.wc[this.wc.length - 1].setAttributeNS(
            null,
            'filter',
            'url(#' + a + ')',
          );
      }
    };
    t.mw = function (a, b, c) {
      this.Ep = a;
      this.Fp = b;
      this.bf = c;
    };
    function rl(a) {
      a.shadowOffsetX = 0;
      a.shadowOffsetY = 0;
      a.shadowBlur = 0;
    }
    function ql(a) {
      a.shadowOffsetX = a.Ep;
      a.shadowOffsetY = a.Fp;
      a.shadowBlur = a.bf;
    }
    t.gt = function (a, b) {
      this.vu = !0;
      this.sh = a;
      this.th = b;
    };
    t.et = function () {
      this.vu = !1;
    };
    t.Qc = function () {};
    t.ly = function () {};
    Vl.prototype.rotate = function () {};
    Vl.prototype.getImageData = function () {
      return null;
    };
    Vl.prototype.measureText = function () {
      return null;
    };
    Vl.className = 'SVGContext';
    R.prototype.At = function (a) {
      var b = new Bj(this, x.document);
      void 0 === a && (a = new db());
      var c = this;
      return Bk(
        this,
        function (a, e) {
          a = Ck(c, a, 'SVG', b);
          a = null !== a ? a.svg : null;
          return 'function' === typeof e ? (e(a), null) : a;
        },
        a,
      );
    };
    R.prototype.makeSvg = R.prototype.At;
    R.prototype.Nv = function (a) {
      return this.At(a);
    };
    R.prototype.makeSVG = R.prototype.Nv;
    Y.prototype.Jx = function (a, b) {
      if (!(a instanceof Vl)) return !1;
      if (!this.visible) return !0;
      var c = null,
        d = a.tq;
      if (
        this instanceof X &&
        (this.type === X.TableRow || this.type === X.TableColumn)
      )
        return ol(this, a, b), !0;
      var e = this.vb;
      if (0 === e.width || 0 === e.height || isNaN(e.x) || isNaN(e.y)) return !0;
      var f = this.transform,
        g = this.panel;
      (0 !== (this.F & 4096)) === !0 && pl(this);
      var h = 0 !== (this.F & 256),
        k = !1;
      this instanceof Xg && (a.font = this.font);
      if (h) {
        k = g.ae() ? g.naturalBounds : g.actualBounds;
        if (null !== this.jd) {
          var l = this.jd;
          var m = l.x;
          var n = l.y;
          var p = l.width;
          l = l.height;
        } else
          (m = Math.max(e.x, k.x)),
            (n = Math.max(e.y, k.y)),
            (p = Math.min(e.right, k.right) - m),
            (l = Math.min(e.bottom, k.bottom) - n);
        if (
          m > e.width + e.x ||
          e.x > k.width + k.x ||
          n > e.height + e.y ||
          e.y > k.height + k.y
        )
          return !0;
        k = !0;
        Wl(a, 1, 0, 0, 1, 0, 0);
        a.save();
        a.beginPath();
        a.rect(m, n, p, l);
        a.clip();
      }
      if (this.wf() && !this.isVisible()) return !0;
      a.Ud.Ka = [1, 0, 0, 1, 0, 0];
      ((this instanceof Xg && 1 < this.lineCount) ||
        (this instanceof W && 1 < this.geometry.figures.length)) &&
        Wl(a, 1, 0, 0, 1, 0, 0);
      m = !1;
      this.wf() &&
        this.isShadowed &&
        b.Be('drawShadows') &&
        ((n = this.shadowOffset),
        a.mw(n.x * b.scale * b.Rb, n.y * b.scale * b.Rb, this.shadowBlur),
        ql(a),
        (a.shadowColor = this.shadowColor));
      n = !1;
      this.part && b.Be('drawShadows') && (n = this.part.isShadowed);
      !0 === this.shadowVisible
        ? (ql(a), !1 === m && n && (Wl(a, 1, 0, 0, 1, 0, 0), a.Kq(), (m = !0)))
        : !1 === this.shadowVisible && rl(a);
      p = this.naturalBounds;
      null !== this.areaBackground &&
        (ji(this, a, this.areaBackground, !0, !0, p, e),
        !1 === m && n && (Wl(a, 1, 0, 0, 1, 0, 0), a.Kq(), (m = !0)),
        this.areaBackground instanceof sl && this.areaBackground.type === tl
          ? (a.beginPath(),
            a.rect(e.x, e.y, e.width, e.height),
            a.Vd(this.areaBackground))
          : a.fillRect(e.x, e.y, e.width, e.height));
      this instanceof X
        ? Wl(a, f.m11, f.m12, f.m21, f.m22, f.dx, f.dy)
        : (a.Ud.Ka = [f.m11, f.m12, f.m21, f.m22, f.dx, f.dy]);
      if (null !== this.background) {
        !1 === m && n && (Wl(a, 1, 0, 0, 1, 0, 0), a.Kq(), (m = !0));
        var r = this.naturalBounds;
        l = f = 0;
        var q = r.width;
        r = r.height;
        var u = 0;
        this instanceof W &&
          ((r = this.geometry.bounds),
          (f = r.x),
          (l = r.y),
          (q = r.width),
          (r = r.height),
          (u = this.strokeWidth));
        ji(this, a, this.background, !0, !1, p, e);
        this.background instanceof sl && this.background.type === tl
          ? (a.beginPath(),
            a.rect(f - u / 2, l - u / 2, q + u, r + u),
            a.Vd(this.background))
          : a.fillRect(f - u / 2, l - u / 2, q + u, r + u);
      }
      n &&
      (null !== this.background ||
        null !== this.areaBackground ||
        (null !== g && 0 !== (g.F & 512)) ||
        (null !== g &&
          (g.type === X.Auto || g.type === X.Spot) &&
          g.Ab() !== this))
        ? (ul(this, !0), null === this.shadowVisible && rl(a))
        : ul(this, !1);
      this.Pi(a, b);
      n && (0 !== (this.F & 512)) === !0 && ql(a);
      this.wf() && n && rl(a);
      h && (a.restore(), k && a.wc.pop());
      this instanceof X && (c = a.wc.pop());
      !0 === m && a.wc.pop();
      if (
        (this instanceof Xg && 1 < this.lineCount) ||
        (this instanceof W && 1 < this.geometry.figures.length)
      )
        c = a.wc.pop();
      null !== a.zk.iq &&
        (null === c &&
          (d === a.tq ? (Wl(a, 1, 0, 0, 1, 0, 0), (c = a.wc.pop())) : (c = a.tq)),
        a.zk.iq(this, c));
      this.svg = c;
      return !0;
    };
    function Dk(a, b) {
      this.ownerDocument = b = void 0 === b ? x.document : b;
      this.iq = null;
      b = b.createElement('canvas');
      b.tabIndex = 0;
      this.Da = b;
      this.Da.innerHTML =
        'This text is displayed if your browser does not support the Canvas HTML element.';
      this.context = new wl(b);
      b.B = a;
    }
    Dk.prototype.resize = function (a, b, c, d) {
      return this.width !== a || this.height !== b
        ? ((this.width = a),
          (this.height = b),
          (this.style.width = c + 'px'),
          (this.style.height = d + 'px'),
          !0)
        : !1;
    };
    Dk.prototype.toDataURL = function (a, b) {
      return this.Da.toDataURL(a, b);
    };
    Dk.prototype.getBoundingClientRect = function () {
      return this.Da.getBoundingClientRect();
    };
    Dk.prototype.focus = function () {
      this.Da.focus();
    };
    Dk.prototype.Ix = function () {
      this.ownerDocument = this.Da.B = null;
    };
    ma.Object.defineProperties(Dk.prototype, {
      width: {
        get: function () {
          return this.Da.width;
        },
        set: function (a) {
          this.Da.width = a;
        },
      },
      height: {
        get: function () {
          return this.Da.height;
        },
        set: function (a) {
          this.Da.height = a;
        },
      },
      style: {
        get: function () {
          return this.Da.style;
        },
      },
    });
    Dk.className = 'CanvasSurface';
    function wl(a) {
      (a.getContext && a.getContext('2d')) ||
        B('Browser does not support HTML Canvas Element');
      this.V = a.getContext('2d');
      this.Yt = this.$t = this.Zt = '';
      this.fn = !1;
      this.bf = this.Fp = this.Ep = 0;
    }
    t = wl.prototype;
    t.ly = function (a) {
      this.V.imageSmoothingEnabled = a;
    };
    t.arc = function (a, b, c, d, e, f) {
      this.V.arc(a, b, c, d, e, f);
    };
    t.beginPath = function () {
      this.V.beginPath();
    };
    t.bezierCurveTo = function (a, b, c, d, e, f) {
      this.V.bezierCurveTo(a, b, c, d, e, f);
    };
    t.clearRect = function (a, b, c, d) {
      this.V.clearRect(a, b, c, d);
    };
    t.clip = function () {
      this.V.clip();
    };
    t.closePath = function () {
      this.V.closePath();
    };
    t.createLinearGradient = function (a, b, c, d) {
      return this.V.createLinearGradient(a, b, c, d);
    };
    t.createPattern = function (a, b) {
      return this.V.createPattern(a, b);
    };
    t.createRadialGradient = function (a, b, c, d, e, f) {
      return this.V.createRadialGradient(a, b, c, d, e, f);
    };
    t.drawImage = function (a, b, c, d, e, f, g, h, k) {
      void 0 === d
        ? this.V.drawImage(a, b, c)
        : this.V.drawImage(a, b, c, d, e, f, g, h, k);
    };
    t.fill = function () {
      this.V.fill();
    };
    t.fillRect = function (a, b, c, d) {
      this.V.fillRect(a, b, c, d);
    };
    t.fillText = function (a, b, c) {
      this.V.fillText(a, b, c);
    };
    t.getImageData = function (a, b, c, d) {
      return this.V.getImageData(a, b, c, d);
    };
    t.lineTo = function (a, b) {
      this.V.lineTo(a, b);
    };
    t.measureText = function (a) {
      return this.V.measureText(a);
    };
    t.moveTo = function (a, b) {
      this.V.moveTo(a, b);
    };
    t.quadraticCurveTo = function (a, b, c, d) {
      this.V.quadraticCurveTo(a, b, c, d);
    };
    t.rect = function (a, b, c, d) {
      this.V.rect(a, b, c, d);
    };
    t.restore = function () {
      this.V.restore();
    };
    wl.prototype.rotate = function (a) {
      this.V.rotate(a);
    };
    t = wl.prototype;
    t.save = function () {
      this.V.save();
    };
    t.setTransform = function (a, b, c, d, e, f) {
      this.V.setTransform(a, b, c, d, e, f);
    };
    t.scale = function (a, b) {
      this.V.scale(a, b);
    };
    t.stroke = function () {
      this.V.stroke();
    };
    t.transform = function (a, b, c, d, e, f) {
      (1 === a && 0 === b && 0 === c && 1 === d && 0 === e && 0 === f) ||
        this.V.transform(a, b, c, d, e, f);
    };
    t.translate = function (a, b) {
      this.V.translate(a, b);
    };
    t.Vd = function (a) {
      if (a instanceof sl && a.type === tl) {
        var b = a.Nk;
        a = a.au;
        a > b
          ? (this.scale(b / a, 1), this.translate((a - b) / 2, 0))
          : b > a && (this.scale(1, a / b), this.translate(0, (b - a) / 2));
        this.fn ? this.clip() : this.fill();
        a > b
          ? (this.translate(-(a - b) / 2, 0), this.scale(1 / (b / a), 1))
          : b > a &&
            (this.translate(0, -(b - a) / 2), this.scale(1, 1 / (a / b)));
      } else this.fn ? this.clip() : this.fill();
    };
    t.ej = function () {
      this.fn || this.stroke();
    };
    t.mw = function (a, b, c) {
      this.Ep = a;
      this.Fp = b;
      this.bf = c;
    };
    t.gt = function (a, b) {
      var c = this.V;
      void 0 !== c.setLineDash && (c.setLineDash(a), (c.lineDashOffset = b));
    };
    t.et = function () {
      var a = this.V;
      void 0 !== a.setLineDash && (a.setLineDash(Zl), (a.lineDashOffset = 0));
    };
    t.Qc = function (a) {
      a && (this.Zt = '');
      this.Yt = this.$t = '';
    };
    ma.Object.defineProperties(wl.prototype, {
      fillStyle: {
        get: function () {
          return this.V.fillStyle;
        },
        set: function (a) {
          this.Yt !== a && (this.Yt = this.V.fillStyle = a);
        },
      },
      font: {
        get: function () {
          return this.V.font;
        },
        set: function (a) {
          this.Zt !== a && (this.Zt = this.V.font = a);
        },
      },
      globalAlpha: {
        get: function () {
          return this.V.globalAlpha;
        },
        set: function (a) {
          this.V.globalAlpha = a;
        },
      },
      lineCap: {
        get: function () {
          return this.V.lineCap;
        },
        set: function (a) {
          this.V.lineCap = a;
        },
      },
      lineDashOffset: {
        get: function () {
          return this.V.lineDashOffset;
        },
        set: function (a) {
          this.V.lineDashOffset = a;
        },
      },
      lineJoin: {
        get: function () {
          return this.V.lineJoin;
        },
        set: function (a) {
          this.V.lineJoin = a;
        },
      },
      lineWidth: {
        get: function () {
          return this.V.lineWidth;
        },
        set: function (a) {
          this.V.lineWidth = a;
        },
      },
      miterLimit: {
        get: function () {
          return this.V.miterLimit;
        },
        set: function (a) {
          this.V.miterLimit = a;
        },
      },
      shadowBlur: {
        get: function () {
          return this.V.shadowBlur;
        },
        set: function (a) {
          this.V.shadowBlur = a;
        },
      },
      shadowColor: {
        get: function () {
          return this.V.shadowColor;
        },
        set: function (a) {
          this.V.shadowColor = a;
        },
      },
      shadowOffsetX: {
        get: function () {
          return this.V.shadowOffsetX;
        },
        set: function (a) {
          this.V.shadowOffsetX = a;
        },
      },
      shadowOffsetY: {
        get: function () {
          return this.V.shadowOffsetY;
        },
        set: function (a) {
          this.V.shadowOffsetY = a;
        },
      },
      strokeStyle: {
        get: function () {
          return this.V.strokeStyle;
        },
        set: function (a) {
          this.$t !== a && (this.$t = this.V.strokeStyle = a);
        },
      },
      textAlign: {
        get: function () {
          return this.V.textAlign;
        },
        set: function (a) {
          this.V.textAlign = a;
        },
      },
      imageSmoothingEnabled: {
        get: function () {
          return this.V.imageSmoothingEnabled;
        },
        set: function (a) {
          this.V.imageSmoothingEnabled = a;
        },
      },
      clipInsteadOfFill: {
        get: function () {
          return this.fn;
        },
        set: function (a) {
          this.fn = a;
        },
      },
    });
    var Zl = Object.freeze([]);
    wl.className = 'CanvasSurfaceContext';
    function $l() {
      this.Y = this.v = this.I = this.l = 0;
    }
    $l.className = 'ColorNumbers';
    function sl(a) {
      am || (bm(), (am = !0));
      Za(this);
      this.s = !1;
      void 0 === a
        ? ((this.qa = vl), (this.Mk = 'black'))
        : 'string' === typeof a
        ? ((this.qa = vl), (this.Mk = a))
        : ((this.qa = a), (this.Mk = 'black'));
      a = this.qa;
      a === yl
        ? ((this.rd = xc), (this.Zk = Fc))
        : (this.Zk = a === tl ? (this.rd = Ac) : (this.rd = uc));
      this.Ns = 0;
      this.Br = NaN;
      this.ee = this.qs = this.de = null;
      this.au = this.Nk = 0;
    }
    sl.prototype.copy = function () {
      var a = new sl();
      a.qa = this.qa;
      a.Mk = this.Mk;
      a.rd = this.rd.G();
      a.Zk = this.Zk.G();
      a.Ns = this.Ns;
      a.Br = this.Br;
      null !== this.de && (a.de = this.de.copy());
      a.qs = this.qs;
      return a;
    };
    t = sl.prototype;
    t.freeze = function () {
      this.s = !0;
      null !== this.de && this.de.freeze();
      return this;
    };
    t.ea = function () {
      Object.isFrozen(this) && B('cannot thaw constant: ' + this);
      this.s = !1;
      null !== this.de && this.de.ea();
      return this;
    };
    t.bb = function (a) {
      a.classType === sl && (this.type = a);
    };
    t.toString = function () {
      var a = 'Brush(';
      if (this.type === vl) a += this.color;
      else if (
        ((a =
          this.type === yl
            ? a + 'Linear '
            : this.type === tl
            ? a + 'Radial '
            : this.type === xl
            ? a + 'Pattern '
            : a + '(unknown) '),
        (a += this.start + ' ' + this.end),
        null !== this.colorStops)
      )
        for (var b = this.colorStops.iterator; b.next(); )
          a += ' ' + b.key + ':' + b.value;
      return a + ')';
    };
    t.addColorStop = function (a, b) {
      this.s && ua(this);
      ('number' !== typeof a || !isFinite(a) || 1 < a || 0 > a) &&
        va(a, '0 <= loc <= 1', sl, 'addColorStop:loc');
      null === this.de && (this.de = new G());
      this.de.add(a, b);
      this.qa === vl && (this.type = yl);
      this.ee = null;
      return this;
    };
    t.dA = function (a, b) {
      this.s && ua(this);
      a = void 0 === a || 'number' !== typeof a ? 0.2 : a;
      b = void 0 === b ? cm : b;
      if (this.type === vl) Qh(this.color), (this.color = dm(a, b));
      else if ((this.type === yl || this.type === tl) && null !== this.colorStops)
        for (var c = this.colorStops.iterator; c.next(); )
          Qh(c.value), this.addColorStop(c.key, dm(a, b));
      return this;
    };
    function em(a, b, c) {
      b = void 0 === b || 'number' !== typeof b ? 0.2 : b;
      c = void 0 === c ? cm : c;
      Qh(a);
      return dm(b, c);
    }
    t.$y = function (a, b) {
      this.s && ua(this);
      a = void 0 === a || 'number' !== typeof a ? 0.2 : a;
      b = void 0 === b ? cm : b;
      if (this.type === vl) Qh(this.color), (this.color = dm(-a, b));
      else if ((this.type === yl || this.type === tl) && null !== this.colorStops)
        for (var c = this.colorStops.iterator; c.next(); )
          Qh(c.value), this.addColorStop(c.key, dm(-a, b));
      return this;
    };
    function fm(a, b, c) {
      b = void 0 === b || 'number' !== typeof b ? 0.2 : b;
      c = void 0 === c ? cm : c;
      Qh(a);
      return dm(-b, c);
    }
    function gm(a, b, c) {
      Qh(a);
      a = hm.l;
      var d = hm.I,
        e = hm.v,
        f = hm.Y;
      Qh(b);
      void 0 === c && (c = 0.5);
      return (
        'rgba(' +
        Math.round((hm.l - a) * c + a) +
        ', ' +
        Math.round((hm.I - d) * c + d) +
        ', ' +
        Math.round((hm.v - e) * c + e) +
        ', ' +
        Math.round((hm.Y - f) * c + f) +
        ')'
      );
    }
    t.Ux = function () {
      if (this.type === vl) return im(this.color);
      if ((this.type === yl || this.type === tl) && null !== this.colorStops) {
        var a = this.colorStops;
        if (this.type === tl) return im(a.first().value);
        if (null !== a.get(0.5)) return im(a.get(0.5));
        if (2 === a.count) return (a = a.na()), im(gm(a[0].value, a[1].value));
        for (var b = a.iterator, c = -1, d = -1, e = 1, f = 1; b.next(); ) {
          var g = b.key,
            h = Math.abs(0.5 - b.key);
          e > f && h < e
            ? ((c = g), (e = h))
            : f >= e && h < f && ((d = g), (f = h));
        }
        c > d && (c = [d, (d = c)][0]);
        b = d - c;
        return im(gm(a.get(c), a.get(d), 1 - e / b));
      }
      return !1;
    };
    function im(a) {
      if (null === a) return null;
      if (a instanceof sl) return a.Ux();
      Qh(a);
      return 128 > (299 * hm.l + 587 * hm.I + 114 * hm.v) / 1e3;
    }
    function dm(a, b) {
      switch (b) {
        case cm:
          b = 100 * jm(hm.l);
          var c = 100 * jm(hm.I),
            d = 100 * jm(hm.v);
          km.l = 0.4124564 * b + 0.3575761 * c + 0.1804375 * d;
          km.I = 0.2126729 * b + 0.7151522 * c + 0.072175 * d;
          km.v = 0.0193339 * b + 0.119192 * c + 0.9503041 * d;
          km.Y = hm.Y;
          b = lm(km.l / mm[0]);
          c = lm(km.I / mm[1]);
          d = lm(km.v / mm[2]);
          nm.l = 116 * c - 16;
          nm.I = 500 * (b - c);
          nm.v = 200 * (c - d);
          nm.Y = km.Y;
          nm.l = Math.min(100, Math.max(0, nm.l + 100 * a));
          a = (nm.l + 16) / 116;
          b = a - nm.v / 200;
          km.l = mm[0] * om(nm.I / 500 + a);
          km.I = mm[1] * (nm.l > pm * qm ? Math.pow(a, 3) : nm.l / pm);
          km.v = mm[2] * om(b);
          km.Y = nm.Y;
          a = -0.969266 * km.l + 1.8760108 * km.I + 0.041556 * km.v;
          b = 0.0556434 * km.l + -0.2040259 * km.I + 1.0572252 * km.v;
          hm.l =
            255 *
            rm((3.2404542 * km.l + -1.5371385 * km.I + -0.4985314 * km.v) / 100);
          hm.I = 255 * rm(a / 100);
          hm.v = 255 * rm(b / 100);
          hm.Y = km.Y;
          hm.l = Math.round(hm.l);
          255 < hm.l ? (hm.l = 255) : 0 > hm.l && (hm.l = 0);
          hm.I = Math.round(hm.I);
          255 < hm.I ? (hm.I = 255) : 0 > hm.I && (hm.I = 0);
          hm.v = Math.round(hm.v);
          255 < hm.v ? (hm.v = 255) : 0 > hm.v && (hm.v = 0);
          return 'rgba(' + hm.l + ', ' + hm.I + ', ' + hm.v + ', ' + hm.Y + ')';
        case sm:
          return (
            Rh(),
            (Sh.v = Math.min(100, Math.max(0, Sh.v + 100 * a))),
            'hsla(' + Sh.l + ', ' + Sh.I + '%, ' + Sh.v + '%, ' + Sh.Y + ')'
          );
        default:
          return B('Unknown color space: ' + b), 'rgba(0, 0, 0, 1)';
      }
    }
    function Qh(a) {
      am || (bm(), (am = !0));
      var b = tm;
      if (null !== b) {
        b.clearRect(0, 0, 1, 1);
        b.fillStyle = '#000000';
        var c = b.fillStyle;
        b.fillStyle = a;
        b.fillStyle !== c
          ? (b.fillRect(0, 0, 1, 1),
            (a = b.getImageData(0, 0, 1, 1).data),
            (hm.l = a[0]),
            (hm.I = a[1]),
            (hm.v = a[2]),
            (hm.Y = a[3] / 255))
          : ((b.fillStyle = '#FFFFFF'),
            (b.fillStyle = a),
            (hm.l = 0),
            (hm.I = 0),
            (hm.v = 0),
            (hm.Y = 1));
      }
    }
    function Rh() {
      var a = hm.l / 255,
        b = hm.I / 255,
        c = hm.v / 255,
        d = Math.max(a, b, c),
        e = Math.min(a, b, c),
        f = d - e;
      e = (d + e) / 2;
      if (0 === f) var g = (a = 0);
      else {
        switch (d) {
          case a:
            g = ((b - c) / f) % 6;
            break;
          case b:
            g = (c - a) / f + 2;
            break;
          case c:
            g = (a - b) / f + 4;
        }
        g *= 60;
        0 > g && (g += 360);
        a = f / (1 - Math.abs(2 * e - 1));
      }
      Sh.l = Math.round(g);
      Sh.I = Math.round(100 * a);
      Sh.v = Math.round(100 * e);
      Sh.Y = hm.Y;
    }
    function jm(a) {
      a /= 255;
      return 0.04045 >= a ? a / 12.92 : Math.pow((a + 0.055) / 1.055, 2.4);
    }
    function rm(a) {
      return 0.0031308 >= a ? 12.92 * a : 1.055 * Math.pow(a, 1 / 2.4) - 0.055;
    }
    function lm(a) {
      return a > qm ? Math.pow(a, 1 / 3) : (pm * a + 16) / 116;
    }
    function om(a) {
      var b = a * a * a;
      return b > qm ? b : (116 * a - 16) / pm;
    }
    function Ql(a, b) {
      'string' !== typeof a &&
        (a instanceof sl ||
          B('Value for ' + b + ' must be a color string or a Brush, not ' + a));
    }
    function bm() {
      tm = Vg ? new Dk(null).context : null;
    }
    ma.Object.defineProperties(sl.prototype, {
      type: {
        get: function () {
          return this.qa;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.qa = a;
          this.start.kc() &&
            (a === yl ? (this.start = xc) : a === tl && (this.start = Ac));
          this.end.kc() &&
            (a === yl ? (this.end = Fc) : a === tl && (this.end = Ac));
          this.ee = null;
        },
      },
      color: {
        get: function () {
          return this.Mk;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.Mk = a;
          this.ee = null;
        },
      },
      start: {
        get: function () {
          return this.rd;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.rd = a.G();
          this.ee = null;
        },
      },
      end: {
        get: function () {
          return this.Zk;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.Zk = a.G();
          this.ee = null;
        },
      },
      startRadius: {
        get: function () {
          return this.Ns;
        },
        set: function (a) {
          this.s && ua(this, a);
          0 > a && va(a, '>= zero', sl, 'startRadius');
          this.Ns = a;
          this.ee = null;
        },
      },
      endRadius: {
        get: function () {
          return this.Br;
        },
        set: function (a) {
          this.s && ua(this, a);
          0 > a && va(a, '>= zero', sl, 'endRadius');
          this.Br = a;
          this.ee = null;
        },
      },
      colorStops: {
        get: function () {
          return this.de;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.de = a;
          this.ee = null;
        },
      },
      pattern: {
        get: function () {
          return this.qs;
        },
        set: function (a) {
          this.s && ua(this, a);
          this.qs = a;
          this.ee = null;
        },
      },
    });
    sl.prototype.isDark = sl.prototype.Ux;
    sl.prototype.darkenBy = sl.prototype.$y;
    sl.prototype.lightenBy = sl.prototype.dA;
    sl.prototype.addColorStop = sl.prototype.addColorStop;
    var qm = 216 / 24389,
      pm = 24389 / 27,
      mm = [95.047, 100, 108.883],
      tm = null,
      hm = new $l(),
      Sh = new $l(),
      km = new $l(),
      nm = new $l(),
      am = !1;
    sl.className = 'Brush';
    var vl;
    sl.Solid = vl = new D(sl, 'Solid', 0);
    var yl;
    sl.Linear = yl = new D(sl, 'Linear', 1);
    var tl;
    sl.Radial = tl = new D(sl, 'Radial', 2);
    var xl;
    sl.Pattern = xl = new D(sl, 'Pattern', 4);
    var cm;
    sl.Lab = cm = new D(sl, 'Lab', 5);
    var sm;
    sl.HSL = sm = new D(sl, 'HSL', 6);
    sl.randomColor = function (a, b) {
      void 0 === a && (a = 128);
      void 0 === b && (b = Math.max(a, 255));
      var c = Math.abs(b - a);
      b = Math.floor(a + Math.random() * c).toString(16);
      var d = Math.floor(a + Math.random() * c).toString(16);
      a = Math.floor(a + Math.random() * c).toString(16);
      2 > b.length && (b = '0' + b);
      2 > d.length && (d = '0' + d);
      2 > a.length && (a = '0' + a);
      return '#' + b + d + a;
    };
    sl.isValidColor = function (a) {
      if ('black' === a) return !0;
      if ('' === a) return !1;
      am || (bm(), (am = !0));
      var b = tm;
      if (null === b) return !0;
      b.fillStyle = '#000000';
      var c = b.fillStyle;
      b.fillStyle = a;
      if (b.fillStyle !== c) return !0;
      b.fillStyle = '#FFFFFF';
      c = b.fillStyle;
      b.fillStyle = a;
      return b.fillStyle !== c;
    };
    sl.lighten = function (a) {
      return em(a);
    };
    sl.lightenBy = em;
    sl.darken = function (a) {
      return fm(a);
    };
    sl.darkenBy = fm;
    sl.mix = gm;
    sl.isDark = im;
    function Nl() {
      this.name = 'Base';
    }
    Nl.prototype.measure = function () {};
    Nl.prototype.gA = function (a, b, c, d, e) {
      a.measure(b, c, d, e);
    };
    Nl.prototype.arrange = function () {};
    Nl.prototype.Qy = function (a, b, c, d, e, f) {
      a.arrange(b, c, d, e, f);
    };
    Nl.prototype.tb = function () {};
    ma.Object.defineProperties(Nl.prototype, {
      classType: {
        get: function () {
          return X;
        },
      },
    });
    Nl.prototype.arrangeElement = Nl.prototype.Qy;
    Nl.prototype.measureElement = Nl.prototype.gA;
    Nl.className = 'PanelLayout';
    function um() {
      this.name = 'Base';
      this.name = 'Position';
    }
    la(um, Nl);
    um.prototype.measure = function (a, b, c, d, e, f, g) {
      var h = d.length;
      a = vm(a);
      for (var k = 0; k < h; k++) {
        var l = d[k];
        if (l.visible || l === a) {
          var m = l.margin,
            n = m.right + m.left;
          m = m.top + m.bottom;
          l.measure(b, c, f, g);
          var p = l.measuredBounds;
          n = Math.max(p.width + n, 0);
          m = Math.max(p.height + m, 0);
          p = l.position.x;
          var r = l.position.y;
          isFinite(p) || (p = 0);
          isFinite(r) || (r = 0);
          l instanceof W &&
            l.isGeometryPositioned &&
            ((l = l.strokeWidth / 2), (p -= l), (r -= l));
          ec(e, p, r, n, m);
        }
      }
    };
    um.prototype.arrange = function (a, b, c) {
      var d = b.length,
        e = a.padding;
      a = c.x - e.left;
      c = c.y - e.top;
      for (e = 0; e < d; e++) {
        var f = b[e],
          g = f.measuredBounds,
          h = f.margin,
          k = f.position.x,
          l = f.position.y;
        k = isNaN(k) ? -a : k - a;
        l = isNaN(l) ? -c : l - c;
        if (f instanceof W && f.isGeometryPositioned) {
          var m = f.strokeWidth / 2;
          k -= m;
          l -= m;
        }
        f.visible && f.arrange(k + h.left, l + h.top, g.width, g.height);
      }
    };
    function wm() {
      this.name = 'Base';
      this.name = 'Horizontal';
    }
    la(wm, Nl);
    wm.prototype.measure = function (a, b, c, d, e, f, g) {
      var h = d.length;
      b = Ea();
      f = vm(a);
      for (var k = 0; k < h; k++) {
        var l = d[k];
        if (l.visible || l === f) {
          var m = jl(l, !1);
          if (m !== Ag && m !== Vk) b.push(l);
          else {
            l.measure(Infinity, c, 0, g);
            m = l.margin;
            l = l.measuredBounds;
            var n = Math.max(l.height + m.top + m.bottom, 0);
            e.width += Math.max(l.width + m.right + m.left, 0);
            e.height = Math.max(e.height, n);
          }
        }
      }
      d = b.length;
      a.desiredSize.height
        ? (c = Math.min(a.desiredSize.height, a.maxSize.height))
        : 0 !== e.height && (c = Math.min(e.height, a.maxSize.height));
      for (a = 0; a < d; a++)
        if (((k = b[a]), k.visible || k === f))
          (m = k.margin),
            (h = m.right + m.left),
            (m = m.top + m.bottom),
            k.measure(Infinity, c, 0, g),
            (k = k.measuredBounds),
            (m = Math.max(k.height + m, 0)),
            (e.width += Math.max(k.width + h, 0)),
            (e.height = Math.max(e.height, m));
      Ha(b);
    };
    wm.prototype.arrange = function (a, b, c) {
      for (
        var d = b.length,
          e = a.padding,
          f = e.top,
          g = a.isOpposite,
          h = g ? c.width : e.left,
          k = 0;
        k < d;
        k++
      ) {
        var l = f,
          m = b[k];
        if (m.visible) {
          var n = m.measuredBounds,
            p = m.margin,
            r = p.top + p.bottom,
            q = f + e.bottom,
            u = n.height,
            v = jl(m, !1);
          if ((isNaN(m.desiredSize.height) && v === vd) || v === Wk)
            u = Math.max(c.height - r - q, 0);
          r = u + r + q;
          q = m.alignment;
          q.Nb() && (q = a.defaultAlignment);
          q.cb() || (q = Ac);
          g && (h -= n.width + p.left + p.right);
          m.arrange(
            h + q.offsetX + p.left,
            l + q.offsetY + p.top + (c.height * q.y - r * q.y),
            n.width,
            u,
          );
          g || (h += n.width + p.left + p.right);
        }
      }
    };
    function xm() {
      this.name = 'Base';
      this.name = 'Vertical';
    }
    la(xm, Nl);
    xm.prototype.measure = function (a, b, c, d, e, f) {
      var g = d.length;
      c = Ea();
      for (var h = vm(a), k = 0; k < g; k++) {
        var l = d[k];
        if (l.visible || l === h) {
          var m = jl(l, !1);
          if (m !== Ag && m !== Wk) c.push(l);
          else {
            var n = l.margin;
            m = n.right + n.left;
            n = n.top + n.bottom;
            l.measure(b, Infinity, f, 0);
            l = l.measuredBounds;
            Vb(
              e,
              Math.max(e.width, Math.max(l.width + m, 0)),
              e.height + Math.max(l.height + n, 0),
            );
          }
        }
      }
      d = c.length;
      if (0 !== d) {
        a.desiredSize.width
          ? (b = Math.min(a.desiredSize.width, a.maxSize.width))
          : 0 !== e.width && (b = Math.min(e.width, a.maxSize.width));
        for (a = 0; a < d; a++)
          if (((k = c[a]), k.visible || k === h))
            (l = k.margin),
              (g = l.right + l.left),
              (l = l.top + l.bottom),
              k.measure(b, Infinity, f, 0),
              (k = k.measuredBounds),
              (l = Math.max(k.height + l, 0)),
              (e.width = Math.max(e.width, Math.max(k.width + g, 0))),
              (e.height += l);
        Ha(c);
      }
    };
    xm.prototype.arrange = function (a, b, c) {
      for (
        var d = b.length,
          e = a.padding,
          f = e.left,
          g = a.isOpposite,
          h = g ? c.height : e.top,
          k = 0;
        k < d;
        k++
      ) {
        var l = f,
          m = b[k];
        if (m.visible) {
          var n = m.measuredBounds,
            p = m.margin,
            r = p.left + p.right,
            q = f + e.right,
            u = n.width,
            v = jl(m, !1);
          if ((isNaN(m.desiredSize.width) && v === vd) || v === Vk)
            u = Math.max(c.width - r - q, 0);
          r = u + r + q;
          q = m.alignment;
          q.Nb() && (q = a.defaultAlignment);
          q.cb() || (q = Ac);
          g && (h -= n.height + p.bottom + p.top);
          m.arrange(
            l + q.offsetX + p.left + (c.width * q.x - r * q.x),
            h + q.offsetY + p.top,
            u,
            n.height,
          );
          g || (h += n.height + p.bottom + p.top);
        }
      }
    };
    function ym() {
      this.name = 'Base';
      this.name = 'Spot';
    }
    la(ym, Nl);
    ym.prototype.measure = function (a, b, c, d, e, f, g) {
      var h = d.length,
        k = a.Ab(),
        l = k.margin,
        m = l.right + l.left,
        n = l.top + l.bottom;
      k.measure(b, c, f, g);
      var p = k.measuredBounds;
      f = p.width;
      g = p.height;
      var r = Math.max(f + m, 0);
      var q = Math.max(g + n, 0);
      for (
        var u = a.isClipping,
          v = N.allocAt(-l.left, -l.top, r, q),
          w = !0,
          y = vm(a),
          z = 0;
        z < h;
        z++
      ) {
        var A = d[z];
        if (A !== k && (A.visible || A === y)) {
          l = A.margin;
          r = l.right + l.left;
          q = l.top + l.bottom;
          p = jl(A, !1);
          switch (p) {
            case vd:
              b = f;
              c = g;
              break;
            case Vk:
              b = f;
              break;
            case Wk:
              c = g;
          }
          A.measure(b, c, 0, 0);
          p = A.measuredBounds;
          r = Math.max(p.width + r, 0);
          q = Math.max(p.height + q, 0);
          var C = A.alignment;
          C.Nb() && (C = a.defaultAlignment);
          C.cb() || (C = Ac);
          var I = A.alignmentFocus;
          I.Nb() && (I = Ac);
          var P = null;
          A instanceof X &&
            '' !== A.Jg &&
            (A.arrange(0, 0, p.width, p.height),
            (P = A.Xa(A.Jg)),
            P === A && (P = null));
          if (null !== P) {
            l = P.naturalBounds;
            p = P.margin;
            for (
              l = H.allocAt(
                I.x * l.width - I.offsetX - p.left,
                I.y * l.height - I.offsetY - p.top,
              );
              P !== A;
  
            )
              P.transform.ra(l), (P = P.panel);
            A = C.x * f + C.offsetX - l.x;
            p = C.y * g + C.offsetY - l.y;
            H.free(l);
          } else
            (A = C.x * f + C.offsetX - (I.x * p.width + I.offsetX) - l.left),
              (p = C.y * g + C.offsetY - (I.y * p.height + I.offsetY) - l.top);
          w ? ((w = !1), e.h(A, p, r, q)) : ec(e, A, p, r, q);
        }
      }
      w
        ? e.assign(v)
        : u
        ? e.Gv(v.x, v.y, v.width, v.height)
        : ec(e, v.x, v.y, v.width, v.height);
      N.free(v);
      p = k.stretch;
      p === Uk && (p = jl(k, !1));
      switch (p) {
        case Ag:
          return;
        case vd:
          if (!isFinite(b) && !isFinite(c)) return;
          break;
        case Vk:
          if (!isFinite(b)) return;
          break;
        case Wk:
          if (!isFinite(c)) return;
      }
      p = k.measuredBounds;
      f = p.width;
      g = p.height;
      r = Math.max(f + m, 0);
      q = Math.max(g + n, 0);
      l = k.margin;
      v = N.allocAt(-l.left, -l.top, r, q);
      for (b = 0; b < h; b++)
        (c = d[b]),
          c === k ||
            (!c.visible && c !== y) ||
            ((l = c.margin),
            (r = l.right + l.left),
            (q = l.top + l.bottom),
            (p = c.measuredBounds),
            (r = Math.max(p.width + r, 0)),
            (q = Math.max(p.height + q, 0)),
            (m = c.alignment),
            m.Nb() && (m = a.defaultAlignment),
            m.cb() || (m = Ac),
            (c = c.alignmentFocus),
            c.Nb() && (c = Ac),
            w
              ? ((w = !1),
                e.h(
                  m.x * f + m.offsetX - (c.x * p.width + c.offsetX) - l.left,
                  m.y * g + m.offsetY - (c.y * p.height + c.offsetY) - l.top,
                  r,
                  q,
                ))
              : ec(
                  e,
                  m.x * f + m.offsetX - (c.x * p.width + c.offsetX) - l.left,
                  m.y * g + m.offsetY - (c.y * p.height + c.offsetY) - l.top,
                  r,
                  q,
                ));
      w
        ? e.assign(v)
        : u
        ? e.Gv(v.x, v.y, v.width, v.height)
        : ec(e, v.x, v.y, v.width, v.height);
      N.free(v);
    };
    ym.prototype.arrange = function (a, b, c) {
      var d = b.length,
        e = a.Ab(),
        f = e.measuredBounds,
        g = f.width;
      f = f.height;
      var h = a.padding,
        k = h.left;
      h = h.top;
      var l = k - c.x,
        m = h - c.y;
      e.arrange(l, m, g, f);
      for (var n = 0; n < d; n++) {
        var p = b[n];
        if (p !== e) {
          var r = p.measuredBounds,
            q = r.width;
          r = r.height;
          m = p.alignment;
          m.Nb() && (m = a.defaultAlignment);
          m.cb() || (m = Ac);
          var u = p.alignmentFocus;
          u.Nb() && (u = Ac);
          l = null;
          p instanceof X &&
            '' !== p.Jg &&
            ((l = p.Xa(p.Jg)), l === p && (l = null));
          if (null !== l) {
            var v = l.naturalBounds;
            for (
              u = H.allocAt(
                u.x * v.width - u.offsetX,
                u.y * v.height - u.offsetY,
              );
              l !== p;
  
            )
              l.transform.ra(u), (l = l.panel);
            l = m.x * g + m.offsetX - u.x;
            m = m.y * f + m.offsetY - u.y;
            H.free(u);
          } else
            (l = m.x * g + m.offsetX - (u.x * q + u.offsetX)),
              (m = m.y * f + m.offsetY - (u.y * r + u.offsetY));
          l -= c.x;
          m -= c.y;
          p.visible && p.arrange(k + l, h + m, q, r);
        }
      }
    };
    function zm() {
      this.name = 'Base';
      this.name = 'Auto';
    }
    la(zm, Nl);
    zm.prototype.measure = function (a, b, c, d, e, f, g) {
      var h = d.length,
        k = a.Ab(),
        l = k.margin,
        m = b,
        n = c,
        p = l.right + l.left,
        r = l.top + l.bottom;
      k.measure(b, c, f, g);
      l = k.measuredBounds;
      var q = 0,
        u = null;
      k instanceof W && ((u = k), (q = u.strokeWidth * u.scale));
      var v = Math.max(l.width + p, 0);
      l = Math.max(l.height + r, 0);
      var w = Am(k),
        y = w.x * v + w.offsetX;
      w = w.y * l + w.offsetY;
      var z = Bm(k),
        A = z.x * v + z.offsetX;
      z = z.y * l + z.offsetY;
      isFinite(b) && (m = Math.max(Math.abs(y - A) - q, 0));
      isFinite(c) && (n = Math.max(Math.abs(w - z) - q, 0));
      q = L.alloc();
      q.h(0, 0);
      a = vm(a);
      for (z = 0; z < h; z++)
        (w = d[z]),
          w === k ||
            (!w.visible && w !== a) ||
            ((l = w.margin),
            (v = l.right + l.left),
            (y = l.top + l.bottom),
            w.measure(m, n, 0, 0),
            (l = w.measuredBounds),
            (v = Math.max(l.width + v, 0)),
            (l = Math.max(l.height + y, 0)),
            q.h(Math.max(v, q.width), Math.max(l, q.height)));
      if (1 === h) (e.width = v), (e.height = l), L.free(q);
      else {
        w = Am(k);
        z = Bm(k);
        h = d = 0;
        z.x !== w.x &&
          z.y !== w.y &&
          ((d = q.width / Math.abs(z.x - w.x)),
          (h = q.height / Math.abs(z.y - w.y)));
        L.free(q);
        q = 0;
        null !== u &&
          ((q = u.strokeWidth * u.scale),
          Bg(u) === Cg && (d = h = Math.max(d, h)));
        d += Math.abs(w.offsetX) + Math.abs(z.offsetX) + q;
        h += Math.abs(w.offsetY) + Math.abs(z.offsetY) + q;
        u = k.stretch;
        u === Uk && (u = jl(k, !1));
        switch (u) {
          case Ag:
            g = f = 0;
            break;
          case vd:
            isFinite(b) && (d = b);
            isFinite(c) && (h = c);
            break;
          case Vk:
            isFinite(b) && (d = b);
            g = 0;
            break;
          case Wk:
            (f = 0), isFinite(c) && (h = c);
        }
        k.om();
        k.measure(d, h, f, g);
        e.width = k.measuredBounds.width + p;
        e.height = k.measuredBounds.height + r;
      }
    };
    zm.prototype.arrange = function (a, b) {
      var c = b.length,
        d = a.Ab(),
        e = d.measuredBounds,
        f = N.alloc();
      f.h(0, 0, 1, 1);
      var g = d.margin,
        h = g.left;
      g = g.top;
      var k = a.padding,
        l = k.left;
      k = k.top;
      d.arrange(l + h, k + g, e.width, e.height);
      var m = Am(d),
        n = Bm(d),
        p = m.y * e.height + m.offsetY,
        r = n.x * e.width + n.offsetX;
      n = n.y * e.height + n.offsetY;
      f.x = m.x * e.width + m.offsetX;
      f.y = p;
      ec(f, r, n, 0, 0);
      f.x += h + l;
      f.y += g + k;
      for (e = 0; e < c; e++)
        (h = b[e]),
          h !== d &&
            ((l = h.measuredBounds),
            (g = h.margin),
            (k = Math.max(l.width + g.right + g.left, 0)),
            (m = Math.max(l.height + g.top + g.bottom, 0)),
            (p = h.alignment),
            p.Nb() && (p = a.defaultAlignment),
            p.cb() || (p = Ac),
            (k = f.width * p.x + p.offsetX - k * p.x + g.left + f.x),
            (g = f.height * p.y + p.offsetY - m * p.y + g.top + f.y),
            h.visible &&
              (fc(f.x, f.y, f.width, f.height, k, g, l.width, l.height)
                ? h.arrange(k, g, l.width, l.height)
                : h.arrange(
                    k,
                    g,
                    l.width,
                    l.height,
                    new N(f.x, f.y, f.width, f.height),
                  )));
      N.free(f);
    };
    function Cm() {
      this.name = 'Base';
      this.name = 'Table';
    }
    la(Cm, Nl);
    Cm.prototype.measure = function (a, b, c, d, e, f, g) {
      for (var h = d.length, k = Ea(), l = Ea(), m = 0; m < h; m++) {
        var n = d[m],
          p = n instanceof X ? n : null;
        if (
          null === p ||
          (p.type !== X.TableRow && p.type !== X.TableColumn) ||
          !n.visible
        )
          k.push(n);
        else {
          l.push(p);
          for (var r = p.W.j, q = r.length, u = 0; u < q; u++) {
            var v = r[u];
            p.type === X.TableRow
              ? (v.row = n.row)
              : p.type === X.TableColumn && (v.column = n.column);
            k.push(v);
          }
        }
      }
      h = k.length;
      0 === h && (a.getRowDefinition(0), a.getColumnDefinition(0));
      for (var w = [], y = 0; y < h; y++) {
        var z = k[y];
        mj(z, !0);
        kl(z, !0);
        w[z.row] || (w[z.row] = []);
        w[z.row][z.column] || (w[z.row][z.column] = []);
        w[z.row][z.column].push(z);
      }
      Ha(k);
      var A = Ea(),
        C = Ea(),
        I = Ea(),
        P = { count: 0 },
        K = { count: 0 },
        V = b,
        Q = c,
        ca = a.rb;
      h = ca.length;
      for (var pa = 0; pa < h; pa++) {
        var M = ca[pa];
        void 0 !== M && (M.actual = 0);
      }
      ca = a.nb;
      h = ca.length;
      for (var xa = 0; xa < h; xa++) (M = ca[xa]), void 0 !== M && (M.actual = 0);
      for (var Ma = w.length, hb = 0, Fa = 0; Fa < Ma; Fa++)
        w[Fa] && (hb = Math.max(hb, w[Fa].length));
      var mb = Math.min(a.topIndex, Ma - 1),
        yd = Math.min(a.leftIndex, hb - 1),
        kb = 0;
      Ma = w.length;
      for (var bc = vm(a), Ya = 0; Ya < Ma; Ya++)
        if (w[Ya]) {
          hb = w[Ya].length;
          for (
            var Nd = a.getRowDefinition(Ya), wc = (Nd.actual = 0);
            wc < hb;
            wc++
          )
            if (w[Ya][wc]) {
              var Af = a.getColumnDefinition(wc);
              void 0 === A[wc] && ((Af.actual = 0), (A[wc] = !0));
              for (var Ze = w[Ya][wc], Ee = Ze.length, jh = 0; jh < Ee; jh++) {
                var Cc = Ze[jh];
                if (Cc.visible || Cc === bc) {
                  var Bf = 1 < Cc.rowSpan || 1 < Cc.columnSpan;
                  Bf && (Ya < mb || wc < yd || C.push(Cc));
                  var $e = Cc.margin,
                    Od = $e.right + $e.left,
                    Tj = $e.top + $e.bottom;
                  var Eb = Cl(Cc, Nd, Af, !1);
                  var Cf = Cc.desiredSize,
                    zd = !isNaN(Cf.height),
                    ic = !isNaN(Cf.width) && zd;
                  Bf ||
                    Eb === Ag ||
                    ic ||
                    Ya < mb ||
                    wc < yd ||
                    (void 0 !== P[wc] ||
                      (Eb !== vd && Eb !== Vk) ||
                      ((P[wc] = -1), P.count++),
                    void 0 !== K[Ya] ||
                      (Eb !== vd && Eb !== Wk) ||
                      ((K[Ya] = -1), K.count++),
                    I.push(Cc));
                  Cc.measure(Infinity, Infinity, 0, 0);
                  if (!(Ya < mb || wc < yd)) {
                    var af = Cc.measuredBounds,
                      Vc = Math.max(af.width + Od, 0),
                      dg = Math.max(af.height + Tj, 0);
                    if (1 === Cc.rowSpan && (Eb === Ag || Eb === Vk)) {
                      M = a.getRowDefinition(Ya);
                      var kh = M.tc();
                      kb = Math.max(dg - M.actual, 0);
                      kb + kh > Q && (kb = Math.max(Q - kh, 0));
                      var on = 0 === M.actual;
                      M.actual = M.actual + kb;
                      Q = Math.max(Q - (kb + (on ? kh : 0)), 0);
                    }
                    if (1 === Cc.columnSpan && (Eb === Ag || Eb === Wk)) {
                      M = a.getColumnDefinition(wc);
                      var eg = M.tc();
                      kb = Math.max(Vc - M.actual, 0);
                      kb + eg > V && (kb = Math.max(V - eg, 0));
                      var Uj = 0 === M.actual;
                      M.actual = M.actual + kb;
                      V = Math.max(V - (kb + (Uj ? eg : 0)), 0);
                    }
                    Bf && Cc.om();
                  }
                }
              }
            }
        }
      Ha(A);
      var Xb = 0,
        Oc = 0;
      h = a.columnCount;
      for (var cc = 0; cc < h; cc++) {
        var fg = a.nb[cc];
        void 0 !== fg && ((Xb += fg.ha), 0 !== fg.ha && (Xb += fg.tc()));
      }
      h = a.rowCount;
      for (var lh = 0; lh < h; lh++) {
        var bf = a.rb[lh];
        void 0 !== bf && ((Oc += bf.ha), 0 !== bf.ha && (Oc += bf.tc()));
      }
      V = Math.max(b - Xb, 0);
      var si = (Q = Math.max(c - Oc, 0)),
        he = V;
      h = I.length;
      for (var Fe = 0; Fe < h; Fe++) {
        var jc = I[Fe],
          Vj = a.getRowDefinition(jc.row),
          pn = a.getColumnDefinition(jc.column),
          gg = jc.measuredBounds,
          Rb = jc.margin,
          hg = Rb.right + Rb.left,
          Wj = Rb.top + Rb.bottom;
        P[jc.column] =
          0 === pn.actual && void 0 !== P[jc.column]
            ? Math.max(gg.width + hg, P[jc.column])
            : null;
        K[jc.row] =
          0 === Vj.actual && void 0 !== K[jc.row]
            ? Math.max(gg.height + Wj, K[jc.row])
            : null;
      }
      var ti = 0,
        ig = 0,
        Df;
      for (Df in K) 'count' !== Df && (ti += K[Df]);
      for (Df in P) 'count' !== Df && (ig += P[Df]);
      for (var ab = L.alloc(), jg = 0; jg < h; jg++) {
        var kc = I[jg];
        if (kc.visible || kc === bc) {
          var Dc = a.getRowDefinition(kc.row),
            bb = a.getColumnDefinition(kc.column),
            Ad = 0;
          isFinite(bb.width)
            ? (Ad = bb.width)
            : (isFinite(V) && null !== P[kc.column]
                ? 0 === ig
                  ? (Ad = bb.actual + V)
                  : (Ad = (P[kc.column] / ig) * he)
                : null !== P[kc.column]
                ? (Ad = V)
                : (Ad = bb.actual || V),
              (Ad = Math.max(0, Ad - bb.tc())));
          var Bd = 0;
          isFinite(Dc.height)
            ? (Bd = Dc.height)
            : (isFinite(Q) && null !== K[kc.row]
                ? 0 === ti
                  ? (Bd = Dc.actual + Q)
                  : (Bd = (K[kc.row] / ti) * si)
                : null !== K[kc.row]
                ? (Bd = Q)
                : (Bd = Dc.actual || Q),
              (Bd = Math.max(0, Bd - Dc.tc())));
          ab.h(
            Math.max(bb.minimum, Math.min(Ad, bb.maximum)),
            Math.max(Dc.minimum, Math.min(Bd, Dc.maximum)),
          );
          Eb = Cl(kc, Dc, bb, !1);
          switch (Eb) {
            case Vk:
              ab.height = Math.max(ab.height, Dc.actual + Q);
              break;
            case Wk:
              ab.width = Math.max(ab.width, bb.actual + V);
          }
          var Pd = kc.margin,
            qn = Pd.right + Pd.left,
            mh = Pd.top + Pd.bottom;
          kc.om();
          kc.measure(ab.width, ab.height, bb.minimum, Dc.minimum);
          var nh = kc.measuredBounds,
            oh = Math.max(nh.width + qn, 0),
            ph = Math.max(nh.height + mh, 0);
          isFinite(V) && (oh = Math.min(oh, ab.width));
          isFinite(Q) && (ph = Math.min(ph, ab.height));
          var kg = 0;
          kg = Dc.actual;
          Dc.actual = Math.max(Dc.actual, ph);
          kb = Dc.actual - kg;
          Q = Math.max(Q - kb, 0);
          kg = bb.actual;
          bb.actual = Math.max(bb.actual, oh);
          kb = bb.actual - kg;
          V = Math.max(V - kb, 0);
        }
      }
      Ha(I);
      var Cd = L.alloc(),
        Wc = Ea(),
        ie = Ea();
      h = C.length;
      if (0 !== h)
        for (var rb = 0; rb < Ma; rb++)
          if (w[rb]) {
            hb = w[rb].length;
            var ui = a.getRowDefinition(rb);
            Wc[rb] = ui.actual;
            for (var ld = 0; ld < hb; ld++)
              if (w[rb][ld]) {
                var rn = a.getColumnDefinition(ld);
                ie[ld] = rn.actual;
              }
          }
      for (var je = 0; je < h; je++) {
        var Na = C[je];
        if (Na.visible || Na === bc) {
          var Dd = a.getRowDefinition(Na.row),
            lc = a.getColumnDefinition(Na.column);
          ab.h(
            Math.max(lc.minimum, Math.min(b, lc.maximum)),
            Math.max(Dd.minimum, Math.min(c, Dd.maximum)),
          );
          Eb = Cl(Na, Dd, lc, !1);
          switch (Eb) {
            case vd:
              0 !== ie[lc.index] && (ab.width = Math.min(ab.width, ie[lc.index]));
              0 !== Wc[Dd.index] &&
                (ab.height = Math.min(ab.height, Wc[Dd.index]));
              break;
            case Vk:
              0 !== ie[lc.index] && (ab.width = Math.min(ab.width, ie[lc.index]));
              break;
            case Wk:
              0 !== Wc[Dd.index] &&
                (ab.height = Math.min(ab.height, Wc[Dd.index]));
          }
          isFinite(lc.width) && (ab.width = lc.width);
          isFinite(Dd.height) && (ab.height = Dd.height);
          Cd.h(0, 0);
          for (var Ge = 1; Ge < Na.rowSpan && !(Na.row + Ge >= a.rowCount); Ge++)
            (M = a.getRowDefinition(Na.row + Ge)),
              (kb = 0),
              (kb =
                Eb === vd || Eb === Wk
                  ? Math.max(
                      M.minimum,
                      0 === Wc[Na.row + Ge]
                        ? M.maximum
                        : Math.min(Wc[Na.row + Ge], M.maximum),
                    )
                  : Math.max(
                      M.minimum,
                      isNaN(M.Nc) ? M.maximum : Math.min(M.Nc, M.maximum),
                    )),
              (Cd.height += kb);
          for (
            var Ef = 1;
            Ef < Na.columnSpan && !(Na.column + Ef >= a.columnCount);
            Ef++
          )
            (M = a.getColumnDefinition(Na.column + Ef)),
              (kb = 0),
              (kb =
                Eb === vd || Eb === Vk
                  ? Math.max(
                      M.minimum,
                      0 === ie[Na.column + Ef]
                        ? M.maximum
                        : Math.min(ie[Na.column + Ef], M.maximum),
                    )
                  : Math.max(
                      M.minimum,
                      isNaN(M.Nc) ? M.maximum : Math.min(M.Nc, M.maximum),
                    )),
              (Cd.width += kb);
          ab.width += Cd.width;
          ab.height += Cd.height;
          var cf = Na.margin,
            Qd = cf.right + cf.left,
            He = cf.top + cf.bottom;
          Na.measure(ab.width, ab.height, f, g);
          for (
            var df = Na.measuredBounds,
              Ie = Math.max(df.width + Qd, 0),
              Je = Math.max(df.height + He, 0),
              md = 0,
              lg = 0;
            lg < Na.rowSpan && !(Na.row + lg >= a.rowCount);
            lg++
          )
            (M = a.getRowDefinition(Na.row + lg)), (md += M.total || 0);
          if (md < Je) {
            var ke = Je - md,
              sn = Je - md;
            if (null !== Na.spanAllocation)
              for (
                var tn = Na.spanAllocation, nd = 0;
                nd < Na.rowSpan && !(0 >= ke) && !(Na.row + nd >= a.rowCount);
                nd++
              ) {
                M = a.getRowDefinition(Na.row + nd);
                var mg = M.ha || 0,
                  un = tn(Na, M, sn);
                M.actual = Math.min(M.maximum, mg + un);
                M.ha !== mg && (ke -= M.ha - mg);
              }
            for (; 0 < ke; ) {
              var qh = M.ha || 0;
              isNaN(M.height) &&
                M.maximum > qh &&
                ((M.actual = Math.min(M.maximum, qh + ke)),
                M.ha !== qh && (ke -= M.ha - qh));
              if (0 === M.index) break;
              M = a.getRowDefinition(M.index - 1);
            }
          }
          for (
            var Xj = 0, Yj = 0;
            Yj < Na.columnSpan && !(Na.column + Yj >= a.columnCount);
            Yj++
          )
            (M = a.getColumnDefinition(Na.column + Yj)), (Xj += M.total || 0);
          if (Xj < Ie) {
            var vi = Ie - Xj,
              Kt = Ie - Xj;
            if (null !== Na.spanAllocation)
              for (
                var Lt = Na.spanAllocation, Zj = 0;
                Zj < Na.columnSpan &&
                !(0 >= vi) &&
                !(Na.column + Zj >= a.columnCount);
                Zj++
              ) {
                M = a.getColumnDefinition(Na.column + Zj);
                var vn = M.ha || 0,
                  Mt = Lt(Na, M, Kt);
                M.actual = Math.min(M.maximum, vn + Mt);
                M.ha !== vn && (vi -= M.ha - vn);
              }
            for (; 0 < vi; ) {
              var ak = M.ha || 0;
              isNaN(M.width) &&
                M.maximum > ak &&
                ((M.actual = Math.min(M.maximum, ak + vi)),
                M.ha !== ak && (vi -= M.ha - ak));
              if (0 === M.index) break;
              M = a.getColumnDefinition(M.index - 1);
            }
          }
        }
      }
      Ha(C);
      L.free(Cd);
      L.free(ab);
      void 0 !== Wc && Ha(Wc);
      void 0 !== ie && Ha(ie);
      var ng = 0,
        og = 0,
        bk = a.desiredSize,
        hr = a.maxSize;
      Eb = jl(a, !0);
      var wi = (Oc = Xb = 0),
        xi = 0;
      h = a.columnCount;
      for (var ck = 0; ck < h; ck++)
        void 0 !== a.nb[ck] &&
          ((M = a.getColumnDefinition(ck)),
          isFinite(M.width)
            ? ((wi += M.width), (wi += M.tc()))
            : Dm(M) === Em
            ? ((wi += M.ha), (wi += M.tc()))
            : 0 !== M.ha && ((Xb += M.ha), (Xb += M.tc())));
      isFinite(bk.width)
        ? (ng = Math.min(bk.width, hr.width))
        : (ng = Eb !== Ag && isFinite(b) ? b : Xb);
      ng = Math.max(ng, a.minSize.width);
      ng = Math.max(ng - wi, 0);
      for (var Nt = 0 === Xb ? 1 : Math.max(ng / Xb, 1), ek = 0; ek < h; ek++)
        void 0 !== a.nb[ek] &&
          ((M = a.getColumnDefinition(ek)),
          isFinite(M.width) || Dm(M) === Em || (M.actual = M.ha * Nt),
          (M.position = e.width),
          0 !== M.ha && ((e.width += M.ha), (e.width += M.tc())));
      h = a.rowCount;
      for (var fk = 0; fk < h; fk++)
        void 0 !== a.rb[fk] &&
          ((M = a.getRowDefinition(fk)),
          isFinite(M.height)
            ? ((xi += M.height), (xi += M.tc()))
            : Dm(M) === Em
            ? ((xi += M.ha), (xi += M.tc()))
            : 0 !== M.ha && ((Oc += M.ha), 0 !== M.ha && (Oc += M.tc())));
      isFinite(bk.height)
        ? (og = Math.min(bk.height, hr.height))
        : (og = Eb !== Ag && isFinite(c) ? c : Oc);
      og = Math.max(og, a.minSize.height);
      og = Math.max(og - xi, 0);
      for (var Ot = 0 === Oc ? 1 : Math.max(og / Oc, 1), gk = 0; gk < h; gk++)
        void 0 !== a.rb[gk] &&
          ((M = a.getRowDefinition(gk)),
          isFinite(M.height) || Dm(M) === Em || (M.actual = M.ha * Ot),
          (M.position = e.height),
          0 !== M.ha && ((e.height += M.ha), 0 !== M.ha && (e.height += M.tc())));
      h = l.length;
      for (var wn = 0; wn < h; wn++) {
        var od = l[wn],
          xn = 0,
          yn = 0;
        od.type === X.TableRow
          ? ((xn = e.width), (M = a.getRowDefinition(od.row)), (yn = M.actual))
          : ((M = a.getColumnDefinition(od.column)),
            (xn = M.actual),
            (yn = e.height));
        od.measuredBounds.h(0, 0, xn, yn);
        mj(od, !1);
        w[od.row] || (w[od.row] = []);
        w[od.row][od.column] || (w[od.row][od.column] = []);
        w[od.row][od.column].push(od);
      }
      Ha(l);
      a.qp = w;
    };
    Cm.prototype.arrange = function (a, b, c) {
      var d = b.length,
        e = a.padding,
        f = e.left;
      e = e.top;
      for (var g = a.qp, h, k, l = g.length, m = 0, n = 0; n < l; n++)
        g[n] && (m = Math.max(m, g[n].length));
      for (
        n = Math.min(a.topIndex, l - 1);
        n !== l && (void 0 === a.rb[n] || 0 === a.rb[n].ha);
  
      )
        n++;
      n = Math.min(n, l - 1);
      n = -a.rb[n].position;
      for (
        h = Math.min(a.leftIndex, m - 1);
        h !== m && (void 0 === a.nb[h] || 0 === a.nb[h].ha);
  
      )
        h++;
      h = Math.min(h, m - 1);
      for (var p = -a.nb[h].position, r = L.alloc(), q = 0; q < l; q++)
        if (g[q]) {
          m = g[q].length;
          var u = a.getRowDefinition(q);
          k = u.position + n + e;
          0 !== u.ha && (k += u.kv());
          for (var v = 0; v < m; v++)
            if (g[q][v]) {
              var w = a.getColumnDefinition(v);
              h = w.position + p + f;
              0 !== w.ha && (h += w.kv());
              for (var y = g[q][v], z = y.length, A = 0; A < z; A++) {
                var C = y[A],
                  I = C.measuredBounds,
                  P = C instanceof X ? C : null;
                if (
                  null === P ||
                  (P.type !== X.TableRow && P.type !== X.TableColumn)
                ) {
                  r.h(0, 0);
                  for (var K = 1; K < C.rowSpan && !(q + K >= a.rowCount); K++)
                    (P = a.getRowDefinition(q + K)), (r.height += P.total);
                  for (K = 1; K < C.columnSpan && !(v + K >= a.columnCount); K++)
                    (P = a.getColumnDefinition(v + K)), (r.width += P.total);
                  var V = w.ha + r.width,
                    Q = u.ha + r.height;
                  K = h;
                  P = k;
                  var ca = V,
                    pa = Q,
                    M = h,
                    xa = k,
                    Ma = V,
                    hb = Q;
                  h + V > c.width && (Ma = Math.max(c.width - h, 0));
                  k + Q > c.height && (hb = Math.max(c.height - k, 0));
                  var Fa = C.alignment;
                  if (Fa.Nb()) {
                    Fa = a.defaultAlignment;
                    Fa.cb() || (Fa = Ac);
                    var mb = Fa.x;
                    var yd = Fa.y;
                    var kb = Fa.offsetX;
                    Fa = Fa.offsetY;
                    var bc = w.alignment,
                      Ya = u.alignment;
                    bc.cb() && ((mb = bc.x), (kb = bc.offsetX));
                    Ya.cb() && ((yd = Ya.y), (Fa = Ya.offsetY));
                  } else
                    (mb = Fa.x),
                      (yd = Fa.y),
                      (kb = Fa.offsetX),
                      (Fa = Fa.offsetY);
                  if (isNaN(mb) || isNaN(yd)) (yd = mb = 0.5), (Fa = kb = 0);
                  bc = I.width;
                  Ya = I.height;
                  var Nd = C.margin,
                    wc = Nd.left + Nd.right,
                    Af = Nd.top + Nd.bottom,
                    Ze = Cl(C, u, w, !1);
                  !isNaN(C.desiredSize.width) ||
                    (Ze !== vd && Ze !== Vk) ||
                    (bc = Math.max(V - wc, 0));
                  !isNaN(C.desiredSize.height) ||
                    (Ze !== vd && Ze !== Wk) ||
                    (Ya = Math.max(Q - Af, 0));
                  V = C.maxSize;
                  Q = C.minSize;
                  bc = Math.min(V.width, bc);
                  Ya = Math.min(V.height, Ya);
                  bc = Math.max(Q.width, bc);
                  Ya = Math.max(Q.height, Ya);
                  V = Ya + Af;
                  K += ca * mb - (bc + wc) * mb + kb + Nd.left;
                  P += pa * yd - V * yd + Fa + Nd.top;
                  C.visible &&
                    (fc(M, xa, Ma, hb, K, P, I.width, I.height)
                      ? C.arrange(K, P, bc, Ya)
                      : C.arrange(K, P, bc, Ya, new N(M, xa, Ma, hb)));
                } else
                  C.nl(),
                    C.actualBounds.ea(),
                    (ca = C.actualBounds),
                    (K = N.allocAt(ca.x, ca.y, ca.width, ca.height)),
                    (ca.x = P.type === X.TableRow ? f : h),
                    (ca.y = P.type === X.TableColumn ? e : k),
                    (ca.width = I.width),
                    (ca.height = I.height),
                    C.actualBounds.freeze(),
                    kl(C, !1),
                    Zb(K, ca) || ((I = C.part), null !== I && (I.Kh(), C.So(I))),
                    N.free(K);
              }
            }
        }
      L.free(r);
      for (a = 0; a < d; a++)
        (c = b[a]),
          (f = c instanceof X ? c : null),
          null === f ||
            (f.type !== X.TableRow && f.type !== X.TableColumn) ||
            ((f = c.actualBounds),
            c.naturalBounds.ea(),
            c.naturalBounds.h(0, 0, f.width, f.height),
            c.naturalBounds.freeze());
    };
    function Fm() {
      this.name = 'Base';
      this.name = 'TableRow';
    }
    la(Fm, Nl);
    Fm.prototype.measure = function () {};
    Fm.prototype.arrange = function () {};
    function Gm() {
      this.name = 'Base';
      this.name = 'TableColumn';
    }
    la(Gm, Nl);
    Gm.prototype.measure = function () {};
    Gm.prototype.arrange = function () {};
    function Hm() {
      this.name = 'Base';
      this.name = 'Viewbox';
    }
    la(Hm, Nl);
    Hm.prototype.measure = function (a, b, c, d, e, f, g) {
      1 < d.length &&
        B('Viewbox Panel cannot contain more than one GraphObject.');
      d = d[0];
      d.ya = 1;
      d.om();
      d.measure(Infinity, Infinity, f, g);
      var h = d.measuredBounds,
        k = d.margin,
        l = k.right + k.left;
      k = k.top + k.bottom;
      if (isFinite(b) || isFinite(c)) {
        var m = d.scale,
          n = h.width;
        h = h.height;
        var p = Math.max(b - l, 0),
          r = Math.max(c - k, 0),
          q = 1;
        a.viewboxStretch === Cg
          ? 0 !== n && 0 !== h && (q = Math.min(p / n, r / h))
          : 0 !== n && 0 !== h && (q = Math.max(p / n, r / h));
        0 === q && (q = 1e-4);
        d.ya *= q;
        m !== d.scale && (mj(d, !0), d.measure(Infinity, Infinity, f, g));
      }
      h = d.measuredBounds;
      e.width = isFinite(b) ? b : Math.max(h.width + l, 0);
      e.height = isFinite(c) ? c : Math.max(h.height + k, 0);
    };
    Hm.prototype.arrange = function (a, b, c) {
      b = b[0];
      var d = b.measuredBounds,
        e = b.margin,
        f = Math.max(d.width + (e.right + e.left), 0);
      e = Math.max(d.height + (e.top + e.bottom), 0);
      var g = b.alignment;
      g.Nb() && (g = a.defaultAlignment);
      g.cb() || (g = Ac);
      b.arrange(
        c.width * g.x - f * g.x + g.offsetX,
        c.height * g.y - e * g.y + g.offsetY,
        d.width,
        d.height,
      );
    };
    function Im() {
      this.name = 'Base';
      this.name = 'Grid';
    }
    la(Im, Nl);
    Im.prototype.measure = function () {};
    Im.prototype.arrange = function () {};
    Im.prototype.tb = function (a, b, c) {
      c = a.tf() * c.scale;
      0 >= c && (c = 1);
      var d = a.gridCellSize,
        e = d.width;
      d = d.height;
      var f = a.naturalBounds,
        g = a.actualBounds,
        h = f.width,
        k = f.height,
        l = Math.ceil(h / e),
        m = Math.ceil(k / d),
        n = a.gridOrigin;
      b.save();
      b.beginPath();
      b.rect(0, 0, h, k);
      b.clip();
      for (var p = [], r = a.W.j, q = r.length, u = 0; u < q; u++) {
        var v = r[u],
          w = [];
        p.push(w);
        if (v.visible) {
          v = hk(v.figure);
          for (var y = u + 1; y < q; y++) {
            var z = r[y];
            z.visible &&
              hk(z.figure) === v &&
              ((z = z.interval), 2 <= z && w.push(z));
          }
        }
      }
      r = a.W.j;
      q = r.length;
      for (u = 0; u < q; u++) {
        var A = r[u];
        if (A.visible && ((w = A.interval), !(2 > e * w * c))) {
          v = A.opacity;
          y = 1;
          if (1 !== v) {
            if (0 === v) continue;
            y = b.globalAlpha;
            b.globalAlpha = y * v;
          }
          z = p[u];
          var C = !1,
            I = A.strokeDashArray;
          null !== I && ((C = !0), b.gt(I, A.strokeDashOffset));
          if ('LineV' === A.figure && null !== A.stroke) {
            b.lineWidth = A.strokeWidth;
            ji(a, b, A.stroke, !1, !1, f, g);
            b.beginPath();
            // 2.5D网格
            if (r[u].angle) {
              for (I = A = Math.floor(-n.x / e); I <= (A + l) * 3; I++) {
                var P = I * e + n.x - h;
                -h <= P &&
                  P <= 2 * h &&
                  Jm(I, w, z) &&
                  (b.moveTo(P, 0),
                  b.lineTo(P - k * Math.tan((r[u].angle / 180) * Math.PI), k));
              }
            } else {
              for (I = A = Math.floor(-n.x / e); I <= A + l; I++) {
                var P = I * e + n.x;
                0 <= P &&
                  P <= h &&
                  Jm(I, w, z) &&
                  (b.moveTo(P, 0), b.lineTo(P, k));
              }
            }
            b.stroke();
          } else if ('LineH' === A.figure && null !== A.stroke) {
            b.lineWidth = A.strokeWidth;
            ji(a, b, A.stroke, !1, !1, f, g);
            b.beginPath();
            // 2.5D网格
            if (r[u].angle) {
              for (I = A = Math.floor(-n.x / e); I <= (A + l) * 3; I++) {
                var P = I * e + n.x - h;
                -h <= P &&
                  P <= 2 * h &&
                  Jm(I, w, z) &&
                  (b.moveTo(P, 0),
                  b.lineTo(P - k * Math.tan((r[u].angle / 180) * Math.PI), k));
              }
            } else {
              for (I = A = Math.floor(-n.y / d); I <= A + m; I++)
                (P = I * d + n.y),
                  0 <= P &&
                    P <= k &&
                    Jm(I, w, z) &&
                    (b.moveTo(0, P), b.lineTo(h, P));
            }
            b.stroke();
          } else if ('BarV' === A.figure && null !== A.fill)
            for (
              ji(a, b, A.fill, !0, !1, f, g),
                A = A.width,
                isNaN(A) && (A = e),
                P = I = Math.floor(-n.x / e);
              P <= I + l;
              P++
            ) {
              var K = P * e + n.x;
              0 <= K && K <= h && Jm(P, w, z) && b.fillRect(K, 0, A, k);
            }
          else if ('BarH' === A.figure && null !== A.fill)
            for (
              ji(a, b, A.fill, !0, !1, f, g),
                A = A.height,
                isNaN(A) && (A = d),
                P = I = Math.floor(-n.y / d);
              P <= I + m;
              P++
            )
              (K = P * d + n.y),
                0 <= K && K <= k && Jm(P, w, z) && b.fillRect(0, K, h, A);
          C && b.et();
          1 !== v && (b.globalAlpha = y);
        }
      }
      b.restore();
      b.Qc(!1);
    };
    function Jm(a, b, c) {
      if (0 !== a % b) return !1;
      b = c.length;
      for (var d = 0; d < b; d++) if (0 === a % c[d]) return !1;
      return !0;
    }
    function Km() {
      this.name = 'Base';
      this.name = 'Link';
    }
    la(Km, Nl);
    Km.prototype.measure = function (a, b, c, d, e) {
      c = d.length;
      if (a instanceof Ce || a instanceof S) {
        var f = null,
          g = null,
          h = null;
        a instanceof S && (g = f = a);
        a instanceof Ce && ((h = a), (f = h.adornedPart));
        if (f instanceof S) {
          var k = f;
          if (0 === c) Vb(a.naturalBounds, 0, 0), a.measuredBounds.h(0, 0, 0, 0);
          else {
            var l = a instanceof Ce ? null : f.path,
              m = f.routeBounds;
            b = a.vg;
            b.h(0, 0, m.width, m.height);
            var n = k.points;
            f = f.pointsCount;
            null !== h ? h.pk(!1) : null !== g && g.pk(!1);
            var p = m.width,
              r = m.height;
            a.location.h(m.x, m.y);
            a.l.length = 0;
            null !== l &&
              (Lm(a, p, r, l), (h = l.measuredBounds), b.Gc(h), a.l.push(h));
            h = rd.alloc();
            for (var q = H.alloc(), u = H.alloc(), v = 0; v < c; v++) {
              var w = d[v];
              if (w !== l)
                if (w.isPanelMain && w instanceof W) {
                  Lm(a, p, r, w);
                  var y = w.measuredBounds;
                  b.Gc(y);
                  a.l.push(y);
                } else if (2 > f)
                  w.measure(Infinity, Infinity, 0, 0),
                    (y = w.measuredBounds),
                    b.Gc(y),
                    a.l.push(y);
                else {
                  var z = w.segmentIndex,
                    A = w.segmentFraction,
                    C = w.alignmentFocus;
                  C.kc() && (C = Ac);
                  var I = w.segmentOrientation,
                    P = w.segmentOffset;
                  if (isNaN(z)) {
                    var K = k.ka;
                    y = Ea();
                    K.Cv(A, y);
                    var V = H.allocAt(y[0], y[1]);
                    V.add(k.i(0));
                    K.type === wd
                      ? V.offset(-K.startX, -K.startY)
                      : ((K = K.figures.first()), V.offset(-K.startX, -K.startY));
                    K = y[2];
                    if (I !== cg) {
                      var Q = k.computeAngle(w, I, K);
                      w.Zb = Q;
                    }
                    Q = V.x - m.x;
                    var ca = V.y - m.y;
                    H.free(V);
                    Ha(y);
                  } else if (z < -f || z >= f)
                    (ca = k.midPoint),
                      (K = k.midAngle),
                      I !== cg && ((Q = k.computeAngle(w, I, K)), (w.Zb = Q)),
                      (Q = ca.x - m.x),
                      (ca = ca.y - m.y);
                  else {
                    Q = 0;
                    0 <= z
                      ? ((ca = n.L(z)), (y = z < f - 1 ? n.L(z + 1) : ca))
                      : ((Q = f + z),
                        (ca = n.L(Q)),
                        (y = 0 < Q ? n.L(Q - 1) : ca));
                    if (ca.Ma(y)) {
                      0 <= z
                        ? ((K = 0 < z ? n.L(z - 1) : ca),
                          (Q = z < f - 2 ? n.L(z + 2) : y))
                        : ((K = Q < f - 1 ? n.L(Q + 1) : ca),
                          (Q = 1 < Q ? n.L(Q - 2) : y));
                      V = K.Ae(ca);
                      var pa = y.Ae(Q);
                      K =
                        V > pa + 10
                          ? 0 <= z
                            ? K.Ta(ca)
                            : ca.Ta(K)
                          : pa > V + 10
                          ? 0 <= z
                            ? y.Ta(Q)
                            : Q.Ta(y)
                          : 0 <= z
                          ? K.Ta(Q)
                          : Q.Ta(K);
                    } else K = 0 <= z ? ca.Ta(y) : y.Ta(ca);
                    I !== cg && ((Q = k.computeAngle(w, I, K)), (w.Zb = Q));
                    Q = ca.x + (y.x - ca.x) * A - m.x;
                    ca = ca.y + (y.y - ca.y) * A - m.y;
                  }
                  w.measure(Infinity, Infinity, 0, 0);
                  y = w.measuredBounds;
                  V = w.naturalBounds;
                  var M = 0;
                  w instanceof W && (M = w.strokeWidth);
                  pa = V.width + M;
                  var xa = V.height + M;
                  h.reset();
                  h.translate(-y.x, -y.y);
                  h.scale(w.scale, w.scale);
                  h.rotate(I === cg ? w.angle : K, pa / 2, xa / 2);
                  (I !== Mm && I !== Nm) || h.rotate(90, pa / 2, xa / 2);
                  (I !== Om && I !== Pm) || h.rotate(-90, pa / 2, xa / 2);
                  I === Qm &&
                    ((45 < K && 135 > K) || (225 < K && 315 > K)) &&
                    h.rotate(-K, pa / 2, xa / 2);
                  V = new N(0, 0, pa, xa);
                  q.cj(V, C);
                  h.ra(q);
                  C = -q.x + (M / 2) * w.scale;
                  w = -q.y + (M / 2) * w.scale;
                  u.assign(P);
                  M = isNaN(P.x);
                  var Ma = isNaN(P.y);
                  if (M || Ma) {
                    pa = pa / 2 + 3;
                    xa = xa / 2 + 3;
                    var hb = 45 <= K && 135 >= K,
                      Fa = 225 <= K && 315 >= K;
                    I === cg && (hb || Fa)
                      ? ((u.x = Ma ? pa : P.y),
                        (u.y = M ? xa : P.x),
                        hb
                          ? 0 <= z || (isNaN(z) && 0.5 > A) || !M || (u.y = -xa)
                          : Fa &&
                            ((0 <= z || (isNaN(z) && 0.5 > A)) &&
                              M &&
                              (u.y = -xa),
                            Ma && (u.x = -pa)))
                      : (M && (u.x = 0 <= z || (isNaN(z) && 0.5 > A) ? pa : -pa),
                        Ma && (u.y = -xa),
                        u.rotate(K));
                  } else u.rotate(K);
                  Q += u.x;
                  ca += u.y;
                  V.set(y);
                  V.h(Q + C, ca + w, y.width, y.height);
                  a.l.push(V);
                  b.Gc(V);
                }
            }
            if (null !== g)
              for (d = g.labelNodes; d.next(); )
                d.value.measure(Infinity, Infinity);
            a.vg = b;
            a = a.location;
            a.h(a.x + b.x, a.y + b.y);
            Vb(e, b.width || 0, b.height || 0);
            rd.free(h);
            H.free(q);
            H.free(u);
          }
        }
      }
    };
    Km.prototype.arrange = function (a, b) {
      var c = b.length;
      if (a instanceof Ce || a instanceof S) {
        var d = null,
          e = null,
          f = null;
        a instanceof S && (e = d = a);
        a instanceof Ce && ((f = a), (d = f.adornedPart));
        var g = a instanceof Ce ? null : d.path;
        if (0 !== a.l.length) {
          var h = a.l,
            k = 0;
          if (null !== g && k < a.l.length) {
            var l = h[k];
            k++;
            g.arrange(l.x - a.vg.x, l.y - a.vg.y, l.width, l.height);
          }
          for (l = 0; l < c; l++) {
            var m = b[l];
            if (m !== g && k < a.l.length) {
              var n = h[k];
              k++;
              m.arrange(n.x - a.vg.x, n.y - a.vg.y, n.width, n.height);
            }
          }
        }
        b = d.points;
        c = b.count;
        if (2 <= c && a instanceof S)
          for (d = a.labelNodes; d.next(); ) {
            var p = a;
            g = d.value;
            h = g.segmentIndex;
            k = g.segmentFraction;
            var r = g.alignmentFocus;
            l = g.segmentOrientation;
            m = g.segmentOffset;
            if (isNaN(h)) {
              n = p.ka;
              var q = Ea();
              n.Cv(k, q);
              var u = H.allocAt(q[0], q[1]);
              u.add(p.i(0));
              n.type === wd
                ? u.offset(-n.startX, -n.startY)
                : ((n = n.figures.first()), u.offset(-n.startX, -n.startY));
              n = q[2];
              l !== cg && ((p = p.computeAngle(g, l, n)), (g.angle = p));
              p = u.x;
              var v = u.y;
              H.free(u);
              Ha(q);
            } else if (h < -c || h >= c)
              (v = p.midPoint),
                (n = p.midAngle),
                l !== cg && ((p = p.computeAngle(g, l, n)), (g.angle = p)),
                (p = v.x),
                (v = v.y);
            else {
              u = 0;
              0 <= h
                ? ((q = b.j[h]), (v = h < c - 1 ? b.j[h + 1] : q))
                : ((u = c + h), (q = b.j[u]), (v = 0 < u ? b.j[u - 1] : q));
              if (q.Ma(v)) {
                0 <= h
                  ? ((n = 0 < h ? b.j[h - 1] : q),
                    (u = h < c - 2 ? b.j[h + 2] : v))
                  : ((n = u < c - 1 ? b.j[u + 1] : q),
                    (u = 1 < u ? b.j[u - 2] : v));
                var w = n.Ae(q),
                  y = v.Ae(u);
                n =
                  w > y + 10
                    ? 0 <= h
                      ? n.Ta(q)
                      : q.Ta(n)
                    : y > w + 10
                    ? 0 <= h
                      ? v.Ta(u)
                      : u.Ta(v)
                    : 0 <= h
                    ? n.Ta(u)
                    : u.Ta(n);
              } else n = 0 <= h ? q.Ta(v) : v.Ta(q);
              l !== cg && ((p = p.computeAngle(g, l, n)), (g.angle = p));
              p = q.x + (v.x - q.x) * k;
              v = q.y + (v.y - q.y) * k;
            }
            if (r.wt()) g.location = new H(p, v);
            else {
              r.kc() && (r = Ac);
              q = rd.alloc();
              q.reset();
              q.scale(g.scale, g.scale);
              q.rotate(g.angle, 0, 0);
              var z = g.naturalBounds;
              u = N.allocAt(0, 0, z.width, z.height);
              w = H.alloc();
              w.cj(u, r);
              q.ra(w);
              r = -w.x;
              y = -w.y;
              var A = z.width,
                C = z.height;
              z = H.alloc();
              z.assign(m);
              var I = isNaN(m.x),
                P = isNaN(m.y);
              if (I || P) {
                A = A / 2 + 3;
                C = C / 2 + 3;
                var K = 45 <= n && 135 >= n,
                  V = 225 <= n && 315 >= n;
                l === cg && (K || V)
                  ? ((z.x = P ? A : m.y),
                    (z.y = I ? C : m.x),
                    K
                      ? 0 <= h || (isNaN(h) && 0.5 > k) || !I || (z.y = -C)
                      : V &&
                        ((0 <= h || (isNaN(h) && 0.5 > k)) && I && (z.y = -C),
                        P && (z.x = -A)))
                  : (I && (z.x = 0 <= h || (isNaN(h) && 0.5 > k) ? A : -A),
                    P && (z.y = -C),
                    z.rotate(n));
              } else z.rotate(n);
              p += z.x;
              v += z.y;
              q.tw(u);
              r += u.x;
              y += u.y;
              h = H.allocAt(p + r, v + y);
              g.move(h);
              H.free(h);
              H.free(z);
              H.free(w);
              N.free(u);
              rd.free(q);
            }
          }
        null !== f ? f.pk(!1) : null !== e && e.pk(!1);
      }
    };
    function Lm(a, b, c, d) {
      if (!1 !== rj(d)) {
        var e = d.strokeWidth;
        0 === e &&
          a instanceof Ce &&
          a.type === X.Link &&
          a.adornedObject instanceof W &&
          (e = a.adornedObject.strokeWidth);
        e *= d.ya;
        a instanceof S && null !== a.ka
          ? ((a = a.ka.bounds),
            gl(d, a.x - e / 2, a.y - e / 2, a.width + e, a.height + e))
          : a instanceof Ce && null !== a.adornedPart.ka
          ? ((a = a.adornedPart.ka.bounds),
            gl(d, a.x - e / 2, a.y - e / 2, a.width + e, a.height + e))
          : gl(d, -(e / 2), -(e / 2), b + e, c + e);
        mj(d, !1);
      }
    }
    function Rm() {
      this.name = 'Base';
      this.name = 'Graduated';
    }
    la(Rm, Nl);
    Rm.prototype.measure = function (a, b, c, d, e, f, g) {
      var h = a.Ab();
      a.Zg = [];
      var k = h.margin,
        l = k.right + k.left,
        m = k.top + k.bottom;
      h.measure(b, c, f, g);
      var n = h.measuredBounds,
        p = new N(
          -k.left,
          -k.top,
          Math.max(n.width + l, 0),
          Math.max(n.height + m, 0),
        );
      a.Zg.push(p);
      e.assign(p);
      for (
        var r = h.geometry,
          q = h.strokeWidth,
          u = r.flattenedSegments,
          v = r.flattenedLengths,
          w = r.flattenedTotalLength,
          y = u.length,
          z = 0,
          A = 0,
          C = Ea(),
          I = 0;
        I < y;
        I++
      ) {
        var P = u[I],
          K = [];
        A = z = 0;
        for (var V = P.length, Q = 0; Q < V; Q += 2) {
          var ca = P[Q],
            pa = P[Q + 1];
          if (0 !== Q) {
            var M = (180 * Math.atan2(pa - A, ca - z)) / Math.PI;
            0 > M && (M += 360);
            K.push(M);
          }
          z = ca;
          A = pa;
        }
        C.push(K);
      }
      if (null === a.$g) {
        for (var xa = [], Ma = a.W.j, hb = Ma.length, Fa = 0; Fa < hb; Fa++) {
          var mb = Ma[Fa],
            yd = [];
          xa.push(yd);
          if (mb.visible)
            for (var kb = mb.interval, bc = 0; bc < hb; bc++) {
              var Ya = Ma[bc];
              if (
                Ya.visible &&
                mb !== Ya &&
                !(
                  (mb instanceof W && !(Ya instanceof W)) ||
                  (mb instanceof Xg && !(Ya instanceof Xg))
                )
              ) {
                var Nd = Ya.interval;
                Nd > kb && yd.push(Nd);
              }
            }
        }
        a.$g = xa;
      }
      var wc = a.$g;
      var Af = a.W.j,
        Ze = Af.length,
        Ee = 0,
        jh = 0,
        Cc = w;
      a.uj = [];
      for (var Bf, $e = 0; $e < Ze; $e++) {
        var Od = Af[$e];
        Bf = [];
        if (Od.visible && Od !== h) {
          var Tj = Od.interval,
            Eb = a.graduatedTickUnit;
          if (!(2 > (Eb * Tj * w) / a.graduatedRange)) {
            var Cf = v[0][0],
              zd = 0,
              ic = 0;
            jh = w * Od.graduatedStart - 1e-4;
            Cc = w * Od.graduatedEnd + 1e-4;
            var af = Eb * Tj,
              Vc = a.graduatedTickBase;
            if (Vc < a.graduatedMin) {
              var dg = (a.graduatedMin - Vc) / af;
              dg = 0 === dg % 1 ? dg : Math.floor(dg + 1);
              Vc += dg * af;
            } else
              Vc > a.graduatedMin + af &&
                (Vc -= Math.floor((Vc - a.graduatedMin) / af) * af);
            for (var kh = wc[$e]; Vc <= a.graduatedMax; ) {
              a: {
                for (var on = kh.length, eg = 0; eg < on; eg++)
                  if (
                    J.$(
                      (Vc - a.graduatedTickBase) % (kh[eg] * a.graduatedTickUnit),
                      0,
                    )
                  ) {
                    var Uj = !1;
                    break a;
                  }
                Uj = !0;
              }
              if (
                Uj &&
                (null === Od.graduatedSkip || !Od.graduatedSkip(Vc)) &&
                ((Ee = ((Vc - a.graduatedMin) * w) / a.graduatedRange),
                Ee > w && (Ee = w),
                jh <= Ee && Ee <= Cc)
              ) {
                for (var Xb = C[zd][ic], Oc = v[zd][ic]; zd < v.length; ) {
                  for (; Ee > Cf && ic < v[zd].length - 1; )
                    ic++, (Xb = C[zd][ic]), (Oc = v[zd][ic]), (Cf += Oc);
                  if (Ee <= Cf) break;
                  zd++;
                  ic = 0;
                  Xb = C[zd][ic];
                  Oc = v[zd][ic];
                  Cf += Oc;
                }
                var cc = u[zd],
                  fg = cc[2 * ic],
                  lh = cc[2 * ic + 1],
                  bf = (Ee - (Cf - Oc)) / Oc,
                  si = new H(
                    fg + (cc[2 * ic + 2] - fg) * bf + q / 2 - r.bounds.x,
                    lh + (cc[2 * ic + 3] - lh) * bf + q / 2 - r.bounds.y,
                  );
                si.scale(h.scale, h.scale);
                var he = Xb,
                  Fe = C[zd];
                1e-4 > bf
                  ? 0 < ic
                    ? (he = Fe[ic - 1])
                    : J.$(cc[0], cc[cc.length - 2]) &&
                      J.$(cc[1], cc[cc.length - 1]) &&
                      (he = Fe[Fe.length - 1])
                  : 0.9999 < bf &&
                    (ic + 1 < Fe.length
                      ? (he = Fe[ic + 1])
                      : J.$(cc[0], cc[cc.length - 2]) &&
                        J.$(cc[1], cc[cc.length - 1]) &&
                        (he = Fe[0]));
                Xb !== he &&
                  (180 < Math.abs(Xb - he) &&
                    (Xb < he ? (Xb += 360) : (he += 360)),
                  (Xb = ((Xb + he) / 2) % 360));
                if (Od instanceof Xg) {
                  var jc = '';
                  null !== Od.graduatedFunction
                    ? ((jc = Od.graduatedFunction(Vc)),
                      (jc = null !== jc && void 0 !== jc ? jc.toString() : ''))
                    : (jc = (+Vc.toFixed(2)).toString());
                  '' !== jc && Bf.push({ xm: si, angle: Xb, text: jc });
                } else
                  Bf.push({
                    xm: si,
                    angle: Xb,
                  });
              }
              Vc += af;
            }
          }
        }
        a.uj.push(Bf);
      }
      Ha(C);
      var Vj = a.uj;
      if (null !== Vj)
        for (var pn = d.length, gg = 0; gg < pn; gg++) {
          var Rb = d[gg],
            hg = Vj[gg];
          if (Rb.visible && Rb !== h && 0 !== hg.length) {
            if (Rb instanceof W) {
              var Wj = a,
                ti = e,
                ig = Rb.alignmentFocus;
              ig.kc() && (ig = xc);
              var Df = Rb.angle;
              Rb.Zb = 0;
              Rb.measure(Infinity, Infinity, 0, 0);
              Rb.Zb = Df;
              var ab = Rb.measuredBounds,
                jg = ab.width,
                kc = ab.height,
                Dc = N.allocAt(0, 0, jg, kc),
                bb = H.alloc();
              bb.cj(Dc, ig);
              N.free(Dc);
              for (
                var Ad = -bb.x, Bd = -bb.y, Pd = new N(), qn = hg.length, mh = 0;
                mh < qn;
                mh++
              )
                for (
                  var nh = hg[mh],
                    oh = nh.xm.x,
                    ph = nh.xm.y,
                    kg = nh.angle,
                    Cd = 0;
                  4 > Cd;
                  Cd++
                ) {
                  switch (Cd) {
                    case 0:
                      bb.h(Ad, Bd);
                      break;
                    case 1:
                      bb.h(Ad + jg, Bd);
                      break;
                    case 2:
                      bb.h(Ad, Bd + kc);
                      break;
                    case 3:
                      bb.h(Ad + jg, Bd + kc);
                  }
                  bb.rotate(kg + Rb.angle);
                  bb.offset(oh, ph);
                  0 === mh && 0 === Cd ? Pd.h(bb.x, bb.y, 0, 0) : Pd.Ge(bb);
                  bb.offset(-oh, -ph);
                  bb.rotate(-kg - Rb.angle);
                }
              H.free(bb);
              null !== Wj.Zg && Wj.Zg.push(Pd);
              ec(ti, Pd.x, Pd.y, Pd.width, Pd.height);
            } else if (Rb instanceof Xg) {
              var Wc = a,
                ie = e;
              null === Wc.wh && (Wc.wh = new Xg());
              var rb = Wc.wh;
              Sm(rb, Rb);
              var ui = Rb.alignmentFocus;
              ui.kc() && (ui = xc);
              for (
                var ld = Rb.segmentOrientation,
                  rn = Rb.segmentOffset,
                  je = new N(),
                  Na = 0,
                  Dd = 0,
                  lc = 0,
                  Ge = 0,
                  Ef = hg.length,
                  cf = 0;
                cf < Ef;
                cf++
              ) {
                var Qd = hg[cf];
                Na = Qd.xm.x;
                Dd = Qd.xm.y;
                lc = Qd.angle;
                ld !== cg && ((Ge = S.computeAngle(ld, lc)), (rb.Zb = Ge));
                rb.text = Qd.text || '';
                rb.measure(Infinity, Infinity, 0, 0);
                var He = rb.measuredBounds,
                  df = rb.naturalBounds,
                  Ie = df.width,
                  Je = df.height,
                  md = rd.alloc();
                md.reset();
                md.translate(-He.x, -He.y);
                md.scale(rb.scale, rb.scale);
                md.rotate(ld === cg ? rb.angle : lc, Ie / 2, Je / 2);
                (ld !== Mm && ld !== Nm) || md.rotate(90, Ie / 2, Je / 2);
                (ld !== Om && ld !== Pm) || md.rotate(-90, Ie / 2, Je / 2);
                ld === Qm &&
                  ((45 < lc && 135 > lc) || (225 < lc && 315 > lc)) &&
                  md.rotate(-lc, Ie / 2, Je / 2);
                var lg = N.allocAt(0, 0, Ie, Je),
                  ke = H.alloc();
                ke.cj(lg, ui);
                md.ra(ke);
                var sn = -ke.x,
                  tn = -ke.y,
                  nd = H.alloc();
                nd.assign(rn);
                isNaN(nd.x) && (nd.x = Ie / 2 + 3);
                isNaN(nd.y) && (nd.y = -(Je / 2 + 3));
                nd.rotate(lc);
                Na += nd.x + sn;
                Dd += nd.y + tn;
                var mg = new N(Na, Dd, He.width, He.height),
                  un = new N(He.x, He.y, He.width, He.height),
                  qh = new N(df.x, df.y, df.width, df.height);
                Qd.aA = Ge;
                Qd.lineCount = rb.lineCount;
                Qd.lines = [rb.qb, rb.ti, rb.ie, rb.ve, rb.Pb, rb.fb, rb.ge];
                Qd.actualBounds = mg;
                Qd.measuredBounds = un;
                Qd.naturalBounds = qh;
                0 === cf ? je.assign(mg) : je.Gc(mg);
                H.free(nd);
                H.free(ke);
                N.free(lg);
                rd.free(md);
              }
              null !== Wc.Zg && Wc.Zg.push(je);
              ec(ie, je.x, je.y, je.width, je.height);
            }
            mj(Rb, !1);
          }
        }
    };
    Rm.prototype.arrange = function (a, b, c) {
      if (null !== a.Zg) {
        var d = a.Ab(),
          e = a.uj;
        if (null !== e) {
          var f = a.Zg,
            g = 0,
            h = f[g];
          g++;
          null !== d && d.arrange(h.x - c.x, h.y - c.y, h.width, h.height);
          for (var k = b.length, l = 0; l < k; l++) {
            var m = b[l];
            h = e[l];
            m.visible &&
              m !== d &&
              0 !== h.length &&
              ((h = f[g]),
              g++,
              m.arrange(h.x - c.x, h.y - c.y, h.width, h.height));
          }
          a.Zg = null;
        }
      }
    };
    Rm.prototype.tb = function (a, b, c) {
      var d = c.ni;
      c.ni = !0;
      var e = a.naturalBounds,
        f = e.width;
      e = e.height;
      b.save();
      b.beginPath();
      b.rect(-1, -1, f + 1, e + 1);
      b.clip();
      f = a.Ab();
      f.tb(b, c);
      e = a.tf() * c.scale;
      0 >= e && (e = 1);
      for (
        var g = f.actualBounds, h = a.W.j, k = a.uj, l = h.length, m = 0;
        m < l;
        m++
      ) {
        var n = h[m],
          p = k[m],
          r = p.length;
        if (n.visible && n !== f && 0 !== p.length)
          if (n instanceof W) {
            if (
              !(
                2 >
                ((a.graduatedTickUnit *
                  n.interval *
                  f.geometry.flattenedTotalLength) /
                  a.graduatedRange) *
                  e
              )
            ) {
              var q = n.measuredBounds,
                u = n.strokeWidth * n.scale,
                v = n.alignmentFocus;
              v.kc() && (v = xc);
              for (var w = 0; w < r; w++) {
                var y = p[w].xm,
                  z = p[w].angle,
                  A = v,
                  C = n.lb;
                C.reset();
                C.translate(y.x + g.x, y.y + g.y);
                C.rotate(z + n.angle, 0, 0);
                C.translate(
                  -q.width * A.x + A.offsetX + u / 2,
                  -q.height * A.y + A.offsetY + u / 2,
                );
                C.scale(n.scale, n.scale);
                zl(n, !1);
                n.Rh.set(n.lb);
                n.Xk = n.scale;
                Al(n, !1);
                n.tb(b, c);
                n.lb.reset();
              }
            }
          } else if (n instanceof Xg)
            for (
              null === a.wh && (a.wh = new Xg()), q = a.wh, Sm(q, n), n = 0;
              n < r;
              n++
            )
              (u = p[n]),
                u.actualBounds &&
                  u.measuredBounds &&
                  u.naturalBounds &&
                  ((q.Sb = u.text || ''),
                  (q.Zb = u.aA || 0),
                  (q.Lc = u.lineCount || 0),
                  (v = u.lines),
                  void 0 !== v &&
                    ((q.qb = v[0]),
                    (q.ti = v[1]),
                    (q.ie = v[2]),
                    (q.ve = v[3]),
                    (q.Pb = v[4]),
                    (q.fb = v[5]),
                    (q.ge = v[6])),
                  u.naturalBounds && (q.pc = u.naturalBounds),
                  u.actualBounds &&
                    ((v = u.actualBounds),
                    q.arrange(v.x, v.y, v.width, v.height)),
                  (v = u.actualBounds),
                  q.arrange(v.x, v.y, v.width, v.height),
                  (w = u.measuredBounds),
                  (u = u.naturalBounds),
                  (y = q.lb),
                  y.reset(),
                  y.translate(v.x + g.x, v.y + g.y),
                  y.translate(-w.x, -w.y),
                  hl(q, y, u.x, u.y, u.width, u.height),
                  zl(q, !1),
                  q.Rh.set(q.lb),
                  (q.Xk = q.scale),
                  Al(q, !1),
                  q.tb(b, c));
      }
      c.ni = d;
      b.restore();
      b.Qc(!0);
    };
    function X(a) {
      Y.call(this);
      this.qa = void 0 === a ? X.Position : a;
      null === this.qa &&
        B('Panel type not specified or PanelLayout not loaded: ' + a);
      this.W = new E();
      this.ab = sc;
      this.qa === X.Grid && (this.isAtomic = !0);
      this.un = Zc;
      this.Pf = Uk;
      this.qa === X.Table && Tm(this);
      this.Xp = Cg;
      this.Sn = Ob;
      this.Tn = Fb;
      this.Pn = 0;
      this.On = 100;
      this.Rn = 10;
      this.Qn = 0;
      this.di = this.hb = this.$g = this.Zg = this.uj = null;
      this.io = NaN;
      this.ne = this.si = null;
      this.rl = 'category';
      this.Jd = null;
      this.vg = new N(NaN, NaN, NaN, NaN);
      this.wh = this.qp = this.Hi = null;
      this.Jg = '';
    }
    la(X, Y);
    function Tm(a) {
      a.nj = sc;
      a.Rg = 1;
      a.ji = null;
      a.ii = null;
      a.Qg = 1;
      a.Pg = null;
      a.hi = null;
      a.rb = [];
      a.nb = [];
      a.Mj = Um;
      a.kj = Um;
      a.Ki = 0;
      a.vi = 0;
    }
    X.prototype.cloneProtected = function (a) {
      Y.prototype.cloneProtected.call(this, a);
      a.qa = this.qa;
      a.ab = this.ab.G();
      a.un = this.un.G();
      a.Pf = this.Pf;
      if (a.qa === X.Table) {
        a.nj = this.nj.G();
        a.Rg = this.Rg;
        a.ji = this.ji;
        a.ii = this.ii;
        a.Qg = this.Qg;
        a.Pg = this.Pg;
        a.hi = this.hi;
        var b = [];
        if (0 < this.rb.length)
          for (var c = this.rb, d = c.length, e = 0; e < d; e++)
            if (void 0 !== c[e]) {
              var f = c[e].copy();
              f.bj(a);
              b[e] = f;
            }
        a.rb = b;
        b = [];
        if (0 < this.nb.length)
          for (c = this.nb, d = c.length, e = 0; e < d; e++)
            void 0 !== c[e] && ((f = c[e].copy()), f.bj(a), (b[e] = f));
        a.nb = b;
        a.Mj = this.Mj;
        a.kj = this.kj;
        a.Ki = this.Ki;
        a.vi = this.vi;
      }
      a.Xp = this.Xp;
      a.Sn = this.Sn.G();
      a.Tn = this.Tn.G();
      a.Pn = this.Pn;
      a.On = this.On;
      a.Rn = this.Rn;
      a.Qn = this.Qn;
      a.uj = this.uj;
      a.$g = this.$g;
      a.hb = this.hb;
      a.di = this.di;
      a.io = this.io;
      a.si = this.si;
      a.ne = this.ne;
      a.rl = this.rl;
      a.vg.assign(this.vg);
      a.Jg = this.Jg;
      null !== this.qp && (a.qp = this.qp);
    };
    X.prototype.rf = function (a) {
      Y.prototype.rf.call(this, a);
      a.W = this.W;
      for (var b = a.W.j, c = b.length, d = 0; d < c; d++) b[d].ng = a;
      a.Hi = null;
    };
    X.prototype.copy = function () {
      var a = Y.prototype.copy.call(this);
      if (null !== a) {
        for (var b = this.W.j, c = b.length, d = 0; d < c; d++) {
          var e = b[d].copy();
          e.bj(a);
          e.Jj = null;
          var f = a.W,
            g = f.count;
          f.Lb(g, e);
          f = a.part;
          if (null !== f) {
            f.Fj = null;
            null !== e.portId && f instanceof U && (f.Jh = !0);
            var h = a.diagram;
            (null !== h && h.undoManager.isUndoingRedoing) ||
              f.Ya(se, 'elements', a, null, e, null, g);
          }
        }
        return a;
      }
      return null;
    };
    t = X.prototype;
    t.toString = function () {
      return 'Panel(' + this.type + ')#' + lb(this);
    };
    t.So = function (a) {
      Y.prototype.So.call(this, a);
      for (var b = this.W.j, c = b.length, d = 0; d < c; d++) b[d].So(a);
    };
    t.Pi = function (a, b) {
      if (this.qa === X.Grid) this.qa.tb(this, a, b);
      else if (this.qa === X.Graduated) this.qa.tb(this, a, b);
      else {
        this.qa === X.Table &&
          ((a.lineCap = 'butt'),
          Vm(this, a, !0, this.rb, !0),
          Vm(this, a, !1, this.nb, !0),
          Wm(this, a, !0, this.rb),
          Wm(this, a, !1, this.nb),
          Vm(this, a, !0, this.rb, !1),
          Vm(this, a, !1, this.nb, !1));
        var c = this.isClipping;
        c && a.save();
        for (var d = this.Ab(), e = this.W.j, f = e.length, g = 0; g < f; g++) {
          var h = e[g];
          c && h === d && (a.clipInsteadOfFill = !0);
          h.tb(a, b);
          c && h === d && (a.clipInsteadOfFill = !1);
        }
        c && (a.restore(), a.Qc(!0));
      }
    };
    function Wm(a, b, c, d) {
      for (
        var e = d.length, f = a.actualBounds, g = a.naturalBounds, h = !0, k = 0;
        k < e;
        k++
      ) {
        var l = d[k];
        if (void 0 !== l)
          if (h) h = !1;
          else if (0 !== l.actual) {
            if (c) {
              if (l.position > f.height) continue;
            } else if (l.position > f.width) continue;
            var m = l.separatorStrokeWidth;
            isNaN(m) && (m = c ? a.Rg : a.Qg);
            var n = l.separatorStroke;
            null === n && (n = c ? a.ji : a.Pg);
            if (0 !== m && null !== n) {
              ji(a, b, n, !1, !1, g, f);
              n = !1;
              var p = l.separatorDashArray;
              null === p && (p = c ? a.ii : a.hi);
              null !== p && ((n = !0), b.gt(p, 0));
              b.beginPath();
              p = l.position + m;
              c
                ? p > f.height && (m -= p - f.height)
                : p > f.width && (m -= p - f.width);
              l = l.position + m / 2;
              b.lineWidth = m;
              m = a.ab;
              c
                ? ((l += m.top),
                  (p = f.width - m.right),
                  b.moveTo(m.left, l),
                  b.lineTo(p, l))
                : ((l += m.left),
                  (p = f.height - m.bottom),
                  b.moveTo(l, m.top),
                  b.lineTo(l, p));
              b.stroke();
              n && b.et();
            }
          }
      }
    }
    function Vm(a, b, c, d, e) {
      for (
        var f = d.length, g = a.actualBounds, h = a.naturalBounds, k = 0;
        k < f;
        k++
      ) {
        var l = d[k];
        if (
          void 0 !== l &&
          null !== l.background &&
          l.coversSeparators !== e &&
          0 !== l.actual
        ) {
          var m = c ? g.height : g.width;
          if (!(l.position > m)) {
            var n = l.tc(),
              p = l.separatorStrokeWidth;
            isNaN(p) && (p = c ? a.Rg : a.Qg);
            var r = l.separatorStroke;
            null === r && (r = c ? a.ji : a.Pg);
            null === r && (p = 0);
            n -= p;
            p = l.position + p;
            n += l.actual;
            p + n > m && (n = m - p);
            0 >= n ||
              ((m = a.ab),
              ji(a, b, l.background, !0, !1, h, g),
              c
                ? b.fillRect(m.left, p + m.top, g.width - (m.left + m.right), n)
                : b.fillRect(
                    p + m.left,
                    m.top,
                    n,
                    g.height - (m.top + m.bottom),
                  ));
          }
        }
      }
    }
    function hk(a) {
      return 'LineV' === a || 'BarV' === a;
    }
    t.ik = function (a, b, c, d, e) {
      var f = this.ae(),
        g = this.transform,
        h = 1 / (g.m11 * g.m22 - g.m12 * g.m21),
        k = g.m22 * h,
        l = -g.m12 * h,
        m = -g.m21 * h,
        n = g.m11 * h,
        p = h * (g.m21 * g.dy - g.m22 * g.dx),
        r = h * (g.m12 * g.dx - g.m11 * g.dy);
      if (null !== this.areaBackground)
        return (
          (g = this.actualBounds),
          J.Sc(g.left, g.top, g.right, g.bottom, a, b, c, d, e)
        );
      if (null !== this.background)
        return (
          (f = a * k + b * m + p),
          (h = a * l + b * n + r),
          (a = c * k + d * m + p),
          (k = c * l + d * n + r),
          e.h(0, 0),
          (c = this.naturalBounds),
          (f = J.Sc(0, 0, c.width, c.height, f, h, a, k, e)),
          e.transform(g),
          f
        );
      f || ((k = 1), (m = l = 0), (n = 1), (r = p = 0));
      h = a * k + b * m + p;
      a = a * l + b * n + r;
      k = c * k + d * m + p;
      c = c * l + d * n + r;
      e.h(k, c);
      d = (k - h) * (k - h) + (c - a) * (c - a);
      l = !1;
      n = this.W.j;
      r = n.length;
      m = H.alloc();
      p = null;
      b = Infinity;
      var q = null;
      this.isClipping &&
        ((q = H.alloc()),
        (p = this.Ab()),
        (l = p.ik(h, a, k, c, q)) &&
          (b = (h - q.x) * (h - q.x) + (a - q.y) * (a - q.y)));
      for (var u = 0; u < r; u++) {
        var v = n[u];
        v.visible &&
          v !== p &&
          v.ik(h, a, k, c, m) &&
          ((l = !0),
          (v = (h - m.x) * (h - m.x) + (a - m.y) * (a - m.y)),
          v < d && ((d = v), e.set(m)));
      }
      this.isClipping && (b > d && e.set(q), H.free(q));
      H.free(m);
      f && e.transform(g);
      return l;
    };
    t.o = function (a) {
      if (!0 !== rj(this)) {
        Y.prototype.o.call(this, a);
        a = null;
        if (this.qa === X.Auto || this.qa === X.Link) a = this.Ab();
        for (var b = this.W.j, c = b.length, d = 0; d < c; d++) {
          var e = b[d];
          (e === a || e.isPanelMain) && e.o(!0);
          if (!e.desiredSize.u()) {
            var f = jl(e, !1);
            (e instanceof yg || e instanceof X || e instanceof Xg || f !== Ag) &&
              e.o(!0);
          }
        }
      }
    };
    t.om = function () {
      if (!1 === rj(this)) {
        mj(this, !0);
        kl(this, !0);
        for (var a = this.W.j, b = a.length, c = 0; c < b; c++) a[c].om();
      }
    };
    t.nl = function () {
      if ((0 !== (this.F & 2048)) === !1) {
        zl(this, !0);
        Al(this, !0);
        for (var a = this.W.j, b = a.length, c = 0; c < b; c++) a[c].Iv();
      }
    };
    t.Iv = function () {
      Al(this, !0);
      for (var a = this.W.j, b = a.length, c = 0; c < b; c++) a[c].Iv();
    };
    t.sm = function (a, b, c, d) {
      var e = this.vg;
      e.h(0, 0, 0, 0);
      var f = this.desiredSize,
        g = this.minSize;
      void 0 === c && ((c = g.width), (d = g.height));
      c = Math.max(c, g.width);
      d = Math.max(d, g.height);
      var h = this.maxSize;
      isNaN(f.width) || (a = Math.min(f.width, h.width));
      isNaN(f.height) || (b = Math.min(f.height, h.height));
      a = Math.max(c, a);
      b = Math.max(d, b);
      var k = this.ab;
      a = Math.max(a - k.left - k.right, 0);
      b = Math.max(b - k.top - k.bottom, 0);
      var l = this.W.j;
      0 !== l.length && this.qa.measure(this, a, b, l, e, c, d);
      a = e.width + k.left + k.right;
      k = e.height + k.top + k.bottom;
      isFinite(f.width) && (a = f.width);
      isFinite(f.height) && (k = f.height);
      a = Math.min(h.width, a);
      k = Math.min(h.height, k);
      a = Math.max(g.width, a);
      k = Math.max(g.height, k);
      a = Math.max(c, a);
      k = Math.max(d, k);
      Vb(e, a, k);
      Vb(this.naturalBounds, a, k);
      gl(this, 0, 0, a, k);
    };
    t.Ab = function () {
      if (null === this.Hi) {
        var a = this.W.j,
          b = a.length;
        if (0 === b) return null;
        for (var c = 0; c < b; c++) {
          var d = a[c];
          if (!0 === d.isPanelMain) return (this.Hi = d);
        }
        this.Hi = a[0];
      }
      return this.Hi;
    };
    function vm(a) {
      return null !== a.part ? a.part.locationObject : null;
    }
    t.Gh = function (a, b, c, d) {
      var e = this.W.j;
      this.actualBounds.h(a, b, c, d);
      if (0 !== e.length) {
        if (!this.desiredSize.u()) {
          a = jl(this, !0);
          var f = this.measuredBounds;
          b = f.width;
          f = f.height;
          var g = this.gh,
            h = g.left + g.right;
          g = g.top + g.bottom;
          b === c && f === d && (a = Ag);
          switch (a) {
            case Ag:
              if (b > c || f > d)
                this.o(), this.measure(b > c ? c : b, f > d ? d : f, 0, 0);
              break;
            case vd:
              this.o(!0);
              this.measure(c + h, d + g, 0, 0);
              break;
            case Vk:
              this.o(!0);
              this.measure(c + h, f + g, 0, 0);
              break;
            case Wk:
              this.o(!0), this.measure(b + h, d + g, 0, 0);
          }
        }
        this.qa.arrange(this, e, this.vg);
      }
    };
    t.Ih = function (a) {
      var b = this.naturalBounds,
        c = vm(this);
      if (fc(0, 0, b.width, b.height, a.x, a.y)) {
        b = this.W.j;
        for (var d = b.length, e = H.allocAt(0, 0); d--; ) {
          var f = b[d];
          if (f.visible || f === c)
            if ((zb(e.set(a), f.transform), f.aa(e))) return H.free(e), !0;
        }
        H.free(e);
        return null === this.gb && null === this.dc ? !1 : !0;
      }
      return !1;
    };
    t.ht = function (a) {
      if (this.Kk === a) return this;
      for (var b = this.W.j, c = b.length, d = 0; d < c; d++) {
        var e = b[d].ht(a);
        if (null !== e) return e;
      }
      return null;
    };
    t.Km = function (a, b) {
      b(this, a);
      if (a instanceof X) {
        a = a.W.j;
        for (var c = a.length, d = 0; d < c; d++) this.Km(a[d], b);
      }
    };
    function Ej(a, b) {
      Xm(a, a, b);
    }
    function Xm(a, b, c) {
      c(b);
      b = b.W.j;
      for (var d = b.length, e = 0; e < d; e++) {
        var f = b[e];
        f instanceof X && Xm(a, f, c);
      }
    }
    function Ym(a, b) {
      Zm(a, a, b);
    }
    function Zm(a, b, c) {
      c(b);
      if (b instanceof X) {
        b = b.W.j;
        for (var d = b.length, e = 0; e < d; e++) Zm(a, b[e], c);
      }
    }
    t.im = function (a) {
      return $m(this, this, a);
    };
    function $m(a, b, c) {
      if (c(b)) return b;
      if (b instanceof X) {
        b = b.W.j;
        for (var d = b.length, e = 0; e < d; e++) {
          var f = $m(a, b[e], c);
          if (null !== f) return f;
        }
      }
      return null;
    }
    t.Xa = function (a) {
      if (this.name === a) return this;
      var b = this.W.j,
        c = b.length;
      (null === this.si && null === this.ne) || (c = an(this));
      for (var d = 0; d < c; d++) {
        var e = b[d];
        if (e instanceof X) {
          var f = e.Xa(a);
          if (null !== f) return f;
        }
        if (e.name === a) return e;
      }
      return null;
    };
    function bn(a) {
      a = a.W.j;
      for (var b = a.length, c = 0, d = 0; d < b; d++) {
        var e = a[d];
        if (e instanceof X) c = Math.max(c, bn(e));
        else if (e instanceof W) {
          a: {
            switch (e.$k) {
              case 'None':
              case 'Square':
              case 'Ellipse':
              case 'Circle':
              case 'LineH':
              case 'LineV':
              case 'FramedRectangle':
              case 'RoundedRectangle':
              case 'Line1':
              case 'Line2':
              case 'Border':
              case 'Cube1':
              case 'Cube2':
              case 'Junction':
              case 'Cylinder1':
              case 'Cylinder2':
              case 'Cylinder3':
              case 'Cylinder4':
              case 'PlusLine':
              case 'XLine':
              case 'ThinCross':
              case 'ThickCross':
                e = 0;
                break a;
            }
            e = (e.uh / 2) * e.Oj * e.tf();
          }
          c = Math.max(c, e);
        }
      }
      return c;
    }
    t.ae = function () {
      return !(this.type === X.TableRow || this.type === X.TableColumn);
    };
    t.Tb = function (a, b, c) {
      if (!1 === this.pickable) return null;
      void 0 === b && (b = null);
      void 0 === c && (c = null);
      if (sj(this)) return null;
      var d = this.naturalBounds,
        e = 1 / this.tf(),
        f = this.ae(),
        g = f ? a : zb(H.allocAt(a.x, a.y), this.transform),
        h = this.diagram,
        k = 10,
        l = 5;
      null !== h && ((k = h.mm('extraTouchArea')), (l = k / 2));
      if (fc(-(l * e), -(l * e), d.width + k * e, d.height + k * e, g.x, g.y)) {
        if (!this.isAtomic) {
          e = this.W.j;
          var m = e.length;
          h = H.alloc();
          l = (k = this.isClipping) ? this.Ab() : null;
          if (k && (l.ae() ? zb(h.set(a), l.transform) : h.set(a), !l.aa(h)))
            return H.free(h), f || H.free(g), null;
          for (var n = vm(this); m--; ) {
            var p = e[m];
            if (p.visible || p === n)
              if (
                (p.ae() ? zb(h.set(a), p.transform) : h.set(a), !k || p !== l)
              ) {
                var r = null;
                p instanceof X
                  ? (r = p.Tb(h, b, c))
                  : !0 === p.pickable && p.aa(h) && (r = p);
                if (
                  null !== r &&
                  (null !== b && (r = b(r)), null !== r && (null === c || c(r)))
                )
                  return H.free(h), f || H.free(g), r;
              }
          }
          H.free(h);
        }
        if (null === this.background && null === this.areaBackground)
          return f || H.free(g), null;
        a = fc(0, 0, d.width, d.height, g.x, g.y) ? this : null;
        f || H.free(g);
        return a;
      }
      f || H.free(g);
      return null;
    };
    t.Si = function (a, b, c, d) {
      if (!1 === this.pickable) return !1;
      void 0 === b && (b = null);
      void 0 === c && (c = null);
      var e = this.naturalBounds,
        f = this.ae(),
        g = f ? a : zb(H.allocAt(a.x, a.y), this.transform);
      e = fc(0, 0, e.width, e.height, g.x, g.y);
      if (this.type === X.TableRow || this.type === X.TableColumn || e) {
        if (!this.isAtomic) {
          for (
            var h = this.W.j, k = h.length, l = H.alloc(), m = vm(this);
            k--;
  
          ) {
            var n = h[k];
            if (n.visible || n === m) {
              n.ae() ? zb(l.set(a), n.transform) : l.set(a);
              var p = n;
              n = n instanceof X ? n : null;
              (null !== n ? n.Si(l, b, c, d) : p.aa(l)) &&
                !1 !== p.pickable &&
                (null !== b && (p = b(p)),
                null === p || (null !== c && !c(p)) || d.add(p));
            }
          }
          H.free(l);
        }
        f || H.free(g);
        return e && (null !== this.background || null !== this.areaBackground);
      }
      f || H.free(g);
      return !1;
    };
    t.sf = function (a, b, c, d, e, f) {
      if (!1 === this.pickable) return !1;
      void 0 === b && (b = null);
      void 0 === c && (c = null);
      var g = f;
      void 0 === f && ((g = rd.alloc()), g.reset());
      g.multiply(this.transform);
      if (this.Hh(a, g)) return cn(this, b, c, e), void 0 === f && rd.free(g), !0;
      if (this.Fc(a, g)) {
        if (!this.isAtomic)
          for (var h = vm(this), k = this.W.j, l = k.length; l--; ) {
            var m = k[l];
            if (m.visible || m === h) {
              var n = m.actualBounds,
                p = this.naturalBounds;
              if (
                !(
                  n.x > p.width ||
                  n.y > p.height ||
                  0 > n.x + n.width ||
                  0 > n.y + n.height
                )
              ) {
                n = m;
                m = m instanceof X ? m : null;
                p = rd.alloc();
                p.set(g);
                if (null !== m ? m.sf(a, b, c, d, e, p) : il(n, a, d, p))
                  null !== b && (n = b(n)),
                    null === n || (null !== c && !c(n)) || e.add(n);
                rd.free(p);
              }
            }
          }
        void 0 === f && rd.free(g);
        return d;
      }
      void 0 === f && rd.free(g);
      return !1;
    };
    function cn(a, b, c, d) {
      for (var e = a.W.j, f = e.length; f--; ) {
        var g = e[f];
        if (g.visible) {
          var h = g.actualBounds,
            k = a.naturalBounds;
          h.x > k.width ||
            h.y > k.height ||
            0 > h.x + h.width ||
            0 > h.y + h.height ||
            (g instanceof X && cn(g, b, c, d),
            null !== b && (g = b(g)),
            null === g || (null !== c && !c(g)) || d.add(g));
        }
      }
    }
    t.Ag = function (a, b, c, d, e, f) {
      if (!1 === this.pickable) return !1;
      void 0 === c && (c = null);
      void 0 === d && (d = null);
      var g = this.naturalBounds,
        h = this.ae(),
        k = h ? a : zb(H.allocAt(a.x, a.y), this.transform),
        l = h ? b : zb(H.allocAt(b.x, b.y), this.transform),
        m = k.Ae(l),
        n =
          (0 < k.x && k.x < g.width && 0 < k.y && k.y < g.height) ||
          Ab(k.x, k.y, 0, 0, 0, g.height) <= m ||
          Ab(k.x, k.y, 0, g.height, g.width, g.height) <= m ||
          Ab(k.x, k.y, g.width, g.height, g.width, 0) <= m ||
          Ab(k.x, k.y, g.width, 0, 0, 0) <= m;
      g =
        k.cd(0, 0) <= m &&
        k.cd(0, g.height) <= m &&
        k.cd(g.width, 0) <= m &&
        k.cd(g.width, g.height) <= m;
      h || (H.free(k), H.free(l));
      if (n) {
        if (!this.isAtomic) {
          k = H.alloc();
          l = H.alloc();
          m = vm(this);
          for (var p = this.W.j, r = p.length; r--; ) {
            var q = p[r];
            if (q.visible || q === m) {
              var u = q.actualBounds,
                v = this.naturalBounds;
              if (
                !h ||
                !(
                  u.x > v.width ||
                  u.y > v.height ||
                  0 > u.x + u.width ||
                  0 > u.y + u.height
                )
              )
                if (
                  (q.ae()
                    ? ((u = q.transform), zb(k.set(a), u), zb(l.set(b), u))
                    : (k.set(a), l.set(b)),
                  (u = q),
                  (q = q instanceof X ? q : null),
                  null !== q ? q.Ag(k, l, c, d, e, f) : u.Nx(k, l, e))
                )
                  null !== c && (u = c(u)),
                    null === u || (null !== d && !d(u)) || f.add(u);
            }
          }
          H.free(k);
          H.free(l);
        }
        return e ? n : g;
      }
      return !1;
    };
    function Am(a) {
      var b = null;
      a instanceof W &&
        ((b = a.spot1),
        b === Zc && (b = null),
        (a = a.geometry),
        null !== a && null === b && (b = a.spot1));
      null === b && (b = vc);
      return b;
    }
    function Bm(a) {
      var b = null;
      a instanceof W &&
        ((b = a.spot2),
        b === Zc && (b = null),
        (a = a.geometry),
        null !== a && null === b && (b = a.spot2));
      null === b && (b = Gc);
      return b;
    }
    t.add = function (a) {
      this.Lb(this.W.count, a);
    };
    t.L = function (a) {
      return this.W.L(a);
    };
    t.Lb = function (a, b) {
      b instanceof T &&
        B('Cannot add a Part to a Panel: ' + b + '; use a Panel instead');
      if (this === b || this.Dg(b))
        this === b && B('Cannot make a Panel contain itself: ' + this.toString()),
          B(
            'Cannot make a Panel indirectly contain itself: ' +
              this.toString() +
              ' already contains ' +
              b.toString(),
          );
      var c = b.panel;
      null !== c &&
        c !== this &&
        B(
          'Cannot add a GraphObject that already belongs to another Panel to this Panel: ' +
            b.toString() +
            ', already contained by ' +
            c.toString() +
            ', cannot be shared by this Panel: ' +
            this.toString(),
        );
      this.qa !== X.Grid ||
        b instanceof W ||
        B('Can only add Shapes to a Grid Panel, not: ' + b);
      this.qa !== X.Graduated ||
        b instanceof W ||
        b instanceof Xg ||
        B('Can only add Shapes or TextBlocks to a Graduated Panel, not: ' + b);
      b.bj(this);
      b.Jj = null;
      if (null !== this.itemArray) {
        var d = b.data;
        null !== d &&
          'object' === typeof d &&
          (null === this.Jd && (this.Jd = new G()), this.Jd.add(d, b));
      }
      var e = this.W;
      d = -1;
      if (c === this) {
        for (var f = -1, g = this.W.j, h = g.length, k = 0; k < h; k++)
          if (g[k] === b) {
            f = k;
            break;
          }
        if (-1 !== f) {
          if (f === a || (f + 1 >= e.count && a >= e.count)) return;
          e.mb(f);
          d = f;
        } else
          B(
            'element ' +
              b.toString() +
              ' has panel ' +
              c.toString() +
              ' but is not contained by it.',
          );
      }
      if (0 > a || a > e.count) a = e.count;
      e.Lb(a, b);
      if (0 === a || b.isPanelMain) this.Hi = null;
      rj(this) || this.o();
      b.o(!1);
      null !== b.portId
        ? (this.Jh = !0)
        : b instanceof X && !0 === b.Jh && (this.Jh = !0);
      this.$g = null;
      c = this.part;
      null !== c &&
        ((c.Fj = null),
        (c.hh = NaN),
        this.Jh && c instanceof U && (c.Jh = !0),
        c.Jh && c instanceof U && (c.rc = null),
        (e = this.diagram),
        (null !== e && e.undoManager.isUndoingRedoing) ||
          (-1 !== d && c.Ya(te, 'elements', this, b, null, d, null),
          c.Ya(se, 'elements', this, null, b, null, a),
          this.Eg() || dn(this, b, !1)));
    };
    function en(a, b) {
      a.F = b ? a.F | 16777216 : a.F & -16777217;
    }
    t.remove = function (a) {
      for (var b = this.W.j, c = b.length, d = -1, e = 0; e < c; e++)
        if (b[e] === a) {
          d = e;
          break;
        }
      -1 !== d && this.Ec(d, !0);
    };
    t.mb = function (a) {
      0 <= a && this.Ec(a, !0);
    };
    t.Ec = function (a, b) {
      var c = this.W,
        d = c.L(a);
      d.Jj = null;
      d.bj(null);
      if (null !== this.Jd) {
        var e = d.data;
        'object' === typeof e && this.Jd.remove(e);
      }
      c.mb(a);
      mj(this, !1);
      this.o();
      this.Hi === d && (this.Hi = null);
      this.$g = null;
      var f = this.part;
      null !== f &&
        ((f.Fj = null),
        (f.hh = NaN),
        f.Mb(),
        f instanceof U &&
          (d instanceof X
            ? d.Km(d, function (a, c) {
                Rl(f, c, b);
              })
            : Rl(f, d, b)),
        (c = this.diagram),
        (null !== c && c.undoManager.isUndoingRedoing) ||
          f.Ya(te, 'elements', this, d, null, a, null));
    };
    X.prototype.getRowDefinition = function (a) {
      0 > a && va(a, '>= 0', X, 'getRowDefinition:idx');
      a = Math.round(a);
      var b = this.rb;
      if (void 0 === b) return null;
      if (void 0 === b[a]) {
        var c = new Sj();
        c.bj(this);
        c.isRow = !0;
        c.index = a;
        b[a] = c;
      }
      return b[a];
    };
    X.prototype.aw = function (a) {
      0 > a && va(a, '>= 0', X, 'removeRowDefinition:idx');
      a = Math.round(a);
      var b = this.rb;
      void 0 !== b &&
        (this.Ya(te, 'coldefs', this, b[a], null, a, null),
        b[a] && delete b[a],
        this.o());
    };
    X.prototype.getColumnDefinition = function (a) {
      0 > a && va(a, '>= 0', X, 'getColumnDefinition:idx');
      a = Math.round(a);
      var b = this.nb;
      if (void 0 === b) return null;
      if (void 0 === b[a]) {
        var c = new Sj();
        c.bj(this);
        c.isRow = !1;
        c.index = a;
        b[a] = c;
      }
      return b[a];
    };
    t = X.prototype;
    t.Zv = function (a) {
      0 > a && va(a, '>= 0', X, 'removeColumnDefinition:idx');
      a = Math.round(a);
      var b = this.nb;
      void 0 !== b &&
        (this.Ya(te, 'coldefs', this, b[a], null, a, null),
        b[a] && delete b[a],
        this.o());
    };
    t.rz = function (a) {
      if (0 > a || this.type !== X.Table) return -1;
      for (var b = 0, c = this.rb, d = c.length, e = this.Ki; e < d; e++) {
        var f = c[e];
        if (void 0 !== f && ((b += f.total), a < b)) break;
      }
      return e;
    };
    t.jz = function (a) {
      if (0 > a || this.type !== X.Table) return -1;
      for (var b = 0, c = this.nb, d = c.length, e = this.vi; e < d; e++) {
        var f = c[e];
        if (void 0 !== f && ((b += f.total), a < b)) break;
      }
      return e;
    };
    t.Mz = function (a, b) {
      void 0 === b && (b = new H(NaN, NaN));
      if (this.type !== X.Graduated) return b.h(NaN, NaN), b;
      a = Math.min(Math.max(a, this.graduatedMin), this.graduatedMax);
      var c = this.Ab();
      c.geometry.Bv((a - this.graduatedMin) / this.graduatedRange, b);
      return c.transform.ra(b);
    };
    t.Nz = function (a) {
      if (this.type !== X.Graduated) return NaN;
      var b = this.Ab();
      b.transform.Wd(a);
      return b.geometry.Rx(a) * this.graduatedRange + this.graduatedMin;
    };
    function Hl(a) {
      a = a.di;
      return null !== a && a.s;
    }
    function zg(a) {
      var b = a.di;
      if (null === b)
        null !== a.data && B('Template cannot have .data be non-null: ' + a),
          (a.di = b = new E());
      else if (b.s) return;
      var c = new E();
      en(a, !1);
      a.Km(a, function (a, d) {
        var e = d.Za;
        if (null !== e)
          for (El(d, !1), e = e.iterator; e.next(); ) {
            var f = e.value;
            f.mode === fn && El(d, !0);
            var g = f.sourceName;
            null !== g &&
              ('/' === g && en(a, !0),
              (g = fl(f, a, d)),
              null !== g &&
                (c.add(g), null === g.Ql && (g.Ql = new E()), g.Ql.add(f)));
            b.add(f);
          }
        if (d instanceof X && d.type === X.Table) {
          if (0 < d.rb.length)
            for (a = d.rb, e = a.length, f = 0; f < e; f++)
              if (((g = a[f]), void 0 !== g && null !== g.Za))
                for (var h = g.Za.iterator; h.next(); ) {
                  var k = h.value;
                  k.ad = g;
                  k.Pp = 2;
                  k.Wl = g.index;
                  b.add(k);
                }
          if (0 < d.nb.length)
            for (d = d.nb, a = d.length, e = 0; e < a; e++)
              if (((f = d[e]), void 0 !== f && null !== f.Za))
                for (g = f.Za.iterator; g.next(); )
                  (h = g.value),
                    (h.ad = f),
                    (h.Pp = 1),
                    (h.Wl = f.index),
                    b.add(h);
        }
      });
      for (var d = c.iterator; d.next(); ) {
        var e = d.value;
        if (null !== e.Ql) {
          El(e, !0);
          for (var f = e.Ql.iterator; f.next(); ) {
            var g = f.value;
            null === e.Za && (e.Za = new E());
            e.Za.add(g);
          }
        }
        e.Ql = null;
      }
      for (d = b.iterator; d.next(); )
        if (((e = d.value), (f = e.ad), null !== f)) {
          e.ad = null;
          var h = e.targetProperty,
            k = h.indexOf('.');
          0 < k &&
            f instanceof X &&
            ((g = h.substring(0, k)),
            (h = h.substr(k + 1)),
            (k = f.Xa(g)),
            null !== k
              ? ((f = k), (e.targetProperty = h))
              : wa(
                  'Warning: unable to find GraphObject named "' +
                    g +
                    '" for Binding: ' +
                    e.toString(),
                ));
          f instanceof Sj
            ? ((g = lb(f.panel)),
              (e.fj = void 0 === g ? -1 : g),
              (f.panel.Kk = e.fj))
            : f instanceof Y
            ? ((g = lb(f)), (e.fj = void 0 === g ? -1 : g), (f.Kk = e.fj))
            : B('Unknown type of binding target: ' + f);
        }
      b.freeze();
      a instanceof T && a.Vb() && a.zb();
    }
    t.Yy = function () {
      var a = this.copy();
      Ym(a, function (a) {
        a instanceof X && ((a.di = null), (a.hb = null));
        var b = a.Za;
        null !== b &&
          ((a.Za = null),
          b.each(function (b) {
            a.bind(b.copy());
          }));
        b = a.Kg;
        null !== b &&
          ((a.Kg = null),
          b.each(function (b) {
            Il(a, b.value.copy());
          }));
      });
      return a;
    };
    t.Aa = function (a) {
      var b = this.di;
      if (null !== b)
        for (void 0 === a && (a = ''), b = b.iterator; b.next(); ) {
          var c = b.value,
            d = c.sourceProperty;
          if ('' === a || '' === d || d === a)
            if (((d = c.targetProperty), null !== c.converter || '' !== d)) {
              d = this.data;
              var e = c.sourceName;
              if (null !== e)
                d =
                  '' === e
                    ? this
                    : '/' === e
                    ? this
                    : '.' === e
                    ? this
                    : '..' === e
                    ? this
                    : this.Xa(e);
              else {
                var f = this.diagram;
                null !== f && c.isToModel && (d = f.model.modelData);
              }
              if (null !== d) {
                f = this;
                var g = c.fj;
                if (-1 !== g) {
                  if (((f = this.ht(g)), null === f)) continue;
                } else null !== c.ad && (f = c.ad);
                '/' === e
                  ? (d = f.part)
                  : '.' === e
                  ? (d = f)
                  : '..' === e && (d = f.panel);
                e = c.Pp;
                if (0 !== e) {
                  if (!(f instanceof X)) continue;
                  1 === e
                    ? (f = f.getColumnDefinition(c.Wl))
                    : 2 === e && (f = f.getRowDefinition(c.Wl));
                }
                void 0 !== f && c.ww(f, d);
              }
            }
        }
    };
    function gn(a, b) {
      a = a.W.j;
      for (
        var c = a.length, d = b.length, e = 0, f = null;
        e < c && !((f = a[e]), f instanceof X && null !== f.data);
  
      )
        e++, (f = a[e]);
      if (c - e !== d) return !0;
      if (null === f) return 0 < d;
      for (var g = 0; e < c && g < d; ) {
        f = a[e];
        if (!(f instanceof X) || f.data !== b[g]) return !0;
        e++;
        g++;
      }
      return !1;
    }
    function an(a) {
      if (a.type === X.Spot || a.type === X.Auto) return Math.min(a.W.length, 1);
      if (a.type === X.Link) {
        a = a.W;
        for (var b = a.length, c = 0; c < b; c++) {
          var d = a.L(c);
          if (!(d instanceof W && d.isPanelMain)) break;
        }
        return c;
      }
      return a.type === X.Table &&
        0 < a.W.length &&
        ((a = a.W.L(0)),
        a.isPanelMain &&
          a instanceof X &&
          (a.type === X.TableRow || a.type === X.TableColumn))
        ? 1
        : 0;
    }
    t.Gt = function () {
      for (var a = an(this); this.W.length > a; ) this.Ec(this.W.length - 1, !1);
      a = this.itemArray;
      if (null !== a) for (var b = a.length, c = 0; c < b; c++) hn(this, a[c], c);
    };
    t.Mx = function (a) {
      return void 0 === a || null === a || null === this.Jd ? null : this.Jd.H(a);
    };
    function hn(a, b, c) {
      if (!(void 0 === b || null === b || 0 > c)) {
        var d = jn(a, b),
          e = a.itemTemplateMap,
          f = null;
        null !== e && (f = e.H(d));
        null === f &&
          (kn ||
            ((kn = !0),
            wa('No item template Panel found for category "' + d + '" on ' + a),
            wa('  Using default item template.'),
            (d = new X()),
            (e = new Xg()),
            e.bind(new Ki('text', '', Ja)),
            d.add(e),
            (ln = d)),
          (f = ln));
        d = f;
        null !== d &&
          (zg(d),
          (d = d.copy()),
          0 !== (d.F & 16777216) && ((e = a.Ti()), null !== e && en(e, !0)),
          'object' === typeof b &&
            (null === a.Jd && (a.Jd = new G()), a.Jd.add(b, d)),
          (e = c + an(a)),
          a.Lb(e, d),
          (d.hb = b),
          mn(a, e, c),
          (d.hb = null),
          (d.data = b));
      }
    }
    function mn(a, b, c) {
      for (a = a.W; b < a.length; ) {
        var d = a.L(b);
        if (d instanceof X) {
          var e = b,
            f = c;
          d.type === X.TableRow
            ? (d.row = e)
            : d.type === X.TableColumn && (d.column = e);
          d.itemIndex = f;
        }
        b++;
        c++;
      }
    }
    function jn(a, b) {
      if (null === b) return '';
      a = a.rl;
      if ('function' === typeof a) a = a(b);
      else if ('string' === typeof a && 'object' === typeof b) {
        if ('' === a) return '';
        a = nn(b, a);
      } else return '';
      if (void 0 === a) return '';
      if ('string' === typeof a) return a;
      B(
        'Panel.getCategoryForItemData found a non-string category for ' +
          b +
          ': ' +
          a,
      );
      return '';
    }
    function dn(a, b, c) {
      var d = b.enabledChanged;
      null !== d && d(b, c);
      if (b instanceof X) {
        b = b.W.j;
        d = b.length;
        for (var e = 0; e < d; e++) {
          var f = b[e];
          (c && f instanceof X && !f.isEnabled) || dn(a, f, c);
        }
      }
    }
    function zn(a, b) {
      Ml.add(a, b);
    }
    ma.Object.defineProperties(X.prototype, {
      type: {
        get: function () {
          return this.qa;
        },
        set: function (a) {
          var b = this.qa;
          b !== a &&
            ((this.qa = a),
            this.qa === X.Grid
              ? (this.isAtomic = !0)
              : this.qa === X.Table && Tm(this),
            this.o(),
            this.g('type', b, a));
        },
      },
      elements: {
        get: function () {
          return this.W.iterator;
        },
      },
      naturalBounds: {
        get: function () {
          return this.pc;
        },
      },
      padding: {
        get: function () {
          return this.ab;
        },
        set: function (a) {
          'number' === typeof a
            ? (0 > a && va(a, '>= 0', X, 'padding'), (a = new oc(a)))
            : (0 > a.left && va(a.left, '>= 0', X, 'padding:value.left'),
              0 > a.right && va(a.right, '>= 0', X, 'padding:value.right'),
              0 > a.top && va(a.top, '>= 0', X, 'padding:value.top'),
              0 > a.bottom && va(a.bottom, '>= 0', X, 'padding:value.bottom'));
          var b = this.ab;
          b.A(a) || ((this.ab = a = a.G()), this.o(), this.g('padding', b, a));
        },
      },
      defaultAlignment: {
        get: function () {
          return this.un;
        },
        set: function (a) {
          var b = this.un;
          b.A(a) ||
            ((this.un = a = a.G()), this.o(), this.g('defaultAlignment', b, a));
        },
      },
      defaultStretch: {
        get: function () {
          return this.Pf;
        },
        set: function (a) {
          var b = this.Pf;
          b !== a && ((this.Pf = a), this.o(), this.g('defaultStretch', b, a));
        },
      },
      defaultSeparatorPadding: {
        get: function () {
          return void 0 === this.nj ? sc : this.nj;
        },
        set: function (a) {
          if (void 0 !== this.nj) {
            'number' === typeof a && (a = new oc(a));
            var b = this.nj;
            b.A(a) ||
              ((this.nj = a = a.G()),
              this.o(),
              this.g('defaultSeparatorPadding', b, a));
          }
        },
      },
      defaultRowSeparatorStroke: {
        get: function () {
          return void 0 === this.ji ? null : this.ji;
        },
        set: function (a) {
          var b = this.ji;
          b !== a &&
            (null === a || 'string' === typeof a || a instanceof sl) &&
            (a instanceof sl && a.freeze(),
            (this.ji = a),
            this.N(),
            this.g('defaultRowSeparatorStroke', b, a));
        },
      },
      defaultRowSeparatorStrokeWidth: {
        get: function () {
          return void 0 === this.Rg ? 1 : this.Rg;
        },
        set: function (a) {
          if (void 0 !== this.Rg) {
            var b = this.Rg;
            b !== a &&
              isFinite(a) &&
              0 <= a &&
              ((this.Rg = a),
              this.o(),
              this.g('defaultRowSeparatorStrokeWidth', b, a));
          }
        },
      },
      defaultRowSeparatorDashArray: {
        get: function () {
          return void 0 === this.ii ? null : this.ii;
        },
        set: function (a) {
          if (void 0 !== this.ii) {
            var b = this.ii;
            if (b !== a) {
              if (null !== a) {
                for (var c = a.length, d = 0, e = 0; e < c; e++) {
                  var f = a[e];
                  ('number' === typeof f && 0 <= f && isFinite(f)) ||
                    B(
                      'defaultRowSeparatorDashArray value ' +
                        f +
                        ' at index ' +
                        e +
                        ' must be a positive number or zero.',
                    );
                  d += f;
                }
                if (0 === d) {
                  if (null === b) return;
                  a = null;
                }
              }
              this.ii = a;
              this.N();
              this.g('defaultRowSeparatorDashArray', b, a);
            }
          }
        },
      },
      defaultColumnSeparatorStroke: {
        get: function () {
          return void 0 === this.Pg ? null : this.Pg;
        },
        set: function (a) {
          if (void 0 !== this.Pg) {
            var b = this.Pg;
            b !== a &&
              (null === a || 'string' === typeof a || a instanceof sl) &&
              (a instanceof sl && a.freeze(),
              (this.Pg = a),
              this.N(),
              this.g('defaultColumnSeparatorStroke', b, a));
          }
        },
      },
      defaultColumnSeparatorStrokeWidth: {
        get: function () {
          return void 0 === this.Qg ? 1 : this.Qg;
        },
        set: function (a) {
          if (void 0 !== this.Qg) {
            var b = this.Qg;
            b !== a &&
              isFinite(a) &&
              0 <= a &&
              ((this.Qg = a),
              this.o(),
              this.g('defaultColumnSeparatorStrokeWidth', b, a));
          }
        },
      },
      defaultColumnSeparatorDashArray: {
        get: function () {
          return void 0 === this.hi ? null : this.hi;
        },
        set: function (a) {
          if (void 0 !== this.hi) {
            var b = this.hi;
            if (b !== a) {
              if (null !== a) {
                for (var c = a.length, d = 0, e = 0; e < c; e++) {
                  var f = a[e];
                  ('number' === typeof f && 0 <= f && isFinite(f)) ||
                    B(
                      'defaultColumnSeparatorDashArray value ' +
                        f +
                        ' at index ' +
                        e +
                        ' must be a positive number or zero.',
                    );
                  d += f;
                }
                if (0 === d) {
                  if (null === b) return;
                  a = null;
                }
              }
              this.hi = a;
              this.N();
              this.g('defaultColumnSeparatorDashArray', b, a);
            }
          }
        },
      },
      viewboxStretch: {
        get: function () {
          return this.Xp;
        },
        set: function (a) {
          var b = this.Xp;
          b !== a && ((this.Xp = a), this.o(), this.g('viewboxStretch', b, a));
        },
      },
      gridCellSize: {
        get: function () {
          return this.Sn;
        },
        set: function (a) {
          var b = this.Sn;
          if (!b.A(a)) {
            (a.u() && 0 !== a.width && 0 !== a.height) ||
              B('Invalid Panel.gridCellSize: ' + a);
            this.Sn = a.G();
            var c = this.diagram;
            null !== c && this === c.grid && nj(c);
            this.N();
            this.g('gridCellSize', b, a);
          }
        },
      },
      gridOrigin: {
        get: function () {
          return this.Tn;
        },
        set: function (a) {
          var b = this.Tn;
          if (!b.A(a)) {
            a.u() || B('Invalid Panel.gridOrigin: ' + a);
            this.Tn = a.G();
            var c = this.diagram;
            null !== c && this === c.grid && nj(c);
            this.N();
            this.g('gridOrigin', b, a);
          }
        },
      },
      graduatedMin: {
        get: function () {
          return this.Pn;
        },
        set: function (a) {
          var b = this.Pn;
          b !== a &&
            ((this.Pn = a),
            this.o(),
            this.g('graduatedMin', b, a),
            dl(this) &&
              ((a = this.part), null !== a && el(this, a, 'graduatedRange')));
        },
      },
      graduatedMax: {
        get: function () {
          return this.On;
        },
        set: function (a) {
          var b = this.On;
          b !== a &&
            ((this.On = a),
            this.o(),
            this.g('graduatedMax', b, a),
            dl(this) &&
              ((a = this.part), null !== a && el(this, a, 'graduatedRange')));
        },
      },
      graduatedRange: {
        get: function () {
          return this.graduatedMax - this.graduatedMin;
        },
      },
      graduatedTickUnit: {
        get: function () {
          return this.Rn;
        },
        set: function (a) {
          var b = this.Rn;
          b !== a &&
            0 < a &&
            ((this.Rn = a), this.o(), this.g('graduatedTickUnit', b, a));
        },
      },
      graduatedTickBase: {
        get: function () {
          return this.Qn;
        },
        set: function (a) {
          var b = this.Qn;
          b !== a && ((this.Qn = a), this.o(), this.g('graduatedTickBase', b, a));
        },
      },
      Jh: {
        get: function () {
          return 0 !== (this.F & 8388608);
        },
        set: function (a) {
          (0 !== (this.F & 8388608)) !== a && (this.F ^= 8388608);
        },
      },
      rowCount: {
        get: function () {
          return void 0 === this.rb ? 0 : this.rb.length;
        },
      },
      columnCount: {
        get: function () {
          return void 0 === this.nb ? 0 : this.nb.length;
        },
      },
      rowSizing: {
        get: function () {
          return void 0 === this.Mj ? Um : this.Mj;
        },
        set: function (a) {
          if (void 0 !== this.Mj) {
            var b = this.Mj;
            b !== a && ((this.Mj = a), this.o(), this.g('rowSizing', b, a));
          }
        },
      },
      columnSizing: {
        get: function () {
          return void 0 === this.kj ? Um : this.kj;
        },
        set: function (a) {
          if (void 0 !== this.kj) {
            var b = this.kj;
            b !== a && ((this.kj = a), this.o(), this.g('columnSizing', b, a));
          }
        },
      },
      topIndex: {
        get: function () {
          return void 0 === this.Ki ? 0 : this.Ki;
        },
        set: function (a) {
          if (void 0 !== this.Ki) {
            var b = this.Ki;
            b !== a &&
              ((!isFinite(a) || 0 > a) &&
                B(
                  'Panel.topIndex must be greater than zero and a real number, not: ' +
                    a,
                ),
              (this.Ki = a),
              this.o(),
              this.g('topIndex', b, a));
          }
        },
      },
      leftIndex: {
        get: function () {
          return void 0 === this.vi ? 0 : this.vi;
        },
        set: function (a) {
          if (void 0 !== this.vi) {
            var b = this.vi;
            b !== a &&
              ((!isFinite(a) || 0 > a) &&
                B(
                  'Panel.leftIndex must be greater than zero and a real number, not: ' +
                    a,
                ),
              (this.vi = a),
              this.o(),
              this.g('leftIndex', b, a));
          }
        },
      },
      data: {
        get: function () {
          return this.hb;
        },
        set: function (a) {
          var b = this.hb;
          if (b !== a) {
            var c = this instanceof T && !(this instanceof Ce);
            zg(this);
            this.hb = a;
            var d = this.diagram;
            null !== d &&
              (c
                ? ((c = d.partManager),
                  this instanceof S
                    ? (null !== b && c.Le.remove(b),
                      null !== a && c.Le.add(a, this))
                    : this instanceof T &&
                      (null !== b && c.Me.remove(b),
                      null !== a && c.Me.add(a, this)))
                : ((c = this.panel),
                  null !== c &&
                    null !== c.Jd &&
                    (null !== b && c.Jd.remove(b),
                    null !== a && c.Jd.add(a, this))));
            this.g('data', b, a);
            (null !== d && d.undoManager.isUndoingRedoing) ||
              (null !== a && this.Aa());
          }
        },
      },
      itemIndex: {
        get: function () {
          return this.io;
        },
        set: function (a) {
          var b = this.io;
          b !== a && ((this.io = a), this.g('itemIndex', b, a));
        },
      },
      itemArray: {
        get: function () {
          return this.si;
        },
        set: function (a) {
          var b = this.si;
          if (b !== a || (null !== a && gn(this, a))) {
            var c = this.diagram;
            b !== a &&
              (null !== c && null !== b && Jj(c.partManager, this, c),
              (this.si = a),
              null !== c && null !== a && Gj(c.partManager, this));
            this.g('itemArray', b, a);
            (null !== c && c.undoManager.isUndoingRedoing) || this.Gt();
          }
        },
      },
      itemTemplate: {
        get: function () {
          return null === this.ne ? null : this.ne.H('');
        },
        set: function (a) {
          if (null === this.ne) {
            if (null === a) return;
            this.ne = new G();
          }
          var b = this.ne.H('');
          b !== a &&
            ((a instanceof T || a.isPanelMain) &&
              B(
                'Panel.itemTemplate must not be a Part or be Panel.isPanelMain: ' +
                  a,
              ),
            this.ne.add('', a),
            this.g('itemTemplate', b, a),
            (a = this.diagram),
            (null !== a && a.undoManager.isUndoingRedoing) || this.Gt());
        },
      },
      itemTemplateMap: {
        get: function () {
          return this.ne;
        },
        set: function (a) {
          var b = this.ne;
          if (b !== a) {
            for (var c = a.iterator; c.next(); );
            this.ne = a;
            this.g('itemTemplateMap', b, a);
            a = this.diagram;
            (null !== a && a.undoManager.isUndoingRedoing) || this.Gt();
          }
        },
      },
      itemCategoryProperty: {
        get: function () {
          return this.rl;
        },
        set: function (a) {
          var b = this.rl;
          b !== a && ((this.rl = a), this.g('itemCategoryProperty', b, a));
        },
      },
      isAtomic: {
        get: function () {
          return 0 !== (this.F & 1048576);
        },
        set: function (a) {
          var b = 0 !== (this.F & 1048576);
          b !== a && ((this.F ^= 1048576), this.g('isAtomic', b, a));
        },
      },
      isClipping: {
        get: function () {
          return 0 !== (this.F & 2097152);
        },
        set: function (a) {
          var b = 0 !== (this.F & 2097152);
          b !== a && ((this.F ^= 2097152), this.o(), this.g('isClipping', b, a));
        },
      },
      isOpposite: {
        get: function () {
          return 0 !== (this.F & 33554432);
        },
        set: function (a) {
          var b = 0 !== (this.F & 33554432);
          b !== a && ((this.F ^= 33554432), this.o(), this.g('isOpposite', b, a));
        },
      },
      isEnabled: {
        get: function () {
          return 0 !== (this.F & 4194304);
        },
        set: function (a) {
          var b = 0 !== (this.F & 4194304);
          if (b !== a) {
            var c = null === this.panel || this.panel.Eg();
            this.F ^= 4194304;
            this.g('isEnabled', b, a);
            b = this.diagram;
            (null !== b && b.undoManager.isUndoingRedoing) ||
              (c && dn(this, this, a));
          }
        },
      },
      alignmentFocusName: {
        get: function () {
          return this.Jg;
        },
        set: function (a) {
          var b = this.Jg;
          b !== a &&
            ((this.Jg = a), this.o(), this.g('alignmentFocusName', b, a));
        },
      },
    });
    ma.Object.defineProperties(X, {
      Position: {
        get: function () {
          return Ml.H('Position');
        },
      },
      Horizontal: {
        get: function () {
          return Ml.H('Horizontal');
        },
      },
      Vertical: {
        get: function () {
          return Ml.H('Vertical');
        },
      },
      Spot: {
        get: function () {
          return Ml.H('Spot');
        },
      },
      Auto: {
        get: function () {
          return Ml.H('Auto');
        },
      },
      Table: {
        get: function () {
          return Ml.H('Table');
        },
      },
      Viewbox: {
        get: function () {
          return Ml.H('Viewbox');
        },
      },
      TableRow: {
        get: function () {
          return Ml.H('TableRow');
        },
      },
      TableColumn: {
        get: function () {
          return Ml.H('TableColumn');
        },
      },
      Link: {
        get: function () {
          return Ml.H('Link');
        },
      },
      Grid: {
        get: function () {
          return Ml.H('Grid');
        },
      },
      Graduated: {
        get: function () {
          return Ml.H('Graduated');
        },
      },
    });
    X.prototype.findItemPanelForData = X.prototype.Mx;
    X.prototype.rebuildItemElements = X.prototype.Gt;
    X.prototype.updateTargetBindings = X.prototype.Aa;
    X.prototype.copyTemplate = X.prototype.Yy;
    X.prototype.graduatedValueForPoint = X.prototype.Nz;
    X.prototype.graduatedPointForValue = X.prototype.Mz;
    X.prototype.findColumnForLocalX = X.prototype.jz;
    X.prototype.findRowForLocalY = X.prototype.rz;
    X.prototype.removeColumnDefinition = X.prototype.Zv;
    X.prototype.removeRowDefinition = X.prototype.aw;
    X.prototype.removeAt = X.prototype.mb;
    X.prototype.remove = X.prototype.remove;
    X.prototype.insertAt = X.prototype.Lb;
    X.prototype.elt = X.prototype.L;
    X.prototype.add = X.prototype.add;
    X.prototype.findObject = X.prototype.Xa;
    X.prototype.findInVisualTree = X.prototype.im;
    X.prototype.walkVisualTreeFrom = X.prototype.Km;
    X.prototype.findMainElement = X.prototype.Ab;
    var kn = !1,
      ln = null,
      Ml = new G();
    X.className = 'Panel';
    X.definePanelLayout = zn;
    zn('Position', new um());
    zn('Vertical', new xm());
    zn('Auto', new zm());
    zn('Link', new Km());
    function Sj() {
      Za(this);
      this.ng = null;
      this.Rr = !0;
      this.Pa = 0;
      this.Nc = NaN;
      this.jh = 0;
      this.ih = Infinity;
      this.wb = Zc;
      this.ma = this.ha = 0;
      this.Za = null;
      this.Gp = An;
      this.xe = Uk;
      this.Ap = this.qg = null;
      this.Bp = NaN;
      this.gb = this.Nj = null;
      this.qn = !1;
    }
    Sj.prototype.copy = function () {
      var a = new Sj();
      a.Rr = this.Rr;
      a.Pa = this.Pa;
      a.Nc = this.Nc;
      a.jh = this.jh;
      a.ih = this.ih;
      a.wb = this.wb;
      a.ha = this.ha;
      a.ma = this.ma;
      a.xe = this.xe;
      a.Gp = this.Gp;
      null === this.qg ? (a.qg = null) : (a.qg = this.qg.G());
      a.Ap = this.Ap;
      a.Bp = this.Bp;
      a.Nj = null;
      null !== this.Nj && (a.separatorDashArray = Ba(this.separatorDashArray));
      a.gb = this.gb;
      a.qn = this.qn;
      a.Za = this.Za;
      return a;
    };
    t = Sj.prototype;
    t.dt = function (a) {
      a.isRow ? (this.height = a.height) : (this.width = a.width);
      this.minimum = a.minimum;
      this.maximum = a.maximum;
      this.alignment = a.alignment;
      this.stretch = a.stretch;
      this.sizing = a.sizing;
      this.qg = null === a.separatorPadding ? null : a.separatorPadding.G();
      this.separatorStroke = a.separatorStroke;
      this.separatorStrokeWidth = a.separatorStrokeWidth;
      this.Nj = null;
      a.separatorDashArray && (this.Nj = Ba(a.separatorDashArray));
      this.background = a.background;
      this.coversSeparators = a.coversSeparators;
      this.Za = a.Za;
    };
    t.bb = function (a) {
      a.classType === Sj && (this.sizing = a);
    };
    t.toString = function () {
      return (
        'RowColumnDefinition ' +
        (this.isRow ? '(Row ' : '(Column ') +
        this.index +
        ') #' +
        lb(this)
      );
    };
    t.bj = function (a) {
      this.ng = a;
    };
    t.kv = function () {
      var a = 0,
        b = 0,
        c = this.ng,
        d = this.isRow;
      if (null !== c && c.type === X.Table)
        for (var e = d ? c.rb.length : c.nb.length, f = 0; f < e; f++) {
          var g = d ? c.rb[f] : c.nb[f];
          if (void 0 !== g) {
            b = g.index;
            break;
          }
        }
      this.index !== b &&
        ((b = this.separatorStroke),
        null === b &&
          null !== c &&
          (b = this.isRow
            ? c.defaultRowSeparatorStroke
            : c.defaultColumnSeparatorStroke),
        null !== b &&
          ((a = this.separatorStrokeWidth),
          isNaN(a) &&
            (null !== c
              ? (a = this.isRow
                  ? c.defaultRowSeparatorStrokeWidth
                  : c.defaultColumnSeparatorStrokeWidth)
              : (a = 0))));
      b = this.qg;
      if (null === b)
        if (null !== c) b = c.defaultSeparatorPadding;
        else return a;
      return a + (this.isRow ? b.top : b.left);
    };
    t.tc = function () {
      var a = 0,
        b = this.ng,
        c = 0,
        d = this.isRow;
      if (null !== b && b.type === X.Table)
        for (var e = d ? b.rb.length : b.nb.length, f = 0; f < e; f++) {
          var g = d ? b.rb[f] : b.nb[f];
          if (void 0 !== g) {
            c = g.index;
            break;
          }
        }
      this.index !== c &&
        ((c = this.separatorStroke),
        null === c &&
          null !== b &&
          (c = d ? b.defaultRowSeparatorStroke : b.defaultColumnSeparatorStroke),
        null !== c &&
          ((a = this.separatorStrokeWidth),
          isNaN(a) &&
            (null !== b
              ? (a = d
                  ? b.defaultRowSeparatorStrokeWidth
                  : b.defaultColumnSeparatorStrokeWidth)
              : (a = 0))));
      d = this.qg;
      if (null === d)
        if (null !== b) d = b.defaultSeparatorPadding;
        else return a;
      return a + (this.isRow ? d.top + d.bottom : d.left + d.right);
    };
    t.yb = function (a, b, c) {
      var d = this.ng;
      if (
        null !== d &&
        (d.Ya(qe, a, this, b, c, void 0, void 0),
        null !== this.Za &&
          ((b = d.diagram),
          null !== b &&
            !b.skipsModelSourceBindings &&
            ((d = d.Ti()), null !== d && ((b = d.data), null !== b))))
      )
        for (c = this.Za.iterator; c.next(); ) c.value.Pq(this, b, a, d);
    };
    function Dm(a) {
      if (a.sizing === An) {
        var b = a.ng;
        return a.isRow ? b.rowSizing : b.columnSizing;
      }
      return a.sizing;
    }
    t.bind = function (a) {
      a.ad = this;
      var b = this.panel;
      if (null !== b) {
        var c = b.Ti();
        null !== c &&
          Hl(c) &&
          B(
            'Cannot add a Binding to a RowColumnDefinition that is already frozen: ' +
              a +
              ' on ' +
              b,
          );
      }
      null === this.Za && (this.Za = new E());
      this.Za.add(a);
    };
    ma.Object.defineProperties(Sj.prototype, {
      panel: {
        get: function () {
          return this.ng;
        },
      },
      isRow: {
        get: function () {
          return this.Rr;
        },
        set: function (a) {
          this.Rr = a;
        },
      },
      index: {
        get: function () {
          return this.Pa;
        },
        set: function (a) {
          this.Pa = a;
        },
      },
      height: {
        get: function () {
          return this.Nc;
        },
        set: function (a) {
          var b = this.Nc;
          b !== a &&
            (0 > a && va(a, '>= 0', Sj, 'height'),
            (this.Nc = a),
            (this.actual = this.ha),
            null !== this.panel && this.panel.o(),
            this.yb('height', b, a));
        },
      },
      width: {
        get: function () {
          return this.Nc;
        },
        set: function (a) {
          var b = this.Nc;
          b !== a &&
            (0 > a && va(a, '>= 0', Sj, 'width'),
            (this.Nc = a),
            (this.actual = this.ha),
            null !== this.panel && this.panel.o(),
            this.yb('width', b, a));
        },
      },
      minimum: {
        get: function () {
          return this.jh;
        },
        set: function (a) {
          var b = this.jh;
          b !== a &&
            ((0 > a || !isFinite(a)) && va(a, '>= 0', Sj, 'minimum'),
            (this.jh = a),
            (this.actual = this.ha),
            null !== this.panel && this.panel.o(),
            this.yb('minimum', b, a));
        },
      },
      maximum: {
        get: function () {
          return this.ih;
        },
        set: function (a) {
          var b = this.ih;
          b !== a &&
            (0 > a && va(a, '>= 0', Sj, 'maximum'),
            (this.ih = a),
            (this.actual = this.ha),
            null !== this.panel && this.panel.o(),
            this.yb('maximum', b, a));
        },
      },
      alignment: {
        get: function () {
          return this.wb;
        },
        set: function (a) {
          var b = this.wb;
          b.A(a) ||
            ((this.wb = a.G()),
            null !== this.panel && this.panel.o(),
            this.yb('alignment', b, a));
        },
      },
      stretch: {
        get: function () {
          return this.xe;
        },
        set: function (a) {
          var b = this.xe;
          b !== a &&
            ((this.xe = a),
            null !== this.panel && this.panel.o(),
            this.yb('stretch', b, a));
        },
      },
      separatorPadding: {
        get: function () {
          return this.qg;
        },
        set: function (a) {
          'number' === typeof a && (a = new oc(a));
          var b = this.qg;
          (null !== a && null !== b && b.A(a)) ||
            (null !== a && (a = a.G()),
            (this.qg = a),
            null !== this.panel && this.panel.o(),
            this.yb('separatorPadding', b, a));
        },
      },
      separatorStroke: {
        get: function () {
          return this.Ap;
        },
        set: function (a) {
          var b = this.Ap;
          b !== a &&
            (null !== a && Ql(a, 'RowColumnDefinition.separatorStroke'),
            a instanceof sl && a.freeze(),
            (this.Ap = a),
            null !== this.panel && this.panel.o(),
            this.yb('separatorStroke', b, a));
        },
      },
      separatorStrokeWidth: {
        get: function () {
          return this.Bp;
        },
        set: function (a) {
          var b = this.Bp;
          b !== a &&
            ((this.Bp = a),
            null !== this.panel && this.panel.o(),
            this.yb('separatorStrokeWidth', b, a));
        },
      },
      separatorDashArray: {
        get: function () {
          return this.Nj;
        },
        set: function (a) {
          var b = this.Nj;
          if (b !== a) {
            if (null !== a) {
              for (var c = a.length, d = 0, e = 0; e < c; e++) {
                var f = a[e];
                ('number' === typeof f && 0 <= f && isFinite(f)) ||
                  B(
                    'separatorDashArray value ' +
                      f +
                      ' at index ' +
                      e +
                      ' must be a positive number or zero.',
                  );
                d += f;
              }
              if (0 === d) {
                if (null === b) return;
                a = null;
              }
            }
            this.Nj = a;
            null !== this.panel && this.panel.N();
            this.yb('separatorDashArray', b, a);
          }
        },
      },
      background: {
        get: function () {
          return this.gb;
        },
        set: function (a) {
          var b = this.gb;
          b !== a &&
            (null !== a && Ql(a, 'RowColumnDefinition.background'),
            a instanceof sl && a.freeze(),
            (this.gb = a),
            null !== this.panel && this.panel.N(),
            this.yb('background', b, a));
        },
      },
      coversSeparators: {
        get: function () {
          return this.qn;
        },
        set: function (a) {
          var b = this.qn;
          b !== a &&
            ((this.qn = a),
            null !== this.panel && this.panel.N(),
            this.yb('coversSeparators', b, a));
        },
      },
      sizing: {
        get: function () {
          return this.Gp;
        },
        set: function (a) {
          var b = this.Gp;
          b !== a &&
            ((this.Gp = a),
            null !== this.panel && this.panel.o(),
            this.yb('sizing', b, a));
        },
      },
      actual: {
        get: function () {
          return this.ha;
        },
        set: function (a) {
          this.ha = isNaN(this.Nc)
            ? Math.max(Math.min(this.ih, a), this.jh)
            : Math.max(Math.min(this.ih, this.Nc), this.jh);
        },
      },
      total: {
        get: function () {
          return this.ha + this.tc();
        },
        set: function (a) {
          this.ha = isNaN(this.Nc)
            ? Math.max(Math.min(this.ih, a), this.jh)
            : Math.max(Math.min(this.ih, this.Nc), this.jh);
          this.ha = Math.max(0, this.ha - this.tc());
        },
      },
      position: {
        get: function () {
          return this.ma;
        },
        set: function (a) {
          this.ma = a;
        },
      },
    });
    Sj.prototype.bind = Sj.prototype.bind;
    Sj.prototype.computeEffectiveSpacing = Sj.prototype.tc;
    Sj.prototype.computeEffectiveSpacingTop = Sj.prototype.kv;
    var An = new D(Sj, 'Default', 0),
      Em = new D(Sj, 'None', 1),
      Um = new D(Sj, 'ProportionalExtra', 2);
    Sj.className = 'RowColumnDefinition';
    Sj.Default = An;
    Sj.None = Em;
    Sj.ProportionalExtra = Um;
    function W() {
      Y.call(this);
      this.Rd = this.ka = null;
      this.$k = 'None';
      this.Nn = Uk;
      this.Cc = this.al = 'black';
      this.uh = 1;
      this.Sl = 'butt';
      this.Tl = 'miter';
      this.Oj = 10;
      this.sh = null;
      this.th = 0;
      this.gf = this.ff = Zc;
      this.Zo = this.Yo = NaN;
      this.Zn = !1;
      this.ap = null;
      this.bl = this.Zl = 'None';
      this.Hd = 1;
      this.Fd = 0;
      this.Dd = 1;
      this.Ed = null;
    }
    la(W, Y);
    W.prototype.cloneProtected = function (a) {
      Y.prototype.cloneProtected.call(this, a);
      a.ka = this.ka;
      a.$k = this.$k;
      a.Nn = this.Nn;
      a.Rd = this.Rd;
      a.al = this.al;
      a.Cc = this.Cc;
      a.uh = this.uh;
      a.Sl = this.Sl;
      a.Tl = this.Tl;
      a.Oj = this.Oj;
      null !== this.sh && (a.sh = Ba(this.sh));
      a.th = this.th;
      a.ff = this.ff.G();
      a.gf = this.gf.G();
      a.Yo = this.Yo;
      a.Zo = this.Zo;
      a.Zn = this.Zn;
      a.ap = this.ap;
      a.Zl = this.Zl;
      a.bl = this.bl;
      a.Hd = this.Hd;
      a.Fd = this.Fd;
      a.Dd = this.Dd;
      a.Ed = this.Ed;
    };
    t = W.prototype;
    t.bb = function (a) {
      a === Ag || a === Cg || a === Xk || a === Uk
        ? (this.geometryStretch = a)
        : Y.prototype.bb.call(this, a);
    };
    t.toString = function () {
      return (
        'Shape(' +
        ('None' !== this.figure
          ? this.figure
          : 'None' !== this.toArrow
          ? this.toArrow
          : this.fromArrow) +
        ')#' +
        lb(this)
      );
    };
    function Bn(a, b, c, d) {
      var e = c.length;
      if (!(4 > e)) {
        var f = d.measuredBounds,
          g = Math.max(1, f.width);
        f = f.height;
        for (
          var h = c[0], k = c[1], l, m, n, p, r, q, u = 0, v = Ea(), w = 2;
          w < e;
          w += 2
        )
          (l = c[w]),
            (m = c[w + 1]),
            (n = l - h),
            (h = m - k),
            0 === n && (n = 0.001),
            (p = h / n),
            (r = Math.atan2(h, n)),
            (q = Math.sqrt(n * n + h * h)),
            v.push([n, r, p, q]),
            (u += q),
            (h = l),
            (k = m);
        h = c[0];
        k = c[1];
        n = d.measuredBounds.width;
        d instanceof W && (n -= d.strokeWidth);
        1 > n && (n = 1);
        e = c = n;
        l = g / 2;
        m = 0 === l ? !1 : !0;
        w = 0;
        q = v[w];
        n = q[0];
        r = q[1];
        p = q[2];
        q = q[3];
        for (var y = 0; 0.1 <= u; ) {
          0 === y &&
            (m ? ((e = c), (e -= l), (u -= l), (m = !1)) : (e = c),
            0 === e && (e = 1));
          if (e > u) {
            Ha(v);
            return;
          }
          e > q ? ((y = e - q), (e = q)) : (y = 0);
          var z = Math.sqrt((e * e) / (1 + p * p));
          0 > n && (z = -z);
          h += z;
          k += p * z;
          a.translate(h, k);
          a.rotate(r);
          a.translate(-(g / 2), -(f / 2));
          0 === y && d.Pi(a, b);
          a.translate(g / 2, f / 2);
          a.rotate(-r);
          a.translate(-h, -k);
          u -= e;
          q -= e;
          if (0 !== y) {
            w++;
            if (w === v.length) {
              Ha(v);
              return;
            }
            q = v[w];
            n = q[0];
            r = q[1];
            p = q[2];
            q = q[3];
            e = y;
          }
        }
        Ha(v);
      }
    }
    t.Pi = function (a, b) {
      var c = this.Cc,
        d = this.al;
      if (null !== c || null !== d) {
        var e = this.actualBounds,
          f = this.naturalBounds;
        null !== d && ji(this, a, d, !0, !1, f, e);
        var g = this.part,
          h = this.uh;
        null !== c &&
          0 === h &&
          null !== g &&
          (h =
            g.type === X.Link &&
            g instanceof Ce &&
            'Selection' === g.category &&
            g.adornedObject instanceof W &&
            g.adornedPart.Ab() === g.adornedObject
              ? g.adornedObject.strokeWidth
              : 0);
        null !== c &&
          0 !== h &&
          (ji(this, a, c, !1, !1, f, e),
          (a.lineWidth = h),
          (a.lineJoin = this.Tl),
          (a.lineCap = this.Sl),
          (a.miterLimit = this.Oj));
        e = !1;
        g && b.Be('drawShadows') && (e = g.isShadowed);
        g = !0;
        null === c || (null !== d && 'transparent' !== d) || (g = !1);
        f = !1;
        var k = this.strokeDashArray;
        null !== k && ((f = !0), a.gt(k, this.th));
        var l = this.ka;
        if (null !== l) {
          if (l.type === wd)
            a.beginPath(),
              a.moveTo(l.startX, l.startY),
              a.lineTo(l.endX, l.endY),
              null !== d && a.Vd(d),
              0 !== h && null !== c && a.ej();
          else if (l.type === Gd) {
            var m = l.startX;
            k = l.startY;
            var n = l.endX,
              p = l.endY;
            l = Math.min(m, n);
            var r = Math.min(k, p);
            m = Math.abs(n - m);
            k = Math.abs(p - k);
            a.beginPath();
            a.rect(l, r, m, k);
            null !== d && a.Vd(d);
            if (null !== c) {
              g && e && rl(a);
              if (0 !== h) {
                if (0 === m || 0 === k)
                  a.beginPath(), a.rect(l, r, Math.max(m, 0.1), Math.max(k, 0.1));
                a.ej();
              }
              g && e && ql(a);
            }
          } else if (l.type === Hd)
            (m = l.startX),
              (k = l.startY),
              (n = l.endX),
              (p = l.endY),
              (l = Math.abs(n - m) / 2),
              (r = Math.abs(p - k) / 2),
              (m = Math.min(m, n) + l),
              (k = Math.min(k, p) + r),
              a.beginPath(),
              a.moveTo(m, k - r),
              a.bezierCurveTo(m + J.Ig * l, k - r, m + l, k - J.Ig * r, m + l, k),
              a.bezierCurveTo(m + l, k + J.Ig * r, m + J.Ig * l, k + r, m, k + r),
              a.bezierCurveTo(m - J.Ig * l, k + r, m - l, k + J.Ig * r, m - l, k),
              a.bezierCurveTo(m - l, k - J.Ig * r, m - J.Ig * l, k - r, m, k - r),
              a.closePath(),
              null !== d && a.Vd(d),
              0 !== h && null !== c && (g && e ? (rl(a), a.ej(), ql(a)) : a.ej());
          else if (l.type === ud)
            for (k = l.figures, l = k.length, r = 0; r < l; r++) {
              m = k.j[r];
              a.beginPath();
              a.moveTo(m.startX, m.startY);
              n = m.segments.j;
              p = n.length;
              for (var q = null, u = 0; u < p; u++) {
                var v = n[u];
                switch (v.type) {
                  case Wd:
                    a.moveTo(v.endX, v.endY);
                    break;
                  case Ed:
                    a.lineTo(v.endX, v.endY);
                    break;
                  case Xd:
                    a.bezierCurveTo(
                      v.point1X,
                      v.point1Y,
                      v.point2X,
                      v.point2Y,
                      v.endX,
                      v.endY,
                    );
                    break;
                  case Yd:
                    a.quadraticCurveTo(v.point1X, v.point1Y, v.endX, v.endY);
                    break;
                  case Zd:
                    if (v.radiusX === v.radiusY) {
                      var w = Math.PI / 180;
                      a.arc(
                        v.point1X,
                        v.point1Y,
                        v.radiusX,
                        v.startAngle * w,
                        (v.startAngle + v.sweepAngle) * w,
                        0 > v.sweepAngle,
                        null !== q ? q.endX : m.startX,
                        null !== q ? q.endY : m.startY,
                      );
                    } else if (((q = ae(v, m)), (w = q.length), 0 === w))
                      a.lineTo(v.centerX, v.centerY);
                    else
                      for (var y = 0; y < w; y++) {
                        var z = q[y];
                        0 === y && a.lineTo(z[0], z[1]);
                        a.bezierCurveTo(z[2], z[3], z[4], z[5], z[6], z[7]);
                      }
                    break;
                  case $d:
                    y = w = 0;
                    if (null !== q && q.type === Zd) {
                      q = ae(q, m);
                      z = q.length;
                      if (0 === z) {
                        a.lineTo(v.centerX, v.centerY);
                        break;
                      }
                      q = q[z - 1] || null;
                      null !== q && ((w = q[6]), (y = q[7]));
                    } else
                      (w = null !== q ? q.endX : m.startX),
                        (y = null !== q ? q.endY : m.startY);
                    q = be(v, m, w, y);
                    w = q.length;
                    if (0 === w) {
                      a.lineTo(v.centerX, v.centerY);
                      break;
                    }
                    for (y = 0; y < w; y++)
                      (z = q[y]),
                        a.bezierCurveTo(z[2], z[3], z[4], z[5], z[6], z[7]);
                    break;
                  default:
                    B('Segment not of valid type: ' + v.type);
                }
                v.isClosed && a.closePath();
                q = v;
              }
              e
                ? m.isShadowed
                  ? (!0 === m.isFilled &&
                      'transparent' !== d &&
                      null !== d &&
                      a.Vd(d),
                    0 !== h && null !== c && (g && rl(a), a.ej(), g && ql(a)))
                  : (g && rl(a),
                    !0 === m.isFilled &&
                      'transparent' !== d &&
                      null !== d &&
                      a.Vd(d),
                    0 !== h && null !== c && a.ej(),
                    g && ql(a))
                : (!0 === m.isFilled && null !== d && a.Vd(d),
                  0 !== h && null !== c && a.ej());
            }
          f && a.et();
          if (null !== this.pathPattern) {
            c = this.pathPattern;
            c.measure(Infinity, Infinity);
            d = c.measuredBounds;
            c.arrange(0, 0, d.width, d.height);
            h = this.geometry;
            a.save();
            a.beginPath();
            d = Ea();
            if (h.type === wd)
              d.push(h.startX),
                d.push(h.startY),
                d.push(h.endX),
                d.push(h.endY),
                Bn(a, b, d, c);
            else if (h.type === ud)
              for (h = h.figures.iterator; h.next(); ) {
                e = h.value;
                d.length = 0;
                d.push(e.startX);
                d.push(e.startY);
                g = e.startX;
                f = e.startY;
                k = g;
                l = f;
                r = e.segments.j;
                m = r.length;
                for (n = 0; n < m; n++) {
                  p = r[n];
                  switch (p.type) {
                    case Wd:
                      Bn(a, b, d, c);
                      d.length = 0;
                      d.push(p.endX);
                      d.push(p.endY);
                      g = p.endX;
                      f = p.endY;
                      k = g;
                      l = f;
                      break;
                    case Ed:
                      d.push(p.endX);
                      d.push(p.endY);
                      g = p.endX;
                      f = p.endY;
                      break;
                    case Xd:
                      J.ze(
                        g,
                        f,
                        p.point1X,
                        p.point1Y,
                        p.point2X,
                        p.point2Y,
                        p.endX,
                        p.endY,
                        0.5,
                        d,
                      );
                      g = p.endX;
                      f = p.endY;
                      break;
                    case Yd:
                      J.Bq(g, f, p.point1X, p.point1Y, p.endX, p.endY, 0.5, d);
                      g = p.endX;
                      f = p.endY;
                      break;
                    case Zd:
                      u = ae(p, e);
                      v = u.length;
                      if (0 === v) {
                        d.push(p.centerX);
                        d.push(p.centerY);
                        g = p.centerX;
                        f = p.centerY;
                        break;
                      }
                      for (q = 0; q < v; q++)
                        (w = u[q]),
                          J.ze(g, f, w[2], w[3], w[4], w[5], w[6], w[7], 0.5, d),
                          (g = w[6]),
                          (f = w[7]);
                      break;
                    case $d:
                      u = be(p, e, g, f);
                      v = u.length;
                      if (0 === v) {
                        d.push(p.centerX);
                        d.push(p.centerY);
                        g = p.centerX;
                        f = p.centerY;
                        break;
                      }
                      for (q = 0; q < v; q++)
                        (w = u[q]),
                          J.ze(g, f, w[2], w[3], w[4], w[5], w[6], w[7], 0.5, d),
                          (g = w[6]),
                          (f = w[7]);
                      break;
                    default:
                      B('Segment not of valid type: ' + p.type);
                  }
                  p.isClosed && (d.push(k), d.push(l), Bn(a, b, d, c));
                }
                Bn(a, b, d, c);
              }
            else if (h.type === Gd)
              d.push(h.startX),
                d.push(h.startY),
                d.push(h.endX),
                d.push(h.startY),
                d.push(h.endX),
                d.push(h.endY),
                d.push(h.startX),
                d.push(h.endY),
                d.push(h.startX),
                d.push(h.startY),
                Bn(a, b, d, c);
            else if (h.type === Hd) {
              f = new fe();
              f.startX = h.endX;
              f.startY = (h.startY + h.endY) / 2;
              g = new ge(Zd);
              g.startAngle = 0;
              g.sweepAngle = 360;
              g.centerX = (h.startX + h.endX) / 2;
              g.centerY = (h.startY + h.endY) / 2;
              g.radiusX = Math.abs(h.startX - h.endX) / 2;
              g.radiusY = Math.abs(h.startY - h.endY) / 2;
              f.add(g);
              h = ae(g, f);
              e = h.length;
              if (0 === e) d.push(g.centerX), d.push(g.centerY);
              else
                for (g = f.startX, f = f.startY, k = 0; k < e; k++)
                  (l = h[k]),
                    J.ze(g, f, l[2], l[3], l[4], l[5], l[6], l[7], 0.5, d),
                    (g = l[6]),
                    (f = l[7]);
              Bn(a, b, d, c);
            }
            Ha(d);
            a.restore();
            a.Qc(!1);
          }
        }
      }
    };
    t.ga = function (a, b) {
      void 0 === b && (b = new H());
      if (a instanceof O) {
        a.kc() &&
          B(
            'getDocumentPoint Spot must be a real, specific Spot, not: ' +
              a.toString(),
          );
        var c = this.naturalBounds,
          d = this.strokeWidth;
        b.h(
          a.x * (c.width + d) - d / 2 + c.x + a.offsetX,
          a.y * (c.height + d) - d / 2 + c.y + a.offsetY,
        );
      } else b.set(a);
      this.sd.ra(b);
      return b;
    };
    t.nq = function (a) {
      void 0 === a && (a = new N());
      var b = this.naturalBounds,
        c = this.sd;
      b = N.allocAt(b.x, b.y, b.width, b.height);
      var d = this.strokeWidth;
      b.Tc(d / 2, d / 2);
      d = H.allocAt(b.x, b.y).transform(c);
      a.h(d.x, d.y, 0, 0);
      d.h(b.right, b.y).transform(c);
      ec(a, d.x, d.y, 0, 0);
      d.h(b.right, b.bottom).transform(c);
      ec(a, d.x, d.y, 0, 0);
      d.h(b.x, b.bottom).transform(c);
      ec(a, d.x, d.y, 0, 0);
      N.free(b);
      H.free(d);
      return a;
    };
    t.Ih = function (a, b) {
      var c = this.geometry;
      if (null === c || (null === this.fill && null === this.stroke)) return !1;
      var d = c.bounds,
        e = this.strokeWidth / 2;
      c.type !== wd || b || (e += 2);
      var f = N.alloc();
      f.assign(d);
      f.Tc(e + 2, e + 2);
      if (!f.aa(a)) return N.free(f), !1;
      d = e + 1e-4;
      if (c.type === wd) {
        if (null === this.stroke) return !1;
        d =
          (c.endX - c.startX) * (a.x - c.startX) +
          (c.endY - c.startY) * (a.y - c.startY);
        if (
          0 >
            (c.startX - c.endX) * (a.x - c.endX) +
              (c.startY - c.endY) * (a.y - c.endY) ||
          0 > d
        )
          return !1;
        N.free(f);
        return J.Xb(c.startX, c.startY, c.endX, c.endY, e, a.x, a.y);
      }
      if (c.type === Gd) {
        b = c.startX;
        var g = c.startY,
          h = c.endX;
        c = c.endY;
        f.x = Math.min(b, h);
        f.y = Math.min(g, c);
        f.width = Math.abs(h - b);
        f.height = Math.abs(c - g);
        if (null === this.fill) {
          f.Tc(-d, -d);
          if (f.aa(a)) return N.free(f), !1;
          f.Tc(d, d);
        }
        null !== this.stroke && f.Tc(e, e);
        a = f.aa(a);
        N.free(f);
        return a;
      }
      if (c.type === Hd) {
        g = c.startX;
        e = c.startY;
        h = c.endX;
        var k = c.endY;
        c = Math.min(g, h);
        b = Math.min(e, k);
        g = Math.abs(h - g) / 2;
        e = Math.abs(k - e) / 2;
        c = a.x - (c + g);
        b = a.y - (b + e);
        if (null === this.fill) {
          g -= d;
          e -= d;
          if (0 >= g || 0 >= e || 1 >= (c * c) / (g * g) + (b * b) / (e * e))
            return N.free(f), !1;
          g += d;
          e += d;
        }
        null !== this.stroke && ((g += d), (e += d));
        N.free(f);
        return 0 >= g || 0 >= e ? !1 : 1 >= (c * c) / (g * g) + (b * b) / (e * e);
      }
      if (c.type === ud)
        return (
          N.free(f),
          null === this.fill
            ? de(c, a.x, a.y, e)
            : c.aa(a, e, 1 < this.strokeWidth, b)
        );
      B('Unknown Geometry type: ' + c.type);
      return !1;
    };
    t.sm = function (a, b, c, d) {
      var e = this.desiredSize,
        f = this.uh;
      a = Math.max(a, 0);
      b = Math.max(b, 0);
      if (null !== this.Rd) var g = this.geometry.bounds;
      else {
        var h = this.figure,
          k = Cn[h];
        if (void 0 === k) {
          var l = J.He[h];
          'string' === typeof l && (l = J.He[l]);
          'function' === typeof l
            ? ((k = l(null, 100, 100)), (Cn[h] = k))
            : B('Unsupported Figure: ' + h);
        }
        g = k.bounds;
      }
      h = g.width;
      k = g.height;
      l = g.width;
      var m = g.height;
      switch (jl(this, !0)) {
        case Ag:
          d = c = 0;
          break;
        case vd:
          l = Math.max(a - f, 0);
          m = Math.max(b - f, 0);
          break;
        case Vk:
          l = Math.max(a - f, 0);
          d = 0;
          break;
        case Wk:
          (c = 0), (m = Math.max(b - f, 0));
      }
      isFinite(e.width) && (l = e.width);
      isFinite(e.height) && (m = e.height);
      e = this.maxSize;
      g = this.minSize;
      c = Math.max(c - f, g.width);
      d = Math.max(d - f, g.height);
      l = Math.min(e.width, l);
      m = Math.min(e.height, m);
      l = isFinite(l) ? Math.max(c, l) : Math.max(h, c);
      m = isFinite(m) ? Math.max(d, m) : Math.max(k, d);
      c = Bg(this);
      switch (c) {
        case Ag:
          break;
        case vd:
          h = l;
          k = m;
          break;
        case Cg:
          c = Math.min(l / h, m / k);
          isFinite(c) || (c = 1);
          h *= c;
          k *= c;
          break;
        default:
          B(c + ' is not a valid geometryStretch.');
      }
      null !== this.Rd
        ? ((h = Math.max(h, 0.01)),
          (k = Math.max(k, 0.01)),
          (g = null !== this.Rd ? this.Rd : this.ka),
          (e = h),
          (d = k),
          (c = g.copy()),
          (g = g.bounds),
          (e /= g.width),
          (d /= g.height),
          isFinite(e) || (e = 1),
          isFinite(d) || (d = 1),
          (1 === e && 1 === d) || c.scale(e, d),
          (this.ka = c))
        : (null !== this.ka &&
            J.$(this.ka.ll, a - f) &&
            J.$(this.ka.kl, b - f)) ||
          (this.ka = W.makeGeometry(this, h, k));
      g = this.ka.bounds;
      Infinity === a || Infinity === b
        ? gl(
            this,
            g.x - f / 2,
            g.y - f / 2,
            0 === a && 0 === h ? 0 : g.width + f,
            0 === b && 0 === k ? 0 : g.height + f,
          )
        : gl(this, -(f / 2), -(f / 2), l + f, m + f);
    };
    function Bg(a) {
      var b = a.geometryStretch;
      return null !== a.Rd
        ? b === Uk
          ? vd
          : b
        : b === Uk
        ? Cn[a.figure].defaultStretch
        : b;
    }
    t.Gh = function (a, b, c, d) {
      ll(this, a, b, c, d);
    };
    t.Sc = function (a, b, c) {
      return this.ik(a.x, a.y, b.x, b.y, c);
    };
    t.ik = function (a, b, c, d, e) {
      var f = this.transform,
        g = 1 / (f.m11 * f.m22 - f.m12 * f.m21),
        h = f.m22 * g,
        k = -f.m12 * g,
        l = -f.m21 * g,
        m = f.m11 * g,
        n = g * (f.m21 * f.dy - f.m22 * f.dx),
        p = g * (f.m12 * f.dx - f.m11 * f.dy);
      f = a * h + b * l + n;
      g = a * k + b * m + p;
      h = c * h + d * l + n;
      k = c * k + d * m + p;
      n = this.uh / 2;
      l = this.ka;
      null === l && (this.measure(Infinity, Infinity), (l = this.ka));
      p = l.bounds;
      m = !1;
      if (l.type === wd)
        if (1.5 >= this.strokeWidth)
          m = J.De(l.startX, l.startY, l.endX, l.endY, f, g, h, k, e);
        else {
          l.startX === l.endX
            ? ((d = n), (m = 0))
            : ((b = (l.endY - l.startY) / (l.endX - l.startX)),
              (m = n / Math.sqrt(1 + b * b)),
              (d = m * b));
          b = Ea();
          a = new H();
          J.De(
            l.startX + d,
            l.startY + m,
            l.endX + d,
            l.endY + m,
            f,
            g,
            h,
            k,
            a,
          ) && b.push(a);
          a = new H();
          J.De(
            l.startX - d,
            l.startY - m,
            l.endX - d,
            l.endY - m,
            f,
            g,
            h,
            k,
            a,
          ) && b.push(a);
          a = new H();
          J.De(
            l.startX + d,
            l.startY + m,
            l.startX - d,
            l.startY - m,
            f,
            g,
            h,
            k,
            a,
          ) && b.push(a);
          a = new H();
          J.De(l.endX + d, l.endY + m, l.endX - d, l.endY - m, f, g, h, k, a) &&
            b.push(a);
          h = b.length;
          if (0 === h) return Ha(b), !1;
          m = !0;
          k = Infinity;
          for (d = 0; d < h; d++)
            (a = b[d]),
              (c = (a.x - f) * (a.x - f) + (a.y - g) * (a.y - g)),
              c < k && ((k = c), (e.x = a.x), (e.y = a.y));
          Ha(b);
        }
      else if (l.type === Gd)
        m = J.Sc(
          p.x - n,
          p.y - n,
          p.x + p.width + n,
          p.y + p.height + n,
          f,
          g,
          h,
          k,
          e,
        );
      else if (l.type === Hd) {
        b = N.allocAt(p.x, p.y, p.width, p.height).Tc(n, n);
        a: if (0 === b.width)
          m = J.De(b.x, b.y, b.x, b.y + b.height, f, g, h, k, e);
        else if (0 === b.height)
          m = J.De(b.x, b.y, b.x + b.width, b.y, f, g, h, k, e);
        else {
          a = b.width / 2;
          l = b.height / 2;
          d = b.x + a;
          m = b.y + l;
          c = 9999;
          f !== h && (c = (g - k) / (f - h));
          if (9999 > Math.abs(c)) {
            k = g - m - c * (f - d);
            if (0 > a * a * c * c + l * l - k * k) {
              e.x = NaN;
              e.y = NaN;
              m = !1;
              break a;
            }
            n = Math.sqrt(a * a * c * c + l * l - k * k);
            h = (-(a * a * c * k) + a * l * n) / (l * l + a * a * c * c) + d;
            a = (-(a * a * c * k) - a * l * n) / (l * l + a * a * c * c) + d;
            l = c * (h - d) + k + m;
            k = c * (a - d) + k + m;
            Math.abs((f - h) * (f - h)) + Math.abs((g - l) * (g - l)) <
            Math.abs((f - a) * (f - a)) + Math.abs((g - k) * (g - k))
              ? ((e.x = h), (e.y = l))
              : ((e.x = a), (e.y = k));
          } else {
            h = l * l;
            k = f - d;
            h -= (h / (a * a)) * k * k;
            if (0 > h) {
              e.x = NaN;
              e.y = NaN;
              m = !1;
              break a;
            }
            k = Math.sqrt(h);
            h = m + k;
            k = m - k;
            Math.abs(h - g) < Math.abs(k - g)
              ? ((e.x = f), (e.y = h))
              : ((e.x = f), (e.y = k));
          }
          m = !0;
        }
        N.free(b);
      } else if (l.type === ud) {
        p = H.alloc();
        var r = h - f;
        var q = k - g;
        var u = r * r + q * q;
        e.x = h;
        e.y = k;
        for (var v = 0; v < l.figures.count; v++) {
          var w = l.figures.j[v],
            y = w.segments;
          r = w.startX;
          q = w.startY;
          for (var z = r, A = q, C = 0; C < y.count; C++) {
            var I = y.j[C],
              P = I.type;
            var K = I.endX;
            var V = I.endY;
            var Q = !1;
            switch (P) {
              case Wd:
                z = K;
                A = V;
                break;
              case Ed:
                Q = Dn(r, q, K, V, f, g, h, k, p);
                break;
              case Xd:
                Q = J.cq(
                  r,
                  q,
                  I.point1X,
                  I.point1Y,
                  I.point2X,
                  I.point2Y,
                  K,
                  V,
                  f,
                  g,
                  h,
                  k,
                  0.6,
                  p,
                );
                break;
              case Yd:
                Q = J.cq(
                  r,
                  q,
                  (r + 2 * I.point1X) / 3,
                  (q + 2 * I.point1Y) / 3,
                  (2 * I.point1X + K) / 3,
                  (2 * I.point1X + K) / 3,
                  K,
                  V,
                  f,
                  g,
                  h,
                  k,
                  0.6,
                  p,
                );
                break;
              case Zd:
              case $d:
                P = I.type === Zd ? ae(I, w) : be(I, w, r, q);
                var ca = P.length;
                if (0 === ca) {
                  Q = Dn(r, q, I.centerX, I.centerY, f, g, h, k, p);
                  break;
                }
                V = null;
                for (K = 0; K < ca; K++) {
                  V = P[K];
                  if (0 === K && Dn(r, q, V[0], V[1], f, g, h, k, p)) {
                    var pa = En(f, g, p, u, e);
                    pa < u && ((u = pa), (m = !0));
                  }
                  J.cq(
                    V[0],
                    V[1],
                    V[2],
                    V[3],
                    V[4],
                    V[5],
                    V[6],
                    V[7],
                    f,
                    g,
                    h,
                    k,
                    0.6,
                    p,
                  ) && ((pa = En(f, g, p, u, e)), pa < u && ((u = pa), (m = !0)));
                }
                K = V[6];
                V = V[7];
                break;
              default:
                B('Unknown Segment type: ' + P);
            }
            r = K;
            q = V;
            Q && ((Q = En(f, g, p, u, e)), Q < u && ((u = Q), (m = !0)));
            I.isClosed &&
              ((K = z),
              (V = A),
              Dn(r, q, K, V, f, g, h, k, p) &&
                ((I = En(f, g, p, u, e)), I < u && ((u = I), (m = !0))));
          }
        }
        f = c - a;
        g = d - b;
        h = Math.sqrt(f * f + g * g);
        0 !== h && ((f /= h), (g /= h));
        e.x -= f * n;
        e.y -= g * n;
        H.free(p);
      } else B('Unknown Geometry type: ' + l.type);
      if (!m) return !1;
      this.transform.ra(e);
      return !0;
    };
    function En(a, b, c, d, e) {
      a = c.x - a;
      b = c.y - b;
      b = a * a + b * b;
      return b < d ? ((e.x = c.x), (e.y = c.y), b) : d;
    }
    function Dn(a, b, c, d, e, f, g, h, k) {
      var l = !1,
        m = (e - g) * (b - d) - (f - h) * (a - c);
      if (0 === m) return !1;
      k.x = ((e * h - f * g) * (a - c) - (e - g) * (a * d - b * c)) / m;
      k.y = ((e * h - f * g) * (b - d) - (f - h) * (a * d - b * c)) / m;
      (a > c ? a - c : c - a) < (b > d ? b - d : d - b)
        ? ((a = b < d ? b : d),
          (b = b < d ? d : b),
          (k.y > a || J.$(k.y, a)) && (k.y < b || J.$(k.y, b)) && (l = !0))
        : ((b = a < c ? a : c),
          (a = a < c ? c : a),
          (k.x > b || J.$(k.x, b)) && (k.x < a || J.$(k.x, a)) && (l = !0));
      return l;
    }
    t.Hh = function (a, b) {
      if (void 0 === b) return a.qf(this.actualBounds);
      var c = this.ka;
      null === c && (this.measure(Infinity, Infinity), (c = this.ka));
      c = c.bounds;
      var d = this.strokeWidth / 2,
        e = !1,
        f = H.alloc();
      f.h(c.x - d, c.y - d);
      a.aa(b.ra(f)) &&
        (f.h(c.x - d, c.bottom + d),
        a.aa(b.ra(f)) &&
          (f.h(c.right + d, c.bottom + d),
          a.aa(b.ra(f)) &&
            (f.h(c.right + d, c.y - d), a.aa(b.ra(f)) && (e = !0))));
      H.free(f);
      return e;
    };
    t.Fc = function (a, b) {
      if (
        this.Hh(a, b) ||
        (void 0 === b && ((b = this.transform), a.qf(this.actualBounds)))
      )
        return !0;
      var c = rd.alloc();
      c.set(b);
      c.tt();
      var d = a.left,
        e = a.right,
        f = a.top;
      a = a.bottom;
      var g = H.alloc();
      g.h(d, f);
      c.ra(g);
      if (this.Ih(g, !0)) return H.free(g), !0;
      g.h(e, f);
      c.ra(g);
      if (this.Ih(g, !0)) return H.free(g), !0;
      g.h(d, a);
      c.ra(g);
      if (this.Ih(g, !0)) return H.free(g), !0;
      g.h(e, a);
      c.ra(g);
      if (this.Ih(g, !0)) return H.free(g), !0;
      var h = H.alloc(),
        k = H.alloc();
      c.set(b);
      c.Ov(this.transform);
      c.tt();
      h.x = e;
      h.y = f;
      h.transform(c);
      g.x = d;
      g.y = f;
      g.transform(c);
      b = !1;
      Fn(this, g, h, k)
        ? (b = !0)
        : ((g.x = e),
          (g.y = a),
          g.transform(c),
          Fn(this, g, h, k)
            ? (b = !0)
            : ((h.x = d),
              (h.y = a),
              h.transform(c),
              Fn(this, g, h, k)
                ? (b = !0)
                : ((g.x = d),
                  (g.y = f),
                  g.transform(c),
                  Fn(this, g, h, k) && (b = !0))));
      H.free(g);
      rd.free(c);
      H.free(h);
      H.free(k);
      return b;
    };
    function Fn(a, b, c, d) {
      if (!a.Sc(b, c, d)) return !1;
      a = b.x;
      b = b.y;
      var e = c.x,
        f = c.y;
      c = d.x;
      d = d.y;
      if (a === e) return b < f ? ((a = b), (b = f)) : (a = f), d >= a && d <= b;
      a < e ? ((d = a), (a = e)) : (d = e);
      return c >= d && c <= a;
    }
    t.Nx = function (a, b, c) {
      function d(a, b) {
        for (var c = a.length, d = 0; d < c; d += 2)
          if (b.cd(a[d], a[d + 1]) > e) return !0;
        return !1;
      }
      if (c && null !== this.fill && this.Ih(a, !0)) return !0;
      var e = a.Ae(b),
        f = e;
      1.5 < this.strokeWidth &&
        ((e = this.strokeWidth / 2 + Math.sqrt(e)), (e *= e));
      b = this.ka;
      if (
        null === b &&
        (this.measure(Infinity, Infinity), (b = this.ka), null === b)
      )
        return !1;
      if (!c) {
        var g = b.bounds,
          h = g.x,
          k = g.y,
          l = g.x + g.width;
        g = g.y + g.height;
        if (
          Bb(a.x, a.y, h, k) <= e &&
          Bb(a.x, a.y, l, k) <= e &&
          Bb(a.x, a.y, h, g) <= e &&
          Bb(a.x, a.y, l, g) <= e
        )
          return !0;
      }
      h = b.startX;
      k = b.startY;
      l = b.endX;
      g = b.endY;
      if (b.type === wd) {
        if (
          ((c = (h - l) * (a.x - l) + (k - g) * (a.y - g)),
          Ab(a.x, a.y, h, k, l, g) <=
            (0 <= (l - h) * (a.x - h) + (g - k) * (a.y - k) && 0 <= c ? e : f))
        )
          return !0;
      } else {
        if (b.type === Gd)
          return (
            (b = !1),
            c &&
              (b =
                Ab(a.x, a.y, h, k, h, g) <= e ||
                Ab(a.x, a.y, h, k, l, k) <= e ||
                Ab(a.x, a.y, l, k, l, g) <= e ||
                Ab(a.x, a.y, h, g, l, g) <= e),
            b
          );
        if (b.type === Hd) {
          b = a.x - (h + l) / 2;
          f = a.y - (k + g) / 2;
          var m = Math.abs(l - h) / 2,
            n = Math.abs(g - k) / 2;
          if (0 === m || 0 === n) return Ab(a.x, a.y, h, k, l, g) <= e ? !0 : !1;
          if (c) {
            if (((a = J.dz(m, n, b, f)), a * a <= e)) return !0;
          } else
            return Bb(b, f, -m, 0) >= e ||
              Bb(b, f, 0, -n) >= e ||
              Bb(b, f, 0, n) >= e ||
              Bb(b, f, m, 0) >= e
              ? !1
              : !0;
        } else if (b.type === ud) {
          l = b.bounds;
          f = l.x;
          h = l.y;
          k = l.x + l.width;
          l = l.y + l.height;
          if (
            a.x > k &&
            a.x < f &&
            a.y > l &&
            a.y < h &&
            Ab(a.x, a.y, f, h, f, l) > e &&
            Ab(a.x, a.y, f, h, k, h) > e &&
            Ab(a.x, a.y, k, l, f, l) > e &&
            Ab(a.x, a.y, k, l, k, h) > e
          )
            return !1;
          f = Math.sqrt(e);
          if (c) {
            if (null === this.fill ? de(b, a.x, a.y, f) : b.aa(a, f, !0))
              return !0;
          } else {
            c = b.figures;
            for (b = 0; b < c.count; b++) {
              f = c.j[b];
              g = f.startX;
              m = f.startY;
              if (a.cd(g, m) > e) return !1;
              h = f.segments.j;
              k = h.length;
              for (l = 0; l < k; l++)
                switch (((n = h[l]), n.type)) {
                  case Wd:
                  case Ed:
                    g = n.endX;
                    m = n.endY;
                    if (a.cd(g, m) > e) return !1;
                    break;
                  case Xd:
                    var p = Ea();
                    J.ze(
                      g,
                      m,
                      n.point1X,
                      n.point1Y,
                      n.point2X,
                      n.point2Y,
                      n.endX,
                      n.endY,
                      0.8,
                      p,
                    );
                    g = d(p, a);
                    Ha(p);
                    if (g) return !1;
                    g = n.endX;
                    m = n.endY;
                    if (a.cd(g, m) > e) return !1;
                    break;
                  case Yd:
                    p = Ea();
                    J.Bq(g, m, n.point1X, n.point1Y, n.endX, n.endY, 0.8, p);
                    g = d(p, a);
                    Ha(p);
                    if (g) return !1;
                    g = n.endX;
                    m = n.endY;
                    if (a.cd(g, m) > e) return !1;
                    break;
                  case Zd:
                  case $d:
                    p = n.type === Zd ? ae(n, f) : be(n, f, g, m);
                    var r = p.length;
                    if (0 === r) {
                      g = n.centerX;
                      m = n.centerY;
                      if (a.cd(g, m) > e) return !1;
                      break;
                    }
                    n = null;
                    for (var q = Ea(), u = 0; u < r; u++)
                      if (
                        ((n = p[u]),
                        (q.length = 0),
                        J.ze(
                          n[0],
                          n[1],
                          n[2],
                          n[3],
                          n[4],
                          n[5],
                          n[6],
                          n[7],
                          0.8,
                          q,
                        ),
                        d(q, a))
                      )
                        return Ha(q), !1;
                    Ha(q);
                    null !== n && ((g = n[6]), (m = n[7]));
                    break;
                  default:
                    B('Unknown Segment type: ' + n.type);
                }
            }
            return !0;
          }
        }
      }
      return !1;
    };
    t.cc = function () {
      this.ka = null;
    };
    function Gn(a) {
      var b = a.diagram;
      (null !== b && b.undoManager.isUndoingRedoing) ||
        ((a.segmentOrientation = Hn),
        'None' !== a.Zl
          ? ((a.segmentIndex = -1), (a.alignmentFocus = fd))
          : 'None' !== a.bl &&
            ((a.segmentIndex = 0), (a.alignmentFocus = new O(1 - fd.x, fd.y))));
    }
    W.makeGeometry = function (a, b, c) {
      if ('None' !== a.toArrow) var d = In[a.toArrow];
      else
        'None' !== a.fromArrow
          ? (d = In[a.fromArrow])
          : ((d = J.He[a.figure]),
            'string' === typeof d && (d = J.He[d]),
            void 0 === d && B('Unknown Shape.figure: ' + a.figure),
            (d = d(a, b, c)),
            (d.ll = b),
            (d.kl = c));
      if (null === d) {
        var e = J.He.Rectangle;
        'function' === typeof e && (d = e(a, b, c));
      }
      return d;
    };
    function Jn(a) {
      var b = In[a];
      if (void 0 === b) {
        var c = a.toLowerCase();
        if ('none' === c) return 'None';
        b = In[c];
        if (void 0 === b) {
          var d = null,
            e;
          for (e in J.Nm)
            if (e.toLowerCase() === c) {
              d = e;
              break;
            }
          if (null !== d)
            return (a = Id(J.Nm[d], !1)), (In[d] = a), c !== d && (In[c] = d), d;
        }
      }
      return 'string' === typeof b ? b : b instanceof td ? a : null;
    }
    ma.Object.defineProperties(W.prototype, {
      geometry: {
        get: function () {
          return null !== this.ka ? this.ka : this.Rd;
        },
        set: function (a) {
          var b = this.ka;
          if (b !== a) {
            null !== a
              ? (this.Rd = this.ka = a.freeze())
              : (this.Rd = this.ka = null);
            var c = this.part;
            null !== c && (c.hh = NaN);
            this.o();
            this.g('geometry', b, a);
            dl(this) &&
              ((a = this.part), null !== a && el(this, a, 'geometryString'));
          }
        },
      },
      geometryString: {
        get: function () {
          return null === this.geometry ? '' : this.geometry.toString();
        },
        set: function (a) {
          a = Id(a);
          var b = a.normalize();
          this.geometry = a;
          this.position = a = H.allocAt(-b.x, -b.y);
          H.free(a);
        },
      },
      isGeometryPositioned: {
        get: function () {
          return this.Zn;
        },
        set: function (a) {
          var b = this.Zn;
          b !== a &&
            ((this.Zn = a), this.o(), this.g('isGeometryPositioned', b, a));
        },
      },
      fill: {
        get: function () {
          return this.al;
        },
        set: function (a) {
          var b = this.al;
          b !== a &&
            (null !== a && Ql(a, 'Shape.fill'),
            a instanceof sl && a.freeze(),
            (this.al = a),
            this.N(),
            this.g('fill', b, a));
        },
      },
      stroke: {
        get: function () {
          return this.Cc;
        },
        set: function (a) {
          var b = this.Cc;
          b !== a &&
            (null !== a && Ql(a, 'Shape.stroke'),
            a instanceof sl && a.freeze(),
            (this.Cc = a),
            this.N(),
            this.g('stroke', b, a));
        },
      },
      strokeWidth: {
        get: function () {
          return this.uh;
        },
        set: function (a) {
          var b = this.uh;
          if (b !== a)
            if (0 <= a) {
              this.uh = a;
              this.o();
              var c = this.part;
              null !== c && (c.hh = NaN);
              this.g('strokeWidth', b, a);
            } else va(a, 'value >= 0', W, 'strokeWidth:value');
        },
      },
      strokeCap: {
        get: function () {
          return this.Sl;
        },
        set: function (a) {
          var b = this.Sl;
          b !== a &&
            ('string' !== typeof a ||
            ('butt' !== a && 'round' !== a && 'square' !== a)
              ? va(a, '"butt", "round", or "square"', W, 'strokeCap')
              : ((this.Sl = a), this.N(), this.g('strokeCap', b, a)));
        },
      },
      strokeJoin: {
        get: function () {
          return this.Tl;
        },
        set: function (a) {
          var b = this.Tl;
          b !== a &&
            ('string' !== typeof a ||
            ('miter' !== a && 'bevel' !== a && 'round' !== a)
              ? va(a, '"miter", "bevel", or "round"', W, 'strokeJoin')
              : ((this.Tl = a), this.N(), this.g('strokeJoin', b, a)));
        },
      },
      strokeMiterLimit: {
        get: function () {
          return this.Oj;
        },
        set: function (a) {
          var b = this.Oj;
          if (b !== a && 1 <= a) {
            this.Oj = a;
            this.N();
            var c = this.part;
            null !== c && (c.hh = NaN);
            this.g('strokeMiterLimit', b, a);
          }
        },
      },
      strokeDashArray: {
        get: function () {
          return this.sh;
        },
        set: function (a) {
          var b = this.sh;
          if (b !== a) {
            if (null !== a) {
              for (var c = a.length, d = 0, e = 0; e < c; e++) {
                var f = a[e];
                (0 <= f && isFinite(f)) ||
                  B(
                    'strokeDashArray:value ' +
                      f +
                      ' at index ' +
                      e +
                      ' must be a positive number or zero.',
                  );
                d += f;
              }
              if (0 === d) {
                if (null === b) return;
                a = null;
              }
            }
            this.sh = a;
            this.N();
            this.g('strokeDashArray', b, a);
          }
        },
      },
      strokeDashOffset: {
        get: function () {
          return this.th;
        },
        set: function (a) {
          var b = this.th;
          b !== a &&
            0 <= a &&
            ((this.th = a), this.N(), this.g('strokeDashOffset', b, a));
        },
      },
      figure: {
        get: function () {
          return this.$k;
        },
        set: function (a) {
          var b = this.$k;
          if (b !== a) {
            var c = J.He[a];
            'function' === typeof c
              ? (c = a)
              : (c = J.He[a.toLowerCase()]) || B('Unknown Shape.figure: ' + a);
            b !== c &&
              ((a = this.part),
              null !== a && (a.hh = NaN),
              (this.$k = c),
              (this.Rd = null),
              this.cc(),
              this.o(),
              this.g('figure', b, c));
          }
        },
      },
      toArrow: {
        get: function () {
          return this.Zl;
        },
        set: function (a) {
          var b = this.Zl;
          !0 === a ? (a = 'Standard') : !1 === a && (a = '');
          if (b !== a) {
            var c = Jn(a);
            null === c
              ? B('Unknown Shape.toArrow: ' + a)
              : b !== c &&
                ((this.Zl = c),
                (this.Rd = null),
                this.cc(),
                this.o(),
                Gn(this),
                this.g('toArrow', b, c));
          }
        },
      },
      fromArrow: {
        get: function () {
          return this.bl;
        },
        set: function (a) {
          var b = this.bl;
          !0 === a ? (a = 'Standard') : !1 === a && (a = '');
          if (b !== a) {
            var c = Jn(a);
            null === c
              ? B('Unknown Shape.fromArrow: ' + a)
              : b !== c &&
                ((this.bl = c),
                (this.Rd = null),
                this.cc(),
                this.o(),
                Gn(this),
                this.g('fromArrow', b, c));
          }
        },
      },
      spot1: {
        get: function () {
          return this.ff;
        },
        set: function (a) {
          var b = this.ff;
          b.A(a) || ((this.ff = a = a.G()), this.o(), this.g('spot1', b, a));
        },
      },
      spot2: {
        get: function () {
          return this.gf;
        },
        set: function (a) {
          var b = this.gf;
          b.A(a) || ((this.gf = a = a.G()), this.o(), this.g('spot2', b, a));
        },
      },
      parameter1: {
        get: function () {
          return this.Yo;
        },
        set: function (a) {
          var b = this.Yo;
          b !== a &&
            ((this.Yo = a), this.cc(), this.o(), this.g('parameter1', b, a));
        },
      },
      parameter2: {
        get: function () {
          return this.Zo;
        },
        set: function (a) {
          var b = this.Zo;
          b !== a &&
            ((this.Zo = a), this.cc(), this.o(), this.g('parameter2', b, a));
        },
      },
      naturalBounds: {
        get: function () {
          if (null !== this.ka) return this.pc.assign(this.ka.bounds), this.pc;
          var a = this.desiredSize;
          return new N(0, 0, a.width, a.height);
        },
      },
      pathPattern: {
        get: function () {
          return this.ap;
        },
        set: function (a) {
          var b = this.ap;
          b !== a && ((this.ap = a), this.N(), this.g('pathPattern', b, a));
        },
      },
      geometryStretch: {
        get: function () {
          return this.Nn;
        },
        set: function (a) {
          var b = this.Nn;
          b !== a && ((this.Nn = a), this.g('geometryStretch', b, a));
        },
      },
      interval: {
        get: function () {
          return this.Hd;
        },
        set: function (a) {
          var b = this.Hd;
          a = Math.floor(a);
          if (b !== a && 0 <= a) {
            this.Hd = a;
            var c = this.diagram;
            null !== c && this.panel === c.grid && nj(c);
            this.o();
            c = this.panel;
            null !== c && (c.$g = null);
            this.g('interval', b, a);
          }
        },
      },
      graduatedStart: {
        get: function () {
          return this.Fd;
        },
        set: function (a) {
          var b = this.Fd;
          b !== a &&
            (0 > a ? (a = 0) : 1 < a && (a = 1),
            (this.Fd = a),
            this.o(),
            this.g('graduatedStart', b, a));
        },
      },
      graduatedEnd: {
        get: function () {
          return this.Dd;
        },
        set: function (a) {
          var b = this.Dd;
          b !== a &&
            (0 > a ? (a = 0) : 1 < a && (a = 1),
            (this.Dd = a),
            this.o(),
            this.g('graduatedEnd', b, a));
        },
      },
      graduatedSkip: {
        get: function () {
          return this.Ed;
        },
        set: function (a) {
          var b = this.Ed;
          b !== a && ((this.Ed = a), this.o(), this.g('graduatedSkip', b, a));
        },
      },
    });
    W.prototype.intersectsRect = W.prototype.Fc;
    W.prototype.containedInRect = W.prototype.Hh;
    W.prototype.getNearestIntersectionPoint = W.prototype.Sc;
    W.prototype.getDocumentBounds = W.prototype.nq;
    W.prototype.getDocumentPoint = W.prototype.ga;
    var In = new db(),
      Cn = new db();
    W.className = 'Shape';
    W.getFigureGenerators = function () {
      var a = new G(),
        b;
      for (b in J.He) b !== b.toLowerCase() && a.add(b, J.He[b]);
      a.freeze();
      return a;
    };
    W.defineFigureGenerator = function (a, b) {
      var c = a.toLowerCase(),
        d = J.He;
      d[a] = b;
      d[c] = a;
    };
    W.getArrowheadGeometries = function () {
      var a = new G();
      for (d in J.Nm)
        if (void 0 === In[d]) {
          var b = Id(J.Nm[d], !1);
          In[d] = b;
          b = d.toLowerCase();
          b !== d && (In[b] = d);
        }
      for (var c in In)
        if (c !== c.toLowerCase()) {
          var d = In[c];
          d instanceof td && a.add(c, d);
        }
      a.freeze();
      return a;
    };
    W.defineArrowheadGeometry = function (a, b) {
      var c = null;
      'string' === typeof b ? (c = Id(b, !1)) : (c = b);
      b = a.toLowerCase();
      ('none' !== b && a !== b) ||
        B(
          'Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: ' +
            a,
        );
      var d = In;
      d[a] = c;
      d[b] = a;
    };
    function Xg() {
      Y.call(this);
      Kn || ((Ln = Vg ? new Dk(null).context : null), (Kn = !0));
      this.kx = this.Sb = '';
      this.Cc = 'black';
      this.he = '13px sans-serif';
      this.Ii = 'start';
      this.Cd = Ag;
      this.Mi = bd;
      this.xj = !0;
      this.pi = this.ri = !1;
      this.lg = Mn;
      this.wg = Nn;
      this.$r = this.qb = this.Lc = 0;
      this.Du = this.Eu = null;
      this.Dn = !1;
      this.Ac = this.en = this.Qp = this.Ji = this.Rp = null;
      this.ef = this.df = 0;
      this.pe = Infinity;
      this.ti = 0;
      this.ie = null;
      this.ve = 0;
      this.ge = this.fb = this.Pb = null;
      this.Hd = 1;
      this.Fd = 0;
      this.Dd = 1;
      this.Ed = this.tj = null;
    }
    la(Xg, Y);
    Xg.prototype.cloneProtected = function (a) {
      Y.prototype.cloneProtected.call(this, a);
      a.Sb = this.Sb;
      a.kx = this.kx;
      a.Cc = this.Cc;
      a.he = this.he;
      a.Ii = this.Ii;
      a.Cd = this.Cd;
      a.Mi = this.Mi;
      a.xj = this.xj;
      a.ri = this.ri;
      a.pi = this.pi;
      a.lg = this.lg;
      a.wg = this.wg;
      a.Lc = this.Lc;
      a.$r = this.$r;
      a.qb = this.qb;
      a.Eu = this.Eu;
      a.Du = this.Du;
      a.Dn = this.Dn;
      a.Rp = this.Rp;
      a.Ji = this.Ji;
      a.Qp = this.Qp;
      a.en = this.en;
      a.Ac = this.Ac;
      a.df = this.df;
      a.ef = this.ef;
      a.pe = this.pe;
      a.ie = this.ie;
      a.ve = this.ve;
      a.Pb = this.Pb;
      a.fb = this.fb;
      a.ge = this.ge;
      a.ti = this.ti;
      a.Hd = this.Hd;
      a.Fd = this.Fd;
      a.Dd = this.Dd;
      a.tj = this.tj;
      a.Ed = this.Ed;
    };
    function Sm(a, b) {
      a.F = b.F | 6144;
      a.jb = b.opacity;
      a.gb = b.background;
      a.dc = b.areaBackground;
      a.Jc = b.desiredSize.G();
      a.dg = b.minSize.G();
      a.cg = b.maxSize.G();
      a.ag = b.ag.copy();
      a.ya = b.scale;
      a.Zb = b.angle;
      a.xe = b.stretch;
      a.gh = b.margin.G();
      a.wb = b.alignment.G();
      a.Gk = b.alignmentFocus.G();
      a.Jl = b.segmentFraction;
      a.Kl = b.segmentOffset.G();
      a.Ll = b.segmentOrientation;
      null !== b.jd && (a.jd = b.jd.copy());
      a.Nl = b.shadowVisible;
      b instanceof Xg &&
        ((a.Sb = b.Sb),
        (a.Cc = b.Cc),
        (a.he = b.he),
        (a.Ii = b.Ii),
        (a.Cd = b.Cd),
        (a.Mi = b.Mi),
        (a.xj = b.xj),
        (a.ri = b.ri),
        (a.pi = b.pi),
        (a.lg = b.lg),
        (a.wg = b.wg),
        (a.ie = null),
        (a.df = b.df),
        (a.ef = b.ef),
        (a.pe = b.pe),
        (a.ti = b.ti),
        (a.Hd = b.Hd),
        (a.Fd = b.Fd),
        (a.Dd = b.Dd),
        (a.tj = b.tj),
        (a.Ed = b.Ed));
    }
    t = Xg.prototype;
    t.bb = function (a) {
      a.classType === Xg ? (this.wrap = a) : Y.prototype.bb.call(this, a);
    };
    t.toString = function () {
      return 22 < this.Sb.length
        ? 'TextBlock("' + this.Sb.substring(0, 20) + '"...)'
        : 'TextBlock("' + this.Sb + '")';
    };
    t.o = function () {
      Y.prototype.o.call(this);
      this.Du = this.Eu = null;
    };
    t.Pi = function (a, b) {
      if (null !== this.Cc && 0 !== this.Sb.length && null !== this.he) {
        var c = this.naturalBounds,
          d = this.actualBounds,
          e = c.width,
          f = c.height,
          g = On(this),
          h = (a.textAlign = this.Ii),
          k = b.ol;
        'start' === h
          ? (h = k ? 'right' : 'left')
          : 'end' === h && (h = k ? 'left' : 'right');
        k = this.ri;
        var l = this.pi;
        ji(this, a, this.Cc, !0, !1, c, d);
        (k || l) && ji(this, a, this.Cc, !1, !1, c, d);
        d = 0;
        c = !1;
        var m = H.allocAt(0, 0);
        this.sd.ra(m);
        var n = H.allocAt(0, g);
        this.sd.ra(n);
        var p = m.Ae(n);
        H.free(m);
        H.free(n);
        m = b.scale;
        8 > p * m * m && (c = !0);
        b.Wc !== a && (c = !1);
        !1 === b.Be('textGreeking') && (c = !1);
        b = this.df;
        p = this.ef;
        switch (this.flip) {
          case Zk:
            a.translate(e, 0);
            a.scale(-1, 1);
            break;
          case Yk:
            a.translate(0, f);
            a.scale(1, -1);
            break;
          case $k:
            a.translate(e, f), a.scale(-1, -1);
        }
        m = this.Lc;
        n = (b + g + p) * m;
        f > n && ((d = this.Mi), (d = d.y * f - d.y * n + d.offsetY));
        if (1 === m && null !== this.ge)
          (p = this.qb),
            p > e && (p = e),
            Pn(this, this.ge, a, d + b, e, g, p, c, h, k, l);
        else if (null !== this.Pb && null !== this.fb)
          for (n = 0; n < m; n++) {
            var r = this.Pb[n];
            r > e && (r = e);
            d += b;
            Pn(this, this.fb[n], a, d, e, g, r, c, h, k, l);
            d += g + p;
          }
        switch (this.flip) {
          case Zk:
            a.scale(-1, 1);
            a.translate(-e, 0);
            break;
          case Yk:
            a.scale(1, -1);
            a.translate(0, -f);
            break;
          case $k:
            a.scale(-1, -1), a.translate(-e, -f);
        }
      }
    };
    function Pn(a, b, c, d, e, f, g, h, k, l, m) {
      var n = 0;
      h
        ? ('left' === k
            ? (n = 0)
            : 'right' === k
            ? (n = e - g)
            : 'center' === k && (n = (e - g) / 2),
          c.fillRect(0 + n, d + 0.25 * f, g, 1))
        : ('left' === k
            ? (n = 0)
            : 'right' === k
            ? (n = e)
            : 'center' === k && (n = e / 2),
          (e = null !== Qn ? Qn(a, f) : 0.75 * f),
          c.fillText(b, 0 + n, d + e),
          (b = (f / 20) | 0),
          0 === b && (b = 1),
          'right' === k ? (n -= g) : 'center' === k && (n -= g / 2),
          l &&
            ((a = null !== Rn ? Rn(a, f) : 0.8 * f),
            c.beginPath(),
            (c.lineWidth = b),
            c.moveTo(0 + n, d + a),
            c.lineTo(0 + n + g, d + a),
            c.stroke()),
          m &&
            (c.beginPath(),
            (c.lineWidth = b),
            (d = (d + f - f / 2.2) | 0),
            0 !== b % 2 && (d += 0.5),
            c.moveTo(0 + n, d),
            c.lineTo(0 + n + g, d),
            c.stroke()));
    }
    t.sm = function (a, b, c, d) {
      this.ti = a;
      var e = this.he;
      null !== Ln && Sn !== e && (Sn = Ln.font = e);
      this.qb = this.ve = 0;
      this.ge = this.fb = this.Pb = this.ie = null;
      var f;
      if (isNaN(this.desiredSize.width)) {
        e = this.Sb.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
        if (0 === e.length) e = 0;
        else if (this.isMultiline) {
          for (var g = (f = 0), h = !1; !h; ) {
            var k = e.indexOf('\n', g);
            -1 === k && ((k = e.length), (h = !0));
            f = Math.max(f, Tn(e.substr(g, k - g).trim()));
            g = k + 1;
          }
          e = f;
        } else
          (f = e.indexOf('\n', 0)), 0 <= f && (e = e.substr(0, f)), (e = Tn(e));
        e = Math.min(e, a / this.scale);
        e = Math.max(8, e);
      } else e = this.desiredSize.width;
      null !== this.panel && (e = Math.min(e, this.panel.maxSize.width));
      f = Un(this, e);
      isNaN(this.desiredSize.height)
        ? (f = Math.min(f, b / this.scale))
        : (f = this.desiredSize.height);
      g = f;
      if (
        0 !== this.qb &&
        null !== this.Pb &&
        null !== this.fb &&
        this.lg === Vn &&
        ((b = this.he),
        (b = this.lg === Vn ? Wn(b) : 0),
        (h = this.df + this.ef),
        (h = Math.max(0, On(this) + h)),
        (g = Math.min(
          this.maxLines - 1,
          Math.max(Math.floor(g / h + 0.01) - 1, 0),
        )),
        !(g + 1 >= this.fb.length))
      ) {
        h = this.fb[g];
        for (b = Math.max(1, a - b); Tn(h) > b && 1 < h.length; )
          h = h.substr(0, h.length - 1);
        h += Xn;
        b = Tn(h);
        this.fb[g] = h;
        this.fb = this.fb.slice(0, g + 1);
        this.Pb[g] = b;
        this.Pb = this.Pb.slice(0, g + 1);
        this.ve = this.fb.length;
        this.qb = Math.max(this.qb, b);
        this.Lc = this.ve;
        1 === this.Lc && (this.ge = this.fb[0]);
      }
      if (this.wrap === Yn || isNaN(this.desiredSize.width))
        (e = isNaN(a) ? this.qb : Math.min(a, this.qb)),
          isNaN(this.desiredSize.width) && (e = Math.max(8, e));
      e = Math.max(c, e);
      f = Math.max(d, f);
      Vb(this.pc, e, f);
      gl(this, 0, 0, e, f);
    };
    t.Gh = function (a, b, c, d) {
      ll(this, a, b, c, d);
    };
    function Zn(a, b, c) {
      if (null === a.ge) (a.ge = b), (a.qb = c);
      else {
        if (null === a.fb || null === a.Pb)
          (a.fb = []), (a.Pb = []), a.fb.push(a.ge), a.Pb.push(a.qb);
        a.fb.push(b);
        a.Pb.push(c);
      }
    }
    function $n(a, b, c, d) {
      b = b.trim();
      var e = 0;
      var f = a.he;
      var g = a.df + a.ef;
      g = Math.max(0, On(a) + g);
      var h = a.lg === Vn ? Wn(f) : 0;
      if (a.Lc >= a.pe) null !== d && d.h(0, g);
      else {
        var k = b;
        if (a.wg === ao)
          if (((a.ve = 1), (f = Tn(b)), 0 === h || f <= c))
            (a.qb = Math.max(a.qb, f)), Zn(a, b, a.qb), null !== d && d.h(f, g);
          else {
            e = bo(a, k);
            k = k.substr(e.length);
            b = bo(a, k);
            for (f = Tn(e + b); 0 < b.length && f <= c; )
              (e += b),
                (k = k.substr(b.length)),
                (b = bo(a, k)),
                (f = Tn((e + b).trim()));
            e += b.trim();
            for (c = Math.max(1, c - h); Tn(e) > c && 1 < e.length; )
              e = e.substr(0, e.length - 1);
            e += Xn;
            b = Tn(e);
            a.qb = b;
            Zn(a, e, b);
            null !== d && d.h(b, g);
          }
        else {
          h = 0;
          0 === k.length && ((h = 1), Zn(a, k, 0));
          for (; 0 < k.length; ) {
            var l = bo(a, k);
            for (k = k.substr(l.length); Tn(l) > c; ) {
              var m = 1;
              f = Tn(l.substr(0, m));
              for (b = 0; f <= c; ) m++, (b = f), (f = Tn(l.substr(0, m)));
              if (1 === m) {
                var n = f;
                e = Math.max(e, f);
              } else (n = b), (e = Math.max(e, b));
              m--;
              1 > m && (m = 1);
              Zn(a, l.substr(0, m), n);
              h++;
              l = l.substr(m);
              if (a.Lc + h > a.pe) break;
            }
            b = bo(a, k);
            for (f = Tn(l + b); 0 < b.length && f <= c; )
              (l += b),
                (k = k.substr(b.length)),
                (b = bo(a, k)),
                (f = Tn((l + b).trim()));
            l = l.trim();
            if (
              '' !== l &&
              ('\u00ad' === l[l.length - 1] &&
                (l = l.substring(0, l.length - 1) + '\u2010'),
              0 === b.length
                ? ((m = f), (e = Math.max(e, f)))
                : ((m = b = Tn(l)), (e = Math.max(e, b))),
              Zn(a, l, m),
              h++,
              a.Lc + h > a.pe)
            )
              break;
          }
          a.ve = Math.min(a.pe, h);
          a.qb = Math.max(a.qb, e);
          null !== d && d.h(a.qb, g * a.ve);
        }
      }
    }
    function bo(a, b) {
      if (a.wg === co) return b.substr(0, 1);
      a = b.length;
      for (var c = 0, d = eo; c < a && !d.test(b.charAt(c)); ) c++;
      for (; c < a && d.test(b.charAt(c)); ) c++;
      return c >= a ? b : b.substr(0, c);
    }
    function Tn(a) {
      return null === Ln ? 8 * a.length : Ln.measureText(a).width;
    }
    function On(a) {
      if (null !== a.ie) return a.ie;
      var b = a.he;
      if (null === Ln) {
        var c = 16;
        return (a.ie = c);
      }
      void 0 !== fo[b] && 5e3 > go
        ? (c = fo[b])
        : ((c = 1.3 * Ln.measureText('M').width), (fo[b] = c), go++);
      return (a.ie = c);
    }
    function Wn(a) {
      if (null === Ln) return 6;
      if (void 0 !== ho[a] && 5e3 > io) var b = ho[a];
      else (b = Ln.measureText(Xn).width), (ho[a] = b), io++;
      return b;
    }
    function Un(a, b) {
      var c = a.Sb.replace(/\r\n/g, '\n').replace(/\r/g, '\n'),
        d = a.df + a.ef;
      d = Math.max(0, On(a) + d);
      if (0 === c.length) return (a.qb = 0), (a.Lc = 1), d;
      if (!a.isMultiline) {
        var e = c.indexOf('\n', 0);
        0 <= e && (c = c.substr(0, e));
      }
      e = 0;
      for (var f = (a.Lc = 0), g, h = !1; !h; ) {
        g = c.indexOf('\n', f);
        -1 === g && ((g = c.length), (h = !0));
        if (f <= g) {
          f = c.substr(f, g - f);
          if (a.wg !== ao) {
            a.ve = 0;
            var k = L.alloc();
            $n(a, f, b, k);
            e += k.height;
            L.free(k);
            a.Lc += a.ve;
          } else $n(a, f, b, null), (e += d), a.Lc++;
          a.Lc === a.pe && (h = !0);
        }
        f = g + 1;
      }
      return (a.$r = e);
    }
    ma.Object.defineProperties(Xg.prototype, {
      font: {
        get: function () {
          return this.he;
        },
        set: function (a) {
          var b = this.he;
          b !== a &&
            ((this.he = a), (this.ie = null), this.o(), this.g('font', b, a));
        },
      },
      text: {
        get: function () {
          return this.Sb;
        },
        set: function (a) {
          var b = this.Sb;
          null !== a && void 0 !== a ? (a = a.toString()) : (a = '');
          b !== a && ((this.Sb = a), this.o(), this.g('text', b, a));
        },
      },
      textAlign: {
        get: function () {
          return this.Ii;
        },
        set: function (a) {
          var b = this.Ii;
          b === a ||
            ('start' !== a &&
              'end' !== a &&
              'left' !== a &&
              'right' !== a &&
              'center' !== a) ||
            ((this.Ii = a), this.N(), this.g('textAlign', b, a));
        },
      },
      flip: {
        get: function () {
          return this.Cd;
        },
        set: function (a) {
          var b = this.Cd;
          b !== a && ((this.Cd = a), this.N(), this.g('flip', b, a));
        },
      },
      verticalAlignment: {
        get: function () {
          return this.Mi;
        },
        set: function (a) {
          var b = this.Mi;
          b.A(a) ||
            ((this.Mi = a = a.G()), Bl(this), this.g('verticalAlignment', b, a));
        },
      },
      naturalBounds: {
        get: function () {
          if (!this.pc.u()) {
            var a = L.alloc();
            $n(this, this.Sb, 999999, a);
            var b = a.width;
            L.free(a);
            a = Un(this, b);
            var c = this.desiredSize;
            isNaN(c.width) || (b = c.width);
            isNaN(c.height) || (a = c.height);
            Vb(this.pc, b, a);
          }
          return this.pc;
        },
      },
      isMultiline: {
        get: function () {
          return this.xj;
        },
        set: function (a) {
          var b = this.xj;
          b !== a && ((this.xj = a), this.o(), this.g('isMultiline', b, a));
        },
      },
      isUnderline: {
        get: function () {
          return this.ri;
        },
        set: function (a) {
          var b = this.ri;
          b !== a && ((this.ri = a), this.N(), this.g('isUnderline', b, a));
        },
      },
      isStrikethrough: {
        get: function () {
          return this.pi;
        },
        set: function (a) {
          var b = this.pi;
          b !== a && ((this.pi = a), this.N(), this.g('isStrikethrough', b, a));
        },
      },
      wrap: {
        get: function () {
          return this.wg;
        },
        set: function (a) {
          var b = this.wg;
          b !== a && ((this.wg = a), this.o(), this.g('wrap', b, a));
        },
      },
      overflow: {
        get: function () {
          return this.lg;
        },
        set: function (a) {
          var b = this.lg;
          b !== a && ((this.lg = a), this.o(), this.g('overflow', b, a));
        },
      },
      stroke: {
        get: function () {
          return this.Cc;
        },
        set: function (a) {
          var b = this.Cc;
          b !== a &&
            (null !== a && Ql(a, 'TextBlock.stroke'),
            a instanceof sl && a.freeze(),
            (this.Cc = a),
            this.N(),
            this.g('stroke', b, a));
        },
      },
      lineCount: {
        get: function () {
          return this.Lc;
        },
      },
      editable: {
        get: function () {
          return this.Dn;
        },
        set: function (a) {
          var b = this.Dn;
          b !== a && ((this.Dn = a), this.g('editable', b, a));
        },
      },
      textEditor: {
        get: function () {
          return this.Rp;
        },
        set: function (a) {
          var b = this.Rp;
          b !== a && ((this.Rp = a), this.g('textEditor', b, a));
        },
      },
      errorFunction: {
        get: function () {
          return this.Ac;
        },
        set: function (a) {
          var b = this.Ac;
          b !== a && ((this.Ac = a), this.g('errorFunction', b, a));
        },
      },
      interval: {
        get: function () {
          return this.Hd;
        },
        set: function (a) {
          var b = this.Hd;
          a = Math.floor(a);
          if (b !== a && 0 <= a) {
            this.Hd = a;
            this.o();
            var c = this.panel;
            null !== c && (c.$g = null);
            this.g('interval', b, a);
          }
        },
      },
      graduatedStart: {
        get: function () {
          return this.Fd;
        },
        set: function (a) {
          var b = this.Fd;
          b !== a &&
            (0 > a ? (a = 0) : 1 < a && (a = 1),
            (this.Fd = a),
            this.o(),
            this.g('graduatedStart', b, a));
        },
      },
      graduatedEnd: {
        get: function () {
          return this.Dd;
        },
        set: function (a) {
          var b = this.Dd;
          b !== a &&
            (0 > a ? (a = 0) : 1 < a && (a = 1),
            (this.Dd = a),
            this.o(),
            this.g('graduatedEnd', b, a));
        },
      },
      graduatedFunction: {
        get: function () {
          return this.tj;
        },
        set: function (a) {
          var b = this.tj;
          b !== a && ((this.tj = a), this.o(), this.g('graduatedFunction', b, a));
        },
      },
      graduatedSkip: {
        get: function () {
          return this.Ed;
        },
        set: function (a) {
          var b = this.Ed;
          b !== a && ((this.Ed = a), this.o(), this.g('graduatedSkip', b, a));
        },
      },
      textValidation: {
        get: function () {
          return this.Ji;
        },
        set: function (a) {
          var b = this.Ji;
          b !== a && ((this.Ji = a), this.g('textValidation', b, a));
        },
      },
      textEdited: {
        get: function () {
          return this.Qp;
        },
        set: function (a) {
          var b = this.Qp;
          b !== a && ((this.Qp = a), this.g('textEdited', b, a));
        },
      },
      spacingAbove: {
        get: function () {
          return this.df;
        },
        set: function (a) {
          var b = this.df;
          b !== a && ((this.df = a), this.g('spacingAbove', b, a));
        },
      },
      spacingBelow: {
        get: function () {
          return this.ef;
        },
        set: function (a) {
          var b = this.ef;
          b !== a && ((this.ef = a), this.g('spacingBelow', b, a));
        },
      },
      maxLines: {
        get: function () {
          return this.pe;
        },
        set: function (a) {
          var b = this.pe;
          b !== a &&
            ((a = Math.floor(a)),
            0 >= a && va(a, '> 0', Xg, 'maxLines'),
            (this.pe = a),
            this.g('maxLines', b, a),
            this.o());
        },
      },
      metrics: {
        get: function () {
          return {
            arrSize: null !== this.Pb ? this.Pb : [this.qb],
            arrText: null !== this.fb ? this.fb : [this.ge],
            maxLineWidth: this.qb,
            fontHeight: this.ie,
          };
        },
      },
      choices: {
        get: function () {
          return this.en;
        },
        set: function (a) {
          var b = this.en;
          b !== a && ((this.en = a), this.g('choices', b, a));
        },
      },
    });
    var Qn = null,
      Rn = null,
      ao = new D(Xg, 'None', 0),
      Yn = new D(Xg, 'WrapFit', 1),
      Nn = new D(Xg, 'WrapDesiredSize', 2),
      co = new D(Xg, 'WrapBreakAll', 3),
      Mn = new D(Xg, 'OverflowClip', 0),
      Vn = new D(Xg, 'OverflowEllipsis', 1),
      eo = /[ \u200b\u00ad]/,
      fo = new db(),
      go = 0,
      ho = new db(),
      io = 0,
      Xn = '...',
      Sn = '',
      Ln = null,
      Kn = !1;
    Xg.className = 'TextBlock';
    Xg.getEllipsis = function () {
      return Xn;
    };
    Xg.setEllipsis = function (a) {
      Xn = a;
      ho = new db();
      io = 0;
    };
    Xg.getBaseline = function () {
      return Qn;
    };
    Xg.setBaseline = function (a) {
      Qn = a;
      a = Pa();
      for (var b = a.length, c = 0; c < b; c++) a[c].zf();
    };
    Xg.getUnderline = function () {
      return Rn;
    };
    Xg.setUnderline = function (a) {
      Rn = a;
      a = Pa();
      for (var b = a.length, c = 0; c < b; c++) a[c].zf();
    };
    Xg.isValidFont = function (a) {
      Kn || ((Ln = Vg ? new Dk(null).context : null), (Kn = !0));
      if (null === Ln) return !0;
      var b = Ln.font;
      if (a === b || '10px sans-serif' === a) return !0;
      Ln.font = '10px sans-serif';
      Ln.font = a;
      var c = Ln.font;
      if ('10px sans-serif' !== c) return (Ln.font = b), !0;
      Ln.font = '19px serif';
      var d = Ln.font;
      Ln.font = a;
      c = Ln.font;
      Ln.font = b;
      return c !== d;
    };
    Xg.None = ao;
    Xg.WrapFit = Yn;
    Xg.WrapDesiredSize = Nn;
    Xg.WrapBreakAll = co;
    Xg.OverflowClip = Mn;
    Xg.OverflowEllipsis = Vn;
    function jo() {
      this.Pb = [];
      this.fb = [];
    }
    jo.prototype.reset = function () {
      this.Pb = [];
      this.fb = [];
    };
    jo.prototype.dt = function (a) {
      this.Pb = Ba(a.Pb);
      this.fb = Ba(a.fb);
    };
    jo.className = 'TextBlockMetrics';
    function lk() {
      Y.call(this);
      this.Vg = null;
      this.Ip = '';
      this.rh = nc;
      this.gl = vd;
      this.hf = this.Ac = null;
      this.fl = Ac;
      this.Cd = Ag;
      this.Vl = null;
      this.tu = !1;
      this.Er = !0;
      this.wl = !1;
      this.Ol = null;
    }
    la(lk, Y);
    lk.prototype.cloneProtected = function (a) {
      Y.prototype.cloneProtected.call(this, a);
      a.element = this.Vg;
      a.Ip = this.Ip;
      a.rh = this.rh.G();
      a.gl = this.gl;
      a.Cd = this.Cd;
      a.Ac = this.Ac;
      a.hf = this.hf;
      a.fl = this.fl.G();
      a.Er = this.Er;
      a.Ol = this.Ol;
    };
    t = lk.prototype;
    t.bb = function (a) {
      a === Ag || a === Cg || a === Xk
        ? (this.imageStretch = a)
        : Y.prototype.bb.call(this, a);
    };
    t.toString = function () {
      return 'Picture(' + this.source + ')#' + lb(this);
    };
    function nk(a) {
      void 0 === a && (a = '');
      '' !== a ? ko[a] && (delete ko[a], lo--) : ((ko = new db()), (lo = 0));
    }
    function mo(a, b) {
      a.Pr = !0;
      a.cl = !1;
      for (var c, d = Pa(), e = d.length, f = 0; f < e; f++) {
        var g = d[f];
        c = a.getAttribute('src');
        var h = g.Ci.H(c);
        if (null !== h)
          for (var k = h.length, l = 0; l < k; l++)
            (c = h[l]),
              g.rs.add(c),
              g.Yb(),
              void 0 === a.Ou && ((a.Ou = b), null !== c.hf && c.hf(c, b));
      }
    }
    function no(a, b) {
      a.cl = b;
      for (var c, d = Pa(), e = d.length, f = 0; f < e; f++) {
        var g = d[f],
          h = a.getAttribute('src');
        c = g.Ci.H(h);
        if (null !== c) {
          g = c.length;
          h = Ea();
          for (var k = 0; k < g; k++) h.push(c[k]);
          for (k = 0; k < g; k++) (c = h[k]), null !== c.Ac && c.Ac(c, b);
          Ha(h);
        }
      }
    }
    t.zf = function () {
      this.N();
    };
    t.Pi = function (a, b) {
      var c = this.Vg;
      if (null !== c) {
        var d = c.getAttribute('src');
        c instanceof HTMLImageElement &&
          (null === d || '' === d) &&
          B('Element has no source ("src") attribute: ' + c);
        if (!(c.cl instanceof Event)) {
          d = this.naturalBounds;
          var e = 0,
            f = 0,
            g = this.tu,
            h = g ? +c.width : c.naturalWidth;
          g = g ? +c.height : c.naturalHeight;
          void 0 === h && c.videoWidth && (h = c.videoWidth);
          void 0 === g && c.videoHeight && (g = c.videoHeight);
          h = h || d.width;
          g = g || d.height;
          if (0 !== h && 0 !== g) {
            var k = h,
              l = g;
            this.sourceRect.u() &&
              ((e = this.rh.x),
              (f = this.rh.y),
              (h = this.rh.width),
              (g = this.rh.height));
            var m = h,
              n = g,
              p = this.gl,
              r = this.fl;
            switch (p) {
              case Ag:
                if (this.sourceRect.u()) break;
                m >= d.width && (e = e + r.offsetX + (m * r.x - d.width * r.x));
                n >= d.height && (f = f + r.offsetY + (n * r.y - d.height * r.y));
                h = Math.min(d.width, m);
                g = Math.min(d.height, n);
                break;
              case vd:
                m = d.width;
                n = d.height;
                break;
              case Cg:
              case Xk:
                p === Cg
                  ? ((p = Math.min(d.height / n, d.width / m)),
                    (m *= p),
                    (n *= p))
                  : p === Xk &&
                    ((p = Math.max(d.height / n, d.width / m)),
                    (m *= p),
                    (n *= p),
                    m >= d.width &&
                      (e = (e + r.offsetX + (m * r.x - d.width * r.x) / m) * h),
                    n >= d.height &&
                      (f = (f + r.offsetY + (n * r.y - d.height * r.y) / n) * g),
                    (h *= 1 / (m / d.width)),
                    (g *= 1 / (n / d.height)),
                    (m = d.width),
                    (n = d.height));
            }
            p = this.tf() * b.scale;
            var q = m * p * n * p,
              u = (h * g) / q,
              v = c.__goCache;
            p = null;
            var w = oo;
            if (c.Pr && void 0 !== v && 4 < q && u > w * w)
              for (
                null === v.Oi && (po(v, 4, k, l, c), po(v, 16, k, l, c)),
                  k = v.Oi,
                  l = k.length,
                  q = 0;
                q < l;
                q++
              )
                if (k[q].ratio * k[q].ratio < u) p = k[q];
                else break;
            if (!b.Yk) {
              if (null === this.Vl)
                if (null === this.Vg) this.Vl = !1;
                else {
                  k = new Dk(null).context;
                  k.drawImage(this.Vg, 0, 0);
                  try {
                    k.getImageData(0, 0, 1, 1).data[3] && (this.Vl = !1),
                      (this.Vl = !1);
                  } catch (y) {
                    this.Vl = !0;
                  }
                }
              if (this.Vl) return;
            }
            k = 0;
            m < d.width && (k = r.offsetX + (d.width * r.x - m * r.x));
            l = 0;
            n < d.height && (l = r.offsetY + (d.height * r.y - n * r.y));
            switch (this.flip) {
              case Zk:
                a.translate(Math.min(d.width, m), 0);
                a.scale(-1, 1);
                break;
              case Yk:
                a.translate(0, Math.min(d.height, n));
                a.scale(1, -1);
                break;
              case $k:
                a.translate(Math.min(d.width, m), Math.min(d.height, n)),
                  a.scale(-1, -1);
            }
            if (
              b.Be('pictureRatioOptimization') &&
              !b.ni &&
              void 0 !== v &&
              null !== p &&
              1 !== p.ratio
            ) {
              a.save();
              b = p.ratio;
              try {
                a.drawImage(
                  p.source,
                  e / b,
                  f / b,
                  Math.min(p.source.width, h / b),
                  Math.min(p.source.height, g / b),
                  k,
                  l,
                  Math.min(d.width, m),
                  Math.min(d.height, n),
                );
              } catch (y) {
                this.Er = !1;
              }
              a.restore();
            } else
              try {
                a.drawImage(
                  c,
                  e,
                  f,
                  h,
                  g,
                  k,
                  l,
                  Math.min(d.width, m),
                  Math.min(d.height, n),
                );
              } catch (y) {
                this.Er = !1;
              }
            switch (this.flip) {
              case Zk:
                a.scale(-1, 1);
                a.translate(-Math.min(d.width, m), 0);
                break;
              case Yk:
                a.scale(1, -1);
                a.translate(0, -Math.min(d.height, n));
                break;
              case $k:
                a.scale(-1, -1),
                  a.translate(-Math.min(d.width, m), -Math.min(d.height, n));
            }
          }
        }
      }
    };
    t.sm = function (a, b, c, d) {
      var e = this.desiredSize,
        f = jl(this, !0),
        g = this.Vg,
        h = this.tu;
      if (h || (!this.wl && g && g.complete)) this.wl = !0;
      null === g && (isFinite(e.width) || (a = 0), isFinite(e.height) || (b = 0));
      isFinite(e.width) || f === vd || f === Vk
        ? (isFinite(a) ||
            (a = this.sourceRect.u()
              ? this.sourceRect.width
              : h
              ? +g.width
              : g.naturalWidth),
          (c = 0))
        : null !== g &&
          !1 !== this.wl &&
          (a = this.sourceRect.u()
            ? this.sourceRect.width
            : h
            ? +g.width
            : g.naturalWidth);
      isFinite(e.height) || f === vd || f === Wk
        ? (isFinite(b) ||
            (b = this.sourceRect.u()
              ? this.sourceRect.height
              : h
              ? +g.height
              : g.naturalHeight),
          (d = 0))
        : null !== g &&
          !1 !== this.wl &&
          (b = this.sourceRect.u()
            ? this.sourceRect.height
            : h
            ? +g.height
            : g.naturalHeight);
      isFinite(e.width) && (a = e.width);
      isFinite(e.height) && (b = e.height);
      e = this.maxSize;
      f = this.minSize;
      c = Math.max(c, f.width);
      d = Math.max(d, f.height);
      a = Math.min(e.width, a);
      b = Math.min(e.height, b);
      a = Math.max(c, a);
      b = Math.max(d, b);
      null === g ||
        g.complete ||
        (isFinite(a) || (a = 0), isFinite(b) || (b = 0));
      Vb(this.pc, a, b);
      gl(this, 0, 0, a, b);
    };
    t.Gh = function (a, b, c, d) {
      ll(this, a, b, c, d);
    };
    ma.Object.defineProperties(lk.prototype, {
      element: {
        get: function () {
          return this.Vg;
        },
        set: function (a) {
          var b = this.Vg;
          if (b !== a) {
            null === a ||
              a instanceof HTMLImageElement ||
              a instanceof HTMLVideoElement ||
              a instanceof HTMLCanvasElement ||
              B(
                'Picture.element must be an instance of Image, Canvas, or Video, not: ' +
                  a,
              );
            this.tu = a instanceof HTMLCanvasElement;
            this.Vg = a;
            if (null !== a)
              if (a instanceof HTMLCanvasElement || !0 === a.complete)
                a.cl instanceof Event && null !== this.Ac && this.Ac(this, a.cl),
                  !0 === a.Pr && null !== this.hf && this.hf(this, a.Ou),
                  (a.Pr = !0),
                  this.desiredSize.u() || (mj(this, !1), this.o());
              else {
                var c = this;
                a.Yw ||
                  (a.addEventListener('load', function (b) {
                    mo(a, b);
                    c.desiredSize.u() || (mj(c, !1), c.o());
                  }),
                  a.addEventListener('error', function (b) {
                    no(a, b);
                  }),
                  (a.Yw = !0));
              }
            this.g('element', b, a);
            this.N();
          }
        },
      },
      source: {
        get: function () {
          return this.Ip;
        },
        set: function (a) {
          var b = this.Ip;
          if (b !== a) {
            this.Ip = a;
            var c = ko,
              d = this.diagram,
              e = null;
            if (void 0 !== c[a]) e = c[a];
            else {
              30 < lo && (nk(), (c = ko));
              e = ta('img');
              var f = this;
              e.addEventListener('load', function (a) {
                mo(e, a);
                f.desiredSize.u() || (mj(f, !1), f.o());
              });
              e.addEventListener('error', function (a) {
                no(e, a);
              });
              e.Yw = !0;
              var g = this.Ol;
              null !== g && (e.crossOrigin = g(this));
              e.src = a;
              c[a] = e;
              lo++;
            }
            null !== d && mk(d, this);
            this.element = e;
            null !== d && kk(d, this);
            void 0 === e.__goCache && (e.__goCache = new qo());
            this.o();
            this.N();
            this.g('source', b, a);
          }
        },
      },
      sourceCrossOrigin: {
        get: function () {
          return this.Ol;
        },
        set: function (a) {
          if (this.Ol !== a && ((this.Ol = a), null !== this.element)) {
            var b = this.element.getAttribute('src');
            null === a && 'string' === typeof b
              ? (this.element.crossOrigin = null)
              : null !== a && (this.element.crossOrigin = a(this));
            this.element.src = b;
          }
        },
      },
      sourceRect: {
        get: function () {
          return this.rh;
        },
        set: function (a) {
          var b = this.rh;
          b.A(a) || ((this.rh = a = a.G()), this.N(), this.g('sourceRect', b, a));
        },
      },
      imageStretch: {
        get: function () {
          return this.gl;
        },
        set: function (a) {
          var b = this.gl;
          b !== a && ((this.gl = a), this.N(), this.g('imageStretch', b, a));
        },
      },
      flip: {
        get: function () {
          return this.Cd;
        },
        set: function (a) {
          var b = this.Cd;
          b !== a && ((this.Cd = a), this.N(), this.g('flip', b, a));
        },
      },
      imageAlignment: {
        get: function () {
          return this.fl;
        },
        set: function (a) {
          var b = this.fl;
          b.A(a) ||
            ((this.fl = a = a.G()), this.o(), this.g('imageAlignment', b, a));
        },
      },
      errorFunction: {
        get: function () {
          return this.Ac;
        },
        set: function (a) {
          var b = this.Ac;
          b !== a && ((this.Ac = a), this.g('errorFunction', b, a));
        },
      },
      successFunction: {
        get: function () {
          return this.hf;
        },
        set: function (a) {
          var b = this.hf;
          b !== a && ((this.hf = a), this.g('successFunction', b, a));
        },
      },
      naturalBounds: {
        get: function () {
          return this.pc;
        },
      },
    });
    var ko = null,
      lo = 0,
      oo = 4;
    lk.className = 'Picture';
    ko = new db();
    lk.clearCache = nk;
    function qo() {
      this.Oi = null;
    }
    function po(a, b, c, d, e) {
      null === a.Oi && (a.Oi = []);
      var f = new Dk(null),
        g = f.context,
        h = 1 / b;
      f.width = c / b;
      f.height = d / b;
      0 !== f.width &&
        0 !== f.height &&
        ((b = new ro(f.Da, b)),
        (c = 1),
        0 < a.Oi.length &&
          ((c = a.Oi[a.Oi.length - 1]), (e = c.source), (c = c.ratio)),
        g.setTransform(h * c, 0, 0, h * c, 0, 0),
        g.drawImage(e, 0, 0),
        a.Oi.push(b));
    }
    qo.className = 'PictureCacheArray';
    function ro(a, b) {
      this.source = a;
      this.ratio = b;
    }
    ro.className = 'PictureCacheInstance';
    function so() {
      this.lt = new td();
      this.ec = null;
    }
    t = so.prototype;
    t.reset = function (a) {
      null !== a
        ? (a.ea(), (this.lt = a), a.figures.clear())
        : (this.lt = new td());
      this.ec = null;
    };
    function Kd(a, b, c, d, e) {
      a.ec = new fe();
      a.ec.startX = b;
      a.ec.startY = c;
      a.ec.isFilled = d;
      a.lt.figures.add(a.ec);
      void 0 !== e && (a.ec.isShadowed = e);
    }
    function Sd(a) {
      var b = a.ec.segments.length;
      0 < b && a.ec.segments.L(b - 1).close();
    }
    t.Kq = function (a) {
      this.ec.isShadowed = a;
    };
    t.moveTo = function (a, b, c) {
      void 0 === c && (c = !1);
      var d = new ge(Wd);
      d.endX = a;
      d.endY = b;
      c && d.close();
      this.ec.segments.add(d);
    };
    t.lineTo = function (a, b, c) {
      void 0 === c && (c = !1);
      var d = new ge(Ed);
      d.endX = a;
      d.endY = b;
      c && d.close();
      this.ec.segments.add(d);
    };
    function Ld(a, b, c, d, e, f, g) {
      var h;
      void 0 === h && (h = !1);
      var k = new ge(Xd);
      k.point1X = b;
      k.point1Y = c;
      k.point2X = d;
      k.point2Y = e;
      k.endX = f;
      k.endY = g;
      h && k.close();
      a.ec.segments.add(k);
    }
    function Md(a, b, c, d, e) {
      var f;
      void 0 === f && (f = !1);
      var g = new ge(Yd);
      g.point1X = b;
      g.point1Y = c;
      g.endX = d;
      g.endY = e;
      f && g.close();
      a.ec.segments.add(g);
    }
    t.arcTo = function (a, b, c, d, e, f, g) {
      void 0 === f && (f = 0);
      void 0 === g && (g = !1);
      var h = new ge(Zd);
      h.startAngle = a;
      h.sweepAngle = b;
      h.centerX = c;
      h.centerY = d;
      h.radiusX = e;
      h.radiusY = 0 !== f ? f : e;
      g && h.close();
      this.ec.segments.add(h);
    };
    function Rd(a, b, c, d, e, f, g, h) {
      var k;
      void 0 === k && (k = !1);
      b = new ge($d, g, h, b, c, d, e, f);
      k && b.close();
      a.ec.segments.add(b);
    }
    function Jd(a) {
      var b = Td;
      if (null !== b) return (Td = null), b.reset(a), b;
      b = new so();
      b.reset(a);
      return b;
    }
    var Td = null;
    so.className = 'StreamGeometryContext';
    function to(a, b) {
      var c = a.toLowerCase(),
        d = J.He;
      d[a] = b;
      d[c] = a;
    }
    to('Rectangle', function (a, b, c) {
      a = 50 > J.Ff;
      var d = 'r' + b + ',' + c,
        e = J.Ef[d];
      if (void 0 !== e) return e;
      e = new td(Gd);
      e.endX = b;
      e.endY = c;
      a && ((J.Ef[d] = e), J.Ff++);
      return e;
    });
    to('Square', function (a, b, c) {
      a = 50 > J.Ff;
      var d = 's' + b + ',' + c,
        e = J.Ef[d];
      if (void 0 !== e) return e;
      e = new td(Gd);
      e.endX = b;
      e.endY = c;
      e.defaultStretch = Cg;
      a && ((J.Ef[d] = e), J.Ff++);
      return e;
    });
    to('RoundedRectangle', function (a, b, c) {
      var d = 50 > J.Ff,
        e = 'rr' + b + ',' + c,
        f = J.Ef[e];
      if (void 0 === f) {
        f = a ? a.parameter1 : NaN;
        if (isNaN(f) || 0 >= f) f = 5;
        f = Math.min(f, b / 3);
        f = Math.min(f, c / 3);
        a = f * J.Ig;
        f = new td().add(
          new fe(f, 0, !0)
            .add(new ge(Ed, b - f, 0))
            .add(new ge(Xd, b, f, b - a, 0, b, a))
            .add(new ge(Ed, b, c - f))
            .add(new ge(Xd, b - f, c, b, c - a, b - a, c))
            .add(new ge(Ed, f, c))
            .add(new ge(Xd, 0, c - f, a, c, 0, c - a))
            .add(new ge(Ed, 0, f))
            .add(new ge(Xd, f, 0, 0, a, a, 0).close()),
        );
        1 < a && ((f.spot1 = new O(0, 0, a, a)), (f.spot2 = new O(1, 1, -a, -a)));
        d && ((J.Ef[e] = f), J.Ff++);
      }
      return f;
    });
    to('Border', 'RoundedRectangle');
    to('Ellipse', function (a, b, c) {
      a = 50 > J.Ff;
      var d = 'e' + b + ',' + c,
        e = J.Ef[d];
      if (void 0 !== e) return e;
      e = new td(Hd);
      e.endX = b;
      e.endY = c;
      e.spot1 = hd;
      e.spot2 = id;
      a && ((J.Ef[d] = e), J.Ff++);
      return e;
    });
    to('Circle', function (a, b, c) {
      a = 50 > J.Ff;
      var d = 'c' + b + ',' + c,
        e = J.Ef[d];
      if (void 0 !== e) return e;
      e = new td(Hd);
      e.endX = b;
      e.endY = c;
      e.spot1 = hd;
      e.spot2 = id;
      e.defaultStretch = Cg;
      a && ((J.Ef[d] = e), J.Ff++);
      return e;
    });
    to('TriangleRight', function (a, b, c) {
      return new td()
        .add(
          new fe(0, 0).add(new ge(Ed, b, 0.5 * c)).add(new ge(Ed, 0, c).close()),
        )
        .Jm(0, 0.25, 0.5, 0.75);
    });
    to('TriangleDown', function (a, b, c) {
      return new td()
        .add(
          new fe(0, 0).add(new ge(Ed, b, 0)).add(new ge(Ed, 0.5 * b, c).close()),
        )
        .Jm(0.25, 0, 0.75, 0.5);
    });
    to('TriangleLeft', function (a, b, c) {
      return new td()
        .add(
          new fe(b, c).add(new ge(Ed, 0, 0.5 * c)).add(new ge(Ed, b, 0).close()),
        )
        .Jm(0.5, 0.25, 1, 0.75);
    });
    to('TriangleUp', function (a, b, c) {
      return new td()
        .add(
          new fe(b, c).add(new ge(Ed, 0, c)).add(new ge(Ed, 0.5 * b, 0).close()),
        )
        .Jm(0.25, 0.5, 0.75, 1);
    });
    to('Triangle', 'TriangleUp');
    to('Diamond', function (a, b, c) {
      return new td()
        .add(
          new fe(0.5 * b, 0)
            .add(new ge(Ed, 0, 0.5 * c))
            .add(new ge(Ed, 0.5 * b, c))
            .add(new ge(Ed, b, 0.5 * c).close()),
        )
        .Jm(0.25, 0.25, 0.75, 0.75);
    });
    to('LineH', function (a, b, c) {
      a = new td(wd);
      a.startX = 0;
      a.startY = c / 2;
      a.endX = b;
      a.endY = c / 2;
      return a;
    });
    to('LineV', function (a, b, c) {
      a = new td(wd);
      a.startX = b / 2;
      a.startY = 0;
      a.endX = b / 2;
      a.endY = c;
      return a;
    });
    to('None', 'Rectangle');
    to('BarH', 'Rectangle');
    to('BarV', 'Rectangle');
    to('MinusLine', 'LineH');
    to('PlusLine', function (a, b, c) {
      return new td().add(
        new fe(0, c / 2, !1)
          .add(new ge(Ed, b, c / 2))
          .add(new ge(Wd, b / 2, 0))
          .add(new ge(Ed, b / 2, c)),
      );
    });
    to('XLine', function (a, b, c) {
      return new td().add(
        new fe(0, c, !1)
          .add(new ge(Ed, b, 0))
          .add(new ge(Wd, 0, 0))
          .add(new ge(Ed, b, c)),
      );
    });
    J.Nm = {
      '': '',
      Standard: 'F1 m 0,0 l 8,4 -8,4 2,-4 z',
      Backward: 'F1 m 8,0 l -2,4 2,4 -8,-4 z',
      Triangle: 'F1 m 0,0 l 8,4.62 -8,4.62 z',
      BackwardTriangle: 'F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z',
      Boomerang: 'F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z',
      BackwardBoomerang: 'F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z',
      SidewaysV: 'm 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z',
      BackwardV: 'm 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z',
      OpenTriangle: 'm 0,0 l 8,4 -8,4',
      BackwardOpenTriangle: 'm 8,0 l -8,4 8,4',
      OpenTriangleLine: 'm 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8',
      BackwardOpenTriangleLine: 'm 8,0 l  -8,4 8,4 m -8.5,0 l 0,-8',
      OpenTriangleTop: 'm 0,0 l 8,4 m 0,4',
      BackwardOpenTriangleTop: 'm 8,0 l -8,4 m 0,4',
      OpenTriangleBottom: 'm 0,8 l 8,-4',
      BackwardOpenTriangleBottom: 'm 0,4 l 8,4',
      HalfTriangleTop: 'F1 m 0,0 l 0,4 8,0 z m 0,8',
      BackwardHalfTriangleTop: 'F1 m 8,0 l 0,4 -8,0 z m 0,8',
      HalfTriangleBottom: 'F1 m 0,4 l 0,4 8,-4 z',
      BackwardHalfTriangleBottom: 'F1 m 8,4 l 0,4 -8,-4 z',
      ForwardSemiCircle: 'm 4,0 b 270 180 0 4 4',
      BackwardSemiCircle: 'm 4,8 b 90 180 0 -4 4',
      Feather: 'm 0,0 l 3,4 -3,4',
      BackwardFeather: 'm 3,0 l -3,4 3,4',
      DoubleFeathers: 'm 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4',
      BackwardDoubleFeathers: 'm 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4',
      TripleFeathers: 'm 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4',
      BackwardTripleFeathers:
        'm 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4',
      ForwardSlash: 'm 0,8 l 5,-8',
      BackSlash: 'm 0,0 l 5,8',
      DoubleForwardSlash: 'm 0,8 l 4,-8 m -2,8 l 4,-8',
      DoubleBackSlash: 'm 0,0 l 4,8 m -2,-8 l 4,8',
      TripleForwardSlash: 'm 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8',
      TripleBackSlash: 'm 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8',
      Fork: 'm 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4',
      BackwardFork: 'm 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4',
      LineFork: 'm 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4',
      BackwardLineFork: 'm 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8',
      CircleFork:
        'F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4',
      BackwardCircleFork:
        'F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3',
      CircleLineFork:
        'F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4',
      BackwardCircleLineFork:
        'F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3',
      Circle: 'F1 m 8,4 b 0 360 -4 0 4 z',
      Block: 'F1 m 0,0 l 0,8 8,0 0,-8 z',
      StretchedDiamond: 'F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z',
      Diamond: 'F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z',
      Chevron: 'F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z',
      StretchedChevron: 'F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z',
      NormalArrow: 'F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z',
      X: 'm 0,0 l 8,8 m 0,-8 l -8,8',
      TailedNormalArrow:
        'F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z',
      DoubleTriangle: 'F1 m 0,0 l 4,4 -4,4 0,-8 z  m 4,0 l 4,4 -4,4 0,-8 z',
      BigEndArrow: 'F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z',
      ConcaveTailArrow: 'F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z',
      RoundedTriangle:
        'F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z',
      SimpleArrow:
        'F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z',
      AccelerationArrow:
        'F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z',
      BoxArrow: 'F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z',
      TriangleLine: 'F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8',
      CircleEndedArrow:
        'F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z',
      DynamicWidthArrow:
        'F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z',
      EquilibriumArrow: 'm 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3',
      FastForward:
        'F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z',
      Kite: 'F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z',
      HalfArrowTop: 'F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8',
      HalfArrowBottom: 'F1 m 0,8 l 4,-4 4,0 -8,4 z',
      OpposingDirectionDoubleArrow:
        'F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z',
      PartialDoubleTriangle: 'F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z',
      LineCircle: 'F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z',
      DoubleLineCircle: 'F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z',
      TripleLineCircle:
        'F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z',
      CircleLine: 'F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8',
      DiamondCircle: 'F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z',
      PlusCircle: 'F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8',
      OpenRightTriangleTop: 'm 8,0 l 0,4 -8,0 m 0,4',
      OpenRightTriangleBottom: 'm 8,8 l 0,-4 -8,0',
      Line: 'm 0,0 l 0,8',
      DoubleLine: 'm 0,0 l 0,8 m 2,0 l 0,-8',
      TripleLine: 'm 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8',
      PentagonArrow: 'F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z',
    };
    function T(a) {
      X.call(this, a);
      this.D = 2408959;
      this.fh = this.Kf = '';
      this.lp = this.hp = this.xp = this.mo = null;
      this.zp = '';
      this.Gf = this.Wn = this.yp = this.qh = null;
      this.jp = '';
      this.ip = Qb;
      this.Sb = this.mp = '';
      this.ui = this.hn = this.ei = null;
      this.bg = new H(NaN, NaN).freeze();
      this.to = '';
      this.Ve = null;
      this.uo = vc;
      this.np = Zc;
      this.Co = Gb;
      this.vo = Hb;
      this.An = null;
      this.no = 127;
      this.Dp = Ib;
      this.Cp = 'gray';
      this.bf = 4;
      this.$w = -1;
      this.$p = NaN;
      this.zy = new N();
      this.Fj = null;
      this.hh = NaN;
    }
    la(T, X);
    T.prototype.cloneProtected = function (a) {
      X.prototype.cloneProtected.call(this, a);
      a.D = (this.D & -4097) | 49152;
      a.Kf = this.Kf;
      a.fh = this.fh;
      a.mo = this.mo;
      a.xp = this.xp;
      a.hp = this.hp;
      a.lp = this.lp;
      a.zp = this.zp;
      a.yp = this.yp;
      a.Wn = this.Wn;
      a.Gf = null;
      a.jp = this.jp;
      a.ip = this.ip.G();
      a.mp = this.mp;
      a.np = this.np.G();
      a.Sb = this.Sb;
      a.hn = this.hn;
      a.bg.assign(this.bg);
      a.to = this.to;
      a.uo = this.uo.G();
      a.Co = this.Co.G();
      a.vo = this.vo.G();
      a.An = this.An;
      a.no = this.no;
      a.Dp = this.Dp.G();
      a.Cp = this.Cp;
      a.bf = this.bf;
      a.$p = this.$p;
    };
    T.prototype.rf = function (a) {
      X.prototype.rf.call(this, a);
      a.Kh();
      a.qh = null;
      a.Ve = null;
      a.Fj = null;
    };
    T.prototype.toString = function () {
      var a = Ia(this.constructor) + '#' + lb(this);
      null !== this.data && (a += '(' + Ja(this.data) + ')');
      return a;
    };
    T.prototype.wk = function (a, b, c, d, e, f, g) {
      var h = this.diagram;
      null !== h &&
        (a === se && 'elements' === b
          ? e instanceof X
            ? Ej(e, function (a) {
                Gj(h.partManager, a);
                Fj(h, a);
              })
            : kk(h, e)
          : a === te &&
            'elements' === b &&
            (e instanceof X
              ? Ej(e, function (a) {
                  Jj(h.partManager, a, h);
                })
              : mk(h, e)),
        h.Ya(a, b, c, d, e, f, g));
    };
    T.prototype.Aa = function (a) {
      X.prototype.Aa.call(this, a);
      if (null !== this.data) {
        for (var b = this.W.j, c = b.length, d = 0; d < c; d++) {
          var e = b[d];
          e instanceof X &&
            Ej(e, function (a) {
              null !== a.data && a.Aa();
            });
        }
        for (b = this.adornments; b.next(); ) b.value.Aa(a);
      }
    };
    T.prototype.updateRelationshipsFromData = function () {
      null !== this.data &&
        this.diagram.partManager.updateRelationshipsFromData(this);
    };
    T.prototype.gk = function (a) {
      var b = this.Gf;
      return null === b ? null : b.H(a);
    };
    T.prototype.Dh = function (a, b) {
      if (null !== b) {
        var c = null,
          d = this.Gf;
        null !== d && (c = d.H(a));
        if (c !== b) {
          if (null !== c) {
            var e = c.diagram;
            null !== e && e.remove(c);
          }
          null === d && (this.Gf = d = new G());
          b.Kf !== a && (b.category = a);
          d.add(a, b);
          a = this.diagram;
          null !== a &&
            (a.add(b),
            (a = b.adornedObject),
            null !== a && ((a = a.Ti()), null !== a && (b.data = a.data)));
        }
      }
    };
    T.prototype.Af = function (a) {
      var b = this.Gf;
      if (null !== b) {
        var c = b.H(a);
        if (null !== c) {
          var d = c.diagram;
          null !== d && d.remove(c);
        }
        b.remove(a);
        0 === b.count && (this.Gf = null);
      }
    };
    T.prototype.Zj = function () {
      var a = this.Gf;
      if (null !== a) {
        var b = Ea();
        for (a = a.iterator; a.next(); ) b.push(a.key);
        a = b.length;
        for (var c = 0; c < a; c++) this.Af(b[c]);
        Ha(b);
      }
    };
    T.prototype.updateAdornments = function () {
      var a = this.diagram;
      if (null !== a) {
        for (var b = this.adornments; b.next(); ) {
          var c = b.value;
          c.o();
          c.placeholder && c.placeholder.o();
        }
        a: {
          if (
            this.isSelected &&
            this.selectionAdorned &&
            ((b = this.selectionObject),
            null !== b &&
              this.actualBounds.u() &&
              this.isVisible() &&
              b.yf() &&
              b.actualBounds.u())
          ) {
            c = this.gk('Selection');
            if (null === c) {
              c = this.selectionAdornmentTemplate;
              null === c &&
                (c = this.Lh()
                  ? a.linkSelectionAdornmentTemplate
                  : this instanceof xf
                  ? a.groupSelectionAdornmentTemplate
                  : a.nodeSelectionAdornmentTemplate);
              if (!(c instanceof Ce)) break a;
              zg(c);
              c = c.copy();
              null !== c &&
                (this.Lh() &&
                  this.selectionObject === this.path &&
                  (c.type = X.Link),
                (c.adornedObject = b));
            }
            if (null !== c) {
              c.type === X.Link ? c.o() : ((b = H.alloc()), H.free(b));
              this.Dh('Selection', c);
              break a;
            }
          }
          this.Af('Selection');
        }
        uo(this, a);
        for (b = this.adornments; b.next(); ) b.value.Aa();
      }
    };
    T.prototype.Mb = function () {
      var a = this.diagram;
      null !== a &&
        (Si(a), (0 !== (this.D & 16384)) !== !0 && (gi(this, !0), a.Yb()));
    };
    function fi(a) {
      (0 !== (a.D & 16384)) !== !1 && (a.updateAdornments(), gi(a, !1));
    }
    function uo(a, b) {
      b.toolManager.mouseDownTools.each(function (b) {
        b.isEnabled && b.updateAdornments(a);
      });
      b.toolManager.updateAdornments(a);
    }
    function vo(a) {
      if (!1 === tj(a)) {
        wo(a, !0);
        a.nl();
        var b = a.diagram;
        null !== b && (b.ld.add(a), b.Yb());
      }
    }
    function xo(a) {
      a.D |= 2097152;
      if (!1 !== tj(a)) {
        var b = a.position,
          c = a.location;
        (c.u() && b.u()) || yo(a, b, c);
        c = a.vb;
        var d = N.alloc().assign(c);
        c.ea();
        c.x = b.x;
        c.y = b.y;
        c.freeze();
        a.Et(d, c);
        N.free(d);
        wo(a, !1);
      }
    }
    T.prototype.move = function (a, b) {
      !0 === b ? (this.location = a) : (this.position = a);
    };
    T.prototype.moveTo = function (a, b, c) {
      a = H.allocAt(a, b);
      this.move(a, c);
      H.free(a);
    };
    T.prototype.isVisible = function () {
      if (!this.visible) return !1;
      var a = this.layer;
      if (null !== a && !a.visible) return !1;
      a = this.diagram;
      if (null !== a && a.animationManager.Dt(this)) return !0;
      a = this.containingGroup;
      return null === a || (a.isSubGraphExpanded && a.isVisible()) ? !0 : !1;
    };
    t = T.prototype;
    t.Ob = function (a) {
      var b = this.diagram;
      a
        ? (this.C(4), this.Mb(), null !== b && b.ld.add(this))
        : (this.C(8), this.Zj());
      this.Kh();
      null !== b && (b.Na(), b.N());
    };
    t.Xa = function (a) {
      if (this.name === a) return this;
      var b = this.Fj;
      null === b && (this.Fj = b = new G());
      if (null !== b.H(a)) return b.H(a);
      var c = X.prototype.Xa.call(this, a);
      if (null !== c) return b.set(a, c), c;
      b.set(a, null);
      return null;
    };
    t.uf = function (a, b, c) {
      void 0 === c && (c = new H());
      b = b.kc() ? Ac : b;
      var d = a.naturalBounds;
      c.h(d.width * b.x + b.offsetX, d.height * b.y + b.offsetY);
      if (null === a || a === this) return c;
      a.transform.ra(c);
      for (a = a.panel; null !== a && a !== this; )
        a.transform.ra(c), (a = a.panel);
      this.ag.ra(c);
      c.offset(-this.oc.x, -this.oc.y);
      return c;
    };
    t.nq = function (a) {
      void 0 === a && (a = new N());
      return a.assign(this.actualBounds);
    };
    t.zb = function () {
      !0 === rj(this) && this.measure(Infinity, Infinity);
      this.arrange();
    };
    function Cj(a, b) {
      var c = a.zy;
      isNaN(a.hh) && (a.hh = bn(a));
      var d = a.hh;
      var e = 2 * d;
      if (!a.isShadowed)
        return (
          c.h(b.x - 1 - d, b.y - 1 - d, b.width + 2 + e, b.height + 2 + e), c
        );
      d = b.x;
      e = b.y;
      var f = b.width;
      b = b.height;
      var g = a.shadowBlur;
      a = a.shadowOffset;
      f += g;
      b += g;
      d -= g / 2;
      e -= g / 2;
      0 < a.x ? (f += a.x) : ((d += a.x), (f -= a.x));
      0 < a.y ? (b += a.y) : ((e += a.y), (b -= a.y));
      c.h(d - 1, e - 1, f + 2, b + 2);
      return c;
    }
    T.prototype.arrange = function () {
      if (!1 === sj(this)) xo(this);
      else {
        var a = this.vb,
          b = N.alloc();
        b.assign(a);
        a.ea();
        var c = xg(this);
        this.Gh(0, 0, this.oc.width, this.oc.height);
        var d = this.position;
        yo(this, d, this.location);
        a.x = d.x;
        a.y = d.y;
        a.freeze();
        this.Et(b, a);
        kl(this, !1);
        b.A(a)
          ? this.xd(c)
          : !this.Vb() ||
            (J.w(b.width, a.width) && J.w(b.height, a.height)) ||
            (0 <= this.$w && this.C(16));
        N.free(b);
        wo(this, !1);
      }
    };
    t = T.prototype;
    t.Et = function (a, b) {
      var c = this.diagram;
      if (null !== c) {
        var d = !1;
        if (!1 === c.li && a.u()) {
          var e = N.alloc();
          e.assign(c.documentBounds);
          e.nw(c.padding);
          a.x > e.x &&
            a.y > e.y &&
            a.right < e.right &&
            a.bottom < e.bottom &&
            b.x > e.x &&
            b.y > e.y &&
            b.right < e.right &&
            b.bottom < e.bottom &&
            (d = !0);
          N.free(e);
        }
        ((0 !== (this.D & 65536)) !== !0 && a.A(b)) || Hj(this, d, c);
        c.N();
        Zb(a, b) ||
          (this instanceof U && !c.undoManager.isUndoingRedoing && this.ed(),
          this.Kh());
      }
    };
    t.jw = function (a, b) {
      if (this.Lh() || !a.u()) return !1;
      var c = this.diagram;
      if (
        null !== c &&
        (zo(this, c, a, b), !0 === c.undoManager.isUndoingRedoing)
      )
        return !0;
      this.ma = a;
      this.D &= -2097153;
      c = this.bg;
      if (c.u()) {
        var d = c.copy();
        c.h(c.x + (a.x - b.x), c.y + (a.y - b.y));
        this.g('location', d, c.copy());
      }
      !1 === tj(this) && !1 === sj(this) && (vo(this), xo(this));
      return !0;
    };
    function zo(a, b, c, d) {
      null === b ||
        a instanceof Ce ||
        ((b = b.animationManager), b.Xe && Jh(b, a, d.copy(), c.copy()));
    }
    t.Jq = function (a, b, c) {
      var d = this.bg,
        e = this.ma;
      if (c) {
        if (d.x === a && d.y === b) return;
        tj(this) || sj(this) ? e.h(NaN, NaN) : e.h(e.x + a - d.x, e.y + b - d.y);
        d.h(a, b);
      } else {
        if (e.x === a && e.y === b) return;
        tj(this) || sj(this) ? d.h(NaN, NaN) : d.h(d.x + a - e.x, d.y + b - e.y);
        e.h(a, b);
      }
      vo(this);
    };
    t.kw = function () {
      this.D &= -2097153;
      vo(this);
    };
    function yo(a, b, c) {
      var d = H.alloc(),
        e = a.locationSpot,
        f = a.locationObject;
      e.kc() &&
        B("determineOffset: Part's locationSpot must be real: " + e.toString());
      var g = f.naturalBounds,
        h = f instanceof W ? f.strokeWidth : 0;
      d.yk(0, 0, g.width + h, g.height + h, e);
      if (f !== a)
        for (
          d.offset(-h / 2, -h / 2), f.transform.ra(d), e = f.panel;
          null !== e && e !== a;
  
        )
          e.transform.ra(d), (e = e.panel);
      a.ag.ra(d);
      d.offset(-a.oc.x, -a.oc.y);
      e = a.diagram;
      f = c.u();
      g = b.u();
      f && g
        ? 0 !== (a.D & 2097152)
          ? Ao(a, b, c, e, d)
          : Bo(a, b, c, e, d)
        : f
        ? Ao(a, b, c, e, d)
        : g && Bo(a, b, c, e, d);
      a.D |= 2097152;
      H.free(d);
      a.nl();
    }
    function Ao(a, b, c, d, e) {
      var f = b.x,
        g = b.y;
      b.h(c.x - e.x, c.y - e.y);
      null !== d &&
        ((c = d.animationManager),
        (e = c.isAnimating) ||
          !c.Xe ||
          a instanceof Ce ||
          Jh(c, a, new H(f, g), b),
        e ||
          (b.x === f && b.y === g) ||
          ((c = d.skipsUndoManager),
          (d.skipsUndoManager = !0),
          a.g('position', new H(f, g), b),
          (d.skipsUndoManager = c)));
    }
    function Bo(a, b, c, d, e) {
      var f = c.copy();
      c.h(b.x + e.x, b.y + e.y);
      c.A(f) ||
        null === d ||
        ((b = d.skipsUndoManager),
        (d.skipsUndoManager = !0),
        a.g('location', f, c.copy()),
        (d.skipsUndoManager = b));
    }
    function Hj(a, b, c) {
      ml(a, !1);
      a instanceof U && yk(c, a);
      a.layer.isTemporary || b || c.Na();
      b = a.vb;
      var d = c.viewportBounds;
      d.u()
        ? xg(a)
          ? (dc(b, d) || a.xd(!1), a.updateAdornments())
          : b.Fc(d)
          ? (a.xd(!0), a.updateAdornments())
          : a.Mb()
        : (c.bh = !0);
    }
    t.aj = function () {
      return !0;
    };
    t.Vb = function () {
      return !0;
    };
    t.Lh = function () {
      return !1;
    };
    t.wf = function () {
      return !0;
    };
    function Co(a, b, c, d) {
      b.constructor === a.constructor ||
        Do ||
        ((Do = !0),
        wa(
          'Should not change the class of the Part when changing category from "' +
            c +
            '" to "' +
            d +
            '"',
        ),
        wa(
          '  Old class: ' +
            Ia(a.constructor) +
            ', new class: ' +
            Ia(b.constructor) +
            ', part: ' +
            a.toString(),
        ));
      a.Zj();
      var e = a.data;
      c = a.layerName;
      var f = a.isSelected,
        g = a.isHighlighted,
        h = !0,
        k = !0,
        l = !1;
      a instanceof U &&
        ((h = a.isTreeLeaf), (k = a.isTreeExpanded), (l = a.wasTreeExpanded));
      b.rf(a);
      b.cloneProtected(a);
      a.Kf = d;
      a.o();
      a.N();
      b = a.diagram;
      d = !0;
      null !== b && ((d = b.skipsUndoManager), (b.skipsUndoManager = !0));
      a.hb = e;
      a.D = f ? a.D | 4096 : a.D & -4097;
      a.D = g ? a.D | 524288 : a.D & -524289;
      a instanceof U &&
        ((a.P = h ? a.P | 4 : a.P & -5),
        (a.P = k ? a.P | 1 : a.P & -2),
        (a.P = l ? a.P | 2 : a.P & -3));
      null !== e && a.Aa();
      e = a.layerName;
      e !== c && ((a.fh = c), (a.layerName = e));
      null !== b && (b.skipsUndoManager = d);
      a.Vb() && a.C(64);
    }
    T.prototype.canCopy = function () {
      if (!this.copyable) return !1;
      var a = this.layer;
      if (null === a) return !0;
      if (!a.allowCopy) return !1;
      a = a.diagram;
      return null === a ? !0 : a.allowCopy ? !0 : !1;
    };
    T.prototype.canDelete = function () {
      if (!this.deletable) return !1;
      var a = this.layer;
      if (null === a) return !0;
      if (!a.allowDelete) return !1;
      a = a.diagram;
      return null === a ? !0 : a.allowDelete ? !0 : !1;
    };
    T.prototype.canEdit = function () {
      if (!this.textEditable) return !1;
      var a = this.layer;
      if (null === a) return !0;
      if (!a.allowTextEdit) return !1;
      a = a.diagram;
      return null === a ? !0 : a.allowTextEdit ? !0 : !1;
    };
    T.prototype.canGroup = function () {
      if (!this.groupable) return !1;
      var a = this.layer;
      if (null === a) return !0;
      if (!a.allowGroup) return !1;
      a = a.diagram;
      return null === a ? !0 : a.allowGroup ? !0 : !1;
    };
    T.prototype.canMove = function () {
      if (!this.movable) return !1;
      var a = this.layer;
      if (null === a) return !0;
      if (!a.allowMove) return !1;
      a = a.diagram;
      return null === a ? !0 : a.allowMove ? !0 : !1;
    };
    T.prototype.canReshape = function () {
      if (!this.reshapable) return !1;
      var a = this.layer;
      if (null === a) return !0;
      if (!a.allowReshape) return !1;
      a = a.diagram;
      return null === a ? !0 : a.allowReshape ? !0 : !1;
    };
    T.prototype.canResize = function () {
      if (!this.resizable) return !1;
      var a = this.layer;
      if (null === a) return !0;
      if (!a.allowResize) return !1;
      a = a.diagram;
      return null === a ? !0 : a.allowResize ? !0 : !1;
    };
    T.prototype.canRotate = function () {
      if (!this.rotatable) return !1;
      var a = this.layer;
      if (null === a) return !0;
      if (!a.allowRotate) return !1;
      a = a.diagram;
      return null === a ? !0 : a.allowRotate ? !0 : !1;
    };
    T.prototype.canSelect = function () {
      if (!this.selectable) return !1;
      var a = this.layer;
      if (null === a) return !0;
      if (!a.allowSelect) return !1;
      a = a.diagram;
      return null === a ? !0 : a.allowSelect ? !0 : !1;
    };
    function gi(a, b) {
      a.D = b ? a.D | 16384 : a.D & -16385;
    }
    function tj(a) {
      return 0 !== (a.D & 32768);
    }
    function wo(a, b) {
      a.D = b ? a.D | 32768 : a.D & -32769;
    }
    function ml(a, b) {
      a.D = b ? a.D | 65536 : a.D & -65537;
    }
    function xg(a) {
      return 0 !== (a.D & 131072);
    }
    t = T.prototype;
    t.xd = function (a) {
      this.D = a ? this.D | 131072 : this.D & -131073;
    };
    function Eo(a, b) {
      a.D = b ? a.D | 1048576 : a.D & -1048577;
    }
    t.Kh = function () {
      var a = this.containingGroup;
      null !== a && (a.o(), null !== a.placeholder && a.placeholder.o(), a.ed());
    };
    t.N = function () {
      var a = this.diagram;
      null !== a &&
        !sj(this) &&
        !tj(this) &&
        this.isVisible() &&
        this.vb.u() &&
        a.N(Cj(this, this.vb));
    };
    t.o = function () {
      X.prototype.o.call(this);
      var a = this.diagram;
      null !== a &&
        (a.ld.add(this),
        this instanceof U && null !== this.labeledLink && Bl(this.labeledLink),
        a.Yb(!0));
    };
    t.qq = function (a) {
      a || ((a = this.ei), null !== a && Fo(a, this));
    };
    t.rq = function (a) {
      a || ((a = this.ei), null !== a && Go(a, this));
    };
    t.ek = function () {
      var a = this.data;
      if (null !== a) {
        var b = this.diagram;
        null !== b && ((b = b.model), null !== b && b.Am(a));
      }
    };
    t.sz = function () {
      return Ho(this, this);
    };
    function Ho(a, b) {
      var c = b.containingGroup;
      return null !== c
        ? 1 + Ho(a, c)
        : b instanceof U && ((b = b.labeledLink), null !== b)
        ? Ho(a, b)
        : 0;
    }
    t.wz = function () {
      return Io(this, this);
    };
    function Io(a, b) {
      var c = b.containingGroup;
      return null !== c || (b instanceof U && ((c = b.labeledLink), null !== c))
        ? Io(a, c)
        : b;
    }
    t.Xd = function (a) {
      return a instanceof xf ? Jo(this, this, a) : !1;
    };
    function Jo(a, b, c) {
      if (b === c || null === c) return !1;
      var d = b.containingGroup;
      return null === d || (d !== c && !Jo(a, d, c))
        ? b instanceof U && ((b = b.labeledLink), null !== b)
          ? Jo(a, b, c)
          : !1
        : !0;
    }
    t.Lx = function (a) {
      if (null === a) return null;
      if (this === a) return this.containingGroup;
      for (var b = this; null !== b; ) {
        b instanceof xf && Eo(b, !0);
        if (b instanceof U) {
          var c = b.labeledLink;
          null !== c && (b = c);
        }
        b = b.containingGroup;
      }
      c = null;
      for (b = a; null !== b; ) {
        if (0 !== (b.D & 1048576)) {
          c = b;
          break;
        }
        b instanceof U && ((a = b.labeledLink), null !== a && (b = a));
        b = b.containingGroup;
      }
      for (b = this; null !== b; )
        b instanceof xf && Eo(b, !1),
          b instanceof U && ((a = b.labeledLink), null !== a && (b = a)),
          (b = b.containingGroup);
      return c;
    };
    T.prototype.canLayout = function () {
      if (!this.isLayoutPositioned || !this.isVisible()) return !1;
      var a = this.layer;
      return (null !== a && a.isTemporary) ||
        (this instanceof U && this.isLinkLabel)
        ? !1
        : !0;
    };
    T.prototype.C = function (a) {
      void 0 === a && (a = 16777215);
      if (this.isLayoutPositioned && 0 !== (a & this.layoutConditions)) {
        var b = this.layer;
        (null !== b && b.isTemporary) || (this instanceof U && this.isLinkLabel)
          ? (b = !1)
          : ((b = this.diagram),
            (b = null !== b && b.undoManager.isUndoingRedoing ? !1 : !0));
      } else b = !1;
      if (b)
        if (((b = this.ei), null !== b)) {
          var c = b.layout;
          null !== c ? c.C() : b.C(a);
        } else
          (a = this.diagram), null !== a && ((a = a.layout), null !== a && a.C());
    };
    function Ij(a) {
      if (!a.isVisible()) return !1;
      a = a.layer;
      return null !== a && a.isTemporary ? !1 : !0;
    }
    function Rk(a, b, c, d, e, f) {
      void 0 === f && (f = null);
      if (!(a.contains(b) || (null !== f && !f(b)) || b instanceof Ce))
        if ((a.add(b), b instanceof U)) {
          if (c && b instanceof xf)
            for (var g = b.memberParts; g.next(); ) Rk(a, g.value, c, d, e, f);
          if (!1 !== e)
            for (g = b.linksConnected; g.next(); ) {
              var h = g.value;
              if (!a.contains(h)) {
                var k = h.fromNode,
                  l = h.toNode;
                k = null === k || a.contains(k);
                l = null === l || a.contains(l);
                (e ? k && l : k || l) && Rk(a, h, c, d, e, f);
              }
            }
          if (1 < d) for (b = b.yv(); b.next(); ) Rk(a, b.value, c, d - 1, e, f);
        } else if (b instanceof S)
          for (b = b.labelNodes; b.next(); ) Rk(a, b.value, c, d, e, f);
    }
    ma.Object.defineProperties(T.prototype, {
      key: {
        get: function () {
          var a = this.diagram;
          if (null !== a) return a.model.ja(this.data);
        },
      },
      adornments: {
        get: function () {
          return null === this.Gf ? fb : this.Gf.iteratorValues;
        },
      },
      layer: {
        get: function () {
          return this.ui;
        },
      },
      diagram: {
        get: function () {
          var a = this.ui;
          return null !== a ? a.diagram : null;
        },
      },
      layerName: {
        get: function () {
          return this.fh;
        },
        set: function (a) {
          var b = this.fh;
          if (b !== a) {
            var c = this.diagram;
            if (
              null === c ||
              (null !== c.jm(a) && !c.partManager.addsToTemporaryLayer)
            )
              if (
                ((this.fh = a),
                null !== c && c.Na(),
                this.g('layerName', b, a),
                (b = this.layer),
                null !== b &&
                  b.name !== a &&
                  ((c = b.diagram),
                  null !== c && ((a = c.jm(a)), null !== a && a !== b)))
              ) {
                var d = b.Ec(-1, this, !0);
                0 <= d && c.Ya(te, 'parts', b, this, null, d, !0);
                d = a.$i(99999999, this, !0);
                b.visible !== a.visible && this.Ob(a.visible);
                0 <= d && c.Ya(se, 'parts', a, null, this, !0, d);
                d = this.layerChanged;
                if (null !== d) {
                  var e = c.Z;
                  c.Z = !0;
                  d(this, b, a);
                  c.Z = e;
                }
              }
          }
        },
      },
      layerChanged: {
        get: function () {
          return this.mo;
        },
        set: function (a) {
          var b = this.mo;
          b !== a && ((this.mo = a), this.g('layerChanged', b, a));
        },
      },
      zOrder: {
        get: function () {
          return this.$p;
        },
        set: function (a) {
          var b = this.$p;
          if (b !== a) {
            this.$p = a;
            var c = this.layer;
            null !== c && ki(c, -1, this);
            this.g('zOrder', b, a);
            a = this.diagram;
            null !== a && a.N();
          }
        },
      },
      locationObject: {
        get: function () {
          if (null === this.Ve) {
            var a = this.locationObjectName;
            '' !== a
              ? ((a = this.Xa(a)), null !== a ? (this.Ve = a) : (this.Ve = this))
              : this instanceof Ce
              ? this.type !== X.Link && null !== this.placeholder
                ? (this.Ve = this.placeholder)
                : (this.Ve = this)
              : (this.Ve = this);
          }
          return this.Ve.visible ? this.Ve : this;
        },
      },
      minLocation: {
        get: function () {
          return this.Co;
        },
        set: function (a) {
          var b = this.Co;
          b.A(a) || ((this.Co = a = a.G()), this.g('minLocation', b, a));
        },
      },
      maxLocation: {
        get: function () {
          return this.vo;
        },
        set: function (a) {
          var b = this.vo;
          b.A(a) || ((this.vo = a = a.G()), this.g('maxLocation', b, a));
        },
      },
      locationObjectName: {
        get: function () {
          return this.to;
        },
        set: function (a) {
          var b = this.to;
          b !== a &&
            ((this.to = a),
            (this.Ve = null),
            this.o(),
            this.g('locationObjectName', b, a));
        },
      },
      locationSpot: {
        get: function () {
          return this.uo;
        },
        set: function (a) {
          var b = this.uo;
          b.A(a) ||
            ((this.uo = a = a.G()), this.o(), this.g('locationSpot', b, a));
        },
      },
      location: {
        get: function () {
          return this.bg;
        },
        set: function (a) {
          var b = a.x,
            c = a.y,
            d = this.bg,
            e = d.x,
            f = d.y;
          ((e === b || (isNaN(e) && isNaN(b))) &&
            (f === c || (isNaN(f) && isNaN(c)))) ||
            ((a = a.copy()),
            (b = a),
            this.Lh()
              ? (b = !1)
              : ((this.bg = b),
                (this.D |= 2097152),
                !1 === sj(this) &&
                  (vo(this),
                  (c = this.ma),
                  c.u() &&
                    ((e = c.copy()),
                    c.h(c.x + (b.x - d.x), c.y + (b.y - d.y)),
                    zo(this, this.diagram, c, e),
                    this.g('position', e, c))),
                (b = !0)),
            b && this.g('location', d.copy(), a.copy()));
        },
      },
      category: {
        get: function () {
          return this.Kf;
        },
        set: function (a) {
          var b = this.Kf;
          if (b !== a) {
            var c = this.diagram,
              d = this.data,
              e = null;
            if (null !== c && null !== d && !(this instanceof Ce)) {
              var f = c.model.undoManager;
              f.isEnabled &&
                !f.isUndoingRedoing &&
                ((e = this.clone()), e.W.addAll(this.W));
            }
            this.Kf = a;
            this.g('category', b, a);
            null === c || null === d || this instanceof Ce
              ? this instanceof Ce &&
                ((e = this.adornedPart),
                null !== e &&
                  ((a = e.Gf),
                  null !== a && a.remove(b),
                  e.Dh(this.category, this)))
              : ((f = c.model),
                f.undoManager.isUndoingRedoing ||
                  (this.Lh()
                    ? (c.partManager.setLinkCategoryForData(d, a),
                      (c = c.partManager.findLinkTemplateForCategory(a)),
                      null !== c &&
                        (zg(c), (c = c.copy()), null !== c && Co(this, c, b, a)))
                    : (null !== f && f.Iq(d, a),
                      (c = Ko(c.partManager, d, a)),
                      null !== c &&
                        (zg(c),
                        (c = c.copy()),
                        null === c ||
                          c instanceof S ||
                          ((d = this.location.copy()),
                          Co(this, c, b, a),
                          this.location.u() || (this.location = d)))),
                  null !== e &&
                    ((b = this.clone()),
                    b.W.addAll(this.W),
                    this.g('self', e, b))));
          }
        },
      },
      self: {
        get: function () {
          return this;
        },
        set: function (a) {
          Co(this, a, this.category, a.category);
        },
      },
      copyable: {
        get: function () {
          return 0 !== (this.D & 1);
        },
        set: function (a) {
          var b = 0 !== (this.D & 1);
          b !== a && ((this.D ^= 1), this.g('copyable', b, a));
        },
      },
      deletable: {
        get: function () {
          return 0 !== (this.D & 2);
        },
        set: function (a) {
          var b = 0 !== (this.D & 2);
          b !== a && ((this.D ^= 2), this.g('deletable', b, a));
        },
      },
      textEditable: {
        get: function () {
          return 0 !== (this.D & 4);
        },
        set: function (a) {
          var b = 0 !== (this.D & 4);
          b !== a && ((this.D ^= 4), this.g('textEditable', b, a), this.Mb());
        },
      },
      groupable: {
        get: function () {
          return 0 !== (this.D & 8);
        },
        set: function (a) {
          var b = 0 !== (this.D & 8);
          b !== a && ((this.D ^= 8), this.g('groupable', b, a));
        },
      },
      movable: {
        get: function () {
          return 0 !== (this.D & 16);
        },
        set: function (a) {
          var b = 0 !== (this.D & 16);
          b !== a && ((this.D ^= 16), this.g('movable', b, a));
        },
      },
      selectionAdorned: {
        get: function () {
          return 0 !== (this.D & 32);
        },
        set: function (a) {
          var b = 0 !== (this.D & 32);
          b !== a &&
            ((this.D ^= 32), this.g('selectionAdorned', b, a), this.Mb());
        },
      },
      isInDocumentBounds: {
        get: function () {
          return 0 !== (this.D & 64);
        },
        set: function (a) {
          var b = 0 !== (this.D & 64);
          if (b !== a) {
            this.D ^= 64;
            var c = this.diagram;
            null !== c && c.Na();
            this.g('isInDocumentBounds', b, a);
          }
        },
      },
      isLayoutPositioned: {
        get: function () {
          return 0 !== (this.D & 128);
        },
        set: function (a) {
          var b = 0 !== (this.D & 128);
          b !== a &&
            ((this.D ^= 128),
            this.g('isLayoutPositioned', b, a),
            this.C(a ? 4 : 8));
        },
      },
      selectable: {
        get: function () {
          return 0 !== (this.D & 256);
        },
        set: function (a) {
          var b = 0 !== (this.D & 256);
          b !== a && ((this.D ^= 256), this.g('selectable', b, a), this.Mb());
        },
      },
      reshapable: {
        get: function () {
          return 0 !== (this.D & 512);
        },
        set: function (a) {
          var b = 0 !== (this.D & 512);
          b !== a && ((this.D ^= 512), this.g('reshapable', b, a), this.Mb());
        },
      },
      resizable: {
        get: function () {
          return 0 !== (this.D & 1024);
        },
        set: function (a) {
          var b = 0 !== (this.D & 1024);
          b !== a && ((this.D ^= 1024), this.g('resizable', b, a), this.Mb());
        },
      },
      rotatable: {
        get: function () {
          return 0 !== (this.D & 2048);
        },
        set: function (a) {
          var b = 0 !== (this.D & 2048);
          b !== a && ((this.D ^= 2048), this.g('rotatable', b, a), this.Mb());
        },
      },
      isSelected: {
        get: function () {
          return 0 !== (this.D & 4096);
        },
        set: function (a) {
          var b = 0 !== (this.D & 4096);
          if (b !== a) {
            var c = this.diagram;
            if (
              !a ||
              (this.canSelect() &&
                !(null !== c && c.selection.count >= c.maxSelectionCount))
            ) {
              this.D ^= 4096;
              var d = !1;
              if (null !== c) {
                d = c.skipsUndoManager;
                c.skipsUndoManager = !0;
                var e = c.selection;
                e.ea();
                a ? e.add(this) : e.remove(this);
                e.freeze();
              }
              this.g('isSelected', b, a);
              this.Mb();
              a = this.selectionChanged;
              null !== a && a(this);
              null !== c && (c.Yb(), (c.skipsUndoManager = d));
            }
          }
        },
      },
      isHighlighted: {
        get: function () {
          return 0 !== (this.D & 524288);
        },
        set: function (a) {
          var b = 0 !== (this.D & 524288);
          if (b !== a) {
            this.D ^= 524288;
            var c = this.diagram;
            null !== c &&
              ((c = c.highlighteds),
              c.ea(),
              a ? c.add(this) : c.remove(this),
              c.freeze());
            this.g('isHighlighted', b, a);
            this.N();
            a = this.highlightedChanged;
            null !== a && a(this);
          }
        },
      },
      isShadowed: {
        get: function () {
          return 0 !== (this.D & 8192);
        },
        set: function (a) {
          var b = 0 !== (this.D & 8192);
          b !== a && ((this.D ^= 8192), this.g('isShadowed', b, a), this.N());
        },
      },
      isAnimated: {
        get: function () {
          return 0 !== (this.D & 262144);
        },
        set: function (a) {
          var b = 0 !== (this.D & 262144);
          b !== a && ((this.D ^= 262144), this.g('isAnimated', b, a));
        },
      },
      highlightedChanged: {
        get: function () {
          return this.Wn;
        },
        set: function (a) {
          var b = this.Wn;
          b !== a && ((this.Wn = a), this.g('highlightedChanged', b, a));
        },
      },
      selectionObjectName: {
        get: function () {
          return this.zp;
        },
        set: function (a) {
          var b = this.zp;
          b !== a &&
            ((this.zp = a),
            (this.qh = null),
            this.g('selectionObjectName', b, a));
        },
      },
      selectionAdornmentTemplate: {
        get: function () {
          return this.xp;
        },
        set: function (a) {
          var b = this.xp;
          b !== a && ((this.xp = a), this.g('selectionAdornmentTemplate', b, a));
        },
      },
      selectionObject: {
        get: function () {
          if (null === this.qh) {
            var a = this.selectionObjectName;
            null !== a && '' !== a
              ? ((a = this.Xa(a)), null !== a ? (this.qh = a) : (this.qh = this))
              : this instanceof S
              ? ((a = this.path), null !== a ? (this.qh = a) : (this.qh = this))
              : (this.qh = this);
          }
          return this.qh;
        },
      },
      selectionChanged: {
        get: function () {
          return this.yp;
        },
        set: function (a) {
          var b = this.yp;
          b !== a && ((this.yp = a), this.g('selectionChanged', b, a));
        },
      },
      resizeAdornmentTemplate: {
        get: function () {
          return this.hp;
        },
        set: function (a) {
          var b = this.hp;
          b !== a && ((this.hp = a), this.g('resizeAdornmentTemplate', b, a));
        },
      },
      resizeObjectName: {
        get: function () {
          return this.jp;
        },
        set: function (a) {
          var b = this.jp;
          b !== a && ((this.jp = a), this.g('resizeObjectName', b, a));
        },
      },
      resizeObject: {
        get: function () {
          var a = this.resizeObjectName;
          return '' !== a && ((a = this.Xa(a)), null !== a) ? a : this;
        },
      },
      resizeCellSize: {
        get: function () {
          return this.ip;
        },
        set: function (a) {
          var b = this.ip;
          b.A(a) || ((this.ip = a = a.G()), this.g('resizeCellSize', b, a));
        },
      },
      rotateAdornmentTemplate: {
        get: function () {
          return this.lp;
        },
        set: function (a) {
          var b = this.lp;
          b !== a && ((this.lp = a), this.g('rotateAdornmentTemplate', b, a));
        },
      },
      rotateObjectName: {
        get: function () {
          return this.mp;
        },
        set: function (a) {
          var b = this.mp;
          b !== a && ((this.mp = a), this.g('rotateObjectName', b, a));
        },
      },
      rotateObject: {
        get: function () {
          var a = this.rotateObjectName;
          return '' !== a && ((a = this.Xa(a)), null !== a) ? a : this;
        },
      },
      rotationSpot: {
        get: function () {
          return this.np;
        },
        set: function (a) {
          var b = this.np;
          b.A(a) || ((this.np = a = a.G()), this.g('rotationSpot', b, a));
        },
      },
      text: {
        get: function () {
          return this.Sb;
        },
        set: function (a) {
          var b = this.Sb;
          b !== a && ((this.Sb = a), this.g('text', b, a));
        },
      },
      containingGroup: {
        get: function () {
          return this.ei;
        },
        set: function (a) {
          if (this.Vb()) {
            var b = this.ei;
            if (b !== a) {
              null === a ||
                (this !== a && !a.Xd(this)) ||
                (this === a &&
                  B('Cannot make a Group a member of itself: ' + this.toString()),
                B(
                  'Cannot make a Group indirectly contain itself: ' +
                    this.toString() +
                    ' already contains ' +
                    a.toString(),
                ));
              this.C(2);
              var c = this.diagram;
              null !== b
                ? Go(b, this)
                : this instanceof xf && null !== c && c.Ah.remove(this);
              this.ei = a;
              null !== a
                ? Fo(a, this)
                : this instanceof xf && null !== c && c.Ah.add(this);
              this.C(1);
              if (null !== c && c.Z) {
                var d = this.data,
                  e = c.model;
                if (null !== d && e.kk()) {
                  var f = e.ja(null !== a ? a.data : null);
                  e.Mt(d, f);
                }
              }
              d = this.containingGroupChanged;
              null !== d &&
                ((e = !0),
                null !== c && ((e = c.Z), (c.Z = !0)),
                d(this, b, a),
                null !== c && (c.Z = e));
              if (this instanceof xf)
                for (
                  c = new F(), Rk(c, this, !0, 0, !0), c = c.iterator;
                  c.next();
  
                )
                  if (((d = c.value), d instanceof U))
                    for (d = d.linksConnected; d.next(); ) Lo(d.value);
              if (this instanceof U) {
                for (c = this.linksConnected; c.next(); ) Lo(c.value);
                c = this.labeledLink;
                null !== c && Lo(c);
              }
              this.g('containingGroup', b, a);
              null !== a && ((b = a.layer), null !== b && ki(b, -1, a));
            }
          } else B('cannot set the Part.containingGroup of a Link or Adornment');
        },
      },
      containingGroupChanged: {
        get: function () {
          return this.hn;
        },
        set: function (a) {
          var b = this.hn;
          b !== a && ((this.hn = a), this.g('containingGroupChanged', b, a));
        },
      },
      isTopLevel: {
        get: function () {
          return null !== this.containingGroup ||
            (this instanceof U && null !== this.labeledLink)
            ? !1
            : !0;
        },
      },
      layoutConditions: {
        get: function () {
          return this.no;
        },
        set: function (a) {
          var b = this.no;
          b !== a && ((this.no = a), this.g('layoutConditions', b, a));
        },
      },
      dragComputation: {
        get: function () {
          return this.An;
        },
        set: function (a) {
          var b = this.An;
          b !== a && ((this.An = a), this.g('dragComputation', b, a));
        },
      },
      shadowOffset: {
        get: function () {
          return this.Dp;
        },
        set: function (a) {
          var b = this.Dp;
          b.A(a) ||
            ((this.Dp = a = a.G()), this.N(), this.g('shadowOffset', b, a));
        },
      },
      shadowColor: {
        get: function () {
          return this.Cp;
        },
        set: function (a) {
          var b = this.Cp;
          b !== a && ((this.Cp = a), this.N(), this.g('shadowColor', b, a));
        },
      },
      shadowBlur: {
        get: function () {
          return this.bf;
        },
        set: function (a) {
          var b = this.bf;
          b !== a && ((this.bf = a), this.N(), this.g('shadowBlur', b, a));
        },
      },
    });
    T.prototype.invalidateLayout = T.prototype.C;
    T.prototype.findCommonContainingGroup = T.prototype.Lx;
    T.prototype.isMemberOf = T.prototype.Xd;
    T.prototype.findTopLevelPart = T.prototype.wz;
    T.prototype.findSubGraphLevel = T.prototype.sz;
    T.prototype.ensureBounds = T.prototype.zb;
    T.prototype.getDocumentBounds = T.prototype.nq;
    T.prototype.getRelativePoint = T.prototype.uf;
    T.prototype.findObject = T.prototype.Xa;
    T.prototype.moveTo = T.prototype.moveTo;
    T.prototype.invalidateAdornments = T.prototype.Mb;
    T.prototype.clearAdornments = T.prototype.Zj;
    T.prototype.removeAdornment = T.prototype.Af;
    T.prototype.addAdornment = T.prototype.Dh;
    T.prototype.findAdornment = T.prototype.gk;
    T.prototype.updateTargetBindings = T.prototype.Aa;
    var Do = !1;
    T.className = 'Part';
    T.LayoutNone = 0;
    T.LayoutAdded = 1;
    T.LayoutRemoved = 2;
    T.LayoutShown = 4;
    T.LayoutHidden = 8;
    T.LayoutNodeSized = 16;
    T.LayoutGroupLayout = 32;
    T.LayoutNodeReplaced = 64;
    T.LayoutStandard = 127;
    T.LayoutAll = 16777215;
    function Ce(a) {
      T.call(this, a);
      this.D &= -257;
      this.fh = 'Adornment';
      this.ce = null;
      this.gx = 0;
      this.tx = !1;
      this.l = [];
      this.Sa = null;
    }
    la(Ce, T);
    Ce.prototype.toString = function () {
      var a = this.adornedPart;
      return (
        'Adornment(' + this.category + ')' + (null !== a ? a.toString() : '')
      );
    };
    Ce.prototype.updateRelationshipsFromData = function () {};
    Ce.prototype.pk = function (a) {
      var b = this.adornedObject.part;
      if (b instanceof S && this.adornedObject instanceof W) {
        var c = b.path;
        b.pk(a);
        a = c.geometry;
        b = this.W.j;
        c = b.length;
        for (var d = 0; d < c; d++) {
          var e = b[d];
          e.isPanelMain && e instanceof W && (e.ka = a);
        }
      }
    };
    Ce.prototype.aj = function () {
      var a = this.ce;
      if (null === a) return !0;
      a = a.part;
      return null === a || !sj(a);
    };
    Ce.prototype.Vb = function () {
      return !1;
    };
    Ce.prototype.wk = function (a, b, c, d, e, f, g) {
      if (a === se && 'elements' === b)
        if (e instanceof yg) null === this.Sa && (this.Sa = e);
        else {
          if (e instanceof X) {
            var h = e.im(function (a) {
              return a instanceof yg;
            });
            h instanceof yg && null === this.Sa && (this.Sa = h);
          }
        }
      else
        a === te &&
          'elements' === b &&
          null !== this.Sa &&
          (d === this.Sa
            ? (this.Sa = null)
            : d instanceof X && this.Sa.Dg(d) && (this.Sa = null));
      T.prototype.wk.call(this, a, b, c, d, e, f, g);
    };
    Ce.prototype.updateAdornments = function () {};
    Ce.prototype.ek = function () {};
    ma.Object.defineProperties(Ce.prototype, {
      placeholder: {
        get: function () {
          return this.Sa;
        },
      },
      adornedObject: {
        get: function () {
          return this.ce;
        },
        set: function (a) {
          var b = this.adornedPart,
            c = null;
          null !== a && (c = a.part);
          null === b || (null !== a && b === c) || b.Af(this.category);
          this.ce = a;
          null !== c && c.Dh(this.category, this);
        },
      },
      adornedPart: {
        get: function () {
          var a = this.ce;
          return null !== a ? a.part : null;
        },
      },
      containingGroup: {
        get: function () {
          return null;
        },
      },
    });
    Ce.className = 'Adornment';
    function U(a) {
      T.call(this, a);
      this.P = 13;
      this.Wa = new E();
      this.Vp = this.sl = this.xi = this.po = this.oo = null;
      this.Jk = tc;
      this.rc = this.Ke = null;
      this.ep = Mo;
      this.Bh = !1;
    }
    la(U, T);
    U.prototype.cloneProtected = function (a) {
      T.prototype.cloneProtected.call(this, a);
      a.P = this.P;
      a.P = this.P & -17;
      a.oo = this.oo;
      a.po = this.po;
      a.xi = this.xi;
      a.Vp = this.Vp;
      a.Jk = this.Jk.G();
      a.ep = this.ep;
    };
    t = U.prototype;
    t.rf = function (a) {
      T.prototype.rf.call(this, a);
      a.ed();
      a.Ke = this.Ke;
      a.rc = null;
    };
    function No(a, b) {
      null !== b && (null === a.Ke && (a.Ke = new F()), a.Ke.add(b));
    }
    function Oo(a, b, c, d) {
      if (null === b || null === a.Ke) return null;
      for (var e = a.Ke.iterator; e.next(); ) {
        var f = e.value;
        if (
          (f.Bt === a && f.Pv === b && f.$x === c && f.ay === d) ||
          (f.Bt === b && f.Pv === a && f.$x === d && f.ay === c)
        )
          return f;
      }
      return null;
    }
    t.Vz = function (a, b, c) {
      if (void 0 === b || null === b) b = '';
      if (void 0 === c || null === c) c = '';
      a = Oo(this, a, b, c);
      null !== a && a.nm();
    };
    t.wk = function (a, b, c, d, e, f, g) {
      a === se && 'elements' === b
        ? (this.rc = null)
        : a === te && 'elements' === b && (this.rc = null);
      T.prototype.wk.call(this, a, b, c, d, e, f, g);
    };
    t.ed = function (a) {
      void 0 === a && (a = null);
      for (var b = this.linksConnected; b.next(); ) {
        var c = b.value;
        (null !== a && a.contains(c)) ||
          (Po(this, c.fromPort), Po(this, c.toPort), c.Oa());
      }
    };
    function nl(a, b) {
      for (var c = a.linksConnected; c.next(); ) {
        var d = c.value;
        if (d.fromPort === b || d.toPort === b)
          Po(a, d.fromPort), Po(a, d.toPort), d.Oa();
      }
    }
    function Po(a, b) {
      null !== b &&
        ((b = b.cp),
        null !== b && b.nm(),
        (a = a.containingGroup),
        null === a || a.isSubGraphExpanded || Po(a, a.port));
    }
    t.aj = function () {
      return !0;
    };
    U.prototype.getAvoidableRect = function (a) {
      a.set(this.actualBounds);
      a.bq(this.Jk);
      return a;
    };
    U.prototype.findVisibleNode = function () {
      for (var a = this; null !== a && !a.isVisible(); ) a = a.containingGroup;
      return a;
    };
    U.prototype.isVisible = function () {
      if (!T.prototype.isVisible.call(this)) return !1;
      var a = !0,
        b = qi,
        c = this.diagram;
      if (null !== c) {
        if (c.animationManager.Dt(this)) return !0;
        a = c.isTreePathToChildren;
        b = c.treeCollapsePolicy;
      }
      if (b === qi) {
        if (((a = this.Bg()), null !== a && !a.isTreeExpanded)) return !1;
      } else if (b === Fk) {
        if (
          ((a = a ? this.vv() : this.wv()),
          0 < a.count &&
            a.all(function (a) {
              return !a.isTreeExpanded;
            }))
        )
          return !1;
      } else if (
        b === Gk &&
        ((a = a ? this.vv() : this.wv()),
        0 < a.count &&
          a.any(function (a) {
            return !a.isTreeExpanded;
          }))
      )
        return !1;
      a = this.labeledLink;
      return null !== a ? a.isVisible() : !0;
    };
    t = U.prototype;
    t.Ob = function (a) {
      T.prototype.Ob.call(this, a);
      for (var b = this.linksConnected; b.next(); ) b.value.Ob(a);
    };
    t.tv = function (a) {
      void 0 === a && (a = null);
      if (null === a) return this.Wa.iterator;
      var b = new ib(this.Wa),
        c = this;
      b.predicate = function (b) {
        return (
          (b.fromNode === c && b.fromPortId === a) ||
          (b.toNode === c && b.toPortId === a)
        );
      };
      return b;
    };
    t.kq = function (a) {
      void 0 === a && (a = null);
      var b = new ib(this.Wa),
        c = this;
      b.predicate = function (b) {
        return b.fromNode !== c ? !1 : null === a ? !0 : b.fromPortId === a;
      };
      return b;
    };
    t.td = function (a) {
      void 0 === a && (a = null);
      var b = new ib(this.Wa),
        c = this;
      b.predicate = function (b) {
        return b.toNode !== c ? !1 : null === a ? !0 : b.toPortId === a;
      };
      return b;
    };
    t.uv = function (a) {
      void 0 === a && (a = null);
      for (var b = null, c = null, d = this.Wa.iterator; d.next(); ) {
        var e = d.value;
        if (e.fromNode === this) {
          if (null === a || e.fromPortId === a)
            (e = e.toNode),
              null !== b
                ? b.add(e)
                : null !== c && c !== e
                ? ((b = new F()), b.add(c), b.add(e))
                : (c = e);
        } else
          e.toNode !== this ||
            (null !== a && e.toPortId !== a) ||
            ((e = e.fromNode),
            null !== b
              ? b.add(e)
              : null !== c && c !== e
              ? ((b = new F()), b.add(c), b.add(e))
              : (c = e));
      }
      return null !== b ? b.iterator : null !== c ? new gb(c) : fb;
    };
    t.wv = function (a) {
      void 0 === a && (a = null);
      for (var b = null, c = null, d = this.Wa.iterator; d.next(); ) {
        var e = d.value;
        e.fromNode !== this ||
          (null !== a && e.fromPortId !== a) ||
          ((e = e.toNode),
          null !== b
            ? b.add(e)
            : null !== c && c !== e
            ? ((b = new F()), b.add(c), b.add(e))
            : (c = e));
      }
      return null !== b ? b.iterator : null !== c ? new gb(c) : fb;
    };
    t.vv = function (a) {
      void 0 === a && (a = null);
      for (var b = null, c = null, d = this.Wa.iterator; d.next(); ) {
        var e = d.value;
        e.toNode !== this ||
          (null !== a && e.toPortId !== a) ||
          ((e = e.fromNode),
          null !== b
            ? b.add(e)
            : null !== c && c !== e
            ? ((b = new F()), b.add(c), b.add(e))
            : (c = e));
      }
      return null !== b ? b.iterator : null !== c ? new gb(c) : fb;
    };
    t.nz = function (a, b, c) {
      void 0 === b && (b = null);
      void 0 === c && (c = null);
      var d = new ib(this.Wa),
        e = this;
      d.predicate = function (d) {
        return (d.fromNode !== e ||
          d.toNode !== a ||
          (null !== b && d.fromPortId !== b) ||
          (null !== c && d.toPortId !== c)) &&
          (d.fromNode !== a ||
            d.toNode !== e ||
            (null !== c && d.fromPortId !== c) ||
            (null !== b && d.toPortId !== b))
          ? !1
          : !0;
      };
      return d;
    };
    t.oz = function (a, b, c) {
      void 0 === b && (b = null);
      void 0 === c && (c = null);
      var d = new ib(this.Wa),
        e = this;
      d.predicate = function (d) {
        return d.fromNode !== e ||
          d.toNode !== a ||
          (null !== b && d.fromPortId !== b) ||
          (null !== c && d.toPortId !== c)
          ? !1
          : !0;
      };
      return d;
    };
    function Qo(a, b, c) {
      Po(a, c);
      var d = a.Wa.contains(b);
      d || a.Wa.add(b);
      if (!d || b.fromNode === b.toNode) {
        var e = a.linkConnected;
        if (null !== e) {
          var f = !0,
            g = a.diagram;
          null !== g && ((f = g.Z), (g.Z = !0));
          e(a, b, c);
          null !== g && (g.Z = f);
        }
      }
      !d &&
        b.isTreeLink &&
        ((c = b.fromNode),
        (b = b.toNode),
        null !== c &&
          null !== b &&
          c !== b &&
          ((d = !0),
          (a = a.diagram),
          null !== a && (d = a.isTreePathToChildren),
          (e = d ? b : c),
          (f = d ? c : b),
          e.Bh || (e.Bh = f),
          !f.isTreeLeaf ||
            (null !== a && a.undoManager.isUndoingRedoing) ||
            (d
              ? c === f && (f.isTreeLeaf = !1)
              : b === f && (f.isTreeLeaf = !1))));
    }
    function Ro(a, b, c) {
      Po(a, c);
      var d = a.Wa.remove(b),
        e = null;
      if (d || b.toNode === b.fromNode) {
        var f = a.linkDisconnected;
        e = a.diagram;
        if (null !== f) {
          var g = !0;
          null !== e && ((g = e.Z), (e.Z = !0));
          f(a, b, c);
          null !== e && (e.Z = g);
        }
      }
      d &&
        b.isTreeLink &&
        ((c = !0),
        null !== e && (c = e.isTreePathToChildren),
        (a = c ? b.toNode : b.fromNode),
        (b = c ? b.fromNode : b.toNode),
        null !== a && (a.Bh = !1),
        null === b ||
          b.isTreeLeaf ||
          (0 === b.Wa.count
            ? ((b.Bh = null),
              (null !== e && e.undoManager.isUndoingRedoing) ||
                (b.isTreeLeaf = !0))
            : Ek(b)));
    }
    function Ek(a) {
      a.Bh = !1;
      if (0 !== a.Wa.count) {
        var b = !0,
          c = a.diagram;
        if (null === c || !c.undoManager.isUndoingRedoing) {
          null !== c && (b = c.isTreePathToChildren);
          for (c = a.Wa.iterator; c.next(); ) {
            var d = c.value;
            if (d.isTreeLink)
              if (b) {
                if (d.fromNode === a) {
                  a.isTreeLeaf = !1;
                  return;
                }
              } else if (d.toNode === a) {
                a.isTreeLeaf = !1;
                return;
              }
          }
          a.isTreeLeaf = !0;
        }
      }
    }
    U.prototype.updateRelationshipsFromData = function () {
      var a = this.diagram;
      null !== a && a.partManager.updateRelationshipsFromData(this);
    };
    t = U.prototype;
    t.qq = function (a) {
      T.prototype.qq.call(this, a);
      a || (Ek(this), (a = this.sl), null !== a && So(a, this));
    };
    t.rq = function (a) {
      T.prototype.rq.call(this, a);
      a ||
        ((a = this.sl),
        null !== a && null !== a.Yc && (a.Yc.remove(this), a.o()));
    };
    t.ek = function () {
      if (0 < this.Wa.count) {
        var a = this.diagram;
        if (null !== a)
          for (
            var b =
                null !== a.commandHandler
                  ? a.commandHandler.deletesConnectedLinks
                  : !0,
              c = this.Wa.copy().iterator;
            c.next();
  
          ) {
            var d = c.value;
            b
              ? a.remove(d)
              : (d.fromNode === this && (d.fromNode = null),
                d.toNode === this && (d.toNode = null));
          }
      }
      this.labeledLink = null;
      T.prototype.ek.call(this);
    };
    t.kt = function (a) {
      if (null === this.rc) {
        if ('' === a && !1 === this.Jh) return this;
        To(this);
      }
      var b = this.rc.H(a);
      return null !== b || ('' !== a && ((b = this.rc.H('')), null !== b))
        ? b
        : this;
    };
    function To(a) {
      null === a.rc ? (a.rc = new G()) : a.rc.clear();
      a.Km(a, function (a, c) {
        Sl(a, c);
      });
      0 === a.rc.count && a.rc.add('', a);
    }
    function Sl(a, b) {
      var c = b.portId;
      null !== c && null !== a.rc && a.rc.add(c, b);
    }
    function Rl(a, b, c) {
      var d = b.portId;
      if (
        null !== d &&
        (null !== a.rc && a.rc.remove(d), (b = a.diagram), null !== b && c)
      ) {
        c = null;
        for (a = a.tv(d); a.next(); )
          (d = a.value), null === c && (c = Ea()), c.push(d);
        if (null !== c) {
          for (a = 0; a < c.length; a++) b.remove(c[a]);
          Ha(c);
        }
      }
    }
    t.Xz = function (a) {
      if (null === a || a === this) return !1;
      var b = !0,
        c = this.diagram;
      null !== c && (b = c.isTreePathToChildren);
      c = this;
      if (b)
        for (; c !== a; ) {
          b = null;
          for (var d = c.Wa.iterator; d.next(); ) {
            var e = d.value;
            if (e.isTreeLink && ((b = e.fromNode), b !== c && b !== this)) break;
          }
          if (b === this || null === b || b === c) return !1;
          c = b;
        }
      else
        for (; c !== a; ) {
          b = null;
          for (
            d = c.Wa.iterator;
            d.next() &&
            ((e = d.value),
            !e.isTreeLink || ((b = e.toNode), b === c || b === this));
  
          );
          if (b === this || null === b || b === c) return !1;
          c = b;
        }
      return !0;
    };
    t.Az = function () {
      var a = !0,
        b = this.diagram;
      null !== b && (a = b.isTreePathToChildren);
      b = this;
      if (a)
        for (;;) {
          a = null;
          for (var c = b.Wa.iterator; c.next(); ) {
            var d = c.value;
            if (d.isTreeLink && ((a = d.fromNode), a !== b && a !== this)) break;
          }
          if (a === this) return this;
          if (null === a || a === b) return b;
          b = a;
        }
      else
        for (;;) {
          a = null;
          for (
            c = b.Wa.iterator;
            c.next() &&
            ((d = c.value),
            !d.isTreeLink || ((a = d.toNode), a === b || a === this));
  
          );
          if (a === this) return this;
          if (null === a || a === b) return b;
          b = a;
        }
    };
    t.kz = function (a) {
      if (null === a) return null;
      if (this === a) return this;
      for (var b = this; null !== b; ) Eo(b, !0), (b = b.Bg());
      var c = null;
      for (b = a; null !== b; ) {
        if (0 !== (b.D & 1048576)) {
          c = b;
          break;
        }
        b = b.Bg();
      }
      for (b = this; null !== b; ) Eo(b, !1), (b = b.Bg());
      return c;
    };
    t.Ui = function () {
      var a = !0,
        b = this.diagram;
      null !== b && (a = b.isTreePathToChildren);
      b = this.Wa.iterator;
      if (a)
        for (; b.next(); ) {
          if (((a = b.value), a.isTreeLink && a.fromNode !== this)) return a;
        }
      else
        for (; b.next(); )
          if (((a = b.value), a.isTreeLink && a.toNode !== this)) return a;
      return null;
    };
    t.Bg = function () {
      var a = this.Bh;
      if (null === a) return null;
      if (a instanceof U) return a;
      var b = !0;
      a = this.diagram;
      null !== a && (b = a.isTreePathToChildren);
      a = this.Wa.iterator;
      if (b)
        for (; a.next(); ) {
          if (((b = a.value), b.isTreeLink && ((b = b.fromNode), b !== this)))
            return (this.Bh = b);
        }
      else
        for (; a.next(); )
          if (((b = a.value), b.isTreeLink && ((b = b.toNode), b !== this)))
            return (this.Bh = b);
      return (this.Bh = null);
    };
    t.yz = function () {
      function a(b, d) {
        if (null !== b) {
          d.add(b);
          var c = b.Ui();
          null !== c && (d.add(c), a(b.Bg(), d));
        }
      }
      var b = new F();
      a(this, b);
      return b;
    };
    t.xz = function () {
      return Uo(this, this);
    };
    function Uo(a, b) {
      b = b.Bg();
      return null === b ? 0 : 1 + Uo(a, b);
    }
    t.mq = function () {
      var a = !0,
        b = this.diagram;
      null !== b && (a = b.isTreePathToChildren);
      b = new ib(this.Wa);
      var c = this;
      b.predicate = a
        ? function (a) {
            return a.isTreeLink && a.fromNode === c ? !0 : !1;
          }
        : function (a) {
            return a.isTreeLink && a.toNode === c ? !0 : !1;
          };
      return b;
    };
    t.yv = function () {
      var a = !0,
        b = this.diagram;
      null !== b && (a = b.isTreePathToChildren);
      var c = (b = null),
        d = this.Wa.iterator;
      if (a)
        for (; d.next(); )
          (a = d.value),
            a.isTreeLink &&
              a.fromNode === this &&
              ((a = a.toNode),
              null !== b
                ? b.add(a)
                : null !== c && c !== a
                ? ((b = new E()), b.add(c), b.add(a))
                : (c = a));
      else
        for (; d.next(); )
          (a = d.value),
            a.isTreeLink &&
              a.toNode === this &&
              ((a = a.fromNode),
              null !== b
                ? b.add(a)
                : null !== c && c !== a
                ? ((b = new E()), b.add(c), b.add(a))
                : (c = a));
      return null !== b ? b.iterator : null !== c ? new gb(c) : fb;
    };
    t.zz = function (a) {
      void 0 === a && (a = Infinity);
      var b = new F();
      Rk(b, this, !1, a, !0);
      return b;
    };
    U.prototype.collapseTree = function (a) {
      void 0 === a && (a = 1);
      1 > a && (a = 1);
      var b = this.diagram;
      if (null !== b && !b.Ce) {
        b.Ce = !0;
        var c = new F();
        c.add(this);
        Vo(
          this,
          c,
          b.isTreePathToChildren,
          a,
          b,
          this,
          b.treeCollapsePolicy === qi,
        );
        b.Ce = !1;
      }
    };
    function Vo(a, b, c, d, e, f, g) {
      if (1 < d)
        for (var h = c ? a.kq() : a.td(); h.next(); ) {
          var k = h.value;
          k.isTreeLink &&
            ((k = k.ot(a)),
            null === k ||
              k === a ||
              b.contains(k) ||
              (b.add(k), Vo(k, b, c, d - 1, e, f, g)));
        }
      else Wo(a, b, c, e, f, g);
    }
    function Wo(a, b, c, d, e, f) {
      for (
        var g = e === a ? !0 : a.isTreeExpanded, h = c ? a.kq() : a.td();
        h.next();
  
      ) {
        var k = h.value;
        if (k.isTreeLink && ((k = k.ot(a)), null !== k && k !== a)) {
          var l = b.contains(k);
          l || b.add(k);
          g && (f && d.Tj(k, e), k.Kh(), k.Ob(!1));
          k.isTreeExpanded &&
            ((k.wasTreeExpanded = k.isTreeExpanded), l || Wo(k, b, c, d, e, f));
        }
      }
      a.isTreeExpanded = !1;
    }
    U.prototype.expandTree = function (a) {
      void 0 === a && (a = 2);
      2 > a && (a = 2);
      var b = this.diagram;
      if (null !== b && !b.Ce) {
        b.Ce = !0;
        var c = new F();
        c.add(this);
        Xo(
          this,
          c,
          b.isTreePathToChildren,
          a,
          b,
          this,
          b.treeCollapsePolicy === qi,
        );
        b.Ce = !1;
      }
    };
    function Xo(a, b, c, d, e, f, g) {
      for (
        var h = f === a ? !1 : a.isTreeExpanded, k = c ? a.kq() : a.td();
        k.next();
  
      ) {
        var l = k.value;
        l.isTreeLink &&
          (h || l.yc || l.Oa(),
          (l = l.ot(a)),
          null !== l &&
            l !== a &&
            !b.contains(l) &&
            (b.add(l),
            h || (l.Ob(!0), l.Kh(), g && e.Vj(l, f)),
            2 < d || l.wasTreeExpanded)) &&
          ((l.wasTreeExpanded = !1), Xo(l, b, c, d - 1, e, f, g));
      }
      a.isTreeExpanded = !0;
    }
    ma.Object.defineProperties(U.prototype, {
      portSpreading: {
        get: function () {
          return this.ep;
        },
        set: function (a) {
          var b = this.ep;
          b !== a &&
            ((this.ep = a),
            this.g('portSpreading', b, a),
            (a = this.diagram),
            (null !== a && a.undoManager.isUndoingRedoing) || this.ed());
        },
      },
      avoidable: {
        get: function () {
          return 0 !== (this.P & 8);
        },
        set: function (a) {
          var b = 0 !== (this.P & 8);
          if (b !== a) {
            this.P ^= 8;
            var c = this.diagram;
            null !== c && yk(c, this);
            this.g('avoidable', b, a);
          }
        },
      },
      avoidableMargin: {
        get: function () {
          return this.Jk;
        },
        set: function (a) {
          'number' === typeof a && (a = new oc(a));
          var b = this.Jk;
          if (!b.A(a)) {
            this.Jk = a = a.G();
            var c = this.diagram;
            null !== c && yk(c, this);
            this.g('avoidableMargin', b, a);
          }
        },
      },
      linksConnected: {
        get: function () {
          return this.Wa.iterator;
        },
      },
      linkConnected: {
        get: function () {
          return this.oo;
        },
        set: function (a) {
          var b = this.oo;
          b !== a && ((this.oo = a), this.g('linkConnected', b, a));
        },
      },
      linkDisconnected: {
        get: function () {
          return this.po;
        },
        set: function (a) {
          var b = this.po;
          b !== a && ((this.po = a), this.g('linkDisconnected', b, a));
        },
      },
      linkValidation: {
        get: function () {
          return this.xi;
        },
        set: function (a) {
          var b = this.xi;
          b !== a && ((this.xi = a), this.g('linkValidation', b, a));
        },
      },
      isLinkLabel: {
        get: function () {
          return null !== this.sl;
        },
      },
      labeledLink: {
        get: function () {
          return this.sl;
        },
        set: function (a) {
          var b = this.sl;
          if (b !== a) {
            var c = this.diagram,
              d = this.data;
            if (null !== b) {
              null !== b.Yc && (b.Yc.remove(this), b.o());
              if (null !== c && null !== d && !c.undoManager.isUndoingRedoing) {
                var e = b.data,
                  f = c.model;
                if (null !== e && f.pm()) {
                  var g = f.ja(d);
                  void 0 !== g && f.by(e, g);
                }
              }
              this.containingGroup = null;
            }
            this.sl = a;
            null !== a &&
              (So(a, this),
              null === c ||
                null === d ||
                c.undoManager.isUndoingRedoing ||
                ((e = a.data),
                (c = c.model),
                null !== e &&
                  c.pm() &&
                  ((d = c.ja(d)), void 0 !== d && c.ev(e, d))),
              (this.containingGroup = a.containingGroup));
            Bl(this);
            this.g('labeledLink', b, a);
          }
        },
      },
      port: {
        get: function () {
          return this.kt('');
        },
      },
      ports: {
        get: function () {
          null === this.rc && To(this);
          return this.rc.iteratorValues;
        },
      },
      isTreeExpanded: {
        get: function () {
          return 0 !== (this.P & 1);
        },
        set: function (a) {
          var b = 0 !== (this.P & 1);
          if (b !== a) {
            this.P ^= 1;
            var c = this.diagram;
            this.g('isTreeExpanded', b, a);
            b = this.treeExpandedChanged;
            if (null !== b) {
              var d = !0;
              null !== c && ((d = c.Z), (c.Z = !0));
              b(this);
              null !== c && (c.Z = d);
            }
            null !== c && c.undoManager.isUndoingRedoing
              ? this.Ob(a)
              : a
              ? this.expandTree()
              : this.collapseTree();
          }
        },
      },
      wasTreeExpanded: {
        get: function () {
          return 0 !== (this.P & 2);
        },
        set: function (a) {
          var b = 0 !== (this.P & 2);
          b !== a && ((this.P ^= 2), this.g('wasTreeExpanded', b, a));
        },
      },
      treeExpandedChanged: {
        get: function () {
          return this.Vp;
        },
        set: function (a) {
          var b = this.Vp;
          b !== a && ((this.Vp = a), this.g('treeExpandedChanged', b, a));
        },
      },
      isTreeLeaf: {
        get: function () {
          return 0 !== (this.P & 4);
        },
        set: function (a) {
          var b = 0 !== (this.P & 4);
          b !== a && ((this.P ^= 4), this.g('isTreeLeaf', b, a));
        },
      },
    });
    U.prototype.expandTree = U.prototype.expandTree;
    U.prototype.collapseTree = U.prototype.collapseTree;
    U.prototype.findTreeParts = U.prototype.zz;
    U.prototype.findTreeChildrenNodes = U.prototype.yv;
    U.prototype.findTreeChildrenLinks = U.prototype.mq;
    U.prototype.findTreeLevel = U.prototype.xz;
    U.prototype.findTreeParentChain = U.prototype.yz;
    U.prototype.findTreeParentNode = U.prototype.Bg;
    U.prototype.findTreeParentLink = U.prototype.Ui;
    U.prototype.findCommonTreeParent = U.prototype.kz;
    U.prototype.findTreeRoot = U.prototype.Az;
    U.prototype.isInTreeOf = U.prototype.Xz;
    U.prototype.findPort = U.prototype.kt;
    U.prototype.findLinksTo = U.prototype.oz;
    U.prototype.findLinksBetween = U.prototype.nz;
    U.prototype.findNodesInto = U.prototype.vv;
    U.prototype.findNodesOutOf = U.prototype.wv;
    U.prototype.findNodesConnected = U.prototype.uv;
    U.prototype.findLinksInto = U.prototype.td;
    U.prototype.findLinksOutOf = U.prototype.kq;
    U.prototype.findLinksConnected = U.prototype.tv;
    U.prototype.invalidateConnectedLinks = U.prototype.ed;
    U.prototype.invalidateLinkBundle = U.prototype.Vz;
    var Yo = new D(U, 'SpreadingNone', 10),
      Mo = new D(U, 'SpreadingEvenly', 11),
      Zo = new D(U, 'SpreadingPacked', 12);
    U.className = 'Node';
    U.SpreadingNone = Yo;
    U.SpreadingEvenly = Mo;
    U.SpreadingPacked = Zo;
    function xf(a) {
      U.call(this, a);
      this.P |= 4608;
      this.zo = new F();
      this.Al = new F();
      this.Sa = this.Mp = this.yi = this.Ao = this.yo = null;
      this.ic = new Di();
      this.ic.group = this;
    }
    la(xf, U);
    xf.prototype.cloneProtected = function (a) {
      U.prototype.cloneProtected.call(this, a);
      this.P = this.P & -32769;
      a.yo = this.yo;
      a.Ao = this.Ao;
      a.yi = this.yi;
      a.Mp = this.Mp;
      var b = a.im(function (a) {
        return a instanceof yg;
      });
      b instanceof yg ? (a.Sa = b) : (a.Sa = null);
      null !== this.ic
        ? ((a.ic = this.ic.copy()), (a.ic.group = a))
        : (null !== a.ic && (a.ic.group = null), (a.ic = null));
    };
    t = xf.prototype;
    t.rf = function (a) {
      U.prototype.rf.call(this, a);
      var b = a.hk();
      for (a = a.memberParts; a.next(); ) {
        var c = a.value;
        c.o();
        c.C(8);
        c.Zj();
        if (c instanceof U) c.ed(b);
        else if (c instanceof S) for (c = c.labelNodes; c.next(); ) c.value.ed(b);
      }
    };
    t.wk = function (a, b, c, d, e, f, g) {
      if (a === se && 'elements' === b)
        if (e instanceof yg)
          null === this.Sa
            ? (this.Sa = e)
            : this.Sa !== e &&
              B(
                'Cannot insert a second Placeholder into the visual tree of a Group.',
              );
        else {
          if (e instanceof X) {
            var h = e.im(function (a) {
              return a instanceof yg;
            });
            h instanceof yg &&
              (null === this.Sa
                ? (this.Sa = h)
                : this.Sa !== h &&
                  B(
                    'Cannot insert a second Placeholder into the visual tree of a Group.',
                  ));
          }
        }
      else
        a === te &&
          'elements' === b &&
          null !== this.Sa &&
          (d === this.Sa
            ? (this.Sa = null)
            : d instanceof X && this.Sa.Dg(d) && (this.Sa = null));
      U.prototype.wk.call(this, a, b, c, d, e, f, g);
    };
    t.Gh = function (a, b, c, d) {
      this.Ve = this.Sa;
      U.prototype.Gh.call(this, a, b, c, d);
    };
    t.zb = function () {
      this.memberParts.each(function (a) {
        a.zb();
      });
      U.prototype.zb.call(this);
    };
    t.aj = function () {
      if (!U.prototype.aj.call(this)) return !1;
      for (var a = this.memberParts; a.next(); ) {
        var b = a.value;
        if (b instanceof U) {
          if (b.isVisible() && sj(b)) return !1;
        } else if (
          b instanceof S &&
          b.isVisible() &&
          sj(b) &&
          b.fromNode !== this &&
          b.toNode !== this
        )
          return !1;
      }
      return !0;
    };
    function Fo(a, b) {
      if (a.zo.add(b)) {
        b instanceof xf && a.Al.add(b);
        var c = a.memberAdded;
        if (null !== c) {
          var d = !0,
            e = a.diagram;
          null !== e && ((d = e.Z), (e.Z = !0));
          c(a, b);
          null !== e && (e.Z = d);
        }
        (a.isVisible() && a.isSubGraphExpanded) || b.Ob(!1);
      }
      (b instanceof S && !a.computesBoundsIncludingLinks) ||
        ((b = a.Sa), null === b && (b = a), b.o());
    }
    function Go(a, b) {
      if (a.zo.remove(b)) {
        b instanceof xf && a.Al.remove(b);
        var c = a.memberRemoved;
        if (null !== c) {
          var d = !0,
            e = a.diagram;
          null !== e && ((d = e.Z), (e.Z = !0));
          c(a, b);
          null !== e && (e.Z = d);
        }
        (a.isVisible() && a.isSubGraphExpanded) || b.Ob(!0);
      }
      (b instanceof S && !a.computesBoundsIncludingLinks) ||
        ((b = a.Sa), null === b && (b = a), b.o());
    }
    t.ek = function () {
      if (0 < this.zo.count) {
        var a = this.diagram;
        if (null !== a)
          for (var b = this.zo.copy().iterator; b.next(); ) a.remove(b.value);
      }
      U.prototype.ek.call(this);
    };
    xf.prototype.canAddMembers = function (a) {
      var b = this.diagram;
      if (null === b) return !1;
      b = b.commandHandler;
      for (a = Tk(a).iterator; a.next(); )
        if (!b.isValidMember(this, a.value)) return !1;
      return !0;
    };
    xf.prototype.addMembers = function (a, b) {
      var c = this.diagram;
      if (null === c) return !1;
      c = c.commandHandler;
      var d = !0;
      for (a = Tk(a).iterator; a.next(); ) {
        var e = a.value;
        !b || c.isValidMember(this, e) ? (e.containingGroup = this) : (d = !1);
      }
      return d;
    };
    xf.prototype.canUngroup = function () {
      if (!this.ungroupable) return !1;
      var a = this.layer;
      if (null !== a && !a.allowUngroup) return !1;
      a = a.diagram;
      return null === a || a.allowUngroup ? !0 : !1;
    };
    t = xf.prototype;
    t.ed = function (a) {
      void 0 === a && (a = null);
      var b = 0 !== (this.P & 65536);
      U.prototype.ed.call(this, a);
      if (!b)
        for (
          (0 !== (this.P & 65536)) !== !0 && (this.P = this.P ^ 65536),
            b = this.sv();
          b.next();
  
        ) {
          var c = b.value;
          if (null === a || !a.contains(c)) {
            var d = c.fromNode;
            null !== d && d !== this && d.Xd(this) && !d.isVisible()
              ? (Po(d, c.fromPort), Po(d, c.toPort), c.Oa())
              : ((d = c.toNode),
                null !== d &&
                  d !== this &&
                  d.Xd(this) &&
                  !d.isVisible() &&
                  (Po(d, c.fromPort), Po(d, c.toPort), c.Oa()));
          }
        }
    };
    t.sv = function () {
      var a = this.hk();
      a.add(this);
      for (var b = new F(), c = a.iterator; c.next(); ) {
        var d = c.value;
        if (d instanceof U)
          for (d = d.linksConnected; d.next(); ) {
            var e = d.value;
            a.contains(e) || b.add(e);
          }
      }
      return b.iterator;
    };
    t.mz = function () {
      var a = this.hk();
      a.add(this);
      for (var b = new F(), c = a.iterator; c.next(); ) {
        var d = c.value;
        if (d instanceof U)
          for (d = d.linksConnected; d.next(); ) {
            var e = d.value,
              f = e.fromNode;
            (a.contains(f) && f !== this) || b.add(f);
            e = e.toNode;
            (a.contains(e) && e !== this) || b.add(e);
          }
      }
      return b.iterator;
    };
    t.lz = function () {
      function a(b, d) {
        null !== b && (d.add(b), a(b.containingGroup, d));
      }
      var b = new F();
      a(this, b);
      return b;
    };
    t.hk = function () {
      var a = new F();
      Rk(a, this, !0, 0, !0);
      a.remove(this);
      return a;
    };
    t.Ob = function (a) {
      U.prototype.Ob.call(this, a);
      for (var b = this.memberParts; b.next(); ) b.value.Ob(a);
    };
    xf.prototype.collapseSubGraph = function () {
      var a = this.diagram;
      if (null !== a && !a.Ce) {
        a.Ce = !0;
        var b = this.hk();
        $o(this, b, a, this);
        a.Ce = !1;
      }
    };
    function $o(a, b, c, d) {
      for (var e = a.memberParts; e.next(); ) {
        var f = e.value;
        f.Ob(!1);
        f instanceof xf &&
          f.isSubGraphExpanded &&
          ((f.wasSubGraphExpanded = f.isSubGraphExpanded), $o(f, b, c, d));
        if (f instanceof U) f.ed(b), c.Tj(f, d);
        else if (f instanceof S) for (f = f.labelNodes; f.next(); ) f.value.ed(b);
      }
      a.isSubGraphExpanded = !1;
    }
    xf.prototype.expandSubGraph = function () {
      var a = this.diagram;
      if (null !== a && !a.Ce) {
        a.Ce = !0;
        var b = this.hk();
        ap(this, b, a, this);
        a.Ce = !1;
      }
    };
    function ap(a, b, c, d) {
      for (var e = a.memberParts; e.next(); ) {
        var f = e.value;
        f.Ob(!0);
        f instanceof xf &&
          f.wasSubGraphExpanded &&
          ((f.wasSubGraphExpanded = !1), ap(f, b, c, d));
        if (f instanceof U) f.ed(b), c.Vj(f, d);
        else if (f instanceof S) for (f = f.labelNodes; f.next(); ) f.value.ed(b);
      }
      a.isSubGraphExpanded = !0;
    }
    xf.prototype.move = function (a, b) {
      void 0 === b && (b = !1);
      var c = b ? this.location : this.position,
        d = c.x;
      c = c.y;
      var e = a.x,
        f = a.y;
      if (
        !(d === e || (isNaN(d) && isNaN(e))) ||
        !(c === f || (isNaN(c) && isNaN(f)))
      ) {
        d = e - (isNaN(d) ? 0 : d);
        c = f - (isNaN(c) ? 0 : c);
        f = H.alloc();
        U.prototype.move.call(this, a, b);
        a = new F();
        for (b = this.hk().iterator; b.next(); )
          if (
            ((e = b.value),
            e instanceof S &&
              (e.suspendsRouting && a.add(e),
              e.yc || (e.fromNode !== this && e.toNode !== this)))
          )
            e.suspendsRouting = !0;
        for (b.reset(); b.next(); )
          if (((e = b.value), !(e.Lh() || (e instanceof U && e.isLinkLabel)))) {
            var g = e.position,
              h = e.location;
            g.u()
              ? ((f.x = g.x + d), (f.y = g.y + c), (e.position = f))
              : h.u() && ((f.x = h.x + d), (f.y = h.y + c), (e.location = f));
          }
        for (b.reset(); b.next(); )
          if (
            ((e = b.value),
            e instanceof S &&
              ((e.suspendsRouting = a.contains(e)),
              e.yc || (e.fromNode !== this && e.toNode !== this)))
          )
            (g = e.position),
              (f.x = g.x + d),
              (f.y = g.y + c),
              f.u() ? e.move(f) : e.Oa(),
              Pj(e) && e.Oa();
        H.free(f);
      }
    };
    ma.Object.defineProperties(xf.prototype, {
      placeholder: {
        get: function () {
          return this.Sa;
        },
      },
      computesBoundsAfterDrag: {
        get: function () {
          return 0 !== (this.P & 2048);
        },
        set: function (a) {
          var b = 0 !== (this.P & 2048);
          b !== a && ((this.P ^= 2048), this.g('computesBoundsAfterDrag', b, a));
        },
      },
      computesBoundsIncludingLinks: {
        get: function () {
          return 0 !== (this.P & 4096);
        },
        set: function (a) {
          var b = 0 !== (this.P & 4096);
          b !== a &&
            ((this.P ^= 4096), this.g('computesBoundsIncludingLinks', b, a));
        },
      },
      computesBoundsIncludingLocation: {
        get: function () {
          return 0 !== (this.P & 8192);
        },
        set: function (a) {
          var b = 0 !== (this.P & 8192);
          b !== a &&
            ((this.P ^= 8192), this.g('computesBoundsIncludingLocation', b, a));
        },
      },
      handlesDragDropForMembers: {
        get: function () {
          return 0 !== (this.P & 16384);
        },
        set: function (a) {
          var b = 0 !== (this.P & 16384);
          b !== a &&
            ((this.P ^= 16384), this.g('handlesDragDropForMembers', b, a));
        },
      },
      memberParts: {
        get: function () {
          return this.zo.iterator;
        },
      },
      layout: {
        get: function () {
          return this.ic;
        },
        set: function (a) {
          var b = this.ic;
          if (b !== a) {
            null !== b && ((b.diagram = null), (b.group = null));
            this.ic = a;
            var c = this.diagram;
            null !== a && ((a.diagram = c), (a.group = this));
            null !== c && (c.Hf = !0);
            this.g('layout', b, a);
            null !== c && c.Yb();
          }
        },
      },
      memberAdded: {
        get: function () {
          return this.yo;
        },
        set: function (a) {
          var b = this.yo;
          b !== a && ((this.yo = a), this.g('memberAdded', b, a));
        },
      },
      memberRemoved: {
        get: function () {
          return this.Ao;
        },
        set: function (a) {
          var b = this.Ao;
          b !== a && ((this.Ao = a), this.g('memberRemoved', b, a));
        },
      },
      memberValidation: {
        get: function () {
          return this.yi;
        },
        set: function (a) {
          var b = this.yi;
          b !== a && ((this.yi = a), this.g('memberValidation', b, a));
        },
      },
      ungroupable: {
        get: function () {
          return 0 !== (this.P & 256);
        },
        set: function (a) {
          var b = 0 !== (this.P & 256);
          b !== a && ((this.P ^= 256), this.g('ungroupable', b, a));
        },
      },
      isSubGraphExpanded: {
        get: function () {
          return 0 !== (this.P & 512);
        },
        set: function (a) {
          var b = 0 !== (this.P & 512);
          if (b !== a) {
            this.P ^= 512;
            var c = this.diagram;
            this.g('isSubGraphExpanded', b, a);
            b = this.subGraphExpandedChanged;
            if (null !== b) {
              var d = !0;
              null !== c && ((d = c.Z), (c.Z = !0));
              b(this);
              null !== c && (c.Z = d);
            }
            null !== c && c.undoManager.isUndoingRedoing
              ? (null !== this.Sa && this.Sa.o(),
                this.memberParts.each(function (a) {
                  a.updateAdornments();
                }))
              : a
              ? this.expandSubGraph()
              : this.collapseSubGraph();
          }
        },
      },
      wasSubGraphExpanded: {
        get: function () {
          return 0 !== (this.P & 1024);
        },
        set: function (a) {
          var b = 0 !== (this.P & 1024);
          b !== a && ((this.P ^= 1024), this.g('wasSubGraphExpanded', b, a));
        },
      },
      subGraphExpandedChanged: {
        get: function () {
          return this.Mp;
        },
        set: function (a) {
          var b = this.Mp;
          b !== a && ((this.Mp = a), this.g('subGraphExpandedChanged', b, a));
        },
      },
      vk: {
        get: function () {
          return 0 !== (this.P & 32768);
        },
        set: function (a) {
          (0 !== (this.P & 32768)) !== a && (this.P ^= 32768);
        },
      },
    });
    xf.prototype.expandSubGraph = xf.prototype.expandSubGraph;
    xf.prototype.collapseSubGraph = xf.prototype.collapseSubGraph;
    xf.prototype.findSubGraphParts = xf.prototype.hk;
    xf.prototype.findContainingGroupChain = xf.prototype.lz;
    xf.prototype.findExternalNodesConnected = xf.prototype.mz;
    xf.prototype.findExternalLinksConnected = xf.prototype.sv;
    xf.prototype.ensureBounds = xf.prototype.zb;
    xf.className = 'Group';
    function yg() {
      Y.call(this);
      this.ab = sc;
      this.sp = new N(NaN, NaN, NaN, NaN);
    }
    la(yg, Y);
    yg.prototype.cloneProtected = function (a) {
      Y.prototype.cloneProtected.call(this, a);
      a.ab = this.ab.G();
      a.sp = this.sp.copy();
    };
    yg.prototype.Ih = function (a) {
      if (null === this.background && null === this.areaBackground) return !1;
      var b = this.naturalBounds;
      return fc(0, 0, b.width, b.height, a.x, a.y);
    };
    yg.prototype.sm = function () {
      var a = this.part;
      (null !== a && (a instanceof xf || a instanceof Ce)) ||
        B('Placeholder is not inside a Group or Adornment.');
      if (a instanceof xf) {
        var b = this.computeBorder(this.sp),
          c = this.minSize,
          d = this.pc;
        Vb(
          d,
          (isFinite(c.width) ? Math.max(c.width, b.width) : b.width) || 0,
          (isFinite(c.height) ? Math.max(c.height, b.height) : b.height) || 0,
        );
        gl(this, 0, 0, d.width, d.height);
        d = a.memberParts;
        for (c = !1; d.next(); )
          if (d.value.isVisible()) {
            c = !0;
            break;
          }
        d = a.diagram;
        !c ||
          null === d ||
          d.animationManager.Jv(a) ||
          isNaN(b.x) ||
          isNaN(b.y) ||
          ((c = H.alloc()),
          c.cj(b, a.locationSpot),
          c.A(a.location) || (a.location = new H(c.x, c.y)),
          H.free(c));
      } else {
        b = this.pc;
        c = this.ab;
        d = c.left + c.right;
        var e = c.top + c.bottom,
          f = a.adornedObject;
        a.angle = f.Wi();
        var g = 0;
        f instanceof W && (g = f.strokeWidth);
        var h = f.tf(),
          k = f.naturalBounds,
          l = (k.width + g) * h;
        g = (k.height + g) * h;
        a.type !== X.Link &&
          ((f = f.ga(
            'Selection' === a.category ? vc : a.locationSpot,
            H.alloc(),
          )),
          (a.location = f),
          H.free(f));
        isNaN(l) || isNaN(g)
          ? ((a = a.adornedObject),
            (l = a.ga(vc, H.alloc())),
            (f = N.allocAt(l.x, l.y, 0, 0)),
            f.Ge(a.ga(Gc, l)),
            f.Ge(a.ga(yc, l)),
            f.Ge(a.ga(Ec, l)),
            Vb(b, f.width + d || 0, f.height + e || 0),
            gl(this, -c.left, -c.top, b.width, b.height),
            H.free(l),
            N.free(f))
          : (Vb(b, l + d || 0, g + e || 0),
            gl(this, -c.left, -c.top, b.width, b.height));
      }
    };
    yg.prototype.Gh = function (a, b, c, d) {
      this.actualBounds.h(a, b, c, d);
    };
    yg.prototype.computeBorder = function (a) {
      var b = this.part,
        c = b.diagram;
      if (
        null !== c &&
        b instanceof xf &&
        !b.layer.isTemporary &&
        b.computesBoundsAfterDrag &&
        this.sp.u()
      ) {
        var d = c.toolManager.findTool('Dragging');
        if (
          d === c.currentTool &&
          ((c = d.computeBorder(b, this.sp, a)), null !== c)
        )
          return c;
      }
      c = N.alloc();
      d = this.computeMemberBounds(c);
      var e = this.ab;
      b instanceof xf && !b.isSubGraphExpanded
        ? a.h(d.x - e.left, d.y - e.top, 0, 0)
        : a.h(
            d.x - e.left,
            d.y - e.top,
            Math.max(d.width + e.left + e.right, 0),
            Math.max(d.height + e.top + e.bottom, 0),
          );
      N.free(c);
      b instanceof xf &&
        b.computesBoundsIncludingLocation &&
        b.location.u() &&
        a.Ge(b.location);
      return a;
    };
    yg.prototype.computeMemberBounds = function (a) {
      if (!(this.part instanceof xf)) return a.h(0, 0, 0, 0), a;
      for (
        var b = this.part,
          c = Infinity,
          d = Infinity,
          e = -Infinity,
          f = -Infinity,
          g = b.memberParts;
        g.next();
  
      ) {
        var h = g.value;
        if (h.isVisible()) {
          if (h instanceof S) {
            if (!b.computesBoundsIncludingLinks) continue;
            if (rj(h)) continue;
            if (h.fromNode === b || h.toNode === b) continue;
          }
          h = h.actualBounds;
          h.left < c && (c = h.left);
          h.top < d && (d = h.top);
          h.right > e && (e = h.right);
          h.bottom > f && (f = h.bottom);
        }
      }
      isFinite(c) && isFinite(d)
        ? a.h(c, d, e - c, f - d)
        : ((b = b.location), a.h(b.x, b.y, 0, 0));
      return a;
    };
    ma.Object.defineProperties(yg.prototype, {
      padding: {
        get: function () {
          return this.ab;
        },
        set: function (a) {
          'number' === typeof a && (a = new oc(a));
          var b = this.ab;
          b.A(a) || ((this.ab = a = a.G()), this.g('padding', b, a));
        },
      },
    });
    yg.className = 'Placeholder';
    function S() {
      T.call(this, X.Link);
      this.Qa = 8;
      this.Oe = null;
      this.Pe = '';
      this.jf = this.Mn = null;
      this.kf = '';
      this.Up = null;
      this.Ek = cg;
      this.pn = 0;
      this.rn = cg;
      this.sn = NaN;
      this.Lj = bp;
      this.Hp = 0.5;
      this.Yc = null;
      this.xb = new E().freeze();
      this.ph = this.kh = null;
      this.Gl = new N();
      this.ka = new td();
      this.Yn = !0;
      this.I = this.v = this.Jf = this.Sf = null;
      this.l = [];
      this.Wu = new H();
      this.Gr = this.ox = this.nx = null;
      this.qu = NaN;
      this.O = null;
    }
    la(S, T);
    S.prototype.cloneProtected = function (a) {
      T.prototype.cloneProtected.call(this, a);
      a.Qa = this.Qa & -113;
      a.Pe = this.Pe;
      a.Mn = this.Mn;
      a.kf = this.kf;
      a.Up = this.Up;
      a.Ek = this.Ek;
      a.pn = this.pn;
      a.rn = this.rn;
      a.sn = this.sn;
      a.Lj = this.Lj;
      a.Hp = this.Hp;
      null !== this.O && (a.O = this.O.copy());
    };
    t = S.prototype;
    t.rf = function (a) {
      T.prototype.rf.call(this, a);
      this.Pe = a.Pe;
      this.kf = a.kf;
      a.kh = null;
      a.Oa();
      a.Jf = this.Jf;
      var b = a.fromPort;
      null !== b && Po(a.fromNode, b);
      b = a.toPort;
      null !== b && Po(a.toNode, b);
    };
    t.bb = function (a) {
      a.classType === S
        ? 2 === (a.value & 2)
          ? (this.routing = a)
          : a === rg || a === bg || a === ag
          ? (this.curve = a)
          : a === cp || a === dp || a === ep
          ? (this.adjusting = a)
          : a !== bp &&
            a !== cg &&
            B('Unknown Link enum value for a Link property: ' + a)
        : T.prototype.bb.call(this, a);
    };
    t.Dc = function () {
      null === this.O && (this.O = new cl());
    };
    t.aj = function () {
      var a = this.fromNode;
      if (null !== a) {
        var b = a.findVisibleNode();
        null !== b && (a = b);
        if (sj(a) || tj(a)) return !1;
      }
      a = this.toNode;
      return null !== a &&
        ((b = a.findVisibleNode()), null !== b && (a = b), sj(a) || tj(a))
        ? !1
        : !0;
    };
    t.jw = function () {
      return !1;
    };
    t.kw = function () {};
    t.Vb = function () {
      return !1;
    };
    S.prototype.computeAngle = function (a, b, c) {
      return S.computeAngle(b, c);
    };
    S.computeAngle = function (a, b) {
      switch (a) {
        default:
        case cg:
          a = 0;
          break;
        case Hn:
          a = b;
          break;
        case Mm:
          a = b + 90;
          break;
        case Om:
          a = b - 90;
          break;
        case fp:
          a = b + 180;
          break;
        case gp:
          a = J.yq(b);
          90 < a && 270 > a && (a -= 180);
          break;
        case Nm:
          a = J.yq(b + 90);
          90 < a && 270 > a && (a -= 180);
          break;
        case Pm:
          a = J.yq(b - 90);
          90 < a && 270 > a && (a -= 180);
          break;
        case Qm:
          a = J.yq(b);
          if ((45 < a && 135 > a) || (225 < a && 315 > a)) return 0;
          90 < a && 270 > a && (a -= 180);
      }
      return J.yq(a);
    };
    function Lo(a) {
      var b = a.fromNode,
        c = a.toNode,
        d = null;
      null !== b
        ? (d = null !== c ? b.Lx(c) : b.containingGroup)
        : null !== c
        ? (d = c.containingGroup)
        : (d = null);
      b = d;
      c = a.ei;
      if (c !== b) {
        null !== c && Go(c, a);
        a.ei = b;
        null !== b && Fo(b, a);
        var e = a.containingGroupChanged;
        if (null !== e) {
          var f = !0,
            g = a.diagram;
          null !== g && ((f = g.Z), (g.Z = !0));
          e(a, c, b);
          null !== g && (g.Z = f);
        }
        !a.yc || (a.nx !== c && a.ox !== c) || a.Oa();
      }
      if (a.isLabeledLink)
        for (a = a.labelNodes; a.next(); ) a.value.containingGroup = d;
    }
    t = S.prototype;
    t.Kh = function () {
      var a = this.containingGroup;
      null !== a &&
        this.fromNode !== a &&
        this.toNode !== a &&
        a.computesBoundsIncludingLinks &&
        T.prototype.Kh.call(this);
    };
    t.ot = function (a) {
      var b = this.fromNode;
      return a === b ? this.toNode : b;
    };
    t.Hz = function (a) {
      var b = this.fromPort;
      return a === b ? this.toPort : b;
    };
    function So(a, b) {
      null === a.Yc && (a.Yc = new F());
      a.Yc.add(b);
      a.o();
    }
    t.qq = function (a) {
      T.prototype.qq.call(this, a);
      hp(this) && this.sq(this.actualBounds);
      if (!a) {
        a = this.Oe;
        var b = null;
        null !== a && ((b = this.fromPort), Qo(a, this, b));
        var c = this.jf;
        if (null !== c) {
          var d = this.toPort;
          (c === a && d === b) || Qo(c, this, d);
        }
        ip(this);
      }
    };
    t.rq = function (a) {
      T.prototype.rq.call(this, a);
      hp(this) && this.sq(this.actualBounds);
      if (!a) {
        a = this.Oe;
        var b = null;
        null !== a && ((b = this.fromPort), Ro(a, this, b));
        var c = this.jf;
        if (null !== c) {
          var d = this.toPort;
          (c === a && d === b) || Ro(c, this, d);
        }
        jp(this);
      }
    };
    t.ek = function () {
      this.yc = !0;
      if (null !== this.Yc) {
        var a = this.diagram;
        if (null !== a)
          for (var b = this.Yc.copy().iterator; b.next(); ) a.remove(b.value);
      }
      null !== this.data &&
        ((a = this.diagram), null !== a && a.partManager.removeDataForLink(this));
    };
    S.prototype.updateRelationshipsFromData = function () {
      if (null !== this.data) {
        var a = this.diagram;
        null !== a && a.partManager.updateRelationshipsFromData(this);
      }
    };
    S.prototype.move = function (a, b) {
      var c = b ? this.location : this.position,
        d = c.x;
      isNaN(d) && (d = 0);
      var e = c.y;
      isNaN(e) && (e = 0);
      d = a.x - d;
      e = a.y - e;
      !0 === b
        ? T.prototype.move.call(this, a, !1)
        : ((a = H.allocAt(c.x + d, c.y + e)),
          T.prototype.move.call(this, a, !1),
          H.free(a));
      qf(this, d, e);
      for (a = this.labelNodes; a.next(); )
        (b = a.value), (c = b.position), b.moveTo(c.x + d, c.y + e);
    };
    S.prototype.canRelinkFrom = function () {
      if (!this.relinkableFrom) return !1;
      var a = this.layer;
      if (null === a) return !0;
      if (!a.allowRelink) return !1;
      a = a.diagram;
      return null === a || a.allowRelink ? !0 : !1;
    };
    S.prototype.canRelinkTo = function () {
      if (!this.relinkableTo) return !1;
      var a = this.layer;
      if (null === a) return !0;
      if (!a.allowRelink) return !1;
      a = a.diagram;
      return null === a || a.allowRelink ? !0 : !1;
    };
    S.prototype.computeMidPoint = function (a) {
      var b = this.pointsCount;
      if (0 === b) return a.assign(Jb), a;
      if (1 === b) return a.assign(this.i(0)), a;
      if (2 === b) {
        var c = this.i(0),
          d = this.i(1);
        a.h((c.x + d.x) / 2, (c.y + d.y) / 2);
        return a;
      }
      if (
        this.isOrthogonal &&
        (15 <= this.computeCorner() || this.computeCurve() === rg)
      )
        return (
          this.ka.Bv(0.5, a),
          a.add(this.i(0)),
          (c = this.ka.figures.first()),
          a.offset(-c.startX, -c.startY),
          a
        );
      if (this.computeCurve() === rg) {
        if (3 === b) return this.i(1);
        d = ((b - 1) / 3) | 0;
        c = 3 * ((d / 2) | 0);
        if (1 === d % 2) {
          d = this.i(c);
          var e = this.i(c + 1),
            f = this.i(c + 2);
          c = this.i(c + 3);
          J.Sy(d.x, d.y, e.x, e.y, f.x, f.y, c.x, c.y, a);
        } else a.assign(this.i(c));
        return a;
      }
      var g = this.flattenedLengths;
      c = this.flattenedTotalLength;
      for (e = f = d = 0; d < c / 2 && f < b; ) {
        e = g[f];
        if (d + e > c / 2) break;
        d += e;
        f++;
      }
      b = this.i(f);
      f = this.i(f + 1);
      1 > Math.abs(b.x - f.x)
        ? b.y > f.y
          ? a.h(b.x, b.y - (c / 2 - d))
          : a.h(b.x, b.y + (c / 2 - d))
        : 1 > Math.abs(b.y - f.y)
        ? b.x > f.x
          ? a.h(b.x - (c / 2 - d), b.y)
          : a.h(b.x + (c / 2 - d), b.y)
        : ((c = (c / 2 - d) / e),
          a.h(b.x + c * (f.x - b.x), b.y + c * (f.y - b.y)));
      return a;
    };
    S.prototype.computeMidAngle = function () {
      var a = this.pointsCount;
      if (2 > a) return NaN;
      if (2 === a) return this.i(0).Ta(this.i(1));
      if (
        this.isOrthogonal &&
        (15 <= this.computeCorner() || this.computeCurve() === rg)
      )
        return this.ka.Qx(0.5);
      if (this.computeCurve() === rg && 4 <= a) {
        var b = ((a - 1) / 3) | 0,
          c = 3 * ((b / 2) | 0);
        if (1 === b % 2) {
          c = Math.floor(c);
          a = this.i(c);
          b = this.i(c + 1);
          var d = this.i(c + 2);
          c = this.i(c + 3);
          return J.Ry(a.x, a.y, b.x, b.y, d.x, d.y, c.x, c.y);
        }
        if (0 < c && c + 1 < a) return this.i(c - 1).Ta(this.i(c + 1));
      }
      b = this.flattenedLengths;
      d = this.flattenedTotalLength;
      var e = 0;
      c = 0;
      for (var f; e < d / 2 && c < a; ) {
        f = b[c];
        if (e + f > d / 2) break;
        e += f;
        c++;
      }
      b = this.i(c);
      d = this.i(c + 1);
      if (1 > Math.abs(b.x - d.x) && 1 > Math.abs(b.y - d.y)) {
        if (0 < c && c + 2 < a) return this.i(c - 1).Ta(this.i(c + 2));
      } else {
        if (1 > Math.abs(b.x - d.x)) return b.y > d.y ? 270 : 90;
        if (1 > Math.abs(b.y - d.y)) return b.x > d.x ? 180 : 0;
      }
      return b.Ta(d);
    };
    t = S.prototype;
    t.i = function (a) {
      return this.xb.j[a];
    };
    t.gd = function (a, b) {
      this.xb.fd(a, b);
    };
    t.K = function (a, b, c) {
      this.xb.fd(a, new H(b, c));
    };
    t.Tz = function (a, b) {
      this.xb.Lb(a, b);
    };
    t.m = function (a, b, c) {
      this.xb.Lb(a, new H(b, c));
    };
    t.ye = function (a) {
      this.xb.add(a);
    };
    t.nf = function (a, b) {
      this.xb.add(new H(a, b));
    };
    t.$v = function (a) {
      this.xb.mb(a);
    };
    t.$j = function () {
      this.xb.clear();
    };
    function qf(a, b, c) {
      if (0 !== b || 0 !== c) {
        for (var d = a.yc, e = new E(), f = a.xb.iterator; f.next(); ) {
          var g = f.value;
          e.add(new H(g.x + b, g.y + c).freeze());
        }
        e.freeze();
        f = a.xb;
        a.xb = e;
        isNaN(b) || isNaN(c) || a.diagram.animationManager.jc
          ? a.o()
          : (a.bg.h(a.bg.x + b, a.bg.y + c),
            a.ma.h(a.ma.x + b, a.ma.y + c),
            Bl(a));
        d && kp(a);
        b = a.diagram;
        null !== b && b.animationManager.jc && (a.ph = e);
        a.g('points', f, e);
      }
    }
    t.Oh = function () {
      null === this.kh && ((this.kh = this.xb), (this.xb = this.xb.copy()));
    };
    t.pf = function () {
      if (null !== this.kh) {
        for (
          var a = this.kh,
            b = this.xb,
            c = Infinity,
            d = Infinity,
            e = a.j,
            f = e.length,
            g = 0;
          g < f;
          g++
        ) {
          var h = e[g];
          c = Math.min(h.x, c);
          d = Math.min(h.y, d);
        }
        h = g = Infinity;
        for (var k = b.j, l = k.length, m = 0; m < l; m++) {
          var n = k[m];
          g = Math.min(n.x, g);
          h = Math.min(n.y, h);
          n.freeze();
        }
        b.freeze();
        if (l === f)
          for (f = 0; f < l; f++) {
            if (
              ((m = e[f]), (n = k[f]), m.x - c !== n.x - g || m.y - d !== n.y - h)
            ) {
              this.o();
              this.cc();
              break;
            }
          }
        else this.o(), this.cc();
        this.kh = null;
        c = this.diagram;
        null !== c && c.animationManager.jc && (this.ph = b);
        kp(this);
        this.g('points', a, b);
      }
    };
    t.gy = function () {
      null !== this.kh && ((this.xb = this.kh), (this.kh = null));
    };
    function kp(a) {
      0 === a.xb.count
        ? (a.yc = !1)
        : ((a.yc = !0),
          (a.Gr = null),
          (a.qu = NaN),
          (a.defaultFromPoint = a.i(0)),
          (a.defaultToPoint = a.i(a.pointsCount - 1)),
          lp(a, !1));
    }
    t.Oa = function () {
      if (!this.suspendsRouting) {
        var a = this.diagram;
        if (a) {
          if (a.yt.contains(this) || a.undoManager.isUndoingRedoing) return;
          a = a.animationManager;
          if (a.isTicking && !a.isAnimating) return;
          null !== this.ph && !a.isTicking && a.isAnimating && (this.ph = null);
        }
        a = this.path;
        null !== a && ((this.yc = !1), this.o(), a.o());
      }
    };
    t.gj = function () {
      if (!this.yc && !this.lv) {
        var a = !0;
        try {
          (this.lv = !0), this.Oh(), (a = this.computePoints());
        } finally {
          (this.lv = !1), a ? this.pf() : this.gy();
        }
      }
    };
    S.prototype.computePoints = function () {
      var a = this.diagram;
      if (null === a) return !1;
      var b = this.fromNode,
        c = null;
      null === b
        ? (a.nh ||
            ((a.Hl = new W()),
            (a.Hl.desiredSize = Kb),
            (a.Hl.strokeWidth = 0),
            (a.nh = new U()),
            a.nh.add(a.Hl),
            a.nh.zb()),
          this.defaultFromPoint &&
            ((a.nh.position = a.nh.location = this.defaultFromPoint),
            a.nh.zb(),
            (b = a.nh),
            (c = a.Hl)))
        : (c = this.fromPort);
      if (null !== c && !b.isVisible()) {
        var d = b.findVisibleNode();
        null !== d && d !== b ? ((b = d), (c = d.port)) : (b = d);
      }
      this.nx = b;
      if (null === b || !b.location.u()) return !1;
      for (; !(null === c || (c.actualBounds.u() && c.yf())); ) c = c.panel;
      if (null === c) return !1;
      var e = this.toNode,
        f = null;
      null === e
        ? (a.oh ||
            ((a.Il = new W()),
            (a.Il.desiredSize = Kb),
            (a.Il.strokeWidth = 0),
            (a.oh = new U()),
            a.oh.add(a.Il),
            a.oh.zb()),
          this.defaultToPoint &&
            ((a.oh.position = a.oh.location = this.defaultToPoint),
            a.oh.zb(),
            (e = a.oh),
            (f = a.Il)))
        : (f = this.toPort);
      null === f ||
        e.isVisible() ||
        ((a = e.findVisibleNode()),
        null !== a && a !== e ? ((e = a), (f = a.port)) : (e = a));
      this.ox = e;
      if (null === e || !e.location.u()) return !1;
      for (; !(null === f || (f.actualBounds.u() && f.yf())); ) f = f.panel;
      if (null === f) return !1;
      var g = this.pointsCount;
      d = this.computeSpot(!0, c);
      a = this.computeSpot(!1, f);
      var h = mp(d),
        k = mp(a),
        l = c === f && null !== c,
        m = this.isOrthogonal,
        n = this.curve === rg;
      this.Sf = l && !m ? (n = !0) : !1;
      var p = this.computeAdjusting() === cg || l;
      if (!m && !l && h && k) {
        if (
          ((h = !1),
          !p &&
            3 <= g &&
            ((p = this.getLinkPoint(b, c, d, !0, !1, e, f)),
            (k = this.getLinkPoint(e, f, a, !1, !1, b, c)),
            (h = this.adjustPoints(0, p, g - 1, k))) &&
            ((p = this.getLinkPoint(b, c, d, !0, !1, e, f)),
            (k = this.getLinkPoint(e, f, a, !1, !1, b, c)),
            this.adjustPoints(0, p, g - 1, k)),
          !h)
        )
          if ((this.$j(), n)) {
            g = this.getLinkPoint(b, c, d, !0, !1, e, f);
            p = this.getLinkPoint(e, f, a, !1, !1, b, c);
            h = p.x - g.x;
            k = p.y - g.y;
            l = this.computeCurviness();
            n = m = 0;
            var r = g.x + h / 3,
              q = g.y + k / 3,
              u = r,
              v = q;
            J.w(k, 0)
              ? (v = 0 < h ? v - l : v + l)
              : ((m = -h / k),
                (n = Math.sqrt((l * l) / (m * m + 1))),
                0 > l && (n = -n),
                (u = (0 > k ? -1 : 1) * n + r),
                (v = m * (u - r) + q));
            r = g.x + (2 * h) / 3;
            q = g.y + (2 * k) / 3;
            var w = r,
              y = q;
            J.w(k, 0)
              ? (y = 0 < h ? y - l : y + l)
              : ((w = (0 > k ? -1 : 1) * n + r), (y = m * (w - r) + q));
            this.$j();
            this.ye(g);
            this.nf(u, v);
            this.nf(w, y);
            this.ye(p);
            this.gd(0, this.getLinkPoint(b, c, d, !0, !1, e, f));
            this.gd(3, this.getLinkPoint(e, f, a, !1, !1, b, c));
          } else
            (d = this.getLinkPoint(b, c, d, !0, !1, e, f)),
              (a = this.getLinkPoint(e, f, a, !1, !1, b, c)),
              this.hasCurviness()
                ? ((p = a.x - d.x),
                  (e = a.y - d.y),
                  (f = this.computeCurviness()),
                  (b = d.x + p / 2),
                  (c = d.y + e / 2),
                  (g = b),
                  (h = c),
                  J.w(e, 0)
                    ? (h = 0 < p ? h - f : h + f)
                    : ((p = -p / e),
                      (g = Math.sqrt((f * f) / (p * p + 1))),
                      0 > f && (g = -g),
                      (g = (0 > e ? -1 : 1) * g + b),
                      (h = p * (g - b) + c)),
                  this.ye(d),
                  this.nf(g, h))
                : this.ye(d),
              this.ye(a);
      } else {
        n = this.isAvoiding;
        p && ((m && n) || l) && this.$j();
        var z = l ? this.computeCurviness() : 0;
        n = this.getLinkPoint(b, c, d, !0, m, e, f);
        r = u = q = 0;
        if (m || !h || l)
          (v = this.computeEndSegmentLength(b, c, d, !0)),
            (r = this.getLinkDirection(b, c, n, d, !0, m, e, f)),
            l &&
              (h || d.A(a) || (!m && 1 === d.x + a.x && 1 === d.y + a.y)) &&
              ((r -= m ? 90 : 30), 0 > z && (r -= 180)),
            0 > r ? (r += 360) : 360 <= r && (r -= 360),
            l && (v += Math.abs(z) * (m ? 1 : 2)),
            0 === r
              ? (q = v)
              : 90 === r
              ? (u = v)
              : 180 === r
              ? (q = -v)
              : 270 === r
              ? (u = -v)
              : ((q = v * Math.cos((r * Math.PI) / 180)),
                (u = v * Math.sin((r * Math.PI) / 180))),
            d.kc() &&
              l &&
              ((v = c.ga(Ac, H.alloc())),
              (w = H.allocAt(v.x + 1e3 * q, v.y + 1e3 * u)),
              this.getLinkPointFromPoint(b, c, v, w, !0, n),
              H.free(v),
              H.free(w));
        v = this.getLinkPoint(e, f, a, !1, m, b, c);
        var A = (y = w = 0);
        if (m || !k || l) {
          var C = this.computeEndSegmentLength(e, f, a, !1);
          A = this.getLinkDirection(e, f, v, a, !1, m, b, c);
          l &&
            (k || d.A(a) || (!m && 1 === d.x + a.x && 1 === d.y + a.y)) &&
            ((A += m ? 0 : 30), 0 > z && (A += 180));
          0 > A ? (A += 360) : 360 <= A && (A -= 360);
          l && (C += Math.abs(z) * (m ? 1 : 2));
          0 === A
            ? (w = C)
            : 90 === A
            ? (y = C)
            : 180 === A
            ? (w = -C)
            : 270 === A
            ? (y = -C)
            : ((w = C * Math.cos((A * Math.PI) / 180)),
              (y = C * Math.sin((A * Math.PI) / 180)));
          a.kc() &&
            l &&
            ((a = f.ga(Ac, H.alloc())),
            (d = H.allocAt(a.x + 1e3 * w, a.y + 1e3 * y)),
            this.getLinkPointFromPoint(e, f, a, d, !1, v),
            H.free(a),
            H.free(d));
        }
        a = n;
        if (m || !h || l) a = new H(n.x + q, n.y + u);
        d = v;
        if (m || !k || l) d = new H(v.x + w, v.y + y);
        !p && !m && h && 3 < g && this.adjustPoints(0, n, g - 2, d)
          ? this.gd(g - 1, v)
          : !p && !m && k && 3 < g && this.adjustPoints(1, a, g - 1, v)
          ? this.gd(0, n)
          : !p && (m ? 6 <= g : 4 < g) && this.adjustPoints(1, a, g - 2, d)
          ? (this.gd(0, n), this.gd(g - 1, v))
          : (this.$j(),
            this.ye(n),
            (m || !h || l) && this.ye(a),
            m && this.addOrthoPoints(a, r, d, A, b, e),
            (m || !k || l) && this.ye(d),
            this.ye(v));
      }
      return !0;
    };
    function np(a, b) {
      Math.abs(b.x - a.x) > Math.abs(b.y - a.y)
        ? (b.x >= a.x ? (b.x = a.x + 9e9) : (b.x = a.x - 9e9), (b.y = a.y))
        : (b.y >= a.y ? (b.y = a.y + 9e9) : (b.y = a.y - 9e9), (b.x = a.x));
      return b;
    }
    S.prototype.getLinkPointFromPoint = function (a, b, c, d, e, f) {
      void 0 === f && (f = new H());
      if (null === a || null === b) return f.assign(c), f;
      a.isVisible() ||
        ((e = a.findVisibleNode()), null !== e && e !== a && (b = e.port));
      a = null;
      e = b.panel;
      null === e || e.ae() || (e = e.panel);
      if (null === e) {
        e = d.x;
        d = d.y;
        var g = c.x;
        c = c.y;
      } else {
        a = e.sd;
        e = 1 / (a.m11 * a.m22 - a.m12 * a.m21);
        g = a.m22 * e;
        var h = -a.m12 * e,
          k = -a.m21 * e,
          l = a.m11 * e,
          m = e * (a.m21 * a.dy - a.m22 * a.dx),
          n = e * (a.m12 * a.dx - a.m11 * a.dy);
        e = d.x * g + d.y * k + m;
        d = d.x * h + d.y * l + n;
        g = c.x * g + c.y * k + m;
        c = c.x * h + c.y * l + n;
      }
      b.ik(e, d, g, c, f);
      null !== a && f.transform(a);
      return f;
    };
    function op(a, b) {
      var c = b.cp;
      null === c && ((c = new pp()), (c.port = b), (c.node = b.part), (b.cp = c));
      return qp(c, a);
    }
    S.prototype.getLinkPoint = function (a, b, c, d, e, f, g, h) {
      void 0 === h && (h = new H());
      if (c.cb() && !mp(c)) return b.ga(c, h), h;
      if (c.xf()) {
        var k = op(this, b);
        if (null !== k) {
          h.assign(k.vq);
          if (e && this.routing === rp) {
            var l = op(this, g);
            if (null !== l && k.fm < l.fm) {
              k = H.alloc();
              l = H.alloc();
              var m = new N(b.ga(vc, k), b.ga(Gc, l)),
                n = this.computeSpot(!d, g);
              a = this.getLinkPoint(f, g, n, !d, e, a, b, l);
              (c.vf(Ic) || c.vf(Jc)) && a.y >= m.y && a.y <= m.y + m.height
                ? (h.y = a.y)
                : (c.vf(Hc) || c.vf(Kc)) &&
                  a.x >= m.x &&
                  a.x <= m.x + m.width &&
                  (h.x = a.x);
              H.free(k);
              H.free(l);
            }
          }
          return h;
        }
      }
      c = b.ga(0.5 === c.x && 0.5 === c.y ? c : Ac, H.alloc());
      this.pointsCount > (e ? 6 : 2)
        ? ((g = d ? this.i(1) : this.i(this.pointsCount - 2)),
          e && (g = np(c, g.copy())))
        : ((k = this.computeSpot(!d, g)),
          (f = H.alloc()),
          (g = g.ga(0.5 === k.x && 0.5 === k.y ? k : Ac, f)),
          e && (g = np(c, g)),
          H.free(f));
      this.getLinkPointFromPoint(a, b, c, g, d, h);
      H.free(c);
      return h;
    };
    S.prototype.getLinkDirection = function (a, b, c, d, e, f, g, h) {
      a: if (d.cb())
        var k =
          d.x > d.y
            ? d.x > 1 - d.y
              ? 0
              : d.x < 1 - d.y
              ? 270
              : 315
            : d.x < d.y
            ? d.x > 1 - d.y
              ? 90
              : d.x < 1 - d.y
              ? 180
              : 135
            : 0.5 > d.x
            ? 225
            : 0.5 < d.x
            ? 45
            : 0;
      else {
        if (d.xf() && ((k = op(this, b)), null !== k))
          switch (k.xc) {
            case 1:
              k = 270;
              break a;
            case 2:
              k = 180;
              break a;
            default:
            case 4:
              k = 0;
              break a;
            case 8:
              k = 90;
              break a;
          }
        k = b.ga(Ac, H.alloc());
        this.pointsCount > (f ? 6 : 2)
          ? ((h = e ? this.i(1) : this.i(this.pointsCount - 2)),
            (h = f ? np(k, h.copy()) : c))
          : ((c = H.alloc()), (h = h.ga(Ac, c)), H.free(c));
        c =
          Math.abs(h.x - k.x) > Math.abs(h.y - k.y)
            ? h.x >= k.x
              ? 0
              : 180
            : h.y >= k.y
            ? 90
            : 270;
        H.free(k);
        k = c;
      }
      d.kc() && g.Xd(a) && ((k += 180), 360 <= k && (k -= 360));
      if (mp(d)) return k;
      a = b.Wi();
      if (0 === a) return k;
      45 <= a && 135 > a
        ? (k += 90)
        : 135 <= a && 225 > a
        ? (k += 180)
        : 225 <= a && 315 > a && (k += 270);
      360 <= k && (k -= 360);
      return k;
    };
    S.prototype.computeEndSegmentLength = function (a, b, c, d) {
      if (null !== b && c.xf() && ((a = op(this, b)), null !== a)) return a.qv;
      a = d ? this.fromEndSegmentLength : this.toEndSegmentLength;
      null !== b &&
        isNaN(a) &&
        (a = d ? b.fromEndSegmentLength : b.toEndSegmentLength);
      isNaN(a) && (a = 10);
      return a;
    };
    S.prototype.computeSpot = function (a, b) {
      void 0 === b && (b = null);
      a
        ? ((a = b ? b : this.fromPort),
          null === a
            ? (a = Ac)
            : ((b = this.fromSpot),
              b.Nb() && (b = a.fromSpot),
              (a = b === Zc ? uc : b)))
        : ((a = b ? b : this.toPort),
          null === a
            ? (a = Ac)
            : ((b = this.toSpot),
              b.Nb() && (b = a.toSpot),
              (a = b === Zc ? uc : b)));
      return a;
    };
    function mp(a) {
      return a === uc || (0.5 === a.x && 0.5 === a.y);
    }
    S.prototype.computeOtherPoint = function (a, b) {
      if (this.computeAdjusting() !== cg && 4 < this.pointsCount)
        return this.computeMidPoint(new H());
      a = b.ga(Ac);
      b = b.cp;
      b = null !== b ? qp(b, this) : null;
      null !== b && (a = b.vq);
      return a;
    };
    S.prototype.computeShortLength = function (a) {
      if (a) {
        a = this.fromShortLength;
        if (isNaN(a)) {
          var b = this.fromPort;
          null !== b && (a = b.fromShortLength);
        }
        return isNaN(a) ? 0 : a;
      }
      a = this.toShortLength;
      isNaN(a) && ((b = this.toPort), null !== b && (a = b.toShortLength));
      return isNaN(a) ? 0 : a;
    };
    S.prototype.sf = function (a, b, c, d, e, f) {
      if (!1 === this.pickable) return !1;
      void 0 === b && (b = null);
      void 0 === c && (c = null);
      var g = f;
      void 0 === f && ((g = rd.alloc()), g.reset());
      g.multiply(this.transform);
      if (this.Hh(a, g)) return cn(this, b, c, e), void 0 === f && rd.free(g), !0;
      if (this.Fc(a, g)) {
        var h = !1;
        if (!this.isAtomic)
          for (var k = this.W.j, l = k.length; l--; ) {
            var m = k[l];
            if (m.visible || m === this.locationObject) {
              var n = m.actualBounds,
                p = this.naturalBounds;
              if (
                !(
                  n.x > p.width ||
                  n.y > p.height ||
                  0 > n.x + n.width ||
                  0 > n.y + n.height
                )
              ) {
                n = rd.alloc();
                n.set(g);
                if (m instanceof X) h = m.sf(a, b, c, d, e, n);
                else if (this.path === m) {
                  if (m instanceof W)
                    if (((h = a), (p = d), !1 === m.pickable)) h = !1;
                    else if ((n.multiply(m.transform), p))
                      b: {
                        var r = h,
                          q = n;
                        if (m.Hh(r, q)) h = !0;
                        else {
                          if (
                            void 0 === q &&
                            ((q = m.transform), r.qf(m.actualBounds))
                          ) {
                            h = !0;
                            break b;
                          }
                          h = r.left;
                          p = r.right;
                          var u = r.top;
                          r = r.bottom;
                          var v = H.alloc(),
                            w = H.alloc(),
                            y = H.alloc(),
                            z = rd.alloc();
                          z.set(q);
                          z.Ov(m.transform);
                          z.tt();
                          w.x = p;
                          w.y = u;
                          w.transform(z);
                          v.x = h;
                          v.y = u;
                          v.transform(z);
                          q = !1;
                          Fn(m, v, w, y)
                            ? (q = !0)
                            : ((v.x = p),
                              (v.y = r),
                              v.transform(z),
                              Fn(m, v, w, y)
                                ? (q = !0)
                                : ((w.x = h),
                                  (w.y = r),
                                  w.transform(z),
                                  Fn(m, v, w, y)
                                    ? (q = !0)
                                    : ((v.x = h),
                                      (v.y = u),
                                      v.transform(z),
                                      Fn(m, v, w, y) && (q = !0))));
                          rd.free(z);
                          H.free(v);
                          H.free(w);
                          H.free(y);
                          h = q;
                        }
                      }
                    else h = m.Hh(h, n);
                } else h = il(m, a, d, n);
                h &&
                  ((p = m),
                  null !== b && (p = b(m)),
                  p && (null === c || c(p)) && e.add(p));
                rd.free(n);
              }
            }
          }
        void 0 === f && rd.free(g);
        return h || null !== this.background || null !== this.areaBackground;
      }
      void 0 === f && rd.free(g);
      return !1;
    };
    S.prototype.computeCurve = function () {
      if (null === this.Sf) {
        var a = this.fromPort,
          b = this.isOrthogonal;
        this.Sf = null !== a && a === this.toPort && !b;
      }
      return this.Sf ? rg : this.curve;
    };
    S.prototype.computeCorner = function () {
      if (this.curve === rg) return 0;
      var a = this.corner;
      if (isNaN(a) || 0 > a) a = 10;
      return a;
    };
    S.prototype.findMidLabel = function () {
      for (var a = this.path, b = this.W.j, c = b.length, d = 0; d < c; d++) {
        var e = b[d];
        if (
          e !== a &&
          !e.isPanelMain &&
          (-Infinity === e.segmentIndex || isNaN(e.segmentIndex))
        )
          return e;
      }
      for (a = this.labelNodes; a.next(); )
        if (
          ((b = a.value), -Infinity === b.segmentIndex || isNaN(b.segmentIndex))
        )
          return b;
      return null;
    };
    S.prototype.computeSpacing = function () {
      if (!this.isVisible()) return 0;
      var a = Math.max(14, this.computeThickness());
      var b = this.fromPort,
        c = this.toPort;
      if (null !== b && null !== c) {
        var d = this.findMidLabel();
        if (null !== d) {
          var e = d.naturalBounds,
            f = d.margin,
            g = isNaN(e.width) ? 30 : e.width * d.scale + f.left + f.right;
          e = isNaN(e.height) ? 14 : e.height * d.scale + f.top + f.bottom;
          d = d.segmentOrientation;
          d === Hn || d === gp || d === fp
            ? (a = Math.max(a, e))
            : d === Om || d === Pm || d === Mm || d === Nm
            ? (a = Math.max(a, g))
            : ((b = (b.ga(Ac).Ta(c.ga(Ac)) / 180) * Math.PI),
              (a = Math.max(
                a,
                Math.abs(Math.sin(b) * g) + Math.abs(Math.cos(b) * e) + 1,
              )));
          this.curve === rg && (a *= 1.333);
        }
      }
      return a;
    };
    S.prototype.arrangeBundledLinks = function (a, b) {
      if (b)
        for (b = 0; b < a.length; b++) {
          var c = a[b];
          c.computeAdjusting() === cg && c.Oa();
        }
    };
    S.prototype.computeCurviness = function () {
      var a = this.curviness;
      if (isNaN(a)) {
        a = 16;
        var b = this.Jf;
        if (null !== b) {
          for (var c = Ea(), d = 0, e = b.links, f = 0; f < e.length; f++) {
            var g = e[f].computeSpacing();
            c.push(g);
            d += g;
          }
          d = -d / 2;
          for (f = 0; f < e.length; f++) {
            if (e[f] === this) {
              a = d + c[f] / 2;
              break;
            }
            d += c[f];
          }
          b.Bt === this.fromNode && (a = -a);
          Ha(c);
        }
      }
      return a;
    };
    S.prototype.computeThickness = function () {
      if (!this.isVisible()) return 0;
      var a = this.path;
      return null !== a ? Math.max(a.strokeWidth, 1) : 1;
    };
    S.prototype.hasCurviness = function () {
      return !isNaN(this.curviness) || null !== this.Jf;
    };
    S.prototype.adjustPoints = function (a, b, c, d) {
      var e = this.computeAdjusting();
      if (this.isOrthogonal) {
        if (e === dp) return !1;
        e === ep && (e = cp);
      }
      switch (e) {
        case dp:
          var f = this.i(a),
            g = this.i(c);
          if (!f.Ma(b) || !g.Ma(d)) {
            e = f.x;
            f = f.y;
            var h = g.x - e,
              k = g.y - f,
              l = Math.sqrt(h * h + k * k);
            if (!J.$(l, 0)) {
              if (J.$(h, 0)) var m = 0 > k ? -Math.PI / 2 : Math.PI / 2;
              else (m = Math.atan(k / Math.abs(h))), 0 > h && (m = Math.PI - m);
              g = b.x;
              var n = b.y;
              h = d.x - g;
              var p = d.y - n;
              k = Math.sqrt(h * h + p * p);
              J.$(h, 0)
                ? (p = 0 > p ? -Math.PI / 2 : Math.PI / 2)
                : ((p = Math.atan(p / Math.abs(h))), 0 > h && (p = Math.PI - p));
              l = k / l;
              m = p - m;
              this.gd(a, b);
              for (a += 1; a < c; a++)
                (b = this.i(a)),
                  (h = b.x - e),
                  (k = b.y - f),
                  (b = Math.sqrt(h * h + k * k)),
                  J.$(b, 0) ||
                    (J.$(h, 0)
                      ? (k = 0 > k ? -Math.PI / 2 : Math.PI / 2)
                      : ((k = Math.atan(k / Math.abs(h))),
                        0 > h && (k = Math.PI - k)),
                    (h = k + m),
                    (b *= l),
                    this.K(a, g + b * Math.cos(h), n + b * Math.sin(h)));
              this.gd(c, d);
            }
          }
          return !0;
        case ep:
          f = this.i(a);
          n = this.i(c);
          if (!f.Ma(b) || !n.Ma(d)) {
            e = f.x;
            f = f.y;
            g = n.x;
            n = n.y;
            l = (g - e) * (g - e) + (n - f) * (n - f);
            h = b.x;
            m = b.y;
            k = d.x;
            p = d.y;
            var r = 1;
            if (0 !== k - h) {
              var q = (p - m) / (k - h);
              r = Math.sqrt(1 + 1 / (q * q));
            } else q = 9e9;
            this.gd(a, b);
            for (a += 1; a < c; a++) {
              b = this.i(a);
              var u = b.x,
                v = b.y,
                w = 0.5;
              0 !== l && (w = ((e - u) * (e - g) + (f - v) * (f - n)) / l);
              var y = e + w * (g - e),
                z = f + w * (n - f);
              b = Math.sqrt((u - y) * (u - y) + (v - z) * (v - z));
              v < q * (u - y) + z && (b = -b);
              0 < q && (b = -b);
              u = h + w * (k - h);
              w = m + w * (p - m);
              0 !== q
                ? ((b = u + b / r), this.K(a, b, w - (b - u) / q))
                : this.K(a, u, w + b);
            }
            this.gd(c, d);
          }
          return !0;
        case cp:
          a: {
            if (
              this.isOrthogonal &&
              ((e = this.i(a)),
              (f = this.i(a + 1)),
              (g = this.i(a + 2)),
              (h = f.x),
              (m = f.y),
              (n = h),
              (l = m),
              J.w(e.y, f.y)
                ? J.w(f.x, g.x)
                  ? (m = b.y)
                  : J.w(f.y, g.y) && (h = b.x)
                : J.w(e.x, f.x) &&
                  (J.w(f.y, g.y) ? (h = b.x) : J.w(f.x, g.x) && (m = b.y)),
              this.K(a + 1, h, m),
              (e = this.i(c)),
              (f = this.i(c - 1)),
              (g = this.i(c - 2)),
              (h = f.x),
              (m = f.y),
              (k = h),
              (p = m),
              J.w(e.y, f.y)
                ? J.w(f.x, g.x)
                  ? (m = d.y)
                  : J.w(f.y, g.y) && (h = d.x)
                : J.w(e.x, f.x) &&
                  (J.w(f.y, g.y) ? (h = d.x) : J.w(f.x, g.x) && (m = d.y)),
              this.K(c - 1, h, m),
              Pj(this))
            ) {
              this.K(a + 1, n, l);
              this.K(c - 1, k, p);
              c = !1;
              break a;
            }
            this.gd(a, b);
            this.gd(c, d);
            c = !0;
          }
          return c;
        default:
          return !1;
      }
    };
    S.prototype.addOrthoPoints = function (a, b, c, d, e, f) {
      b =
        -45 <= b && 45 > b
          ? 0
          : 45 <= b && 135 > b
          ? 90
          : 135 <= b && 225 > b
          ? 180
          : 270;
      d =
        -45 <= d && 45 > d
          ? 0
          : 45 <= d && 135 > d
          ? 90
          : 135 <= d && 225 > d
          ? 180
          : 270;
      var g = e.actualBounds.copy(),
        h = f.actualBounds.copy();
      if (g.u() && h.u()) {
        g.Tc(8, 8);
        h.Tc(8, 8);
        g.Ge(a);
        h.Ge(c);
        if (0 === b)
          if (
            c.x > a.x ||
            (270 === d && c.y < a.y && h.right > a.x) ||
            (90 === d && c.y > a.y && h.right > a.x)
          ) {
            var k = new H(c.x, a.y);
            var l = new H(c.x, (a.y + c.y) / 2);
            180 === d
              ? ((k.x = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !1)),
                (l.x = k.x),
                (l.y = c.y))
              : (270 === d && c.y < a.y) || (90 === d && c.y > a.y)
              ? ((k.x =
                  a.x < h.left
                    ? this.computeMidOrthoPosition(a.x, a.y, h.left, c.y, !1)
                    : a.x < h.right &&
                      ((270 === d && a.y < h.top) || (90 === d && a.y > h.bottom))
                    ? this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !1)
                    : h.right),
                (l.x = k.x),
                (l.y = c.y))
              : 0 === d &&
                a.x < h.left &&
                a.y > h.top &&
                a.y < h.bottom &&
                ((k.x = a.x),
                (k.y =
                  a.y < c.y ? Math.min(c.y, h.top) : Math.max(c.y, h.bottom)),
                (l.y = k.y));
          } else {
            k = new H(a.x, c.y);
            l = new H((a.x + c.x) / 2, c.y);
            if (
              180 === d ||
              (90 === d && c.y < g.top) ||
              (270 === d && c.y > g.bottom)
            )
              180 === d && (h.aa(a) || g.aa(c))
                ? (k.y = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0))
                : c.y < a.y && (180 === d || 90 === d)
                ? (k.y = this.computeMidOrthoPosition(
                    a.x,
                    g.top,
                    c.x,
                    Math.max(c.y, h.bottom),
                    !0,
                  ))
                : c.y > a.y &&
                  (180 === d || 270 === d) &&
                  (k.y = this.computeMidOrthoPosition(
                    a.x,
                    g.bottom,
                    c.x,
                    Math.min(c.y, h.top),
                    !0,
                  )),
                (l.x = c.x),
                (l.y = k.y);
            if (k.y > g.top && k.y < g.bottom)
              if (
                (c.x >= g.left && c.x <= a.x) ||
                (a.x <= h.right && a.x >= c.x)
              ) {
                if (90 === d || 270 === d)
                  (k = new H(Math.max((a.x + c.x) / 2, a.x), a.y)),
                    (l = new H(k.x, c.y));
              } else
                (k.y =
                  270 === d || ((0 === d || 180 === d) && c.y < a.y)
                    ? Math.min(c.y, 0 === d ? g.top : Math.min(g.top, h.top))
                    : Math.max(
                        c.y,
                        0 === d ? g.bottom : Math.max(g.bottom, h.bottom),
                      )),
                  (l.x = c.x),
                  (l.y = k.y);
          }
        else if (180 === b)
          if (
            c.x < a.x ||
            (270 === d && c.y < a.y && h.left < a.x) ||
            (90 === d && c.y > a.y && h.left < a.x)
          )
            (k = new H(c.x, a.y)),
              (l = new H(c.x, (a.y + c.y) / 2)),
              0 === d
                ? ((k.x = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !1)),
                  (l.x = k.x),
                  (l.y = c.y))
                : (270 === d && c.y < a.y) || (90 === d && c.y > a.y)
                ? ((k.x =
                    a.x > h.right
                      ? this.computeMidOrthoPosition(a.x, a.y, h.right, c.y, !1)
                      : a.x > h.left &&
                        ((270 === d && a.y < h.top) ||
                          (90 === d && a.y > h.bottom))
                      ? this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !1)
                      : h.left),
                  (l.x = k.x),
                  (l.y = c.y))
                : 180 === d &&
                  a.x > h.right &&
                  a.y > h.top &&
                  a.y < h.bottom &&
                  ((k.x = a.x),
                  (k.y =
                    a.y < c.y ? Math.min(c.y, h.top) : Math.max(c.y, h.bottom)),
                  (l.y = k.y));
          else {
            k = new H(a.x, c.y);
            l = new H((a.x + c.x) / 2, c.y);
            if (
              0 === d ||
              (90 === d && c.y < g.top) ||
              (270 === d && c.y > g.bottom)
            )
              0 === d && (h.aa(a) || g.aa(c))
                ? (k.y = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0))
                : c.y < a.y && (0 === d || 90 === d)
                ? (k.y = this.computeMidOrthoPosition(
                    a.x,
                    g.top,
                    c.x,
                    Math.max(c.y, h.bottom),
                    !0,
                  ))
                : c.y > a.y &&
                  (0 === d || 270 === d) &&
                  (k.y = this.computeMidOrthoPosition(
                    a.x,
                    g.bottom,
                    c.x,
                    Math.min(c.y, h.top),
                    !0,
                  )),
                (l.x = c.x),
                (l.y = k.y);
            if (k.y > g.top && k.y < g.bottom)
              if (
                (c.x <= g.right && c.x >= a.x) ||
                (a.x >= h.left && a.x <= c.x)
              ) {
                if (90 === d || 270 === d)
                  (k = new H(Math.min((a.x + c.x) / 2, a.x), a.y)),
                    (l = new H(k.x, c.y));
              } else
                (k.y =
                  270 === d || ((0 === d || 180 === d) && c.y < a.y)
                    ? Math.min(c.y, 180 === d ? g.top : Math.min(g.top, h.top))
                    : Math.max(
                        c.y,
                        180 === d ? g.bottom : Math.max(g.bottom, h.bottom),
                      )),
                  (l.x = c.x),
                  (l.y = k.y);
          }
        else if (90 === b)
          if (
            c.y > a.y ||
            (180 === d && c.x < a.x && h.bottom > a.y) ||
            (0 === d && c.x > a.x && h.bottom > a.y)
          )
            (k = new H(a.x, c.y)),
              (l = new H((a.x + c.x) / 2, c.y)),
              270 === d
                ? ((k.y = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0)),
                  (l.x = c.x),
                  (l.y = k.y))
                : (180 === d && c.x < a.x) || (0 === d && c.x > a.x)
                ? ((k.y =
                    a.y < h.top
                      ? this.computeMidOrthoPosition(a.x, a.y, c.x, h.top, !0)
                      : a.y < h.bottom &&
                        ((180 === d && a.x < h.left) ||
                          (0 === d && a.x > h.right))
                      ? this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0)
                      : h.bottom),
                  (l.x = c.x),
                  (l.y = k.y))
                : 90 === d &&
                  a.y < h.top &&
                  a.x > h.left &&
                  a.x < h.right &&
                  ((k.x =
                    a.x < c.x ? Math.min(c.x, h.left) : Math.max(c.x, h.right)),
                  (k.y = a.y),
                  (l.x = k.x));
          else {
            k = new H(c.x, a.y);
            l = new H(c.x, (a.y + c.y) / 2);
            if (
              270 === d ||
              (0 === d && c.x < g.left) ||
              (180 === d && c.x > g.right)
            )
              270 === d && (h.aa(a) || g.aa(c))
                ? (k.x = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !1))
                : c.x < a.x && (270 === d || 0 === d)
                ? (k.x = this.computeMidOrthoPosition(
                    g.left,
                    a.y,
                    Math.max(c.x, h.right),
                    c.y,
                    !1,
                  ))
                : c.x > a.x &&
                  (270 === d || 180 === d) &&
                  (k.x = this.computeMidOrthoPosition(
                    g.right,
                    a.y,
                    Math.min(c.x, h.left),
                    c.y,
                    !1,
                  )),
                (l.x = k.x),
                (l.y = c.y);
            if (k.x > g.left && k.x < g.right)
              if (
                (c.y >= g.top && c.y <= a.y) ||
                (a.y <= h.bottom && a.y >= c.y)
              ) {
                if (0 === d || 180 === d)
                  (k = new H(a.x, Math.max((a.y + c.y) / 2, a.y))),
                    (l = new H(c.x, k.y));
              } else
                (k.x =
                  180 === d || ((90 === d || 270 === d) && c.x < a.x)
                    ? Math.min(c.x, 90 === d ? g.left : Math.min(g.left, h.left))
                    : Math.max(
                        c.x,
                        90 === d ? g.right : Math.max(g.right, h.right),
                      )),
                  (l.x = k.x),
                  (l.y = c.y);
          }
        else if (
          c.y < a.y ||
          (180 === d && c.x < a.x && h.top < a.y) ||
          (0 === d && c.x > a.x && h.top < a.y)
        )
          (k = new H(a.x, c.y)),
            (l = new H((a.x + c.x) / 2, c.y)),
            90 === d
              ? ((k.y = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0)),
                (l.x = c.x),
                (l.y = k.y))
              : (180 === d && c.x < a.x) || (0 === d && c.x >= a.x)
              ? ((k.y =
                  a.y > h.bottom
                    ? this.computeMidOrthoPosition(a.x, a.y, c.x, h.bottom, !0)
                    : a.y > h.top &&
                      ((180 === d && a.x < h.left) || (0 === d && a.x > h.right))
                    ? this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !0)
                    : h.top),
                (l.x = c.x),
                (l.y = k.y))
              : 270 === d &&
                a.y > h.bottom &&
                a.x > h.left &&
                a.x < h.right &&
                ((k.x =
                  a.x < c.x ? Math.min(c.x, h.left) : Math.max(c.x, h.right)),
                (k.y = a.y),
                (l.x = k.x));
        else {
          k = new H(c.x, a.y);
          l = new H(c.x, (a.y + c.y) / 2);
          if (
            90 === d ||
            (0 === d && c.x < g.left) ||
            (180 === d && c.x > g.right)
          )
            90 === d && (h.aa(a) || g.aa(c))
              ? (k.x = this.computeMidOrthoPosition(a.x, a.y, c.x, c.y, !1))
              : c.x < a.x && (90 === d || 0 === d)
              ? (k.x = this.computeMidOrthoPosition(
                  g.left,
                  a.y,
                  Math.max(c.x, h.right),
                  c.y,
                  !1,
                ))
              : c.x > a.x &&
                (90 === d || 180 === d) &&
                (k.x = this.computeMidOrthoPosition(
                  g.right,
                  a.y,
                  Math.min(c.x, h.left),
                  c.y,
                  !1,
                )),
              (l.x = k.x),
              (l.y = c.y);
          if (k.x > g.left && k.x < g.right)
            if ((c.y <= g.bottom && c.y >= a.y) || (a.y >= h.top && a.y <= c.y)) {
              if (0 === d || 180 === d)
                (k = new H(a.x, Math.min((a.y + c.y) / 2, a.y))),
                  (l = new H(c.x, k.y));
            } else
              (k.x =
                180 === d || ((90 === d || 270 === d) && c.x < a.x)
                  ? Math.min(c.x, 270 === d ? g.left : Math.min(g.left, h.left))
                  : Math.max(
                      c.x,
                      270 === d ? g.right : Math.max(g.right, h.right),
                    )),
                (l.x = k.x),
                (l.y = c.y);
        }
        var m = k,
          n = l,
          p = c;
        if (this.isAvoiding) {
          var r = this.diagram;
          if (
            null === r ||
            !sk(r) ||
            (g.aa(p) && !f.Xd(e)) ||
            (h.aa(a) && !e.Xd(f)) ||
            e === f ||
            this.layer.isTemporary
          )
            b = !1;
          else {
            var q = tk(r, !0, this.containingGroup, null);
            if (
              q.mk(
                Math.min(a.x, m.x),
                Math.min(a.y, m.y),
                Math.abs(a.x - m.x),
                Math.abs(a.y - m.y),
              ) &&
              q.mk(
                Math.min(m.x, n.x),
                Math.min(m.y, n.y),
                Math.abs(m.x - n.x),
                Math.abs(m.y - n.y),
              ) &&
              q.mk(
                Math.min(n.x, p.x),
                Math.min(n.y, p.y),
                Math.abs(n.x - p.x),
                Math.abs(n.y - p.y),
              )
            )
              b = !1;
            else {
              e = a;
              f = p;
              var u = (c = null);
              if (r.isVirtualized) {
                r = q.bounds.copy();
                r.Tc(-q.em, -q.dm);
                var v = H.alloc();
                sp(q, a.x, a.y) ||
                  (J.Sc(
                    r.x,
                    r.y,
                    r.x + r.width,
                    r.y + r.height,
                    a.x,
                    a.y,
                    m.x,
                    m.y,
                    v,
                  )
                    ? ((c = a = v.copy()), (b = v.Ta(m)))
                    : J.Sc(
                        r.x,
                        r.y,
                        r.x + r.width,
                        r.y + r.height,
                        m.x,
                        m.y,
                        n.x,
                        n.y,
                        v,
                      )
                    ? ((c = a = v.copy()), (b = v.Ta(n)))
                    : J.Sc(
                        r.x,
                        r.y,
                        r.x + r.width,
                        r.y + r.height,
                        n.x,
                        n.y,
                        p.x,
                        p.y,
                        v,
                      ) && ((c = a = v.copy()), (b = v.Ta(p))));
                sp(q, p.x, p.y) ||
                  (J.Sc(
                    r.x,
                    r.y,
                    r.x + r.width,
                    r.y + r.height,
                    p.x,
                    p.y,
                    n.x,
                    n.y,
                    v,
                  )
                    ? ((u = p = v.copy()), (d = n.Ta(v)))
                    : J.Sc(
                        r.x,
                        r.y,
                        r.x + r.width,
                        r.y + r.height,
                        n.x,
                        n.y,
                        m.x,
                        m.y,
                        v,
                      )
                    ? ((u = p = v.copy()), (d = m.Ta(v)))
                    : J.Sc(
                        r.x,
                        r.y,
                        r.x + r.width,
                        r.y + r.height,
                        m.x,
                        m.y,
                        a.x,
                        a.y,
                        v,
                      ) && ((u = p = v.copy()), (d = a.Ta(v))));
                H.free(v);
              }
              g = g.copy().Gc(h);
              h = q.xA;
              g.Tc(q.em * h, q.dm * h);
              tp(q, a, b, p, d, g);
              h = up(q, p.x, p.y);
              !q.abort &&
                h >= vp &&
                (wk(q),
                (h = q.bA),
                g.Tc(q.em * h, q.dm * h),
                tp(q, a, b, p, d, g),
                (h = up(q, p.x, p.y)));
              !q.abort &&
                h >= vp &&
                q.EA &&
                (wk(q), tp(q, a, b, p, d, q.bounds), (h = up(q, p.x, p.y)));
              if (!q.abort && h < vp && up(q, p.x, p.y) !== wp) {
                xp(this, q, p.x, p.y, d, !0);
                g = this.i(2);
                if (4 > this.pointsCount)
                  0 === b || 180 === b
                    ? ((g.x = a.x), (g.y = p.y))
                    : ((g.x = p.x), (g.y = a.y)),
                    this.K(2, g.x, g.y),
                    this.m(3, g.x, g.y);
                else if (((p = this.i(3)), 0 === b || 180 === b))
                  J.w(g.x, p.x)
                    ? ((g = 0 === b ? Math.max(g.x, a.x) : Math.min(g.x, a.x)),
                      this.K(2, g, a.y),
                      this.K(3, g, p.y))
                    : J.w(g.y, p.y)
                    ? (Math.abs(a.y - g.y) <= q.dm / 2 &&
                        (this.K(2, g.x, a.y), this.K(3, p.x, a.y)),
                      this.m(2, g.x, a.y))
                    : this.K(2, a.x, g.y);
                else if (90 === b || 270 === b)
                  J.w(g.y, p.y)
                    ? ((g = 90 === b ? Math.max(g.y, a.y) : Math.min(g.y, a.y)),
                      this.K(2, a.x, g),
                      this.K(3, p.x, g))
                    : J.w(g.x, p.x)
                    ? (Math.abs(a.x - g.x) <= q.em / 2 &&
                        (this.K(2, a.x, g.y), this.K(3, a.x, p.y)),
                      this.m(2, a.x, g.y))
                    : this.K(2, g.x, a.y);
                null !== c &&
                  ((a = this.i(1)),
                  (p = this.i(2)),
                  a.x !== p.x && a.y !== p.y
                    ? 0 === b || 180 === b
                      ? this.m(2, a.x, p.y)
                      : this.m(2, p.x, a.y)
                    : 0 === b || 180 === b
                    ? this.m(2, e.x, c.y)
                    : this.m(2, c.x, e.y));
                null !== u &&
                  (0 === d || 180 === d ? this.nf(f.x, u.y) : this.nf(u.x, f.y));
                b = !0;
              } else b = !1;
            }
          }
        } else b = !1;
        b || (this.ye(k), this.ye(l));
      }
    };
    S.prototype.computeMidOrthoPosition = function (a, b, c, d, e) {
      var f = 0;
      this.hasCurviness() && (f = this.computeCurviness());
      return e ? (b + d) / 2 + f : (a + c) / 2 + f;
    };
    function Pj(a) {
      if (null === a.diagram || !a.isAvoiding || !sk(a.diagram)) return !1;
      var b = a.points.j,
        c = b.length;
      if (4 > c) return !1;
      a = tk(a.diagram, !0, a.containingGroup, null);
      for (var d = 1; d < c - 2; d++) {
        var e = b[d],
          f = b[d + 1];
        if (
          !a.mk(
            Math.min(e.x, f.x),
            Math.min(e.y, f.y),
            Math.abs(e.x - f.x),
            Math.abs(e.y - f.y),
          )
        )
          return !0;
      }
      return !1;
    }
    function xp(a, b, c, d, e, f) {
      var g = b.em,
        h = b.dm,
        k = up(b, c, d),
        l = c,
        m = d;
      for (
        0 === e
          ? (l += g)
          : 90 === e
          ? (m += h)
          : 180 === e
          ? (l -= g)
          : (m -= h);
        k > yp && up(b, l, m) === k - 1;
  
      )
        (c = l),
          (d = m),
          0 === e
            ? (l += g)
            : 90 === e
            ? (m += h)
            : 180 === e
            ? (l -= g)
            : (m -= h),
          --k;
      if (f) {
        if (k > yp)
          if (180 === e || 0 === e) c = Math.floor(c / g) * g + g / 2;
          else if (90 === e || 270 === e) d = Math.floor(d / h) * h + h / 2;
      } else
        (c = Math.floor(c / g) * g + g / 2), (d = Math.floor(d / h) * h + h / 2);
      k > yp &&
        ((f = e),
        (l = c),
        (m = d),
        0 === e
          ? ((f = 90), (m += h))
          : 90 === e
          ? ((f = 180), (l -= g))
          : 180 === e
          ? ((f = 270), (m -= h))
          : 270 === e && ((f = 0), (l += g)),
        up(b, l, m) === k - 1
          ? xp(a, b, l, m, f, !1)
          : ((l = c),
            (m = d),
            0 === e
              ? ((f = 270), (m -= h))
              : 90 === e
              ? ((f = 0), (l += g))
              : 180 === e
              ? ((f = 90), (m += h))
              : 270 === e && ((f = 180), (l -= g)),
            up(b, l, m) === k - 1 && xp(a, b, l, m, f, !1)));
      a.nf(c, d);
    }
    S.prototype.iz = function (a) {
      var b = a.x;
      a = a.y;
      for (
        var c = this.i(0),
          d = this.i(1),
          e = Ab(b, a, c.x, c.y, d.x, d.y),
          f = 0,
          g = 1;
        g < this.pointsCount - 1;
        g++
      ) {
        c = this.i(g + 1);
        var h = Ab(b, a, d.x, d.y, c.x, c.y);
        d = c;
        h < e && ((f = g), (e = h));
      }
      return f;
    };
    S.prototype.cc = function () {
      this.Yn = !0;
    };
    S.prototype.pk = function (a) {
      if (!a) {
        if (!1 === this.yc) return;
        a = this.Ab();
        if (!this.Yn && (null === a || null !== a.geometry)) return;
      }
      this.ka = this.makeGeometry();
      a = this.path;
      if (null !== a) {
        a.ka = this.ka;
        for (var b = this.W.j, c = b.length, d = 0; d < c; d++) {
          var e = b[d];
          e !== a && e.isPanelMain && e instanceof W && (e.ka = this.ka);
        }
      }
    };
    S.prototype.makeGeometry = function () {
      var a = this.ka,
        b = this.pointsCount;
      if (2 > b) return (a.type = wd), (this.Yn = !1), a;
      var c = !1,
        d = this.diagram;
      null !== d &&
        hp(this) &&
        d.Sg.contains(this) &&
        (0 !== this.Gl.width || 0 !== this.Gl.height) &&
        (c = !0);
      var e = this.i(0).copy(),
        f = e.copy();
      d = this.xb.j;
      var g = this.computeCurve();
      if (g === rg && 3 <= b && !J.$(this.smoothness, 0))
        if (3 === b) {
          var h = this.i(1);
          d = Math.min(e.x, h.x);
          var k = Math.min(e.y, h.y);
          h = this.i(2);
          d = Math.min(d, h.x);
          k = Math.min(k, h.y);
        } else {
          if (this.isOrthogonal)
            for (k = 0; k < b; k++)
              (h = d[k]), (f.x = Math.min(h.x, f.x)), (f.y = Math.min(h.y, f.y));
          else
            for (d = 3; d < b; d += 3)
              d + 3 >= b && (d = b - 1),
                (k = this.i(d)),
                (f.x = Math.min(k.x, f.x)),
                (f.y = Math.min(k.y, f.y));
          d = f.x;
          k = f.y;
        }
      else {
        for (k = 0; k < b; k++)
          (h = d[k]), (f.x = Math.min(h.x, f.x)), (f.y = Math.min(h.y, f.y));
        d = f.x;
        k = f.y;
      }
      d -= this.Wu.x;
      k -= this.Wu.y;
      e.x -= d;
      e.y -= k;
      if (2 !== b || hp(this)) {
        a.type = ud;
        h = Jd(a);
        0 !== this.computeShortLength(!0) && (e = zp(this, e, !0, f));
        Kd(h, e.x, e.y, !1);
        if (g === rg && 3 <= b && !J.$(this.smoothness, 0))
          if (3 === b)
            (c = this.i(1)),
              (b = c.x - d),
              (c = c.y - k),
              (e = this.i(2).copy()),
              (e.x -= d),
              (e.y -= k),
              0 !== this.computeShortLength(!1) && (e = zp(this, e, !1, f)),
              Ld(h, b, c, b, c, e.x, e.y);
          else if (this.isOrthogonal) {
            f = new H(d, k);
            e = this.i(1).copy();
            g = new H(d, k);
            b = new H(d, k);
            c = this.i(0);
            for (
              var l, m = this.smoothness / 3, n = 1;
              n < this.pointsCount - 1;
              n++
            ) {
              l = this.i(n);
              var p = c,
                r = l,
                q = this.i(Ap(this, l, n, !1));
              if (!J.$(p.x, r.x) || !J.$(r.x, q.x))
                if (!J.$(p.y, r.y) || !J.$(r.y, q.y)) {
                  var u = m;
                  isNaN(u) && (u = this.smoothness / 3);
                  var v = p.x;
                  p = p.y;
                  var w = r.x;
                  r = r.y;
                  var y = q.x;
                  q = q.y;
                  var z = u * Bp(v, p, w, r);
                  u *= Bp(w, r, y, q);
                  J.$(p, r) &&
                    J.$(w, y) &&
                    (w > v
                      ? q > r
                        ? ((g.x = w - z),
                          (g.y = r - z),
                          (b.x = w + u),
                          (b.y = r + u))
                        : ((g.x = w - z),
                          (g.y = r + z),
                          (b.x = w + u),
                          (b.y = r - u))
                      : q > r
                      ? ((g.x = w + z),
                        (g.y = r - z),
                        (b.x = w - u),
                        (b.y = r + u))
                      : ((g.x = w + z),
                        (g.y = r + z),
                        (b.x = w - u),
                        (b.y = r - u)));
                  J.$(v, w) &&
                    J.$(r, q) &&
                    (r > p
                      ? (y > w
                          ? ((g.x = w - z), (g.y = r - z), (b.x = w + u))
                          : ((g.x = w + z), (g.y = r - z), (b.x = w - u)),
                        (b.y = r + u))
                      : (y > w
                          ? ((g.x = w - z), (g.y = r + z), (b.x = w + u))
                          : ((g.x = w + z), (g.y = r + z), (b.x = w - u)),
                        (b.y = r - u)));
                  if ((J.$(v, w) && J.$(w, y)) || (J.$(p, r) && J.$(r, q)))
                    (v = 0.5 * (v + y)),
                      (p = 0.5 * (p + q)),
                      (g.x = v),
                      (g.y = p),
                      (b.x = v),
                      (b.y = p);
                  1 === n
                    ? ((e.x = 0.5 * (c.x + l.x)), (e.y = 0.5 * (c.y + l.y)))
                    : 2 === n &&
                      J.$(c.x, this.i(0).x) &&
                      J.$(c.y, this.i(0).y) &&
                      ((e.x = 0.5 * (c.x + l.x)), (e.y = 0.5 * (c.y + l.y)));
                  Ld(h, e.x - d, e.y - k, g.x - d, g.y - k, l.x - d, l.y - k);
                  f.set(g);
                  e.set(b);
                  c = l;
                }
            }
            f = c.x;
            c = c.y;
            e = this.i(this.pointsCount - 1);
            0 !== this.computeShortLength(!1) && (e = zp(this, e.copy(), !1, Fb));
            f = 0.5 * (f + e.x);
            c = 0.5 * (c + e.y);
            Ld(h, b.x - d, b.y - k, f - d, c - k, e.x - d, e.y - k);
          } else
            for (c = 3; c < b; c += 3)
              (f = this.i(c - 2)),
                c + 3 >= b && (c = b - 1),
                (e = this.i(c - 1)),
                (g = this.i(c)),
                c === b - 1 &&
                  0 !== this.computeShortLength(!1) &&
                  (g = zp(this, g.copy(), !1, Fb)),
                Ld(h, f.x - d, f.y - k, e.x - d, e.y - k, g.x - d, g.y - k);
        else {
          f = H.alloc();
          f.assign(this.i(0));
          g = 1;
          for (e = 0; g < b; ) {
            g = Ap(this, f, g, 1 < g);
            m = this.i(g);
            if (g >= b - 1) {
              if (!f.A(m))
                0 !== this.computeShortLength(!1) &&
                  (m = zp(this, m.copy(), !1, Fb)),
                  Cp(this, h, -d, -k, f, m, c);
              else if (0 === e)
                for (g = 1; g < b; )
                  (m = this.i(g++)), Cp(this, h, -d, -k, f, m, c), f.assign(m);
              break;
            }
            e = Ap(this, m, g + 1, g < b - 3);
            g = -d;
            l = -k;
            n = this.i(e);
            v = c;
            J.w(f.y, m.y) && J.w(m.x, n.x)
              ? ((p = this.computeCorner()),
                (p = Math.min(p, Math.abs(m.x - f.x) / 2)),
                (p = u = Math.min(p, Math.abs(n.y - m.y) / 2)),
                J.w(p, 0)
                  ? (Cp(this, h, g, l, f, m, v), f.assign(m))
                  : ((w = m.x),
                    (r = m.y),
                    (y = w),
                    (q = r),
                    m.x > f.x ? (w = m.x - p) : (w = m.x + p),
                    n.y > m.y ? (q = m.y + u) : (q = m.y - u),
                    Cp(this, h, g, l, f, new H(w, r), v),
                    Md(h, m.x + g, m.y + l, y + g, q + l),
                    f.h(y, q)))
              : J.w(f.x, m.x) && J.w(m.y, n.y)
              ? ((p = this.computeCorner()),
                (p = Math.min(p, Math.abs(m.y - f.y) / 2)),
                (p = u = Math.min(p, Math.abs(n.x - m.x) / 2)),
                J.w(u, 0)
                  ? (Cp(this, h, g, l, f, m, v), f.assign(m))
                  : ((w = m.x),
                    (r = m.y),
                    (y = w),
                    (q = r),
                    m.y > f.y ? (r = m.y - p) : (r = m.y + p),
                    n.x > m.x ? (y = m.x + u) : (y = m.x - u),
                    Cp(this, h, g, l, f, new H(w, r), v),
                    Md(h, m.x + g, m.y + l, y + g, q + l),
                    f.h(y, q)))
              : (Cp(this, h, g, l, f, m, v), f.assign(m));
            g = e;
          }
          H.free(f);
        }
        Td = h;
      } else
        (h = this.i(1).copy()),
          (h.x -= d),
          (h.y -= k),
          0 !== this.computeShortLength(!0) && (e = zp(this, e, !0, f)),
          0 !== this.computeShortLength(!1) && (h = zp(this, h, !1, f)),
          (a.type = wd),
          (a.startX = e.x),
          (a.startY = e.y),
          (a.endX = h.x),
          (a.endY = h.y);
      this.Yn = !1;
      return a;
    };
    function Bp(a, b, c, d) {
      a = c - a;
      if (isNaN(a) || Infinity === a || -Infinity === a) return NaN;
      0 > a && (a = -a);
      b = d - b;
      if (isNaN(b) || Infinity === b || -Infinity === b) return NaN;
      0 > b && (b = -b);
      return J.$(a, 0) ? b : J.$(b, 0) ? a : Math.sqrt(a * a + b * b);
    }
    function zp(a, b, c, d) {
      var e = a.pointsCount;
      if (2 > e) return b;
      if (c) {
        var f = a.i(1);
        c = f.x - d.x;
        f = f.y - d.y;
        d = Bp(b.x, b.y, c, f);
        if (0 === d) return b;
        e = 2 === e ? 0.5 * d : d;
        a = a.computeShortLength(!0);
        a > e && (a = e);
        e = (a * (f - b.y)) / d;
        b.x += (a * (c - b.x)) / d;
        b.y += e;
      } else {
        f = a.i(e - 2);
        c = f.x - d.x;
        f = f.y - d.y;
        d = Bp(b.x, b.y, c, f);
        if (0 === d) return b;
        e = 2 === e ? 0.5 * d : d;
        a = a.computeShortLength(!1);
        a > e && (a = e);
        e = (a * (b.y - f)) / d;
        b.x -= (a * (b.x - c)) / d;
        b.y -= e;
      }
      return b;
    }
    function Ap(a, b, c, d) {
      for (var e = a.pointsCount, f = b; J.$(b.x, f.x) && J.$(b.y, f.y); ) {
        if (c >= e) return e - 1;
        f = a.i(c++);
      }
      if (!J.$(b.x, f.x) && !J.$(b.y, f.y)) return c - 1;
      for (
        var g = f;
        (J.$(b.x, f.x) &&
          J.$(f.x, g.x) &&
          (!d || (b.y >= f.y ? f.y >= g.y : f.y <= g.y))) ||
        (J.$(b.y, f.y) &&
          J.$(f.y, g.y) &&
          (!d || (b.x >= f.x ? f.x >= g.x : f.x <= g.x)));
  
      ) {
        if (c >= e) return e - 1;
        g = a.i(c++);
      }
      return c - 2;
    }
    function Cp(a, b, c, d, e, f, g) {
      if (!g && hp(a)) {
        g = [];
        var h = 0;
        a.isVisible() && (h = Dp(a, e, f, g));
        if (0 < h)
          if (J.w(e.y, f.y))
            if (e.x < f.x)
              for (var k = 0; k < h; ) {
                var l = Math.max(e.x, Math.min(g[k++] - 5, f.x - 10));
                b.lineTo(l + c, f.y + d);
                var m = l + c;
                for (var n = Math.min(l + 10, f.x); k < h; )
                  if (((l = g[k]), l < n + 10)) k++, (n = Math.min(l + 5, f.x));
                  else break;
                l = f.y - 10 + d;
                n += c;
                var p = f.y + d;
                a.curve === bg ? Kd(b, n, p, !1) : Ld(b, m, l, n, l, n, p);
              }
            else
              for (--h; 0 <= h; ) {
                k = Math.min(e.x, Math.max(g[h--] + 5, f.x + 10));
                b.lineTo(k + c, f.y + d);
                m = k + c;
                for (l = Math.max(k - 10, f.x); 0 <= h; )
                  if (((k = g[h]), k > l - 10)) h--, (l = Math.max(k - 5, f.x));
                  else break;
                k = f.y - 10 + d;
                l += c;
                n = f.y + d;
                a.curve === bg ? Kd(b, l, n, !1) : Ld(b, m, k, l, k, l, n);
              }
          else if (J.w(e.x, f.x))
            if (e.y < f.y)
              for (k = 0; k < h; ) {
                l = Math.max(e.y, Math.min(g[k++] - 5, f.y - 10));
                b.lineTo(f.x + c, l + d);
                m = l + d;
                for (l = Math.min(l + 10, f.y); k < h; )
                  if (((n = g[k]), n < l + 10)) k++, (l = Math.min(n + 5, f.y));
                  else break;
                n = f.x - 10 + c;
                p = f.x + c;
                l += d;
                a.curve === bg ? Kd(b, p, l, !1) : Ld(b, n, m, n, l, p, l);
              }
            else
              for (--h; 0 <= h; ) {
                k = Math.min(e.y, Math.max(g[h--] + 5, f.y + 10));
                b.lineTo(f.x + c, k + d);
                m = k + d;
                for (k = Math.max(k - 10, f.y); 0 <= h; )
                  if (((l = g[h]), l > k - 10)) h--, (k = Math.max(l - 5, f.y));
                  else break;
                l = f.x - 10 + c;
                n = f.x + c;
                k += d;
                a.curve === bg ? Kd(b, n, k, !1) : Ld(b, l, m, l, k, n, k);
              }
      }
      b.lineTo(f.x + c, f.y + d);
    }
    function Dp(a, b, c, d) {
      var e = a.diagram;
      if (null === e || b.A(c)) return 0;
      for (e = e.layers; e.next(); ) {
        var f = e.value;
        if (null !== f && f.visible) {
          f = f.Ca.j;
          for (var g = f.length, h = 0; h < g; h++) {
            var k = f[h];
            if (k instanceof S) {
              if (k === a)
                return (
                  0 < d.length &&
                    d.sort(function (a, b) {
                      return a - b;
                    }),
                  d.length
                );
              if (k.isVisible() && hp(k)) {
                var l = k.routeBounds;
                l.u() &&
                  a.routeBounds.Fc(l) &&
                  !a.usesSamePort(k) &&
                  ((l = k.path), null !== l && l.yf() && Ep(b, c, d, k));
              }
            }
          }
        }
      }
      0 < d.length &&
        d.sort(function (a, b) {
          return a - b;
        });
      return d.length;
    }
    function Ep(a, b, c, d) {
      for (
        var e = J.w(a.y, b.y),
          f = d.pointsCount,
          g = d.i(0),
          h = H.alloc(),
          k = 1;
        k < f;
        k++
      ) {
        var l = d.i(k);
        if (k < f - 1) {
          var m = d.i(k + 1);
          if (g.y === l.y && l.y === m.y) {
            if ((l.x > g.x && m.x >= l.x) || (l.x < g.x && m.x <= l.x)) continue;
          } else if (
            g.x === l.x &&
            l.x === m.x &&
            ((l.y > g.y && m.y >= l.y) || (l.y < g.y && m.y <= l.y))
          )
            continue;
        }
        a: {
          m = a.x;
          var n = a.y,
            p = b.x,
            r = b.y,
            q = g.x;
          g = g.y;
          var u = l.x,
            v = l.y;
          if (!J.w(m, p)) {
            if (
              J.w(n, r) &&
              J.w(q, u) &&
              Math.min(m, p) < q &&
              Math.max(m, p) > q &&
              Math.min(g, v) < n &&
              Math.max(g, v) > n &&
              !J.w(g, v)
            ) {
              h.x = q;
              h.y = n;
              m = !0;
              break a;
            }
          } else if (
            !J.w(n, r) &&
            J.w(g, v) &&
            Math.min(n, r) < g &&
            Math.max(n, r) > g &&
            Math.min(q, u) < m &&
            Math.max(q, u) > m &&
            !J.w(q, u)
          ) {
            h.x = m;
            h.y = g;
            m = !0;
            break a;
          }
          h.x = 0;
          h.y = 0;
          m = !1;
        }
        m && (e ? c.push(h.x) : c.push(h.y));
        g = l;
      }
      H.free(h);
    }
    function hp(a) {
      a = a.curve;
      return a === ag || a === bg;
    }
    function lp(a, b) {
      if (b || hp(a))
        (b = a.diagram),
          null === b ||
            b.animationManager.isTicking ||
            b.Sg.contains(a) ||
            (0 === a.Gl.width && 0 === a.Gl.height) ||
            b.Sg.add(a, a.Gl.copy());
    }
    S.prototype.sq = function (a) {
      var b = this.layer;
      if (null !== b && b.visible && !b.isTemporary) {
        var c = b.diagram;
        if (null !== c && !c.animationManager.isAnimating) {
          var d = !1;
          for (c = c.layers; c.next(); ) {
            var e = c.value;
            if (e.visible)
              if (e === b) {
                d = !0;
                var f = !1;
                e = e.Ca.j;
                for (var g = e.length, h = 0; h < g; h++) {
                  var k = e[h];
                  k instanceof S && (k === this ? (f = !0) : f && Fp(this, k, a));
                }
              } else if (d)
                for (f = e.Ca.j, e = f.length, g = 0; g < e; g++)
                  (h = f[g]), h instanceof S && Fp(this, h, a);
          }
        }
      }
    };
    function Fp(a, b, c) {
      if (null !== b && null !== b.ka && hp(b)) {
        var d = b.routeBounds;
        d.u() &&
          (a.routeBounds.Fc(d) || c.Fc(d)) &&
          (a.usesSamePort(b) || b.cc());
      }
    }
    S.prototype.usesSamePort = function (a) {
      var b = this.pointsCount,
        c = a.pointsCount;
      if (0 < b && 0 < c) {
        var d = this.i(0),
          e = a.i(0);
        if (d.Ma(e)) return !0;
        b = this.i(b - 1);
        a = a.i(c - 1);
        if (b.Ma(a) || d.Ma(a) || b.Ma(e)) return !0;
      } else if (
        this.fromNode === a.fromNode ||
        this.toNode === a.toNode ||
        this.fromNode === a.toNode ||
        this.toNode === a.fromNode
      )
        return !0;
      return !1;
    };
    S.prototype.isVisible = function () {
      if (!T.prototype.isVisible.call(this)) return !1;
      var a = this.containingGroup,
        b = !0,
        c = this.diagram;
      null !== c && (b = c.isTreePathToChildren);
      c = this.fromNode;
      if (null !== c) {
        if (this.isTreeLink && b && !c.isTreeExpanded) return !1;
        if (c === a) return !0;
        for (var d = c; null !== d; ) {
          if (d.labeledLink === this) return !0;
          d = d.containingGroup;
        }
        c = c.findVisibleNode();
        if (null === c || c === a) return !1;
      }
      c = this.toNode;
      if (null !== c) {
        if (this.isTreeLink && !b && !c.isTreeExpanded) return !1;
        if (c === a) return !0;
        for (b = c; null !== b; ) {
          if (b.labeledLink === this) return !0;
          b = b.containingGroup;
        }
        b = c.findVisibleNode();
        if (null === b || b === a) return !1;
      }
      return !0;
    };
    S.prototype.Ob = function (a) {
      T.prototype.Ob.call(this, a);
      null !== this.Jf && this.Jf.nm();
      if (null !== this.Yc)
        for (var b = this.Yc.iterator; b.next(); ) b.value.Ob(a);
    };
    S.prototype.computeAdjusting = function () {
      return null !== this.diagram && this.diagram.animationManager.isAnimating
        ? cp
        : this.Ek;
    };
    function ip(a) {
      var b = a.Oe;
      if (null !== b) {
        var c = a.jf;
        if (null !== c) {
          for (
            var d = a.Pe,
              e = a.kf,
              f = (a = null),
              g = b.Wa.j,
              h = g.length,
              k = 0;
            k < h;
            k++
          ) {
            var l = g[k];
            if (
              (l.Oe === b && l.Pe === d && l.jf === c && l.kf === e) ||
              (l.Oe === c && l.Pe === e && l.jf === b && l.kf === d)
            )
              null === f
                ? (f = l)
                : (null === a && ((a = []), a.push(f)), a.push(l));
          }
          if (null !== a) {
            f = Oo(b, c, d, e);
            null === f && ((f = new Gp(b, d, c, e)), No(b, f), No(c, f));
            f.links = a;
            for (b = 0; b < a.length; b++) a[b].Jf = f;
            f.nm();
          }
        }
      }
    }
    function jp(a) {
      var b = a.Jf;
      null !== b &&
        ((a.Jf = null),
        (a = b.links.indexOf(a)),
        0 <= a && (Da(b.links, a), b.nm()));
    }
    S.prototype.Lh = function () {
      return !0;
    };
    ma.Object.defineProperties(S.prototype, {
      fromNode: {
        get: function () {
          return this.Oe;
        },
        set: function (a) {
          var b = this.Oe;
          if (b !== a) {
            var c = this.fromPort;
            null !== b && (this.jf !== b && Ro(b, this, c), jp(this), this.C(2));
            this.Oe = a;
            null !== a && this.Ob(a.isVisible());
            this.Sf = null;
            this.Oa();
            var d = this.diagram;
            null !== d && d.Z && d.partManager.setFromNodeForLink(this, a, b);
            var e = this.fromPort,
              f = this.fromPortChanged;
            if (null !== f) {
              var g = !0;
              null !== d && ((g = d.Z), (d.Z = !0));
              f(this, c, e);
              null !== d && (d.Z = g);
            }
            null !== a && (this.jf !== a && Qo(a, this, e), ip(this), this.C(1));
            this.g('fromNode', b, a);
            Lo(this);
          }
        },
      },
      fromPortId: {
        get: function () {
          return this.Pe;
        },
        set: function (a) {
          var b = this.Pe;
          if (b !== a) {
            var c = this.fromPort;
            null !== c && Po(this.fromNode, c);
            jp(this);
            this.Pe = a;
            var d = this.fromPort;
            null !== d && Po(this.fromNode, d);
            var e = this.diagram;
            if (null !== e) {
              var f = this.data,
                g = e.model;
              null !== f && g.pm() && g.ky(f, a);
            }
            c !== d &&
              ((this.Sf = null),
              this.Oa(),
              (f = this.fromPortChanged),
              null !== f &&
                ((g = !0),
                null !== e && ((g = e.Z), (e.Z = !0)),
                f(this, c, d),
                null !== e && (e.Z = g)));
            ip(this);
            this.g('fromPortId', b, a);
          }
        },
      },
      fromPort: {
        get: function () {
          var a = this.Oe;
          return null === a ? null : a.kt(this.Pe);
        },
      },
      fromPortChanged: {
        get: function () {
          return this.Mn;
        },
        set: function (a) {
          var b = this.Mn;
          b !== a && ((this.Mn = a), this.g('fromPortChanged', b, a));
        },
      },
      toNode: {
        get: function () {
          return this.jf;
        },
        set: function (a) {
          var b = this.jf;
          if (b !== a) {
            var c = this.toPort;
            null !== b && (this.Oe !== b && Ro(b, this, c), jp(this), this.C(2));
            this.jf = a;
            null !== a && this.Ob(a.isVisible());
            this.Sf = null;
            this.Oa();
            var d = this.diagram;
            null !== d && d.Z && d.partManager.setToNodeForLink(this, a, b);
            var e = this.toPort,
              f = this.toPortChanged;
            if (null !== f) {
              var g = !0;
              null !== d && ((g = d.Z), (d.Z = !0));
              f(this, c, e);
              null !== d && (d.Z = g);
            }
            null !== a && (this.Oe !== a && Qo(a, this, e), ip(this), this.C(1));
            this.g('toNode', b, a);
            Lo(this);
          }
        },
      },
      toPortId: {
        get: function () {
          return this.kf;
        },
        set: function (a) {
          var b = this.kf;
          if (b !== a) {
            var c = this.toPort;
            null !== c && Po(this.toNode, c);
            jp(this);
            this.kf = a;
            var d = this.toPort;
            null !== d && Po(this.toNode, d);
            var e = this.diagram;
            if (null !== e) {
              var f = this.data,
                g = e.model;
              null !== f && g.pm() && g.oy(f, a);
            }
            c !== d &&
              ((this.Sf = null),
              this.Oa(),
              (f = this.toPortChanged),
              null !== f &&
                ((g = !0),
                null !== e && ((g = e.Z), (e.Z = !0)),
                f(this, c, d),
                null !== e && (e.Z = g)));
            ip(this);
            this.g('toPortId', b, a);
          }
        },
      },
      toPort: {
        get: function () {
          var a = this.jf;
          return null === a ? null : a.kt(this.kf);
        },
      },
      toPortChanged: {
        get: function () {
          return this.Up;
        },
        set: function (a) {
          var b = this.Up;
          b !== a && ((this.Up = a), this.g('toPortChanged', b, a));
        },
      },
      fromSpot: {
        get: function () {
          return null !== this.O ? this.O.Yg : Zc;
        },
        set: function (a) {
          this.Dc();
          var b = this.O.Yg;
          b.A(a) ||
            ((a = a.G()), (this.O.Yg = a), this.g('fromSpot', b, a), this.Oa());
        },
      },
      fromEndSegmentLength: {
        get: function () {
          return null !== this.O ? this.O.Wg : NaN;
        },
        set: function (a) {
          this.Dc();
          var b = this.O.Wg;
          b !== a &&
            (0 > a && va(a, '>= 0', S, 'fromEndSegmentLength'),
            (this.O.Wg = a),
            this.g('fromEndSegmentLength', b, a),
            this.Oa());
        },
      },
      fromShortLength: {
        get: function () {
          return null !== this.O ? this.O.Xg : NaN;
        },
        set: function (a) {
          this.Dc();
          var b = this.O.Xg;
          b !== a &&
            ((this.O.Xg = a),
            this.g('fromShortLength', b, a),
            this.Oa(),
            this.cc());
        },
      },
      toSpot: {
        get: function () {
          return null !== this.O ? this.O.zh : Zc;
        },
        set: function (a) {
          this.Dc();
          var b = this.O.zh;
          b.A(a) ||
            ((a = a.G()), (this.O.zh = a), this.g('toSpot', b, a), this.Oa());
        },
      },
      toEndSegmentLength: {
        get: function () {
          return null !== this.O ? this.O.xh : NaN;
        },
        set: function (a) {
          this.Dc();
          var b = this.O.xh;
          b !== a &&
            (0 > a && va(a, '>= 0', S, 'toEndSegmentLength'),
            (this.O.xh = a),
            this.g('toEndSegmentLength', b, a),
            this.Oa());
        },
      },
      toShortLength: {
        get: function () {
          return null !== this.O ? this.O.yh : NaN;
        },
        set: function (a) {
          this.Dc();
          var b = this.O.yh;
          b !== a &&
            ((this.O.yh = a),
            this.g('toShortLength', b, a),
            this.Oa(),
            this.cc());
        },
      },
      isLabeledLink: {
        get: function () {
          return null === this.Yc ? !1 : 0 < this.Yc.count;
        },
      },
      labelNodes: {
        get: function () {
          return null === this.Yc ? fb : this.Yc.iterator;
        },
      },
      relinkableFrom: {
        get: function () {
          return 0 !== (this.Qa & 1);
        },
        set: function (a) {
          var b = 0 !== (this.Qa & 1);
          b !== a && ((this.Qa ^= 1), this.g('relinkableFrom', b, a), this.Mb());
        },
      },
      relinkableTo: {
        get: function () {
          return 0 !== (this.Qa & 2);
        },
        set: function (a) {
          var b = 0 !== (this.Qa & 2);
          b !== a && ((this.Qa ^= 2), this.g('relinkableTo', b, a), this.Mb());
        },
      },
      resegmentable: {
        get: function () {
          return 0 !== (this.Qa & 4);
        },
        set: function (a) {
          var b = 0 !== (this.Qa & 4);
          b !== a && ((this.Qa ^= 4), this.g('resegmentable', b, a), this.Mb());
        },
      },
      isTreeLink: {
        get: function () {
          return 0 !== (this.Qa & 8);
        },
        set: function (a) {
          var b = 0 !== (this.Qa & 8);
          b !== a &&
            ((this.Qa ^= 8),
            this.g('isTreeLink', b, a),
            null !== this.fromNode && Ek(this.fromNode),
            null !== this.toNode && Ek(this.toNode));
        },
      },
      path: {
        get: function () {
          var a = this.Ab();
          return a instanceof W ? a : null;
        },
      },
      routeBounds: {
        get: function () {
          this.gj();
          var a = this.Gl,
            b = Infinity,
            c = Infinity,
            d = this.pointsCount;
          if (0 === d) a.h(NaN, NaN, 0, 0);
          else {
            if (1 === d)
              (d = this.i(0)),
                (b = Math.min(d.x, b)),
                (c = Math.min(d.y, c)),
                a.h(d.x, d.y, 0, 0);
            else if (2 === d) {
              d = this.i(0);
              var e = this.i(1);
              b = Math.min(d.x, e.x);
              c = Math.min(d.y, e.y);
              a.h(d.x, d.y, 0, 0);
              a.Ge(e);
            } else if (this.computeCurve() === rg && 3 <= d && !this.isOrthogonal)
              if (
                ((e = this.i(0)), (b = e.x), (c = e.y), a.h(b, c, 0, 0), 3 === d)
              ) {
                d = this.i(1);
                b = Math.min(d.x, b);
                c = Math.min(d.y, c);
                var f = this.i(2);
                b = Math.min(f.x, b);
                c = Math.min(f.y, c);
                J.cm(e.x, e.y, d.x, d.y, d.x, d.y, f.x, f.y, 0.5, a);
              } else
                for (f = 3; f < d; f += 3) {
                  var g = this.i(f - 2);
                  f + 3 >= d && (f = d - 1);
                  var h = this.i(f - 1),
                    k = this.i(f);
                  J.cm(e.x, e.y, g.x, g.y, h.x, h.y, k.x, k.y, 0.5, a);
                  b = Math.min(k.x, b);
                  c = Math.min(k.y, c);
                  e = k;
                }
            else
              for (
                e = this.i(0),
                  f = this.i(1),
                  b = Math.min(e.x, f.x),
                  c = Math.min(e.y, f.y),
                  a.h(e.x, e.y, 0, 0),
                  a.Ge(f),
                  e = 2;
                e < d;
                e++
              )
                (f = this.i(e)),
                  (b = Math.min(f.x, b)),
                  (c = Math.min(f.y, c)),
                  a.Ge(f);
            this.Wu.h(b - a.x, c - a.y);
          }
          return a;
        },
      },
      midPoint: {
        get: function () {
          this.gj();
          return this.computeMidPoint(new H());
        },
      },
      midAngle: {
        get: function () {
          this.gj();
          return this.computeMidAngle();
        },
      },
      flattenedLengths: {
        get: function () {
          if (null === this.Gr) {
            this.yc || kp(this);
            for (
              var a = (this.Gr = []), b = this.pointsCount, c = 0;
              c < b - 1;
              c++
            ) {
              var d = this.i(c);
              var e = this.i(c + 1);
              J.$(d.x, e.x)
                ? ((d = e.y - d.y), 0 > d && (d = -d))
                : J.$(d.y, e.y)
                ? ((d = e.x - d.x), 0 > d && (d = -d))
                : (d = Math.sqrt(d.Ae(e)));
              a.push(d);
            }
          }
          return this.Gr;
        },
      },
      flattenedTotalLength: {
        get: function () {
          var a = this.qu;
          if (isNaN(a)) {
            for (
              var b = this.flattenedLengths, c = b.length, d = (a = 0);
              d < c;
              d++
            )
              a += b[d];
            this.qu = a;
          }
          return a;
        },
      },
      points: {
        get: function () {
          return this.xb;
        },
        set: function (a) {
          var b = this.xb;
          if (b !== a) {
            var c = null;
            if (Array.isArray(a)) {
              var d = 0 === a.length % 2;
              if (d)
                for (var e = 0; e < a.length; e++)
                  if ('number' !== typeof a[e] || isNaN(a[e])) {
                    d = !1;
                    break;
                  }
              if (d)
                for (c = new E(), d = 0; d < a.length / 2; d++)
                  (e = new H(a[2 * d], a[2 * d + 1]).freeze()), c.add(e);
              else {
                d = !0;
                for (e = 0; e < a.length; e++) {
                  var f = a[e];
                  if (
                    !za(f) ||
                    'number' !== typeof f.x ||
                    isNaN(f.x) ||
                    'number' !== typeof f.y ||
                    isNaN(f.y)
                  ) {
                    d = !1;
                    break;
                  }
                }
                if (d)
                  for (c = new E(), d = 0; d < a.length; d++)
                    (e = a[d]), c.add(new H(e.x, e.y).freeze());
              }
            } else if (a instanceof E)
              for (c = a.copy(), a = c.iterator; a.next(); ) a.value.freeze();
            else B('Link.points value is not an instance of List or Array: ' + a);
            c.freeze();
            this.xb = c;
            this.cc();
            this.o();
            kp(this);
            a = this.diagram;
            null !== a &&
              (a.lk || a.undoManager.isUndoingRedoing || a.yt.add(this),
              a.animationManager.jc && (this.ph = c));
            this.g('points', b, c);
          }
        },
      },
      pointsCount: {
        get: function () {
          return this.xb.count;
        },
      },
      yc: {
        get: function () {
          return 0 !== (this.Qa & 16);
        },
        set: function (a) {
          (0 !== (this.Qa & 16)) !== a && (this.Qa ^= 16);
        },
      },
      suspendsRouting: {
        get: function () {
          return 0 !== (this.Qa & 32);
        },
        set: function (a) {
          (0 !== (this.Qa & 32)) !== a && (this.Qa ^= 32);
        },
      },
      lv: {
        get: function () {
          return 0 !== (this.Qa & 64);
        },
        set: function (a) {
          (0 !== (this.Qa & 64)) !== a && (this.Qa ^= 64);
        },
      },
      defaultFromPoint: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v = a.copy();
        },
      },
      defaultToPoint: {
        get: function () {
          return this.I;
        },
        set: function (a) {
          this.I = a.copy();
        },
      },
      isOrthogonal: {
        get: function () {
          return 2 === (this.Lj.value & 2);
        },
      },
      isAvoiding: {
        get: function () {
          return 4 === (this.Lj.value & 4);
        },
      },
      geometry: {
        get: function () {
          this.Yn && (this.gj(), (this.ka = this.makeGeometry()));
          return this.ka;
        },
      },
      firstPickIndex: {
        get: function () {
          return 2 >= this.pointsCount
            ? 0
            : this.isOrthogonal || !mp(this.computeSpot(!0))
            ? 1
            : 0;
        },
      },
      lastPickIndex: {
        get: function () {
          var a = this.pointsCount;
          return 0 === a
            ? 0
            : 2 >= a
            ? a - 1
            : this.isOrthogonal || !mp(this.computeSpot(!1))
            ? a - 2
            : a - 1;
        },
      },
      adjusting: {
        get: function () {
          return this.Ek;
        },
        set: function (a) {
          var b = this.Ek;
          b !== a && ((this.Ek = a), this.g('adjusting', b, a));
        },
      },
      corner: {
        get: function () {
          return this.pn;
        },
        set: function (a) {
          var b = this.pn;
          b !== a && ((this.pn = a), this.cc(), this.g('corner', b, a));
        },
      },
      curve: {
        get: function () {
          return this.rn;
        },
        set: function (a) {
          var b = this.rn;
          b !== a &&
            ((this.rn = a),
            this.Oa(),
            this.cc(),
            lp(this, b === bg || b === ag || a === bg || a === ag),
            this.g('curve', b, a));
        },
      },
      curviness: {
        get: function () {
          return this.sn;
        },
        set: function (a) {
          var b = this.sn;
          b !== a &&
            ((this.sn = a), this.Oa(), this.cc(), this.g('curviness', b, a));
        },
      },
      routing: {
        get: function () {
          return this.Lj;
        },
        set: function (a) {
          var b = this.Lj;
          b !== a &&
            ((this.Lj = a),
            (this.Sf = null),
            this.Oa(),
            lp(this, 2 === (b.value & 2) || 2 === (a.value & 2)),
            this.g('routing', b, a));
        },
      },
      smoothness: {
        get: function () {
          return this.Hp;
        },
        set: function (a) {
          var b = this.Hp;
          b !== a && ((this.Hp = a), this.cc(), this.g('smoothness', b, a));
        },
      },
      key: {
        get: function () {
          var a = this.diagram;
          if (null !== a && a.model.pm()) return a.model.Ub(this.data);
        },
      },
    });
    S.prototype.invalidateOtherJumpOvers = S.prototype.sq;
    S.prototype.findClosestSegment = S.prototype.iz;
    S.prototype.updateRoute = S.prototype.gj;
    S.prototype.invalidateRoute = S.prototype.Oa;
    S.prototype.rollbackRoute = S.prototype.gy;
    S.prototype.commitRoute = S.prototype.pf;
    S.prototype.startRoute = S.prototype.Oh;
    S.prototype.clearPoints = S.prototype.$j;
    S.prototype.removePoint = S.prototype.$v;
    S.prototype.addPointAt = S.prototype.nf;
    S.prototype.addPoint = S.prototype.ye;
    S.prototype.insertPointAt = S.prototype.m;
    S.prototype.insertPoint = S.prototype.Tz;
    S.prototype.setPointAt = S.prototype.K;
    S.prototype.setPoint = S.prototype.gd;
    S.prototype.getPoint = S.prototype.i;
    S.prototype.getOtherPort = S.prototype.Hz;
    S.prototype.getOtherNode = S.prototype.ot;
    var bp = new D(S, 'Normal', 1),
      Hp = new D(S, 'Orthogonal', 2),
      Ip = new D(S, 'AvoidsNodes', 6),
      rp = new D(S, 'AvoidsNodesStraight', 7),
      cg = new D(S, 'None', 0),
      rg = new D(S, 'Bezier', 9),
      bg = new D(S, 'JumpGap', 10),
      ag = new D(S, 'JumpOver', 11),
      cp = new D(S, 'End', 17),
      dp = new D(S, 'Scale', 18),
      ep = new D(S, 'Stretch', 19),
      Hn = new D(S, 'OrientAlong', 21),
      Mm = new D(S, 'OrientPlus90', 22),
      Om = new D(S, 'OrientMinus90', 23),
      fp = new D(S, 'OrientOpposite', 24),
      gp = new D(S, 'OrientUpright', 25),
      Nm = new D(S, 'OrientPlus90Upright', 26),
      Pm = new D(S, 'OrientMinus90Upright', 27),
      Qm = new D(S, 'OrientUpright45', 28);
    S.className = 'Link';
    S.Normal = bp;
    S.Orthogonal = Hp;
    S.AvoidsNodes = Ip;
    S.AvoidsNodesStraight = rp;
    S.None = cg;
    S.Bezier = rg;
    S.JumpGap = bg;
    S.JumpOver = ag;
    S.End = cp;
    S.Scale = dp;
    S.Stretch = ep;
    S.OrientAlong = Hn;
    S.OrientPlus90 = Mm;
    S.OrientMinus90 = Om;
    S.OrientOpposite = fp;
    S.OrientUpright = gp;
    S.OrientPlus90Upright = Nm;
    S.OrientMinus90Upright = Pm;
    S.OrientUpright45 = Qm;
    function Gp(a, b, c, d) {
      Za(this);
      this.me = this.Nr = !1;
      this.Bt = a;
      this.$x = b;
      this.Pv = c;
      this.ay = d;
      this.links = [];
    }
    Gp.prototype.nm = function () {
      if (!this.Nr) {
        var a = this.links;
        0 < a.length &&
          ((a = a[0].diagram),
          null !== a &&
            (a.su.add(this), (this.me = a.undoManager.isUndoingRedoing)));
      }
      this.Nr = !0;
    };
    Gp.prototype.xw = function () {
      if (this.Nr) {
        this.Nr = !1;
        var a = this.links;
        if (0 < a.length) {
          var b = a[0],
            c = b.diagram;
          c = null === c || (c.lk && !this.me);
          this.me = !1;
          b.arrangeBundledLinks(a, c);
          1 === a.length && ((b.Jf = null), (a.length = 0));
        }
        0 === a.length &&
          ((a = this.Bt),
          null !== this && null !== a.Ke && a.Ke.remove(this),
          (a = this.Pv),
          null !== this && null !== a.Ke && a.Ke.remove(this));
      }
    };
    Gp.className = 'LinkBundle';
    function uk() {
      Za(this);
      this.py = this.group = null;
      this.st = !0;
      this.abort = !1;
      this.Od = this.Nd = 1;
      this.xo = this.wo = -1;
      this.mc = this.lc = 8;
      this.Cb = [[]];
      this.Sj = this.Rj = 0;
      this.EA = !1;
      this.xA = 22;
      this.bA = 111;
    }
    uk.prototype.initialize = function (a) {
      if (!(0 >= a.width || 0 >= a.height)) {
        var b = a.y,
          c = a.x + a.width,
          d = a.y + a.height;
        this.Nd = Math.floor((a.x - this.lc) / this.lc) * this.lc;
        this.Od = Math.floor((b - this.mc) / this.mc) * this.mc;
        this.wo = Math.ceil((c + 2 * this.lc) / this.lc) * this.lc;
        this.xo = Math.ceil((d + 2 * this.mc) / this.mc) * this.mc;
        a = 1 + (Math.ceil((this.wo - this.Nd) / this.lc) | 0);
        b = 1 + (Math.ceil((this.xo - this.Od) / this.mc) | 0);
        if (null === this.Cb || this.Rj < a - 1 || this.Sj < b - 1) {
          c = [];
          for (d = 0; d <= a; d++) c[d] = [];
          this.Cb = c;
          this.Rj = a - 1;
          this.Sj = b - 1;
        }
        a = Jp;
        if (null !== this.Cb)
          for (b = 0; b <= this.Rj; b++)
            for (c = 0; c <= this.Sj; c++) this.Cb[b][c] = a;
      }
    };
    function sp(a, b, c) {
      return a.Nd <= b && b <= a.wo && a.Od <= c && c <= a.xo;
    }
    function up(a, b, c) {
      if (!sp(a, b, c)) return Jp;
      b -= a.Nd;
      b /= a.lc;
      c -= a.Od;
      c /= a.mc;
      return a.Cb[b | 0][c | 0];
    }
    function xk(a, b, c) {
      sp(a, b, c) &&
        ((b -= a.Nd),
        (b /= a.lc),
        (c -= a.Od),
        (c /= a.mc),
        (a.Cb[b | 0][c | 0] = wp));
    }
    function wk(a) {
      if (null !== a.Cb)
        for (var b = 0; b <= a.Rj; b++)
          for (var c = 0; c <= a.Sj; c++) a.Cb[b][c] >= yp && (a.Cb[b][c] = Jp);
    }
    uk.prototype.mk = function (a, b, c, d) {
      if (a > this.wo || a + c < this.Nd || b > this.xo || b + d < this.Od)
        return !0;
      a = ((a - this.Nd) / this.lc) | 0;
      b = ((b - this.Od) / this.mc) | 0;
      c = (Math.max(0, c) / this.lc + 1) | 0;
      var e = (Math.max(0, d) / this.mc + 1) | 0;
      0 > a && ((c += a), (a = 0));
      0 > b && ((e += b), (b = 0));
      if (0 > c || 0 > e) return !0;
      d = Math.min(a + c - 1, this.Rj) | 0;
      for (c = Math.min(b + e - 1, this.Sj) | 0; a <= d; a++)
        for (e = b; e <= c; e++) if (this.Cb[a][e] === wp) return !1;
      return !0;
    };
    function Kp(a, b, c, d, e, f, g, h, k) {
      if (!(b < f || b > g || c < h || c > k)) {
        var l = b | 0;
        var m = c | 0;
        var n = a.Cb[l][m];
        if (n >= yp && n < vp)
          for (
            e ? (m += d) : (l += d), n += 1;
            f <= l && l <= g && h <= m && m <= k && !(n >= a.Cb[l][m]);
  
          )
            (a.Cb[l][m] = n), (n += 1), e ? (m += d) : (l += d);
        l = e ? m : l;
        if (e)
          if (0 < d)
            for (c += d; c < l; c += d)
              Kp(a, b, c, 1, !e, f, g, h, k), Kp(a, b, c, -1, !e, f, g, h, k);
          else
            for (c += d; c > l; c += d)
              Kp(a, b, c, 1, !e, f, g, h, k), Kp(a, b, c, -1, !e, f, g, h, k);
        else if (0 < d)
          for (b += d; b < l; b += d)
            Kp(a, b, c, 1, !e, f, g, h, k), Kp(a, b, c, -1, !e, f, g, h, k);
        else
          for (b += d; b > l; b += d)
            Kp(a, b, c, 1, !e, f, g, h, k), Kp(a, b, c, -1, !e, f, g, h, k);
      }
    }
    function Lp(a, b, c, d, e, f, g, h, k) {
      b |= 0;
      c |= 0;
      var l = wp,
        m = yp;
      for (a.Cb[b][c] = m; l === wp && b > f && b < g && c > h && c < k; )
        (m += 1), (a.Cb[b][c] = m), e ? (c += d) : (b += d), (l = a.Cb[b][c]);
    }
    function Mp(a, b, c, d, e, f, g, h, k) {
      b |= 0;
      c |= 0;
      var l = wp,
        m = vp;
      for (a.Cb[b][c] = m; l === wp && b > f && b < g && c > h && c < k; )
        (a.Cb[b][c] = m), e ? (c += d) : (b += d), (l = a.Cb[b][c]);
    }
    function tp(a, b, c, d, e, f) {
      if (null !== a.Cb) {
        a.abort = !1;
        var g = b.x,
          h = b.y;
        if (
          sp(a, g, h) &&
          ((g -= a.Nd),
          (g /= a.lc),
          (h -= a.Od),
          (h /= a.mc),
          (b = d.x),
          (d = d.y),
          sp(a, b, d))
        )
          if (
            ((b -= a.Nd),
            (b /= a.lc),
            (d -= a.Od),
            (d /= a.mc),
            1 >= Math.abs(g - b) && 1 >= Math.abs(h - d))
          )
            a.abort = !0;
          else {
            var k = f.x,
              l = f.y,
              m = f.x + f.width,
              n = f.y + f.height;
            k -= a.Nd;
            k /= a.lc;
            l -= a.Od;
            l /= a.mc;
            m -= a.Nd;
            m /= a.lc;
            n -= a.Od;
            n /= a.mc;
            f = Math.max(0, Math.min(a.Rj, k | 0));
            m = Math.min(a.Rj, Math.max(0, m | 0));
            l = Math.max(0, Math.min(a.Sj, l | 0));
            n = Math.min(a.Sj, Math.max(0, n | 0));
            g |= 0;
            h |= 0;
            b |= 0;
            d |= 0;
            k = 0 === c || 90 === c ? 1 : -1;
            c = 90 === c || 270 === c;
            a.Cb[g][h] === wp
              ? (Lp(a, g, h, k, c, f, m, l, n),
                Lp(a, g, h, 1, !c, f, m, l, n),
                Lp(a, g, h, -1, !c, f, m, l, n))
              : Lp(a, g, h, k, c, g, h, g, h);
            a.Cb[b][d] === wp
              ? (Mp(
                  a,
                  b,
                  d,
                  0 === e || 90 === e ? 1 : -1,
                  90 === e || 270 === e,
                  f,
                  m,
                  l,
                  n,
                ),
                Mp(a, b, d, 1, !(90 === e || 270 === e), f, m, l, n),
                Mp(a, b, d, -1, !(90 === e || 270 === e), f, m, l, n))
              : Mp(a, b, d, k, c, b, d, b, d);
            a.abort ||
              (Kp(a, g, h, 1, !1, f, m, l, n),
              Kp(a, g, h, -1, !1, f, m, l, n),
              Kp(a, g, h, 1, !0, f, m, l, n),
              Kp(a, g, h, -1, !0, f, m, l, n));
          }
      }
    }
    ma.Object.defineProperties(uk.prototype, {
      bounds: {
        get: function () {
          return new N(this.Nd, this.Od, this.wo - this.Nd, this.xo - this.Od);
        },
      },
      em: {
        get: function () {
          return this.lc;
        },
        set: function (a) {
          0 < a && a !== this.lc && ((this.lc = a), this.initialize(this.bounds));
        },
      },
      dm: {
        get: function () {
          return this.mc;
        },
        set: function (a) {
          0 < a && a !== this.mc && ((this.mc = a), this.initialize(this.bounds));
        },
      },
    });
    var wp = 0,
      yp = 1,
      vp = 999999,
      Jp = vp + 1;
    uk.className = 'PositionArray';
    function pp() {
      Za(this);
      this.port = this.node = null;
      this.Yd = [];
      this.xq = !1;
    }
    pp.prototype.toString = function () {
      for (
        var a = this.Yd,
          b = this.node.toString() + ' ' + a.length.toString() + ':',
          c = 0;
        c < a.length;
        c++
      ) {
        var d = a[c];
        null !== d && (b += '\n  ' + d.toString());
      }
      return b;
    };
    function Np(a, b, c, d) {
      b = b.offsetY;
      switch (b) {
        case 8:
          return 90;
        case 2:
          return 180;
        case 1:
          return 270;
        case 4:
          return 0;
      }
      switch (b) {
        case 9:
          return 180 < c ? 270 : 90;
        case 6:
          return 90 < c && 270 >= c ? 180 : 0;
      }
      a = (180 * Math.atan2(a.height, a.width)) / Math.PI;
      switch (b) {
        case 3:
          return c > a && c <= 180 + a ? 180 : 270;
        case 5:
          return c > 180 - a && c <= 360 - a ? 270 : 0;
        case 12:
          return c > a && c <= 180 + a ? 90 : 0;
        case 10:
          return c > 180 - a && c <= 360 - a ? 180 : 90;
        case 7:
          return 90 < c && c <= 180 + a
            ? 180
            : c > 180 + a && c <= 360 - a
            ? 270
            : 0;
        case 13:
          return 180 < c && c <= 360 - a ? 270 : c > a && 180 >= c ? 90 : 0;
        case 14:
          return c > a && c <= 180 - a ? 90 : c > 180 - a && 270 >= c ? 180 : 0;
        case 11:
          return c > 180 - a && c <= 180 + a ? 180 : c > 180 + a ? 270 : 90;
      }
      d && 15 !== b && ((c -= 15), 0 > c && (c += 360));
      return c > a && c < 180 - a
        ? 90
        : c >= 180 - a && c <= 180 + a
        ? 180
        : c > 180 + a && c < 360 - a
        ? 270
        : 0;
    }
    pp.prototype.nm = function () {
      this.Yd.length = 0;
    };
    function qp(a, b) {
      var c = a.Yd;
      if (0 === c.length) {
        a: if (!a.xq) {
          c = a.xq;
          a.xq = !0;
          var d = null,
            e = a.node;
          e = e instanceof xf ? e : null;
          if (null === e || e.isSubGraphExpanded)
            var f = a.node.tv(a.port.portId);
          else {
            if (!e.actualBounds.u()) {
              a.xq = c;
              break a;
            }
            d = e;
            f = d.sv();
          }
          var g = (a.Yd.length = 0),
            h = a.port.ga(vc, H.alloc()),
            k = a.port.ga(Gc, H.alloc());
          e = N.allocAt(h.x, h.y, 0, 0);
          e.Ge(k);
          H.free(h);
          H.free(k);
          h = H.allocAt(e.x + e.width / 2, e.y + e.height / 2);
          k = a.port.Wi();
          for (f = f.iterator; f.next(); ) {
            var l = f.value;
            if (l.isVisible() && l.fromPort !== l.toPort) {
              var m =
                  l.fromPort === a.port ||
                  (null !== l.fromNode && l.fromNode.Xd(d)),
                n = l.computeSpot(m, a.port);
              if (n.xf() && ((m = m ? l.toPort : l.fromPort), null !== m)) {
                var p = m.part;
                if (null !== p) {
                  var r = p.findVisibleNode();
                  null !== r && r !== p && ((p = r), (m = p.port));
                  m = l.computeOtherPoint(p, m);
                  p = h.Ta(m);
                  p -= k;
                  0 > p && (p += 360);
                  n = Np(e, n, p, l.isOrthogonal);
                  0 === n
                    ? ((n = 4), 180 < p && (p -= 360))
                    : (n = 90 === n ? 8 : 180 === n ? 2 : 1);
                  r = a.Yd[g];
                  void 0 === r
                    ? ((r = new Op(l, p, n)), (a.Yd[g] = r))
                    : ((r.link = l), (r.angle = p), (r.xc = n));
                  r.Tv.set(m);
                  g++;
                }
              }
            }
          }
          H.free(h);
          a.Yd.sort(pp.prototype.l);
          k = a.Yd.length;
          d = -1;
          for (g = h = 0; g < k; g++)
            (f = a.Yd[g]),
              void 0 !== f &&
                (f.xc !== d && ((d = f.xc), (h = 0)), (f.pq = h), h++);
          d = -1;
          h = 0;
          for (g = k - 1; 0 <= g; g--)
            (k = a.Yd[g]),
              void 0 !== k &&
                (k.xc !== d && ((d = k.xc), (h = k.pq + 1)), (k.fm = h));
          g = a.Yd;
          n = a.port;
          d = a.node.portSpreading;
          h = H.alloc();
          k = H.alloc();
          f = H.alloc();
          l = H.alloc();
          n.ga(vc, h);
          n.ga(yc, k);
          n.ga(Gc, f);
          n.ga(Ec, l);
          r = p = m = n = 0;
          if (d === Zo)
            for (var q = 0; q < g.length; q++) {
              var u = g[q];
              if (null !== u) {
                var v = u.link.computeThickness();
                switch (u.xc) {
                  case 8:
                    p += v;
                    break;
                  case 2:
                    r += v;
                    break;
                  case 1:
                    n += v;
                    break;
                  default:
                  case 4:
                    m += v;
                }
              }
            }
          var w = (q = 0),
            y = 1,
            z = (u = 0);
          for (v = 0; v < g.length; v++) {
            var A = g[v];
            if (null !== A) {
              if (q !== A.xc) {
                q = A.xc;
                switch (q) {
                  case 8:
                    var C = f;
                    w = l;
                    break;
                  case 2:
                    C = l;
                    w = h;
                    break;
                  case 1:
                    C = h;
                    w = k;
                    break;
                  default:
                  case 4:
                    (C = k), (w = f);
                }
                u = w.x - C.x;
                z = w.y - C.y;
                switch (q) {
                  case 8:
                    p > Math.abs(u)
                      ? ((y = Math.abs(u) / p), (p = Math.abs(u)))
                      : (y = 1);
                    break;
                  case 2:
                    r > Math.abs(z)
                      ? ((y = Math.abs(z) / r), (r = Math.abs(z)))
                      : (y = 1);
                    break;
                  case 1:
                    n > Math.abs(u)
                      ? ((y = Math.abs(u) / n), (n = Math.abs(u)))
                      : (y = 1);
                    break;
                  default:
                  case 4:
                    m > Math.abs(z)
                      ? ((y = Math.abs(z) / m), (m = Math.abs(z)))
                      : (y = 1);
                }
                w = 0;
              }
              var I = A.vq;
              if (d === Zo) {
                A = A.link.computeThickness();
                A *= y;
                I.set(C);
                switch (q) {
                  case 8:
                    I.x = C.x + u / 2 + p / 2 - w - A / 2;
                    break;
                  case 2:
                    I.y = C.y + z / 2 + r / 2 - w - A / 2;
                    break;
                  case 1:
                    I.x = C.x + u / 2 - n / 2 + w + A / 2;
                    break;
                  default:
                  case 4:
                    I.y = C.y + z / 2 - m / 2 + w + A / 2;
                }
                w += A;
              } else {
                var P = 0.5;
                d === Mo && (P = (A.pq + 1) / (A.fm + 1));
                I.x = C.x + u * P;
                I.y = C.y + z * P;
              }
            }
          }
          H.free(h);
          H.free(k);
          H.free(f);
          H.free(l);
          C = a.Yd;
          for (g = 0; g < C.length; g++)
            (d = C[g]), null !== d && (d.qv = a.computeEndSegmentLength(d));
          a.xq = c;
          N.free(e);
        }
        c = a.Yd;
      }
      for (a = 0; a < c.length; a++)
        if (((e = c[a]), null !== e && e.link === b)) return e;
      return null;
    }
    pp.prototype.l = function (a, b) {
      return a === b
        ? 0
        : null === a
        ? -1
        : null === b
        ? 1
        : a.xc < b.xc
        ? -1
        : a.xc > b.xc
        ? 1
        : a.angle < b.angle
        ? -1
        : a.angle > b.angle
        ? 1
        : 0;
    };
    pp.prototype.computeEndSegmentLength = function (a) {
      var b = a.link,
        c = b.computeEndSegmentLength(
          this.node,
          this.port,
          uc,
          b.fromPort === this.port,
        ),
        d = a.pq;
      if (0 > d) return c;
      var e = a.fm;
      if (1 >= e || !b.isOrthogonal) return c;
      b = a.Tv;
      var f = a.vq;
      if (2 === a.xc || 8 === a.xc) d = e - 1 - d;
      return ((a = 2 === a.xc || 4 === a.xc) ? b.y < f.y : b.x < f.x)
        ? c + 8 * d
        : (a ? b.y === f.y : b.x === f.x)
        ? c
        : c + 8 * (e - 1 - d);
    };
    pp.className = 'Knot';
    function Op(a, b, c) {
      this.link = a;
      this.angle = b;
      this.xc = c;
      this.Tv = new H();
      this.fm = this.pq = 0;
      this.vq = new H();
      this.qv = 0;
    }
    Op.prototype.toString = function () {
      return (
        this.link.toString() +
        ' ' +
        this.angle.toString() +
        ' ' +
        this.xc.toString() +
        ':' +
        this.pq.toString() +
        '/' +
        this.fm.toString() +
        ' ' +
        this.vq.toString() +
        ' ' +
        this.qv.toString() +
        ' ' +
        this.Tv.toString()
      );
    };
    Op.className = 'LinkInfo';
    function cl() {
      this.zh = this.Yg = Zc;
      this.yh = this.Xg = this.xh = this.Wg = NaN;
      this.Sp = this.Kn = null;
      this.Tp = this.Ln = Infinity;
    }
    cl.prototype.copy = function () {
      var a = new cl();
      a.Yg = this.Yg.G();
      a.zh = this.zh.G();
      a.Wg = this.Wg;
      a.xh = this.xh;
      a.Xg = this.Xg;
      a.yh = this.yh;
      a.Kn = this.Kn;
      a.Sp = this.Sp;
      a.Ln = this.Ln;
      a.Tp = this.Tp;
      return a;
    };
    cl.className = 'LinkSettings';
    function Di() {
      Za(this);
      this.I = this.B = null;
      this.oi = this.ao = !0;
      this.ho = !1;
      this.Xm = new H(0, 0).freeze();
      this.co = !0;
      this.bo = null;
      this.Tw = '';
      this.v = null;
      this.fo = !1;
      this.l = null;
    }
    Di.prototype.cloneProtected = function (a) {
      a.ao = this.ao;
      a.oi = this.oi;
      a.ho = this.ho;
      a.Xm.assign(this.Xm);
      a.co = this.co;
      a.bo = this.bo;
      a.Tw = this.Tw;
      a.fo = !0;
    };
    Di.prototype.copy = function () {
      var a = new this.constructor();
      this.cloneProtected(a);
      return a;
    };
    Di.prototype.bb = function () {};
    Di.prototype.toString = function () {
      var a = Ia(this.constructor);
      a += '(';
      null !== this.group && (a += ' in ' + this.group);
      null !== this.diagram && (a += ' for ' + this.diagram);
      return a + ')';
    };
    Di.prototype.C = function () {
      if (this.isValidLayout) {
        var a = this.diagram;
        if (null !== a && !a.undoManager.isUndoingRedoing) {
          var b = a.animationManager;
          !b.isTicking &&
            (b.defaultAnimation.isAnimating && b.Uc(),
            (this.isOngoing && a.lk) || (this.isInitial && !a.lk)) &&
            ((this.isValidLayout = !1), a.Yb());
        }
      }
    };
    Di.prototype.createNetwork = function () {
      return new Pp(this);
    };
    Di.prototype.makeNetwork = function (a) {
      var b = this.createNetwork();
      a instanceof R
        ? (b.xg(a.nodes, !0), b.xg(a.links, !0))
        : a instanceof xf
        ? b.xg(a.memberParts)
        : b.xg(a.iterator);
      return b;
    };
    Di.prototype.updateParts = function () {
      var a = this.diagram;
      if (null === a && null !== this.network)
        for (var b = this.network.vertexes.iterator; b.next(); ) {
          var c = b.value.node;
          if (null !== c && ((a = c.diagram), null !== a)) break;
        }
      this.isValidLayout = !0;
      try {
        null !== a && a.ta('Layout'), this.commitLayout();
      } finally {
        null !== a && a.Ua('Layout');
      }
    };
    Di.prototype.commitLayout = function () {
      if (null !== this.network) {
        for (var a = this.network.vertexes.iterator; a.next(); ) a.value.commit();
        if (this.isRouting)
          for (a = this.network.edges.iterator; a.next(); ) a.value.commit();
      }
    };
    Di.prototype.doLayout = function (a) {
      var b = new F();
      a instanceof R
        ? (Qp(this, b, a.nodes, !0, this.vk, !0, !1, !0),
          Qp(this, b, a.parts, !0, this.vk, !0, !1, !0))
        : a instanceof xf
        ? Qp(this, b, a.memberParts, !1, this.vk, !0, !1, !0)
        : b.addAll(a.iterator);
      var c = b.count;
      if (0 < c) {
        a = this.diagram;
        null !== a && a.ta('Layout');
        c = Math.ceil(Math.sqrt(c));
        this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin);
        var d = this.arrangementOrigin.x,
          e = d,
          f = this.arrangementOrigin.y,
          g = 0,
          h = 0;
        for (b = b.iterator; b.next(); ) {
          var k = b.value;
          Rp(k);
          var l = k.measuredBounds,
            m = l.width;
          l = l.height;
          k.moveTo(e, f);
          k instanceof xf && (k.vk = !1);
          e += Math.max(m, 50) + 20;
          h = Math.max(h, Math.max(l, 50));
          g >= c - 1 ? ((g = 0), (e = d), (f += h + 20), (h = 0)) : g++;
        }
        null !== a && a.Ua('Layout');
      }
      this.isValidLayout = !0;
    };
    Di.prototype.vk = function (a) {
      return !a.location.u() || (a instanceof xf && a.vk) ? !0 : !1;
    };
    function Qp(a, b, c, d, e, f, g, h) {
      for (c = c.iterator; c.next(); ) {
        var k = c.value;
        (d && !k.isTopLevel) ||
          (null !== e && !e(k)) ||
          !k.canLayout() ||
          (f && k instanceof U
            ? k.isLinkLabel ||
              (k instanceof xf
                ? null === k.layout
                  ? Qp(a, b, k.memberParts, !1, e, f, g, h)
                  : (Rp(k), b.add(k))
                : (Rp(k), b.add(k)))
            : g && k instanceof S
            ? b.add(k)
            : !h || !k.Vb() || k instanceof U || (Rp(k), b.add(k)));
      }
    }
    function Rp(a) {
      var b = a.actualBounds;
      (0 === b.width || 0 === b.height || isNaN(b.width) || isNaN(b.height)) &&
        a.zb();
    }
    Di.prototype.Yi = function (a, b) {
      var c = this.boundsComputation;
      if (null !== c) return b || (b = new N()), c(a, this, b);
      if (!b) return a.actualBounds;
      b.set(a.actualBounds);
      return b;
    };
    Di.prototype.Bx = function (a) {
      var b = new F();
      a instanceof R
        ? (Qp(this, b, a.nodes, !0, null, !0, !0, !0),
          Qp(this, b, a.links, !0, null, !0, !0, !0),
          Qp(this, b, a.parts, !0, null, !0, !0, !0))
        : a instanceof xf
        ? Qp(this, b, a.memberParts, !1, null, !0, !0, !0)
        : Qp(this, b, a.iterator, !1, null, !0, !0, !0);
      return b;
    };
    Di.prototype.initialOrigin = function (a) {
      var b = this.group;
      if (null !== b) {
        var c = b.position.copy();
        (isNaN(c.x) || isNaN(c.y)) && c.set(a);
        b = b.placeholder;
        null !== b &&
          ((c = b.ga(vc)),
          (isNaN(c.x) || isNaN(c.y)) && c.set(a),
          (a = b.padding),
          (c.x += a.left),
          (c.y += a.top));
        return c;
      }
      return a;
    };
    ma.Object.defineProperties(Di.prototype, {
      diagram: {
        get: function () {
          return this.B;
        },
        set: function (a) {
          this.B = a;
        },
      },
      group: {
        get: function () {
          return this.I;
        },
        set: function (a) {
          this.I !== a && ((this.I = a), null !== a && (this.B = a.diagram));
        },
      },
      isOngoing: {
        get: function () {
          return this.ao;
        },
        set: function (a) {
          this.ao !== a && (this.ao = a);
        },
      },
      isInitial: {
        get: function () {
          return this.oi;
        },
        set: function (a) {
          this.oi = a;
          a || (this.fo = !0);
        },
      },
      isViewportSized: {
        get: function () {
          return this.ho;
        },
        set: function (a) {
          this.ho !== a && (this.ho = a) && this.C();
        },
      },
      isRouting: {
        get: function () {
          return this.co;
        },
        set: function (a) {
          this.co !== a && (this.co = a);
        },
      },
      isRealtime: {
        get: function () {
          return this.bo;
        },
        set: function (a) {
          this.bo !== a && (this.bo = a);
        },
      },
      isValidLayout: {
        get: function () {
          return this.fo;
        },
        set: function (a) {
          this.fo !== a &&
            ((this.fo = a), a || ((a = this.diagram), null !== a && (a.Hf = !0)));
        },
      },
      network: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.l !== a && ((this.l = a), null !== a && (a.layout = this));
        },
      },
      boundsComputation: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v !== a && ((this.v = a), this.C());
        },
      },
      arrangementOrigin: {
        get: function () {
          return this.Xm;
        },
        set: function (a) {
          this.Xm.A(a) || (this.Xm.assign(a), this.C());
        },
      },
    });
    Di.prototype.collectParts = Di.prototype.Bx;
    Di.prototype.getLayoutBounds = Di.prototype.Yi;
    Di.prototype.invalidateLayout = Di.prototype.C;
    Di.className = 'Layout';
    function Pp(a) {
      Za(this);
      this.ic = a;
      this.lf = new F();
      this.fe = new F();
      this.Ct = new G();
      this.xt = new G();
    }
    Pp.prototype.clear = function () {
      if (this.lf) for (var a = this.lf.iterator; a.next(); ) a.value.clear();
      if (this.fe) for (a = this.fe.iterator; a.next(); ) a.value.clear();
      this.lf = new F();
      this.fe = new F();
      this.Ct = new G();
      this.xt = new G();
    };
    Pp.prototype.toString = function (a) {
      void 0 === a && (a = 0);
      var b =
        'LayoutNetwork' +
        (null !== this.layout ? '(' + this.layout.toString() + ')' : '');
      if (0 >= a) return b;
      b += ' vertexes: ' + this.lf.count + ' edges: ' + this.fe.count;
      if (1 < a) {
        for (var c = this.lf.iterator; c.next(); )
          b += '\n    ' + c.value.toString(a - 1);
        for (c = this.fe.iterator; c.next(); )
          b += '\n    ' + c.value.toString(a - 1);
      }
      return b;
    };
    Pp.prototype.createVertex = function () {
      return new Sp(this);
    };
    Pp.prototype.createEdge = function () {
      return new Tp(this);
    };
    Pp.prototype.xg = function (a, b, c) {
      if (null !== a) {
        void 0 === b && (b = !1);
        void 0 === c && (c = null);
        null === c &&
          (c = function (a) {
            if (a instanceof U) return !a.isLinkLabel;
            if (a instanceof S) {
              var b = a.fromNode;
              if (null === b || b.isLinkLabel) return !1;
              a = a.toNode;
              return null === a || a.isLinkLabel ? !1 : !0;
            }
            return !1;
          });
        for (a = a.iterator; a.next(); ) {
          var d = a.value;
          if (d instanceof U && (!b || d.isTopLevel) && d.canLayout() && c(d))
            if (d instanceof xf && null === d.layout) this.xg(d.memberParts, !1);
            else if (null === this.Vi(d)) {
              var e = this.createVertex();
              e.node = d;
              this.Fh(e);
            }
        }
        for (a.reset(); a.next(); )
          if (
            ((d = a.value),
            d instanceof S &&
              (!b || d.isTopLevel) &&
              d.canLayout() &&
              c(d) &&
              null === this.jq(d))
          ) {
            var f = d.fromNode;
            e = d.toNode;
            null !== f &&
              null !== e &&
              f !== e &&
              ((f = this.findGroupVertex(f)),
              (e = this.findGroupVertex(e)),
              null !== f && null !== e && this.nk(f, e, d));
          }
      }
    };
    Pp.prototype.findGroupVertex = function (a) {
      if (null === a) return null;
      var b = a.findVisibleNode();
      if (null === b) return null;
      a = this.Vi(b);
      if (null !== a) return a;
      for (b = b.containingGroup; null !== b; ) {
        a = this.Vi(b);
        if (null !== a) return a;
        b = b.containingGroup;
      }
      return null;
    };
    t = Pp.prototype;
    t.Fh = function (a) {
      if (null !== a) {
        this.lf.add(a);
        var b = a.node;
        null !== b && this.Ct.add(b, a);
        a.network = this;
      }
    };
    t.bm = function (a) {
      if (null === a) return null;
      var b = this.Vi(a);
      null === b && ((b = this.createVertex()), (b.node = a), this.Fh(b));
      return b;
    };
    t.pv = function (a) {
      if (null !== a && Up(this, a)) {
        for (var b = a.Gg, c = b.count - 1; 0 <= c; c--) {
          var d = b.L(c);
          this.fk(d);
        }
        b = a.yg;
        for (a = b.count - 1; 0 <= a; a--) (c = b.L(a)), this.fk(c);
      }
    };
    function Up(a, b) {
      if (null === b) return !1;
      var c = a.lf.remove(b);
      c && ((b = b.node), null !== b && a.Ct.remove(b));
      return c;
    }
    t.cz = function (a) {
      null !== a && ((a = this.Vi(a)), null !== a && this.pv(a));
    };
    t.Vi = function (a) {
      return null === a ? null : this.Ct.H(a);
    };
    t.aq = function (a) {
      if (null !== a) {
        Vp(this, a);
        var b = a.toVertex;
        null !== b && b.fv(a);
        b = a.fromVertex;
        null !== b && b.dv(a);
      }
    };
    function Vp(a, b) {
      if (null !== b) {
        a.fe.add(b);
        var c = b.link;
        null !== c && null === a.jq(c) && a.xt.add(c, b);
        b.network = a;
      }
    }
    t.Jy = function (a) {
      if (null === a) return null;
      var b = a.fromNode,
        c = a.toNode,
        d = this.jq(a);
      null === d
        ? ((d = this.createEdge()),
          (d.link = a),
          null !== b && (d.fromVertex = this.bm(b)),
          null !== c && (d.toVertex = this.bm(c)),
          this.aq(d))
        : (null !== b ? (d.fromVertex = this.bm(b)) : (d.fromVertex = null),
          null !== c ? (d.toVertex = this.bm(c)) : (d.toVertex = null));
      return d;
    };
    t.fk = function (a) {
      if (null !== a) {
        var b = a.toVertex;
        null !== b && b.ov(a);
        b = a.fromVertex;
        null !== b && b.nv(a);
        Wp(this, a);
      }
    };
    function Wp(a, b) {
      null !== b &&
        a.fe.remove(b) &&
        ((b = b.link), null !== b && a.xt.remove(b));
    }
    t.bz = function (a) {
      null !== a && ((a = this.jq(a)), null !== a && this.fk(a));
    };
    t.jq = function (a) {
      return null === a ? null : this.xt.H(a);
    };
    t.nk = function (a, b, c) {
      if (null === a || null === b) return null;
      if (a.network === this && b.network === this) {
        var d = this.createEdge();
        d.link = c;
        d.fromVertex = a;
        d.toVertex = b;
        this.aq(d);
        return d;
      }
      return null;
    };
    t.Em = function (a) {
      if (null !== a) {
        var b = a.fromVertex,
          c = a.toVertex;
        null !== b && null !== c && (b.nv(a), c.ov(a), a.Em(), b.fv(a), c.dv(a));
      }
    };
    t.hq = function () {
      for (var a = Ea(), b = this.fe.iterator; b.next(); ) {
        var c = b.value;
        c.fromVertex === c.toVertex && a.push(c);
      }
      b = a.length;
      for (c = 0; c < b; c++) this.fk(a[c]);
      Ha(a);
    };
    Pp.prototype.deleteArtificialVertexes = function () {
      for (var a = Ea(), b = this.lf.iterator; b.next(); ) {
        var c = b.value;
        null === c.node && a.push(c);
      }
      c = a.length;
      for (b = 0; b < c; b++) this.pv(a[b]);
      b = Ea();
      for (c = this.fe.iterator; c.next(); ) {
        var d = c.value;
        null === d.link && b.push(d);
      }
      c = b.length;
      for (d = 0; d < c; d++) this.fk(b[d]);
      Ha(a);
      Ha(b);
    };
    function Xp(a) {
      for (var b = Ea(), c = a.fe.iterator; c.next(); ) {
        var d = c.value;
        (null !== d.fromVertex && null !== d.toVertex) || b.push(d);
      }
      c = b.length;
      for (d = 0; d < c; d++) a.fk(b[d]);
      Ha(b);
    }
    Pp.prototype.qy = function (a) {
      void 0 === a && (a = !0);
      a && (this.deleteArtificialVertexes(), Xp(this), this.hq());
      a = new E();
      for (var b = !0; b; ) {
        b = !1;
        for (var c = this.lf.iterator; c.next(); ) {
          var d = c.value;
          if (0 < d.Gg.count || 0 < d.yg.count) {
            b = this.layout.createNetwork();
            a.add(b);
            Yp(this, b, d);
            b = !0;
            break;
          }
        }
      }
      a.sort(function (a, b) {
        return null === a || null === b || a === b
          ? 0
          : b.vertexes.count - a.vertexes.count;
      });
      return a;
    };
    function Yp(a, b, c) {
      if (null !== c && c.network !== b) {
        Up(a, c);
        b.Fh(c);
        for (var d = c.sourceEdges; d.next(); ) {
          var e = d.value;
          e.network !== b && (Wp(a, e), Vp(b, e), Yp(a, b, e.fromVertex));
        }
        for (d = c.destinationEdges; d.next(); )
          (c = d.value),
            c.network !== b && (Wp(a, c), Vp(b, c), Yp(a, b, c.toVertex));
      }
    }
    Pp.prototype.hz = function () {
      for (var a = new F(), b = this.lf.iterator; b.next(); ) a.add(b.value.node);
      for (b = this.fe.iterator; b.next(); ) a.add(b.value.link);
      return a;
    };
    ma.Object.defineProperties(Pp.prototype, {
      layout: {
        get: function () {
          return this.ic;
        },
        set: function (a) {
          null !== a && (this.ic = a);
        },
      },
      vertexes: {
        get: function () {
          return this.lf;
        },
      },
      edges: {
        get: function () {
          return this.fe;
        },
      },
    });
    Pp.prototype.findAllParts = Pp.prototype.hz;
    Pp.prototype.splitIntoSubNetworks = Pp.prototype.qy;
    Pp.prototype.deleteSelfEdges = Pp.prototype.hq;
    Pp.prototype.reverseEdge = Pp.prototype.Em;
    Pp.prototype.linkVertexes = Pp.prototype.nk;
    Pp.prototype.findEdge = Pp.prototype.jq;
    Pp.prototype.deleteLink = Pp.prototype.bz;
    Pp.prototype.deleteEdge = Pp.prototype.fk;
    Pp.prototype.addLink = Pp.prototype.Jy;
    Pp.prototype.addEdge = Pp.prototype.aq;
    Pp.prototype.findVertex = Pp.prototype.Vi;
    Pp.prototype.deleteNode = Pp.prototype.cz;
    Pp.prototype.deleteVertex = Pp.prototype.pv;
    Pp.prototype.addNode = Pp.prototype.bm;
    Pp.prototype.addVertex = Pp.prototype.Fh;
    Pp.prototype.addParts = Pp.prototype.xg;
    Pp.className = 'LayoutNetwork';
    function Sp(a) {
      Za(this);
      this.be = a;
      this.l = new N(0, 0, 10, 10).freeze();
      this.v = new H(5, 5).freeze();
      this.zi = this.hb = null;
      this.Gg = new E();
      this.yg = new E();
    }
    Sp.prototype.clear = function () {
      this.zi = this.hb = null;
      this.Gg = new E();
      this.yg = new E();
    };
    Sp.prototype.toString = function (a) {
      void 0 === a && (a = 0);
      var b = 'LayoutVertex#' + lb(this);
      if (
        0 < a &&
        ((b += null !== this.node ? '(' + this.node.toString() + ')' : ''), 1 < a)
      ) {
        a = '';
        for (var c = !0, d = this.Gg.iterator; d.next(); ) {
          var e = d.value;
          c ? (c = !1) : (a += ',');
          a += e.toString(0);
        }
        e = '';
        c = !0;
        for (d = this.yg.iterator; d.next(); ) {
          var f = d.value;
          c ? (c = !1) : (e += ',');
          e += f.toString(0);
        }
        b += ' sources: ' + a + ' destinations: ' + e;
      }
      return b;
    };
    Sp.prototype.commit = function () {
      var a = this.hb;
      if (null !== a) {
        var b = this.bounds,
          c = a.bounds;
        za(c)
          ? ((c.x = b.x), (c.y = b.y), (c.width = b.width), (c.height = b.height))
          : (a.bounds = b.copy());
      } else if (((a = this.node), null !== a)) {
        b = this.bounds;
        if (!(a instanceof xf)) {
          c = N.alloc();
          var d = this.network.layout.Yi(a, c),
            e = a.locationObject.ga(Ac);
          if (d.u() && e.u()) {
            a.moveTo(
              b.x + this.focusX - (e.x - d.x),
              b.y + this.focusY - (e.y - d.y),
            );
            N.free(c);
            return;
          }
          N.free(c);
        }
        a.moveTo(b.x, b.y);
      }
    };
    Sp.prototype.fv = function (a) {
      null !== a && (this.Gg.contains(a) || this.Gg.add(a));
    };
    Sp.prototype.ov = function (a) {
      null !== a && this.Gg.remove(a);
    };
    Sp.prototype.dv = function (a) {
      null !== a && (this.yg.contains(a) || this.yg.add(a));
    };
    Sp.prototype.nv = function (a) {
      null !== a && this.yg.remove(a);
    };
    function Zp(a, b) {
      a = a.zi;
      b = b.zi;
      return a
        ? b
          ? ((a = a.text), (b = b.text), a < b ? -1 : a > b ? 1 : 0)
          : 1
        : null !== b
        ? -1
        : 0;
    }
    ma.Object.defineProperties(Sp.prototype, {
      sourceEdgesArrayAccess: {
        get: function () {
          return this.Gg._dataArray;
        },
      },
      destinationEdgesArrayAccess: {
        get: function () {
          return this.yg._dataArray;
        },
      },
      data: {
        get: function () {
          return this.hb;
        },
        set: function (a) {
          this.hb = a;
          if (null !== a) {
            var b = a.bounds;
            a = b.x;
            var c = b.y,
              d = b.width;
            b = b.height;
            this.v.h(d / 2, b / 2);
            this.l.h(a, c, d, b);
          }
        },
      },
      node: {
        get: function () {
          return this.zi;
        },
        set: function (a) {
          if (this.zi !== a) {
            this.zi = a;
            a.zb();
            var b = this.network.layout,
              c = N.alloc(),
              d = b.Yi(a, c);
            b = d.x;
            var e = d.y,
              f = d.width;
            d = d.height;
            isNaN(b) && (b = 0);
            isNaN(e) && (e = 0);
            this.l.h(b, e, f, d);
            N.free(c);
            if (!(a instanceof xf) && ((a = a.locationObject.ga(Ac)), a.u())) {
              this.v.h(a.x - b, a.y - e);
              return;
            }
            this.v.h(f / 2, d / 2);
          }
        },
      },
      bounds: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.l.A(a) || this.l.assign(a);
        },
      },
      focus: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v.A(a) || this.v.assign(a);
        },
      },
      centerX: {
        get: function () {
          return this.l.x + this.v.x;
        },
        set: function (a) {
          var b = this.l;
          b.x + this.v.x !== a && (b.ea(), (b.x = a - this.v.x), b.freeze());
        },
      },
      centerY: {
        get: function () {
          return this.l.y + this.v.y;
        },
        set: function (a) {
          var b = this.l;
          b.y + this.v.y !== a && (b.ea(), (b.y = a - this.v.y), b.freeze());
        },
      },
      focusX: {
        get: function () {
          return this.v.x;
        },
        set: function (a) {
          var b = this.v;
          b.x !== a && (b.ea(), (b.x = a), b.freeze());
        },
      },
      focusY: {
        get: function () {
          return this.v.y;
        },
        set: function (a) {
          var b = this.v;
          b.y !== a && (b.ea(), (b.y = a), b.freeze());
        },
      },
      x: {
        get: function () {
          return this.l.x;
        },
        set: function (a) {
          var b = this.l;
          b.x !== a && (b.ea(), (b.x = a), b.freeze());
        },
      },
      y: {
        get: function () {
          return this.l.y;
        },
        set: function (a) {
          var b = this.l;
          b.y !== a && (b.ea(), (b.y = a), b.freeze());
        },
      },
      width: {
        get: function () {
          return this.l.width;
        },
        set: function (a) {
          var b = this.l;
          b.width !== a && (b.ea(), (b.width = a), b.freeze());
        },
      },
      height: {
        get: function () {
          return this.l.height;
        },
        set: function (a) {
          var b = this.l;
          b.height !== a && (b.ea(), (b.height = a), b.freeze());
        },
      },
      network: {
        get: function () {
          return this.be;
        },
        set: function (a) {
          this.be = a;
        },
      },
      sourceVertexes: {
        get: function () {
          for (var a = new F(), b = this.sourceEdges; b.next(); )
            a.add(b.value.fromVertex);
          return a.iterator;
        },
      },
      destinationVertexes: {
        get: function () {
          for (var a = new F(), b = this.destinationEdges; b.next(); )
            a.add(b.value.toVertex);
          return a.iterator;
        },
      },
      vertexes: {
        get: function () {
          for (var a = new F(), b = this.sourceEdges; b.next(); )
            a.add(b.value.fromVertex);
          for (b = this.destinationEdges; b.next(); ) a.add(b.value.toVertex);
          return a.iterator;
        },
      },
      sourceEdges: {
        get: function () {
          return this.Gg.iterator;
        },
      },
      destinationEdges: {
        get: function () {
          return this.yg.iterator;
        },
      },
      edges: {
        get: function () {
          for (var a = new E(), b = this.sourceEdges; b.next(); ) a.add(b.value);
          for (b = this.destinationEdges; b.next(); ) a.add(b.value);
          return a.iterator;
        },
      },
      edgesCount: {
        get: function () {
          return this.Gg.count + this.yg.count;
        },
      },
    });
    Sp.prototype.deleteDestinationEdge = Sp.prototype.nv;
    Sp.prototype.addDestinationEdge = Sp.prototype.dv;
    Sp.prototype.deleteSourceEdge = Sp.prototype.ov;
    Sp.prototype.addSourceEdge = Sp.prototype.fv;
    Sp.className = 'LayoutVertex';
    Sp.standardComparer = Zp;
    Sp.smartComparer = function (a, b) {
      if (null !== a) {
        if (null !== b) {
          a = a.zi;
          var c = b.zi;
          if (null !== a) {
            if (null !== c) {
              b = a.text
                .toLocaleLowerCase()
                .split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);
              a = c.text
                .toLocaleLowerCase()
                .split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);
              for (c = 0; c < b.length; c++)
                if ('' !== a[c] && void 0 !== a[c]) {
                  var d = parseFloat(b[c]),
                    e = parseFloat(a[c]);
                  if (isNaN(d))
                    if (isNaN(e)) {
                      if (0 !== b[c].localeCompare(a[c]))
                        return b[c].localeCompare(a[c]);
                    } else return 1;
                  else {
                    if (isNaN(e)) return -1;
                    if (0 !== d - e) return d - e;
                  }
                } else if ('' !== b[c]) return 1;
              return '' !== a[c] && void 0 !== a[c] ? -1 : 0;
            }
            return 1;
          }
          return null !== c ? -1 : 0;
        }
        return 1;
      }
      return null !== b ? -1 : 0;
    };
    function Tp(a) {
      Za(this);
      this.hd = a;
      this.tg = this.Uf = this.vl = this.hb = null;
    }
    Tp.prototype.clear = function () {
      this.tg = this.Uf = this.vl = this.hb = null;
    };
    Tp.prototype.toString = function (a) {
      void 0 === a && (a = 0);
      var b = 'LayoutEdge#' + lb(this);
      0 < a &&
        ((b += null !== this.vl ? '(' + this.vl.toString() + ')' : ''),
        1 < a &&
          (b +=
            ' ' +
            (this.Uf ? this.Uf.toString() : 'null') +
            ' --\x3e ' +
            (this.tg ? this.tg.toString() : 'null')));
      return b;
    };
    Tp.prototype.Em = function () {
      var a = this.Uf;
      this.Uf = this.tg;
      this.tg = a;
    };
    Tp.prototype.commit = function () {};
    Tp.prototype.Sx = function (a) {
      return this.tg === a ? this.Uf : this.Uf === a ? this.tg : null;
    };
    ma.Object.defineProperties(Tp.prototype, {
      network: {
        get: function () {
          return this.hd;
        },
        set: function (a) {
          this.hd = a;
        },
      },
      data: {
        get: function () {
          return this.hb;
        },
        set: function (a) {
          this.hb !== a && (this.hb = a);
        },
      },
      link: {
        get: function () {
          return this.vl;
        },
        set: function (a) {
          this.vl !== a && (this.vl = a);
        },
      },
      fromVertex: {
        get: function () {
          return this.Uf;
        },
        set: function (a) {
          this.Uf !== a && (this.Uf = a);
        },
      },
      toVertex: {
        get: function () {
          return this.tg;
        },
        set: function (a) {
          this.tg !== a && (this.tg = a);
        },
      },
    });
    Tp.prototype.getOtherVertex = Tp.prototype.Sx;
    Tp.className = 'LayoutEdge';
    function Lk() {
      Di.call(this);
      this.isViewportSized = !0;
      this.Yp = this.Zp = NaN;
      this.Ng = new L(NaN, NaN).freeze();
      this.cf = new L(10, 10).freeze();
      this.wb = $p;
      this.Bb = aq;
      this.Oc = bq;
      this.Ic = cq;
    }
    la(Lk, Di);
    Lk.prototype.cloneProtected = function (a) {
      Di.prototype.cloneProtected.call(this, a);
      a.Zp = this.Zp;
      a.Yp = this.Yp;
      a.Ng.assign(this.Ng);
      a.cf.assign(this.cf);
      a.wb = this.wb;
      a.Bb = this.Bb;
      a.Oc = this.Oc;
      a.Ic = this.Ic;
    };
    Lk.prototype.bb = function (a) {
      a.classType === Lk
        ? a === bq || a === dq || a === eq || a === fq
          ? (this.sorting = a)
          : a === aq || a === gq
          ? (this.arrangement = a)
          : a === $p || a === hq
          ? (this.alignment = a)
          : B('Unknown enum value: ' + a)
        : Di.prototype.bb.call(this, a);
    };
    Lk.prototype.doLayout = function (a) {
      this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin);
      var b = this.Bx(a);
      a = this.diagram;
      for (var c = b.copy().iterator; c.next(); ) {
        var d = c.value;
        if (!d.Lh() || (null === d.fromNode && null === d.toNode)) {
          if ((d.zb(), d instanceof xf))
            for (d = d.memberParts; d.next(); ) b.remove(d.value);
        } else b.remove(d);
      }
      var e = b.na();
      if (0 !== e.length) {
        switch (this.sorting) {
          case fq:
            e.reverse();
            break;
          case bq:
            e.sort(this.comparer);
            break;
          case dq:
            e.sort(this.comparer), e.reverse();
        }
        var f = this.wrappingColumn;
        isNaN(f) && (f = 0);
        var g = this.wrappingWidth;
        isNaN(g) && null !== a
          ? ((b = a.padding),
            (g = Math.max(a.viewportBounds.width - b.left - b.right, 0)))
          : (g = Math.max(this.wrappingWidth, 0));
        0 >= f && 0 >= g && (f = 1);
        b = this.spacing.width;
        isFinite(b) || (b = 0);
        c = this.spacing.height;
        isFinite(c) || (c = 0);
        null !== a && a.ta('Layout');
        d = [];
        switch (this.alignment) {
          case hq:
            var h = b,
              k = c,
              l = N.alloc(),
              m = Math.max(this.cellSize.width, 1);
            if (!isFinite(m))
              for (var n = (m = 0); n < e.length; n++) {
                var p = this.Yi(e[n], l);
                m = Math.max(m, p.width);
              }
            m = Math.max(m + h, 1);
            n = Math.max(this.cellSize.height, 1);
            if (!isFinite(n))
              for (p = n = 0; p < e.length; p++) {
                var r = this.Yi(e[p], l);
                n = Math.max(n, r.height);
              }
            n = Math.max(n + k, 1);
            p = this.arrangement;
            for (
              var q = (r = this.arrangementOrigin.x),
                u = this.arrangementOrigin.y,
                v = 0,
                w = 0,
                y = 0;
              y < e.length;
              y++
            ) {
              var z = e[y],
                A = this.Yi(z, l),
                C = Math.ceil((A.width + h) / m) * m,
                I = Math.ceil((A.height + k) / n) * n;
              switch (p) {
                case gq:
                  var P = Math.abs(q - A.width);
                  break;
                default:
                  P = q + A.width;
              }
              if ((0 < f && v > f - 1) || (0 < g && 0 < v && P - r > g))
                d.push(new N(0, u, g + h, w)),
                  (v = 0),
                  (q = r),
                  (u += w),
                  (w = 0);
              w = Math.max(w, I);
              switch (p) {
                case gq:
                  A = -A.width;
                  break;
                default:
                  A = 0;
              }
              z.moveTo(q + A, u);
              switch (p) {
                case gq:
                  q -= C;
                  break;
                default:
                  q += C;
              }
              v++;
            }
            d.push(new N(0, u, g + h, w));
            N.free(l);
            break;
          case $p:
            k = g;
            m = f;
            n = b;
            p = c;
            g = N.alloc();
            r = Math.max(this.cellSize.width, 1);
            f = u = l = 0;
            h = H.alloc();
            for (q = 0; q < e.length; q++)
              (w = e[q]),
                (v = this.Yi(w, g)),
                (w = w.uf(w.locationObject, w.locationSpot, h)),
                (l = Math.max(l, w.x)),
                (u = Math.max(u, v.width - w.x)),
                (f = Math.max(f, w.y));
            q = this.arrangement;
            switch (q) {
              case gq:
                l += n;
                break;
              default:
                u += n;
            }
            r = isFinite(r) ? Math.max(r + n, 1) : Math.max(l + u, 1);
            var K = (w = this.arrangementOrigin.x);
            y = this.arrangementOrigin.y;
            u = 0;
            k >= l && (k -= l);
            l = z = 0;
            C = Math.max(this.cellSize.height, 1);
            A = f = 0;
            I = !0;
            v = H.alloc();
            for (P = 0; P < e.length; P++) {
              var V = e[P],
                Q = this.Yi(V, g),
                ca = V.uf(V.locationObject, V.locationSpot, h);
              if (0 < u)
                switch (q) {
                  case gq:
                    K = (K - w - (Q.width - ca.x)) / r;
                    K = J.$(Math.round(K), K) ? Math.round(K) : Math.floor(K);
                    K = K * r + w;
                    break;
                  default:
                    (K = (K - w + ca.x) / r),
                      (K = J.$(Math.round(K), K) ? Math.round(K) : Math.ceil(K)),
                      (K = K * r + w);
                }
              else
                switch (q) {
                  case gq:
                    z = K + ca.x + Q.width;
                    break;
                  default:
                    z = K - ca.x;
                }
              switch (q) {
                case gq:
                  var pa = -(K + ca.x) + z;
                  break;
                default:
                  pa = K + Q.width - ca.x - z;
              }
              if ((0 < m && u > m - 1) || (0 < k && 0 < u && pa > k)) {
                d.push(new N(0, I ? y - f : y, k + n, A + f + p));
                for (K = 0; K < u && P !== u; K++) {
                  pa = e[P - u + K];
                  var M = pa.uf(pa.locationObject, pa.locationSpot, v);
                  pa.moveTo(pa.position.x, pa.position.y + f - M.y);
                }
                A += p;
                y = I ? y + A : y + (A + f);
                u = A = f = 0;
                K = w;
                I = !1;
              }
              K === w &&
                (l = q === gq ? Math.max(l, Q.width - ca.x) : Math.min(l, -ca.x));
              f = Math.max(f, ca.y);
              A = Math.max(A, Q.height - ca.y);
              isFinite(C) && (A = Math.max(A, Math.max(Q.height, C) - ca.y));
              I ? V.moveTo(K - ca.x, y - ca.y) : V.moveTo(K - ca.x, y);
              switch (q) {
                case gq:
                  K -= ca.x + n;
                  break;
                default:
                  K += Q.width - ca.x + n;
              }
              u++;
            }
            d.push(new N(0, y, k + n, (I ? A : A + f) + p));
            if (e.length !== u)
              for (k = 0; k < u; k++)
                (m = e[e.length - u + k]),
                  (n = m.uf(m.locationObject, m.locationSpot, h)),
                  m.moveTo(m.position.x, m.position.y + f - n.y);
            H.free(h);
            H.free(v);
            if (q === gq)
              for (e = 0; e < d.length; e++)
                (f = d[e]), (f.width += l), (f.x -= l);
            else
              for (e = 0; e < d.length; e++)
                (f = d[e]), f.x > l && ((f.width += f.x - l), (f.x = l));
            N.free(g);
        }
        for (h = f = g = e = 0; h < d.length; h++)
          (k = d[h]),
            (e = Math.min(e, k.x)),
            (g = Math.min(g, k.y)),
            (f = Math.max(f, k.x + k.width));
        this.arrangement === gq
          ? this.commitLayers(d, new H(e + b / 2 - (f + e), g - c / 2))
          : this.commitLayers(d, new H(e - b / 2, g - c / 2));
        null !== a && a.Ua('Layout');
        this.isValidLayout = !0;
      }
    };
    Lk.prototype.commitLayers = function () {};
    function cq(a, b) {
      a = a.text;
      b = b.text;
      return a < b ? -1 : a > b ? 1 : 0;
    }
    ma.Object.defineProperties(Lk.prototype, {
      wrappingWidth: {
        get: function () {
          return this.Zp;
        },
        set: function (a) {
          this.Zp !== a &&
            (0 < a || isNaN(a)) &&
            ((this.Zp = a), (this.isViewportSized = isNaN(a)), this.C());
        },
      },
      wrappingColumn: {
        get: function () {
          return this.Yp;
        },
        set: function (a) {
          this.Yp !== a && (0 < a || isNaN(a)) && ((this.Yp = a), this.C());
        },
      },
      cellSize: {
        get: function () {
          return this.Ng;
        },
        set: function (a) {
          this.Ng.A(a) || (this.Ng.assign(a), this.C());
        },
      },
      spacing: {
        get: function () {
          return this.cf;
        },
        set: function (a) {
          this.cf.A(a) || (this.cf.assign(a), this.C());
        },
      },
      alignment: {
        get: function () {
          return this.wb;
        },
        set: function (a) {
          this.wb === a || (a !== $p && a !== hq) || ((this.wb = a), this.C());
        },
      },
      arrangement: {
        get: function () {
          return this.Bb;
        },
        set: function (a) {
          this.Bb === a || (a !== aq && a !== gq) || ((this.Bb = a), this.C());
        },
      },
      sorting: {
        get: function () {
          return this.Oc;
        },
        set: function (a) {
          this.Oc === a ||
            (a !== eq && a !== fq && a !== bq && a !== dq) ||
            ((this.Oc = a), this.C());
        },
      },
      comparer: {
        get: function () {
          return this.Ic;
        },
        set: function (a) {
          this.Ic !== a && ((this.Ic = a), this.C());
        },
      },
    });
    var hq = new D(Lk, 'Position', 0),
      $p = new D(Lk, 'Location', 1),
      aq = new D(Lk, 'LeftToRight', 2),
      gq = new D(Lk, 'RightToLeft', 3),
      eq = new D(Lk, 'Forward', 4),
      fq = new D(Lk, 'Reverse', 5),
      bq = new D(Lk, 'Ascending', 6),
      dq = new D(Lk, 'Descending', 7);
    Lk.className = 'GridLayout';
    Lk.standardComparer = cq;
    Lk.smartComparer = function (a, b) {
      if (null !== a) {
        if (null !== b) {
          a = a.text
            .toLocaleLowerCase()
            .split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);
          b = b.text
            .toLocaleLowerCase()
            .split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);
          for (var c = 0; c < a.length; c++)
            if ('' !== b[c] && void 0 !== b[c]) {
              var d = parseFloat(a[c]),
                e = parseFloat(b[c]);
              if (isNaN(d))
                if (isNaN(e)) {
                  if (0 !== a[c].localeCompare(b[c]))
                    return a[c].localeCompare(b[c]);
                } else return 1;
              else {
                if (isNaN(e)) return -1;
                if (0 !== d - e) return d - e;
              }
            } else if ('' !== a[c]) return 1;
          return '' !== b[c] && void 0 !== b[c] ? -1 : 0;
        }
        return 1;
      }
      return null !== b ? -1 : 0;
    };
    Lk.Position = hq;
    Lk.Location = $p;
    Lk.LeftToRight = aq;
    Lk.RightToLeft = gq;
    Lk.Forward = eq;
    Lk.Reverse = fq;
    Lk.Ascending = bq;
    Lk.Descending = dq;
    function yi() {
      this.Ro = new F();
      this.so = new F();
      this.Ca = new F();
      this.Me = new G();
      this.Le = new G();
      this.yj = new G();
      this.B = null;
      this.Sq = !1;
    }
    t = yi.prototype;
    t.clear = function () {
      this.Ro.clear();
      this.so.clear();
      this.Ca.clear();
      this.Me.clear();
      this.Le.clear();
      this.yj.clear();
    };
    t.Zd = function (a) {
      this.B = a;
    };
    t.$i = function (a) {
      if (a instanceof U) {
        if ((this.Ro.add(a), a instanceof xf)) {
          var b = a.containingGroup;
          null === b ? this.B.Ah.add(a) : b.Al.add(a);
          b = a.layout;
          null !== b && (b.diagram = this.B);
        }
      } else a instanceof S ? this.so.add(a) : a instanceof Ce || this.Ca.add(a);
      b = a.data;
      null === b ||
        a instanceof Ce ||
        (a instanceof S ? this.Le.add(b, a) : this.Me.add(b, a));
    };
    t.Ec = function (a) {
      a.Zj();
      if (a instanceof U) {
        if ((this.Ro.remove(a), a instanceof xf)) {
          var b = a.containingGroup;
          null === b ? this.B.Ah.remove(a) : b.Al.remove(a);
          b = a.layout;
          null !== b && (b.diagram = null);
        }
      } else
        a instanceof S ? this.so.remove(a) : a instanceof Ce || this.Ca.remove(a);
      b = a.data;
      null === b ||
        a instanceof Ce ||
        (a instanceof S ? this.Le.remove(b) : this.Me.remove(b));
    };
    t.wd = function () {
      for (var a = this.B.nodeTemplateMap.iterator; a.next(); ) {
        var b = a.value,
          c = a.key;
        (!b.Vb() || b instanceof xf) &&
          B(
            'Invalid node template in Diagram.nodeTemplateMap: template for "' +
              c +
              '" must be a Node or a simple Part, not a Group or Link: ' +
              b,
          );
      }
      for (a = this.B.groupTemplateMap.iterator; a.next(); )
        (b = a.value),
          (c = a.key),
          b instanceof xf ||
            B(
              'Invalid group template in Diagram.groupTemplateMap: template for "' +
                c +
                '" must be a Group, not a normal Node or Link: ' +
                b,
            );
      for (a = this.B.linkTemplateMap.iterator; a.next(); )
        (b = a.value),
          (c = a.key),
          b instanceof S ||
            B(
              'Invalid link template in Diagram.linkTemplateMap: template for "' +
                c +
                '" must be a Link, not a normal Node or simple Part: ' +
                b,
            );
      a = Ea();
      for (b = this.B.selection.iterator; b.next(); )
        (c = b.value.data) && a.push(c);
      b = Ea();
      for (c = this.B.highlighteds.iterator; c.next(); ) {
        var d = c.value.data;
        d && b.push(d);
      }
      c = Ea();
      for (d = this.nodes.iterator; d.next(); ) {
        var e = d.value;
        null !== e.data && (c.push(e.data), c.push(e.location));
      }
      for (d = this.links.iterator; d.next(); )
        (e = d.value), null !== e.data && (c.push(e.data), c.push(e.location));
      for (d = this.parts.iterator; d.next(); )
        (e = d.value), null !== e.data && (c.push(e.data), c.push(e.location));
      this.removeAllModeledParts();
      this.addAllModeledParts();
      for (d = 0; d < a.length; d++)
        (e = this.vc(a[d])), null !== e && (e.isSelected = !0);
      for (d = 0; d < b.length; d++)
        (e = this.vc(b[d])), null !== e && (e.isHighlighted = !0);
      for (d = 0; d < c.length; d += 2)
        (e = this.vc(c[d])), null !== e && (e.location = c[d + 1]);
      Ha(a);
      Ha(b);
      Ha(c);
    };
    yi.prototype.addAllModeledParts = function () {
      this.addModeledParts(this.diagram.model.nodeDataArray);
    };
    yi.prototype.addModeledParts = function (a, b) {
      var c = this,
        d = this.diagram.model;
      a.forEach(function (a) {
        d.sb(a) && iq(c, a, !1);
      });
      a.forEach(function (a) {
        d.sb(a) && c.resolveReferencesForData(a);
      });
      !1 !== b && ok(this.diagram, !1);
    };
    function iq(a, b, c) {
      if (
        void 0 !== b &&
        null !== b &&
        !a.diagram.undoManager.isUndoingRedoing &&
        !a.Me.contains(b)
      ) {
        void 0 === c && (c = !0);
        a: {
          if (
            void 0 !== b &&
            null !== b &&
            !a.B.undoManager.isUndoingRedoing &&
            !a.Me.contains(b)
          ) {
            var d = a.mt(b);
            var e = Ko(a, b, d);
            if (null !== e && (zg(e), (e = e.copy()), null !== e)) {
              var f = a.diagram.skipsModelSourceBindings;
              a.diagram.skipsModelSourceBindings = !0;
              e.Kf = d;
              e.hb = b;
              a.Sq && (e.fh = 'Tool');
              a.diagram.add(e);
              e.hb = null;
              e.data = b;
              a.diagram.skipsModelSourceBindings = f;
              d = e;
              break a;
            }
          }
          d = null;
        }
        null !== d && c && a.resolveReferencesForData(b);
      }
    }
    yi.prototype.insertLink = function () {
      return null;
    };
    yi.prototype.resolveReferencesForData = function () {};
    yi.prototype.mt = function (a) {
      return this.B.model.mt(a);
    };
    function Ko(a, b, c) {
      a = a.B;
      var d = a.model;
      d.kk() && d.Kv(b)
        ? ((b = a.groupTemplateMap.H(c)),
          null === b &&
            ((b = a.groupTemplateMap.H('')),
            null === b &&
              (jq ||
                ((jq = !0),
                wa('No Group template found for category "' + c + '"'),
                wa('  Using default group template')),
              (b = a.eu))))
        : ((b = a.nodeTemplateMap.H(c)),
          null === b &&
            ((b = a.nodeTemplateMap.H('')),
            null === b &&
              (kq ||
                ((kq = !0),
                wa('No Node template found for category "' + c + '"'),
                wa('  Using default node template')),
              (b = a.gu))));
      return b;
    }
    yi.prototype.getLinkCategoryForData = function () {
      return '';
    };
    yi.prototype.setLinkCategoryForData = function () {};
    yi.prototype.setFromNodeForLink = function () {};
    yi.prototype.setToNodeForLink = function () {};
    yi.prototype.findLinkTemplateForCategory = function (a) {
      var b = this.B.linkTemplateMap.H(a);
      null === b &&
        ((b = this.B.linkTemplateMap.H('')),
        null === b &&
          (lq ||
            ((lq = !0),
            wa('No Link template found for category "' + a + '"'),
            wa('  Using default link template')),
          (b = this.B.fu)));
      return b;
    };
    yi.prototype.removeAllModeledParts = function () {
      this.It(this.diagram.model.nodeDataArray);
    };
    yi.prototype.It = function (a) {
      var b = this;
      a.forEach(function (a) {
        b.Fq(a);
      });
    };
    yi.prototype.Fq = function (a) {
      a = this.vc(a);
      null !== a && (Kj(this.diagram, a, !1), this.unresolveReferencesForPart(a));
    };
    yi.prototype.unresolveReferencesForPart = function () {};
    yi.prototype.removeDataForLink = function () {};
    yi.prototype.findPartForKey = function (a) {
      if (null === a || void 0 === a) return null;
      a = this.B.model.Jb(a);
      return null !== a ? this.Me.H(a) : null;
    };
    yi.prototype.Kb = function (a) {
      if (null === a || void 0 === a) return null;
      a = this.B.model.Jb(a);
      if (null === a) return null;
      a = this.Me.H(a);
      return a instanceof U ? a : null;
    };
    yi.prototype.findLinkForKey = function () {
      return null;
    };
    t = yi.prototype;
    t.vc = function (a) {
      if (null === a) return null;
      var b = this.Me.H(a);
      return null !== b ? b : (b = this.Le.H(a));
    };
    t.Ri = function (a) {
      if (null === a) return null;
      a = this.Me.H(a);
      return a instanceof U ? a : null;
    };
    t.uc = function (a) {
      return null === a ? null : this.Le.H(a);
    };
    t.jt = function (a) {
      for (var b = 0; b < arguments.length; ++b);
      b = new F();
      for (var c = this.Ro.iterator; c.next(); ) {
        var d = c.value,
          e = d.data;
        if (null !== e)
          for (var f = 0; f < arguments.length; f++) {
            var g = arguments[f];
            if (za(g) && mq(this, e, g)) {
              b.add(d);
              break;
            }
          }
      }
      return b.iterator;
    };
    t.it = function (a) {
      for (var b = 0; b < arguments.length; ++b);
      b = new F();
      for (var c = this.so.iterator; c.next(); ) {
        var d = c.value,
          e = d.data;
        if (null !== e)
          for (var f = 0; f < arguments.length; f++) {
            var g = arguments[f];
            if (za(g) && mq(this, e, g)) {
              b.add(d);
              break;
            }
          }
      }
      return b.iterator;
    };
    function mq(a, b, c) {
      for (var d in c) {
        var e = b[d],
          f = c[d];
        if (Aa(f)) {
          if (!Aa(e) || e.length < f.length) return !1;
          for (var g = 0; g < e.length; g++) {
            var h = f[g];
            if (void 0 !== h && !nq(a, e[g], h)) return !1;
          }
        } else if (!nq(a, e, f)) return !1;
      }
      return !0;
    }
    function nq(a, b, c) {
      if ('function' === typeof c) {
        if (!c(b)) return !1;
      } else if (c instanceof RegExp) {
        if (!b || !c.test(b.toString())) return !1;
      } else if (za(b) && za(c)) {
        if (!mq(a, b, c)) return !1;
      } else if (b !== c) return !1;
      return !0;
    }
    yi.prototype.doModelChanged = function (a) {
      if (this.B) {
        var b = this.B;
        if (a.model === b.model) {
          var c = a.change;
          b.doModelChanged(a);
          if (b.Z) {
            b.Z = !1;
            try {
              var d = a.modelChange;
              if ('' !== d)
                if (c === qe) {
                  if ('nodeCategory' === d) {
                    var e = this.vc(a.object),
                      f = a.newValue;
                    null !== e && 'string' === typeof f && (e.category = f);
                  } else
                    'nodeDataArray' === d &&
                      (this.It(a.oldValue), this.addModeledParts(a.newValue));
                  b.isModified = !0;
                } else if (c === se) {
                  var g = a.newValue;
                  'nodeDataArray' === d && za(g) && iq(this, g);
                  b.isModified = !0;
                } else if (c === te) {
                  var h = a.oldValue;
                  'nodeDataArray' === d && za(h) && this.Fq(h);
                  b.isModified = !0;
                } else
                  c === re &&
                    ('SourceChanged' === d
                      ? null !== a.object
                        ? this.updateDataBindings(a.object, a.propertyName)
                        : (this.Oq(), this.updateAllTargetBindings())
                      : 'ModelDisplaced' === d && this.wd());
              else if (c === qe) {
                var k = a.propertyName,
                  l = a.object;
                if (l === b.model) {
                  if ('nodeKeyProperty' === k || 'nodeCategoryProperty' === k)
                    b.undoManager.isUndoingRedoing || this.wd();
                } else this.updateDataBindings(l, k);
                b.isModified = !0;
              } else if (c === se || c === te) {
                var m = a.change === se,
                  n = m ? a.newParam : a.oldParam,
                  p = m ? a.newValue : a.oldValue,
                  r = this.yj.H(a.object);
                if (Array.isArray(r))
                  for (a = 0; a < r.length; a++) {
                    var q = r[a];
                    if (m) hn(q, p, n);
                    else if (!(0 > n)) {
                      var u = n + an(q);
                      q.Ec(u, !0);
                      mn(q, u, n);
                    }
                  }
                b.isModified = !0;
              }
            } finally {
              b.Z = !0;
            }
          }
        }
      }
    };
    yi.prototype.updateAllTargetBindings = function (a) {
      void 0 === a && (a = '');
      for (var b = this.parts.iterator; b.next(); ) b.value.Aa(a);
      for (b = this.nodes.iterator; b.next(); ) b.value.Aa(a);
      for (b = this.links.iterator; b.next(); ) b.value.Aa(a);
    };
    yi.prototype.Oq = function () {
      for (
        var a = this.B.model, b = new F(), c = a.nodeDataArray, d = 0;
        d < c.length;
        d++
      )
        b.add(c[d]);
      var e = [];
      this.nodes.each(function (a) {
        null === a.data || b.contains(a.data) || e.push(a.data);
      });
      this.parts.each(function (a) {
        null === a.data || b.contains(a.data) || e.push(a.data);
      });
      e.forEach(function (b) {
        oq(a, b, !1);
      });
      for (d = 0; d < c.length; d++) {
        var f = c[d];
        null === this.vc(f) && pq(a, f, !1);
      }
      this.refreshDataBoundLinks();
      for (c = this.parts.iterator; c.next(); )
        c.value.updateRelationshipsFromData();
      for (c = this.nodes.iterator; c.next(); )
        c.value.updateRelationshipsFromData();
      for (c = this.links.iterator; c.next(); )
        c.value.updateRelationshipsFromData();
    };
    yi.prototype.refreshDataBoundLinks = function () {};
    yi.prototype.updateRelationshipsFromData = function () {};
    yi.prototype.updateDataBindings = function (a, b) {
      if ('string' === typeof b) {
        var c = this.vc(a);
        if (null !== c) c.Aa(b);
        else {
          c = null;
          for (var d = this.yj.iterator; d.next(); ) {
            for (var e = d.value, f = 0; f < e.length; f++) {
              var g = e[f].Mx(a);
              null !== g && (null === c && (c = Ea()), c.push(g));
            }
            if (null !== c) break;
          }
          if (null !== c) {
            for (d = 0; d < c.length; d++) c[d].Aa(b);
            Ha(c);
          }
        }
        a === this.diagram.model.modelData && this.updateAllTargetBindings(b);
      }
    };
    function Gj(a, b) {
      var c = b.si;
      if (Aa(c)) {
        var d = a.yj.H(c);
        if (null === d) (d = []), d.push(b), a.yj.add(c, d);
        else {
          for (a = 0; a < d.length; a++) if (d[a] === b) return;
          d.push(b);
        }
      }
    }
    function Jj(a, b, c) {
      Ej(b, function (a) {
        a = a.W.j;
        for (var b = a.length, d = 0; d < b; d++) mk(c, a[d]);
      });
      var d = b.si;
      if (Aa(d)) {
        var e = a.yj.H(d);
        if (null !== e)
          for (var f = 0; f < e.length; f++)
            if (e[f] === b) {
              e.splice(f, 1);
              0 === e.length && a.yj.remove(d);
              break;
            }
      }
    }
    yi.prototype.dk = function (a, b, c) {
      var d = new G();
      if (Aa(a)) for (var e = 0; e < a.length; e++) qq(this, a[e], b, d, c);
      else for (a = a.iterator; a.next(); ) qq(this, a.value, b, d, c);
      if (null !== b) {
        c = b.model;
        a = b.toolManager.findTool('Dragging');
        a = null !== a ? a.dragOptions.dragsLink : b.Rk.dragsLink;
        e = new F();
        for (var f = new G(), g = d.iterator; g.next(); ) {
          var h = g.value;
          if (h instanceof S)
            a || (null !== h.fromNode && null !== h.toNode) || e.add(h);
          else if (h instanceof U && null !== h.data && c.qm()) {
            var k = h;
            h = g.key;
            var l = h.Bg();
            null !== l &&
              ((l = d.H(l)),
              null !== l
                ? (c.Fe(k.data, c.ja(l.data)),
                  (k = b.uc(k.data)),
                  (h = h.Ui()),
                  null !== h && null !== k && f.add(h, k))
                : c.Fe(k.data, void 0));
          }
        }
        0 < e.count && b.Jt(e, !1);
        if (0 < f.count) for (c = f.iterator; c.next(); ) d.add(c.key, c.value);
      }
      if (
        null !== b &&
        null !== this.B &&
        ((b = b.model), (c = b.afterCopyFunction), null !== c)
      ) {
        var m = new G();
        d.each(function (a) {
          null !== a.key.data && m.add(a.key.data, a.value.data);
        });
        c(m, b, this.B.model);
      }
      for (b = d.iterator; b.next(); ) b.value.Aa();
      return d;
    };
    function qq(a, b, c, d, e) {
      if (null === b || (e && !b.canCopy())) return null;
      if (d.contains(b)) return d.H(b);
      var f = a.copyPartData(b, c);
      if (!(f instanceof T)) return null;
      f.isSelected = !1;
      f.isHighlighted = !1;
      d.add(b, f);
      if (b instanceof U) {
        for (var g = b.linksConnected; g.next(); ) {
          var h = g.value;
          if (h.fromNode === b) {
            var k = d.H(h);
            null !== k && (k.fromNode = f);
          }
          h.toNode === b && ((h = d.H(h)), null !== h && (h.toNode = f));
        }
        if (b instanceof xf && f instanceof xf)
          for (b = b.memberParts; b.next(); )
            (g = qq(a, b.value, c, d, e)),
              g instanceof S || null === g || (g.containingGroup = f);
      } else if (b instanceof S && f instanceof S)
        for (
          g = b.fromNode,
            null !== g && ((g = d.H(g)), null !== g && (f.fromNode = g)),
            g = b.toNode,
            null !== g && ((g = d.H(g)), null !== g && (f.toNode = g)),
            b = b.labelNodes;
          b.next();
  
        )
          (g = qq(a, b.value, c, d, e)),
            null !== g && g instanceof U && (g.labeledLink = f);
      return f;
    }
    yi.prototype.copyPartData = function (a, b) {
      var c = null,
        d = a.data;
      if (null !== d && null !== b) {
        var e = b.model;
        a instanceof S ||
          ((d = e.copyNodeData(d)), za(d) && (e.mf(d), (c = b.vc(d))));
      } else
        zg(a),
          (c = a.copy()),
          null !== c &&
            ((e = this.B),
            null !== b
              ? b.add(c)
              : null !== d &&
                null !== e &&
                null !== e.commandHandler &&
                e.commandHandler.copiesClipboardData &&
                ((b = e.model),
                (e = null),
                c instanceof S || (e = b.copyNodeData(d)),
                za(e) && (c.data = e)));
      return c;
    };
    ma.Object.defineProperties(yi.prototype, {
      nodes: {
        get: function () {
          return this.Ro;
        },
      },
      links: {
        get: function () {
          return this.so;
        },
      },
      parts: {
        get: function () {
          return this.Ca;
        },
      },
      diagram: {
        get: function () {
          return this.B;
        },
      },
      addsToTemporaryLayer: {
        get: function () {
          return this.Sq;
        },
        set: function (a) {
          this.Sq = a;
        },
      },
    });
    yi.prototype.updateAllRelationshipsFromData = yi.prototype.Oq;
    yi.prototype.findLinksByExample = yi.prototype.it;
    yi.prototype.findNodesByExample = yi.prototype.jt;
    yi.prototype.findLinkForData = yi.prototype.uc;
    yi.prototype.findNodeForData = yi.prototype.Ri;
    yi.prototype.findPartForData = yi.prototype.vc;
    yi.prototype.findNodeForKey = yi.prototype.Kb;
    yi.prototype.removeModeledPart = yi.prototype.Fq;
    yi.prototype.removeModeledParts = yi.prototype.It;
    yi.prototype.rebuildParts = yi.prototype.wd;
    var kq = !1,
      jq = !1,
      lq = !1;
    yi.className = 'PartManager';
    function rq(a) {
      yi.apply(this, arguments);
    }
    la(rq, yi);
    rq.prototype.addAllModeledParts = function () {
      var a = this.diagram.model;
      this.addModeledParts(a.nodeDataArray);
      sq(this, a.linkDataArray);
    };
    rq.prototype.addModeledParts = function (a) {
      yi.prototype.addModeledParts.call(this, a, !1);
      for (a = this.links.iterator; a.next(); ) Lo(a.value);
      ok(this.diagram, !1);
    };
    function sq(a, b) {
      b.forEach(function (b) {
        tq(a, b);
      });
      ok(a.diagram, !1);
    }
    function tq(a, b) {
      if (
        void 0 !== b &&
        null !== b &&
        !a.diagram.undoManager.isUndoingRedoing &&
        !a.Le.contains(b)
      ) {
        var c = a.getLinkCategoryForData(b),
          d = a.findLinkTemplateForCategory(c);
        if (null !== d) {
          zg(d);
          var e = d.copy();
          if (null !== e) {
            d = a.diagram.skipsModelSourceBindings;
            a.diagram.skipsModelSourceBindings = !0;
            e.Kf = c;
            e.hb = b;
            c = a.diagram.model;
            var f = uq(c, b, !0);
            '' !== f && (e.fromPortId = f);
            f = vq(c, b, !0);
            void 0 !== f && ((f = a.Kb(f)), f instanceof U && (e.fromNode = f));
            f = uq(c, b, !1);
            '' !== f && (e.toPortId = f);
            f = vq(c, b, !1);
            void 0 !== f && ((f = a.Kb(f)), f instanceof U && (e.toNode = f));
            c = c.Cg(b);
            Array.isArray(c) &&
              c.forEach(function (b) {
                b = a.Kb(b);
                null !== b && (b.labeledLink = e);
              });
            a.Sq && (e.fh = 'Tool');
            a.diagram.add(e);
            e.hb = null;
            e.data = b;
            a.diagram.skipsModelSourceBindings = d;
          }
        }
      }
    }
    rq.prototype.removeAllModeledParts = function () {
      var a = this.diagram.model;
      wq(this, a.linkDataArray);
      this.It(a.nodeDataArray);
    };
    function wq(a, b) {
      b.forEach(function (b) {
        a.Fq(b);
      });
    }
    rq.prototype.getLinkCategoryForData = function (a) {
      return this.diagram.model.zv(a);
    };
    rq.prototype.setLinkCategoryForData = function (a, b) {
      return this.diagram.model.Lt(a, b);
    };
    rq.prototype.setFromNodeForLink = function (a, b) {
      var c = this.diagram.model;
      c.jy(a.data, c.ja(null !== b ? b.data : null));
    };
    rq.prototype.setToNodeForLink = function (a, b) {
      var c = this.diagram.model;
      c.ny(a.data, c.ja(null !== b ? b.data : null));
    };
    rq.prototype.removeDataForLink = function (a) {
      this.diagram.model.zm(a.data);
    };
    rq.prototype.findPartForKey = function (a) {
      var b = yi.prototype.findPartForKey.call(this, a);
      return null === b && ((a = this.diagram.model.zg(a)), null !== a)
        ? this.Le.H(a)
        : b;
    };
    rq.prototype.findLinkForKey = function (a) {
      if (null === a || void 0 === a) return null;
      a = this.diagram.model.zg(a);
      return null !== a ? this.Le.H(a) : null;
    };
    rq.prototype.doModelChanged = function (a) {
      var b = this;
      yi.prototype.doModelChanged.call(this, a);
      if (this.diagram) {
        var c = this.diagram;
        if (a.model === c.model) {
          var d = a.change;
          if (c.Z) {
            c.Z = !1;
            try {
              var e = a.modelChange;
              if ('' !== e)
                if (d === qe) {
                  if ('linkFromKey' === e) {
                    var f = this.uc(a.object);
                    if (null !== f) {
                      var g = this.Kb(a.newValue);
                      f.fromNode = g;
                    }
                  } else if ('linkToKey' === e) {
                    var h = this.uc(a.object);
                    if (null !== h) {
                      var k = this.Kb(a.newValue);
                      h.toNode = k;
                    }
                  } else if ('linkFromPortId' === e) {
                    var l = this.uc(a.object);
                    if (null !== l) {
                      var m = a.newValue;
                      'string' === typeof m && (l.fromPortId = m);
                    }
                  } else if ('linkToPortId' === e) {
                    var n = this.uc(a.object);
                    if (null !== n) {
                      var p = a.newValue;
                      'string' === typeof p && (n.toPortId = p);
                    }
                  } else if ('nodeGroupKey' === e) {
                    var r = this.vc(a.object);
                    if (null !== r) {
                      var q = a.newValue;
                      if (void 0 !== q) {
                        var u = this.Kb(q);
                        u instanceof xf
                          ? (r.containingGroup = u)
                          : (r.containingGroup = null);
                      } else r.containingGroup = null;
                    }
                  } else if ('linkLabelKeys' === e) {
                    var v = this.uc(a.object);
                    if (null !== v) {
                      var w = a.oldValue,
                        y = a.newValue;
                      Array.isArray(w) &&
                        w.forEach(function (a) {
                          a = b.Kb(a);
                          null !== a && (a.labeledLink = null);
                        });
                      Array.isArray(y) &&
                        y.forEach(function (a) {
                          a = b.Kb(a);
                          null !== a && (a.labeledLink = v);
                        });
                    }
                  } else if ('linkCategory' === e) {
                    var z = this.uc(a.object),
                      A = a.newValue;
                    null !== z && 'string' === typeof A && (z.category = A);
                  } else
                    'linkDataArray' === e &&
                      (wq(this, a.oldValue), sq(this, a.newValue));
                  c.isModified = !0;
                } else if (d === se) {
                  var C = a.newValue;
                  if (
                    'linkDataArray' === e &&
                    'object' === typeof C &&
                    null !== C
                  )
                    tq(this, C);
                  else if ('linkLabelKeys' === e && xq(C)) {
                    var I = this.uc(a.object),
                      P = this.Kb(C);
                    null !== I && null !== P && (P.labeledLink = I);
                  }
                  c.isModified = !0;
                } else {
                  if (d === te) {
                    var K = a.oldValue;
                    if (
                      'linkDataArray' === e &&
                      'object' === typeof K &&
                      null !== K
                    )
                      this.Fq(K);
                    else if ('linkLabelKeys' === e && xq(K)) {
                      var V = this.Kb(K);
                      null !== V && (V.labeledLink = null);
                    }
                    c.isModified = !0;
                  }
                }
              else if (d === qe) {
                var Q = a.propertyName;
                a.object !== c.model ||
                  ('linkFromKeyProperty' !== Q &&
                    'linkToKeyProperty' !== Q &&
                    'linkFromPortIdProperty' !== Q &&
                    'linkToPortIdProperty' !== Q &&
                    'linkLabelKeysProperty' !== Q &&
                    'nodeIsGroupProperty' !== Q &&
                    'nodeGroupKeyProperty' !== Q &&
                    'linkCategoryProperty' !== Q) ||
                  c.undoManager.isUndoingRedoing ||
                  this.wd();
                c.isModified = !0;
              }
            } finally {
              c.Z = !0;
            }
          }
        }
      }
    };
    rq.prototype.refreshDataBoundLinks = function () {
      var a = this,
        b = this.diagram.model,
        c = new F(),
        d = b.linkDataArray;
      d.forEach(function (a) {
        c.add(a);
      });
      var e = [];
      this.links.each(function (a) {
        null === a.data || c.contains(a.data) || e.push(a.data);
      });
      e.forEach(function (a) {
        yq(b, a, !1);
      });
      d.forEach(function (c) {
        null === a.uc(c) && zq(b, c, !1);
      });
    };
    rq.prototype.updateRelationshipsFromData = function (a) {
      var b = a.data;
      if (null !== b) {
        var c = a.diagram;
        if (null !== c) {
          var d = c.model;
          if (a instanceof S) {
            var e = vq(d, b, !0);
            e = c.Kb(e);
            a.fromNode = e;
            e = vq(d, b, !1);
            e = c.Kb(e);
            a.toNode = e;
            b = d.Cg(b);
            if (0 < b.length || 0 < a.labelNodes.count) {
              if (1 === b.length && 1 === a.labelNodes.count) {
                e = b[0];
                var f = a.labelNodes.first();
                if (d.ja(f.data) === e) return;
              }
              e = new F().addAll(b);
              var g = new F();
              a.labelNodes.each(function (a) {
                null !== a.data && ((a = d.ja(a.data)), void 0 !== a && g.add(a));
              });
              b = g.copy();
              b.Eq(e);
              e = e.copy();
              e.Eq(g);
              if (0 < b.count || 0 < e.count)
                b.each(function (b) {
                  b = c.Kb(b);
                  null !== b && b.labeledLink === a && (b.labeledLink = null);
                }),
                  e.each(function (b) {
                    b = c.Kb(b);
                    null !== b && b.labeledLink !== a && (b.labeledLink = a);
                  });
            }
          } else
            !(a instanceof Ce) &&
              ((b = d.Xi(b)),
              (b = c.findPartForKey(b)),
              null === b || b instanceof xf) &&
              (a.containingGroup = b);
        }
      }
    };
    rq.prototype.resolveReferencesForData = function (a) {
      var b = this.diagram.model,
        c = b.ja(a);
      if (void 0 !== c) {
        var d = Aq(b, c),
          e = this.vc(a);
        if (null !== d && null !== e) {
          d = d.iterator;
          for (var f = {}; d.next(); ) {
            var g = d.value;
            b.sb(g)
              ? e instanceof xf &&
                b.Xi(g) === c &&
                ((g = this.vc(g)), null !== g && (g.containingGroup = e))
              : ((f.link = this.uc(g)),
                null !== f.link &&
                  e instanceof U &&
                  (vq(b, g, !0) === c && (f.link.fromNode = e),
                  vq(b, g, !1) === c && (f.link.toNode = e),
                  (g = b.Cg(g)),
                  Array.isArray(g) &&
                    g.some(
                      (function (a) {
                        return function (b) {
                          return b === c ? ((e.labeledLink = a.link), !0) : !1;
                        };
                      })(f),
                    )));
            f = { link: f.link };
          }
          Bq(b, c);
        }
        a = b.Xi(a);
        void 0 !== a &&
          ((a = this.Kb(a)), a instanceof xf && (e.containingGroup = a));
      }
    };
    rq.prototype.unresolveReferencesForPart = function (a) {
      var b = this.diagram.model;
      if (a instanceof U) {
        var c = b.ja(a.data);
        if (void 0 !== c) {
          for (var d = a.linksConnected; d.next(); ) Cq(b, c, d.value.data);
          a.isLinkLabel && ((d = a.labeledLink), null !== d && Cq(b, c, d.data));
          if (a instanceof xf)
            for (a = a.memberParts; a.next(); )
              (d = a.value.data), b.sb(d) && Cq(b, c, d);
        }
      }
    };
    rq.prototype.copyPartData = function (a, b) {
      var c = yi.prototype.copyPartData.call(this, a, b);
      if (a instanceof S)
        if (((a = a.data), null !== a && null !== b)) {
          var d = b.model;
          a = d.gq(a);
          'object' === typeof a && null !== a && (d.Ni(a), (c = b.uc(a)));
        } else
          null !== c &&
            ((b = this.diagram),
            null !== a &&
              null !== b &&
              null !== b.commandHandler &&
              b.commandHandler.copiesClipboardData &&
              ((b = b.model.gq(a)),
              'object' === typeof b && null !== b && (c.data = b)));
      return c;
    };
    rq.prototype.insertLink = function (a, b, c, d) {
      var e = this.diagram,
        f = e.model,
        g = e.toolManager.findTool('Linking'),
        h = '';
      null !== a &&
        (null === b && (b = a), (h = b.portId), null === h && (h = ''));
      b = '';
      null !== c &&
        (null === d && (d = c), (b = d.portId), null === b && (b = ''));
      d = g.archetypeLinkData;
      if (d instanceof S) {
        if ((zg(d), (f = d.copy()), null !== f))
          return (
            (f.fromNode = a),
            (f.fromPortId = h),
            (f.toNode = c),
            (f.toPortId = b),
            e.add(f),
            (a = g.archetypeLabelNodeData),
            a instanceof U &&
              (zg(a),
              (a = a.copy()),
              null !== a && ((a.labeledLink = f), e.add(a))),
            f
          );
      } else if (
        null !== d &&
        ((d = f.gq(d)), 'object' === typeof d && null !== d)
      )
        return (
          null !== a && Dq(f, d, f.ja(a.data), !0),
          Eq(f, d, h, !0),
          null !== c && Dq(f, d, f.ja(c.data), !1),
          Eq(f, d, b, !1),
          f.Ni(d),
          (a = g.archetypeLabelNodeData),
          null === a ||
            a instanceof U ||
            ((a = f.copyNodeData(a)),
            'object' === typeof a &&
              null !== a &&
              (f.mf(a), (a = f.ja(a)), void 0 !== a && f.ev(d, a))),
          e.uc(d)
        );
      return null;
    };
    rq.prototype.findLinkForKey = rq.prototype.findLinkForKey;
    rq.prototype.findPartForKey = rq.prototype.findPartForKey;
    rq.prototype.removeAllModeledParts = rq.prototype.removeAllModeledParts;
    rq.prototype.addModeledParts = rq.prototype.addModeledParts;
    rq.prototype.addAllModeledParts = rq.prototype.addAllModeledParts;
    rq.className = 'GraphLinksPartManager';
    function Fq() {
      yi.apply(this, arguments);
      this.mh = null;
    }
    la(Fq, yi);
    function Gq(a, b, c) {
      if (null !== b && null !== c) {
        var d = a.diagram.toolManager.findTool('Linking'),
          e = b,
          f = c;
        if (a.diagram.isTreePathToChildren)
          for (b = f.linksConnected; b.next(); ) {
            if (b.value.toNode === f) return;
          }
        else
          for (e = c, f = b, b = e.linksConnected; b.next(); )
            if (b.value.fromNode === e) return;
        if (null === d || !Qf(d, e, f, null, !0))
          if (
            ((d = a.getLinkCategoryForData(c.data)),
            (b = a.findLinkTemplateForCategory(d)),
            null !== b && (zg(b), (b = b.copy()), null !== b))
          ) {
            var g = a.diagram.skipsModelSourceBindings;
            a.diagram.skipsModelSourceBindings = !0;
            b.Kf = d;
            b.hb = c.data;
            b.fromNode = e;
            b.toNode = f;
            a.diagram.add(b);
            b.hb = null;
            b.data = c.data;
            a.diagram.skipsModelSourceBindings = g;
          }
      }
    }
    Fq.prototype.getLinkCategoryForData = function (a) {
      return this.diagram.model.Av(a);
    };
    Fq.prototype.setLinkCategoryForData = function (a, b) {
      this.diagram.model.hw(a, b);
    };
    Fq.prototype.setFromNodeForLink = function (a, b, c) {
      var d = this.diagram.model;
      void 0 === c && (c = null);
      b = null !== b ? b.data : null;
      if (this.diagram.isTreePathToChildren) d.Fe(a.data, d.ja(b));
      else {
        var e = this.mh;
        this.mh = a;
        null !== c && d.Fe(c.data, void 0);
        d.Fe(b, d.ja(null !== a.toNode ? a.toNode.data : null));
        this.mh = e;
      }
    };
    Fq.prototype.setToNodeForLink = function (a, b, c) {
      var d = this.diagram.model;
      void 0 === c && (c = null);
      b = null !== b ? b.data : null;
      if (this.diagram.isTreePathToChildren) {
        var e = this.mh;
        this.mh = a;
        null !== c && d.Fe(c.data, void 0);
        d.Fe(b, d.ja(null !== a.fromNode ? a.fromNode.data : null));
        this.mh = e;
      } else d.Fe(a.data, d.ja(b));
    };
    Fq.prototype.removeDataForLink = function (a) {
      this.diagram.model.Fe(a.data, void 0);
    };
    Fq.prototype.findLinkForKey = function (a) {
      if (null === a || void 0 === a) return null;
      a = this.diagram.model.Jb(a);
      return null !== a ? this.Le.H(a) : null;
    };
    Fq.prototype.doModelChanged = function (a) {
      yi.prototype.doModelChanged.call(this, a);
      if (this.diagram) {
        var b = this.diagram;
        if (a.model === b.model) {
          var c = a.change;
          if (b.Z) {
            b.Z = !1;
            try {
              var d = a.modelChange;
              if ('' !== d) {
                if (c === qe) {
                  if ('nodeParentKey' === d) {
                    var e = a.object,
                      f = this.Kb(a.newValue),
                      g = this.Ri(e);
                    if (null !== this.mh)
                      null !== f &&
                        ((this.mh.data = e),
                        (this.mh.category = this.getLinkCategoryForData(e)));
                    else if (null !== g) {
                      var h = g.Ui();
                      null !== h
                        ? null === f
                          ? b.remove(h)
                          : b.isTreePathToChildren
                          ? (h.fromNode = f)
                          : (h.toNode = f)
                        : Gq(this, f, g);
                    }
                  } else if ('parentLinkCategory' === d) {
                    var k = this.Ri(a.object),
                      l = a.newValue;
                    if (null !== k && 'string' === typeof l) {
                      var m = k.Ui();
                      null !== m && (m.category = l);
                    }
                  }
                  b.isModified = !0;
                }
              } else if (c === qe) {
                var n = a.propertyName;
                a.object === b.model &&
                  'nodeParentKeyProperty' === n &&
                  (b.undoManager.isUndoingRedoing || this.wd());
                b.isModified = !0;
              }
            } finally {
              b.Z = !0;
            }
          }
        }
      }
    };
    Fq.prototype.updateRelationshipsFromData = function (a) {
      var b = a.data;
      if (null !== b) {
        var c = a.diagram;
        if (null !== c) {
          var d = c.model;
          a instanceof U &&
            ((b = d.Zi(b)),
            (b = c.Kb(b)),
            (d = a.Bg()),
            b !== d &&
              ((d = a.Ui()),
              null !== b
                ? null !== d
                  ? c.isTreePathToChildren
                    ? (d.fromNode = b)
                    : (d.toNode = b)
                  : Gq(this, b, a)
                : null !== d && Kj(c, d, !1)));
        }
      }
    };
    Fq.prototype.updateDataBindings = function (a, b) {
      yi.prototype.updateDataBindings.call(this, a, b);
      'string' === typeof b &&
        null !== this.vc(a) &&
        ((a = this.uc(a)), null !== a && a.Aa(b));
    };
    Fq.prototype.resolveReferencesForData = function (a) {
      var b = this.diagram.model,
        c = b.ja(a);
      if (void 0 !== c) {
        var d = Aq(b, c),
          e = this.vc(a);
        if (null !== d && null !== e) {
          for (d = d.iterator; d.next(); ) {
            var f = d.value;
            b.sb(f) && e instanceof U && b.Zi(f) === c && Gq(this, e, this.Ri(f));
          }
          Bq(b, c);
        }
        a = b.Zi(a);
        void 0 !== a && e instanceof U && ((a = this.Kb(a)), Gq(this, a, e));
      }
    };
    Fq.prototype.unresolveReferencesForPart = function (a) {
      var b = this.diagram.model;
      if (a instanceof U) {
        var c = b.ja(a.data),
          d = this.uc(a.data);
        if (null !== d) {
          d.isSelected = !1;
          d.isHighlighted = !1;
          var e = d.layer;
          if (null !== e) {
            var f = e.Ec(-1, d, !1);
            0 <= f && this.diagram.Ya(te, 'parts', e, d, null, f, null);
            f = d.layerChanged;
            null !== f && f(d, e, null);
          }
        }
        d = this.diagram.isTreePathToChildren;
        for (a = a.linksConnected; a.next(); )
          (e = a.value),
            (e = (d ? e.toNode : e.fromNode).data),
            b.sb(e) && Cq(b, c, e);
      }
    };
    Fq.prototype.insertLink = function (a, b, c) {
      b = this.diagram.model;
      var d = a,
        e = c;
      this.diagram.isTreePathToChildren || ((d = c), (e = a));
      return null !== d && null !== e
        ? (b.Fe(e.data, b.ja(d.data)), e.Ui())
        : null;
    };
    Fq.prototype.findLinkForKey = Fq.prototype.findLinkForKey;
    Fq.className = 'TreePartManager';
    function Z(a) {
      this.Ut = ',\n  "insertedNodeKeys": ';
      this.Mw = ',\n  "modifiedNodeData": ';
      this.Wt = ',\n  "removedNodeKeys": ';
      this.Qh = null;
      Za(this);
      this.tn = this.Ra = '';
      this.Yf = !1;
      this.l = {};
      this.Bc = [];
      this.$a = new G();
      this.Ai = 'key';
      this.Pk = this.xl = null;
      this.kn = this.ln = !1;
      this.nn = !0;
      this.Tm = null;
      this.Gj = 'category';
      this.Qf = new G();
      this.Bu = new E();
      this.sg = !1;
      this.v = null;
      this.undoManager = new ve();
      void 0 !== a && (this.nodeDataArray = a);
    }
    Z.prototype.cloneProtected = function (a) {
      a.Ra = this.Ra;
      a.tn = this.tn;
      a.Yf = this.Yf;
      a.Ai = this.Ai;
      a.xl = this.xl;
      a.Pk = this.Pk;
      a.ln = this.ln;
      a.kn = this.kn;
      a.nn = this.nn;
      a.Tm = this.Tm;
      a.Gj = this.Gj;
    };
    Z.prototype.copy = function () {
      var a = new this.constructor();
      this.cloneProtected(a);
      return a;
    };
    Z.prototype.clear = function () {
      this.Bc = [];
      this.$a.clear();
      this.Qf.clear();
      this.undoManager.clear();
    };
    Z.prototype.toString = function (a) {
      void 0 === a && (a = 0);
      if (1 < a) return this.Lq();
      var b = ('' !== this.name ? this.name : '') + ' Model';
      if (0 < a) {
        b += '\n node data:';
        a = this.nodeDataArray;
        for (var c = a.length, d = 0; d < c; d++) {
          var e = a[d];
          b += ' ' + this.ja(e) + ':' + Ja(e);
        }
      }
      return b;
    };
    Z.prototype.BA = function (a) {
      a.change !== re &&
        B(
          'Model.toIncrementalData argument is not a Transaction ChangedEvent:' +
            a.toString(),
        );
      var b = a.object;
      if (!(a.isTransactionFinished && b instanceof ue)) return null;
      Hq(this, b);
      a = this.Aw(b, 'FinishedUndo' === a.propertyName);
      this.Qh = null;
      return a;
    };
    Z.prototype.Aw = function (a, b) {
      var c = this,
        d = !1,
        e = new F(),
        f = new F(),
        g = new F(),
        h = this.Qh;
      a.changes.each(function (a) {
        a.model === c &&
          ('nodeDataArray' === a.modelChange
            ? a.change === se
              ? e.add(a.newValue)
              : a.change === te && g.add(a.oldValue)
            : c.sb(a.object)
            ? f.add(a.object)
            : a.change !== qe ||
              (c.modelData !== a.object && 'modelData' !== a.propertyName)
            ? null !== a.object &&
              (h && h.contains(a.object)
                ? h.get(a.object).each(function (a) {
                    c.sb(a) && f.add(a);
                  })
                : Iq(c, a.object).each(function (a) {
                    f.add(a);
                  }))
            : (d = !0));
      });
      var k = new F();
      e.each(function (a) {
        k.add(c.ja(a));
        b || f.add(a);
      });
      var l = new F();
      g.each(function (a) {
        l.add(c.ja(a));
        b && f.add(a);
      });
      a = c.cloneDeep(f.na());
      var m = null;
      d &&
        (null === m && (m = {}), (m.modelData = this.cloneDeep(this.modelData)));
      0 < k.count &&
        (null === m && (m = {}),
        b ? (m.removedNodeKeys = k.na()) : (m.insertedNodeKeys = k.na()));
      0 < a.length && (null === m && (m = {}), (m.modifiedNodeData = a));
      0 < l.count &&
        (null === m && (m = {}),
        b ? (m.insertedNodeKeys = l.na()) : (m.removedNodeKeys = l.na()));
      return m;
    };
    Z.prototype.cloneDeep = function (a) {
      return Jq(this, a, !0);
    };
    function Jq(a, b, c, d, e) {
      function f(a, b) {
        void 0 === a.__gohashid && e.push(a);
        d.set(a, b);
      }
      if (!za(b)) return b;
      e || (e = []);
      d || (d = new G());
      var g = d.get(b);
      if (g) return g;
      if (Array.isArray(b)) {
        g = [];
        f(b, g);
        for (var h = 0; h < b.length; h++) g.push(Jq(a, b[h], !1, d, e));
      } else if (
        b instanceof H ||
        b instanceof L ||
        b instanceof N ||
        b instanceof oc ||
        b instanceof O
      )
        (g = b.copy()), f(b, g);
      else {
        if (b instanceof sl || b instanceof td || b instanceof D) return b;
        if (b instanceof E)
          (g = new E().addAll(Jq(a, b.na(), !1, d, e))), f(b, g);
        else if (b instanceof F)
          (g = new F().addAll(Jq(a, b.na(), !1, d, e))), f(b, g);
        else if (b instanceof G)
          (g = new G().addAll(Jq(a, b.na(), !1, d, e))), f(b, g);
        else if (b instanceof Date) (g = new Date(b.getTime())), f(b, g);
        else if (b instanceof RegExp)
          (g = new RegExp(b)), f(b, g), (g.lastIndex = b.lastIndex);
        else if ('function' === typeof b.copy) (g = b.copy()), f(b, g);
        else
          for (h in ((g = {}), f(b, g), b))
            '__gohashid' !== h && (g[h] = Jq(a, b[h], !1, d, e));
      }
      c &&
        e.forEach(function (a) {
          delete a.__gohashid;
        });
      return g;
    }
    t = Z.prototype;
    t.Ak = function () {
      var a = '';
      '' !== this.name && (a += ',\n  "name": ' + this.quote(this.name));
      '' !== this.dataFormat &&
        (a += ',\n  "dataFormat": ' + this.quote(this.dataFormat));
      this.isReadOnly && (a += ',\n  "isReadOnly": ' + this.isReadOnly);
      'key' !== this.nodeKeyProperty &&
        'string' === typeof this.nodeKeyProperty &&
        (a += ',\n  "nodeKeyProperty": ' + this.quote(this.nodeKeyProperty));
      this.copiesArrays && (a += ',\n  "copiesArrays": true');
      this.copiesArrayObjects && (a += ',\n  "copiesArrayObjects": true');
      this.copiesKey || (a += ',\n  "copiesKey": false');
      'category' !== this.nodeCategoryProperty &&
        'string' === typeof this.nodeCategoryProperty &&
        (a +=
          ',\n  "nodeCategoryProperty": ' +
          this.quote(this.nodeCategoryProperty));
      return a;
    };
    t.Dq = function (a) {
      a.name && (this.name = a.name);
      a.dataFormat && (this.dataFormat = a.dataFormat);
      a.isReadOnly && (this.isReadOnly = !0);
      a.nodeKeyProperty && (this.nodeKeyProperty = a.nodeKeyProperty);
      a.copiesArrays && (this.copiesArrays = !0);
      a.copiesArrayObjects && (this.copiesArrayObjects = !0);
      !1 === a.copiesKey && (this.copiesKey = !1);
      a.nodeCategoryProperty &&
        (this.nodeCategoryProperty = a.nodeCategoryProperty);
    };
    function Kq(a) {
      return ',\n  "modelData": ' + Lq(a, a.modelData);
    }
    function Mq(a, b) {
      b = b.modelData;
      za(b) && (a.Bm(b), (a.modelData = b));
    }
    t.Bw = function () {
      var a = this.modelData,
        b = !1,
        c;
      for (c in a)
        if (!Nq(c, a[c])) {
          b = !0;
          break;
        }
      a = '';
      b && (a = Kq(this));
      return a + ',\n  "nodeDataArray": ' + Oq(this, this.nodeDataArray, !0);
    };
    t.Wv = function (a) {
      Mq(this, a);
      a = a.nodeDataArray;
      Aa(a) && (this.Bm(a), (this.nodeDataArray = a));
    };
    function Pq(a, b, c, d) {
      if (b === c) return !0;
      if (
        typeof b !== typeof c ||
        'function' === typeof b ||
        'function' === typeof c
      )
        return !1;
      if (Array.isArray(b) && Array.isArray(c)) {
        if (d.H(b) === c) return !0;
        d.add(b, c);
        if (b.length !== c.length) return !1;
        for (var e = 0; e < b.length; e++) if (!Pq(a, b[e], c[e], d)) return !1;
        return !0;
      }
      if (za(b) && za(c)) {
        if (d.H(b) === c) return !0;
        d.add(b, c);
        for (var f in b) {
          var g = b[f];
          if (!Nq(f, g)) {
            var h = c[f];
            if (void 0 === h || !Pq(a, g, h, d)) return !1;
          }
        }
        for (e in c)
          if (
            ((f = c[e]),
            !Nq(e, f) && ((g = b[e]), void 0 === g || !Pq(a, g, f, d)))
          )
            return !1;
        return !0;
      }
      return !1;
    }
    function Qq(a, b, c) {
      a[c] !== b[c] &&
        B(
          'Model.computeJsonDifference: Model.' +
            c +
            ' is not the same in both models: "' +
            a[c] +
            '" and "' +
            b[c] +
            '"',
        );
    }
    t.Qq = function (a) {
      Qq(this, a, 'nodeKeyProperty');
      for (
        var b = new F(),
          c = new F(),
          d = new F().addAll(this.$a.iteratorKeys),
          e = new G(),
          f = a.nodeDataArray,
          g = f.length,
          h = 0;
        h < g;
        h++
      ) {
        var k = f[h],
          l = a.ja(k);
        if (void 0 !== l) {
          d.remove(l);
          var m = this.Jb(l);
          null === m ? (b.add(l), c.add(k)) : Pq(this, m, k, e) || c.add(k);
        } else this.zt(k), (l = this.ja(k)), b.add(l), c.add(k);
      }
      f = '';
      Pq(this, this.modelData, a.modelData, e) || (f += Kq(this));
      0 < b.count && (f += this.Ut + Oq(this, b.na(), !0));
      0 < c.count && (f += this.Mw + Oq(this, c.na(), !0));
      0 < d.count && (f += this.Wt + Oq(this, d.na(), !0));
      return f;
    };
    t.Vy = function (a, b) {
      void 0 === b && (b = Rq(this, this));
      return (
        '{ "class": ' +
        this.quote(b) +
        ', "incremental": 1' +
        this.Ak() +
        this.Qq(a) +
        '}'
      );
    };
    function Hq(a, b) {
      function c(a, b) {
        b = b.part.data;
        if (a !== b) {
          var c = d.get(a);
          null === c ? ((c = new F()), c.add(b), d.add(a, c)) : c.add(b);
        }
      }
      var d = a.Qh;
      null === d &&
        ((d = new G()),
        b.changes.each(function (a) {
          if (null !== a.diagram) {
            var b = a.change;
            if (b === qe) (a = a.object.panel) && (b = a.data) && c(b, a);
            else if (b === se || b === te)
              (a = a.object), (b = a.itemArray) && c(b, a);
          }
        }),
        (a.Qh = d));
    }
    function Iq(a, b) {
      for (var c = new F(), d = 0; d < a.nodeDataArray.length; d++) {
        var e = a.nodeDataArray[d];
        Sq(a, b, e, e, c);
      }
      return c;
    }
    function Sq(a, b, c, d, e) {
      if (Array.isArray(c))
        for (var f = 0; f < c.length; f++) {
          var g = c[f];
          if (g === b) return e.add(d), !0;
          if (Sq(a, b, g, d, e)) return !0;
        }
      else if (za(c) && Object.getPrototypeOf(c) === Object.prototype)
        for (f in c) {
          g = c[f];
          if (g === b) return e.add(d), !0;
          if (Sq(a, b, g, d, e)) return !0;
        }
      return !1;
    }
    t.zw = function (a, b) {
      var c = this,
        d = !1,
        e = new F(),
        f = new F(),
        g = new F(),
        h = this.Qh;
      a.changes.each(function (a) {
        a.model === c &&
          ('nodeDataArray' === a.modelChange
            ? a.change === se
              ? e.add(a.newValue)
              : a.change === te && g.add(a.oldValue)
            : c.sb(a.object)
            ? f.add(a.object)
            : a.change !== qe ||
              (c.modelData !== a.object && 'modelData' !== a.propertyName)
            ? null !== a.object &&
              (h && h.contains(a.object)
                ? h.get(a.object).each(function (a) {
                    c.sb(a) && f.add(a);
                  })
                : Iq(c, a.object).each(function (a) {
                    f.add(a);
                  }))
            : (d = !0));
      });
      var k = new F();
      e.each(function (a) {
        k.add(c.ja(a));
        b || f.add(a);
      });
      var l = new F();
      g.each(function (a) {
        l.add(c.ja(a));
        b && f.add(a);
      });
      a = '';
      d && (a += Kq(this));
      0 < k.count && (a += (b ? this.Wt : this.Ut) + Oq(this, k.na(), !0));
      0 < f.count && (a += this.Mw + Oq(this, f.na(), !0));
      0 < l.count && (a += (b ? this.Ut : this.Wt) + Oq(this, l.na(), !0));
      return a;
    };
    t.Cq = function (a) {
      ((void 0 !== a.name && a.name !== this.name) ||
        (void 0 !== a.dataFormat && a.dataFormat !== this.dataFormat) ||
        (void 0 !== a.isReadOnly && a.isReadOnly !== this.isReadOnly) ||
        (void 0 !== a.nodeKeyProperty &&
          a.nodeKeyProperty !== this.nodeKeyProperty) ||
        (void 0 !== a.copiesArrays && a.copiesArrays !== this.copiesArrays) ||
        (void 0 !== a.copiesArrayObjects &&
          a.copiesArrayObjects !== this.copiesArrayObjects) ||
        (void 0 !== a.copiesKey && a.copiesKey !== this.copiesKey) ||
        (void 0 !== a.nodeCategoryProperty &&
          a.nodeCategoryProperty !== this.nodeCategoryProperty)) &&
        B('applyIncrementalJson cannot change Model properties');
      Mq(this, a);
      var b = a.insertedNodeKeys,
        c = a.modifiedNodeData,
        d = new G();
      if (Array.isArray(c))
        for (var e = 0; e < c.length; e++) {
          var f = c[e],
            g = this.ja(f);
          void 0 !== g && null !== g && d.set(g, f);
        }
      if (Array.isArray(b))
        for (e = b.length, f = 0; f < e; f++) {
          g = b[f];
          var h = this.Jb(g);
          null === h &&
            ((h = (h = d.get(g)) ? h : this.copyNodeData({})),
            this.Hm(h, g),
            this.mf(h));
        }
      if (Array.isArray(c))
        for (b = c.length, d = 0; d < b; d++)
          if (((e = c[d]), (f = this.ja(e)), (f = this.Jb(f)), null !== f))
            for (var k in e)
              '__gohashid' === k ||
                k === this.nodeKeyProperty ||
                (this.jk() && k === this.nodeIsGroupProperty) ||
                this.setDataProperty(f, k, e[k]);
      a = a.removedNodeKeys;
      if (Array.isArray(a))
        for (c = a.length, k = 0; k < c; k++)
          (b = this.Jb(a[k])), null !== b && this.Am(b);
    };
    t.sy = function (a, b) {
      a.change !== re &&
        B(
          'Model.toIncrementalJson argument is not a Transaction ChangedEvent:' +
            a.toString(),
        );
      var c = a.object;
      if (!(a.isTransactionFinished && c instanceof ue))
        return '{ "incremental": 0 }';
      void 0 === b && (b = Rq(this, this));
      Hq(this, c);
      a = this.zw(c, 'FinishedUndo' === a.propertyName);
      this.Qh = null;
      return '2' === b
        ? '{ "incremental": 2' + a + '}'
        : '{ "class": ' +
            this.quote(b) +
            ', "incremental": 1' +
            this.Ak() +
            a +
            '}';
    };
    t.CA = function (a, b) {
      return this.sy(a, b);
    };
    t.Lq = function (a) {
      void 0 === a && (a = Rq(this, this));
      return '{ "class": ' + this.quote(a) + this.Ak() + this.Bw() + '}';
    };
    t.toJSON = function (a) {
      return this.Lq(a);
    };
    t.yx = function (a) {
      var b = null;
      if ('string' === typeof a)
        try {
          b = x.JSON.parse(a);
        } catch (d) {}
      else
        'object' === typeof a
          ? (b = a)
          : B('Unable to modify a Model from: ' + a);
      var c = b.incremental;
      'number' !== typeof c &&
        B('Unable to apply non-incremental changes to Model: ' + a);
      0 !== c &&
        (this.ta('applyIncrementalJson'),
        this.Cq(b),
        this.Ua('applyIncrementalJson'));
    };
    t.Py = function (a) {
      return this.yx(a);
    };
    Z.constructGraphLinksModel = function () {
      return new Z();
    };
    t = Z.prototype;
    t.Bm = function (a) {
      if (Aa(a))
        for (var b = a.length, c = 0; c < b; c++) {
          var d = a[c];
          if (za(d)) {
            var e = c;
            d = this.Bm(d);
            Array.isArray(a)
              ? (a[e] = d)
              : B(
                  'Cannot replace an object in an HTMLCollection or NodeList at ' +
                    e,
                );
          }
        }
      else if (za(a)) {
        for (c in a)
          if (
            ((e = a[c]),
            za(e) &&
              ((e = this.Bm(e)), (a[c] = e), 'points' === c && Array.isArray(e)))
          ) {
            d = 0 === e.length % 2;
            for (var f = 0; f < e.length; f++)
              if ('number' !== typeof e[f]) {
                d = !1;
                break;
              }
            if (d) {
              d = new E();
              for (f = 0; f < e.length / 2; f++)
                d.add(new H(e[2 * f], e[2 * f + 1]));
              d.freeze();
              a[c] = d;
            }
          }
        if ('object' === typeof a) {
          c = a;
          e = a['class'] || '';
          0 === e.indexOf('go.') && (e = e.substr(3));
          if ('NaN' === e) c = NaN;
          else if ('Date' === e) c = new Date(a.value);
          else if ('Point' === e) c = new H(Tq(a.x), Tq(a.y));
          else if ('Size' === e) c = new L(Tq(a.width), Tq(a.height));
          else if ('Rect' === e)
            c = new N(Tq(a.x), Tq(a.y), Tq(a.width), Tq(a.height));
          else if ('Margin' === e)
            c = new oc(Tq(a.top), Tq(a.right), Tq(a.bottom), Tq(a.left));
          else if ('Spot' === e)
            'string' === typeof a['enum']
              ? (c = kd(a['enum']))
              : (c = new O(Tq(a.x), Tq(a.y), Tq(a.offsetX), Tq(a.offsetY)));
          else if ('Brush' === e) {
            if (
              ((c = new sl()),
              (c.type = $a(sl, a.type)),
              'string' === typeof a.color && (c.color = a.color),
              a.start instanceof O && (c.start = a.start),
              a.end instanceof O && (c.end = a.end),
              'number' === typeof a.startRadius &&
                (c.startRadius = Tq(a.startRadius)),
              'number' === typeof a.endRadius && (c.endRadius = Tq(a.endRadius)),
              (a = a.colorStops),
              za(a))
            )
              for (b in a) c.addColorStop(parseFloat(b), a[b]);
          } else
            'Geometry' === e
              ? ((b = null),
                'string' === typeof a.path ? (b = Id(a.path)) : (b = new td()),
                (b.type = $a(td, a.type)),
                'number' === typeof a.startX && (b.startX = Tq(a.startX)),
                'number' === typeof a.startY && (b.startY = Tq(a.startY)),
                'number' === typeof a.endX && (b.endX = Tq(a.endX)),
                'number' === typeof a.endY && (b.endY = Tq(a.endY)),
                a.spot1 instanceof O && (b.spot1 = a.spot1),
                a.spot2 instanceof O && (b.spot2 = a.spot2),
                (c = b))
              : 'EnumValue' === e &&
                ((b = a.classType),
                0 === b.indexOf('go.') && (b = b.substr(3)),
                (b = Uq(b)),
                'function' === typeof b && (c = $a(b, a.name)));
          a = c;
        }
      }
      return a;
    };
    t.quote = function (a) {
      for (var b = '', c = a.length, d = 0; d < c; d++) {
        var e = a[d];
        if ('"' === e || '\\' === e) b += '\\' + e;
        else if ('\b' === e) b += '\\b';
        else if ('\f' === e) b += '\\f';
        else if ('\n' === e) b += '\\n';
        else if ('\r' === e) b += '\\r';
        else if ('\t' === e) b += '\\t';
        else {
          var f = a.charCodeAt(d);
          b =
            16 > f
              ? b + ('\\u000' + a.charCodeAt(d).toString(16))
              : 32 > f
              ? b + ('\\u00' + a.charCodeAt(d).toString(16))
              : 8232 === f
              ? b + '\\u2028'
              : 8233 === f
              ? b + '\\u2029'
              : b + e;
        }
      }
      return '"' + b + '"';
    };
    t.Lm = function (a) {
      return void 0 === a
        ? 'undefined'
        : null === a
        ? 'null'
        : !0 === a
        ? 'true'
        : !1 === a
        ? 'false'
        : 'string' === typeof a
        ? this.quote(a)
        : 'number' === typeof a
        ? Infinity === a
          ? '9e9999'
          : -Infinity === a
          ? '-9e9999'
          : isNaN(a)
          ? '{"class":"NaN"}'
          : a.toString()
        : a instanceof Date
        ? '{"class":"Date", "value":"' + a.toJSON() + '"}'
        : a instanceof Number
        ? this.Lm(a.valueOf())
        : Aa(a)
        ? Oq(this, a)
        : za(a)
        ? Lq(this, a)
        : 'function' === typeof a
        ? 'null'
        : a.toString();
    };
    function Oq(a, b, c) {
      void 0 === c && (c = !1);
      var d = b.length;
      if (0 >= d) return '[]';
      var e = new cb();
      e.add('[ ');
      c && 1 < d && e.add('\n');
      for (var f = 0; f < d; f++) {
        var g = b[f];
        void 0 !== g && (0 < f && (e.add(','), c && e.add('\n')), e.add(a.Lm(g)));
      }
      c && 1 < d && e.add('\n');
      e.add(' ]');
      return e.toString();
    }
    function Nq(a, b) {
      return void 0 === b ||
        '__gohashid' === a ||
        '_' === a[0] ||
        'function' === typeof b
        ? !0
        : !1;
    }
    function Vq(a) {
      return isNaN(a)
        ? 'NaN'
        : Infinity === a
        ? '9e9999'
        : -Infinity === a
        ? '-9e9999'
        : a;
    }
    function Lq(a, b) {
      var c = b;
      if (c instanceof H) b = { class: 'go.Point', x: Vq(c.x), y: Vq(c.y) };
      else if (c instanceof L)
        b = { class: 'go.Size', width: Vq(c.width), height: Vq(c.height) };
      else if (c instanceof N)
        b = {
          class: 'go.Rect',
          x: Vq(c.x),
          y: Vq(c.y),
          width: Vq(c.width),
          height: Vq(c.height),
        };
      else if (c instanceof oc)
        b = {
          class: 'go.Margin',
          top: Vq(c.top),
          right: Vq(c.right),
          bottom: Vq(c.bottom),
          left: Vq(c.left),
        };
      else if (c instanceof O)
        c.cb()
          ? (b = {
              class: 'go.Spot',
              x: Vq(c.x),
              y: Vq(c.y),
              offsetX: Vq(c.offsetX),
              offsetY: Vq(c.offsetY),
            })
          : (b = { class: 'go.Spot', enum: c.toString() });
      else if (c instanceof sl) {
        b = { class: 'go.Brush', type: c.type.name };
        if (c.type === vl) b.color = c.color;
        else if (c.type === yl || c.type === tl)
          (b.start = c.start),
            (b.end = c.end),
            c.type === tl &&
              (0 !== c.startRadius && (b.startRadius = Vq(c.startRadius)),
              isNaN(c.endRadius) || (b.endRadius = Vq(c.endRadius)));
        if (null !== c.colorStops) {
          var d = {};
          for (c = c.colorStops.iterator; c.next(); ) d[c.key] = c.value;
          b.colorStops = d;
        }
      } else
        c instanceof td
          ? ((b = { class: 'go.Geometry', type: c.type.name }),
            0 !== c.startX && (b.startX = Vq(c.startX)),
            0 !== c.startY && (b.startY = Vq(c.startY)),
            0 !== c.endX && (b.endX = Vq(c.endX)),
            0 !== c.endY && (b.endY = Vq(c.endY)),
            c.spot1.A(vc) || (b.spot1 = c.spot1),
            c.spot2.A(Gc) || (b.spot2 = c.spot2),
            c.type === ud && (b.path = Fd(c)))
          : c instanceof D &&
            (b = {
              class: 'go.EnumValue',
              classType: Rq(a, c.classType),
              name: c.name,
            });
      d = '{';
      c = !0;
      for (var e in b) {
        var f = nn(b, e);
        if (!Nq(e, f))
          if (
            (c ? (c = !1) : (d += ', '),
            (d += '"' + e + '":'),
            'points' === e && f instanceof E)
          ) {
            var g = '[';
            for (f = f.iterator; f.next(); ) {
              var h = f.value;
              1 < g.length && (g += ',');
              g += a.Lm(h.x);
              g += ',';
              g += a.Lm(h.y);
            }
            g += ']';
            d += g;
          } else d += a.Lm(f);
      }
      return d + '}';
    }
    function Tq(a) {
      return 'number' === typeof a
        ? a
        : 'NaN' === a
        ? NaN
        : '9e9999' === a
        ? Infinity
        : '-9e9999' === a
        ? -Infinity
        : parseFloat(a);
    }
    t.Eh = function (a) {
      this.Bu.add(a);
    };
    t.xk = function (a) {
      this.Bu.remove(a);
    };
    t.at = function (a) {
      this.skipsUndoManager || this.undoManager.Fv(a);
      for (var b = this.Bu, c = b.length, d = 0; d < c; d++) b.L(d)(a);
    };
    t.Ya = function (a, b, c, d, e, f, g) {
      Wq(this, '', a, b, c, d, e, f, g);
    };
    t.g = function (a, b, c, d, e) {
      Wq(this, '', qe, a, this, b, c, d, e);
    };
    t.Ft = function (a, b, c, d, e, f) {
      Wq(this, '', qe, b, a, c, d, e, f);
    };
    function Wq(a, b, c, d, e, f, g, h, k) {
      void 0 === h && (h = null);
      void 0 === k && (k = null);
      var l = new pe();
      l.model = a;
      l.change = c;
      l.modelChange = b;
      l.propertyName = d;
      l.object = e;
      l.oldValue = f;
      l.oldParam = h;
      l.newValue = g;
      l.newParam = k;
      a.at(l);
    }
    t.Yj = function (a, b) {
      if (null !== a && a.model === this)
        if (a.change === qe) Rj(a.object, a.propertyName, a.H(b));
        else if (a.change === se) {
          var c = a.newParam;
          if ('nodeDataArray' === a.modelChange) {
            if (((a = a.newValue), za(a) && 'number' === typeof c)) {
              var d = this.ja(a);
              b
                ? (this.Bc[c] === a && Da(this.Bc, c),
                  void 0 !== d && this.$a.remove(d))
                : (this.Bc[c] !== a && Ca(this.Bc, c, a),
                  void 0 !== d && this.$a.add(d, a));
            }
          } else
            '' === a.modelChange
              ? ((d = a.object) &&
                  !Aa(d) &&
                  a.propertyName &&
                  (d = nn(a.object, a.propertyName)),
                Aa(d) &&
                  'number' === typeof c &&
                  ((a = a.newValue), b ? Da(d, c) : Ca(d, c, a)))
              : B('unknown ChangedEvent.Insert modelChange: ' + a.toString());
        } else
          a.change === te
            ? ((c = a.oldParam),
              'nodeDataArray' === a.modelChange
                ? ((a = a.oldValue),
                  za(a) &&
                    'number' === typeof c &&
                    ((d = this.ja(a)),
                    b
                      ? (this.Bc[c] !== a && Ca(this.Bc, c, a),
                        void 0 !== d && this.$a.add(d, a))
                      : (this.Bc[c] === a && Da(this.Bc, c),
                        void 0 !== d && this.$a.remove(d))))
                : '' === a.modelChange
                ? ((d = a.object) &&
                    !Aa(d) &&
                    a.propertyName &&
                    (d = nn(a.object, a.propertyName)),
                  Aa(d) &&
                    'number' === typeof c &&
                    ((a = a.oldValue), b ? Ca(d, c, a) : Da(d, c)))
                : B('unknown ChangedEvent.Remove modelChange: ' + a.toString()))
            : a.change !== re && B('unknown ChangedEvent: ' + a.toString());
    };
    t.ta = function (a) {
      return this.undoManager.ta(a);
    };
    t.Ua = function (a) {
      return this.undoManager.Ua(a);
    };
    t.Bf = function () {
      return this.undoManager.Bf();
    };
    Z.prototype.commit = function (a, b) {
      void 0 === b && (b = '');
      var c = this.skipsUndoManager;
      null === b && ((this.skipsUndoManager = !0), (b = ''));
      this.undoManager.ta(b);
      var d = !1;
      try {
        a(this), (d = !0);
      } finally {
        d ? this.undoManager.Ua(b) : this.undoManager.Bf(),
          (this.skipsUndoManager = c);
      }
    };
    t = Z.prototype;
    t.Aa = function (a, b) {
      void 0 === b && (b = '');
      Wq(this, 'SourceChanged', re, b, a, null, null);
    };
    t.ja = function (a) {
      if (null !== a) {
        var b = this.Ai;
        if ('' !== b && ((b = nn(a, b)), void 0 !== b)) {
          if (xq(b)) return b;
          B(
            'Key value for node data ' + a + ' is not a number or a string: ' + b,
          );
        }
      }
    };
    t.Hm = function (a, b) {
      if (null !== a) {
        var c = this.Ai;
        if ('' !== c)
          if (this.sb(a)) {
            var d = nn(a, c);
            d !== b &&
              null === this.Jb(b) &&
              (Rj(a, c, b),
              void 0 !== d && this.$a.remove(d),
              this.$a.add(b, a),
              Wq(this, 'nodeKey', qe, c, a, d, b),
              'string' === typeof c && this.Aa(a, c),
              this.Gq(d, b));
          } else Rj(a, c, b);
      }
    };
    function xq(a) {
      return 'number' === typeof a || 'string' === typeof a;
    }
    t.sb = function (a) {
      var b = this.ja(a);
      return void 0 === b ? !1 : this.$a.H(b) === a;
    };
    t.Jb = function (a) {
      null === a && B('Model.findNodeDataForKey:key must not be null');
      return void 0 !== a && xq(a) ? this.$a.H(a) : null;
    };
    t.zt = function (a) {
      if (null !== a) {
        var b = this.Ai;
        if ('' !== b) {
          var c = this.ja(a);
          if (void 0 === c || this.$a.contains(c)) {
            var d = this.xl;
            if (
              null !== d &&
              ((c = d(this, a)),
              void 0 !== c && null !== c && !this.$a.contains(c))
            ) {
              Rj(a, b, c);
              return;
            }
            if ('string' === typeof c) {
              for (d = 2; this.$a.contains(c + d); ) d++;
              Rj(a, b, c + d);
            } else if (void 0 === c || 'number' === typeof c) {
              for (c = -this.$a.count - 1; this.$a.contains(c); ) c--;
              Rj(a, b, c);
            }
          }
        }
      }
    };
    t.mf = function (a) {
      null !== a && (ob(a), this.sb(a) || pq(this, a, !0));
    };
    function pq(a, b, c) {
      var d = a.ja(b);
      if (void 0 === d || a.$a.H(d) !== b)
        a.zt(b),
          (d = a.ja(b)),
          void 0 === d
            ? B(
                'Model.makeNodeDataKeyUnique failed on ' +
                  b +
                  '.  Data not added to Model.',
              )
            : (a.$a.add(d, b),
              (d = null),
              c && ((d = a.Bc.length), Ca(a.Bc, d, b)),
              Wq(a, 'nodeDataArray', se, 'nodeDataArray', a, null, b, null, d),
              a.Dm(b),
              a.Cm(b));
    }
    t.Ly = function (a) {
      if (Aa(a)) for (var b = a.length, c = 0; c < b; c++) this.mf(a[c]);
      else for (a = a.iterator; a.next(); ) this.mf(a.value);
    };
    t.Am = function (a) {
      null !== a && oq(this, a, !0);
    };
    function oq(a, b, c) {
      var d = a.ja(b);
      void 0 !== d && a.$a.remove(d);
      d = null;
      if (c) {
        a: if (((c = a.Bc), Array.isArray(c))) d = c.indexOf(b);
        else {
          d = c.length;
          for (var e = 0; e < d; e++)
            if (c[e] === b) {
              d = e;
              break a;
            }
          d = -1;
        }
        if (0 > d) return;
        Da(a.Bc, d);
      }
      Wq(a, 'nodeDataArray', te, 'nodeDataArray', a, b, null, d, null);
      a.Nq(b);
    }
    t.rA = function (a) {
      if (Aa(a)) for (var b = a.length, c = 0; c < b; c++) this.Am(a[c]);
      else for (a = a.iterator; a.next(); ) this.Am(a.value);
    };
    t.iA = function (a) {
      if (Aa(a)) {
        for (
          var b = new F(this.$a.iteratorKeys), c = new F(), d = a.length, e = 0;
          e < d;
          e++
        ) {
          var f = a[e],
            g = this.ja(f);
          if (void 0 !== g) {
            c.add(g);
            var h = this.Jb(g);
            null !== h
              ? this.Xj(h, f)
              : ((h = {}), this.Hm(h, g), this.Xj(h, f), this.mf(h));
          } else this.mf(f), c.add(this.ja(f));
        }
        for (a = b.iterator; a.next(); )
          (b = a.value), c.contains(b) || ((b = this.Jb(b)) && this.Am(b));
        this.fq();
      }
    };
    t.Gq = function (a, b) {
      void 0 !== b && ((a = Aq(this, a)), a instanceof F && this.Qf.add(b, a));
    };
    t.vw = function () {};
    t.Dm = function () {};
    t.Cm = function () {};
    t.Nq = function () {};
    function Cq(a, b, c) {
      if (void 0 !== b) {
        var d = a.Qf.H(b);
        null === d && ((d = new F()), a.Qf.add(b, d));
        d.add(c);
      }
    }
    function Bq(a, b, c) {
      if (void 0 !== b) {
        var d = a.Qf.H(b);
        d instanceof F &&
          (void 0 === c || null === c
            ? a.Qf.remove(b)
            : (d.remove(c), 0 === d.count && a.Qf.remove(b)));
      }
    }
    function Aq(a, b) {
      if (void 0 === b) return null;
      a = a.Qf.H(b);
      return a instanceof F ? a : null;
    }
    t.fq = function (a) {
      void 0 === a ? this.Qf.clear() : this.Qf.remove(a);
    };
    Z.prototype.copyNodeData = function (a) {
      if (null === a) return null;
      var b = this.Pk;
      a = null !== b ? b(a, this) : Xq(this, a, !0);
      za(a) && Za(a);
      return a;
    };
    function Xq(a, b, c) {
      if (a.copiesArrays && Array.isArray(b)) {
        var d = [];
        for (c = 0; c < b.length; c++) {
          var e = Xq(a, b[c], a.copiesArrayObjects);
          d.push(e);
        }
        Za(d);
        return d;
      }
      if (c && za(b)) {
        c = (c = b.constructor) ? new c() : {};
        e =
          a.copiesKey || 'string' !== typeof a.nodeKeyProperty
            ? null
            : a.nodeKeyProperty;
        for (d in b)
          if ('__gohashid' === d) c.__gohashid = void 0;
          else if (d === e) c[e] = void 0;
          else {
            var f = nn(b, d),
              g = Rq(a, f);
            'GraphObject' === g ||
            'Diagram' === g ||
            'Layer' === g ||
            'RowColumnDefinition' === g ||
            'AnimationManager' === g ||
            'Tool' === g ||
            'CommandHandler' === g ||
            'Layout' === g ||
            'InputEvent' === g ||
            'DiagramEvent' === g ||
            f instanceof Z ||
            f instanceof ve ||
            f instanceof ue ||
            f instanceof pe
              ? Rj(c, d, f)
              : ((f = Xq(a, f, !1)), Rj(c, d, f));
          }
        Za(c);
        return c;
      }
      return b instanceof H
        ? b.copy()
        : b instanceof L
        ? b.copy()
        : b instanceof N
        ? b.copy()
        : b instanceof O
        ? b.copy()
        : b instanceof oc
        ? b.copy()
        : b;
    }
    Z.prototype.setDataProperty = function (a, b, c) {
      if (this.sb(a))
        if (b === this.nodeKeyProperty) this.Hm(a, c);
        else {
          if (b === this.nodeCategoryProperty) {
            this.Iq(a, c);
            return;
          }
        }
      else
        !Yq &&
          a instanceof Y &&
          ((Yq = !0),
          wa(
            'Model.setDataProperty is modifying a GraphObject, "' +
              a.toString() +
              '"',
          ),
          wa('  Is that really your intent?'));
      var d = nn(a, b);
      d !== c && (Rj(a, b, c), this.Ft(a, b, d, c));
    };
    t = Z.prototype;
    t.set = function (a, b, c) {
      this.setDataProperty(a, b, c);
    };
    t.Xj = function (a, b) {
      if (b) {
        var c = this.sb(a),
          d;
        for (d in b)
          '__gohashid' === d ||
            (c && d === this.nodeKeyProperty) ||
            this.setDataProperty(a, d, b[d]);
      }
    };
    t.Hy = function (a, b) {
      this.pt(a, -1, b);
    };
    t.pt = function (a, b, c) {
      0 > b && (b = a.length);
      Ca(a, b, c);
      Wq(this, '', se, '', a, null, c, null, b);
    };
    t.Yv = function (a, b) {
      void 0 === b && (b = -1);
      a === this.Bc &&
        B(
          'Model.removeArrayItem should not be called on the Model.nodeDataArray',
        );
      -1 === b && (b = a.length - 1);
      var c = a[b];
      Da(a, b);
      Wq(this, '', te, '', a, c, null, b, null);
    };
    t.mt = function (a) {
      if (null === a) return '';
      var b = this.Gj;
      if ('' === b) return '';
      b = nn(a, b);
      if (void 0 === b) return '';
      if ('string' === typeof b) return b;
      B('getCategoryForNodeData found a non-string category for ' + a + ': ' + b);
      return '';
    };
    t.Iq = function (a, b) {
      if (null !== a) {
        var c = this.Gj;
        if ('' !== c)
          if (this.sb(a)) {
            var d = nn(a, c);
            void 0 === d && (d = '');
            d !== b && (Rj(a, c, b), Wq(this, 'nodeCategory', qe, c, a, d, b));
          } else Rj(a, c, b);
      }
    };
    t.qm = function () {
      return !1;
    };
    t.jk = function () {
      return !1;
    };
    t.pm = function () {
      return !1;
    };
    t.vt = function () {
      return !1;
    };
    t.kk = function () {
      return !1;
    };
    function Bi() {
      return new Z();
    }
    function Rq(a, b) {
      if ('function' === typeof b) {
        if (b.className) return b.className;
        if (b.name) return b.name;
      } else if ('object' === typeof b && null !== b && b.constructor)
        return Rq(a, b.constructor);
      return typeof b;
    }
    function Uq(a) {
      return Zq[a] ? Zq[a] : void 0 !== x.go && x.go[a] ? x.go[a] : null;
    }
    function nn(a, b) {
      if (!a || !b) return null;
      try {
        if ('function' === typeof b) var c = b(a);
        else
          'function' === typeof a.getAttribute
            ? ((c = a.getAttribute(b)), null === c && (c = void 0))
            : (c = a[b]);
      } catch (d) {}
      return c;
    }
    function Rj(a, b, c) {
      if (a && b)
        try {
          'function' === typeof b
            ? b(a, c)
            : 'function' === typeof a.setAttribute
            ? a.setAttribute(b, c)
            : (a[b] = c);
        } catch (d) {}
    }
    ma.Object.defineProperties(Z.prototype, {
      name: {
        get: function () {
          return this.Ra;
        },
        set: function (a) {
          var b = this.Ra;
          b !== a && ((this.Ra = a), this.g('name', b, a));
        },
      },
      dataFormat: {
        get: function () {
          return this.tn;
        },
        set: function (a) {
          var b = this.tn;
          b !== a && ((this.tn = a), this.g('dataFormat', b, a));
        },
      },
      isReadOnly: {
        get: function () {
          return this.Yf;
        },
        set: function (a) {
          var b = this.Yf;
          b !== a && ((this.Yf = a), this.g('isReadOnly', b, a));
        },
      },
      modelData: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          var b = this.l;
          b !== a && ((this.l = a), this.g('modelData', b, a), this.Aa(a));
        },
      },
      undoManager: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          var b = this.v;
          b !== a &&
            (null !== b && b.ey(this), (this.v = a), null !== a && a.wx(this));
        },
      },
      skipsUndoManager: {
        get: function () {
          return this.sg;
        },
        set: function (a) {
          this.sg = a;
        },
      },
      nodeKeyProperty: {
        get: function () {
          return this.Ai;
        },
        set: function (a) {
          var b = this.Ai;
          b !== a &&
            ('' === a && B('Model.nodeKeyProperty may not be the empty string'),
            0 < this.$a.count &&
              B(
                'Cannot set Model.nodeKeyProperty when there is existing node data',
              ),
            (this.Ai = a),
            this.g('nodeKeyProperty', b, a));
        },
      },
      makeUniqueKeyFunction: {
        get: function () {
          return this.xl;
        },
        set: function (a) {
          var b = this.xl;
          b !== a && ((this.xl = a), this.g('makeUniqueKeyFunction', b, a));
        },
      },
      nodeDataArray: {
        get: function () {
          return this.Bc;
        },
        set: function (a) {
          var b = this.Bc;
          if (b !== a) {
            this.$a.clear();
            this.vw();
            for (var c = a.length, d = 0; d < c; d++) {
              var e = a[d];
              if (!za(e)) {
                B('Model.nodeDataArray must only contain Objects, not: ' + e);
                return;
              }
              ob(e);
            }
            this.Bc = a;
            d = new E();
            for (e = 0; e < c; e++) {
              var f = a[e],
                g = this.ja(f);
              void 0 === g
                ? d.add(f)
                : null !== this.$a.H(g)
                ? d.add(f)
                : this.$a.add(g, f);
            }
            for (d = d.iterator; d.next(); )
              (e = d.value),
                this.zt(e),
                (f = this.ja(e)),
                void 0 !== f && this.$a.add(f, e);
            Wq(this, 'nodeDataArray', qe, 'nodeDataArray', this, b, a);
            for (b = 0; b < c; b++) (d = a[b]), this.Dm(d), this.Cm(d);
            this.fq();
            Array.isArray(a) || (this.isReadOnly = !0);
          }
        },
      },
      copyNodeDataFunction: {
        get: function () {
          return this.Pk;
        },
        set: function (a) {
          var b = this.Pk;
          b !== a && ((this.Pk = a), this.g('copyNodeDataFunction', b, a));
        },
      },
      copiesArrays: {
        get: function () {
          return this.ln;
        },
        set: function (a) {
          var b = this.ln;
          b !== a && ((this.ln = a), this.g('copiesArrays', b, a));
        },
      },
      copiesArrayObjects: {
        get: function () {
          return this.kn;
        },
        set: function (a) {
          var b = this.kn;
          b !== a && ((this.kn = a), this.g('copiesArrayObjects', b, a));
        },
      },
      copiesKey: {
        get: function () {
          return this.nn;
        },
        set: function (a) {
          var b = this.nn;
          b !== a && ((this.nn = a), this.g('copiesKey', b, a));
        },
      },
      afterCopyFunction: {
        get: function () {
          return this.Tm;
        },
        set: function (a) {
          var b = this.Tm;
          b !== a && ((this.Tm = a), this.g('afterCopyFunction', b, a));
        },
      },
      nodeCategoryProperty: {
        get: function () {
          return this.Gj;
        },
        set: function (a) {
          var b = this.Gj;
          b !== a && ((this.Gj = a), this.g('nodeCategoryProperty', b, a));
        },
      },
    });
    ma.Object.defineProperties(Z, {
      type: {
        get: function () {
          return 'Model';
        },
      },
    });
    Z.prototype.setCategoryForNodeData = Z.prototype.Iq;
    Z.prototype.getCategoryForNodeData = Z.prototype.mt;
    Z.prototype.removeArrayItem = Z.prototype.Yv;
    Z.prototype.insertArrayItem = Z.prototype.pt;
    Z.prototype.addArrayItem = Z.prototype.Hy;
    Z.prototype.assignAllDataProperties = Z.prototype.Xj;
    Z.prototype.set = Z.prototype.set;
    Z.prototype.clearUnresolvedReferences = Z.prototype.fq;
    Z.prototype.mergeNodeDataArray = Z.prototype.iA;
    Z.prototype.removeNodeDataCollection = Z.prototype.rA;
    Z.prototype.removeNodeData = Z.prototype.Am;
    Z.prototype.addNodeDataCollection = Z.prototype.Ly;
    Z.prototype.addNodeData = Z.prototype.mf;
    Z.prototype.makeNodeDataKeyUnique = Z.prototype.zt;
    Z.prototype.findNodeDataForKey = Z.prototype.Jb;
    Z.prototype.containsNodeData = Z.prototype.sb;
    Z.prototype.setKeyForNodeData = Z.prototype.Hm;
    Z.prototype.getKeyForNodeData = Z.prototype.ja;
    Z.prototype.updateTargetBindings = Z.prototype.Aa;
    Z.prototype.commit = Z.prototype.commit;
    Z.prototype.rollbackTransaction = Z.prototype.Bf;
    Z.prototype.commitTransaction = Z.prototype.Ua;
    Z.prototype.startTransaction = Z.prototype.ta;
    Z.prototype.raiseDataChanged = Z.prototype.Ft;
    Z.prototype.raiseChanged = Z.prototype.g;
    Z.prototype.raiseChangedEvent = Z.prototype.Ya;
    Z.prototype.removeChangedListener = Z.prototype.xk;
    Z.prototype.addChangedListener = Z.prototype.Eh;
    Z.prototype.writeJsonValue = Z.prototype.Lm;
    Z.prototype.replaceJsonObjects = Z.prototype.Bm;
    Z.prototype.applyIncrementalJSON = Z.prototype.Py;
    Z.prototype.applyIncrementalJson = Z.prototype.yx;
    Z.prototype.toJSON = Z.prototype.toJSON;
    Z.prototype.toJson = Z.prototype.Lq;
    Z.prototype.toIncrementalJSON = Z.prototype.CA;
    Z.prototype.toIncrementalJson = Z.prototype.sy;
    Z.prototype.computeJsonDifference = Z.prototype.Vy;
    Z.prototype.toIncrementalData = Z.prototype.BA;
    Z.prototype.clear = Z.prototype.clear;
    var Yq = !1,
      Zq = {};
    Z.className = 'Model';
    Z.fromJSON = Z.fromJson = function (a, b) {
      void 0 === b && (b = null);
      var c = null;
      if ('string' === typeof a)
        try {
          c = x.JSON.parse(a);
        } catch (f) {}
      else
        'object' === typeof a
          ? (c = a)
          : B('Unable to construct a Model from: ' + a);
      if (null === b) {
        a = null;
        var d = c['class'];
        if ('string' === typeof d)
          try {
            var e = null;
            0 === d.indexOf('go.')
              ? ((d = d.substr(3)), (e = Uq(d)))
              : ((e = Uq(d)), null === e && (e = x[d]));
            'function' === typeof e && (a = new e());
          } catch (f) {}
        null === a || a instanceof Z
          ? (b = a)
          : B('Unable to construct a Model of declared class: ' + c['class']);
      }
      null === b && (b = Z.constructGraphLinksModel());
      b.Dq(c);
      b.Wv(c);
      return b;
    };
    Z.safePropertyValue = nn;
    Z.safePropertySet = Rj;
    Zq.Brush = sl;
    Zq.ChangedEvent = pe;
    Zq.Geometry = td;
    Zq.Margin = oc;
    Zq.Panel = X;
    Zq.Point = H;
    Zq.Rect = N;
    Zq.Size = L;
    Zq.Spot = O;
    Zq.Transaction = ue;
    Zq.UndoManager = ve;
    function Ki(a, b, c) {
      Za(this);
      this.s = !1;
      void 0 === a && (a = '');
      void 0 === b && (b = a);
      void 0 === c && (c = null);
      this.l = -1;
      this.ad = null;
      this.Xl = a;
      this.Wl = this.Pp = 0;
      this.Ls = null;
      this.eo = !1;
      this.Pl = b;
      this.jn = c;
      this.Do = $q;
      this.cn = null;
      this.ou = new F();
    }
    Ki.prototype.copy = function () {
      var a = new Ki();
      a.Xl = this.Xl;
      a.Pp = this.Pp;
      a.Wl = this.Wl;
      a.Ls = this.Ls;
      a.eo = this.eo;
      a.Pl = this.Pl;
      a.jn = this.jn;
      a.Do = this.Do;
      a.cn = this.cn;
      return a;
    };
    t = Ki.prototype;
    t.bb = function (a) {
      a.classType === Ki && (this.mode = a);
    };
    t.toString = function () {
      return (
        'Binding(' +
        this.targetProperty +
        ':' +
        this.sourceProperty +
        (-1 !== this.fj ? ' ' + this.fj : '') +
        ' ' +
        this.mode.name +
        ')'
      );
    };
    t.freeze = function () {
      this.s = !0;
      return this;
    };
    t.ea = function () {
      this.s = !1;
      return this;
    };
    t.Wx = function (a) {
      void 0 === a && (a = null);
      this.mode = fn;
      this.backConverter = a;
      return this;
    };
    t.zq = function (a) {
      void 0 === a && (a = '');
      this.sourceName = a;
      this.isToModel = !1;
      return this;
    };
    t.kA = function () {
      this.sourceName = null;
      this.isToModel = !0;
      return this;
    };
    function fl(a, b, c) {
      a = a.sourceName;
      return null === a || '' === a
        ? b
        : '/' === a
        ? c.part
        : '.' === a
        ? c
        : '..' === a
        ? c.panel
        : b.Xa(a);
    }
    t.ww = function (a, b, c) {
      var d = this.Pl;
      if (void 0 === c || '' === d || d === c) {
        c = this.Xl;
        var e = this.jn;
        if (null === e && '' === c)
          wa(
            'Binding error: target property is the empty string: ' +
              this.toString(),
          );
        else {
          var f = b;
          '' !== d && (f = nn(b, d));
          if (void 0 !== f)
            if (null === e) '' !== c && Rj(a, c, f);
            else
              try {
                if ('' !== c) {
                  var g = e(f, a);
                  Rj(a, c, g);
                } else e(f, a);
              } catch (h) {}
        }
      }
    };
    t.Pq = function (a, b, c, d) {
      if (this.Do === fn) {
        var e = this.Xl;
        if (void 0 === c || e === c) {
          c = this.Pl;
          var f = this.cn,
            g = a;
          '' !== e && (g = nn(a, e));
          if (void 0 !== g && !this.ou.contains(a))
            try {
              this.ou.add(a);
              var h = null !== d ? d.diagram : null,
                k = null !== h ? h.model : null;
              if (null === f)
                if ('' !== c)
                  null !== k ? k.setDataProperty(b, c, g) : Rj(b, c, g);
                else {
                  if (
                    null !== k &&
                    null !== d &&
                    0 <= d.itemIndex &&
                    null !== d.panel &&
                    Array.isArray(d.panel.itemArray)
                  ) {
                    var l = d.itemIndex,
                      m = d.panel.itemArray;
                    k.Yv(m, l);
                    k.pt(m, l, g);
                  }
                }
              else
                try {
                  if ('' !== c) {
                    var n = f(g, b, k);
                    null !== k ? k.setDataProperty(b, c, n) : Rj(b, c, n);
                  } else {
                    var p = f(g, b, k);
                    if (
                      void 0 !== p &&
                      null !== k &&
                      null !== d &&
                      0 <= d.itemIndex &&
                      null !== d.panel &&
                      Array.isArray(d.panel.itemArray)
                    ) {
                      var r = d.itemIndex,
                        q = d.panel.itemArray;
                      k.Yv(q, r);
                      k.pt(q, r, p);
                    }
                  }
                } catch (u) {}
            } finally {
              this.ou.remove(a);
            }
        }
      }
    };
    ma.Object.defineProperties(Ki.prototype, {
      fj: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.s && ua(this);
          this.l = a;
        },
      },
      targetProperty: {
        get: function () {
          return this.Xl;
        },
        set: function (a) {
          this.s && ua(this);
          this.Xl = a;
        },
      },
      sourceName: {
        get: function () {
          return this.Ls;
        },
        set: function (a) {
          this.s && ua(this);
          this.Ls = a;
          null !== a && (this.eo = !1);
        },
      },
      isToModel: {
        get: function () {
          return this.eo;
        },
        set: function (a) {
          this.s && ua(this);
          this.eo = a;
        },
      },
      sourceProperty: {
        get: function () {
          return this.Pl;
        },
        set: function (a) {
          this.s && ua(this);
          this.Pl = a;
        },
      },
      converter: {
        get: function () {
          return this.jn;
        },
        set: function (a) {
          this.s && ua(this);
          this.jn = a;
        },
      },
      backConverter: {
        get: function () {
          return this.cn;
        },
        set: function (a) {
          this.s && ua(this);
          this.cn = a;
        },
      },
      mode: {
        get: function () {
          return this.Do;
        },
        set: function (a) {
          this.s && ua(this);
          this.Do = a;
        },
      },
    });
    Ki.prototype.updateSource = Ki.prototype.Pq;
    Ki.prototype.updateTarget = Ki.prototype.ww;
    Ki.prototype.ofModel = Ki.prototype.kA;
    Ki.prototype.ofObject = Ki.prototype.zq;
    Ki.prototype.makeTwoWay = Ki.prototype.Wx;
    var $q = new D(Ki, 'OneWay', 1),
      fn = new D(Ki, 'TwoWay', 2);
    Ki.className = 'Binding';
    Ki.parseEnum = function (a, b) {
      return function (c) {
        c = $a(a, c);
        return null === c ? b : c;
      };
    };
    Ki.toString = Ja;
    Ki.OneWay = $q;
    Ki.TwoWay = fn;
    function ar(a, b) {
      Z.call(this);
      this.Tt = ',\n  "insertedLinkKeys": ';
      this.Lw = ',\n  "modifiedLinkData": ';
      this.Vt = ',\n  "removedLinkKeys": ';
      this.Mc = [];
      this.Zf = new F();
      this.pb = new G();
      this.wi = '';
      this.ij = this.Ok = this.yl = null;
      this.Te = 'from';
      this.Ue = 'to';
      this.Dj = this.Cj = '';
      this.Bj = 'category';
      this.Ld = '';
      this.Cl = 'isGroup';
      this.te = 'group';
      this.mn = !1;
      void 0 !== a && (this.nodeDataArray = a);
      void 0 !== b && (this.linkDataArray = b);
    }
    la(ar, Z);
    ar.constructGraphLinksModel = Z.constructGraphLinksModel;
    ar.prototype.cloneProtected = function (a) {
      Z.prototype.cloneProtected.call(this, a);
      a.wi = this.wi;
      a.yl = this.yl;
      a.Ok = this.Ok;
      a.Te = this.Te;
      a.Ue = this.Ue;
      a.Cj = this.Cj;
      a.Dj = this.Dj;
      a.Bj = this.Bj;
      a.Ld = this.Ld;
      a.Cl = this.Cl;
      a.te = this.te;
      a.mn = this.mn;
    };
    t = ar.prototype;
    t.clear = function () {
      Z.prototype.clear.call(this);
      this.Mc = [];
      this.pb.clear();
      this.Zf.clear();
    };
    t.toString = function (a) {
      void 0 === a && (a = 0);
      if (2 <= a) return this.Lq();
      var b = ('' !== this.name ? this.name : '') + ' GraphLinksModel';
      if (0 < a) {
        b += '\n node data:';
        a = this.nodeDataArray;
        var c = a.length,
          d;
        for (d = 0; d < c; d++) {
          var e = a[d];
          b += ' ' + this.ja(e) + ':' + Ja(e);
        }
        b += '\n link data:';
        a = this.linkDataArray;
        c = a.length;
        for (d = 0; d < c; d++)
          (e = a[d]), (b += ' ' + vq(this, e, !0) + '--\x3e' + vq(this, e, !1));
      }
      return b;
    };
    t.Aw = function (a, b) {
      var c = Z.prototype.Aw.call(this, a, b),
        d = this,
        e = new F(),
        f = new F(),
        g = new F(),
        h = this.Qh;
      a.changes.each(function (a) {
        a.model === d &&
          ('linkDataArray' === a.modelChange
            ? a.change === se
              ? e.add(a.newValue)
              : a.change === te && g.add(a.oldValue)
            : d.bd(a.object)
            ? f.add(a.object)
            : null !== a.object &&
              (null !== a.object && h && h.contains(a.object)
                ? h.get(a.object).each(function (a) {
                    d.bd(a) && f.add(a);
                  })
                : br(d, a.object).each(function (a) {
                    f.add(a);
                  })));
      });
      var k = new F();
      e.each(function (a) {
        k.add(d.Ub(a));
        b || f.add(a);
      });
      var l = new F();
      g.each(function (a) {
        l.add(d.Ub(a));
        b && f.add(a);
      });
      a = d.cloneDeep(f.na());
      0 < k.count &&
        (null === c && (c = {}),
        b ? (c.removedLinkKeys = k.na()) : (c.insertedLinkKeys = k.na()));
      0 < a.length && (null === c && (c = {}), (c.modifiedLinkData = a));
      0 < l.count &&
        (null === c && (c = {}),
        b ? (c.insertedLinkKeys = l.na()) : (c.removedLinkKeys = l.na()));
      return c;
    };
    t.Ak = function () {
      var a = Z.prototype.Ak.call(this),
        b = '';
      'category' !== this.linkCategoryProperty &&
        'string' === typeof this.linkCategoryProperty &&
        (b +=
          ',\n  "linkCategoryProperty": ' +
          this.quote(this.linkCategoryProperty));
      '' !== this.linkKeyProperty &&
        'string' === typeof this.linkKeyProperty &&
        (b += ',\n  "linkKeyProperty": ' + this.quote(this.linkKeyProperty));
      'from' !== this.linkFromKeyProperty &&
        'string' === typeof this.linkFromKeyProperty &&
        (b +=
          ',\n  "linkFromKeyProperty": ' + this.quote(this.linkFromKeyProperty));
      'to' !== this.linkToKeyProperty &&
        'string' === typeof this.linkToKeyProperty &&
        (b += ',\n  "linkToKeyProperty": ' + this.quote(this.linkToKeyProperty));
      '' !== this.linkFromPortIdProperty &&
        'string' === typeof this.linkFromPortIdProperty &&
        (b +=
          ',\n  "linkFromPortIdProperty": ' +
          this.quote(this.linkFromPortIdProperty));
      '' !== this.linkToPortIdProperty &&
        'string' === typeof this.linkToPortIdProperty &&
        (b +=
          ',\n  "linkToPortIdProperty": ' +
          this.quote(this.linkToPortIdProperty));
      '' !== this.linkLabelKeysProperty &&
        'string' === typeof this.linkLabelKeysProperty &&
        (b +=
          ',\n  "linkLabelKeysProperty": ' +
          this.quote(this.linkLabelKeysProperty));
      'isGroup' !== this.nodeIsGroupProperty &&
        'string' === typeof this.nodeIsGroupProperty &&
        (b +=
          ',\n  "nodeIsGroupProperty": ' + this.quote(this.nodeIsGroupProperty));
      'group' !== this.nodeGroupKeyProperty &&
        'string' === typeof this.nodeGroupKeyProperty &&
        (b +=
          ',\n  "nodeGroupKeyProperty": ' +
          this.quote(this.nodeGroupKeyProperty));
      return a + b;
    };
    t.Dq = function (a) {
      Z.prototype.Dq.call(this, a);
      a.linkKeyProperty && (this.linkKeyProperty = a.linkKeyProperty);
      a.linkFromKeyProperty && (this.linkFromKeyProperty = a.linkFromKeyProperty);
      a.linkToKeyProperty && (this.linkToKeyProperty = a.linkToKeyProperty);
      a.linkFromPortIdProperty &&
        (this.linkFromPortIdProperty = a.linkFromPortIdProperty);
      a.linkToPortIdProperty &&
        (this.linkToPortIdProperty = a.linkToPortIdProperty);
      a.linkCategoryProperty &&
        (this.linkCategoryProperty = a.linkCategoryProperty);
      a.linkLabelKeysProperty &&
        (this.linkLabelKeysProperty = a.linkLabelKeysProperty);
      a.nodeIsGroupProperty && (this.nodeIsGroupProperty = a.nodeIsGroupProperty);
      a.nodeGroupKeyProperty &&
        (this.nodeGroupKeyProperty = a.nodeGroupKeyProperty);
    };
    t.Bw = function () {
      var a = Z.prototype.Bw.call(this),
        b = ',\n  "linkDataArray": ' + Oq(this, this.linkDataArray, !0);
      return a + b;
    };
    t.Wv = function (a) {
      Z.prototype.Wv.call(this, a);
      a = a.linkDataArray;
      Array.isArray(a) && (this.Bm(a), (this.linkDataArray = a));
    };
    t.Qq = function (a) {
      if (!(a instanceof ar))
        return (
          B('Model.computeJsonDifference: newmodel must be a GraphLinksModel'), ''
        );
      var b = Z.prototype.Qq.call(this, a);
      Qq(this, a, 'linkKeyProperty');
      Qq(this, a, 'linkFromKeyProperty');
      Qq(this, a, 'linkToKeyProperty');
      Qq(this, a, 'linkLabelKeysProperty');
      Qq(this, a, 'nodeIsGroupProperty');
      Qq(this, a, 'nodeGroupKeyProperty');
      for (
        var c = new F(),
          d = new F(),
          e = new F().addAll(this.pb.iteratorKeys),
          f = new G(),
          g = a.linkDataArray,
          h = g.length,
          k = 0;
        k < h;
        k++
      ) {
        var l = g[k],
          m = a.Ub(l);
        if (void 0 !== m) {
          e.remove(m);
          var n = this.zg(m);
          null === n ? (c.add(m), d.add(l)) : Pq(this, n, l, f) || d.add(l);
        } else this.wq(l), (m = this.Ub(l)), c.add(m), d.add(l);
      }
      a = b;
      0 < c.count && (a += this.Tt + Oq(this, c.na(), !0));
      0 < d.count && (a += this.Lw + Oq(this, d.na(), !0));
      0 < e.count && (a += this.Vt + Oq(this, e.na(), !0));
      return a;
    };
    function br(a, b) {
      for (var c = new F(), d = 0; d < a.linkDataArray.length; d++) {
        var e = a.linkDataArray[d];
        Sq(a, b, e, e, c);
      }
      return c;
    }
    t.zw = function (a, b) {
      var c = Z.prototype.zw.call(this, a, b),
        d = this,
        e = new F(),
        f = new F(),
        g = new F(),
        h = this.Qh;
      a.changes.each(function (a) {
        a.model === d &&
          ('linkDataArray' === a.modelChange
            ? a.change === se
              ? e.add(a.newValue)
              : a.change === te && g.add(a.oldValue)
            : d.bd(a.object)
            ? f.add(a.object)
            : null !== a.object &&
              (null !== a.object && h && h.contains(a.object)
                ? h.get(a.object).each(function (a) {
                    d.bd(a) && f.add(a);
                  })
                : br(d, a.object).each(function (a) {
                    f.add(a);
                  })));
      });
      var k = new F();
      e.each(function (a) {
        k.add(d.Ub(a));
        b || f.add(a);
      });
      var l = new F();
      g.each(function (a) {
        l.add(d.Ub(a));
        b && f.add(a);
      });
      a = c;
      0 < k.count && (a += (b ? this.Vt : this.Tt) + Oq(this, k.na(), !0));
      0 < f.count && (a += this.Lw + Oq(this, f.na(), !0));
      0 < l.count && (a += (b ? this.Tt : this.Vt) + Oq(this, l.na(), !0));
      return a;
    };
    t.Cq = function (a) {
      ((void 0 !== a.linkCategoryProperty &&
        a.linkCategoryProperty !== this.linkCategoryProperty) ||
        (void 0 !== a.linkKeyProperty &&
          a.linkKeyProperty !== this.linkKeyProperty) ||
        (void 0 !== a.linkFromKeyProperty &&
          a.linkFromKeyProperty !== this.linkFromKeyProperty) ||
        (void 0 !== a.linkToKeyProperty &&
          a.linkToKeyProperty !== this.linkToKeyProperty) ||
        (void 0 !== a.linkFromPortIdProperty &&
          a.linkFromPortIdProperty !== this.linkFromPortIdProperty) ||
        (void 0 !== a.linkToPortIdProperty &&
          a.linkToPortIdProperty !== this.linkToPortIdProperty) ||
        (void 0 !== a.linkLabelKeysProperty &&
          a.linkLabelKeysProperty !== this.linkLabelKeysProperty) ||
        (void 0 !== a.nodeIsGroupProperty &&
          a.nodeIsGroupProperty !== this.nodeIsGroupProperty) ||
        (void 0 !== a.nodeGroupKeyProperty &&
          a.nodeGroupKeyProperty !== this.nodeGroupKeyProperty)) &&
        B('applyIncrementalJson cannot change Model properties');
      Z.prototype.Cq.call(this, a);
      var b = a.insertedLinkKeys;
      if (Array.isArray(b))
        for (var c = b.length, d = 0; d < c; d++) {
          var e = b[d],
            f = this.zg(e);
          null === f && ((f = this.gq({})), this.Nt(f, e), this.Ni(f));
        }
      b = a.modifiedLinkData;
      if (Array.isArray(b))
        for (c = b.length, d = 0; d < c; d++)
          if (((e = b[d]), (f = this.Ub(e)), (f = this.zg(f)), null !== f))
            for (var g in e)
              '__gohashid' !== g &&
                g !== this.linkKeyProperty &&
                this.setDataProperty(f, g, e[g]);
      a = a.removedLinkKeys;
      if (Array.isArray(a))
        for (g = a.length, b = 0; b < g; b++)
          (c = this.zg(a[b])), null !== c && this.zm(c);
    };
    t.Yj = function (a, b) {
      if (a.change === se) {
        var c = a.newParam;
        if ('linkDataArray' === a.modelChange) {
          a = a.newValue;
          if (za(a) && 'number' === typeof c) {
            var d = this.Ub(a);
            b
              ? (this.Zf.remove(a),
                this.Mc[c] === a && this.Mc.splice(c, 1),
                void 0 !== d && this.pb.remove(d))
              : (this.Zf.add(a),
                this.Mc[c] !== a && this.Mc.splice(c, 0, a),
                void 0 !== d && this.pb.add(d, a));
          }
          return;
        }
        if ('linkLabelKeys' === a.modelChange) {
          d = this.Cg(a.object);
          Array.isArray(d) &&
            'number' === typeof c &&
            (b
              ? ((c = d.indexOf(a.newValue)), 0 <= c && d.splice(c, 1))
              : 0 > d.indexOf(a.newValue) && d.splice(c, 0, a.newValue));
          return;
        }
      } else if (a.change === te) {
        c = a.oldParam;
        if ('linkDataArray' === a.modelChange) {
          a = a.oldValue;
          za(a) &&
            'number' === typeof c &&
            ((d = this.Ub(a)),
            b
              ? (this.Zf.add(a),
                this.Mc[c] !== a && this.Mc.splice(c, 0, a),
                void 0 !== d && this.pb.add(d, a))
              : (this.Zf.remove(a),
                this.Mc[c] === a && this.Mc.splice(c, 1),
                void 0 !== d && this.pb.remove(d)));
          return;
        }
        if ('linkLabelKeys' === a.modelChange) {
          d = this.Cg(a.object);
          Array.isArray(d) &&
            'number' === typeof c &&
            (b
              ? 0 > d.indexOf(a.newValue) && d.splice(c, 0, a.newValue)
              : ((c = d.indexOf(a.newValue)), 0 <= c && d.splice(c, 1)));
          return;
        }
      }
      Z.prototype.Yj.call(this, a, b);
    };
    t.rm = function (a) {
      if (void 0 !== a) {
        var b = this.ij;
        if (null !== b) {
          var c = this.Jb(a);
          null === c &&
            ((c = this.copyNodeData(b)),
            Rj(c, this.nodeKeyProperty, a),
            this.mf(c));
        }
        return a;
      }
    };
    t.Ez = function (a) {
      return vq(this, a, !0);
    };
    t.jy = function (a, b) {
      Dq(this, a, b, !0);
    };
    t.Kz = function (a) {
      return vq(this, a, !1);
    };
    t.ny = function (a, b) {
      Dq(this, a, b, !1);
    };
    function vq(a, b, c) {
      if (
        null !== b &&
        ((a = c ? a.Te : a.Ue), '' !== a && ((a = nn(b, a)), void 0 !== a))
      ) {
        if (xq(a)) return a;
        B(
          (c ? 'FromKey' : 'ToKey') +
            ' value for link data ' +
            b +
            ' is not a number or a string: ' +
            a,
        );
      }
    }
    function Dq(a, b, c, d) {
      null === c && (c = void 0);
      if (null !== b) {
        var e = d ? a.Te : a.Ue;
        if ('' !== e)
          if (((c = a.rm(c)), a.bd(b))) {
            var f = nn(b, e);
            f !== c &&
              (Bq(a, f, b),
              Rj(b, e, c),
              null === a.Jb(c) && Cq(a, c, b),
              Wq(a, d ? 'linkFromKey' : 'linkToKey', qe, e, b, f, c),
              'string' === typeof e && a.Aa(b, e));
          } else Rj(b, e, c);
      }
    }
    t.Fz = function (a) {
      return uq(this, a, !0);
    };
    t.ky = function (a, b) {
      Eq(this, a, b, !0);
    };
    t.Lz = function (a) {
      return uq(this, a, !1);
    };
    t.oy = function (a, b) {
      Eq(this, a, b, !1);
    };
    function uq(a, b, c) {
      if (null === b) return '';
      a = c ? a.Cj : a.Dj;
      if ('' === a) return '';
      b = nn(b, a);
      return void 0 === b ? '' : b;
    }
    function Eq(a, b, c, d) {
      if (null !== b) {
        var e = d ? a.Cj : a.Dj;
        if ('' !== e)
          if (a.bd(b)) {
            var f = nn(b, e);
            void 0 === f && (f = '');
            f !== c &&
              (Rj(b, e, c),
              Wq(a, d ? 'linkFromPortId' : 'linkToPortId', qe, e, b, f, c),
              'string' === typeof e && a.Aa(b, e));
          } else Rj(b, e, c);
      }
    }
    t.Cg = function (a) {
      if (null === a) return cr;
      var b = this.Ld;
      if ('' === b) return cr;
      a = nn(a, b);
      return void 0 === a ? cr : a;
    };
    t.gw = function (a, b) {
      if (null !== a) {
        var c = this.Ld;
        if ('' !== c)
          if (this.bd(a)) {
            var d = nn(a, c);
            void 0 === d && (d = cr);
            if (d !== b) {
              if (Array.isArray(d))
                for (var e = d.length, f = 0; f < e; f++) Bq(this, d[f], a);
              Rj(a, c, b);
              e = b.length;
              for (f = 0; f < e; f++) {
                var g = b[f];
                null === this.Jb(g) && Cq(this, g, a);
              }
              Wq(this, 'linkLabelKeys', qe, c, a, d, b);
              'string' === typeof c && this.Aa(a, c);
            }
          } else Rj(a, c, b);
      }
    };
    t.ev = function (a, b) {
      if (null !== b && void 0 !== b && null !== a) {
        var c = this.Ld;
        if ('' !== c) {
          var d = nn(a, c);
          if (void 0 === d) (c = []), c.push(b), this.gw(a, c);
          else if (Array.isArray(d)) {
            var e = d.indexOf(b);
            0 <= e ||
              ((e = d.length),
              d.push(b),
              this.bd(a) &&
                (null === this.Jb(b) && Cq(this, b, a),
                Wq(this, 'linkLabelKeys', se, c, a, null, b, null, e)));
          } else
            B(
              c +
                ' property is not an Array; cannot addLabelKeyForLinkData: ' +
                a,
            );
        }
      }
    };
    t.by = function (a, b) {
      if (null !== b && void 0 !== b && null !== a) {
        var c = this.Ld;
        if ('' !== c) {
          var d = nn(a, c);
          if (Array.isArray(d)) {
            var e = d.indexOf(b);
            0 > e ||
              (d.splice(e, 1),
              this.bd(a) &&
                (Bq(this, b, a),
                Wq(this, 'linkLabelKeys', te, c, a, b, null, e, null)));
          } else
            void 0 !== d &&
              B(
                c +
                  ' property is not an Array; cannot removeLabelKeyforLinkData: ' +
                  a,
              );
        }
      }
    };
    t.Ub = function (a) {
      if (null !== a) {
        var b = this.wi;
        if ('' !== b && ((b = nn(a, b)), void 0 !== b)) {
          if (xq(b)) return b;
          B(
            'Key value for link data ' + a + ' is not a number or a string: ' + b,
          );
        }
      }
    };
    t.Nt = function (a, b) {
      if (null !== a) {
        var c = this.wi;
        if ('' !== c)
          if (this.bd(a)) {
            var d = nn(a, c);
            d !== b &&
              null === this.zg(b) &&
              (Rj(a, c, b),
              void 0 !== d && this.pb.remove(d),
              this.pb.add(b, a),
              Wq(this, 'linkKey', qe, c, a, d, b),
              'string' === typeof c && this.Aa(a, c));
          } else Rj(a, c, b);
      }
    };
    t.zg = function (a) {
      null === a && B('GraphLinksModel.findLinkDataForKey:key must not be null');
      return void 0 !== a && xq(a) ? this.pb.H(a) : null;
    };
    t.wq = function (a) {
      if (null !== a) {
        var b = this.wi;
        if ('' !== b) {
          var c = this.Ub(a);
          if (void 0 === c || this.pb.contains(c)) {
            var d = this.yl;
            if (
              null !== d &&
              ((c = d(this, a)),
              void 0 !== c && null !== c && !this.pb.contains(c))
            ) {
              Rj(a, b, c);
              return;
            }
            if ('string' === typeof c) {
              for (d = 2; this.pb.contains(c + d); ) d++;
              Rj(a, b, c + d);
            } else if (void 0 === c || 'number' === typeof c) {
              for (c = -this.pb.count - 1; this.pb.contains(c); ) c--;
              Rj(a, b, c);
            }
          }
        }
      }
    };
    t.bd = function (a) {
      return null === a ? !1 : this.Zf.contains(a);
    };
    t.Ni = function (a) {
      null !== a && (ob(a), this.bd(a) || zq(this, a, !0));
    };
    function zq(a, b, c) {
      if ('' !== a.linkKeyProperty) {
        var d = a.Ub(b);
        if (void 0 !== d && a.pb.H(d) === b) return;
        a.wq(b);
        d = a.Ub(b);
        if (void 0 === d) {
          B(
            'GraphLinksModel.makeLinkDataKeyUnique failed on ' +
              b +
              '. Data not added to model.',
          );
          return;
        }
        a.pb.add(d, b);
      }
      a.Zf.add(b);
      d = null;
      c && ((d = a.Mc.length), a.Mc.splice(d, 0, b));
      Wq(a, 'linkDataArray', se, 'linkDataArray', a, null, b, null, d);
      dr(a, b);
    }
    t.Ky = function (a) {
      if (Array.isArray(a))
        for (var b = a.length, c = 0; c < b; c++) this.Ni(a[c]);
      else for (a = a.iterator; a.next(); ) this.Ni(a.value);
    };
    t.zm = function (a) {
      null !== a && yq(this, a, !0);
    };
    function yq(a, b, c) {
      a.Zf.remove(b);
      var d = a.Ub(b);
      void 0 !== d && a.pb.remove(d);
      d = null;
      if (c) {
        d = a.Mc.indexOf(b);
        if (0 > d) return;
        a.Mc.splice(d, 1);
      }
      Wq(a, 'linkDataArray', te, 'linkDataArray', a, b, null, d, null);
      c = vq(a, b, !0);
      Bq(a, c, b);
      c = vq(a, b, !1);
      Bq(a, c, b);
      d = a.Cg(b);
      if (Array.isArray(d))
        for (var e = d.length, f = 0; f < e; f++) (c = d[f]), Bq(a, c, b);
    }
    t.pA = function (a) {
      if (Array.isArray(a))
        for (var b = a.length, c = 0; c < b; c++) this.zm(a[c]);
      else for (a = a.iterator; a.next(); ) this.zm(a.value);
    };
    t.hA = function (a) {
      if (Aa(a)) {
        for (
          var b = new F(this.pb.iteratorKeys), c = new F(), d = a.length, e = 0;
          e < d;
          e++
        ) {
          var f = a[e],
            g = this.Ub(f);
          if (void 0 !== g) {
            c.add(g);
            var h = this.zg(g);
            null !== h
              ? this.Xj(h, f)
              : ((h = {}), this.Nt(h, g), this.Xj(h, f), this.Ni(h));
          } else this.Ni(f), c.add(this.Ub(f));
        }
        for (a = b.iterator; a.next(); )
          (b = a.value), c.contains(b) || ((b = this.zg(b)) && this.zm(b));
        this.fq();
      }
    };
    function dr(a, b) {
      var c = vq(a, b, !0);
      c = a.rm(c);
      null === a.Jb(c) && Cq(a, c, b);
      c = vq(a, b, !1);
      c = a.rm(c);
      null === a.Jb(c) && Cq(a, c, b);
      var d = a.Cg(b);
      if (Array.isArray(d))
        for (var e = d.length, f = 0; f < e; f++)
          (c = d[f]), null === a.Jb(c) && Cq(a, c, b);
    }
    t.gq = function (a) {
      if (null === a) return null;
      var b = this.Ok;
      a = null !== b ? b(a, this) : Xq(this, a, !0);
      za(a) &&
        (Za(a),
        '' !== this.Te && Rj(a, this.Te, void 0),
        '' !== this.Ue && Rj(a, this.Ue, void 0),
        '' !== this.Ld && Rj(a, this.Ld, []));
      return a;
    };
    t.Kv = function (a) {
      if (null === a) return !1;
      var b = this.Cl;
      return '' === b ? !1 : nn(a, b) ? !0 : !1;
    };
    t.Xi = function (a) {
      if (null !== a) {
        var b = this.te;
        if ('' !== b && ((b = nn(a, b)), void 0 !== b)) {
          if (xq(b)) return b;
          B(
            'GroupKey value for node data ' +
              a +
              ' is not a number or a string: ' +
              b,
          );
        }
      }
    };
    t.Mt = function (a, b) {
      null === b && (b = void 0);
      if (null !== a) {
        var c = this.te;
        if ('' !== c)
          if (this.sb(a)) {
            var d = nn(a, c);
            d !== b &&
              (Bq(this, d, a),
              Rj(a, c, b),
              null === this.Jb(b) && Cq(this, b, a),
              Wq(this, 'nodeGroupKey', qe, c, a, d, b),
              'string' === typeof c && this.Aa(a, c));
          } else Rj(a, c, b);
      }
    };
    ar.prototype.copyNodeData = function (a) {
      if (null === a) return null;
      a = Z.prototype.copyNodeData.call(this, a);
      this.bk ||
        '' === this.te ||
        void 0 === nn(a, this.te) ||
        Rj(a, this.te, void 0);
      return a;
    };
    ar.prototype.setDataProperty = function (a, b, c) {
      if (this.sb(a))
        if (b === this.nodeKeyProperty) this.Hm(a, c);
        else {
          if (b === this.nodeCategoryProperty) {
            this.Iq(a, c);
            return;
          }
          if (b === this.nodeGroupKeyProperty) {
            this.Mt(a, c);
            return;
          }
        }
      else if (this.bd(a)) {
        if (b === this.linkFromKeyProperty) {
          Dq(this, a, c, !0);
          return;
        }
        if (b === this.linkToKeyProperty) {
          Dq(this, a, c, !1);
          return;
        }
        if (b === this.linkFromPortIdProperty) {
          Eq(this, a, c, !0);
          return;
        }
        if (b === this.linkToPortIdProperty) {
          Eq(this, a, c, !1);
          return;
        }
        if (b === this.linkKeyProperty) {
          this.Nt(a, c);
          return;
        }
        if (b === this.linkCategoryProperty) {
          this.Lt(a, c);
          return;
        }
        if (b === this.linkLabelKeysProperty) {
          this.gw(a, c);
          return;
        }
      }
      var d = nn(a, b);
      d !== c && (Rj(a, b, c), this.Ft(a, b, d, c));
    };
    t = ar.prototype;
    t.Xj = function (a, b) {
      if (b) {
        var c = this.sb(a),
          d = this.bd(a),
          e;
        for (e in b)
          '__gohashid' === e ||
            (c && e === this.nodeKeyProperty) ||
            (c && e === this.nodeIsGroupProperty && nn(a, e) === b[e]) ||
            (d && e === this.linkKeyProperty) ||
            this.setDataProperty(a, e, b[e]);
      }
    };
    t.Gq = function (a, b) {
      Z.prototype.Gq.call(this, a, b);
      for (var c = this.$a.iterator; c.next(); ) this.bw(c.value, a, b);
      for (c = this.Zf.iterator; c.next(); ) {
        var d = c.value,
          e = a,
          f = b;
        if (vq(this, d, !0) === e) {
          var g = this.Te;
          Rj(d, g, f);
          Wq(this, 'linkFromKey', qe, g, d, e, f);
          'string' === typeof g && this.Aa(d, g);
        }
        vq(this, d, !1) === e &&
          ((g = this.Ue),
          Rj(d, g, f),
          Wq(this, 'linkToKey', qe, g, d, e, f),
          'string' === typeof g && this.Aa(d, g));
        g = this.Cg(d);
        if (Array.isArray(g))
          for (var h = g.length, k = this.Ld, l = 0; l < h; l++)
            g[l] === e &&
              ((g[l] = f), Wq(this, 'linkLabelKeys', se, k, d, e, f, l, l));
      }
    };
    t.bw = function (a, b, c) {
      if (this.Xi(a) === b) {
        var d = this.te;
        Rj(a, d, c);
        Wq(this, 'nodeGroupKey', qe, d, a, b, c);
        'string' === typeof d && this.Aa(a, d);
      }
    };
    t.vw = function () {
      Z.prototype.vw.call(this);
      for (var a = this.linkDataArray, b = a.length, c = 0; c < b; c++)
        dr(this, a[c]);
    };
    t.Dm = function (a) {
      Z.prototype.Dm.call(this, a);
      a = this.ja(a);
      var b = Aq(this, a);
      if (null !== b) {
        var c = Ea();
        for (b = b.iterator; b.next(); ) {
          var d = b.value;
          if (this.sb(d)) {
            if (this.Xi(d) === a) {
              var e = this.te;
              Wq(this, 'nodeGroupKey', qe, e, d, a, a);
              'string' === typeof e && this.Aa(d, e);
              c.push(d);
            }
          } else if (
            (vq(this, d, !0) === a &&
              ((e = this.Te),
              Wq(this, 'linkFromKey', qe, e, d, a, a),
              'string' === typeof e && this.Aa(d, e),
              c.push(d)),
            vq(this, d, !1) === a &&
              ((e = this.Ue),
              Wq(this, 'linkToKey', qe, e, d, a, a),
              'string' === typeof e && this.Aa(d, e),
              c.push(d)),
            (e = this.Cg(d)),
            Array.isArray(e))
          )
            for (var f = e.length, g = this.Ld, h = 0; h < f; h++)
              e[h] === a &&
                (Wq(this, 'linkLabelKeys', se, g, d, a, a, h, h), c.push(d));
        }
        for (b = 0; b < c.length; b++) Bq(this, a, c[b]);
        Ha(c);
      }
    };
    t.Cm = function (a) {
      Z.prototype.Cm.call(this, a);
      var b = this.Xi(a);
      null === this.Jb(b) && Cq(this, b, a);
    };
    t.Nq = function (a) {
      Z.prototype.Nq.call(this, a);
      var b = this.Xi(a);
      Bq(this, b, a);
    };
    t.zv = function (a) {
      if (null === a) return '';
      var b = this.Bj;
      if ('' === b) return '';
      b = nn(a, b);
      if (void 0 === b) return '';
      if ('string' === typeof b) return b;
      B('getCategoryForLinkData found a non-string category for ' + a + ': ' + b);
      return '';
    };
    ar.prototype.getLinkCategoryForData = function (a) {
      return this.zv(a);
    };
    ar.prototype.Lt = function (a, b) {
      if (null !== a) {
        var c = this.Bj;
        if ('' !== c)
          if (this.bd(a)) {
            var d = nn(a, c);
            void 0 === d && (d = '');
            d !== b &&
              (Rj(a, c, b),
              Wq(this, 'linkCategory', qe, c, a, d, b),
              'string' === typeof c && this.Aa(a, c));
          } else Rj(a, c, b);
      }
    };
    ar.prototype.setLinkCategoryForData = function (a, b) {
      this.Lt(a, b);
    };
    ar.prototype.jk = function () {
      return !0;
    };
    ar.prototype.pm = function () {
      return !0;
    };
    ar.prototype.vt = function () {
      return !0;
    };
    ar.prototype.kk = function () {
      return !0;
    };
    ma.Object.defineProperties(ar.prototype, {
      archetypeNodeData: {
        get: function () {
          return this.ij;
        },
        set: function (a) {
          var b = this.ij;
          b !== a && ((this.ij = a), this.g('archetypeNodeData', b, a));
        },
      },
      linkFromKeyProperty: {
        get: function () {
          return this.Te;
        },
        set: function (a) {
          var b = this.Te;
          b !== a && ((this.Te = a), this.g('linkFromKeyProperty', b, a));
        },
      },
      linkToKeyProperty: {
        get: function () {
          return this.Ue;
        },
        set: function (a) {
          var b = this.Ue;
          b !== a && ((this.Ue = a), this.g('linkToKeyProperty', b, a));
        },
      },
      linkFromPortIdProperty: {
        get: function () {
          return this.Cj;
        },
        set: function (a) {
          var b = this.Cj;
          b !== a && ((this.Cj = a), this.g('linkFromPortIdProperty', b, a));
        },
      },
      linkToPortIdProperty: {
        get: function () {
          return this.Dj;
        },
        set: function (a) {
          var b = this.Dj;
          b !== a && ((this.Dj = a), this.g('linkToPortIdProperty', b, a));
        },
      },
      linkLabelKeysProperty: {
        get: function () {
          return this.Ld;
        },
        set: function (a) {
          var b = this.Ld;
          b !== a && ((this.Ld = a), this.g('linkLabelKeysProperty', b, a));
        },
      },
      linkDataArray: {
        get: function () {
          return this.Mc;
        },
        set: function (a) {
          var b = this.Mc;
          if (b !== a) {
            this.pb.clear();
            for (var c = a.length, d = 0; d < c; d++) {
              var e = a[d];
              if (!za(e)) {
                B(
                  'GraphLinksModel.linkDataArray must only contain Objects, not: ' +
                    e,
                );
                return;
              }
              ob(e);
            }
            this.Mc = a;
            if ('' !== this.linkKeyProperty) {
              d = new E();
              for (e = 0; e < c; e++) {
                var f = a[e],
                  g = this.Ub(f);
                void 0 === g
                  ? d.add(f)
                  : null !== this.pb.H(g)
                  ? d.add(f)
                  : this.pb.add(g, f);
              }
              for (d = d.iterator; d.next(); )
                (e = d.value),
                  this.wq(e),
                  (f = this.Ub(e)),
                  void 0 !== f && this.pb.add(f, e);
            }
            d = new F();
            for (e = 0; e < c; e++) d.add(a[e]);
            this.Zf = d;
            Wq(this, 'linkDataArray', qe, 'linkDataArray', this, b, a);
            for (b = 0; b < c; b++) dr(this, a[b]);
          }
        },
      },
      linkKeyProperty: {
        get: function () {
          return this.wi;
        },
        set: function (a) {
          var b = this.wi;
          if (b !== a) {
            this.wi = a;
            this.pb.clear();
            for (var c = this.linkDataArray.length, d = 0; d < c; d++) {
              var e = this.linkDataArray[d],
                f = this.Ub(e);
              void 0 === f && (this.wq(e), (f = this.Ub(e)));
              void 0 !== f && this.pb.add(f, e);
            }
            this.g('linkKeyProperty', b, a);
          }
        },
      },
      makeUniqueLinkKeyFunction: {
        get: function () {
          return this.yl;
        },
        set: function (a) {
          var b = this.yl;
          b !== a && ((this.yl = a), this.g('makeUniqueLinkKeyFunction', b, a));
        },
      },
      copyLinkDataFunction: {
        get: function () {
          return this.Ok;
        },
        set: function (a) {
          var b = this.Ok;
          b !== a && ((this.Ok = a), this.g('copyLinkDataFunction', b, a));
        },
      },
      nodeIsGroupProperty: {
        get: function () {
          return this.Cl;
        },
        set: function (a) {
          var b = this.Cl;
          b !== a && ((this.Cl = a), this.g('nodeIsGroupProperty', b, a));
        },
      },
      nodeGroupKeyProperty: {
        get: function () {
          return this.te;
        },
        set: function (a) {
          var b = this.te;
          b !== a && ((this.te = a), this.g('nodeGroupKeyProperty', b, a));
        },
      },
      bk: {
        get: function () {
          return this.mn;
        },
        set: function (a) {
          this.mn !== a && (this.mn = a);
        },
      },
      linkCategoryProperty: {
        get: function () {
          return this.Bj;
        },
        set: function (a) {
          var b = this.Bj;
          b !== a && ((this.Bj = a), this.g('linkCategoryProperty', b, a));
        },
      },
    });
    ma.Object.defineProperties(ar, {
      type: {
        get: function () {
          return 'GraphLinksModel';
        },
      },
    });
    ar.prototype.setCategoryForLinkData = ar.prototype.Lt;
    ar.prototype.getCategoryForLinkData = ar.prototype.zv;
    ar.prototype.assignAllDataProperties = ar.prototype.Xj;
    ar.prototype.setGroupKeyForNodeData = ar.prototype.Mt;
    ar.prototype.getGroupKeyForNodeData = ar.prototype.Xi;
    ar.prototype.isGroupForNodeData = ar.prototype.Kv;
    ar.prototype.copyLinkData = ar.prototype.gq;
    ar.prototype.mergeLinkDataArray = ar.prototype.hA;
    ar.prototype.removeLinkDataCollection = ar.prototype.pA;
    ar.prototype.removeLinkData = ar.prototype.zm;
    ar.prototype.addLinkDataCollection = ar.prototype.Ky;
    ar.prototype.addLinkData = ar.prototype.Ni;
    ar.prototype.containsLinkData = ar.prototype.bd;
    ar.prototype.makeLinkDataKeyUnique = ar.prototype.wq;
    ar.prototype.findLinkDataForKey = ar.prototype.zg;
    ar.prototype.setKeyForLinkData = ar.prototype.Nt;
    ar.prototype.getKeyForLinkData = ar.prototype.Ub;
    ar.prototype.removeLabelKeyForLinkData = ar.prototype.by;
    ar.prototype.addLabelKeyForLinkData = ar.prototype.ev;
    ar.prototype.setLabelKeysForLinkData = ar.prototype.gw;
    ar.prototype.getLabelKeysForLinkData = ar.prototype.Cg;
    ar.prototype.setToPortIdForLinkData = ar.prototype.oy;
    ar.prototype.getToPortIdForLinkData = ar.prototype.Lz;
    ar.prototype.setFromPortIdForLinkData = ar.prototype.ky;
    ar.prototype.getFromPortIdForLinkData = ar.prototype.Fz;
    ar.prototype.setToKeyForLinkData = ar.prototype.ny;
    ar.prototype.getToKeyForLinkData = ar.prototype.Kz;
    ar.prototype.setFromKeyForLinkData = ar.prototype.jy;
    ar.prototype.getFromKeyForLinkData = ar.prototype.Ez;
    ar.prototype.clear = ar.prototype.clear;
    var cr = Object.freeze([]);
    ar.className = 'GraphLinksModel';
    Zq.GraphLinksModel = ar;
    Z.constructGraphLinksModel = Z.constructGraphLinksModel = function () {
      return new ar();
    };
    Z.initDiagramModel = Bi = function () {
      return new ar();
    };
    function er(a) {
      Z.call(this);
      this.ue = 'parent';
      this.on = !1;
      this.Ij = 'parentLinkCategory';
      void 0 !== a && (this.nodeDataArray = a);
    }
    la(er, Z);
    er.constructGraphLinksModel = Z.constructGraphLinksModel;
    er.prototype.cloneProtected = function (a) {
      Z.prototype.cloneProtected.call(this, a);
      a.ue = this.ue;
      a.on = this.on;
      a.Ij = this.Ij;
    };
    t = er.prototype;
    t.toString = function (a) {
      void 0 === a && (a = 0);
      if (2 <= a) return this.Lq();
      var b = ('' !== this.name ? this.name : '') + ' TreeModel';
      if (0 < a) {
        b += '\n node data:';
        a = this.nodeDataArray;
        for (var c = a.length, d = 0; d < c; d++) {
          var e = a[d];
          b += ' ' + this.ja(e) + ':' + Ja(e);
        }
      }
      return b;
    };
    t.Ak = function () {
      var a = Z.prototype.Ak.call(this),
        b = '';
      'parent' !== this.nodeParentKeyProperty &&
        'string' === typeof this.nodeParentKeyProperty &&
        (b +=
          ',\n  "nodeParentKeyProperty": ' +
          this.quote(this.nodeParentKeyProperty));
      return a + b;
    };
    t.Dq = function (a) {
      Z.prototype.Dq.call(this, a);
      a.nodeParentKeyProperty &&
        (this.nodeParentKeyProperty = a.nodeParentKeyProperty);
    };
    t.Qq = function (a) {
      Qq(this, a, 'nodeParentKeyProperty');
      return Z.prototype.Qq.call(this, a);
    };
    t.Cq = function (a) {
      void 0 !== a.nodeParentKeyProperty &&
        a.nodeParentKeyProperty !== this.nodeParentKeyProperty &&
        B('applyIncrementalJson cannot change Model properties');
      Z.prototype.Cq.call(this, a);
    };
    t.rm = function (a) {
      return a;
    };
    t.Zi = function (a) {
      if (null !== a) {
        var b = this.ue;
        if ('' !== b && ((b = nn(a, b)), void 0 !== b)) {
          if (xq(b)) return b;
          B(
            'ParentKey value for node data ' +
              a +
              ' is not a number or a string: ' +
              b,
          );
        }
      }
    };
    t.Fe = function (a, b) {
      null === b && (b = void 0);
      if (null !== a) {
        var c = this.ue;
        if ('' !== c)
          if (((b = this.rm(b)), this.sb(a))) {
            var d = nn(a, c);
            d !== b &&
              (Bq(this, d, a),
              Rj(a, c, b),
              null === this.Jb(b) && Cq(this, b, a),
              Wq(this, 'nodeParentKey', qe, c, a, d, b),
              'string' === typeof c && this.Aa(a, c));
          } else Rj(a, c, b);
      }
    };
    t.Av = function (a) {
      if (null === a) return '';
      var b = this.Ij;
      if ('' === b) return '';
      b = nn(a, b);
      if (void 0 === b) return '';
      if ('string' === typeof b) return b;
      B(
        'getParentLinkCategoryForNodeData found a non-string category for ' +
          a +
          ': ' +
          b,
      );
      return '';
    };
    er.prototype.getLinkCategoryForData = function (a) {
      return this.Av(a);
    };
    er.prototype.hw = function (a, b) {
      if (null !== a) {
        var c = this.Ij;
        if ('' !== c)
          if (this.sb(a)) {
            var d = nn(a, c);
            void 0 === d && (d = '');
            d !== b &&
              (Rj(a, c, b),
              Wq(this, 'parentLinkCategory', qe, c, a, d, b),
              'string' === typeof c && this.Aa(a, c));
          } else Rj(a, c, b);
      }
    };
    er.prototype.setLinkCategoryForData = function (a, b) {
      this.hw(a, b);
    };
    er.prototype.copyNodeData = function (a) {
      if (null === a) return null;
      a = Z.prototype.copyNodeData.call(this, a);
      this.ck ||
        '' === this.ue ||
        void 0 === nn(a, this.ue) ||
        Rj(a, this.ue, void 0);
      return a;
    };
    er.prototype.setDataProperty = function (a, b, c) {
      if (this.sb(a))
        if (b === this.nodeKeyProperty) this.Hm(a, c);
        else {
          if (b === this.nodeCategoryProperty) {
            this.Iq(a, c);
            return;
          }
          if (b === this.nodeParentKeyProperty) {
            this.Fe(a, c);
            return;
          }
        }
      var d = nn(a, b);
      d !== c && (Rj(a, b, c), this.Ft(a, b, d, c));
    };
    t = er.prototype;
    t.Gq = function (a, b) {
      Z.prototype.Gq.call(this, a, b);
      for (var c = this.$a.iterator; c.next(); ) this.bw(c.value, a, b);
    };
    t.bw = function (a, b, c) {
      if (this.Zi(a) === b) {
        var d = this.ue;
        Rj(a, d, c);
        Wq(this, 'nodeParentKey', qe, d, a, b, c);
        'string' === typeof d && this.Aa(a, d);
      }
    };
    t.Dm = function (a) {
      Z.prototype.Dm.call(this, a);
      a = this.ja(a);
      var b = Aq(this, a);
      if (null !== b) {
        var c = Ea();
        for (b = b.iterator; b.next(); ) {
          var d = b.value;
          if (this.sb(d) && this.Zi(d) === a) {
            var e = this.ue;
            Wq(this, 'nodeParentKey', qe, e, d, a, a);
            'string' === typeof e && this.Aa(d, e);
            c.push(d);
          }
        }
        for (b = 0; b < c.length; b++) Bq(this, a, c[b]);
        Ha(c);
      }
    };
    t.Cm = function (a) {
      Z.prototype.Cm.call(this, a);
      var b = this.Zi(a);
      b = this.rm(b);
      null === this.Jb(b) && Cq(this, b, a);
    };
    t.Nq = function (a) {
      Z.prototype.Nq.call(this, a);
      var b = this.Zi(a);
      Bq(this, b, a);
    };
    t.qm = function () {
      return !0;
    };
    t.vt = function () {
      return !0;
    };
    ma.Object.defineProperties(er.prototype, {
      nodeParentKeyProperty: {
        get: function () {
          return this.ue;
        },
        set: function (a) {
          var b = this.ue;
          b !== a && ((this.ue = a), this.g('nodeParentKeyProperty', b, a));
        },
      },
      ck: {
        get: function () {
          return this.on;
        },
        set: function (a) {
          this.on !== a && (this.on = a);
        },
      },
      parentLinkCategoryProperty: {
        get: function () {
          return this.Ij;
        },
        set: function (a) {
          var b = this.Ij;
          b !== a && ((this.Ij = a), this.g('parentLinkCategoryProperty', b, a));
        },
      },
      linkCategoryProperty: {
        get: function () {
          return this.parentLinkCategoryProperty;
        },
        set: function (a) {
          this.parentLinkCategoryProperty = a;
        },
      },
    });
    ma.Object.defineProperties(er, {
      type: {
        get: function () {
          return 'TreeModel';
        },
      },
    });
    er.prototype.setParentLinkCategoryForNodeData = er.prototype.hw;
    er.prototype.getParentLinkCategoryForNodeData = er.prototype.Av;
    er.prototype.setParentKeyForNodeData = er.prototype.Fe;
    er.prototype.getParentKeyForNodeData = er.prototype.Zi;
    er.className = 'TreeModel';
    Zq.TreeModel = er;
    function fr() {
      Di.call(this);
      this.Ww = this.Cn = this.ac = 0;
      this.Ar = 360;
      this.Vw = gr;
      this.qj = 0;
      this.Nw = new H();
      this.kr = this.Td = 0;
      this.Xs = new ir();
      this.bu = this.Hj = 0;
      this.Ay = 600;
      this.fp = NaN;
      this.Zm = 1;
      this.Kp = 0;
      this.Ul = 360;
      this.Bb = gr;
      this.J = jr;
      this.Oc = kr;
      this.Ic = Zp;
      this.cf = 6;
      this.Po = lr;
    }
    la(fr, Di);
    fr.prototype.cloneProtected = function (a) {
      Di.prototype.cloneProtected.call(this, a);
      a.fp = this.fp;
      a.Zm = this.Zm;
      a.Kp = this.Kp;
      a.Ul = this.Ul;
      a.Bb = this.Bb;
      a.J = this.J;
      a.Oc = this.Oc;
      a.Ic = this.Ic;
      a.cf = this.cf;
      a.Po = this.Po;
    };
    fr.prototype.bb = function (a) {
      if (a.classType === fr)
        if (a === mr || a === nr || a === or || a === pr || a === kr)
          this.sorting = a;
        else if (a === qr || a === rr || a === jr || a === sr) this.direction = a;
        else if (a === tr || a === ur || a === gr || a === vr)
          this.arrangement = a;
        else {
          if (a === wr || a === lr) this.nodeDiameterFormula = a;
        }
      else Di.prototype.bb.call(this, a);
    };
    fr.prototype.createNetwork = function () {
      return new xr(this);
    };
    fr.prototype.doLayout = function (a) {
      null === this.network && (this.network = this.makeNetwork(a));
      this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin);
      a = this.network.vertexes;
      if (1 >= a.count)
        1 === a.count && ((a = a.first()), (a.centerX = 0), (a.centerY = 0));
      else {
        var b = new E();
        b.addAll(a.iterator);
        a = new E();
        var c = new E();
        var d = this.sort(b);
        var e,
          f,
          g = this.kr;
        var h = this.arrangement;
        var k = this.nodeDiameterFormula;
        var l = this.radius;
        if (!isFinite(l) || 0 >= l) l = NaN;
        var m = this.aspectRatio;
        if (!isFinite(m) || 0 >= m) m = 1;
        var n = this.startAngle;
        isFinite(n) || (n = 0);
        var p = this.sweepAngle;
        if (!isFinite(p) || 360 < p || 1 > p) p = 360;
        b = this.spacing;
        isFinite(b) || (b = NaN);
        h === vr && k === wr
          ? (h = gr)
          : h === vr && k !== wr && (h = this.arrangement);
        if (
          (this.direction === qr || this.direction === rr) &&
          this.sorting !== kr
        ) {
          for (k = 0; !(k >= d.length); k += 2) {
            a.add(d.L(k));
            if (k + 1 >= d.length) break;
            c.add(d.L(k + 1));
          }
          this.direction === qr
            ? (this.arrangement === vr && a.reverse(),
              (d = new E()),
              d.addAll(a),
              d.addAll(c))
            : (this.arrangement === vr && c.reverse(),
              (d = new E()),
              d.addAll(c),
              d.addAll(a));
        }
        k = d.length;
        for (var r = (f = e = 0); r < d.length; r++) {
          var q = n + (p * f * (this.direction === jr ? 1 : -1)) / k,
            u = d.L(r).diameter;
          isNaN(u) && (u = yr(d.L(r), q));
          360 > p && (0 === r || r === d.length - 1) && (u /= 2);
          e += u;
          f++;
        }
        if (isNaN(l) || h === vr) {
          isNaN(b) && (b = 6);
          if (h !== gr && h !== vr) {
            f = -Infinity;
            for (g = 0; g < k; g++)
              (r = d.L(g)),
                (e = d.L(g === k - 1 ? 0 : g + 1)),
                isNaN(r.diameter) && yr(r, 0),
                isNaN(e.diameter) && yr(e, 0),
                (f = Math.max(f, (r.diameter + e.diameter) / 2));
            g = f + b;
            h === tr
              ? (l = (f + b) / ((2 * Math.PI) / k))
              : (l = zr(
                  this,
                  g * (360 <= p ? k : k - 1),
                  m,
                  (n * Math.PI) / 180,
                  (p * Math.PI) / 180,
                ));
          } else
            l = zr(
              this,
              e + (360 <= p ? k : k - 1) * (h !== vr ? b : 1.6 * b),
              m,
              (n * Math.PI) / 180,
              (p * Math.PI) / 180,
            );
          f = l * m;
        } else if (
          ((f = l * m),
          (r = Ar(this, l, f, (n * Math.PI) / 180, (p * Math.PI) / 180)),
          isNaN(b))
        ) {
          if (h === gr || h === vr) b = (r - e) / (360 <= p ? k : k - 1);
        } else if (h === gr || h === vr)
          (r = (r - e) / (360 <= p ? k : k - 1)),
            r < b
              ? ((l = zr(
                  this,
                  e + b * (360 <= p ? k : k - 1),
                  m,
                  (n * Math.PI) / 180,
                  (p * Math.PI) / 180,
                )),
                (f = l * m))
              : (b = r);
        else {
          g = -Infinity;
          for (e = 0; e < k; e++)
            (q = d.L(e)),
              (u = d.L(e === k - 1 ? 0 : e + 1)),
              isNaN(q.diameter) && yr(q, 0),
              isNaN(u.diameter) && yr(u, 0),
              (g = Math.max(g, (q.diameter + u.diameter) / 2));
          g += b;
          e = zr(
            this,
            g * (360 <= p ? k : k - 1),
            m,
            (n * Math.PI) / 180,
            (p * Math.PI) / 180,
          );
          e > l ? ((l = e), (f = l * m)) : (g = r / (360 <= p ? k : k - 1));
        }
        this.Vw = h;
        this.ac = l;
        this.Cn = m;
        this.Ww = n;
        this.Ar = p;
        this.qj = b;
        this.Td = f;
        this.kr = g;
        b = d;
        d = this.Vw;
        h = this.ac;
        l = this.Ww;
        m = this.Ar;
        n = this.qj;
        p = this.Td;
        k = this.kr;
        if ((this.direction !== qr && this.direction !== rr) || d !== vr)
          if (this.direction === qr || this.direction === rr) {
            g = 0;
            switch (d) {
              case ur:
                g = (180 * Br(this, h, p, l, k)) / Math.PI;
                break;
              case gr:
                k = b = 0;
                g = a.first();
                null !== g && (b = yr(g, Math.PI / 2));
                g = c.first();
                null !== g && (k = yr(g, Math.PI / 2));
                g = (180 * Br(this, h, p, l, n + (b + k) / 2)) / Math.PI;
                break;
              case tr:
                g = m / b.length;
            }
            if (this.direction === qr) {
              switch (d) {
                case ur:
                  Cr(this, a, l, sr);
                  break;
                case gr:
                  Dr(this, a, l, sr);
                  break;
                case tr:
                  Er(this, a, m / 2, l, sr);
              }
              switch (d) {
                case ur:
                  Cr(this, c, l + g, jr);
                  break;
                case gr:
                  Dr(this, c, l + g, jr);
                  break;
                case tr:
                  Er(this, c, m / 2, l + g, jr);
              }
            } else {
              switch (d) {
                case ur:
                  Cr(this, c, l, sr);
                  break;
                case gr:
                  Dr(this, c, l, sr);
                  break;
                case tr:
                  Er(this, c, m / 2, l, sr);
              }
              switch (d) {
                case ur:
                  Cr(this, a, l + g, jr);
                  break;
                case gr:
                  Dr(this, a, l + g, jr);
                  break;
                case tr:
                  Er(this, a, m / 2, l + g, jr);
              }
            }
          } else
            switch (d) {
              case ur:
                Cr(this, b, l, this.direction);
                break;
              case gr:
                Dr(this, b, l, this.direction);
                break;
              case tr:
                Er(this, b, m, l, this.direction);
                break;
              case vr:
                Fr(this, b, m, l, this.direction);
            }
        else Fr(this, b, m, l - m / 2, jr);
      }
      this.updateParts();
      this.network = null;
      this.isValidLayout = !0;
    };
    function Er(a, b, c, d, e) {
      var f = a.Ar,
        g = a.ac;
      a = a.Td;
      d = (d * Math.PI) / 180;
      c = (c * Math.PI) / 180;
      for (var h = b.length, k = 0; k < h; k++) {
        var l = d + (e === jr ? (k * c) / (360 <= f ? h : h - 1) : -(k * c) / h),
          m = b.L(k),
          n = (g * Math.tan(l)) / a;
        n = Math.sqrt((g * g + a * a * n * n) / (1 + n * n));
        m.centerX = n * Math.cos(l);
        m.centerY = n * Math.sin(l);
        m.actualAngle = (180 * l) / Math.PI;
      }
    }
    function Dr(a, b, c, d) {
      var e = a.ac,
        f = a.Td,
        g = a.qj;
      c = (c * Math.PI) / 180;
      for (var h = b.length, k = 0; k < h; k++) {
        var l = b.L(k),
          m = b.L(k === h - 1 ? 0 : k + 1),
          n = f * Math.sin(c);
        l.centerX = e * Math.cos(c);
        l.centerY = n;
        l.actualAngle = (180 * c) / Math.PI;
        isNaN(l.diameter) && yr(l, 0);
        isNaN(m.diameter) && yr(m, 0);
        l = Br(a, e, f, d === jr ? c : -c, (l.diameter + m.diameter) / 2 + g);
        c += d === jr ? l : -l;
      }
    }
    function Cr(a, b, c, d) {
      var e = a.ac,
        f = a.Td,
        g = a.kr;
      c = (c * Math.PI) / 180;
      for (var h = b.length, k = 0; k < h; k++) {
        var l = b.L(k);
        l.centerX = e * Math.cos(c);
        l.centerY = f * Math.sin(c);
        l.actualAngle = (180 * c) / Math.PI;
        l = Br(a, e, f, d === jr ? c : -c, g);
        c += d === jr ? l : -l;
      }
    }
    function Fr(a, b, c, d, e) {
      var f = a.Ar;
      a.Hj = 0;
      a.Xs = new ir();
      if (360 > c) {
        for (f = d + (e === jr ? f : -f); 0 > f; ) f += 360;
        f %= 360;
        180 < f && (f -= 360);
        f *= Math.PI / 180;
        a.bu = f;
        Gr(a, b, c, d, e);
      } else Hr(a, b, c, d, e);
      a.Xs.commit(b);
    }
    function Hr(a, b, c, d, e) {
      var f = a.ac,
        g = a.qj,
        h = a.Cn,
        k = f * Math.cos((d * Math.PI) / 180),
        l = a.Td * Math.sin((d * Math.PI) / 180),
        m = b.na();
      if (3 === m.length)
        (m[0].centerX = f),
          (m[0].centerY = 0),
          (m[1].centerX = m[0].centerX - m[0].width / 2 - m[1].width / 2 - g),
          (m[1].y = m[0].y),
          (m[2].centerX = (m[0].centerX + m[1].centerX) / 2),
          (m[2].y = m[0].y - m[2].height - g);
      else if (4 === m.length)
        (m[0].centerX = f),
          (m[0].centerY = 0),
          (m[2].centerX = -m[0].centerX),
          (m[2].centerY = m[0].centerY),
          (m[1].centerX = 0),
          (m[1].y = Math.min(m[0].y, m[2].y) - m[1].height - g),
          (m[3].centerX = 0),
          (m[3].y = Math.max(m[0].y + m[0].height + g, m[2].y + m[2].height + g));
      else {
        f = H.alloc();
        for (var n = 0; n < m.length; n++) {
          m[n].centerX = k;
          m[n].centerY = l;
          if (n >= m.length - 1) break;
          Ir(a, k, l, m, n, e, f) || Jr(a, k, l, m, n, e, f);
          k = f.x;
          l = f.y;
        }
        H.free(f);
        a.Hj++;
        if (!(23 < a.Hj)) {
          k = m[0].centerX;
          l = m[0].centerY;
          f = m[m.length - 1].centerX;
          n = m[m.length - 1].centerY;
          var p =
              Math.abs(k - f) - ((m[0].width + m[m.length - 1].width) / 2 + g),
            r =
              Math.abs(l - n) - ((m[0].height + m[m.length - 1].height) / 2 + g);
          g = 0;
          1 > Math.abs(r)
            ? Math.abs(k - f) < (m[0].width + m[m.length - 1].width) / 2 &&
              (g = 0)
            : (g = 0 < r ? r : 1 > Math.abs(p) ? 0 : p);
          k = Math.abs(f) > Math.abs(n) ? 0 < f !== l > n : 0 < n !== k < f;
          if ((k = e === jr ? k : !k))
            (g = -Math.abs(g)),
              (g = Math.min(g, -m[m.length - 1].width)),
              (g = Math.min(g, -m[m.length - 1].height));
          a.Xs.compare(g, m);
          1 < Math.abs(g) &&
            ((a.ac =
              8 > a.Hj
                ? a.ac - g / (2 * Math.PI)
                : 5 > m.length && 10 < g
                ? a.ac / 2
                : a.ac - (0 < g ? 1.7 : -2.3)),
            (a.Td = a.ac * h),
            Hr(a, b, c, d, e));
        }
      }
    }
    function Gr(a, b, c, d, e) {
      for (
        var f = a.ac,
          g = a.Td,
          h = a.Cn,
          k = f * Math.cos((d * Math.PI) / 180),
          l = g * Math.sin((d * Math.PI) / 180),
          m = H.alloc(),
          n = b.na(),
          p = 0;
        p < n.length;
        p++
      ) {
        n[p].centerX = k;
        n[p].centerY = l;
        if (p >= n.length - 1) break;
        Ir(a, k, l, n, p, e, m) || Jr(a, k, l, n, p, e, m);
        k = m.x;
        l = m.y;
      }
      H.free(m);
      a.Hj++;
      if (!(23 < a.Hj)) {
        k = Math.atan2(l, k);
        k = e === jr ? a.bu - k : k - a.bu;
        k = Math.abs(k) < Math.abs(k - 2 * Math.PI) ? k : k - 2 * Math.PI;
        f = (k * (f + g)) / 2;
        g = a.Xs;
        if (Math.abs(f) < Math.abs(g.lm))
          for (g.lm = f, g.Bk = [], g.Mm = [], k = 0; k < n.length; k++)
            (g.Bk[k] = n[k].bounds.x), (g.Mm[k] = n[k].bounds.y);
        1 < Math.abs(f) &&
          ((a.ac =
            8 > a.Hj ? a.ac - f / (2 * Math.PI) : a.ac - (0 < f ? 1.7 : -2.3)),
          (a.Td = a.ac * h),
          Gr(a, b, c, d, e));
      }
    }
    function Ir(a, b, c, d, e, f, g) {
      var h = a.ac,
        k = a.Td,
        l = 0;
      a = (d[e].width + d[e + 1].width) / 2 + a.qj;
      var m = !1;
      if (0 <= c !== (f === jr)) {
        if (((f = b + a), f > h)) {
          f = b - a;
          if (f < -h) return (g.x = f), (g.y = l), !1;
          m = !0;
        }
      } else if (((f = b - a), f < -h)) {
        f = b + a;
        if (f > h) return (g.x = f), (g.y = l), !1;
        m = !0;
      }
      l = Math.sqrt(1 - Math.min(1, (f * f) / (h * h))) * k;
      0 > c !== m && (l = -l);
      if (Math.abs(c - l) > (d[e].height + d[e + 1].height) / 2)
        return (g.x = f), (g.y = l), !1;
      g.x = f;
      g.y = l;
      return !0;
    }
    function Jr(a, b, c, d, e, f, g) {
      var h = a.ac,
        k = a.Td,
        l = 0;
      a = (d[e].height + d[e + 1].height) / 2 + a.qj;
      d = !1;
      if (0 <= b !== (f === jr)) {
        if (((f = c - a), f < -k)) {
          f = c + a;
          if (f > k) {
            g.x = l;
            g.y = f;
            return;
          }
          d = !0;
        }
      } else if (((f = c + a), f > k)) {
        f = c - a;
        if (f < -k) {
          g.x = l;
          g.y = f;
          return;
        }
        d = !0;
      }
      l = Math.sqrt(1 - Math.min(1, (f * f) / (k * k))) * h;
      0 > b !== d && (l = -l);
      g.x = l;
      g.y = f;
    }
    fr.prototype.commitLayout = function () {
      this.commitNodes();
      this.isRouting && this.commitLinks();
    };
    fr.prototype.commitNodes = function () {
      var a =
          null !== this.group &&
          null !== this.group.placeholder &&
          this.group.isSubGraphExpanded,
        b = a ? this.group.location.copy() : null,
        c = this.actualCenter;
      a
        ? (c = new H(0, 0))
        : ((c.x = this.arrangementOrigin.x + this.ac),
          (c.y = this.arrangementOrigin.y + this.Td));
      for (var d = this.network.vertexes.iterator; d.next(); ) {
        var e = d.value;
        e.x += c.x;
        e.y += c.y;
        e.commit();
      }
      a &&
        (this.group.zb(),
        (a = this.group.position.copy()),
        (c = this.group.location.copy()),
        (b = b.$d(c.$d(a))),
        this.group.move(b),
        (this.Nw = b.$d(a)));
    };
    fr.prototype.commitLinks = function () {
      for (var a = this.network.edges.iterator; a.next(); ) a.value.commit();
    };
    function Ar(a, b, c, d, e) {
      var f = a.Ay;
      if (0.001 > Math.abs(a.Cn - 1))
        return void 0 !== d && void 0 !== e ? e * b : 2 * Math.PI * b;
      a = b > c ? Math.sqrt(b * b - c * c) / b : Math.sqrt(c * c - b * b) / c;
      var g = 0;
      var h =
        void 0 !== d && void 0 !== e ? e / (f + 1) : Math.PI / (2 * (f + 1));
      for (var k = 0, l = 0; l <= f; l++) {
        void 0 !== d && void 0 !== e
          ? (k = d + (l * e) / f)
          : (k = (l * Math.PI) / (2 * f));
        var m = Math.sin(k);
        g += Math.sqrt(1 - a * a * m * m) * h;
      }
      return void 0 !== d && void 0 !== e
        ? (b > c ? b : c) * g
        : 4 * (b > c ? b : c) * g;
    }
    function zr(a, b, c, d, e) {
      return b / (void 0 !== d && void 0 !== e ? Ar(a, 1, c, d, e) : Ar(a, 1, c));
    }
    function Br(a, b, c, d, e) {
      if (0.001 > Math.abs(a.Cn - 1)) return e / b;
      var f = b > c ? Math.sqrt(b * b - c * c) / b : Math.sqrt(c * c - b * b) / c,
        g = 0;
      a = (2 * Math.PI) / (700 * a.network.vertexes.count);
      b > c && (d += Math.PI / 2);
      for (var h = 0; ; h++) {
        var k = Math.sin(d + h * a);
        g += (b > c ? b : c) * Math.sqrt(1 - f * f * k * k) * a;
        if (g >= e) return h * a;
      }
    }
    fr.prototype.sort = function (a) {
      switch (this.sorting) {
        case or:
          break;
        case pr:
          a.reverse();
          break;
        case mr:
          a.sort(this.comparer);
          break;
        case nr:
          a.sort(this.comparer);
          a.reverse();
          break;
        case kr:
          for (var b = [], c = 0; c < a.length; c++) b.push(0);
          c = new E();
          for (var d = 0; d < a.length; d++) {
            var e = -1,
              f = -1;
            if (0 === d)
              for (var g = 0; g < a.length; g++) {
                var h = a.L(g).edgesCount;
                h > e && ((e = h), (f = g));
              }
            else
              for (g = 0; g < a.length; g++)
                (h = b[g]), h > e && ((e = h), (f = g));
            c.add(a.L(f));
            b[f] = -1;
            f = a.L(f);
            for (g = f.sourceEdges; g.next(); )
              (e = a.indexOf(g.value.fromVertex)), 0 > e || (0 <= b[e] && b[e]++);
            for (f = f.destinationEdges; f.next(); )
              (e = a.indexOf(f.value.toVertex)), 0 > e || (0 <= b[e] && b[e]++);
          }
          a = [];
          for (b = 0; b < c.length; b++) {
            e = c.L(b);
            a[b] = [];
            for (f = e.destinationEdges; f.next(); )
              (d = c.indexOf(f.value.toVertex)),
                d !== b && 0 > a[b].indexOf(d) && a[b].push(d);
            for (e = e.sourceEdges; e.next(); )
              (d = c.indexOf(e.value.fromVertex)),
                d !== b && 0 > a[b].indexOf(d) && a[b].push(d);
          }
          f = [];
          for (b = 0; b < a.length; b++) f[b] = 0;
          b = [];
          g = [];
          h = [];
          e = [];
          d = new E();
          for (var k = 0, l = 0; l < a.length; l++) {
            var m = a[l].length;
            if (1 === m) e.push(l);
            else if (0 === m) d.add(c.L(l));
            else {
              if (0 === k) b.push(l);
              else {
                for (
                  var n = (m = Infinity), p = -1, r = [], q = 0;
                  q < b.length;
                  q++
                )
                  0 > a[b[q]].indexOf(b[q === b.length - 1 ? 0 : q + 1]) &&
                    r.push(q === b.length - 1 ? 0 : q + 1);
                if (0 === r.length) for (q = 0; q < b.length; q++) r.push(q);
                for (q = 0; q < r.length; q++) {
                  for (var u = r[q], v = a[l], w = 0, y = 0; y < g.length; y++) {
                    var z = f[g[y]],
                      A = f[h[y]];
                    if (z < A) {
                      var C = z;
                      z = A;
                    } else C = A;
                    if (C < u && u <= z)
                      for (A = 0; A < v.length; A++) {
                        var I = v[A];
                        0 > b.indexOf(I) ||
                          (C < f[I] && f[I] < z) ||
                          C === f[I] ||
                          z === f[I] ||
                          w++;
                      }
                    else
                      for (A = 0; A < v.length; A++)
                        (I = v[A]),
                          0 > b.indexOf(I) ||
                            (C < f[I] &&
                              f[I] < z &&
                              C !== f[I] &&
                              z !== f[I] &&
                              w++);
                  }
                  v = w;
                  for (y = w = 0; y < a[l].length; y++)
                    (C = b.indexOf(a[l][y])),
                      0 <= C &&
                        ((C = Math.abs(u - (C >= u ? C + 1 : C))),
                        (w += C < b.length + 1 - C ? C : b.length + 1 - C));
                  for (y = 0; y < g.length; y++)
                    (C = f[g[y]]),
                      (z = f[h[y]]),
                      C >= u && C++,
                      z >= u && z++,
                      C > z && ((A = z), (z = C), (C = A)),
                      z - C < (b.length + 2) / 2 === (C < u && u <= z) && w++;
                  if (v < m || (v === m && w < n)) (m = v), (n = w), (p = u);
                }
                b.splice(p, 0, l);
                for (m = 0; m < b.length; m++) f[b[m]] = m;
                for (m = 0; m < a[l].length; m++)
                  (n = a[l][m]), 0 <= b.indexOf(n) && (g.push(l), h.push(n));
              }
              k++;
            }
          }
          for (g = b.length; ; ) {
            f = !0;
            for (h = 0; h < e.length; h++)
              if (((k = e[h]), (l = a[k][0]), (m = b.indexOf(l)), 0 <= m)) {
                for (p = n = 0; p < a[l].length; p++)
                  (r = b.indexOf(a[l][p])),
                    0 > r ||
                      r === m ||
                      ((q = r > m ? r - m : m - r),
                      (n += r < m !== q > g - q ? 1 : -1));
                b.splice(0 > n ? m : m + 1, 0, k);
                e.splice(h, 1);
                h--;
              } else f = !1;
            if (f) break;
            else b.push(e[0]), e.splice(0, 1);
          }
          for (a = 0; a < b.length; a++) d.add(c.L(b[a]));
          return d;
        default:
          B('Invalid sorting type.');
      }
      return a;
    };
    ma.Object.defineProperties(fr.prototype, {
      radius: {
        get: function () {
          return this.fp;
        },
        set: function (a) {
          this.fp !== a && (0 < a || isNaN(a)) && ((this.fp = a), this.C());
        },
      },
      aspectRatio: {
        get: function () {
          return this.Zm;
        },
        set: function (a) {
          this.Zm !== a && 0 < a && ((this.Zm = a), this.C());
        },
      },
      startAngle: {
        get: function () {
          return this.Kp;
        },
        set: function (a) {
          this.Kp !== a && ((this.Kp = a), this.C());
        },
      },
      sweepAngle: {
        get: function () {
          return this.Ul;
        },
        set: function (a) {
          this.Ul !== a &&
            (0 < a && 360 >= a ? (this.Ul = a) : (this.Ul = 360), this.C());
        },
      },
      arrangement: {
        get: function () {
          return this.Bb;
        },
        set: function (a) {
          this.Bb === a ||
            (a !== vr && a !== gr && a !== ur && a !== tr) ||
            ((this.Bb = a), this.C());
        },
      },
      direction: {
        get: function () {
          return this.J;
        },
        set: function (a) {
          this.J === a ||
            (a !== jr && a !== sr && a !== qr && a !== rr) ||
            ((this.J = a), this.C());
        },
      },
      sorting: {
        get: function () {
          return this.Oc;
        },
        set: function (a) {
          this.Oc === a ||
            (a !== or && a !== pr && a !== mr && !nr && a !== kr) ||
            ((this.Oc = a), this.C());
        },
      },
      comparer: {
        get: function () {
          return this.Ic;
        },
        set: function (a) {
          this.Ic !== a && ((this.Ic = a), this.C());
        },
      },
      spacing: {
        get: function () {
          return this.cf;
        },
        set: function (a) {
          this.cf !== a && ((this.cf = a), this.C());
        },
      },
      nodeDiameterFormula: {
        get: function () {
          return this.Po;
        },
        set: function (a) {
          this.Po === a || (a !== lr && a !== wr) || ((this.Po = a), this.C());
        },
      },
      actualXRadius: {
        get: function () {
          return this.ac;
        },
      },
      actualYRadius: {
        get: function () {
          return this.Td;
        },
      },
      actualSpacing: {
        get: function () {
          return this.qj;
        },
      },
      actualCenter: {
        get: function () {
          return this.Nw;
        },
      },
    });
    var gr = new D(fr, 'ConstantSpacing', 0),
      ur = new D(fr, 'ConstantDistance', 1),
      tr = new D(fr, 'ConstantAngle', 2),
      vr = new D(fr, 'Packed', 3),
      jr = new D(fr, 'Clockwise', 4),
      sr = new D(fr, 'Counterclockwise', 5),
      qr = new D(fr, 'BidirectionalLeft', 6),
      rr = new D(fr, 'BidirectionalRight', 7),
      or = new D(fr, 'Forwards', 8),
      pr = new D(fr, 'Reverse', 9),
      mr = new D(fr, 'Ascending', 10),
      nr = new D(fr, 'Descending', 11),
      kr = new D(fr, 'Optimized', 12),
      lr = new D(fr, 'Pythagorean', 13),
      wr = new D(fr, 'Circular', 14);
    fr.className = 'CircularLayout';
    fr.ConstantSpacing = gr;
    fr.ConstantDistance = ur;
    fr.ConstantAngle = tr;
    fr.Packed = vr;
    fr.Clockwise = jr;
    fr.Counterclockwise = sr;
    fr.BidirectionalLeft = qr;
    fr.BidirectionalRight = rr;
    fr.Forwards = or;
    fr.Reverse = pr;
    fr.Ascending = mr;
    fr.Descending = nr;
    fr.Optimized = kr;
    fr.Pythagorean = lr;
    fr.Circular = wr;
    function ir() {
      this.lm = -Infinity;
      this.Mm = this.Bk = null;
    }
    ir.prototype.compare = function (a, b) {
      if (
        (0 < a && 0 > this.lm) ||
        (Math.abs(a) < Math.abs(this.lm) && !(0 > a && 0 < this.lm))
      )
        for (this.lm = a, this.Bk = [], this.Mm = [], a = 0; a < b.length; a++)
          (this.Bk[a] = b[a].bounds.x), (this.Mm[a] = b[a].bounds.y);
    };
    ir.prototype.commit = function (a) {
      if (null !== this.Bk && null !== this.Mm)
        for (var b = 0; b < this.Bk.length; b++) {
          var c = a.L(b);
          c.x = this.Bk[b];
          c.y = this.Mm[b];
        }
    };
    ir.className = 'VertexArrangement';
    function xr(a) {
      Pp.call(this, a);
    }
    la(xr, Pp);
    xr.prototype.createVertex = function () {
      return new Kr(this);
    };
    xr.prototype.createEdge = function () {
      return new Lr(this);
    };
    xr.className = 'CircularNetwork';
    function Kr(a) {
      Sp.call(this, a);
      this.I = this.oj = NaN;
    }
    la(Kr, Sp);
    function yr(a, b) {
      var c = a.network;
      if (null === c) return NaN;
      c = c.layout;
      if (null === c) return NaN;
      if (c.arrangement === vr)
        if (c.nodeDiameterFormula === wr) a.oj = Math.max(a.width, a.height);
        else {
          c = Math.abs(Math.sin(b));
          b = Math.abs(Math.cos(b));
          if (0 === c) return a.width;
          if (0 === b) return a.height;
          a.oj = Math.min(a.height / c, a.width / b);
        }
      else
        a.oj =
          c.nodeDiameterFormula === wr
            ? Math.max(a.width, a.height)
            : Math.sqrt(a.width * a.width + a.height * a.height);
      return a.oj;
    }
    ma.Object.defineProperties(Kr.prototype, {
      diameter: {
        get: function () {
          return this.oj;
        },
        set: function (a) {
          this.oj !== a && (this.oj = a);
        },
      },
      actualAngle: {
        get: function () {
          return this.I;
        },
        set: function (a) {
          this.I !== a && (this.I = a);
        },
      },
    });
    Kr.className = 'CircularVertex';
    function Lr(a) {
      Tp.call(this, a);
    }
    la(Lr, Tp);
    Lr.className = 'CircularEdge';
    function Mr() {
      Di.call(this);
      this.Ch = null;
      this.jo = 0;
      this.zd = new L(100, 100).freeze();
      this.Ym = !1;
      this.af = !0;
      this.Vc = !1;
      this.zl = 100;
      this.Fn = 1;
      this.Vf = 1e3;
      this.Go = 10;
      this.gp = Math;
      this.Vk = 0.05;
      this.Uk = 50;
      this.Sk = 150;
      this.Tk = 0;
      this.wn = 10;
      this.vn = 5;
    }
    la(Mr, Di);
    Mr.prototype.cloneProtected = function (a) {
      Di.prototype.cloneProtected.call(this, a);
      a.zd.assign(this.zd);
      a.Ym = this.Ym;
      a.af = this.af;
      a.Vc = this.Vc;
      a.zl = this.zl;
      a.Fn = this.Fn;
      a.Vf = this.Vf;
      a.Go = this.Go;
      a.gp = this.gp;
      a.Vk = this.Vk;
      a.Uk = this.Uk;
      a.Sk = this.Sk;
      a.Tk = this.Tk;
      a.wn = this.wn;
      a.vn = this.vn;
    };
    Mr.prototype.createNetwork = function () {
      return new Nr(this);
    };
    Mr.prototype.doLayout = function (a) {
      null === this.network && (this.network = this.makeNetwork(a));
      a = this.maxIterations;
      if (0 < this.network.vertexes.count) {
        this.network.hq();
        for (var b = this.network.vertexes.iterator; b.next(); ) {
          var c = b.value;
          c.charge = this.electricalCharge(c);
          c.mass = this.gravitationalMass(c);
        }
        for (b = this.network.edges.iterator; b.next(); )
          (c = b.value),
            (c.stiffness = this.springStiffness(c)),
            (c.length = this.springLength(c));
        this.gv();
        this.jo = 0;
        if (this.needsClusterLayout()) {
          b = this.network;
          for (c = b.qy().iterator; c.next(); ) {
            this.network = c.value;
            for (var d = this.network.vertexes.iterator; d.next(); ) {
              var e = d.value;
              e.vd = e.vertexes.count;
              e.Nh = 1;
              e.ak = null;
              e.Ee = null;
            }
            Or(this, 0, a);
          }
          this.network = b;
          c.reset();
          d = this.arrangementSpacing;
          for (
            var f = c.count, g = !0, h = (e = 0), k = Ea(), l = 0;
            l < f + b.vertexes.count + 2;
            l++
          )
            k[l] = null;
          f = 0;
          c.reset();
          for (var m = N.alloc(); c.next(); )
            if (((l = c.value), this.computeBounds(l, m), g))
              (g = !1),
                (e = m.x + m.width / 2),
                (h = m.y + m.height / 2),
                (k[0] = new H(m.x + m.width + d.width, m.y)),
                (k[1] = new H(m.x, m.y + m.height + d.height)),
                (f = 2);
            else {
              var n = Pr(k, f, e, h, m.width, m.height, d),
                p = k[n],
                r = new H(p.x + m.width + d.width, p.y),
                q = new H(p.x, p.y + m.height + d.height);
              n + 1 < f && k.splice(n + 1, 0, null);
              k[n] = r;
              k[n + 1] = q;
              f++;
              n = p.x - m.x;
              p = p.y - m.y;
              for (l = l.vertexes.iterator; l.next(); )
                (r = l.value), (r.centerX += n), (r.centerY += p);
            }
          N.free(m);
          for (l = b.vertexes.iterator; l.next(); )
            (g = l.value),
              (r = g.bounds),
              2 > f
                ? ((e = r.x + r.width / 2),
                  (h = r.y + r.height / 2),
                  (k[0] = new H(r.x + r.width + d.width, r.y)),
                  (k[1] = new H(r.x, r.y + r.height + d.height)),
                  (f = 2))
                : ((m = Pr(k, f, e, h, r.width, r.height, d)),
                  (p = k[m]),
                  (n = new H(p.x + r.width + d.width, p.y)),
                  (r = new H(p.x, p.y + r.height + d.height)),
                  m + 1 < f && k.splice(m + 1, 0, null),
                  (k[m] = n),
                  (k[m + 1] = r),
                  f++,
                  (g.centerX = p.x + g.width / 2),
                  (g.centerY = p.y + g.height / 2));
          Ha(k);
          for (c.reset(); c.next(); ) {
            d = c.value;
            for (e = d.vertexes.iterator; e.next(); ) b.Fh(e.value);
            for (d = d.edges.iterator; d.next(); ) b.aq(d.value);
          }
        }
        Qr(this, a);
        this.updateParts();
      }
      this.zl = a;
      this.network = null;
      this.isValidLayout = !0;
    };
    Mr.prototype.needsClusterLayout = function () {
      if (3 > this.network.vertexes.count) return !1;
      for (
        var a = 0,
          b = 0,
          c = this.network.vertexes.first().bounds,
          d = this.network.vertexes.iterator;
        d.next();
  
      ) {
        if (d.value.bounds.Fc(c) && (a++, 2 < a)) return !0;
        if (10 < b) break;
        b++;
      }
      return !1;
    };
    Mr.prototype.computeBounds = function (a, b) {
      var c = !0;
      for (a = a.vertexes.iterator; a.next(); ) {
        var d = a.value;
        c ? ((c = !1), b.set(d.bounds)) : b.Gc(d.bounds);
      }
      return b;
    };
    function Or(a, b, c) {
      if (Rr(a, b)) {
        var d = a.Vf;
        a.Vf *= 1 + 1 / (b + 1);
        var e = Sr(a, b),
          f = Math.max(
            0,
            Math.max(Math.min(a.network.vertexes.count, (c * (b + 1)) / 11), 10),
          );
        a.maxIterations += f;
        Or(a, b + 1, c);
        Qr(a, f);
        Tr(a, e);
        b = e.vertexes.na();
        b.sort(function (a, b) {
          return null === a || null === b || a === b ? 0 : b.vd - a.vd;
        });
        for (c = 0; c < b.length; c++) Ur(a, b[c]);
        a.Vf = d;
      }
    }
    function Rr(a, b) {
      if (10 < b || 3 > a.network.vertexes.count) return !1;
      a.Ch = a.network.vertexes.na();
      a = a.Ch;
      a.sort(function (a, b) {
        return null === a || null === b || a === b ? 0 : b.vd - a.vd;
      });
      for (b = a.length - 1; 0 <= b && 1 >= a[b].vd; ) b--;
      return 1 < a.length - b;
    }
    function Sr(a, b) {
      for (var c = a.network, d = new Nr(a), e = 0; e < a.Ch.length; e++) {
        var f = a.Ch[e];
        if (1 < f.vd) {
          d.Fh(f);
          var g = new Vr();
          g.Rt = f.vd;
          g.St = f.width;
          g.Qt = f.height;
          g.Cw = f.focus.x;
          g.Dw = f.focus.y;
          null === f.Ee && (f.Ee = new E());
          f.Ee.add(g);
          f.ew = f.Ee.count - 1;
        } else break;
      }
      for (f = c.edges.iterator; f.next(); ) {
        var h = f.value;
        e = h.fromVertex;
        g = h.toVertex;
        e.network === d && g.network === d
          ? d.aq(h)
          : e.network === d
          ? ((h = e.ak),
            null === h && ((h = new E()), (e.ak = h)),
            h.add(g),
            e.vd--,
            (e.Nh += g.Nh))
          : g.network === d &&
            ((h = g.ak),
            null === h && ((h = new E()), (g.ak = h)),
            h.add(e),
            g.vd--,
            (g.Nh += e.Nh));
      }
      for (e = d.edges.iterator; e.next(); )
        (f = e.value),
          (f.length *= Math.max(
            1,
            J.sqrt((f.fromVertex.Nh + f.toVertex.Nh) / (4 * b + 1)),
          ));
      for (b = d.vertexes.iterator; b.next(); ) {
        e = b.value;
        var k = e.ak;
        if (
          null !== k &&
          0 < k.count &&
          ((g = e.Ee.L(e.Ee.count - 1).Rt - e.vd), !(0 >= g))
        ) {
          for (var l = (h = 0), m = k.count - g; m < k.count; m++) {
            var n = k.L(m),
              p = null;
            for (f = n.edges.iterator; f.next(); ) {
              var r = f.value;
              if (r.Sx(n) === e) {
                p = r;
                break;
              }
            }
            null !== p && ((l += p.length), (h += n.width * n.height));
          }
          f = e.centerX;
          k = e.centerY;
          m = e.width;
          n = e.height;
          p = e.focus;
          r = m * n;
          1 > r && (r = 1);
          h = J.sqrt((h + r + (l * l * 4) / (g * g)) / r);
          g = ((h - 1) * m) / 2;
          h = ((h - 1) * n) / 2;
          e.bounds = new N(f - p.x - g, k - p.y - h, m + 2 * g, n + 2 * h);
          e.focus = new H(p.x + g, p.y + h);
        }
      }
      a.network = d;
      return c;
    }
    function Tr(a, b) {
      for (var c = a.network.vertexes.iterator; c.next(); ) {
        var d = c.value;
        d.network = b;
        if (null !== d.Ee) {
          var e = d.Ee.L(d.ew);
          d.vd = e.Rt;
          var f = e.Cw,
            g = e.Dw;
          d.bounds = new N(d.centerX - f, d.centerY - g, e.St, e.Qt);
          d.focus = new H(f, g);
          d.ew--;
        }
      }
      for (c = a.network.edges.iterator; c.next(); ) c.value.network = b;
      a.network = b;
    }
    function Ur(a, b) {
      var c = b.ak;
      if (null !== c && 0 !== c.count) {
        var d = b.centerX,
          e = b.centerY,
          f = b.width,
          g = b.height;
        null !== b.Ee &&
          0 < b.Ee.count &&
          ((g = b.Ee.L(0)), (f = g.St), (g = g.Qt));
        f = J.sqrt(f * f + g * g) / 2;
        for (
          var h = !1, k = (g = 0), l = 0, m = b.vertexes.iterator;
          m.next();
  
        ) {
          var n = m.value;
          1 >= n.vd
            ? k++
            : ((h = !0),
              l++,
              (g += Math.atan2(b.centerY - n.centerY, b.centerX - n.centerX)));
        }
        if (0 !== k)
          for (
            0 < l && (g /= l),
              l = b = 0,
              b = h ? (2 * Math.PI) / (k + 1) : (2 * Math.PI) / k,
              0 === k % 2 && (l = b / 2),
              1 < c.count &&
                c.sort(function (a, b) {
                  return null === a || null === b || a === b
                    ? 0
                    : b.width * b.height - a.width * a.height;
                }),
              h = 0 === k % 2 ? 0 : 1,
              c = c.iterator;
            c.next();
  
          )
            if (((k = c.value), !(1 < k.vd || a.isFixed(k)))) {
              m = null;
              for (n = k.edges.iterator; n.next(); ) {
                m = n.value;
                break;
              }
              n = k.width;
              var p = k.height;
              n = J.sqrt(n * n + p * p) / 2;
              m = f + m.length + n;
              n = g + (b * ((h / 2) >> 1) + l) * (0 === h % 2 ? 1 : -1);
              k.centerX = d + m * Math.cos(n);
              k.centerY = e + m * Math.sin(n);
              h++;
            }
      }
    }
    function Pr(a, b, c, d, e, f, g) {
      var h = 9e19,
        k = -1,
        l = 0;
      a: for (; l < b; l++) {
        var m = a[l],
          n = m.x - c,
          p = m.y - d;
        n = n * n + p * p;
        if (n < h) {
          for (p = l - 1; 0 <= p; p--)
            if (a[p].y > m.y && a[p].x - m.x < e + g.width) continue a;
          for (p = l + 1; p < b; p++)
            if (a[p].x > m.x && a[p].y - m.y < f + g.height) continue a;
          k = l;
          h = n;
        }
      }
      return k;
    }
    Mr.prototype.gv = function () {
      if (this.comments)
        for (var a = this.network.vertexes.iterator; a.next(); )
          this.addComments(a.value);
    };
    Mr.prototype.addComments = function (a) {
      var b = a.node;
      if (null !== b)
        for (b = b.uv(); b.next(); ) {
          var c = b.value;
          if ('Comment' === c.category && c.isVisible()) {
            var d = this.network.Vi(c);
            null === d && (d = this.network.bm(c));
            d.charge = this.defaultCommentElectricalCharge;
            c = null;
            for (var e = d.destinationEdges; e.next(); ) {
              var f = e.value;
              if (f.toVertex === a) {
                c = f;
                break;
              }
            }
            if (null === c)
              for (e = d.sourceEdges; e.next(); )
                if (((f = e.value), f.fromVertex === a)) {
                  c = f;
                  break;
                }
            null === c && (c = this.network.nk(a, d, null));
            c.length = this.defaultCommentSpringLength;
          }
        }
    };
    function Wr(a, b) {
      var c = a.bounds,
        d = c.x;
      a = c.y;
      var e = c.width;
      c = c.height;
      var f = b.bounds,
        g = f.x;
      b = f.y;
      var h = f.width;
      f = f.height;
      return d + e < g
        ? a > b + f
          ? ((c = d + e - g), (a = a - b - f), J.sqrt(c * c + a * a))
          : a + c < b
          ? ((d = d + e - g), (a = a + c - b), J.sqrt(d * d + a * a))
          : g - (d + e)
        : d > g + h
        ? a > b + f
          ? ((c = d - g - h), (a = a - b - f), J.sqrt(c * c + a * a))
          : a + c < b
          ? ((d = d - g - h), (a = a + c - b), J.sqrt(d * d + a * a))
          : d - (g + h)
        : a > b + f
        ? a - (b + f)
        : a + c < b
        ? b - (a + c)
        : 0.1;
    }
    function Qr(a, b) {
      a.Ch = null;
      for (b = a.jo + b; a.jo < b && (a.jo++, Xr(a)); );
      a.Ch = null;
    }
    function Xr(a) {
      null === a.Ch && (a.Ch = a.network.vertexes.na());
      var b = a.Ch;
      if (0 >= b.length) return !1;
      var c = b[0];
      c.forceX = 0;
      c.forceY = 0;
      for (
        var d = c.centerX, e = d, f = (c = c.centerY), g = 1;
        g < b.length;
        g++
      ) {
        var h = b[g];
        h.forceX = 0;
        h.forceY = 0;
        var k = h.centerX;
        h = h.centerY;
        d = Math.min(d, k);
        e = Math.max(e, k);
        c = Math.min(c, h);
        f = Math.max(f, h);
      }
      (e = e - d > f - c)
        ? b.sort(function (a, b) {
            return null === a || null === b || a === b
              ? 0
              : a.centerX - b.centerX;
          })
        : b.sort(function (a, b) {
            return null === a || null === b || a === b
              ? 0
              : a.centerY - b.centerY;
          });
      c = a.Vf;
      var l = (d = h = 0);
      for (f = 0; f < b.length; f++) {
        g = b[f];
        d = g.bounds;
        h = g.focus;
        k = d.x + h.x;
        var m = d.y + h.y;
        d = g.charge * a.electricalFieldX(k, m);
        l = g.charge * a.electricalFieldY(k, m);
        d += g.mass * a.gravitationalFieldX(k, m);
        l += g.mass * a.gravitationalFieldY(k, m);
        g.forceX += d;
        g.forceY += l;
        for (var n = f + 1; n < b.length; n++) {
          var p = b[n];
          if (p !== g) {
            d = p.bounds;
            h = p.focus;
            l = d.x + h.x;
            var r = d.y + h.y;
            if (k - l > c || l - k > c) {
              if (e) break;
            } else if (m - r > c || r - m > c) {
              if (!e) break;
            } else {
              var q = Wr(g, p);
              1 > q
                ? ((d = a.randomNumberGenerator),
                  null === d && (a.randomNumberGenerator = d = new Yr()),
                  (q = d.random()),
                  (h = d.random()),
                  k > l
                    ? ((d = Math.abs(p.bounds.right - g.bounds.x)),
                      (d = (1 + d) * q))
                    : k < l
                    ? ((d = Math.abs(p.bounds.x - g.bounds.right)),
                      (d = -(1 + d) * q))
                    : ((d = Math.max(p.width, g.width)),
                      (d = (1 + d) * q - d / 2)),
                  m > r
                    ? ((l = Math.abs(p.bounds.bottom - g.bounds.y)),
                      (l = (1 + l) * h))
                    : k < l
                    ? ((l = Math.abs(p.bounds.y - g.bounds.bottom)),
                      (l = -(1 + l) * h))
                    : ((l = Math.max(p.height, g.height)),
                      (l = (1 + l) * h - l / 2)))
                : ((h = -(g.charge * p.charge) / (q * q)),
                  (d = ((l - k) / q) * h),
                  (l = ((r - m) / q) * h));
              g.forceX += d;
              g.forceY += l;
              p.forceX -= d;
              p.forceY -= l;
            }
          }
        }
      }
      for (e = a.network.edges.iterator; e.next(); )
        (h = e.value),
          (c = h.fromVertex),
          (f = h.toVertex),
          (g = c.bounds),
          (k = c.focus),
          (d = g.x + k.x),
          (g = g.y + k.y),
          (m = f.bounds),
          (n = f.focus),
          (k = m.x + n.x),
          (m = m.y + n.y),
          (n = Wr(c, f)),
          1 > n
            ? ((n = a.randomNumberGenerator),
              null === n && (a.randomNumberGenerator = n = new Yr()),
              (h = n.random()),
              (n = n.random()),
              (d =
                (d > k ? 1 : -1) *
                (1 + (f.width > c.width ? f.width : c.width)) *
                h),
              (l =
                (g > m ? 1 : -1) *
                (1 + (f.height > c.height ? f.height : c.height)) *
                n))
            : ((h = h.stiffness * (n - h.length)),
              (d = ((k - d) / n) * h),
              (l = ((m - g) / n) * h)),
          (c.forceX += d),
          (c.forceY += l),
          (f.forceX -= d),
          (f.forceY -= l);
      d = 0;
      e = a.moveLimit;
      for (c = 0; c < b.length; c++)
        (f = b[c]),
          a.isFixed(f)
            ? a.moveFixedVertex(f)
            : ((g = f.forceX),
              (k = f.forceY),
              g < -e ? (g = -e) : g > e && (g = e),
              k < -e ? (k = -e) : k > e && (k = e),
              (f.centerX += g),
              (f.centerY += k),
              (d = Math.max(d, g * g + k * k)));
      return d > a.epsilonDistance * a.epsilonDistance;
    }
    Mr.prototype.moveFixedVertex = function () {};
    Mr.prototype.commitLayout = function () {
      this.iw();
      this.commitNodes();
      this.isRouting && this.commitLinks();
    };
    Mr.prototype.iw = function () {
      if (this.setsPortSpots)
        for (var a = this.network.edges.iterator; a.next(); ) {
          var b = a.value.link;
          null !== b && ((b.fromSpot = Zc), (b.toSpot = Zc));
        }
    };
    Mr.prototype.commitNodes = function () {
      var a = 0,
        b = 0;
      if (this.arrangesToOrigin) {
        var c = N.alloc();
        this.computeBounds(this.network, c);
        b = this.arrangementOrigin;
        a = b.x - c.x;
        b = b.y - c.y;
        N.free(c);
      }
      c = N.alloc();
      for (var d = this.network.vertexes.iterator; d.next(); ) {
        var e = d.value;
        if (0 !== a || 0 !== b)
          c.assign(e.bounds), (c.x += a), (c.y += b), (e.bounds = c);
        e.commit();
      }
      N.free(c);
    };
    Mr.prototype.commitLinks = function () {
      for (var a = this.network.edges.iterator; a.next(); ) a.value.commit();
    };
    Mr.prototype.springStiffness = function (a) {
      a = a.stiffness;
      return isNaN(a) ? this.Vk : a;
    };
    Mr.prototype.springLength = function (a) {
      a = a.length;
      return isNaN(a) ? this.Uk : a;
    };
    Mr.prototype.electricalCharge = function (a) {
      a = a.charge;
      return isNaN(a) ? this.Sk : a;
    };
    Mr.prototype.electricalFieldX = function () {
      return 0;
    };
    Mr.prototype.electricalFieldY = function () {
      return 0;
    };
    Mr.prototype.gravitationalMass = function (a) {
      a = a.mass;
      return isNaN(a) ? this.Tk : a;
    };
    Mr.prototype.gravitationalFieldX = function () {
      return 0;
    };
    Mr.prototype.gravitationalFieldY = function () {
      return 0;
    };
    Mr.prototype.isFixed = function (a) {
      return a.isFixed;
    };
    ma.Object.defineProperties(Mr.prototype, {
      currentIteration: {
        get: function () {
          return this.jo;
        },
      },
      arrangementSpacing: {
        get: function () {
          return this.zd;
        },
        set: function (a) {
          this.zd.A(a) || (this.zd.assign(a), this.C());
        },
      },
      arrangesToOrigin: {
        get: function () {
          return this.Ym;
        },
        set: function (a) {
          this.Ym !== a && ((this.Ym = a), this.C());
        },
      },
      setsPortSpots: {
        get: function () {
          return this.af;
        },
        set: function (a) {
          this.af !== a && ((this.af = a), this.C());
        },
      },
      comments: {
        get: function () {
          return this.Vc;
        },
        set: function (a) {
          this.Vc !== a && ((this.Vc = a), this.C());
        },
      },
      maxIterations: {
        get: function () {
          return this.zl;
        },
        set: function (a) {
          this.zl !== a && 0 <= a && ((this.zl = a), this.C());
        },
      },
      epsilonDistance: {
        get: function () {
          return this.Fn;
        },
        set: function (a) {
          this.Fn !== a && 0 < a && ((this.Fn = a), this.C());
        },
      },
      infinityDistance: {
        get: function () {
          return this.Vf;
        },
        set: function (a) {
          this.Vf !== a && 1 < a && ((this.Vf = a), this.C());
        },
      },
      moveLimit: {
        get: function () {
          return this.Go;
        },
        set: function (a) {
          this.Go !== a && 1 < a && ((this.Go = a), this.C());
        },
      },
      randomNumberGenerator: {
        get: function () {
          return this.gp;
        },
        set: function (a) {
          this.gp !== a &&
            (null !== a &&
              'function' !== typeof a.random &&
              B(
                'ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: ' +
                  a,
              ),
            (this.gp = a));
        },
      },
      defaultSpringStiffness: {
        get: function () {
          return this.Vk;
        },
        set: function (a) {
          this.Vk !== a && ((this.Vk = a), this.C());
        },
      },
      defaultSpringLength: {
        get: function () {
          return this.Uk;
        },
        set: function (a) {
          this.Uk !== a && ((this.Uk = a), this.C());
        },
      },
      defaultElectricalCharge: {
        get: function () {
          return this.Sk;
        },
        set: function (a) {
          this.Sk !== a && ((this.Sk = a), this.C());
        },
      },
      defaultGravitationalMass: {
        get: function () {
          return this.Tk;
        },
        set: function (a) {
          this.Tk !== a && ((this.Tk = a), this.C());
        },
      },
      defaultCommentSpringLength: {
        get: function () {
          return this.wn;
        },
        set: function (a) {
          this.wn !== a && ((this.wn = a), this.C());
        },
      },
      defaultCommentElectricalCharge: {
        get: function () {
          return this.vn;
        },
        set: function (a) {
          this.vn !== a && ((this.vn = a), this.C());
        },
      },
    });
    Mr.className = 'ForceDirectedLayout';
    function Vr() {
      this.Dw = this.Cw = this.Qt = this.St = this.Rt = 0;
    }
    Vr.className = 'ForceDirectedSubnet';
    function Nr(a) {
      Pp.call(this, a);
    }
    la(Nr, Pp);
    Nr.prototype.createVertex = function () {
      return new Zr(this);
    };
    Nr.prototype.createEdge = function () {
      return new $r(this);
    };
    Nr.className = 'ForceDirectedNetwork';
    function Zr(a) {
      Sp.call(this, a);
      this.La = !1;
      this.eb = this.I = NaN;
      this.Nh = this.vd = this.Ja = this.Y = 0;
      this.Ee = this.ak = null;
      this.ew = 0;
    }
    la(Zr, Sp);
    ma.Object.defineProperties(Zr.prototype, {
      isFixed: {
        get: function () {
          return this.La;
        },
        set: function (a) {
          this.La !== a && (this.La = a);
        },
      },
      charge: {
        get: function () {
          return this.I;
        },
        set: function (a) {
          this.I !== a && (this.I = a);
        },
      },
      mass: {
        get: function () {
          return this.eb;
        },
        set: function (a) {
          this.eb !== a && (this.eb = a);
        },
      },
      forceX: {
        get: function () {
          return this.Y;
        },
        set: function (a) {
          this.Y !== a && (this.Y = a);
        },
      },
      forceY: {
        get: function () {
          return this.Ja;
        },
        set: function (a) {
          this.Ja !== a && (this.Ja = a);
        },
      },
    });
    Zr.className = 'ForceDirectedVertex';
    function $r(a) {
      Tp.call(this, a);
      this.l = this.v = NaN;
    }
    la($r, Tp);
    ma.Object.defineProperties($r.prototype, {
      stiffness: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v !== a && (this.v = a);
        },
      },
      length: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.l !== a && (this.l = a);
        },
      },
    });
    $r.className = 'ForceDirectedEdge';
    function Yr() {
      var a = 0;
      void 0 === a && (a = 42);
      this.seed = a;
      this.ty = 48271;
      this.vy = 2147483647;
      this.Q = 44488.07041494893;
      this.xy = 3399;
      this.uy = 1 / 2147483647;
      this.random();
    }
    Yr.prototype.random = function () {
      var a = (this.seed % this.Q) * this.ty - (this.seed / this.Q) * this.xy;
      0 < a ? (this.seed = a) : (this.seed = a + this.vy);
      return this.seed * this.uy;
    };
    Yr.className = 'RandomNumberGenerator';
    function as() {
      Di.call(this);
      this.$b = this.oe = 25;
      this.J = 0;
      this.Qk = bs;
      this.ul = cs;
      this.jl = ds;
      this.zj = 4;
      this.Fk = es;
      this.mg = 7;
      this.af = !0;
      this.ro = 4;
      this.Ea = this.Zr = this.wa = -1;
      this.pd = this.Bo = 0;
      this.Ha = this.nd = this.od = this.Kd = this.fc = null;
      this.Lo = 0;
      this.Ko = this.Ej = null;
      this.Pd = 0;
      this.Mo = null;
      this.If = new H();
      this.re = [];
      this.re.length = 100;
    }
    la(as, Di);
    as.prototype.cloneProtected = function (a) {
      Di.prototype.cloneProtected.call(this, a);
      a.oe = this.oe;
      a.$b = this.$b;
      a.J = this.J;
      a.Qk = this.Qk;
      a.ul = this.ul;
      a.jl = this.jl;
      a.zj = this.zj;
      a.Fk = this.Fk;
      a.mg = this.mg;
      a.af = this.af;
      a.ro = this.ro;
    };
    as.prototype.bb = function (a) {
      a.classType === as
        ? 0 === a.name.indexOf('Aggressive')
          ? (this.aggressiveOption = a)
          : 0 === a.name.indexOf('Cycle')
          ? (this.cycleRemoveOption = a)
          : 0 === a.name.indexOf('Init')
          ? (this.initializeOption = a)
          : 0 === a.name.indexOf('Layer')
          ? (this.layeringOption = a)
          : B('Unknown enum value: ' + a)
        : Di.prototype.bb.call(this, a);
    };
    as.prototype.createNetwork = function () {
      return new fs(this);
    };
    as.prototype.doLayout = function (a) {
      null === this.network && (this.network = this.makeNetwork(a));
      this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin);
      this.Zr = -1;
      this.pd = this.Bo = 0;
      this.Mo = this.Ko = this.Ej = null;
      for (a = 0; a < this.re.length; a++) this.re[a] = null;
      if (0 < this.network.vertexes.count) {
        this.network.hq();
        this.cycleRemoveOption !== gs && this.removeCycles();
        for (a = this.network.vertexes.iterator; a.next(); ) a.value.layer = -1;
        this.wa = -1;
        this.assignLayers();
        for (a.reset(); a.next(); ) this.wa = Math.max(this.wa, a.value.layer);
        this.cycleRemoveOption === gs && this.removeCycles();
        a = this.network;
        for (var b = [], c = a.edges.iterator; c.next(); ) {
          var d = c.value;
          d.valid = !1;
          b.push(d);
        }
        for (c = 0; c < b.length; c++) {
          d = b[c];
          var e = d.fromVertex,
            f = d.toVertex;
          if (
            !d.valid &&
            ((null !== e.node && null !== f.node) || e.layer !== f.layer)
          ) {
            var g = 0,
              h = 0,
              k = 0,
              l = 0;
            if (null !== d.link) {
              h = d.link;
              if (null === h) continue;
              var m = e.node;
              g = f.node;
              if (null === m || null === g) continue;
              var n = h.fromNode;
              k = h.toNode;
              var p = h.fromPort;
              h = h.toPort;
              if (d.rev) {
                l = n;
                var r = p;
                n = k;
                p = h;
                k = l;
                h = r;
              }
              var q = e.focus;
              l = f.focus;
              var u = d.rev ? f.bounds : e.bounds;
              r = H.alloc();
              m !== n
                ? u.u() && n.isVisible()
                  ? n.actualBounds.u()
                    ? (n.uf(p, Ac, r),
                      (r.x += n.actualBounds.x - u.x),
                      (r.y += n.actualBounds.y - u.y))
                    : (n.uf(p, Ac, r), r.u() || r.assign(q))
                  : r.assign(q)
                : u.u()
                ? (n.uf(p, Ac, r), r.u() || r.assign(q))
                : r.assign(q);
              n = d.rev ? e.bounds : f.bounds;
              m = H.alloc();
              g !== k
                ? n.u() && k.isVisible()
                  ? k.actualBounds.u()
                    ? (k.uf(h, Ac, m),
                      (m.x += k.actualBounds.x - n.x),
                      (m.y += k.actualBounds.y - n.y))
                    : (k.uf(h, Ac, m), m.u() || m.assign(l))
                  : m.assign(l)
                : n.u()
                ? (k.uf(h, Ac, m), m.u() || m.assign(l))
                : m.assign(l);
              90 === this.J || 270 === this.J
                ? ((g = Math.round((r.x - q.x) / this.$b)),
                  (k = r.x),
                  (h = Math.round((m.x - l.x) / this.$b)),
                  (l = m.x))
                : ((g = Math.round((r.y - q.y) / this.$b)),
                  (k = r.y),
                  (h = Math.round((m.y - l.y) / this.$b)),
                  (l = m.y));
              H.free(r);
              H.free(m);
              d.portFromColOffset = g;
              d.portFromPos = k;
              d.portToColOffset = h;
              d.portToPos = l;
            } else
              (d.portFromColOffset = 0),
                (d.portFromPos = 0),
                (d.portToColOffset = 0),
                (d.portToPos = 0);
            r = e.layer;
            m = f.layer;
            n = 0;
            u = d.link;
            if (null !== u) {
              var v = u.fromPort,
                w = u.toPort;
              if (null !== v && null !== w) {
                var y = u.fromNode;
                p = u.toNode;
                if (null !== y && null !== p) {
                  var z = hs(this, !0),
                    A = hs(this, !1),
                    C = this.setsPortSpots ? z : u.computeSpot(!0, v);
                  q = this.setsPortSpots ? A : u.computeSpot(!1, w);
                  var I = u.isOrthogonal;
                  C.xf() && C.vf(A) && q.xf() && q.vf(z)
                    ? (n = 0)
                    : ((z = u.getLinkPoint(y, v, C, !0, I, p, w, H.alloc())),
                      (A = u.getLinkDirection(y, v, z, C, !0, I, p, w)),
                      H.free(z),
                      C.wt() || A !== is(this, d, !0)
                        ? this.setsPortSpots &&
                          null !== y &&
                          1 === y.ports.count &&
                          d.rev &&
                          (n += 1)
                        : (n += 1),
                      (C = u.getLinkPoint(p, w, q, !1, I, y, v, H.alloc())),
                      (u = u.getLinkDirection(p, w, C, q, !1, I, y, v)),
                      H.free(C),
                      q.wt() || u !== is(this, d, !1)
                        ? this.setsPortSpots &&
                          null !== p &&
                          1 === p.ports.count &&
                          d.rev &&
                          (n += 2)
                        : (n += 2));
                }
              }
            }
            p = n;
            n = 1 === p || 3 === p ? !0 : !1;
            if ((p = 2 === p || 3 === p ? !0 : !1))
              (q = a.createVertex()),
                (q.node = null),
                (q.Wj = 1),
                (q.layer = r),
                (q.near = e),
                a.Fh(q),
                (e = a.nk(e, q, d.link)),
                (e.valid = !1),
                (e.rev = d.rev),
                (e.portFromColOffset = g),
                (e.portToColOffset = 0),
                (e.portFromPos = k),
                (e.portToPos = 0),
                (e = q);
            u = 1;
            n && u--;
            if (r - m > u && 0 < r) {
              d.valid = !1;
              q = a.createVertex();
              q.node = null;
              q.Wj = 2;
              q.layer = r - 1;
              a.Fh(q);
              e = a.nk(e, q, d.link);
              e.valid = !0;
              e.rev = d.rev;
              e.portFromColOffset = p ? 0 : g;
              e.portToColOffset = 0;
              e.portFromPos = p ? 0 : k;
              e.portToPos = 0;
              e = q;
              for (r--; r - m > u && 0 < r; )
                (q = a.createVertex()),
                  (q.node = null),
                  (q.Wj = 3),
                  (q.layer = r - 1),
                  a.Fh(q),
                  (e = a.nk(e, q, d.link)),
                  (e.valid = !0),
                  (e.rev = d.rev),
                  (e.portFromColOffset = 0),
                  (e.portToColOffset = 0),
                  (e.portFromPos = 0),
                  (e.portToPos = 0),
                  (e = q),
                  r--;
              e = a.nk(q, f, d.link);
              e.valid = !n;
              n && (q.near = f);
              e.rev = d.rev;
              e.portFromColOffset = 0;
              e.portToColOffset = h;
              e.portFromPos = 0;
              e.portToPos = l;
            } else d.valid = !0;
          }
        }
        a = this.fc = [];
        for (b = 0; b <= this.wa; b++) a[b] = 0;
        for (b = this.network.vertexes.iterator; b.next(); ) b.value.index = -1;
        this.initializeIndices();
        this.Zr = -1;
        for (c = this.pd = this.Bo = 0; c <= this.wa; c++)
          a[c] > a[this.pd] && ((this.Zr = a[c] - 1), (this.pd = c)),
            a[c] < a[this.Bo] && (this.Bo = c);
        this.Mo = [];
        for (c = 0; c < a.length; c++) this.Mo[c] = [];
        for (b.reset(); b.next(); )
          (a = b.value), (this.Mo[a.layer][a.index] = a);
        this.Ea = -1;
        for (a = 0; a <= this.wa; a++) {
          b = js(this, a);
          c = 0;
          d = this.fc[a];
          for (f = 0; f < d; f++)
            (e = b[f]),
              (c += this.nodeMinColumnSpace(e, !0)),
              (e.column = c),
              (c += 1),
              (c += this.nodeMinColumnSpace(e, !1));
          this.Ea = Math.max(this.Ea, c - 1);
          ks(this, a, b);
        }
        this.reduceCrossings();
        this.straightenAndPack();
        this.updateParts();
      }
      this.network = null;
      this.isValidLayout = !0;
    };
    as.prototype.linkMinLength = function () {
      return 1;
    };
    function ls(a) {
      var b = a.fromVertex.node;
      a = a.toVertex.node;
      return null === b && null === a ? 8 : null === b || null === a ? 4 : 1;
    }
    as.prototype.nodeMinLayerSpace = function (a, b) {
      return null === a.node
        ? 0
        : 90 === this.J || 270 === this.J
        ? b
          ? a.focus.y + 10
          : a.bounds.height - a.focus.y + 10
        : b
        ? a.focus.x + 10
        : a.bounds.width - a.focus.x + 10;
    };
    as.prototype.nodeMinColumnSpace = function (a, b) {
      if (null === a.node) return 0;
      var c = b ? a.Rv : a.Qv;
      if (null !== c) return c;
      c = this.J;
      return 90 === c || 270 === c
        ? b
          ? (a.Rv = (a.focus.x / this.$b + 1) | 0)
          : (a.Qv = ((a.bounds.width - a.focus.x) / this.$b + 1) | 0)
        : b
        ? (a.Rv = (a.focus.y / this.$b + 1) | 0)
        : (a.Qv = ((a.bounds.height - a.focus.y) / this.$b + 1) | 0);
    };
    function ms(a) {
      null === a.Ej && (a.Ej = []);
      for (var b = 0, c = a.network.vertexes.iterator; c.next(); ) {
        var d = c.value;
        a.Ej[b] = d.layer;
        b++;
        a.Ej[b] = d.column;
        b++;
        a.Ej[b] = d.index;
        b++;
      }
      return a.Ej;
    }
    function ns(a, b) {
      var c = 0;
      for (a = a.network.vertexes.iterator; a.next(); ) {
        var d = a.value;
        d.layer = b[c];
        c++;
        d.column = b[c];
        c++;
        d.index = b[c];
        c++;
      }
    }
    function os(a, b, c) {
      var d = js(a, b),
        e = a.fc[b];
      if (null === a.Ko || a.Ko.length < e * e) a.Ko = [];
      for (var f = a.Ko, g = 0; g < e; g++) {
        var h = 0,
          k = d[g],
          l = k.near;
        if (null !== l && l.layer === k.layer)
          if (((k = l.index), k > g))
            for (var m = g + 1; m < k; m++) {
              var n = d[m];
              (n.near === l && n.Wj === l.Wj) || h++;
            }
          else
            for (m = g - 1; m > k; m--)
              (n = d[m]), (n.near === l && n.Wj === l.Wj) || h++;
        var p;
        if (0 <= c)
          for (k = d[g].sourceEdgesArrayAccess, l = 0; l < k.length; l++) {
            var r = k[l];
            if (r.valid && r.fromVertex.layer !== b)
              for (
                n = r.fromVertex.index,
                  m = r.portToPos,
                  r = r.portFromPos,
                  p = l + 1;
                p < k.length;
                p++
              ) {
                var q = k[p];
                if (q.valid && q.fromVertex.layer !== b) {
                  var u = q.fromVertex.index;
                  var v = q.portToPos;
                  q = q.portFromPos;
                  m < v && (n > u || (n === u && r > q)) && h++;
                  v < m && (u > n || (u === n && q > r)) && h++;
                }
              }
          }
        if (0 >= c)
          for (k = d[g].destinationEdgesArrayAccess, l = 0; l < k.length; l++)
            if (((r = k[l]), r.valid && r.toVertex.layer !== b))
              for (
                n = r.toVertex.index,
                  m = r.portToPos,
                  r = r.portFromPos,
                  p = l + 1;
                p < k.length;
                p++
              )
                (q = k[p]),
                  q.valid &&
                    q.toVertex.layer !== b &&
                    ((u = q.toVertex.index),
                    (v = q.portToPos),
                    (q = q.portFromPos),
                    r < q && (n > u || (n === u && m > v)) && h++,
                    q < r && (u > n || (u === n && v > m)) && h++);
        f[g * e + g] = h;
        for (k = g + 1; k < e; k++) {
          var w = 0,
            y = 0;
          if (0 <= c) {
            h = d[g].sourceEdgesArrayAccess;
            var z = d[k].sourceEdgesArrayAccess;
            for (l = 0; l < h.length; l++)
              if (((r = h[l]), r.valid && r.fromVertex.layer !== b))
                for (
                  n = r.fromVertex.index, r = r.portFromPos, p = 0;
                  p < z.length;
                  p++
                )
                  (q = z[p]),
                    q.valid &&
                      q.fromVertex.layer !== b &&
                      ((u = q.fromVertex.index),
                      (q = q.portFromPos),
                      (n < u || (n === u && r < q)) && y++,
                      (u < n || (u === n && q < r)) && w++);
          }
          if (0 >= c)
            for (
              h = d[g].destinationEdgesArrayAccess,
                z = d[k].destinationEdgesArrayAccess,
                l = 0;
              l < h.length;
              l++
            )
              if (((r = h[l]), r.valid && r.toVertex.layer !== b))
                for (
                  n = r.toVertex.index, m = r.portToPos, p = 0;
                  p < z.length;
                  p++
                )
                  (q = z[p]),
                    q.valid &&
                      q.toVertex.layer !== b &&
                      ((u = q.toVertex.index),
                      (v = q.portToPos),
                      (n < u || (n === u && m < v)) && y++,
                      (u < n || (u === n && v < m)) && w++);
          f[g * e + k] = w;
          f[k * e + g] = y;
        }
      }
      ks(a, b, d);
      return f;
    }
    as.prototype.countCrossings = function () {
      for (var a = 0, b = 0; b <= this.wa; b++)
        for (var c = os(this, b, 1), d = this.fc[b], e = 0; e < d; e++)
          for (var f = e; f < d; f++) a += c[e * d + f];
      return a;
    };
    function ps(a) {
      for (var b = 0, c = 0; c <= a.wa; c++) {
        for (
          var d = a, e = c, f = js(d, e), g = d.fc[e], h = 0, k = 0;
          k < g;
          k++
        ) {
          var l = f[k].destinationEdgesArrayAccess;
          if (null !== l)
            for (var m = 0; m < l.length; m++) {
              var n = l[m];
              if (n.valid && n.toVertex.layer !== e) {
                var p = n.fromVertex.column + n.portFromColOffset;
                var r = n.toVertex.column + n.portToColOffset;
                h += (Math.abs(p - r) + 1) * ls(n);
              }
            }
        }
        ks(d, e, f);
        b += h;
      }
      return b;
    }
    as.prototype.normalize = function () {
      var a = Infinity;
      this.Ea = -1;
      for (var b = this.network.vertexes.iterator; b.next(); ) {
        var c = b.value;
        a = Math.min(a, c.column - this.nodeMinColumnSpace(c, !0));
        this.Ea = Math.max(this.Ea, c.column + this.nodeMinColumnSpace(c, !1));
      }
      for (b.reset(); b.next(); ) b.value.column -= a;
      this.Ea -= a;
    };
    function qs(a, b, c) {
      for (var d = js(a, b), e = a.fc[b], f = [], g = 0; g < e; g++) {
        var h = d[g],
          k = null;
        0 >= c && (k = h.sourceEdgesArrayAccess);
        var l = null;
        0 <= c && (l = h.destinationEdgesArrayAccess);
        var m = 0,
          n = 0,
          p = h.near;
        null !== p && p.layer === h.layer && ((m += p.column - 1), n++);
        if (null !== k)
          for (p = 0; p < k.length; p++) {
            h = k[p];
            var r = h.fromVertex;
            h.valid && !h.rev && r.layer !== b && ((m += r.column), n++);
          }
        if (null !== l)
          for (k = 0; k < l.length; k++)
            (h = l[k]),
              (p = h.toVertex),
              h.valid && !h.rev && p.layer !== b && ((m += p.column), n++);
        f[g] = 0 === n ? -1 : m / n;
      }
      ks(a, b, d);
      return f;
    }
    function rs(a, b, c) {
      for (var d = js(a, b), e = a.fc[b], f = [], g = 0; g < e; g++) {
        var h = d[g],
          k = null;
        0 >= c && (k = h.sourceEdgesArrayAccess);
        var l = null;
        0 <= c && (l = h.destinationEdgesArrayAccess);
        var m = 0,
          n = [],
          p = h.near;
        null !== p && p.layer === h.layer && ((n[m] = p.column - 1), m++);
        h = void 0;
        if (null !== k)
          for (p = 0; p < k.length; p++) {
            h = k[p];
            var r = h.fromVertex;
            h.valid &&
              !h.rev &&
              r.layer !== b &&
              ((n[m] = r.column + h.portFromColOffset), m++);
          }
        if (null !== l)
          for (k = 0; k < l.length; k++)
            (h = l[k]),
              (p = h.toVertex),
              h.valid &&
                !h.rev &&
                p.layer !== b &&
                ((n[m] = p.column + h.portToColOffset), m++);
        0 === m
          ? (f[g] = -1)
          : (n.sort(function (a, b) {
              return a - b;
            }),
            (l = m >> 1),
            (f[g] = 0 !== (m & 1) ? n[l] : (n[l - 1] + n[l]) >> 1));
      }
      ks(a, b, d);
      return f;
    }
    function ss(a, b, c, d, e, f) {
      if (b.component === d) {
        b.component = c;
        if (e)
          for (var g = b.destinationEdges; g.next(); ) {
            var h = g.value;
            var k = h.toVertex;
            var l = b.layer - k.layer;
            h = a.linkMinLength(h);
            l === h && ss(a, k, c, d, e, f);
          }
        if (f)
          for (g = b.sourceEdges; g.next(); )
            (h = g.value),
              (k = h.fromVertex),
              (l = k.layer - b.layer),
              (h = a.linkMinLength(h)),
              l === h && ss(a, k, c, d, e, f);
      }
    }
    function ts(a, b, c, d, e, f) {
      if (b.component === d) {
        b.component = c;
        if (e)
          for (var g = b.destinationEdges; g.next(); )
            ts(a, g.value.toVertex, c, d, e, f);
        if (f)
          for (b = b.sourceEdges; b.next(); )
            ts(a, b.value.fromVertex, c, d, e, f);
      }
    }
    as.prototype.removeCycles = function () {
      for (var a = this.network.edges.iterator; a.next(); ) a.value.rev = !1;
      switch (this.Qk) {
        default:
        case us:
          a = this.network;
          var b = 0,
            c = a.vertexes.count - 1,
            d = [];
          d.length = c + 1;
          for (var e = a.vertexes.iterator; e.next(); ) e.value.valid = !0;
          for (; null !== vs(a); ) {
            for (e = ws(a); null !== e; )
              (d[c] = e), c--, (e.valid = !1), (e = ws(a));
            for (e = xs(a); null !== e; )
              (d[b] = e), b++, (e.valid = !1), (e = xs(a));
            e = null;
            for (var f = 0, g = this.network.vertexes.iterator; g.next(); ) {
              var h = g.value;
              if (h.valid) {
                for (var k = 0, l = h.destinationEdges; l.next(); )
                  l.value.toVertex.valid && k++;
                l = 0;
                for (var m = h.sourceEdges; m.next(); )
                  m.value.fromVertex.valid && l++;
                if (null === e || f < k - l) (e = h), (f = k - l);
              }
            }
            null !== e && ((d[b] = e), b++, (e.valid = !1));
          }
          for (b = 0; b < a.vertexes.count; b++) d[b].index = b;
          for (d = a.edges.iterator; d.next(); )
            (b = d.value),
              b.fromVertex.index > b.toVertex.index && (a.Em(b), (b.rev = !0));
          break;
        case bs:
          for (d = this.network.vertexes.iterator; d.next(); )
            (a = d.value), (a.gm = -1), (a.finish = -1);
          for (a = this.network.edges.iterator; a.next(); ) a.value.forest = !1;
          this.Lo = 0;
          for (d.reset(); d.next(); )
            (b = d.value), 0 === b.sourceEdges.count && ys(this, b);
          for (d.reset(); d.next(); ) (b = d.value), -1 === b.gm && ys(this, b);
          for (a.reset(); a.next(); )
            (d = a.value),
              d.forest ||
                ((b = d.fromVertex),
                (c = b.finish),
                (e = d.toVertex),
                (f = e.finish),
                e.gm < b.gm && c < f && (this.network.Em(d), (d.rev = !0)));
          break;
        case gs:
          a = this.network;
          b = a.vertexes.iterator;
          for (d = Infinity; b.next(); ) d = Math.min(d, b.value.layer);
          if (Infinity > d) {
            if (0 > d) for (b.reset(); b.next(); ) b.value.layer -= d;
            d = [];
            for (b.reset(); b.next(); )
              (c = b.value),
                (e = d[c.layer]),
                void 0 === e ? (d[c.layer] = [c]) : e.push(c);
            for (c = b = 0; c < d.length; c++)
              if (((e = d[c]), !e || 0 === e.length)) b++;
              else if (0 < c) for (f = 0; f < e.length; f++) e[f].layer -= b;
            for (d = a.edges.iterator; d.next(); )
              (b = d.value),
                b.fromVertex.layer < b.toVertex.layer && (a.Em(b), (b.rev = !0));
          }
      }
    };
    function vs(a) {
      for (a = a.vertexes.iterator; a.next(); ) {
        var b = a.value;
        if (b.valid) return b;
      }
      return null;
    }
    function ws(a) {
      for (a = a.vertexes.iterator; a.next(); ) {
        var b = a.value;
        if (b.valid) {
          for (var c = !0, d = b.destinationEdges; d.next(); )
            if (d.value.toVertex.valid) {
              c = !1;
              break;
            }
          if (c) return b;
        }
      }
      return null;
    }
    function xs(a) {
      for (a = a.vertexes.iterator; a.next(); ) {
        var b = a.value;
        if (b.valid) {
          for (var c = !0, d = b.sourceEdges; d.next(); )
            if (d.value.fromVertex.valid) {
              c = !1;
              break;
            }
          if (c) return b;
        }
      }
      return null;
    }
    function ys(a, b) {
      b.gm = a.Lo;
      a.Lo++;
      for (var c = b.destinationEdges; c.next(); ) {
        var d = c.value,
          e = d.toVertex;
        -1 === e.gm && ((d.forest = !0), ys(a, e));
      }
      b.finish = a.Lo;
      a.Lo++;
    }
    as.prototype.assignLayers = function () {
      switch (this.ul) {
        case zs:
          As(this);
          break;
        case Bs:
          for (var a, b = this.network.vertexes.iterator; b.next(); )
            (a = Cs(this, b.value)), (this.wa = Math.max(a, this.wa));
          for (b.reset(); b.next(); )
            (a = b.value), (a.layer = this.wa - a.layer);
          break;
        default:
        case cs:
          As(this);
          for (b = this.network.vertexes.iterator; b.next(); ) b.value.valid = !1;
          for (b.reset(); b.next(); )
            (a = b.value), 0 === a.sourceEdges.count && Ds(this, a);
          a = Infinity;
          for (b.reset(); b.next(); ) a = Math.min(a, b.value.layer);
          this.wa = -1;
          for (b.reset(); b.next(); ) {
            var c = b.value;
            c.layer -= a;
            this.wa = Math.max(this.wa, c.layer);
          }
      }
    };
    function As(a) {
      for (var b = a.network.vertexes.iterator; b.next(); ) {
        var c = Es(a, b.value);
        a.wa = Math.max(c, a.wa);
      }
    }
    function Es(a, b) {
      var c = 0;
      if (-1 === b.layer) {
        for (var d = b.destinationEdges; d.next(); ) {
          var e = d.value,
            f = e.toVertex;
          e = a.linkMinLength(e);
          c = Math.max(c, Es(a, f) + e);
        }
        b.layer = c;
      } else c = b.layer;
      return c;
    }
    function Cs(a, b) {
      var c = 0;
      if (-1 === b.layer) {
        for (var d = b.sourceEdges; d.next(); ) {
          var e = d.value,
            f = e.fromVertex;
          e = a.linkMinLength(e);
          c = Math.max(c, Cs(a, f) + e);
        }
        b.layer = c;
      } else c = b.layer;
      return c;
    }
    function Ds(a, b) {
      if (!b.valid) {
        b.valid = !0;
        for (var c = b.destinationEdges; c.next(); ) Ds(a, c.value.toVertex);
        for (c = a.network.vertexes.iterator; c.next(); ) c.value.component = -1;
        for (var d = b.sourceEdgesArrayAccess, e = d.length, f = 0; f < e; f++) {
          var g = d[f],
            h = g.fromVertex,
            k = g.toVertex;
          g = a.linkMinLength(g);
          h.layer - k.layer > g && ss(a, h, 0, -1, !0, !1);
        }
        for (ss(a, b, 1, -1, !0, !0); 0 !== b.component; ) {
          f = 0;
          d = Infinity;
          h = 0;
          k = null;
          for (g = a.network.vertexes.iterator; g.next(); ) {
            var l = g.value;
            if (1 === l.component) {
              var m = 0,
                n = !1,
                p = l.sourceEdgesArrayAccess;
              e = p.length;
              for (var r = 0; r < e; r++) {
                var q = p[r],
                  u = q.fromVertex;
                m += 1;
                1 !== u.component &&
                  ((f += 1),
                  (u = u.layer - l.layer),
                  (q = a.linkMinLength(q)),
                  (d = Math.min(d, u - q)));
              }
              p = l.destinationEdgesArrayAccess;
              e = p.length;
              for (r = 0; r < e; r++)
                (q = p[r].toVertex), --m, 1 !== q.component ? --f : (n = !0);
              (null === k || m < h) && !n && ((k = l), (h = m));
            }
          }
          if (0 < f) {
            for (c.reset(); c.next(); )
              (e = c.value), 1 === e.component && (e.layer += d);
            b.component = 0;
          } else k.component = 0;
        }
        for (c = a.network.vertexes.iterator; c.next(); ) c.value.component = -1;
        for (ss(a, b, 1, -1, !0, !1); 0 !== b.component; ) {
          d = 0;
          e = Infinity;
          f = 0;
          h = null;
          for (k = a.network.vertexes.iterator; k.next(); )
            if (((g = k.value), 1 === g.component)) {
              l = 0;
              m = !1;
              p = g.sourceEdgesArrayAccess;
              n = p.length;
              for (r = 0; r < n; r++)
                (q = p[r].fromVertex),
                  (l += 1),
                  1 !== q.component ? (d += 1) : (m = !0);
              p = g.destinationEdgesArrayAccess;
              n = p.length;
              for (r = 0; r < n; r++)
                (q = p[r]),
                  (u = q.toVertex),
                  --l,
                  1 !== u.component &&
                    (--d,
                    (u = g.layer - u.layer),
                    (q = a.linkMinLength(q)),
                    (e = Math.min(e, u - q)));
              (null === h || l > f) && !m && ((h = g), (f = l));
            }
          if (0 > d) {
            for (c.reset(); c.next(); )
              (d = c.value), 1 === d.component && (d.layer -= e);
            b.component = 0;
          } else h.component = 0;
        }
      }
    }
    function is(a, b, c) {
      return 90 === a.J
        ? (c && !b.rev) || (!c && b.rev)
          ? 270
          : 90
        : 180 === a.J
        ? (c && !b.rev) || (!c && b.rev)
          ? 0
          : 180
        : 270 === a.J
        ? (c && !b.rev) || (!c && b.rev)
          ? 90
          : 270
        : (c && !b.rev) || (!c && b.rev)
        ? 180
        : 0;
    }
    as.prototype.initializeIndices = function () {
      switch (this.jl) {
        default:
        case Fs:
          for (var a = this.network.vertexes.iterator; a.next(); ) {
            var b = a.value,
              c = b.layer;
            b.index = this.fc[c];
            this.fc[c]++;
          }
          break;
        case ds:
          a = this.network.vertexes.iterator;
          for (b = this.wa; 0 <= b; b--)
            for (a.reset(); a.next(); )
              (c = a.value), c.layer === b && -1 === c.index && Gs(this, c);
          break;
        case Hs:
          for (a = this.network.vertexes.iterator, b = 0; b <= this.wa; b++)
            for (a.reset(); a.next(); )
              (c = a.value), c.layer === b && -1 === c.index && Is(this, c);
      }
    };
    function Gs(a, b) {
      var c = b.layer;
      b.index = a.fc[c];
      a.fc[c]++;
      b = b.destinationEdgesArrayAccess;
      for (c = !0; c; ) {
        c = !1;
        for (var d = 0; d < b.length - 1; d++) {
          var e = b[d],
            f = b[d + 1];
          e.portFromColOffset > f.portFromColOffset &&
            ((c = !0), (b[d] = f), (b[d + 1] = e));
        }
      }
      for (c = 0; c < b.length; c++)
        (d = b[c]), d.valid && ((d = d.toVertex), -1 === d.index && Gs(a, d));
    }
    function Is(a, b) {
      var c = b.layer;
      b.index = a.fc[c];
      a.fc[c]++;
      b = b.sourceEdgesArrayAccess;
      for (var d = !0; d; )
        for (d = !1, c = 0; c < b.length - 1; c++) {
          var e = b[c],
            f = b[c + 1];
          e.portToColOffset > f.portToColOffset &&
            ((d = !0), (b[c] = f), (b[c + 1] = e));
        }
      for (c = 0; c < b.length; c++)
        (d = b[c]), d.valid && ((d = d.fromVertex), -1 === d.index && Is(a, d));
    }
    as.prototype.reduceCrossings = function () {
      var a = this.countCrossings(),
        b = ms(this),
        c,
        d;
      for (c = 0; c < this.zj; c++) {
        for (d = 0; d <= this.wa; d++) Js(this, d, 1), Ks(this, d, 1);
        var e = this.countCrossings();
        e < a && ((a = e), (b = ms(this)));
        for (d = this.wa; 0 <= d; d--) Js(this, d, -1), Ks(this, d, -1);
        e = this.countCrossings();
        e < a && ((a = e), (b = ms(this)));
      }
      ns(this, b);
      for (c = 0; c < this.zj; c++) {
        for (d = 0; d <= this.wa; d++) Js(this, d, 0), Ks(this, d, 0);
        e = this.countCrossings();
        e < a && ((a = e), (b = ms(this)));
        for (d = this.wa; 0 <= d; d--) Js(this, d, 0), Ks(this, d, 0);
        e = this.countCrossings();
        e < a && ((a = e), (b = ms(this)));
      }
      ns(this, b);
      var f, g, h;
      switch (this.Fk) {
        case Ls:
          break;
        case Ms:
          for (h = a + 1; (d = this.countCrossings()) < h; )
            for (h = d, c = this.wa; 0 <= c; c--)
              for (g = 0; g <= c; g++) {
                for (f = !0; f; )
                  for (f = !1, d = c; d >= g; d--) f = Ks(this, d, -1) || f;
                e = this.countCrossings();
                e >= a ? ns(this, b) : ((a = e), (b = ms(this)));
                for (f = !0; f; )
                  for (f = !1, d = c; d >= g; d--) f = Ks(this, d, 1) || f;
                e = this.countCrossings();
                e >= a ? ns(this, b) : ((a = e), (b = ms(this)));
                for (f = !0; f; )
                  for (f = !1, d = g; d <= c; d++) f = Ks(this, d, 1) || f;
                e >= a ? ns(this, b) : ((a = e), (b = ms(this)));
                for (f = !0; f; )
                  for (f = !1, d = g; d <= c; d++) f = Ks(this, d, -1) || f;
                e >= a ? ns(this, b) : ((a = e), (b = ms(this)));
                for (f = !0; f; )
                  for (f = !1, d = c; d >= g; d--) f = Ks(this, d, 0) || f;
                e >= a ? ns(this, b) : ((a = e), (b = ms(this)));
                for (f = !0; f; )
                  for (f = !1, d = g; d <= c; d++) f = Ks(this, d, 0) || f;
                e >= a ? ns(this, b) : ((a = e), (b = ms(this)));
              }
          break;
        default:
        case es:
          for (c = this.wa, g = 0, h = a + 1; (d = this.countCrossings()) < h; ) {
            h = d;
            for (f = !0; f; )
              for (f = !1, d = c; d >= g; d--) f = Ks(this, d, -1) || f;
            e = this.countCrossings();
            e >= a ? ns(this, b) : ((a = e), (b = ms(this)));
            for (f = !0; f; )
              for (f = !1, d = c; d >= g; d--) f = Ks(this, d, 1) || f;
            e = this.countCrossings();
            e >= a ? ns(this, b) : ((a = e), (b = ms(this)));
            for (f = !0; f; )
              for (f = !1, d = g; d <= c; d++) f = Ks(this, d, 1) || f;
            e >= a ? ns(this, b) : ((a = e), (b = ms(this)));
            for (f = !0; f; )
              for (f = !1, d = g; d <= c; d++) f = Ks(this, d, -1) || f;
            e >= a ? ns(this, b) : ((a = e), (b = ms(this)));
            for (f = !0; f; )
              for (f = !1, d = c; d >= g; d--) f = Ks(this, d, 0) || f;
            e >= a ? ns(this, b) : ((a = e), (b = ms(this)));
            for (f = !0; f; )
              for (f = !1, d = g; d <= c; d++) f = Ks(this, d, 0) || f;
            e >= a ? ns(this, b) : ((a = e), (b = ms(this)));
          }
      }
      ns(this, b);
    };
    function Js(a, b, c) {
      var d = js(a, b),
        e = a.fc[b],
        f = rs(a, b, c),
        g = qs(a, b, c);
      for (c = 0; c < e; c++)
        -1 === g[c] && (g[c] = d[c].column), -1 === f[c] && (f[c] = d[c].column);
      for (var h = !0, k; h; )
        for (h = !1, c = 0; c < e - 1; c++)
          if (f[c + 1] < f[c] || (f[c + 1] === f[c] && g[c + 1] < g[c]))
            (h = !0),
              (k = f[c]),
              (f[c] = f[c + 1]),
              (f[c + 1] = k),
              (k = g[c]),
              (g[c] = g[c + 1]),
              (g[c + 1] = k),
              (k = d[c]),
              (d[c] = d[c + 1]),
              (d[c + 1] = k);
      for (c = f = 0; c < e; c++)
        (k = d[c]),
          (k.index = c),
          (f += a.nodeMinColumnSpace(k, !0)),
          (k.column = f),
          (f += 1),
          (f += a.nodeMinColumnSpace(k, !1));
      ks(a, b, d);
    }
    function Ks(a, b, c) {
      var d = js(a, b),
        e = a.fc[b];
      c = os(a, b, c);
      var f;
      var g = [];
      for (f = 0; f < e; f++) g[f] = -1;
      var h = [];
      for (f = 0; f < e; f++) h[f] = -1;
      for (var k = !1, l = !0; l; )
        for (l = !1, f = 0; f < e - 1; f++) {
          var m = c[d[f].index * e + d[f + 1].index],
            n = c[d[f + 1].index * e + d[f].index],
            p = 0,
            r = 0,
            q = d[f].column,
            u = d[f + 1].column,
            v = a.nodeMinColumnSpace(d[f], !0),
            w = a.nodeMinColumnSpace(d[f], !1),
            y = a.nodeMinColumnSpace(d[f + 1], !0),
            z = a.nodeMinColumnSpace(d[f + 1], !1);
          v = q - v + y;
          w = u - w + z;
          var A = d[f].sourceEdges.iterator;
          for (A.reset(); A.next(); )
            if (((y = A.value), (z = y.fromVertex), y.valid && z.layer === b)) {
              for (y = 0; d[y] !== z; ) y++;
              y < f && ((p += 2 * (f - y)), (r += 2 * (f + 1 - y)));
              y === f + 1 && (p += 1);
              y > f + 1 && ((p += 4 * (y - f)), (r += 4 * (y - (f + 1))));
            }
          A = d[f].destinationEdges.iterator;
          for (A.reset(); A.next(); )
            if (((y = A.value), (z = y.toVertex), y.valid && z.layer === b)) {
              for (y = 0; d[y] !== z; ) y++;
              y === f + 1 && (r += 1);
            }
          A = d[f + 1].sourceEdges.iterator;
          for (A.reset(); A.next(); )
            if (((y = A.value), (z = y.fromVertex), y.valid && z.layer === b)) {
              for (y = 0; d[y] !== z; ) y++;
              y < f && ((p += 2 * (f + 1 - y)), (r += 2 * (f - y)));
              y === f && (r += 1);
              y > f + 1 && ((p += 4 * (y - (f + 1))), (r += 4 * (y - f)));
            }
          A = d[f + 1].destinationEdges.iterator;
          for (A.reset(); A.next(); )
            if (((y = A.value), (z = y.toVertex), y.valid && z.layer === b)) {
              for (y = 0; d[y] !== z; ) y++;
              y === f && (p += 1);
            }
          y = z = 0;
          A = g[d[f].index];
          var C = h[d[f].index],
            I = g[d[f + 1].index],
            P = h[d[f + 1].index];
          -1 !== A && ((z += Math.abs(A - q)), (y += Math.abs(A - w)));
          -1 !== C && ((z += Math.abs(C - q)), (y += Math.abs(C - w)));
          -1 !== I && ((z += Math.abs(I - u)), (y += Math.abs(I - v)));
          -1 !== P && ((z += Math.abs(P - u)), (y += Math.abs(P - v)));
          if (
            r < p - 0.5 ||
            (r === p && n < m - 0.5) ||
            (r === p && n === m && y < z - 0.5)
          )
            (l = k = !0),
              (d[f].column = w),
              (d[f + 1].column = v),
              (m = d[f]),
              (d[f] = d[f + 1]),
              (d[f + 1] = m);
        }
      for (f = 0; f < e; f++) d[f].index = f;
      ks(a, b, d);
      return k;
    }
    as.prototype.straightenAndPack = function () {
      var a = 0 !== (this.mg & 1);
      var b = 7 === this.mg;
      1e3 < this.network.edges.count && !b && (a = !1);
      if (a) {
        var c = [];
        for (b = 0; b <= this.wa; b++) c[b] = 0;
        for (var d, e = this.network.vertexes.iterator; e.next(); ) {
          var f = e.value;
          b = f.layer;
          d = f.column;
          f = this.nodeMinColumnSpace(f, !1);
          c[b] = Math.max(c[b], d + f);
        }
        for (e.reset(); e.next(); )
          (f = e.value),
            (b = f.layer),
            (d = f.column),
            (f.column = ((8 * (this.Ea - c[b])) >> 1) + 8 * d);
        this.Ea *= 8;
      }
      if (0 !== (this.mg & 2))
        for (c = !0; c; ) {
          c = !1;
          for (b = this.pd + 1; b <= this.wa; b++) c = Ns(this, b, 1) || c;
          for (b = this.pd - 1; 0 <= b; b--) c = Ns(this, b, -1) || c;
          c = Ns(this, this.pd, 0) || c;
        }
      if (0 !== (this.mg & 4)) {
        for (b = this.pd + 1; b <= this.wa; b++) Os(this, b, 1);
        for (b = this.pd - 1; 0 <= b; b--) Os(this, b, -1);
        Os(this, this.pd, 0);
      }
      a && (Ps(this, -1), Ps(this, 1));
      if (0 !== (this.mg & 2))
        for (c = !0; c; ) {
          c = !1;
          c = Ns(this, this.pd, 0) || c;
          for (b = this.pd + 1; b <= this.wa; b++) c = Ns(this, b, 0) || c;
          for (b = this.pd - 1; 0 <= b; b--) c = Ns(this, b, 0) || c;
        }
    };
    function Ns(a, b, c) {
      for (var d = !1; Qs(a, b, c); ) d = !0;
      return d;
    }
    function Qs(a, b, c) {
      var d,
        e = js(a, b),
        f = a.fc[b],
        g = qs(a, b, -1);
      if (0 < c) for (d = 0; d < f; d++) g[d] = -1;
      var h = qs(a, b, 1);
      if (0 > c) for (d = 0; d < f; d++) h[d] = -1;
      for (var k = !1, l = !0; l; )
        for (l = !1, d = 0; d < f; d++) {
          var m = e[d].column,
            n = a.nodeMinColumnSpace(e[d], !0),
            p = a.nodeMinColumnSpace(e[d], !1),
            r = 0;
          0 > d - 1 ||
          m - e[d - 1].column - 1 > n + a.nodeMinColumnSpace(e[d - 1], !1)
            ? (r = m - 1)
            : (r = m);
          n =
            d + 1 >= f ||
            e[d + 1].column - m - 1 > p + a.nodeMinColumnSpace(e[d + 1], !0)
              ? m + 1
              : m;
          var q = (p = 0),
            u = 0;
          if (0 >= c)
            for (var v = e[d].sourceEdges.iterator; v.next(); ) {
              var w = v.value;
              var y = w.fromVertex;
              if (w.valid && y.layer !== b) {
                var z = ls(w);
                var A = w.portFromColOffset;
                w = w.portToColOffset;
                y = y.column;
                p += (Math.abs(m + w - (y + A)) + 1) * z;
                q += (Math.abs(r + w - (y + A)) + 1) * z;
                u += (Math.abs(n + w - (y + A)) + 1) * z;
              }
            }
          if (0 <= c)
            for (v = e[d].destinationEdges.iterator; v.next(); )
              (w = v.value),
                (y = w.toVertex),
                w.valid &&
                  y.layer !== b &&
                  ((z = ls(w)),
                  (A = w.portFromColOffset),
                  (w = w.portToColOffset),
                  (y = y.column),
                  (p += (Math.abs(m + A - (y + w)) + 1) * z),
                  (q += (Math.abs(r + A - (y + w)) + 1) * z),
                  (u += (Math.abs(n + A - (y + w)) + 1) * z));
          w = A = z = 0;
          v = g[e[d].index];
          y = h[e[d].index];
          -1 !== v &&
            ((z += Math.abs(v - m)),
            (A += Math.abs(v - r)),
            (w += Math.abs(v - n)));
          -1 !== y &&
            ((z += Math.abs(y - m)),
            (A += Math.abs(y - r)),
            (w += Math.abs(y - n)));
          if (q < p || (q === p && A < z)) (l = k = !0), (e[d].column = r);
          else if (u < p || (u === p && w < z)) (l = k = !0), (e[d].column = n);
        }
      ks(a, b, e);
      a.normalize();
      return k;
    }
    function Os(a, b, c) {
      var d = js(a, b),
        e = a.fc[b],
        f = rs(a, b, c),
        g = [];
      for (c = 0; c < e; c++) g[c] = f[c];
      for (f = !0; f; )
        for (f = !1, c = 0; c < e; c++) {
          var h = d[c].column,
            k = a.nodeMinColumnSpace(d[c], !0),
            l = a.nodeMinColumnSpace(d[c], !1),
            m = 0;
          if (-1 === g[c])
            if (0 === c && c === e - 1) m = h;
            else if (0 === c) {
              var n = d[c + 1].column;
              n - h === l + a.nodeMinColumnSpace(d[c + 1], !0)
                ? (m = h - 1)
                : (m = h);
            } else
              c === e - 1
                ? ((n = d[c - 1].column),
                  (m =
                    h - n === k + a.nodeMinColumnSpace(d[c - 1], !1) ? h + 1 : h))
                : ((n = d[c - 1].column),
                  (k = n + a.nodeMinColumnSpace(d[c - 1], !1) + k + 1),
                  (n = d[c + 1].column),
                  (l = n - a.nodeMinColumnSpace(d[c + 1], !0) - l - 1),
                  (m = ((k + l) / 2) | 0));
          else
            0 === c && c === e - 1
              ? (m = g[c])
              : 0 === c
              ? ((n = d[c + 1].column),
                (l = n - a.nodeMinColumnSpace(d[c + 1], !0) - l - 1),
                (m = Math.min(g[c], l)))
              : c === e - 1
              ? ((n = d[c - 1].column),
                (k = n + a.nodeMinColumnSpace(d[c - 1], !1) + k + 1),
                (m = Math.max(g[c], k)))
              : ((n = d[c - 1].column),
                (k = n + a.nodeMinColumnSpace(d[c - 1], !1) + k + 1),
                (n = d[c + 1].column),
                (l = n - a.nodeMinColumnSpace(d[c + 1], !0) - l - 1),
                k < g[c] && g[c] < l
                  ? (m = g[c])
                  : k >= g[c]
                  ? (m = k)
                  : l <= g[c] && (m = l));
          m !== h && ((f = !0), (d[c].column = m));
        }
      ks(a, b, d);
      a.normalize();
    }
    function Rs(a, b) {
      for (var c = !0, d = a.network.vertexes.iterator; d.next(); ) {
        var e = d.value,
          f = a.nodeMinColumnSpace(e, !0),
          g = a.nodeMinColumnSpace(e, !1);
        if (e.column - f <= b && e.column + g >= b) {
          c = !1;
          break;
        }
      }
      a = !1;
      if (c)
        for (d.reset(); d.next(); )
          (c = d.value), c.column > b && (--c.column, (a = !0));
      return a;
    }
    function Ss(a, b) {
      var c = b + 1;
      var d,
        e = [],
        f = [];
      for (d = 0; d <= a.wa; d++) (e[d] = !1), (f[d] = !1);
      for (var g = a.network.vertexes.iterator; g.next(); ) {
        d = g.value;
        var h = d.column - a.nodeMinColumnSpace(d, !0),
          k = d.column + a.nodeMinColumnSpace(d, !1);
        h <= b && k >= b && (e[d.layer] = !0);
        h <= c && k >= c && (f[d.layer] = !0);
      }
      h = !0;
      c = !1;
      for (d = 0; d <= a.wa; d++) h = h && !(e[d] && f[d]);
      if (h)
        for (g.reset(); g.next(); )
          (a = g.value), a.column > b && (--a.column, (c = !0));
      return c;
    }
    function Ps(a, b) {
      for (var c = 0; c <= a.Ea; c++) for (; Rs(a, c); );
      a.normalize();
      for (c = 0; c < a.Ea; c++) for (; Ss(a, c); );
      a.normalize();
      var d;
      if (0 < b)
        for (c = 0; c <= a.Ea; c++) {
          var e = ms(a);
          var f = ps(a);
          for (d = f + 1; f < d; ) {
            d = f;
            Ts(a, c, 1);
            var g = ps(a);
            g > f ? ns(a, e) : g < f && ((f = g), (e = ms(a)));
          }
        }
      if (0 > b)
        for (c = a.Ea; 0 <= c; c--)
          for (e = ms(a), f = ps(a), d = f + 1; f < d; )
            (d = f),
              Ts(a, c, -1),
              (g = ps(a)),
              g > f ? ns(a, e) : g < f && ((f = g), (e = ms(a)));
      a.normalize();
    }
    function Ts(a, b, c) {
      a.Pd = 0;
      for (var d = a.network.vertexes.iterator; d.next(); )
        d.value.component = -1;
      if (0 < c)
        for (d.reset(); d.next(); ) {
          var e = d.value;
          e.column - a.nodeMinColumnSpace(e, !0) <= b && (e.component = a.Pd);
        }
      if (0 > c)
        for (d.reset(); d.next(); )
          (e = d.value),
            e.column + a.nodeMinColumnSpace(e, !1) >= b && (e.component = a.Pd);
      a.Pd++;
      for (d.reset(); d.next(); )
        (b = d.value), -1 === b.component && (ts(a, b, a.Pd, -1, !0, !0), a.Pd++);
      var f;
      b = [];
      for (f = 0; f < a.Pd * a.Pd; f++) b[f] = !1;
      e = [];
      for (f = 0; f < (a.wa + 1) * (a.Ea + 1); f++) e[f] = -1;
      for (d.reset(); d.next(); ) {
        f = d.value;
        for (
          var g = f.layer,
            h = Math.max(0, f.column - a.nodeMinColumnSpace(f, !0)),
            k = Math.min(a.Ea, f.column + a.nodeMinColumnSpace(f, !1));
          h <= k;
          h++
        )
          e[g * (a.Ea + 1) + h] = f.component;
      }
      for (f = 0; f <= a.wa; f++) {
        if (0 < c)
          for (g = 0; g < a.Ea; g++)
            -1 !== e[f * (a.Ea + 1) + g] &&
              -1 !== e[f * (a.Ea + 1) + g + 1] &&
              e[f * (a.Ea + 1) + g] !== e[f * (a.Ea + 1) + g + 1] &&
              (b[e[f * (a.Ea + 1) + g] * a.Pd + e[f * (a.Ea + 1) + g + 1]] = !0);
        if (0 > c)
          for (g = a.Ea; 0 < g; g--)
            -1 !== e[f * (a.Ea + 1) + g] &&
              -1 !== e[f * (a.Ea + 1) + g - 1] &&
              e[f * (a.Ea + 1) + g] !== e[f * (a.Ea + 1) + g - 1] &&
              (b[e[f * (a.Ea + 1) + g] * a.Pd + e[f * (a.Ea + 1) + g - 1]] = !0);
      }
      e = [];
      for (f = 0; f < a.Pd; f++) e[f] = !0;
      g = [];
      for (g.push(0); 0 !== g.length; )
        if (((k = g[g.length - 1]), g.pop(), e[k]))
          for (e[k] = !1, f = 0; f < a.Pd; f++)
            b[k * a.Pd + f] && g.splice(0, 0, f);
      if (0 < c)
        for (d.reset(); d.next(); ) (a = d.value), e[a.component] && --a.column;
      if (0 > c)
        for (d.reset(); d.next(); )
          (c = d.value), e[c.component] && (c.column += 1);
    }
    as.prototype.commitLayout = function () {
      if (this.setsPortSpots)
        for (
          var a = hs(this, !0), b = hs(this, !1), c = this.network.edges.iterator;
          c.next();
  
        ) {
          var d = c.value.link;
          null !== d && ((d.fromSpot = a), (d.toSpot = b));
        }
      this.commitNodes();
      this.jv();
      this.isRouting && this.commitLinks();
    };
    function hs(a, b) {
      return 270 === a.J
        ? b
          ? dd
          : gd
        : 90 === a.J
        ? b
          ? gd
          : dd
        : 180 === a.J
        ? b
          ? ed
          : fd
        : b
        ? fd
        : ed;
    }
    as.prototype.commitNodes = function () {
      this.Kd = [];
      this.od = [];
      this.nd = [];
      this.Ha = [];
      for (var a = 0; a <= this.wa; a++)
        (this.Kd[a] = 0), (this.od[a] = 0), (this.nd[a] = 0), (this.Ha[a] = 0);
      for (a = this.network.vertexes.iterator; a.next(); ) {
        var b = a.value,
          c = b.layer;
        this.Kd[c] = Math.max(this.Kd[c], this.nodeMinLayerSpace(b, !0));
        this.od[c] = Math.max(this.od[c], this.nodeMinLayerSpace(b, !1));
      }
      b = 0;
      c = this.oe;
      for (var d = 0; d <= this.wa; d++) {
        var e = c;
        0 >= this.Kd[d] + this.od[d] && (e = 0);
        0 < d && (b += e / 2);
        90 === this.J || 0 === this.J
          ? ((b += this.od[d]), (this.nd[d] = b), (b += this.Kd[d]))
          : ((b += this.Kd[d]), (this.nd[d] = b), (b += this.od[d]));
        d < this.wa && (b += e / 2);
        this.Ha[d] = b;
      }
      c = b;
      b = this.arrangementOrigin;
      for (d = 0; d <= this.wa; d++)
        270 === this.J
          ? (this.nd[d] = b.y + this.nd[d])
          : 90 === this.J
          ? ((this.nd[d] = b.y + c - this.nd[d]), (this.Ha[d] = c - this.Ha[d]))
          : 180 === this.J
          ? (this.nd[d] = b.x + this.nd[d])
          : ((this.nd[d] = b.x + c - this.nd[d]), (this.Ha[d] = c - this.Ha[d]));
      a.reset();
      for (c = d = Infinity; a.next(); ) {
        e = a.value;
        var f = e.layer,
          g = e.column | 0;
        if (270 === this.J || 90 === this.J) {
          var h = b.x + this.$b * g;
          f = this.nd[f];
        } else (h = this.nd[f]), (f = b.y + this.$b * g);
        e.centerX = h;
        e.centerY = f;
        d = Math.min(e.x, d);
        c = Math.min(e.y, c);
      }
      d = b.x - d;
      b = b.y - c;
      this.If = new H(d, b);
      for (a.reset(); a.next(); )
        (c = a.value), (c.x += d), (c.y += b), c.commit();
    };
    as.prototype.jv = function () {
      for (var a = 0, b = this.oe, c = 0; c <= this.wa; c++)
        (a += this.Kd[c]), (a += this.od[c]);
      a += this.wa * b;
      b = [];
      c = this.$b * this.Ea;
      for (var d = this.maxLayer; 0 <= d; d--)
        270 === this.J
          ? 0 === d
            ? b.push(new N(0, 0, c, Math.abs(this.Ha[0])))
            : b.push(
                new N(
                  0,
                  this.Ha[d - 1],
                  c,
                  Math.abs(this.Ha[d - 1] - this.Ha[d]),
                ),
              )
          : 90 === this.J
          ? 0 === d
            ? b.push(new N(0, this.Ha[0], c, Math.abs(this.Ha[0] - a)))
            : b.push(
                new N(0, this.Ha[d], c, Math.abs(this.Ha[d - 1] - this.Ha[d])),
              )
          : 180 === this.J
          ? 0 === d
            ? b.push(new N(0, 0, Math.abs(this.Ha[0]), c))
            : b.push(
                new N(
                  this.Ha[d - 1],
                  0,
                  Math.abs(this.Ha[d - 1] - this.Ha[d]),
                  c,
                ),
              )
          : 0 === d
          ? b.push(new N(this.Ha[0], 0, Math.abs(this.Ha[0] - a), c))
          : b.push(
              new N(this.Ha[d], 0, Math.abs(this.Ha[d - 1] - this.Ha[d]), c),
            );
      this.commitLayers(b, this.If);
    };
    as.prototype.commitLayers = function () {};
    as.prototype.commitLinks = function () {
      for (var a = this.network.edges.iterator, b; a.next(); )
        (b = a.value.link), null !== b && (b.Oh(), b.$j(), b.pf());
      for (a.reset(); a.next(); ) (b = a.value.link), null !== b && b.gj();
      for (a.reset(); a.next(); ) {
        var c = a.value;
        b = c.link;
        if (null !== b) {
          b.Oh();
          var d = b,
            e = d.fromNode,
            f = d.toNode,
            g = d.fromPort,
            h = d.toPort;
          if (null !== e) {
            var k = e.findVisibleNode();
            null !== k && k !== e && ((e = k), (g = k.port));
          }
          null !== f &&
            ((k = f.findVisibleNode()),
            null !== k && k !== f && ((f = k), (h = k.port)));
          var l = b.computeSpot(!0, g);
          k = b.computeSpot(!1, h);
          var m = c.fromVertex,
            n = c.toVertex;
          if (c.valid) {
            if (b.curve === rg && 4 === b.pointsCount)
              if (m.column === n.column)
                (c = b.getLinkPoint(e, g, l, !0, !1, f, h)),
                  (g = b.getLinkPoint(f, h, k, !1, !1, e, g)),
                  c.u() || c.set(e.actualBounds.center),
                  g.u() || g.set(f.actualBounds.center),
                  b.$j(),
                  b.nf(c.x, c.y),
                  b.nf((2 * c.x + g.x) / 3, (2 * c.y + g.y) / 3),
                  b.nf((c.x + 2 * g.x) / 3, (c.y + 2 * g.y) / 3),
                  b.nf(g.x, g.y);
              else {
                var p = !1,
                  r = !1;
                null !== g && l === uc && (p = !0);
                null !== h && k === uc && (r = !0);
                if (p || r) {
                  var q = b.i(0).x;
                  c = b.i(0).y;
                  m = b.i(3).x;
                  d = b.i(3).y;
                  p &&
                    (90 === this.J || 270 === this.J
                      ? ((p = q), (n = (c + d) / 2))
                      : ((p = (q + m) / 2), (n = c)),
                    b.K(1, p, n),
                    (l = b.getLinkPoint(e, g, l, !0, !1, f, h)),
                    l.u() || l.set(e.actualBounds.center),
                    b.K(0, l.x, l.y));
                  r &&
                    (90 === this.J || 270 === this.J
                      ? ((l = m), (c = (c + d) / 2))
                      : ((l = (q + m) / 2), (c = d)),
                    b.K(2, l, c),
                    (e = b.getLinkPoint(f, h, k, !1, !1, e, g)),
                    e.u() || e.set(f.actualBounds.center),
                    b.K(3, e.x, e.y));
                }
              }
            b.pf();
          } else if (m.layer === n.layer) b.pf();
          else {
            p = r = !1;
            q = b.firstPickIndex + 1;
            if (b.isOrthogonal) {
              p = !0;
              var u = b.pointsCount;
              4 < u && b.points.removeRange(2, u - 3);
            } else if (b.curve === rg)
              (r = !0),
                (u = b.pointsCount),
                4 < u && b.points.removeRange(2, u - 3),
                4 === u && (q = 2);
            else {
              u = b.pointsCount;
              var v = l === uc,
                w = k === uc;
              2 < u && v && w
                ? b.points.removeRange(1, u - 2)
                : 3 < u && v && !w
                ? b.points.removeRange(1, u - 3)
                : 3 < u && !v && w
                ? b.points.removeRange(2, u - 2)
                : 4 < u && !v && !w && b.points.removeRange(2, u - 3);
            }
            if (c.rev) {
              for (; null !== n && m !== n; ) {
                var y = (u = null);
                for (
                  v = n.sourceEdges.iterator;
                  v.next() &&
                  ((w = v.value),
                  w.link !== c.link ||
                    ((u = w.fromVertex), (y = w.toVertex), null !== u.node));
  
                );
                if (u !== m) {
                  v = b.i(q - 1).x;
                  w = b.i(q - 1).y;
                  var z = u.centerX;
                  var A = u.centerY;
                  if (p)
                    180 === this.J || 0 === this.J
                      ? q === b.firstPickIndex + 1
                        ? (b.m(q++, v, w), b.m(q++, v, A))
                        : (null !== y ? y.centerY : w) !== A &&
                          ((y = this.Ha[u.layer - 1] + this.If.x),
                          b.m(q++, y, w),
                          b.m(q++, y, A))
                      : q === b.firstPickIndex + 1
                      ? (b.m(q++, v, w), b.m(q++, z, w))
                      : (null !== y ? y.centerX : v) !== z &&
                        ((y = this.Ha[u.layer - 1] + this.If.y),
                        b.m(q++, v, y),
                        b.m(q++, z, y));
                  else if (q === b.firstPickIndex + 1) {
                    y = Math.max(10, this.Kd[n.layer]);
                    var C = Math.max(10, this.od[n.layer]);
                    if (r)
                      180 === this.J
                        ? z <= n.bounds.x
                          ? ((n = n.bounds.x),
                            b.m(q++, n - y, A),
                            b.m(q++, n, A),
                            b.m(q++, n + C, A))
                          : (b.m(q++, z - y, A),
                            b.m(q++, z, A),
                            b.m(q++, z + C, A))
                        : 90 === this.J
                        ? A >= n.bounds.bottom
                          ? ((n = n.bounds.y + n.bounds.height),
                            b.m(q++, z, n + C),
                            b.m(q++, z, n),
                            b.m(q++, z, n - y))
                          : (b.m(q++, z, A + C),
                            b.m(q++, z, A),
                            b.m(q++, z, A - y))
                        : 270 === this.J
                        ? A <= n.bounds.y
                          ? ((n = n.bounds.y),
                            b.m(q++, z, n - y),
                            b.m(q++, z, n),
                            b.m(q++, z, n + C))
                          : (b.m(q++, z, A - y),
                            b.m(q++, z, A),
                            b.m(q++, z, A + C))
                        : 0 === this.J &&
                          (z >= n.bounds.right
                            ? ((n = n.bounds.x + n.bounds.width),
                              b.m(q++, n + C, A),
                              b.m(q++, n, A),
                              b.m(q++, n - y, A))
                            : (b.m(q++, z + C, A),
                              b.m(q++, z, A),
                              b.m(q++, z - y, A)));
                    else {
                      b.m(q++, v, w);
                      var I = 0;
                      if (180 === this.J || 0 === this.J) {
                        if (
                          180 === this.J ? z >= n.bounds.right : z <= n.bounds.x
                        )
                          I = (0 === this.J ? -y : C) / 2;
                        b.m(q++, v + I, A);
                      } else {
                        if (
                          270 === this.J ? A >= n.bounds.bottom : A <= n.bounds.y
                        )
                          I = (90 === this.J ? -y : C) / 2;
                        b.m(q++, z, w + I);
                      }
                      b.m(q++, z, A);
                    }
                  } else
                    (y = Math.max(10, this.Kd[u.layer])),
                      (C = Math.max(10, this.od[u.layer])),
                      180 === this.J
                        ? (r && b.m(q++, z - y, A),
                          b.m(q++, z, A),
                          r && b.m(q++, z + C, A))
                        : 90 === this.J
                        ? (r && b.m(q++, z, A + C),
                          b.m(q++, z, A),
                          r && b.m(q++, z, A - y))
                        : 270 === this.J
                        ? (r && b.m(q++, z, A - y),
                          b.m(q++, z, A),
                          r && b.m(q++, z, A + C))
                        : (r && b.m(q++, z + C, A),
                          b.m(q++, z, A),
                          r && b.m(q++, z - y, A));
                }
                n = u;
              }
              if (null === h || l !== uc || p)
                if (
                  ((v = b.i(q - 1).x),
                  (w = b.i(q - 1).y),
                  (z = b.i(q).x),
                  (A = b.i(q).y),
                  p)
                )
                  (n = this.od[m.layer]),
                    180 === this.J || 0 === this.J
                      ? ((p = w),
                        p >= m.bounds.y &&
                          p <= m.bounds.bottom &&
                          (180 === this.J
                            ? z >= m.bounds.x
                            : z <= m.bounds.right) &&
                          ((n = m.centerX + (180 === this.J ? -n : n)),
                          p < m.bounds.y + m.bounds.height / 2
                            ? (p = m.bounds.y - this.$b / 2)
                            : (p = m.bounds.bottom + this.$b / 2),
                          b.m(q++, n, w),
                          b.m(q++, n, p)),
                        b.m(q++, z, p))
                      : ((p = v),
                        p >= m.bounds.x &&
                          p <= m.bounds.right &&
                          (270 === this.J
                            ? A >= m.bounds.y
                            : A <= m.bounds.bottom) &&
                          ((n = m.centerY + (270 === this.J ? -n : n)),
                          p < m.bounds.x + m.bounds.width / 2
                            ? (p = m.bounds.x - this.$b / 2)
                            : (p = m.bounds.right + this.$b / 2),
                          b.m(q++, v, n),
                          b.m(q++, p, n)),
                        b.m(q++, p, A)),
                    b.m(q++, z, A);
                else if (r)
                  (y = Math.max(10, this.Kd[m.layer])),
                    (C = Math.max(10, this.od[m.layer])),
                    180 === this.J && z >= m.bounds.x
                      ? ((n = m.bounds.x + m.bounds.width),
                        b.K(q - 2, n, w),
                        b.K(q - 1, n + C, w))
                      : 90 === this.J && A <= m.bounds.bottom
                      ? ((n = m.bounds.y), b.K(q - 2, v, n), b.K(q - 1, v, n - y))
                      : 270 === this.J && A >= m.bounds.y
                      ? ((n = m.bounds.y + m.bounds.height),
                        b.K(q - 2, v, n),
                        b.K(q - 1, v, n + C))
                      : 0 === this.J &&
                        z <= m.bounds.right &&
                        ((n = m.bounds.x),
                        b.K(q - 2, n, w),
                        b.K(q - 1, n - y, w));
                else {
                  y = Math.max(10, this.Kd[m.layer]);
                  C = Math.max(10, this.od[m.layer]);
                  p = 0;
                  if (180 === this.J || 0 === this.J) {
                    if (180 === this.J ? z <= m.bounds.x : z >= m.bounds.right)
                      p = (0 === this.J ? C : -y) / 2;
                    b.m(q++, z + p, w);
                  } else {
                    if (270 === this.J ? A <= m.bounds.y : A >= m.bounds.bottom)
                      p = (90 === this.J ? C : -y) / 2;
                    b.m(q++, v, A + p);
                  }
                  b.m(q++, z, A);
                }
            } else {
              for (; null !== m && m !== n; ) {
                y = u = null;
                for (
                  m = m.destinationEdges.iterator;
                  m.next() &&
                  ((v = m.value),
                  v.link !== c.link ||
                    ((u = v.toVertex),
                    (y = v.fromVertex),
                    null !== y.node && (y = null),
                    null !== u.node));
  
                );
                u !== n &&
                  ((v = b.i(q - 1).x),
                  (w = b.i(q - 1).y),
                  (z = u.centerX),
                  (A = u.centerY),
                  p
                    ? 180 === this.J || 0 === this.J
                      ? (null !== y ? y.centerY : w) !== A &&
                        ((y = this.Ha[u.layer] + this.If.x),
                        q === b.firstPickIndex + 1 &&
                          (y = 0 === this.J ? Math.max(y, v) : Math.min(y, v)),
                        b.m(q++, y, w),
                        b.m(q++, y, A))
                      : (null !== y ? y.centerX : v) !== z &&
                        ((y = this.Ha[u.layer] + this.If.y),
                        q === b.firstPickIndex + 1 &&
                          (y = 90 === this.J ? Math.max(y, w) : Math.min(y, w)),
                        b.m(q++, v, y),
                        b.m(q++, z, y))
                    : ((y = Math.max(10, this.Kd[u.layer])),
                      (C = Math.max(10, this.od[u.layer])),
                      180 === this.J
                        ? (b.m(q++, z + C, A),
                          r && b.m(q++, z, A),
                          b.m(q++, z - y, A))
                        : 90 === this.J
                        ? (b.m(q++, z, A - y),
                          r && b.m(q++, z, A),
                          b.m(q++, z, A + C))
                        : 270 === this.J
                        ? (b.m(q++, z, A + C),
                          r && b.m(q++, z, A),
                          b.m(q++, z, A - y))
                        : (b.m(q++, z - y, A),
                          r && b.m(q++, z, A),
                          b.m(q++, z + C, A))));
                m = u;
              }
              p &&
                ((v = b.i(q - 1).x),
                (w = b.i(q - 1).y),
                (z = b.i(q).x),
                (A = b.i(q).y),
                180 === this.J || 0 === this.J
                  ? w !== A &&
                    ((y =
                      0 === this.J
                        ? Math.min(
                            Math.max((z + v) / 2, this.Ha[n.layer] + this.If.x),
                            z,
                          )
                        : Math.max(
                            Math.min((z + v) / 2, this.Ha[n.layer] + this.If.x),
                            z,
                          )),
                    b.m(q++, y, w),
                    b.m(q++, y, A))
                  : v !== z &&
                    ((y =
                      90 === this.J
                        ? Math.min(
                            Math.max((A + w) / 2, this.Ha[n.layer] + this.If.y),
                            A,
                          )
                        : Math.max(
                            Math.min((A + w) / 2, this.Ha[n.layer] + this.If.y),
                            A,
                          )),
                    b.m(q++, v, y),
                    b.m(q++, z, y)));
            }
            null !== d &&
              r &&
              (null !== g &&
                (l === uc &&
                  ((l = b.i(0)),
                  (d = b.i(2)),
                  l.A(d) || b.K(1, (l.x + d.x) / 2, (l.y + d.y) / 2)),
                (l = b.getLinkPoint(e, g, uc, !0, !1, f, h)),
                l.u() || l.set(e.actualBounds.center),
                b.K(0, l.x, l.y)),
              null !== h &&
                (k === uc &&
                  ((k = b.i(b.pointsCount - 1)),
                  (l = b.i(b.pointsCount - 3)),
                  k.A(l) ||
                    b.K(b.pointsCount - 2, (k.x + l.x) / 2, (k.y + l.y) / 2)),
                (e = b.getLinkPoint(f, h, uc, !1, !1, e, g)),
                e.u() || e.set(f.actualBounds.center),
                b.K(b.pointsCount - 1, e.x, e.y)));
            b.pf();
            c.commit();
          }
        }
      }
      this.avoidOrthogonalOverlaps();
    };
    as.prototype.avoidOrthogonalOverlaps = function () {
      for (var a = new E(), b = this.network.edges.iterator; b.next(); ) {
        var c = b.value.link;
        null !== c && c.isOrthogonal && !a.contains(c) && a.add(c);
      }
      if (0 < a.count)
        if (90 === this.J || 270 === this.J) {
          b = 0;
          c = [];
          for (a = a.iterator; a.next(); ) {
            var d = a.value;
            if (null !== d && d.isOrthogonal)
              for (var e = 2; e < d.pointsCount - 3; e++) {
                var f = d.i(e);
                var g = d.i(e + 1);
                if (this.w(f.y, g.y) && !this.w(f.x, g.x)) {
                  var h = new Us();
                  h.layer = Math.floor(f.y / 2);
                  var k = d.i(0),
                    l = d.i(d.pointsCount - 1);
                  h.first = k.x * k.x + k.y;
                  h.Wb = l.x * l.x + l.y;
                  h.Rc = Math.min(f.x, g.x);
                  h.sc = Math.max(f.x, g.x);
                  h.index = e;
                  h.link = d;
                  if (e + 2 < d.pointsCount) {
                    k = d.i(e - 1);
                    l = d.i(e + 2);
                    var m = 0;
                    k.y < f.y
                      ? (m = l.y < f.y ? 3 : f.x < g.x ? 2 : 1)
                      : k.y > f.y && (m = l.y > f.y ? 0 : g.x < f.x ? 2 : 1);
                    h.l = m;
                  }
                  c.push(h);
                }
              }
          }
          if (1 < c.length)
            for (c.sort(this.iy), a = 0; a < c.length; ) {
              f = c[a].layer;
              for (d = a + 1; d < c.length && c[d].layer === f; ) d++;
              if (1 < d - a)
                for (f = a; f < d; ) {
                  g = c[f].sc;
                  for (e = a + 1; e < d && c[e].Rc < g; )
                    (g = Math.max(g, c[e].sc)), e++;
                  g = e - f;
                  if (1 < g) {
                    this.dj(c, this.Kt, f, f + g);
                    m = 1;
                    h = c[f].Wb;
                    for (k = f; k < e; k++)
                      (l = c[k]), l.Wb !== h && (m++, (h = l.Wb));
                    this.dj(c, this.hy, f, f + g);
                    var n = 1;
                    h = c[f].first;
                    for (k = f; k < e; k++)
                      (l = c[k]), l.first !== h && (n++, (h = l.first));
                    k = !0;
                    l = n;
                    m < n
                      ? ((k = !1),
                        (l = m),
                        (h = c[f].Wb),
                        this.dj(c, this.Kt, f, f + g))
                      : (h = c[f].first);
                    m = 0;
                    for (n = f; n < e; n++) {
                      var p = c[n];
                      (k ? p.first : p.Wb) !== h &&
                        (m++, (h = k ? p.first : p.Wb));
                      var r = p.link;
                      f = r.i(p.index);
                      g = r.i(p.index + 1);
                      var q = this.linkSpacing * (m - (l - 1) / 2);
                      b++;
                      r.Oh();
                      r.K(p.index, f.x, f.y + q);
                      r.K(p.index + 1, g.x, g.y + q);
                      r.pf();
                    }
                  }
                  f = e;
                }
              a = d;
            }
        } else {
          b = 0;
          c = [];
          for (a = a.iterator; a.next(); )
            if (((d = a.value), null !== d && d.isOrthogonal))
              for (e = 2; e < d.pointsCount - 3; e++)
                (f = d.i(e)),
                  (g = d.i(e + 1)),
                  this.w(f.x, g.x) &&
                    !this.w(f.y, g.y) &&
                    ((h = new Us()),
                    (h.layer = Math.floor(f.x / 2)),
                    (k = d.i(0)),
                    (l = d.i(d.pointsCount - 1)),
                    (h.first = k.x + k.y * k.y),
                    (h.Wb = l.x + l.y * l.y),
                    (h.Rc = Math.min(f.y, g.y)),
                    (h.sc = Math.max(f.y, g.y)),
                    (h.index = e),
                    (h.link = d),
                    e + 2 < d.pointsCount &&
                      ((k = d.i(e - 1)),
                      (l = d.i(e + 2)),
                      (m = 0),
                      k.x < f.x
                        ? (m = l.x < f.x ? 3 : f.y < g.y ? 2 : 1)
                        : k.x > f.x && (m = l.x > f.x ? 0 : g.y < f.y ? 2 : 1),
                      (h.l = m)),
                    c.push(h));
          if (1 < c.length)
            for (c.sort(this.iy), a = 0; a < c.length; ) {
              f = c[a].layer;
              for (d = a + 1; d < c.length && c[d].layer === f; ) d++;
              if (1 < d - a)
                for (f = a; f < d; ) {
                  g = c[f].sc;
                  for (e = a + 1; e < d && c[e].Rc < g; )
                    (g = Math.max(g, c[e].sc)), e++;
                  g = e - f;
                  if (1 < g) {
                    this.dj(c, this.Kt, f, f + g);
                    m = 1;
                    h = c[f].Wb;
                    for (k = f; k < e; k++)
                      (l = c[k]), l.Wb !== h && (m++, (h = l.Wb));
                    this.dj(c, this.hy, f, f + g);
                    n = 1;
                    h = c[f].first;
                    for (k = f; k < e; k++)
                      (l = c[k]), l.first !== h && (n++, (h = l.first));
                    k = !0;
                    l = n;
                    m < n
                      ? ((k = !1),
                        (l = m),
                        (h = c[f].Wb),
                        this.dj(c, this.Kt, f, f + g))
                      : (h = c[f].first);
                    m = 0;
                    for (n = f; n < e; n++)
                      (p = c[n]),
                        (k ? p.first : p.Wb) !== h &&
                          (m++, (h = k ? p.first : p.Wb)),
                        (r = p.link),
                        (f = r.i(p.index)),
                        (g = r.i(p.index + 1)),
                        (q = this.linkSpacing * (m - (l - 1) / 2)),
                        b++,
                        r.Oh(),
                        r.K(p.index, f.x + q, f.y),
                        r.K(p.index + 1, g.x + q, g.y),
                        r.pf();
                  }
                  f = e;
                }
              a = d;
            }
        }
    };
    t = as.prototype;
    t.iy = function (a, b) {
      return a instanceof Us && b instanceof Us && a !== b
        ? a.layer < b.layer
          ? -1
          : a.layer > b.layer
          ? 1
          : a.Rc < b.Rc
          ? -1
          : a.Rc > b.Rc
          ? 1
          : a.sc < b.sc
          ? -1
          : a.sc > b.sc
          ? 1
          : 0
        : 0;
    };
    t.hy = function (a, b) {
      return a instanceof Us && b instanceof Us && a !== b
        ? a.first < b.first
          ? -1
          : a.first > b.first || a.l < b.l
          ? 1
          : a.l > b.l || a.Rc < b.Rc
          ? -1
          : a.Rc > b.Rc
          ? 1
          : a.sc < b.sc
          ? -1
          : a.sc > b.sc
          ? 1
          : 0
        : 0;
    };
    t.Kt = function (a, b) {
      return a instanceof Us && b instanceof Us && a !== b
        ? a.Wb < b.Wb
          ? -1
          : a.Wb > b.Wb || a.l < b.l
          ? 1
          : a.l > b.l || a.Rc < b.Rc
          ? -1
          : a.Rc > b.Rc
          ? 1
          : a.sc < b.sc
          ? -1
          : a.sc > b.sc
          ? 1
          : 0
        : 0;
    };
    t.w = function (a, b) {
      a -= b;
      return -1 < a && 1 > a;
    };
    t.dj = function (a, b, c, d) {
      var e = a.length,
        f = d - c;
      if (!(1 >= f))
        if (
          ((0 > c || c >= e - 1) && B('not in range 0 <= from < length: ' + c),
          2 === f)
        )
          (d = a[c]), (e = a[c + 1]), 0 < b(d, e) && ((a[c] = e), (a[c + 1] = d));
        else if (0 === c)
          if (d >= e) a.sort(b);
          else for (c = a.slice(0, d), c.sort(b), b = 0; b < d; b++) a[b] = c[b];
        else if (d >= e)
          for (d = a.slice(c), d.sort(b), b = c; b < e; b++) a[b] = d[b - c];
        else
          for (e = a.slice(c, d), e.sort(b), b = c; b < d; b++) a[b] = e[b - c];
    };
    function js(a, b) {
      var c = a.fc[b];
      if (c >= a.re.length) {
        var d = [];
        for (var e = 0; e < a.re.length; e++) d[e] = a.re[e];
        a.re = d;
      }
      void 0 === a.re[c] || null === a.re[c]
        ? (d = [])
        : ((d = a.re[c]), (a.re[c] = null));
      a = a.Mo[b];
      for (b = 0; b < a.length; b++) (c = a[b]), (d[c.index] = c);
      return d;
    }
    function ks(a, b, c) {
      a.re[a.fc[b]] = c;
    }
    ma.Object.defineProperties(as.prototype, {
      layerSpacing: {
        get: function () {
          return this.oe;
        },
        set: function (a) {
          this.oe !== a && 0 <= a && ((this.oe = a), this.C());
        },
      },
      columnSpacing: {
        get: function () {
          return this.$b;
        },
        set: function (a) {
          this.$b !== a && 0 < a && ((this.$b = a), this.C());
        },
      },
      direction: {
        get: function () {
          return this.J;
        },
        set: function (a) {
          this.J !== a &&
            (0 === a || 90 === a || 180 === a || 270 === a
              ? ((this.J = a), this.C())
              : B('LayeredDigraphLayout.direction must be 0, 90, 180, or 270'));
        },
      },
      cycleRemoveOption: {
        get: function () {
          return this.Qk;
        },
        set: function (a) {
          this.Qk === a ||
            (a !== us && a !== bs && a !== gs) ||
            ((this.Qk = a), this.C());
        },
      },
      layeringOption: {
        get: function () {
          return this.ul;
        },
        set: function (a) {
          this.ul === a ||
            (a !== cs && a !== zs && a !== Bs) ||
            ((this.ul = a), this.C());
        },
      },
      initializeOption: {
        get: function () {
          return this.jl;
        },
        set: function (a) {
          this.jl === a ||
            (a !== ds && a !== Hs && a !== Fs) ||
            ((this.jl = a), this.C());
        },
      },
      iterations: {
        get: function () {
          return this.zj;
        },
        set: function (a) {
          this.zj !== a && 0 <= a && ((this.zj = a), this.C());
        },
      },
      aggressiveOption: {
        get: function () {
          return this.Fk;
        },
        set: function (a) {
          this.Fk === a ||
            (a !== Ls && a !== es && a !== Ms) ||
            ((this.Fk = a), this.C());
        },
      },
      packOption: {
        get: function () {
          return this.mg;
        },
        set: function (a) {
          this.mg !== a && 0 <= a && 8 > a && ((this.mg = a), this.C());
        },
      },
      setsPortSpots: {
        get: function () {
          return this.af;
        },
        set: function (a) {
          this.af !== a && ((this.af = a), this.C());
        },
      },
      linkSpacing: {
        get: function () {
          return this.ro;
        },
        set: function (a) {
          this.ro !== a && 0 <= a && ((this.ro = a), this.C());
        },
      },
      maxLayer: {
        get: function () {
          return this.wa;
        },
      },
      maxIndex: {
        get: function () {
          return this.Zr;
        },
      },
      maxColumn: {
        get: function () {
          return this.Ea;
        },
      },
      minIndexLayer: {
        get: function () {
          return this.Bo;
        },
      },
      maxIndexLayer: {
        get: function () {
          return this.pd;
        },
      },
    });
    var bs = new D(as, 'CycleDepthFirst', 0),
      us = new D(as, 'CycleGreedy', 1),
      gs = new D(as, 'CycleFromLayers', 2),
      cs = new D(as, 'LayerOptimalLinkLength', 0),
      zs = new D(as, 'LayerLongestPathSink', 1),
      Bs = new D(as, 'LayerLongestPathSource', 2),
      ds = new D(as, 'InitDepthFirstOut', 0),
      Hs = new D(as, 'InitDepthFirstIn', 1),
      Fs = new D(as, 'InitNaive', 2),
      Ls = new D(as, 'AggressiveNone', 0),
      es = new D(as, 'AggressiveLess', 1),
      Ms = new D(as, 'AggressiveMore', 2);
    as.className = 'LayeredDigraphLayout';
    as.CycleDepthFirst = bs;
    as.CycleGreedy = us;
    as.CycleFromLayers = gs;
    as.LayerOptimalLinkLength = cs;
    as.LayerLongestPathSink = zs;
    as.LayerLongestPathSource = Bs;
    as.InitDepthFirstOut = ds;
    as.InitDepthFirstIn = Hs;
    as.InitNaive = Fs;
    as.AggressiveNone = Ls;
    as.AggressiveLess = es;
    as.AggressiveMore = Ms;
    as.PackNone = 0;
    as.PackExpand = 1;
    as.PackStraighten = 2;
    as.PackMedian = 4;
    as.PackAll = 7;
    function Us() {
      this.index = this.sc = this.Rc = this.Wb = this.first = this.layer = 0;
      this.link = null;
      this.l = 0;
    }
    Us.className = 'SegInfo';
    function fs(a) {
      Pp.call(this, a);
    }
    la(fs, Pp);
    fs.prototype.createVertex = function () {
      return new Vs(this);
    };
    fs.prototype.createEdge = function () {
      return new Ws(this);
    };
    fs.className = 'LayeredDigraphNetwork';
    function Vs(a) {
      Sp.call(this, a);
      this.Pa = this.Og = this.ui = -1;
      this.I = NaN;
      this.Y = null;
      this.valid = !1;
      this.finish = this.gm = NaN;
      this.Wj = 0;
      this.Qv = this.Rv = null;
    }
    la(Vs, Sp);
    ma.Object.defineProperties(Vs.prototype, {
      layer: {
        get: function () {
          return this.ui;
        },
        set: function (a) {
          this.ui !== a && (this.ui = a);
        },
      },
      column: {
        get: function () {
          return this.Og;
        },
        set: function (a) {
          this.Og !== a && (this.Og = a);
        },
      },
      index: {
        get: function () {
          return this.Pa;
        },
        set: function (a) {
          this.Pa !== a && (this.Pa = a);
        },
      },
      component: {
        get: function () {
          return this.I;
        },
        set: function (a) {
          this.I !== a && (this.I = a);
        },
      },
      near: {
        get: function () {
          return this.Y;
        },
        set: function (a) {
          this.Y !== a && (this.Y = a);
        },
      },
    });
    Vs.className = 'LayeredDigraphVertex';
    function Ws(a) {
      Tp.call(this, a);
      this.l = this.La = this.eb = !1;
      this.Ja = this.I = NaN;
      this.Y = this.v = 0;
    }
    la(Ws, Tp);
    ma.Object.defineProperties(Ws.prototype, {
      valid: {
        get: function () {
          return this.eb;
        },
        set: function (a) {
          this.eb !== a && (this.eb = a);
        },
      },
      rev: {
        get: function () {
          return this.La;
        },
        set: function (a) {
          this.La !== a && (this.La = a);
        },
      },
      forest: {
        get: function () {
          return this.l;
        },
        set: function (a) {
          this.l !== a && (this.l = a);
        },
      },
      portFromPos: {
        get: function () {
          return this.I;
        },
        set: function (a) {
          this.I !== a && (this.I = a);
        },
      },
      portToPos: {
        get: function () {
          return this.Ja;
        },
        set: function (a) {
          this.Ja !== a && (this.Ja = a);
        },
      },
      portFromColOffset: {
        get: function () {
          return this.v;
        },
        set: function (a) {
          this.v !== a && (this.v = a);
        },
      },
      portToColOffset: {
        get: function () {
          return this.Y;
        },
        set: function (a) {
          this.Y !== a && (this.Y = a);
        },
      },
    });
    Ws.className = 'LayeredDigraphEdge';
    function Xs() {
      Di.call(this);
      this.Ib = new F();
      this.$o = Ys;
      this.Xc = Zs;
      this.Wp = $s;
      this.Yr = at;
      this.Ow = [];
      this.Vc = !0;
      this.Bb = bt;
      this.zd = new L(10, 10).freeze();
      var a = new ct(this);
      this.T = new dt(a);
      this.U = new dt(a);
      this.Uu = [];
    }
    la(Xs, Di);
    Xs.prototype.cloneProtected = function (a) {
      Di.prototype.cloneProtected.call(this, a);
      a.$o = this.$o;
      a.Wp = this.Wp;
      a.Yr = this.Yr;
      a.Vc = this.Vc;
      a.Bb = this.Bb;
      a.zd.assign(this.zd);
      a.T.copyInheritedPropertiesFrom(this.T);
      a.U.copyInheritedPropertiesFrom(this.U);
    };
    Xs.prototype.bb = function (a) {
      a.classType === Xs
        ? 0 === a.name.indexOf('Alignment')
          ? (this.alignment = a)
          : 0 === a.name.indexOf('Arrangement')
          ? (this.arrangement = a)
          : 0 === a.name.indexOf('Compaction')
          ? (this.compaction = a)
          : 0 === a.name.indexOf('Path')
          ? (this.path = a)
          : 0 === a.name.indexOf('Sorting')
          ? (this.sorting = a)
          : 0 === a.name.indexOf('Style')
          ? (this.treeStyle = a)
          : B('Unknown enum value: ' + a)
        : Di.prototype.bb.call(this, a);
    };
    Xs.prototype.createNetwork = function () {
      return new ct(this);
    };
    Xs.prototype.makeNetwork = function (a) {
      function b(a) {
        if (a instanceof U) return !a.isLinkLabel && 'Comment' !== a.category;
        if (a instanceof S) {
          var b = a.fromNode;
          if (null === b || b.isLinkLabel || 'Comment' === b.category) return !1;
          a = a.toNode;
          return null === a || a.isLinkLabel || 'Comment' === a.category
            ? !1
            : !0;
        }
        return !1;
      }
      var c = this.createNetwork();
      a instanceof R
        ? (c.xg(a.nodes, !0, b), c.xg(a.links, !0, b))
        : a instanceof xf
        ? c.xg(a.memberParts, !1, b)
        : c.xg(a.iterator, !1, b);
      return c;
    };
    Xs.prototype.doLayout = function (a) {
      null === this.network && (this.network = this.makeNetwork(a));
      this.arrangement !== et &&
        (this.arrangementOrigin = this.initialOrigin(this.arrangementOrigin));
      var b = this.diagram;
      null === b && a instanceof R && (b = a);
      this.path === Ys && null !== b
        ? (this.Xc = b.isTreePathToChildren ? Zs : ft)
        : (this.Xc = this.path === Ys ? Zs : this.path);
      if (0 < this.network.vertexes.count) {
        this.network.hq();
        for (a = this.network.vertexes.iterator; a.next(); )
          (b = a.value),
            (b.initialized = !1),
            (b.level = 0),
            (b.parent = null),
            (b.children = []);
        if (0 < this.Ib.count) {
          a = new F();
          for (b = this.Ib.iterator; b.next(); ) {
            var c = b.value;
            c instanceof U
              ? ((c = this.network.Vi(c)), null !== c && a.add(c))
              : c instanceof dt && a.add(c);
          }
          this.Ib = a;
        }
        0 === this.Ib.count && this.findRoots();
        for (a = this.Ib.copy().iterator; a.next(); )
          (b = a.value), b.initialized || ((b.initialized = !0), gt(this, b));
        b = this.network.vertexes;
        for (a = null; (a = ht(b)), 0 < a.count; )
          (b = it(this, a)),
            null !== b && this.Ib.add(b),
            (b.initialized = !0),
            gt(this, b),
            (b = a);
        for (a = this.Ib.iterator; a.next(); )
          (b = a.value), b instanceof dt && jt(this, b);
        for (a = this.Ib.iterator; a.next(); )
          (b = a.value), b instanceof dt && kt(this, b);
        for (a = this.Ib.iterator; a.next(); )
          (b = a.value), b instanceof dt && lt(this, b);
        this.gv();
        if (this.layerStyle === mt) {
          a = [];
          for (b = this.network.vertexes.iterator; b.next(); ) {
            c = b.value;
            var d = c.parent;
            null === d && (d = c);
            d = 0 === d.angle || 180 === d.angle;
            var e = a[c.level];
            void 0 === e && (e = 0);
            a[c.level] = Math.max(e, d ? c.width : c.height);
          }
          for (b = 0; b < a.length; b++) void 0 === a[b] && (a[b] = 0);
          this.Ow = a;
          for (b = this.network.vertexes.iterator; b.next(); )
            (c = b.value),
              (d = c.parent),
              null === d && (d = c),
              0 === d.angle || 180 === d.angle
                ? (180 === d.angle && (c.focusX += a[c.level] - c.width),
                  (c.width = a[c.level]))
                : (270 === d.angle && (c.focusY += a[c.level] - c.height),
                  (c.height = a[c.level]));
        } else if (this.layerStyle === nt)
          for (a = this.network.vertexes.iterator; a.next(); ) {
            b = a.value;
            c = 0 === b.angle || 180 === b.angle;
            d = -1;
            for (e = 0; e < b.children.length; e++) {
              var f = b.children[e];
              d = Math.max(d, c ? f.width : f.height);
            }
            if (0 <= d)
              for (e = 0; e < b.children.length; e++)
                (f = b.children[e]),
                  c
                    ? (180 === b.angle && (f.focusX += d - f.width),
                      (f.width = d))
                    : (270 === b.angle && (f.focusY += d - f.height),
                      (f.height = d));
          }
        for (a = this.Ib.iterator; a.next(); )
          (b = a.value), b instanceof dt && this.layoutTree(b);
        this.arrangeTrees();
        this.updateParts();
      }
      this.network = null;
      this.Ib = new F();
      this.isValidLayout = !0;
    };
    function ht(a) {
      var b = new F();
      for (a = a.iterator; a.next(); ) {
        var c = a.value;
        c.initialized || b.add(c);
      }
      return b;
    }
    Xs.prototype.findRoots = function () {
      for (var a = this.network.vertexes, b = a.iterator; b.next(); ) {
        var c = b.value;
        switch (this.Xc) {
          case Zs:
            0 === c.sourceEdges.count && this.Ib.add(c);
            break;
          case ft:
            0 === c.destinationEdges.count && this.Ib.add(c);
            break;
          default:
            B('Unhandled path value ' + this.Xc.toString());
        }
      }
      0 === this.Ib.count && ((a = it(this, a)), null !== a && this.Ib.add(a));
    };
    function it(a, b) {
      var c = 999999,
        d = null;
      for (b = b.iterator; b.next(); ) {
        var e = b.value;
        switch (a.Xc) {
          case Zs:
            e.sourceEdges.count < c && ((c = e.sourceEdges.count), (d = e));
            break;
          case ft:
            e.destinationEdges.count < c &&
              ((c = e.destinationEdges.count), (d = e));
            break;
          default:
            B('Unhandled path value ' + a.Xc.toString());
        }
      }
      return d;
    }
    function gt(a, b) {
      if (null !== b) {
        switch (a.Xc) {
          case Zs:
            if (0 < b.destinationEdges.count) {
              for (var c = new E(), d = b.destinationVertexes; d.next(); ) {
                var e = d.value;
                ot(a, b, e) && c.add(e);
              }
              0 < c.count && (b.children = c.na());
            }
            break;
          case ft:
            if (0 < b.sourceEdges.count) {
              c = new E();
              for (d = b.sourceVertexes; d.next(); )
                (e = d.value), ot(a, b, e) && c.add(e);
              0 < c.count && (b.children = c.na());
            }
            break;
          default:
            B('Unhandled path value' + a.Xc.toString());
        }
        c = b.children;
        d = c.length;
        for (e = 0; e < d; e++) {
          var f = c[e];
          f.initialized = !0;
          f.level = b.level + 1;
          f.parent = b;
          a.Ib.remove(f);
        }
        for (b = 0; b < d; b++) gt(a, c[b]);
      }
    }
    function ot(a, b, c) {
      if (c.initialized) {
        if (null === b) var d = !1;
        else {
          for (d = b.parent; null !== d && d !== c; ) d = d.parent;
          d = d === c;
        }
        if (d || c.level > b.level) return !1;
        a.removeChild(c.parent, c);
      }
      return !0;
    }
    Xs.prototype.removeChild = function (a, b) {
      if (null !== a && null !== b) {
        for (var c = a.children, d = 0, e = 0; e < c.length; e++)
          c[e] === b && d++;
        if (0 < d) {
          d = Array(c.length - d);
          for (var f = (e = 0); f < c.length; f++) c[f] !== b && (d[e++] = c[f]);
          a.children = d;
        }
      }
    };
    function jt(a, b) {
      if (null !== b) {
        a.initializeTreeVertexValues(b);
        b.alignment === pt && a.sortTreeVertexChildren(b);
        for (
          var c = 0,
            d = b.childrenCount,
            e = 0,
            f = b.children,
            g = f.length,
            h = 0;
          h < g;
          h++
        ) {
          var k = f[h];
          jt(a, k);
          c += k.descendantCount + 1;
          d = Math.max(d, k.maxChildrenCount);
          e = Math.max(e, k.maxGenerationCount);
        }
        b.descendantCount = c;
        b.maxChildrenCount = d;
        b.maxGenerationCount = 0 < d ? e + 1 : 0;
      }
    }
    function qt(a, b) {
      switch (a.Wp) {
        default:
        case $s:
          return null !== b.parent ? b.parent : a.T;
        case rt:
          return null === b.parent
            ? a.T
            : null === b.parent.parent
            ? a.U
            : b.parent;
        case st:
          return null !== b.parent
            ? null !== b.parent.parent
              ? b.parent.parent
              : a.U
            : a.T;
        case tt:
          var c = !0;
          if (0 === b.childrenCount) c = !1;
          else
            for (var d = b.children, e = d.length, f = 0; f < e; f++)
              if (0 < d[f].childrenCount) {
                c = !1;
                break;
              }
          return c && null !== b.parent
            ? a.U
            : null !== b.parent
            ? b.parent
            : a.T;
      }
    }
    Xs.prototype.initializeTreeVertexValues = function (a) {
      a.copyInheritedPropertiesFrom(qt(this, a));
      if (null !== a.parent && a.parent.alignment === pt) {
        for (
          var b = a.angle, c = a.parent.children, d = 0;
          d < c.length && a !== c[d];
  
        )
          d++;
        0 === d % 2
          ? d !== c.length - 1 &&
            (b = 90 === b ? 180 : 180 === b ? 270 : 270 === b ? 180 : 270)
          : (b = 90 === b ? 0 : 180 === b ? 90 : 270 === b ? 0 : 90);
        a.angle = b;
      }
      a.initialized = !0;
    };
    function kt(a, b) {
      if (null !== b) {
        a.assignTreeVertexValues(b);
        b = b.children;
        for (var c = b.length, d = 0; d < c; d++) kt(a, b[d]);
      }
    }
    Xs.prototype.assignTreeVertexValues = function () {};
    function lt(a, b) {
      if (null !== b) {
        b.alignment !== pt && a.sortTreeVertexChildren(b);
        b = b.children;
        for (var c = b.length, d = 0; d < c; d++) lt(a, b[d]);
      }
    }
    Xs.prototype.sortTreeVertexChildren = function (a) {
      switch (a.sorting) {
        case ut:
          break;
        case vt:
          a.children.reverse();
          break;
        case wt:
          a.children.sort(a.comparer);
          break;
        case xt:
          a.children.sort(a.comparer);
          a.children.reverse();
          break;
        default:
          B('Unhandled sorting value ' + a.sorting.toString());
      }
    };
    Xs.prototype.gv = function () {
      if (this.comments)
        for (var a = this.network.vertexes.iterator; a.next(); )
          this.addComments(a.value);
    };
    Xs.prototype.addComments = function (a) {
      var b = a.angle,
        c = a.parent,
        d = 0;
      var e = !1;
      null !== c && ((d = c.angle), (e = c.alignment), (e = yt(e)));
      b = 90 === b || 270 === b;
      d = 90 === d || 270 === d;
      c = 0 === a.childrenCount;
      var f = 0,
        g = 0,
        h = 0,
        k = a.commentSpacing;
      if (null !== a.node)
        for (var l = a.node.uv(); l.next(); ) {
          var m = l.value;
          'Comment' === m.category &&
            m.canLayout() &&
            (null === a.comments && (a.comments = []),
            a.comments.push(m),
            m.zb(),
            (m = m.measuredBounds),
            (b && !c) || (!e && !d && c) || (e && d && c)
              ? ((f = Math.max(f, m.width)), (g += m.height + Math.abs(h)))
              : ((f += m.width + Math.abs(h)), (g = Math.max(g, m.height))),
            (h = k));
        }
      null !== a.comments &&
        ((b && !c) || (!e && !d && c) || (e && d && c)
          ? ((f += Math.abs(a.commentMargin)), (g = Math.max(0, g - a.height)))
          : ((g += Math.abs(a.commentMargin)), (f = Math.max(0, f - a.width))),
        (e = N.allocAt(0, 0, a.bounds.width + f, a.bounds.height + g)),
        (a.bounds = e),
        N.free(e));
    };
    function yt(a) {
      return a === zt || a === pt || a === At || a === Bt;
    }
    function Ct(a) {
      return a === zt || a === pt;
    }
    function Dt(a) {
      var b = a.parent;
      if (null !== b) {
        var c = b.alignment;
        if (yt(c)) {
          if (Ct(c)) {
            b = b.children;
            for (c = 0; c < b.length && a !== b[c]; ) c++;
            return 0 === c % 2;
          }
          if (c === At) return !0;
        }
      }
      return !1;
    }
    Xs.prototype.layoutComments = function (a) {
      if (null !== a.comments) {
        var b = a.node.measuredBounds,
          c = a.parent,
          d = a.angle,
          e = 0;
        var f = !1;
        null !== c && ((e = c.angle), (f = c.alignment), (f = yt(f)));
        d = 90 === d || 270 === d;
        c = 90 === e || 270 === e;
        for (
          var g = 0 === a.childrenCount,
            h = Dt(a),
            k = 0,
            l = a.comments,
            m = l.length,
            n = H.alloc(),
            p = 0;
          p < m;
          p++
        ) {
          var r = l[p],
            q = r.measuredBounds;
          if ((d && !g) || (!f && !c && g) || (f && c && g)) {
            if ((135 < e && !f) || (c && h))
              if (0 <= a.commentMargin)
                for (
                  n.h(a.bounds.x - a.commentMargin - q.width, a.bounds.y + k),
                    r.move(n),
                    r = r.td();
                  r.next();
  
                ) {
                  var u = r.value;
                  u.fromSpot = ed;
                  u.toSpot = fd;
                }
              else
                for (
                  n.h(
                    a.bounds.x + 2 * a.focus.x - a.commentMargin,
                    a.bounds.y + k,
                  ),
                    r.move(n),
                    r = r.td();
                  r.next();
  
                )
                  (u = r.value), (u.fromSpot = fd), (u.toSpot = ed);
            else if (0 <= a.commentMargin)
              for (
                n.h(a.bounds.x + 2 * a.focus.x + a.commentMargin, a.bounds.y + k),
                  r.move(n),
                  r = r.td();
                r.next();
  
              )
                (u = r.value), (u.fromSpot = fd), (u.toSpot = ed);
            else
              for (
                n.h(a.bounds.x + a.commentMargin - q.width, a.bounds.y + k),
                  r.move(n),
                  r = r.td();
                r.next();
  
              )
                (u = r.value), (u.fromSpot = ed), (u.toSpot = fd);
            k =
              0 <= a.commentSpacing
                ? k + (q.height + a.commentSpacing)
                : k + (a.commentSpacing - q.height);
          } else {
            if ((135 < e && !f) || (!c && h))
              if (0 <= a.commentMargin)
                for (
                  n.h(a.bounds.x + k, a.bounds.y - a.commentMargin - q.height),
                    r.move(n),
                    r = r.td();
                  r.next();
  
                )
                  (u = r.value), (u.fromSpot = dd), (u.toSpot = gd);
              else
                for (
                  n.h(
                    a.bounds.x + k,
                    a.bounds.y + 2 * a.focus.y - a.commentMargin,
                  ),
                    r.move(n),
                    r = r.td();
                  r.next();
  
                )
                  (u = r.value), (u.fromSpot = gd), (u.toSpot = dd);
            else if (0 <= a.commentMargin)
              for (
                n.h(a.bounds.x + k, a.bounds.y + 2 * a.focus.y + a.commentMargin),
                  r.move(n),
                  r = r.td();
                r.next();
  
              )
                (u = r.value), (u.fromSpot = gd), (u.toSpot = dd);
            else
              for (
                n.h(a.bounds.x + k, a.bounds.y + a.commentMargin - q.height),
                  r.move(n),
                  r = r.td();
                r.next();
  
              )
                (u = r.value), (u.fromSpot = dd), (u.toSpot = gd);
            k =
              0 <= a.commentSpacing
                ? k + (q.width + a.commentSpacing)
                : k + (a.commentSpacing - q.width);
          }
        }
        H.free(n);
        b = k - a.commentSpacing - (d ? b.height : b.width);
        if (this.Xc === Zs)
          for (a = a.destinationEdges; a.next(); )
            (e = a.value.link),
              null === e ||
                e.isAvoiding ||
                (e.fromEndSegmentLength = 0 < b ? b : NaN);
        else
          for (a = a.sourceEdges; a.next(); )
            (e = a.value.link),
              null === e ||
                e.isAvoiding ||
                (e.toEndSegmentLength = 0 < b ? b : NaN);
      }
    };
    Xs.prototype.layoutTree = function (a) {
      if (null !== a) {
        for (var b = a.children, c = b.length, d = 0; d < c; d++)
          this.layoutTree(b[d]);
        switch (a.compaction) {
          case Et:
            Ft(this, a);
            break;
          case Gt:
            if (a.alignment === pt) Ft(this, a);
            else if (0 === a.childrenCount)
              (d = a.parent),
                (c = !1),
                (b = 0),
                null !== d && ((b = d.angle), (c = d.alignment), (c = yt(c))),
                (d = Dt(a)),
                a.S.h(0, 0),
                a.sa.h(a.width, a.height),
                null === a.parent ||
                null === a.comments ||
                (((180 !== b && 270 !== b) || c) && !d)
                  ? a.da.h(0, 0)
                  : (180 === b && !c) || ((90 === b || 270 === b) && d)
                  ? a.da.h(a.width - 2 * a.focus.x, 0)
                  : a.da.h(0, a.height - 2 * a.focus.y),
                (a.uq = null),
                (a.Hq = null);
            else {
              var e = Ht(a);
              b = 90 === e || 270 === e;
              var f = 0,
                g = a.children,
                h = g.length;
              for (c = 0; c < h; c++)
                (d = g[c]), (f = Math.max(f, b ? d.sa.width : d.sa.height));
              var k = a.alignment,
                l = k === It,
                m = yt(k),
                n = Math.max(0, a.breadthLimit);
              c = Jt(a);
              var p = a.nodeSpacing,
                r = Pt(a),
                q = a.rowSpacing,
                u = 0;
              if (k === Qt || l || a.Fm || (a.Gm && 1 === a.maxGenerationCount))
                u = Math.max(0, a.rowIndent);
              d = a.width;
              var v = a.height,
                w = 0,
                y = 0,
                z = 0,
                A = null,
                C = null,
                I = 0,
                P = 0,
                K = 0,
                V = 0,
                Q = 0,
                ca = 0,
                pa = 0,
                M = 0;
              m && !Ct(k) && 135 < e && g.reverse();
              if (Ct(k))
                if (1 < h)
                  for (var xa = 0; xa < h; xa++)
                    0 === xa % 2 &&
                      xa !== h - 1 &&
                      (M = Math.max(M, b ? g[xa].sa.width : g[xa].sa.height));
                else 1 === h && (M = b ? g[0].sa.width : g[0].sa.height);
              if (m) {
                switch (k) {
                  case zt:
                    y = 135 > e ? Rt(a, g, M, w, y) : St(a, g, M, w, y);
                    M = y.x;
                    w = y.width;
                    y = y.height;
                    break;
                  case At:
                    for (A = 0; A < h; A++)
                      (C = g[A]),
                        (n = C.sa),
                        (z = 0 === ca ? 0 : q),
                        b
                          ? (C.S.h(f - n.width, V + z),
                            (w = Math.max(w, n.width)),
                            (y = Math.max(y, V + z + n.height)),
                            (V += z + n.height))
                          : (C.S.h(K + z, f - n.height),
                            (w = Math.max(w, K + z + n.width)),
                            (y = Math.max(y, n.height)),
                            (K += z + n.width)),
                        ca++;
                    break;
                  case Bt:
                    for (A = 0; A < h; A++)
                      (C = g[A]),
                        (f = C.sa),
                        (n = 0 === ca ? 0 : q),
                        b
                          ? (C.S.h(p / 2 + a.focus.x, V + n),
                            (w = Math.max(w, f.width)),
                            (y = Math.max(y, V + n + f.height)),
                            (V += n + f.height))
                          : (C.S.h(K + n, p / 2 + a.focus.y),
                            (w = Math.max(w, K + n + f.width)),
                            (y = Math.max(y, f.height)),
                            (K += n + f.width)),
                        ca++;
                }
                A = Tt(this, 2);
                C = Tt(this, 2);
                b
                  ? (A[0].h(0, 0), A[1].h(0, y), C[0].h(w, 0))
                  : (A[0].h(0, 0), A[1].h(w, 0), C[0].h(0, y));
                C[1].h(w, y);
              } else
                for (xa = 0; xa < h; xa++) {
                  var Ma = g[xa],
                    hb = Ma.sa;
                  if (b) {
                    0 < n &&
                      0 < ca &&
                      K + p + hb.width > n &&
                      (K < f && Ut(a, k, f - K, 0, pa, xa - 1),
                      Q++,
                      (ca = 0),
                      (pa = xa),
                      (z = y),
                      (K = 0),
                      (V = 135 < e ? -y - q : y + q));
                    Vt(this, Ma, 0, V);
                    var Fa = 0;
                    if (0 === ca) {
                      if (
                        ((A = Ma.uq),
                        (C = Ma.Hq),
                        (I = hb.width),
                        (P = hb.height),
                        null === A || null === C || e !== Ht(Ma))
                      )
                        (A = Tt(this, 2)),
                          (C = Tt(this, 2)),
                          A[0].h(0, 0),
                          A[1].h(0, P),
                          C[0].h(I, 0),
                          C[1].h(I, P);
                    } else {
                      var mb = Ea();
                      P = Wt(this, a, Ma, A, C, I, P, mb);
                      Fa = P.x;
                      A = mb[0];
                      C = mb[1];
                      I = P.width;
                      P = P.height;
                      Ha(mb);
                      K < hb.width &&
                        0 > Fa &&
                        (Xt(a, -Fa, 0, pa, xa - 1),
                        Yt(A, -Fa, 0),
                        Yt(C, -Fa, 0),
                        (Fa = 0));
                    }
                    Ma.S.h(Fa, V);
                    w = Math.max(w, I);
                    y = Math.max(y, z + (0 === Q ? 0 : q) + hb.height);
                    K = I;
                  } else {
                    0 < n &&
                      0 < ca &&
                      V + p + hb.height > n &&
                      (V < f && Ut(a, k, 0, f - V, pa, xa - 1),
                      Q++,
                      (ca = 0),
                      (pa = xa),
                      (z = w),
                      (V = 0),
                      (K = 135 < e ? -w - q : w + q));
                    Vt(this, Ma, K, 0);
                    Fa = 0;
                    if (0 === ca) {
                      if (
                        ((A = Ma.uq),
                        (C = Ma.Hq),
                        (I = hb.width),
                        (P = hb.height),
                        null === A || null === C || e !== Ht(Ma))
                      )
                        (A = Tt(this, 2)),
                          (C = Tt(this, 2)),
                          A[0].h(0, 0),
                          A[1].h(I, 0),
                          C[0].h(0, P),
                          C[1].h(I, P);
                    } else
                      (mb = Ea()),
                        (P = Wt(this, a, Ma, A, C, I, P, mb)),
                        (Fa = P.x),
                        (A = mb[0]),
                        (C = mb[1]),
                        (I = P.width),
                        (P = P.height),
                        Ha(mb),
                        V < hb.height &&
                          0 > Fa &&
                          (Xt(a, 0, -Fa, pa, xa - 1),
                          Yt(A, 0, -Fa),
                          Yt(C, 0, -Fa),
                          (Fa = 0));
                    Ma.S.h(K, Fa);
                    y = Math.max(y, P);
                    w = Math.max(w, z + (0 === Q ? 0 : q) + hb.width);
                    V = P;
                  }
                  ca++;
                }
              0 < Q &&
                (b
                  ? ((y += Math.max(0, c)),
                    K < w && Ut(a, k, w - K, 0, pa, h - 1),
                    0 < u && (l || Xt(a, u, 0, 0, h - 1), (w += u)))
                  : ((w += Math.max(0, c)),
                    V < y && Ut(a, k, 0, y - V, pa, h - 1),
                    0 < u && (l || Xt(a, 0, u, 0, h - 1), (y += u))));
              u = l = 0;
              switch (k) {
                case Zt:
                  b
                    ? (l += w / 2 - a.focus.x - r / 2)
                    : (u += y / 2 - a.focus.y - r / 2);
                  break;
                case $t:
                  0 < Q
                    ? b
                      ? (l += w / 2 - a.focus.x - r / 2)
                      : (u += y / 2 - a.focus.y - r / 2)
                    : b
                    ? ((M = g[0].S.x + g[0].da.x),
                      (l +=
                        M +
                        (g[h - 1].S.x +
                          g[h - 1].da.x +
                          2 * g[h - 1].focus.x -
                          M) /
                          2 -
                        a.focus.x -
                        r / 2))
                    : ((M = g[0].S.y + g[0].da.y),
                      (u +=
                        M +
                        (g[h - 1].S.y +
                          g[h - 1].da.y +
                          2 * g[h - 1].focus.y -
                          M) /
                          2 -
                        a.focus.y -
                        r / 2));
                  break;
                case Qt:
                  b ? ((l -= r), (w += r)) : ((u -= r), (y += r));
                  break;
                case It:
                  b
                    ? ((l += w - a.width + r), (w += r))
                    : ((u += y - a.height + r), (y += r));
                  break;
                case zt:
                  b
                    ? 1 < h
                      ? (l += M + p / 2 - a.focus.x)
                      : (l += g[0].focus.x - a.focus.x + g[0].da.x)
                    : 1 < h
                    ? (u += M + p / 2 - a.focus.y)
                    : (u += g[0].focus.y - a.focus.y + g[0].da.y);
                  break;
                case At:
                  b ? (l += w + p / 2 - a.focus.x) : (u += y + p / 2 - a.focus.y);
                  break;
                case Bt:
                  break;
                default:
                  B('Unhandled alignment value ' + k.toString());
              }
              for (r = 0; r < h; r++)
                (M = g[r]),
                  b
                    ? M.S.h(
                        M.S.x + M.da.x - l,
                        M.S.y +
                          (135 < e
                            ? (m ? -y : -M.sa.height) + M.da.y - c
                            : v + c + M.da.y),
                      )
                    : M.S.h(
                        M.S.x +
                          (135 < e
                            ? (m ? -w : -M.sa.width) + M.da.x - c
                            : d + c + M.da.x),
                        M.S.y + M.da.y - u,
                      );
              h = g = 0;
              m
                ? b
                  ? ((w = au(a, w, l)),
                    0 > l && (l = 0),
                    135 < e && (u += y + c),
                    (y += v + c),
                    k === Bt && (g += p / 2 + a.focus.x),
                    (h += v + c))
                  : (135 < e && (l += w + c),
                    (w += d + c),
                    (y = bu(a, y, u)),
                    0 > u && (u = 0),
                    k === Bt && (h += p / 2 + a.focus.y),
                    (g += d + c))
                : b
                ? (null === a.comments
                    ? d > w &&
                      ((w = cu(k, d - w, 0)),
                      (g = w.x),
                      (h = w.y),
                      (w = d),
                      (l = 0))
                    : (w = au(a, w, l)),
                  0 > l && ((g -= l), (l = 0)),
                  135 < e && (u += y + c),
                  (y = Math.max(Math.max(y, v), y + v + c)),
                  (h += v + c))
                : (135 < e && (l += w + c),
                  (w = Math.max(Math.max(w, d), w + d + c)),
                  null === a.comments
                    ? v > y &&
                      ((y = cu(k, 0, v - y)),
                      (g = y.x),
                      (h = y.y),
                      (y = v),
                      (u = 0))
                    : (y = bu(a, y, u)),
                  0 > u && ((h -= u), (u = 0)),
                  (g += d + c));
              if (0 < Q)
                (e = Tt(this, 4)),
                  (Q = Tt(this, 4)),
                  b
                    ? (e[2].h(0, v + c),
                      e[3].h(e[2].x, y),
                      Q[2].h(w, e[2].y),
                      Q[3].h(Q[2].x, e[3].y))
                    : (e[2].h(d + c, 0),
                      e[3].h(w, e[2].y),
                      Q[2].h(e[2].x, y),
                      Q[3].h(e[3].x, Q[2].y));
              else {
                e = Tt(this, A.length + 2);
                Q = Tt(this, C.length + 2);
                for (k = 0; k < A.length; k++)
                  (m = A[k]), e[k + 2].h(m.x + g, m.y + h);
                for (k = 0; k < C.length; k++)
                  (m = C[k]), Q[k + 2].h(m.x + g, m.y + h);
              }
              b
                ? (e[0].h(l, 0),
                  e[1].h(e[0].x, v),
                  e[2].y < e[1].y &&
                    (e[2].x > e[0].x ? e[2].assign(e[1]) : e[1].assign(e[2])),
                  e[3].y < e[2].y &&
                    (e[3].x > e[0].x ? e[3].assign(e[2]) : e[2].assign(e[3])),
                  Q[0].h(l + d, 0),
                  Q[1].h(Q[0].x, v),
                  Q[2].y < Q[1].y &&
                    (Q[2].x < Q[0].x ? Q[2].assign(Q[1]) : Q[1].assign(Q[2])),
                  Q[3].y < Q[2].y &&
                    (Q[3].x < Q[0].x ? Q[3].assign(Q[2]) : Q[2].assign(Q[3])),
                  (e[2].y -= c / 2),
                  (Q[2].y -= c / 2))
                : (e[0].h(0, u),
                  e[1].h(d, e[0].y),
                  e[2].x < e[1].x &&
                    (e[2].y > e[0].y ? e[2].assign(e[1]) : e[1].assign(e[2])),
                  e[3].x < e[2].x &&
                    (e[3].y > e[0].y ? e[3].assign(e[2]) : e[2].assign(e[3])),
                  Q[0].h(0, u + v),
                  Q[1].h(d, Q[0].y),
                  Q[2].x < Q[1].x &&
                    (Q[2].y < Q[0].y ? Q[2].assign(Q[1]) : Q[1].assign(Q[2])),
                  Q[3].x < Q[2].x &&
                    (Q[3].y < Q[0].y ? Q[3].assign(Q[2]) : Q[2].assign(Q[3])),
                  (e[2].x -= c / 2),
                  (Q[2].x -= c / 2));
              du(this, A);
              du(this, C);
              a.uq = e;
              a.Hq = Q;
              a.da.h(l, u);
              a.sa.h(w, y);
            }
            break;
          default:
            B('Unhandled compaction value ' + a.compaction.toString());
        }
      }
    };
    function Ft(a, b) {
      if (0 === b.childrenCount) {
        var c = !1,
          d = 0;
        null !== b.parent &&
          ((d = b.parent.angle), (c = b.parent.alignment), (c = yt(c)));
        var e = Dt(b);
        b.S.h(0, 0);
        b.sa.h(b.width, b.height);
        null === b.parent ||
        null === b.comments ||
        (((180 !== d && 270 !== d) || c) && !e)
          ? b.da.h(0, 0)
          : (180 === d && !c) || ((90 === d || 270 === d) && e)
          ? b.da.h(b.width - 2 * b.focus.x, 0)
          : b.da.h(0, b.height - 2 * b.focus.y);
      } else {
        d = Ht(b);
        c = 90 === d || 270 === d;
        var f = 0;
        e = b.children;
        for (var g = e.length, h = 0; h < g; h++) {
          var k = e[h];
          f = Math.max(f, c ? k.sa.width : k.sa.height);
        }
        var l = b.alignment,
          m = l === Qt,
          n = l === It;
        h = yt(l);
        var p = Math.max(0, b.breadthLimit);
        k = Jt(b);
        var r = b.nodeSpacing,
          q = Pt(b),
          u = m || n ? 0 : q / 2,
          v = b.rowSpacing,
          w = 0;
        if (m || n || b.Fm || (b.Gm && 1 === b.maxGenerationCount))
          w = Math.max(0, b.rowIndent);
        m = b.width;
        var y = b.height,
          z = 0,
          A = 0,
          C = 0,
          I = 0,
          P = 0,
          K = 0,
          V = 0,
          Q = 0,
          ca = 0;
        h && !Ct(l) && 135 < d && e.reverse();
        if (Ct(l))
          if (1 < g)
            for (var pa = 0; pa < g; pa++) {
              var M = e[pa],
                xa = M.sa;
              0 === pa % 2 &&
                pa !== g - 1 &&
                (ca = Math.max(ca, (c ? xa.width : xa.height) + eu(M) - r));
            }
          else 1 === g && (ca = c ? e[0].sa.width : e[0].sa.height);
        if (h)
          switch (l) {
            case zt:
            case pt:
              A = 135 > d ? Rt(b, e, ca, z, A) : St(b, e, ca, z, A);
              ca = A.x;
              z = A.width;
              A = A.height;
              break;
            case At:
              for (a = 0; a < g; a++)
                (p = e[a]),
                  (u = p.sa),
                  (C = 0 === V ? 0 : v),
                  c
                    ? (p.S.h(f - u.width, P + C),
                      (z = Math.max(z, u.width)),
                      (A = Math.max(A, P + C + u.height)),
                      (P += C + u.height))
                    : (p.S.h(I + C, f - u.height),
                      (z = Math.max(z, I + C + u.width)),
                      (A = Math.max(A, u.height)),
                      (I += C + u.width)),
                  V++;
              break;
            case Bt:
              for (f = 0; f < g; f++)
                (a = e[f]),
                  (p = a.sa),
                  (u = 0 === V ? 0 : v),
                  c
                    ? (a.S.h(r / 2 + b.focus.x, P + u),
                      (z = Math.max(z, p.width)),
                      (A = Math.max(A, P + u + p.height)),
                      (P += u + p.height))
                    : (a.S.h(I + u, r / 2 + b.focus.y),
                      (z = Math.max(z, I + u + p.width)),
                      (A = Math.max(A, p.height)),
                      (I += u + p.width)),
                  V++;
          }
        else
          for (pa = 0; pa < g; pa++) {
            M = e[pa];
            xa = M.sa;
            if (c) {
              0 < p &&
                0 < V &&
                I + r + xa.width > p &&
                (I < f && Ut(b, l, f - I, 0, Q, pa - 1),
                K++,
                (V = 0),
                (Q = pa),
                (C = A),
                (I = 0),
                (P = 135 < d ? -A - v : A + v));
              var Ma = 0 === V ? u : r;
              Vt(a, M, 0, P);
              M.S.h(I + Ma, P);
              z = Math.max(z, I + Ma + xa.width);
              A = Math.max(A, C + (0 === K ? 0 : v) + xa.height);
              I += Ma + xa.width;
            } else
              0 < p &&
                0 < V &&
                P + r + xa.height > p &&
                (P < f && Ut(b, l, 0, f - P, Q, pa - 1),
                K++,
                (V = 0),
                (Q = pa),
                (C = z),
                (P = 0),
                (I = 135 < d ? -z - v : z + v)),
                (Ma = 0 === V ? u : r),
                Vt(a, M, I, 0),
                M.S.h(I, P + Ma),
                (A = Math.max(A, P + Ma + xa.height)),
                (z = Math.max(z, C + (0 === K ? 0 : v) + xa.width)),
                (P += Ma + xa.height);
            V++;
          }
        0 < K &&
          (c
            ? ((A += Math.max(0, k)),
              I < z && Ut(b, l, z - I, 0, Q, g - 1),
              0 < w && (n || Xt(b, w, 0, 0, g - 1), (z += w)))
            : ((z += Math.max(0, k)),
              P < A && Ut(b, l, 0, A - P, Q, g - 1),
              0 < w && (n || Xt(b, 0, w, 0, g - 1), (A += w))));
        w = n = 0;
        switch (l) {
          case Zt:
            c
              ? (n += z / 2 - b.focus.x - q / 2)
              : (w += A / 2 - b.focus.y - q / 2);
            break;
          case $t:
            0 < K
              ? c
                ? (n += z / 2 - b.focus.x - q / 2)
                : (w += A / 2 - b.focus.y - q / 2)
              : c
              ? ((l = e[0].S.x + e[0].da.x),
                (n +=
                  l +
                  (e[g - 1].S.x + e[g - 1].da.x + 2 * e[g - 1].focus.x - l) / 2 -
                  b.focus.x -
                  q / 2))
              : ((l = e[0].S.y + e[0].da.y),
                (w +=
                  l +
                  (e[g - 1].S.y + e[g - 1].da.y + 2 * e[g - 1].focus.y - l) / 2 -
                  b.focus.y -
                  q / 2));
            break;
          case Qt:
            c ? ((n -= q), (z += q)) : ((w -= q), (A += q));
            break;
          case It:
            c
              ? ((n += z - b.width + q), (z += q))
              : ((w += A - b.height + q), (A += q));
            break;
          case zt:
          case pt:
            c
              ? 1 < g
                ? (n += ca + r / 2 - b.focus.x)
                : (n += e[0].focus.x - b.focus.x + e[0].da.x)
              : 1 < g
              ? (w += ca + r / 2 - b.focus.y)
              : (w += e[0].focus.y - b.focus.y + e[0].da.y);
            break;
          case At:
            c ? (n += z + r / 2 - b.focus.x) : (w += A + r / 2 - b.focus.y);
            break;
          case Bt:
            break;
          default:
            B('Unhandled alignment value ' + l.toString());
        }
        for (q = 0; q < g; q++)
          (l = e[q]),
            c
              ? l.S.h(
                  l.S.x + l.da.x - n,
                  l.S.y +
                    (135 < d
                      ? (h ? -A : -l.sa.height) + l.da.y - k
                      : y + k + l.da.y),
                )
              : l.S.h(
                  l.S.x +
                    (135 < d
                      ? (h ? -z : -l.sa.width) + l.da.x - k
                      : m + k + l.da.x),
                  l.S.y + l.da.y - w,
                );
        c
          ? ((z = au(b, z, n)),
            0 > n && (n = 0),
            135 < d && (w += A + k),
            (A += y + k))
          : (135 < d && (n += z + k),
            (z += m + k),
            (A = bu(b, A, w)),
            0 > w && (w = 0));
        b.da.h(n, w);
        b.sa.h(z, A);
      }
    }
    function Rt(a, b, c, d, e) {
      var f = b.length;
      if (0 === f) return new N(c, 0, d, e);
      if (1 === f)
        return (a = b[0]), (d = a.sa.width), (e = a.sa.height), new N(c, 0, d, e);
      for (
        var g = a.nodeSpacing,
          h = a.rowSpacing,
          k = 90 === Ht(a),
          l = 0,
          m = 0,
          n = 0,
          p = 0;
        p < f;
        p++
      )
        if (!(0 !== p % 2 || (1 < f && p === f - 1))) {
          var r = b[p],
            q = r.sa,
            u = 0 === l ? 0 : h;
          if (k) {
            var v = eu(r) - g;
            r.S.h(c - (q.width + v), n + u);
            d = Math.max(d, q.width + v);
            e = Math.max(e, n + u + q.height);
            n += u + q.height;
          } else
            (v = eu(r) - g),
              r.S.h(m + u, c - (q.height + v)),
              (e = Math.max(e, q.height + v)),
              (d = Math.max(d, m + u + q.width)),
              (m += u + q.width);
          l++;
        }
      l = 0;
      r = m;
      p = n;
      k ? ((m = c + g), (n = 0)) : ((m = 0), (n = c + g));
      for (q = 0; q < f; q++)
        if (0 !== q % 2) {
          u = b[q];
          v = u.sa;
          var w = 0 === l ? 0 : h;
          if (k) {
            var y = eu(u) - g;
            u.S.h(m + y, n + w);
            d = Math.max(d, m + v.width + y);
            e = Math.max(e, n + w + v.height);
            n += w + v.height;
          } else
            (y = eu(u) - g),
              u.S.h(m + w, n + y),
              (d = Math.max(d, m + w + v.width)),
              (e = Math.max(e, n + v.height + y)),
              (m += w + v.width);
          l++;
        }
      1 < f &&
        1 === f % 2 &&
        ((b = b[f - 1]),
        (f = b.sa),
        (h = null === b.parent ? 0 : b.parent.rowSpacing),
        k
          ? (b.S.h(c + g / 2 - b.focus.x - b.da.x, e + h),
            (k = c + g / 2 - b.focus.x - b.da.x),
            (d = Math.max(d, k + f.width)),
            0 > k && (d -= k),
            (e = Math.max(e, Math.max(p, n) + h + f.height)),
            0 > b.S.x && (c = fu(a, b.S.x, !1, c, g)))
          : (b.S.h(d + h, c + g / 2 - b.focus.y - b.da.y),
            (d = Math.max(d, Math.max(r, m) + h + f.width)),
            (n = c + g / 2 - b.focus.y - b.da.y),
            (e = Math.max(e, n + f.height)),
            0 > n && (e -= n),
            0 > b.S.y && (c = fu(a, b.S.y, !0, c, g))));
      return new N(c, 0, d, e);
    }
    function St(a, b, c, d, e) {
      var f = b.length;
      if (0 === f) return new N(c, 0, d, e);
      if (1 === f)
        return (b = b[0]), (d = b.sa.width), (e = b.sa.height), new N(c, 0, d, e);
      for (
        var g = a.nodeSpacing,
          h = a.rowSpacing,
          k = 270 === Ht(a),
          l = 0,
          m = 0,
          n = 0,
          p = 0;
        p < f;
        p++
      )
        if (!(0 !== p % 2 || (1 < f && p === f - 1))) {
          var r = b[p],
            q = r.sa,
            u = 0 === l ? 0 : h;
          if (k) {
            var v = eu(r) - g;
            n -= u + q.height;
            r.S.h(c - (q.width + v), n);
            d = Math.max(d, q.width + v);
            e = Math.max(e, Math.abs(n));
          } else
            (v = eu(r) - g),
              (m -= u + q.width),
              r.S.h(m, c - (q.height + v)),
              (e = Math.max(e, q.height + v)),
              (d = Math.max(d, Math.abs(m)));
          l++;
        }
      l = 0;
      r = m;
      p = n;
      k ? ((m = c + g), (n = 0)) : ((m = 0), (n = c + g));
      for (q = 0; q < f; q++)
        if (0 !== q % 2) {
          u = b[q];
          v = u.sa;
          var w = 0 === l ? 0 : h;
          if (k) {
            var y = eu(u) - g;
            n -= w + v.height;
            u.S.h(m + y, n);
            d = Math.max(d, m + v.width + y);
            e = Math.max(e, Math.abs(n));
          } else
            (y = eu(u) - g),
              (m -= w + v.width),
              u.S.h(m, n + y),
              (e = Math.max(e, n + v.height + y)),
              (d = Math.max(d, Math.abs(m)));
          l++;
        }
      1 < f &&
        1 === f % 2 &&
        ((h = b[f - 1]),
        (l = h.sa),
        (q = null === h.parent ? 0 : h.parent.rowSpacing),
        k
          ? (h.S.h(c + g / 2 - h.focus.x - h.da.x, -e - l.height - q),
            (m = c + g / 2 - h.focus.x - h.da.x),
            (d = Math.max(d, m + l.width)),
            0 > m && (d -= m),
            (e = Math.max(e, Math.abs(Math.min(p, n)) + q + l.height)),
            0 > h.S.x && (c = fu(a, h.S.x, !1, c, g)))
          : (h.S.h(-d - l.width - q, c + g / 2 - h.focus.y - h.da.y),
            (d = Math.max(d, Math.abs(Math.min(r, m)) + q + l.width)),
            (n = c + g / 2 - h.focus.y - h.da.y),
            (e = Math.max(e, n + l.height)),
            0 > n && (e -= n),
            0 > h.S.y && (c = fu(a, h.S.y, !0, c, g))));
      for (a = 0; a < f; a++)
        (g = b[a]), k ? g.S.h(g.S.x, g.S.y + e) : g.S.h(g.S.x + d, g.S.y);
      return new N(c, 0, d, e);
    }
    function eu(a) {
      return null === a.parent ? 0 : a.parent.nodeSpacing;
    }
    function fu(a, b, c, d, e) {
      a = a.children;
      for (var f = a.length, g = 0; g < f; g++)
        c ? a[g].S.h(a[g].S.x, a[g].S.y - b) : a[g].S.h(a[g].S.x - b, a[g].S.y);
      b = a[f - 1];
      return Math.max(
        d,
        c ? b.da.y + b.focus.y - e / 2 : b.da.x + b.focus.x - e / 2,
      );
    }
    function au(a, b, c) {
      switch (a.alignment) {
        case $t:
        case Zt:
          return c + a.width > b && (b = c + a.width), 0 > c && (b -= c), b;
        case Qt:
          return a.width > b ? a.width : b;
        case It:
          return 2 * a.focus.x > b ? a.width : b + a.width - 2 * a.focus.x;
        case zt:
        case pt:
          return Math.max(a.width, Math.max(b, c + a.width) - Math.min(0, c));
        case At:
          return a.width - a.focus.x + a.nodeSpacing / 2 + b;
        case Bt:
          return Math.max(a.width, a.focus.x + a.nodeSpacing / 2 + b);
        default:
          return b;
      }
    }
    function bu(a, b, c) {
      switch (a.alignment) {
        case $t:
        case Zt:
          return c + a.height > b && (b = c + a.height), 0 > c && (b -= c), b;
        case Qt:
          return a.height > b ? a.height : b;
        case It:
          return 2 * a.focus.y > b ? a.height : b + a.height - 2 * a.focus.y;
        case zt:
        case pt:
          return Math.max(a.height, Math.max(b, c + a.height) - Math.min(0, c));
        case At:
          return a.height - a.focus.y + a.nodeSpacing / 2 + b;
        case Bt:
          return Math.max(a.height, a.focus.y + a.nodeSpacing / 2 + b);
        default:
          return b;
      }
    }
    function cu(a, b, c) {
      switch (a) {
        case Zt:
          b /= 2;
          c /= 2;
          break;
        case $t:
          b /= 2;
          c /= 2;
          break;
        case Qt:
          c = b = 0;
          break;
        case It:
          break;
        default:
          B('Unhandled alignment value ' + a.toString());
      }
      return new H(b, c);
    }
    function Ut(a, b, c, d, e, f) {
      b = cu(b, c, d);
      Xt(a, b.x, b.y, e, f);
    }
    function Xt(a, b, c, d, e) {
      if (0 !== b || 0 !== c)
        for (a = a.children; d <= e; d++) {
          var f = a[d].S;
          f.x += b;
          f.y += c;
        }
    }
    function Vt(a, b, c, d) {
      var e = b.parent;
      switch (a.Xc) {
        case Zs:
          for (a = b.sourceEdges; a.next(); )
            (b = a.value), b.fromVertex === e && b.relativePoint.h(c, d);
          break;
        case ft:
          for (a = b.destinationEdges; a.next(); )
            (b = a.value), b.toVertex === e && b.relativePoint.h(c, d);
          break;
        default:
          B('Unhandled path value ' + a.Xc.toString());
      }
    }
    function Yt(a, b, c) {
      for (var d = 0; d < a.length; d++) {
        var e = a[d];
        e.x += b;
        e.y += c;
      }
    }
    function Wt(a, b, c, d, e, f, g, h) {
      var k = Ht(b),
        l = 90 === k || 270 === k,
        m = b.nodeSpacing;
      b = d;
      var n = e;
      d = f;
      var p = g,
        r = c.uq,
        q = c.Hq;
      g = c.sa;
      var u = l ? Math.max(p, g.height) : Math.max(d, g.width);
      if (null === r || k !== Ht(c))
        (r = Tt(a, 2)),
          (q = Tt(a, 2)),
          l
            ? (r[0].h(0, 0),
              r[1].h(0, g.height),
              q[0].h(g.width, 0),
              q[1].h(q[0].x, r[1].y))
            : (r[0].h(0, 0),
              r[1].h(g.width, 0),
              q[0].h(0, g.height),
              q[1].h(r[1].x, q[0].y));
      if (l) {
        p = 9999999;
        if (!(null === n || 2 > n.length || null === r || 2 > r.length))
          for (e = c = 0; c < n.length && e < r.length; ) {
            f = n[c];
            var v = r[e];
            k = v.x;
            l = v.y;
            k += d;
            var w = f;
            c + 1 < n.length && (w = n[c + 1]);
            var y = v;
            v = y.x;
            y = y.y;
            e + 1 < r.length && ((y = r[e + 1]), (v = y.x), (y = y.y), (v += d));
            var z = p;
            f.y === l
              ? (z = k - f.x)
              : f.y > l && f.y < y
              ? (z = k + ((f.y - l) / (y - l)) * (v - k) - f.x)
              : l > f.y &&
                l < w.y &&
                (z = k - (f.x + ((l - f.y) / (w.y - f.y)) * (w.x - f.x)));
            z < p && (p = z);
            w.y <= f.y ? c++ : y <= l ? e++ : (w.y <= y && c++, y <= w.y && e++);
          }
        p = d - p;
        p += m;
        c = r;
        e = p;
        if (null === b || 2 > b.length || null === c || 2 > c.length) d = null;
        else {
          m = Tt(a, b.length + c.length);
          for (d = f = k = 0; f < c.length && c[f].y < b[0].y; )
            (l = c[f++]), m[d++].h(l.x + e, l.y);
          for (; k < b.length; ) (l = b[k++]), m[d++].h(l.x, l.y);
          for (k = b[b.length - 1].y; f < c.length && c[f].y <= k; ) f++;
          for (; f < c.length && c[f].y > k; )
            (l = c[f++]), m[d++].h(l.x + e, l.y);
          c = Tt(a, d);
          for (k = 0; k < d; k++) c[k].assign(m[k]);
          du(a, m);
          d = c;
        }
        f = q;
        k = p;
        if (null === n || 2 > n.length || null === f || 2 > f.length) e = null;
        else {
          m = Tt(a, n.length + f.length);
          for (e = l = c = 0; c < n.length && n[c].y < f[0].y; )
            (w = n[c++]), m[e++].h(w.x, w.y);
          for (; l < f.length; ) (w = f[l++]), m[e++].h(w.x + k, w.y);
          for (f = f[f.length - 1].y; c < n.length && n[c].y <= f; ) c++;
          for (; c < n.length && n[c].y > f; ) (k = n[c++]), m[e++].h(k.x, k.y);
          f = Tt(a, e);
          for (c = 0; c < e; c++) f[c].assign(m[c]);
          du(a, m);
          e = f;
        }
        f = Math.max(0, p) + g.width;
        g = u;
        du(a, b);
        du(a, r);
        du(a, n);
        du(a, q);
        h[0] = d;
        h[1] = e;
        return new N(p, 0, f, g);
      }
      d = 9999999;
      if (!(null === n || 2 > n.length || null === r || 2 > r.length))
        for (e = c = 0; c < n.length && e < r.length; )
          (f = n[c]),
            (v = r[e]),
            (k = v.x),
            (l = v.y),
            (l += p),
            (w = f),
            c + 1 < n.length && (w = n[c + 1]),
            (y = v),
            (v = y.x),
            (y = y.y),
            e + 1 < r.length && ((y = r[e + 1]), (v = y.x), (y = y.y), (y += p)),
            (z = d),
            f.x === k
              ? (z = l - f.y)
              : f.x > k && f.x < v
              ? (z = l + ((f.x - k) / (v - k)) * (y - l) - f.y)
              : k > f.x &&
                k < w.x &&
                (z = l - (f.y + ((k - f.x) / (w.x - f.x)) * (w.y - f.y))),
            z < d && (d = z),
            w.x <= f.x ? c++ : v <= k ? e++ : (w.x <= v && c++, v <= w.x && e++);
      p -= d;
      p += m;
      c = r;
      e = p;
      if (null === b || 2 > b.length || null === c || 2 > c.length) d = null;
      else {
        m = Tt(a, b.length + c.length);
        for (d = f = k = 0; f < c.length && c[f].x < b[0].x; )
          (l = c[f++]), m[d++].h(l.x, l.y + e);
        for (; k < b.length; ) (l = b[k++]), m[d++].h(l.x, l.y);
        for (k = b[b.length - 1].x; f < c.length && c[f].x <= k; ) f++;
        for (; f < c.length && c[f].x > k; ) (l = c[f++]), m[d++].h(l.x, l.y + e);
        c = Tt(a, d);
        for (k = 0; k < d; k++) c[k].assign(m[k]);
        du(a, m);
        d = c;
      }
      f = q;
      k = p;
      if (null === n || 2 > n.length || null === f || 2 > f.length) e = null;
      else {
        m = Tt(a, n.length + f.length);
        for (e = l = c = 0; c < n.length && n[c].x < f[0].x; )
          (w = n[c++]), m[e++].h(w.x, w.y);
        for (; l < f.length; ) (w = f[l++]), m[e++].h(w.x, w.y + k);
        for (f = f[f.length - 1].x; c < n.length && n[c].x <= f; ) c++;
        for (; c < n.length && n[c].x > f; ) (k = n[c++]), m[e++].h(k.x, k.y);
        f = Tt(a, e);
        for (c = 0; c < e; c++) f[c].assign(m[c]);
        du(a, m);
        e = f;
      }
      f = u;
      g = Math.max(0, p) + g.height;
      du(a, b);
      du(a, r);
      du(a, n);
      du(a, q);
      h[0] = d;
      h[1] = e;
      return new N(p, 0, f, g);
    }
    function Tt(a, b) {
      a = a.Uu[b];
      if (void 0 !== a && ((a = a.pop()), void 0 !== a)) return a;
      a = [];
      for (var c = 0; c < b; c++) a[c] = new H();
      return a;
    }
    function du(a, b) {
      var c = b.length,
        d = a.Uu[c];
      void 0 === d && ((d = []), (a.Uu[c] = d));
      d.push(b);
    }
    Xs.prototype.arrangeTrees = function () {
      if (this.Bb === et)
        for (var a = this.Ib.iterator; a.next(); ) {
          var b = a.value;
          if (b instanceof dt) {
            var c = b.node;
            if (null !== c) {
              var d = c.position;
              c = d.x;
              d = d.y;
              isFinite(c) || (c = 0);
              isFinite(d) || (d = 0);
              gu(this, b, c, d);
            }
          }
        }
      else {
        a = [];
        for (b = this.Ib.iterator; b.next(); )
          (c = b.value), c instanceof dt && a.push(c);
        switch (this.sorting) {
          case ut:
            break;
          case vt:
            a.reverse();
            break;
          case wt:
            a.sort(this.comparer);
            break;
          case xt:
            a.sort(this.comparer);
            a.reverse();
            break;
          default:
            B('Unhandled sorting value ' + this.sorting.toString());
        }
        c = this.arrangementOrigin;
        b = c.x;
        c = c.y;
        for (d = 0; d < a.length; d++) {
          var e = a[d];
          gu(this, e, b + e.da.x, c + e.da.y);
          switch (this.Bb) {
            case bt:
              c += e.sa.height + this.zd.height;
              break;
            case hu:
              b += e.sa.width + this.zd.width;
              break;
            default:
              B('Unhandled arrangement value ' + this.Bb.toString());
          }
        }
      }
    };
    function gu(a, b, c, d) {
      if (null !== b) {
        b.x = c;
        b.y = d;
        b = b.children;
        for (var e = b.length, f = 0; f < e; f++) {
          var g = b[f];
          gu(a, g, c + g.S.x, d + g.S.y);
        }
      }
    }
    Xs.prototype.commitLayout = function () {
      this.iw();
      this.commitNodes();
      this.jv();
      this.isRouting && this.commitLinks();
    };
    Xs.prototype.commitNodes = function () {
      for (var a = this.network.vertexes.iterator; a.next(); ) a.value.commit();
      for (a.reset(); a.next(); ) this.layoutComments(a.value);
    };
    Xs.prototype.jv = function () {
      if (this.layerStyle === mt) {
        for (
          var a = this.Ow, b = [], c = null, d = this.network.vertexes.iterator;
          d.next();
  
        ) {
          var e = d.value;
          null === c ? (c = e.bounds.copy()) : c.Gc(e.bounds);
          var f = b[e.level];
          void 0 === f ? (f = Jt(e)) : (f = Math.max(f, Jt(e)));
          b[e.level] = f;
        }
        for (d = 0; d < b.length; d++) void 0 === b[d] && (b[d] = 0);
        90 === this.angle || 270 === this.angle
          ? (c.Tc(this.nodeSpacing / 2, this.layerSpacing),
            (d = new H(-this.nodeSpacing / 2, -this.layerSpacing / 2)))
          : (c.Tc(this.layerSpacing, this.nodeSpacing / 2),
            (d = new H(-this.layerSpacing / 2, -this.nodeSpacing / 2)));
        e = [];
        c = 90 === this.angle || 270 === this.angle ? c.width : c.height;
        f = 0;
        if (180 === this.angle || 270 === this.angle)
          for (var g = 0; g < a.length; g++) f += a[g] + b[g];
        for (g = 0; g < a.length; g++) {
          var h = a[g] + b[g];
          270 === this.angle
            ? ((f -= h), e.push(new N(0, f, c, h)))
            : 90 === this.angle
            ? (e.push(new N(0, f, c, h)), (f += h))
            : 180 === this.angle
            ? ((f -= h), e.push(new N(f, 0, h, c)))
            : (e.push(new N(f, 0, h, c)), (f += h));
        }
        this.commitLayers(e, d);
      }
    };
    Xs.prototype.commitLayers = function () {};
    Xs.prototype.commitLinks = function () {
      for (var a = this.network.edges.iterator; a.next(); ) a.value.commit();
    };
    Xs.prototype.iw = function () {
      for (var a = this.Ib.iterator; a.next(); ) {
        var b = a.value;
        b instanceof dt && iu(this, b);
      }
    };
    function iu(a, b) {
      if (null !== b) {
        a.setPortSpots(b);
        b = b.children;
        for (var c = b.length, d = 0; d < c; d++) iu(a, b[d]);
      }
    }
    Xs.prototype.setPortSpots = function (a) {
      var b = a.alignment;
      if (yt(b)) {
        var c = this.Xc === Zs,
          d = Ht(a);
        switch (d) {
          case 0:
            var e = fd;
            break;
          case 90:
            e = gd;
            break;
          case 180:
            e = ed;
            break;
          default:
            e = dd;
        }
        var f = a.children,
          g = f.length;
        switch (b) {
          case zt:
          case pt:
            for (b = 0; b < g; b++) {
              var h = f[b];
              h = (c ? h.sourceEdges : h.destinationEdges).first();
              if (null !== h && ((h = h.link), null !== h)) {
                var k = 90 === d || 270 === d ? ed : dd;
                if (1 === g || (b === g - 1 && 1 === g % 2))
                  switch (d) {
                    case 0:
                      k = ed;
                      break;
                    case 90:
                      k = dd;
                      break;
                    case 180:
                      k = fd;
                      break;
                    default:
                      k = gd;
                  }
                else 0 === b % 2 && (k = 90 === d || 270 === d ? fd : gd);
                c
                  ? (a.setsPortSpot && (h.fromSpot = e),
                    a.setsChildPortSpot && (h.toSpot = k))
                  : (a.setsPortSpot && (h.fromSpot = k),
                    a.setsChildPortSpot && (h.toSpot = e));
              }
            }
            break;
          case At:
            d = 90 === d || 270 === d ? fd : gd;
            for (f = c ? a.destinationEdges : a.sourceEdges; f.next(); )
              (g = f.value.link),
                null !== g &&
                  (c
                    ? (a.setsPortSpot && (g.fromSpot = e),
                      a.setsChildPortSpot && (g.toSpot = d))
                    : (a.setsPortSpot && (g.fromSpot = d),
                      a.setsChildPortSpot && (g.toSpot = e)));
            break;
          case Bt:
            for (
              d = 90 === d || 270 === d ? ed : dd,
                f = c ? a.destinationEdges : a.sourceEdges;
              f.next();
  
            )
              (g = f.value.link),
                null !== g &&
                  (c
                    ? (a.setsPortSpot && (g.fromSpot = e),
                      a.setsChildPortSpot && (g.toSpot = d))
                    : (a.setsPortSpot && (g.fromSpot = d),
                      a.setsChildPortSpot && (g.toSpot = e)));
        }
      } else if (((c = Ht(a)), this.Xc === Zs))
        for (e = a.destinationEdges; e.next(); ) {
          if (((d = e.value.link), null !== d)) {
            if (a.setsPortSpot)
              if (a.portSpot.Nb())
                switch (c) {
                  case 0:
                    d.fromSpot = fd;
                    break;
                  case 90:
                    d.fromSpot = gd;
                    break;
                  case 180:
                    d.fromSpot = ed;
                    break;
                  default:
                    d.fromSpot = dd;
                }
              else d.fromSpot = a.portSpot;
            if (a.setsChildPortSpot)
              if (a.childPortSpot.Nb())
                switch (c) {
                  case 0:
                    d.toSpot = ed;
                    break;
                  case 90:
                    d.toSpot = dd;
                    break;
                  case 180:
                    d.toSpot = fd;
                    break;
                  default:
                    d.toSpot = gd;
                }
              else d.toSpot = a.childPortSpot;
          }
        }
      else
        for (e = a.sourceEdges; e.next(); )
          if (((d = e.value.link), null !== d)) {
            if (a.setsPortSpot)
              if (a.portSpot.Nb())
                switch (c) {
                  case 0:
                    d.toSpot = fd;
                    break;
                  case 90:
                    d.toSpot = gd;
                    break;
                  case 180:
                    d.toSpot = ed;
                    break;
                  default:
                    d.toSpot = dd;
                }
              else d.toSpot = a.portSpot;
            if (a.setsChildPortSpot)
              if (a.childPortSpot.Nb())
                switch (c) {
                  case 0:
                    d.fromSpot = ed;
                    break;
                  case 90:
                    d.fromSpot = dd;
                    break;
                  case 180:
                    d.fromSpot = fd;
                    break;
                  default:
                    d.fromSpot = gd;
                }
              else d.fromSpot = a.childPortSpot;
          }
    };
    function Ht(a) {
      a = a.angle;
      return 45 >= a ? 0 : 135 >= a ? 90 : 225 >= a ? 180 : 315 >= a ? 270 : 0;
    }
    function Jt(a) {
      var b = Ht(a);
      b = 90 === b || 270 === b;
      var c = a.layerSpacing;
      if (0 < a.layerSpacingParentOverlap) {
        var d = Math.min(1, a.layerSpacingParentOverlap);
        c -= b ? a.height * d : a.width * d;
      }
      c < (b ? -a.height : -a.width) && (c = b ? -a.height : -a.width);
      return c;
    }
    function Pt(a) {
      var b = Ht(a),
        c = a.nodeIndent;
      if (0 < a.nodeIndentPastParent) {
        var d = Math.min(1, a.nodeIndentPastParent);
        c += 90 === b || 270 === b ? a.width * d : a.height * d;
      }
      return (c = Math.max(0, c));
    }
    ma.Object.defineProperties(Xs.prototype, {
      roots: {
        get: function () {
          return this.Ib;
        },
        set: function (a) {
          this.Ib !== a && ((this.Ib = a), this.C());
        },
      },
      path: {
        get: function () {
          return this.$o;
        },
        set: function (a) {
          this.$o !== a && ((this.$o = a), this.C());
        },
      },
      treeStyle: {
        get: function () {
          return this.Wp;
        },
        set: function (a) {
          this.Bb === a ||
            (a !== $s && a !== st && a !== tt && a !== rt) ||
            ((this.Wp = a), this.C());
        },
      },
      layerStyle: {
        get: function () {
          return this.Yr;
        },
        set: function (a) {
          this.Bb === a ||
            (a !== at && a !== nt && a !== mt) ||
            ((this.Yr = a), this.C());
        },
      },
      comments: {
        get: function () {
          return this.Vc;
        },
        set: function (a) {
          this.Vc !== a && ((this.Vc = a), this.C());
        },
      },
      arrangement: {
        get: function () {
          return this.Bb;
        },
        set: function (a) {
          this.Bb === a ||
            (a !== bt && a !== hu && a !== et) ||
            ((this.Bb = a), this.C());
        },
      },
      arrangementSpacing: {
        get: function () {
          return this.zd;
        },
        set: function (a) {
          this.zd.A(a) || (this.zd.assign(a), this.C());
        },
      },
      rootDefaults: {
        get: function () {
          return this.T;
        },
        set: function (a) {
          this.T !== a && ((this.T = a), this.C());
        },
      },
      alternateDefaults: {
        get: function () {
          return this.U;
        },
        set: function (a) {
          this.U !== a && ((this.U = a), this.C());
        },
      },
      sorting: {
        get: function () {
          return this.T.sorting;
        },
        set: function (a) {
          this.T.sorting === a ||
            (a !== ut && a !== vt && a !== wt && !xt) ||
            ((this.T.sorting = a), this.C());
        },
      },
      comparer: {
        get: function () {
          return this.T.comparer;
        },
        set: function (a) {
          this.T.comparer !== a && ((this.T.comparer = a), this.C());
        },
      },
      angle: {
        get: function () {
          return this.T.angle;
        },
        set: function (a) {
          this.T.angle !== a &&
            (0 === a || 90 === a || 180 === a || 270 === a
              ? ((this.T.angle = a), this.C())
              : B('TreeLayout.angle must be 0, 90, 180, or 270'));
        },
      },
      alignment: {
        get: function () {
          return this.T.alignment;
        },
        set: function (a) {
          this.T.alignment !== a && ((this.T.alignment = a), this.C());
        },
      },
      nodeIndent: {
        get: function () {
          return this.T.nodeIndent;
        },
        set: function (a) {
          this.T.nodeIndent !== a &&
            0 <= a &&
            ((this.T.nodeIndent = a), this.C());
        },
      },
      nodeIndentPastParent: {
        get: function () {
          return this.T.nodeIndentPastParent;
        },
        set: function (a) {
          this.T.nodeIndentPastParent !== a &&
            0 <= a &&
            1 >= a &&
            ((this.T.nodeIndentPastParent = a), this.C());
        },
      },
      nodeSpacing: {
        get: function () {
          return this.T.nodeSpacing;
        },
        set: function (a) {
          this.T.nodeSpacing !== a && ((this.T.nodeSpacing = a), this.C());
        },
      },
      layerSpacing: {
        get: function () {
          return this.T.layerSpacing;
        },
        set: function (a) {
          this.T.layerSpacing !== a && ((this.T.layerSpacing = a), this.C());
        },
      },
      layerSpacingParentOverlap: {
        get: function () {
          return this.T.layerSpacingParentOverlap;
        },
        set: function (a) {
          this.T.layerSpacingParentOverlap !== a &&
            0 <= a &&
            1 >= a &&
            ((this.T.layerSpacingParentOverlap = a), this.C());
        },
      },
      compaction: {
        get: function () {
          return this.T.compaction;
        },
        set: function (a) {
          this.T.compaction === a ||
            (a !== Et && a !== Gt) ||
            ((this.T.compaction = a), this.C());
        },
      },
      breadthLimit: {
        get: function () {
          return this.T.breadthLimit;
        },
        set: function (a) {
          this.T.breadthLimit !== a &&
            0 <= a &&
            ((this.T.breadthLimit = a), this.C());
        },
      },
      rowSpacing: {
        get: function () {
          return this.T.rowSpacing;
        },
        set: function (a) {
          this.T.rowSpacing !== a && ((this.T.rowSpacing = a), this.C());
        },
      },
      rowIndent: {
        get: function () {
          return this.T.rowIndent;
        },
        set: function (a) {
          this.T.rowIndent !== a && 0 <= a && ((this.T.rowIndent = a), this.C());
        },
      },
      commentSpacing: {
        get: function () {
          return this.T.commentSpacing;
        },
        set: function (a) {
          this.T.commentSpacing !== a && ((this.T.commentSpacing = a), this.C());
        },
      },
      commentMargin: {
        get: function () {
          return this.T.commentMargin;
        },
        set: function (a) {
          this.T.commentMargin !== a && ((this.T.commentMargin = a), this.C());
        },
      },
      setsPortSpot: {
        get: function () {
          return this.T.setsPortSpot;
        },
        set: function (a) {
          this.T.setsPortSpot !== a && ((this.T.setsPortSpot = a), this.C());
        },
      },
      portSpot: {
        get: function () {
          return this.T.portSpot;
        },
        set: function (a) {
          this.T.portSpot.A(a) || ((this.T.portSpot = a), this.C());
        },
      },
      setsChildPortSpot: {
        get: function () {
          return this.T.setsChildPortSpot;
        },
        set: function (a) {
          this.T.setsChildPortSpot !== a &&
            ((this.T.setsChildPortSpot = a), this.C());
        },
      },
      childPortSpot: {
        get: function () {
          return this.T.childPortSpot;
        },
        set: function (a) {
          this.T.childPortSpot.A(a) || ((this.T.childPortSpot = a), this.C());
        },
      },
      alternateSorting: {
        get: function () {
          return this.U.sorting;
        },
        set: function (a) {
          this.U.sorting === a ||
            (a !== ut && a !== vt && a !== wt && !xt) ||
            ((this.U.sorting = a), this.C());
        },
      },
      alternateComparer: {
        get: function () {
          return this.U.comparer;
        },
        set: function (a) {
          this.U.comparer !== a && ((this.U.comparer = a), this.C());
        },
      },
      alternateAngle: {
        get: function () {
          return this.U.angle;
        },
        set: function (a) {
          this.U.angle === a ||
            (0 !== a && 90 !== a && 180 !== a && 270 !== a) ||
            ((this.U.angle = a), this.C());
        },
      },
      alternateAlignment: {
        get: function () {
          return this.U.alignment;
        },
        set: function (a) {
          this.U.alignment !== a && ((this.U.alignment = a), this.C());
        },
      },
      alternateNodeIndent: {
        get: function () {
          return this.U.nodeIndent;
        },
        set: function (a) {
          this.U.nodeIndent !== a &&
            0 <= a &&
            ((this.U.nodeIndent = a), this.C());
        },
      },
      alternateNodeIndentPastParent: {
        get: function () {
          return this.U.nodeIndentPastParent;
        },
        set: function (a) {
          this.U.nodeIndentPastParent !== a &&
            0 <= a &&
            1 >= a &&
            ((this.U.nodeIndentPastParent = a), this.C());
        },
      },
      alternateNodeSpacing: {
        get: function () {
          return this.U.nodeSpacing;
        },
        set: function (a) {
          this.U.nodeSpacing !== a && ((this.U.nodeSpacing = a), this.C());
        },
      },
      alternateLayerSpacing: {
        get: function () {
          return this.U.layerSpacing;
        },
        set: function (a) {
          this.U.layerSpacing !== a && ((this.U.layerSpacing = a), this.C());
        },
      },
      alternateLayerSpacingParentOverlap: {
        get: function () {
          return this.U.layerSpacingParentOverlap;
        },
        set: function (a) {
          this.U.layerSpacingParentOverlap !== a &&
            0 <= a &&
            1 >= a &&
            ((this.U.layerSpacingParentOverlap = a), this.C());
        },
      },
      alternateCompaction: {
        get: function () {
          return this.U.compaction;
        },
        set: function (a) {
          this.U.compaction === a ||
            (a !== Et && a !== Gt) ||
            ((this.U.compaction = a), this.C());
        },
      },
      alternateBreadthLimit: {
        get: function () {
          return this.U.breadthLimit;
        },
        set: function (a) {
          this.U.breadthLimit !== a &&
            0 <= a &&
            ((this.U.breadthLimit = a), this.C());
        },
      },
      alternateRowSpacing: {
        get: function () {
          return this.U.rowSpacing;
        },
        set: function (a) {
          this.U.rowSpacing !== a && ((this.U.rowSpacing = a), this.C());
        },
      },
      alternateRowIndent: {
        get: function () {
          return this.U.rowIndent;
        },
        set: function (a) {
          this.U.rowIndent !== a && 0 <= a && ((this.U.rowIndent = a), this.C());
        },
      },
      alternateCommentSpacing: {
        get: function () {
          return this.U.commentSpacing;
        },
        set: function (a) {
          this.U.commentSpacing !== a && ((this.U.commentSpacing = a), this.C());
        },
      },
      alternateCommentMargin: {
        get: function () {
          return this.U.commentMargin;
        },
        set: function (a) {
          this.U.commentMargin !== a && ((this.U.commentMargin = a), this.C());
        },
      },
      alternateSetsPortSpot: {
        get: function () {
          return this.U.setsPortSpot;
        },
        set: function (a) {
          this.U.setsPortSpot !== a && ((this.U.setsPortSpot = a), this.C());
        },
      },
      alternatePortSpot: {
        get: function () {
          return this.U.portSpot;
        },
        set: function (a) {
          this.U.portSpot.A(a) || ((this.U.portSpot = a), this.C());
        },
      },
      alternateSetsChildPortSpot: {
        get: function () {
          return this.U.setsChildPortSpot;
        },
        set: function (a) {
          this.U.setsChildPortSpot !== a &&
            ((this.U.setsChildPortSpot = a), this.C());
        },
      },
      alternateChildPortSpot: {
        get: function () {
          return this.U.childPortSpot;
        },
        set: function (a) {
          this.U.childPortSpot.A(a) || ((this.U.childPortSpot = a), this.C());
        },
      },
    });
    var Ys = new D(Xs, 'PathDefault', -1),
      Zs = new D(Xs, 'PathDestination', 0),
      ft = new D(Xs, 'PathSource', 1),
      ut = new D(Xs, 'SortingForwards', 10),
      vt = new D(Xs, 'SortingReverse', 11),
      wt = new D(Xs, 'SortingAscending', 12),
      xt = new D(Xs, 'SortingDescending', 13),
      Zt = new D(Xs, 'AlignmentCenterSubtrees', 20),
      $t = new D(Xs, 'AlignmentCenterChildren', 21),
      Qt = new D(Xs, 'AlignmentStart', 22),
      It = new D(Xs, 'AlignmentEnd', 23),
      zt = new D(Xs, 'AlignmentBus', 24),
      pt = new D(Xs, 'AlignmentBusBranching', 25),
      At = new D(Xs, 'AlignmentTopLeftBus', 26),
      Bt = new D(Xs, 'AlignmentBottomRightBus', 27),
      Et = new D(Xs, 'CompactionNone', 30),
      Gt = new D(Xs, 'CompactionBlock', 31),
      $s = new D(Xs, 'StyleLayered', 40),
      tt = new D(Xs, 'StyleLastParents', 41),
      st = new D(Xs, 'StyleAlternating', 42),
      rt = new D(Xs, 'StyleRootOnly', 43),
      bt = new D(Xs, 'ArrangementVertical', 50),
      hu = new D(Xs, 'ArrangementHorizontal', 51),
      et = new D(Xs, 'ArrangementFixedRoots', 52),
      at = new D(Xs, 'LayerIndividual', 60),
      nt = new D(Xs, 'LayerSiblings', 61),
      mt = new D(Xs, 'LayerUniform', 62);
    Xs.className = 'TreeLayout';
    Xs.PathDefault = Ys;
    Xs.PathDestination = Zs;
    Xs.PathSource = ft;
    Xs.SortingForwards = ut;
    Xs.SortingReverse = vt;
    Xs.SortingAscending = wt;
    Xs.SortingDescending = xt;
    Xs.AlignmentCenterSubtrees = Zt;
    Xs.AlignmentCenterChildren = $t;
    Xs.AlignmentStart = Qt;
    Xs.AlignmentEnd = It;
    Xs.AlignmentBus = zt;
    Xs.AlignmentBusBranching = pt;
    Xs.AlignmentTopLeftBus = At;
    Xs.AlignmentBottomRightBus = Bt;
    Xs.CompactionNone = Et;
    Xs.CompactionBlock = Gt;
    Xs.StyleLayered = $s;
    Xs.StyleLastParents = tt;
    Xs.StyleAlternating = st;
    Xs.StyleRootOnly = rt;
    Xs.ArrangementVertical = bt;
    Xs.ArrangementHorizontal = hu;
    Xs.ArrangementFixedRoots = et;
    Xs.LayerIndividual = at;
    Xs.LayerSiblings = nt;
    Xs.LayerUniform = mt;
    function ct(a) {
      Pp.call(this, a);
    }
    la(ct, Pp);
    ct.prototype.createVertex = function () {
      return new dt(this);
    };
    ct.prototype.createEdge = function () {
      return new ju(this);
    };
    ct.className = 'TreeNetwork';
    function dt(a) {
      Sp.call(this, a);
      this.Ja = !1;
      this.yd = null;
      this.I = [];
      this.hd = this.eb = this.Y = this.La = 0;
      this.Vc = null;
      this.S = new H(0, 0);
      this.sa = new L(0, 0);
      this.da = new H(0, 0);
      this.Gm = this.Fm = this.tA = !1;
      this.Hq = this.uq = null;
      this.Oc = ut;
      this.Ic = Zp;
      this.Zb = 0;
      this.wb = $t;
      this.ks = this.js = 0;
      this.ls = 20;
      this.oe = 50;
      this.Xr = 0;
      this.ir = Gt;
      this.ar = 0;
      this.xs = 25;
      this.hr = this.ws = 10;
      this.gr = 20;
      this.Js = !0;
      this.ts = Zc;
      this.Is = !0;
      this.dr = Zc;
    }
    la(dt, Sp);
    dt.prototype.copyInheritedPropertiesFrom = function (a) {
      null !== a &&
        ((this.Oc = a.sorting),
        (this.Ic = a.comparer),
        (this.Zb = a.angle),
        (this.wb = a.alignment),
        (this.js = a.nodeIndent),
        (this.ks = a.nodeIndentPastParent),
        (this.ls = a.nodeSpacing),
        (this.oe = a.layerSpacing),
        (this.Xr = a.layerSpacingParentOverlap),
        (this.ir = a.compaction),
        (this.ar = a.breadthLimit),
        (this.xs = a.rowSpacing),
        (this.ws = a.rowIndent),
        (this.hr = a.commentSpacing),
        (this.gr = a.commentMargin),
        (this.Js = a.setsPortSpot),
        (this.ts = a.portSpot),
        (this.Is = a.setsChildPortSpot),
        (this.dr = a.childPortSpot));
    };
    ma.Object.defineProperties(dt.prototype, {
      initialized: {
        get: function () {
          return this.Ja;
        },
        set: function (a) {
          this.Ja !== a && (this.Ja = a);
        },
      },
      parent: {
        get: function () {
          return this.yd;
        },
        set: function (a) {
          this.yd !== a && (this.yd = a);
        },
      },
      children: {
        get: function () {
          return this.I;
        },
        set: function (a) {
          if (this.I !== a) {
            if (null !== a) for (var b = a.length, c = 0; c < b; c++);
            this.I = a;
          }
        },
      },
      level: {
        get: function () {
          return this.La;
        },
        set: function (a) {
          this.La !== a && (this.La = a);
        },
      },
      descendantCount: {
        get: function () {
          return this.Y;
        },
        set: function (a) {
          this.Y !== a && (this.Y = a);
        },
      },
      maxChildrenCount: {
        get: function () {
          return this.eb;
        },
        set: function (a) {
          this.eb !== a && (this.eb = a);
        },
      },
      maxGenerationCount: {
        get: function () {
          return this.hd;
        },
        set: function (a) {
          this.hd !== a && (this.hd = a);
        },
      },
      comments: {
        get: function () {
          return this.Vc;
        },
        set: function (a) {
          if (this.Vc !== a) {
            if (null !== a) for (var b = a.length, c = 0; c < b; c++);
            this.Vc = a;
          }
        },
      },
      sorting: {
        get: function () {
          return this.Oc;
        },
        set: function (a) {
          this.Oc !== a && (this.Oc = a);
        },
      },
      comparer: {
        get: function () {
          return this.Ic;
        },
        set: function (a) {
          this.Ic !== a && (this.Ic = a);
        },
      },
      angle: {
        get: function () {
          return this.Zb;
        },
        set: function (a) {
          this.Zb !== a && (this.Zb = a);
        },
      },
      alignment: {
        get: function () {
          return this.wb;
        },
        set: function (a) {
          this.wb !== a && (this.wb = a);
        },
      },
      nodeIndent: {
        get: function () {
          return this.js;
        },
        set: function (a) {
          this.js !== a && (this.js = a);
        },
      },
      nodeIndentPastParent: {
        get: function () {
          return this.ks;
        },
        set: function (a) {
          this.ks !== a && (this.ks = a);
        },
      },
      nodeSpacing: {
        get: function () {
          return this.ls;
        },
        set: function (a) {
          this.ls !== a && (this.ls = a);
        },
      },
      layerSpacing: {
        get: function () {
          return this.oe;
        },
        set: function (a) {
          this.oe !== a && (this.oe = a);
        },
      },
      layerSpacingParentOverlap: {
        get: function () {
          return this.Xr;
        },
        set: function (a) {
          this.Xr !== a && (this.Xr = a);
        },
      },
      compaction: {
        get: function () {
          return this.ir;
        },
        set: function (a) {
          this.ir !== a && (this.ir = a);
        },
      },
      breadthLimit: {
        get: function () {
          return this.ar;
        },
        set: function (a) {
          this.ar !== a && (this.ar = a);
        },
      },
      rowSpacing: {
        get: function () {
          return this.xs;
        },
        set: function (a) {
          this.xs !== a && (this.xs = a);
        },
      },
      rowIndent: {
        get: function () {
          return this.ws;
        },
        set: function (a) {
          this.ws !== a && (this.ws = a);
        },
      },
      commentSpacing: {
        get: function () {
          return this.hr;
        },
        set: function (a) {
          this.hr !== a && (this.hr = a);
        },
      },
      commentMargin: {
        get: function () {
          return this.gr;
        },
        set: function (a) {
          this.gr !== a && (this.gr = a);
        },
      },
      setsPortSpot: {
        get: function () {
          return this.Js;
        },
        set: function (a) {
          this.Js !== a && (this.Js = a);
        },
      },
      portSpot: {
        get: function () {
          return this.ts;
        },
        set: function (a) {
          this.ts.A(a) || (this.ts = a);
        },
      },
      setsChildPortSpot: {
        get: function () {
          return this.Is;
        },
        set: function (a) {
          this.Is !== a && (this.Is = a);
        },
      },
      childPortSpot: {
        get: function () {
          return this.dr;
        },
        set: function (a) {
          this.dr.A(a) || (this.dr = a);
        },
      },
      childrenCount: {
        get: function () {
          return this.children.length;
        },
      },
      relativePosition: {
        get: function () {
          return this.S;
        },
        set: function (a) {
          this.S.set(a);
        },
      },
      subtreeSize: {
        get: function () {
          return this.sa;
        },
        set: function (a) {
          this.sa.set(a);
        },
      },
      subtreeOffset: {
        get: function () {
          return this.da;
        },
        set: function (a) {
          this.da.set(a);
        },
      },
    });
    dt.className = 'TreeVertex';
    function ju(a) {
      Tp.call(this, a);
      this.Ju = new H(0, 0);
    }
    la(ju, Tp);
    ju.prototype.commit = function () {
      var a = this.link;
      if (null !== a && !a.isAvoiding) {
        var b = this.network.layout,
          c = null,
          d = null;
        switch (b.Xc) {
          case Zs:
            c = this.fromVertex;
            d = this.toVertex;
            break;
          case ft:
            c = this.toVertex;
            d = this.fromVertex;
            break;
          default:
            B('Unhandled path value ' + b.Xc.toString());
        }
        if (null !== c && null !== d)
          if (((b = this.Ju), 0 !== b.x || 0 !== b.y || c.tA)) {
            d = c.bounds;
            var e = Ht(c),
              f = Jt(c),
              g = c.rowSpacing;
            a.gj();
            var h = a.curve === rg,
              k = a.isOrthogonal,
              l;
            a.Oh();
            if (k || h) {
              for (l = 2; 4 < a.pointsCount; ) a.$v(2);
              var m = a.i(1);
              var n = a.i(2);
            } else {
              for (l = 1; 3 < a.pointsCount; ) a.$v(1);
              m = a.i(0);
              n = a.i(a.pointsCount - 1);
            }
            var p = a.i(a.pointsCount - 1);
            0 === e
              ? (c.alignment === It
                  ? ((e = d.bottom + b.y),
                    0 === b.y &&
                      m.y > p.y + c.rowIndent &&
                      (e = Math.min(e, Math.max(m.y, e - Pt(c)))))
                  : c.alignment === Qt
                  ? ((e = d.top + b.y),
                    0 === b.y &&
                      m.y < p.y - c.rowIndent &&
                      (e = Math.max(e, Math.min(m.y, e + Pt(c)))))
                  : (e =
                      c.Fm || (c.Gm && 1 === c.maxGenerationCount)
                        ? d.top - c.da.y + b.y
                        : d.y + d.height / 2 + b.y),
                h
                  ? (a.m(l, m.x, e),
                    l++,
                    a.m(l, d.right + f, e),
                    l++,
                    a.m(l, d.right + f + (b.x - g) / 3, e),
                    l++,
                    a.m(l, d.right + f + (2 * (b.x - g)) / 3, e),
                    l++,
                    a.m(l, d.right + f + (b.x - g), e),
                    l++,
                    a.m(l, n.x, e))
                  : (k && (a.m(l, d.right + f / 2, m.y), l++),
                    a.m(l, d.right + f / 2, e),
                    l++,
                    a.m(l, d.right + f + b.x - (k ? g / 2 : g), e),
                    l++,
                    k && a.m(l, a.i(l - 1).x, n.y)))
              : 90 === e
              ? (c.alignment === It
                  ? ((e = d.right + b.x),
                    0 === b.x &&
                      m.x > p.x + c.rowIndent &&
                      (e = Math.min(e, Math.max(m.x, e - Pt(c)))))
                  : c.alignment === Qt
                  ? ((e = d.left + b.x),
                    0 === b.x &&
                      m.x < p.x - c.rowIndent &&
                      (e = Math.max(e, Math.min(m.x, e + Pt(c)))))
                  : (e =
                      c.Fm || (c.Gm && 1 === c.maxGenerationCount)
                        ? d.left - c.da.x + b.x
                        : d.x + d.width / 2 + b.x),
                h
                  ? (a.m(l, e, m.y),
                    l++,
                    a.m(l, e, d.bottom + f),
                    l++,
                    a.m(l, e, d.bottom + f + (b.y - g) / 3),
                    l++,
                    a.m(l, e, d.bottom + f + (2 * (b.y - g)) / 3),
                    l++,
                    a.m(l, e, d.bottom + f + (b.y - g)),
                    l++,
                    a.m(l, e, n.y))
                  : (k && (a.m(l, m.x, d.bottom + f / 2), l++),
                    a.m(l, e, d.bottom + f / 2),
                    l++,
                    a.m(l, e, d.bottom + f + b.y - (k ? g / 2 : g)),
                    l++,
                    k && a.m(l, n.x, a.i(l - 1).y)))
              : 180 === e
              ? (c.alignment === It
                  ? ((e = d.bottom + b.y),
                    0 === b.y &&
                      m.y > p.y + c.rowIndent &&
                      (e = Math.min(e, Math.max(m.y, e - Pt(c)))))
                  : c.alignment === Qt
                  ? ((e = d.top + b.y),
                    0 === b.y &&
                      m.y < p.y - c.rowIndent &&
                      (e = Math.max(e, Math.min(m.y, e + Pt(c)))))
                  : (e =
                      c.Fm || (c.Gm && 1 === c.maxGenerationCount)
                        ? d.top - c.da.y + b.y
                        : d.y + d.height / 2 + b.y),
                h
                  ? (a.m(l, m.x, e),
                    l++,
                    a.m(l, d.left - f, e),
                    l++,
                    a.m(l, d.left - f + (b.x + g) / 3, e),
                    l++,
                    a.m(l, d.left - f + (2 * (b.x + g)) / 3, e),
                    l++,
                    a.m(l, d.left - f + (b.x + g), e),
                    l++,
                    a.m(l, n.x, e))
                  : (k && (a.m(l, d.left - f / 2, m.y), l++),
                    a.m(l, d.left - f / 2, e),
                    l++,
                    a.m(l, d.left - f + b.x + (k ? g / 2 : g), e),
                    l++,
                    k && a.m(l, a.i(l - 1).x, n.y)))
              : 270 === e
              ? (c.alignment === It
                  ? ((e = d.right + b.x),
                    0 === b.x &&
                      m.x > p.x + c.rowIndent &&
                      (e = Math.min(e, Math.max(m.x, e - Pt(c)))))
                  : c.alignment === Qt
                  ? ((e = d.left + b.x),
                    0 === b.x &&
                      m.x < p.x - c.rowIndent &&
                      (e = Math.max(e, Math.min(m.x, e + Pt(c)))))
                  : (e =
                      c.Fm || (c.Gm && 1 === c.maxGenerationCount)
                        ? d.left - c.da.x + b.x
                        : d.x + d.width / 2 + b.x),
                h
                  ? (a.m(l, e, m.y),
                    l++,
                    a.m(l, e, d.top - f),
                    l++,
                    a.m(l, e, d.top - f + (b.y + g) / 3),
                    l++,
                    a.m(l, e, d.top - f + (2 * (b.y + g)) / 3),
                    l++,
                    a.m(l, e, d.top - f + (b.y + g)),
                    l++,
                    a.m(l, e, n.y))
                  : (k && (a.m(l, m.x, d.top - f / 2), l++),
                    a.m(l, e, d.top - f / 2),
                    l++,
                    a.m(l, e, d.top - f + b.y + (k ? g / 2 : g)),
                    l++,
                    k && a.m(l, n.x, a.i(l - 1).y)))
              : B('Invalid angle ' + e);
            a.pf();
          } else
            (a = this.link),
              (f = Ht(c)),
              f !== Ht(d) &&
                ((g = Jt(c)),
                (h = c.bounds),
                (c = d.bounds),
                (0 === f && c.left - h.right < g + 1) ||
                  (90 === f && c.top - h.bottom < g + 1) ||
                  (180 === f && h.left - c.right < g + 1) ||
                  (270 === f && h.top - c.bottom < g + 1) ||
                  (a.gj(),
                  (c = a.curve === rg),
                  (b = a.isOrthogonal),
                  (d = yt(this.fromVertex.alignment)),
                  a.Oh(),
                  0 === f
                    ? ((f = h.right + g / 2),
                      c
                        ? 4 === a.pointsCount &&
                          ((c = a.i(3).y),
                          a.K(1, f - 20, a.i(1).y),
                          a.m(2, f - 20, c),
                          a.m(3, f, c),
                          a.m(4, f + 20, c),
                          a.K(5, a.i(5).x, c))
                        : b
                        ? d
                          ? a.K(3, a.i(2).x, a.i(4).y)
                          : 6 === a.pointsCount &&
                            (a.K(2, f, a.i(2).y), a.K(3, f, a.i(3).y))
                        : 4 === a.pointsCount
                        ? a.m(2, f, a.i(2).y)
                        : 3 === a.pointsCount
                        ? a.K(1, f, a.i(2).y)
                        : 2 === a.pointsCount && a.m(1, f, a.i(1).y))
                    : 90 === f
                    ? ((f = h.bottom + g / 2),
                      c
                        ? 4 === a.pointsCount &&
                          ((c = a.i(3).x),
                          a.K(1, a.i(1).x, f - 20),
                          a.m(2, c, f - 20),
                          a.m(3, c, f),
                          a.m(4, c, f + 20),
                          a.K(5, c, a.i(5).y))
                        : b
                        ? d
                          ? a.K(3, a.i(2).x, a.i(4).y)
                          : 6 === a.pointsCount &&
                            (a.K(2, a.i(2).x, f), a.K(3, a.i(3).x, f))
                        : 4 === a.pointsCount
                        ? a.m(2, a.i(2).x, f)
                        : 3 === a.pointsCount
                        ? a.K(1, a.i(2).x, f)
                        : 2 === a.pointsCount && a.m(1, a.i(1).x, f))
                    : 180 === f
                    ? ((f = h.left - g / 2),
                      c
                        ? 4 === a.pointsCount &&
                          ((c = a.i(3).y),
                          a.K(1, f + 20, a.i(1).y),
                          a.m(2, f + 20, c),
                          a.m(3, f, c),
                          a.m(4, f - 20, c),
                          a.K(5, a.i(5).x, c))
                        : b
                        ? d
                          ? a.K(3, a.i(2).x, a.i(4).y)
                          : 6 === a.pointsCount &&
                            (a.K(2, f, a.i(2).y), a.K(3, f, a.i(3).y))
                        : 4 === a.pointsCount
                        ? a.m(2, f, a.i(2).y)
                        : 3 === a.pointsCount
                        ? a.K(1, f, a.i(2).y)
                        : 2 === a.pointsCount && a.m(1, f, a.i(1).y))
                    : 270 === f &&
                      ((f = h.top - g / 2),
                      c
                        ? 4 === a.pointsCount &&
                          ((c = a.i(3).x),
                          a.K(1, a.i(1).x, f + 20),
                          a.m(2, c, f + 20),
                          a.m(3, c, f),
                          a.m(4, c, f - 20),
                          a.K(5, c, a.i(5).y))
                        : b
                        ? d
                          ? a.K(3, a.i(2).x, a.i(4).y)
                          : 6 === a.pointsCount &&
                            (a.K(2, a.i(2).x, f), a.K(3, a.i(3).x, f))
                        : 4 === a.pointsCount
                        ? a.m(2, a.i(2).x, f)
                        : 3 === a.pointsCount
                        ? a.K(1, a.i(2).x, f)
                        : 2 === a.pointsCount && a.m(1, a.i(1).x, f)),
                  a.pf()));
      }
    };
    ma.Object.defineProperties(ju.prototype, {
      relativePoint: {
        get: function () {
          return this.Ju;
        },
        set: function (a) {
          this.Ju.set(a);
        },
      },
    });
    ju.className = 'TreeEdge';
    Oa.prototype.initializeStandardTools = function () {
      this.Va('Action', new Fg(), this.mouseDownTools);
      this.Va('Relinking', new Xe(), this.mouseDownTools);
      this.Va('LinkReshaping', new pg(), this.mouseDownTools);
      this.Va('Rotating', new Dg(), this.mouseDownTools);
      this.Va('Resizing', new wg(), this.mouseDownTools);
      this.Va('Linking', new Xf(), this.mouseMoveTools);
      this.Va('Dragging', new Pe(), this.mouseMoveTools);
      this.Va('DragSelecting', new Ig(), this.mouseMoveTools);
      this.Va('Panning', new Jg(), this.mouseMoveTools);
      this.Va('ContextMenu', new Lg(), this.mouseUpTools);
      this.Va('TextEditing', new Wg(), this.mouseUpTools);
      this.Va('ClickCreating', new Gg(), this.mouseUpTools);
      this.Va('ClickSelecting', new Eg(), this.mouseUpTools);
    };
    zn('Horizontal', new wm());
    zn('Spot', new ym());
    zn('Table', new Cm());
    zn('Viewbox', new Hm());
    zn('TableRow', new Fm());
    zn('TableColumn', new Gm());
    zn('Graduated', new Rm());
    zn('Grid', new Im());
    ri.add(ar.type, rq);
    ri.add(er.type, Fq);
    var ku = x.go,
      lu = {
        get licenseKey() {
          return R.licenseKey;
        },
        set licenseKey(a) {
          R.licenseKey = a;
        },
        get version() {
          return R.version;
        },
        Group: xf,
        EnumValue: D,
        List: E,
        Set: F,
        Map: G,
        Point: H,
        Size: L,
        Rect: N,
        Margin: oc,
        Spot: O,
        Geometry: td,
        PathFigure: fe,
        PathSegment: ge,
        InputEvent: me,
        DiagramEvent: oe,
        ChangedEvent: pe,
        Model: Z,
        GraphLinksModel: ar,
        TreeModel: er,
        Binding: Ki,
        Transaction: ue,
        UndoManager: ve,
        CommandHandler: Qk,
        Tool: xe,
        DraggingTool: Pe,
        DraggingInfo: Ye,
        LinkingBaseTool: Mf,
        LinkingTool: Xf,
        RelinkingTool: Xe,
        LinkReshapingTool: pg,
        ResizingTool: wg,
        RotatingTool: Dg,
        ClickSelectingTool: Eg,
        ActionTool: Fg,
        ClickCreatingTool: Gg,
        HTMLInfo: Ne,
        ContextMenuTool: Lg,
        DragSelectingTool: Ig,
        PanningTool: Jg,
        TextEditingTool: Wg,
        ToolManager: Oa,
        Animation: yh,
        AnimationManager: uh,
        AnimationTrigger: $h,
        Layer: ei,
        Diagram: R,
        Palette: Kk,
        Overview: Mk,
        Brush: sl,
        GraphObject: Y,
        Panel: X,
        RowColumnDefinition: Sj,
        Shape: W,
        TextBlock: Xg,
        TextBlockMetrics: jo,
        Picture: lk,
        Part: T,
        Adornment: Ce,
        Node: U,
        Link: S,
        Placeholder: yg,
        Layout: Di,
        LayoutNetwork: Pp,
        LayoutVertex: Sp,
        LayoutEdge: Tp,
        GridLayout: Lk,
        PanelLayout: Nl,
        CircularLayout: fr,
        CircularNetwork: xr,
        CircularVertex: Kr,
        CircularEdge: Lr,
        ForceDirectedLayout: Mr,
        ForceDirectedNetwork: Nr,
        ForceDirectedVertex: Zr,
        ForceDirectedEdge: $r,
        LayeredDigraphLayout: as,
        LayeredDigraphNetwork: fs,
        LayeredDigraphVertex: Vs,
        LayeredDigraphEdge: Ws,
        TreeLayout: Xs,
        TreeNetwork: ct,
        TreeVertex: dt,
        TreeEdge: ju,
      };
    ku &&
      ku.version !== lu.version &&
      B(
        'WARNING: a `go` object on the root object is already defined with a version mismatch.' +
          ku.version +
          '. Replaced with version: ' +
          lu.version,
      );
    x.go = lu;
    ('undefined' === typeof x ||
      'undefined' === typeof x.module ||
      'object' !== typeof x.module.exports) &&
      x.define &&
      'function' === typeof x.define &&
      x.define.amd &&
      x.define(lu);
    'undefined' !== typeof module &&
      'object' === typeof module.exports &&
      (module.exports = 'undefined' !== typeof global ? global.go : self.go);
  })();
  