text: /*
   Basic Primitives Diagram v5.3.1
   Copyright (c) 2013 - 2019 Basic Primitives Inc
  
   Non-commercial - Free
   http://creativecommons.org/licenses/by-nc/3.0/
  
   Commercial and government licenses:
   http://www.basicprimitives.com/pdf/license.pdf
  
  */
  (function(a, M) {
      "function" === typeof define && define.amd ? define([], function() {
          return a.primitives = M()
      }) : "object" === typeof module && module.exports ? module.exports = a.primitives = M() : a.primitives = M()
  })(this, function() {
      var a = {
          common: {
              version: "5.3.1"
          },
          orgdiagram: {},
          famdiagram: {},
          text: {},
          callout: {},
          connector: {},
          shape: {},
          pdf: {
              orgdiagram: {},
              famdiagram: {}
          }
      };
      a.common.getElementsByName = function(a, b, d, c) {
          for (var b = b.getElementsByTagName("*"), e = 0; e < b.length; e += 1) {
              var g = b[e];
              g.name == d && c.call(a, g)
          }
      };
      a.common.getFixOfPixelALignment =
          function(f) {
              var b = f.getBoundingClientRect(),
                  f = b.top + document.body.scrollTop,
                  b = b.left + document.body.scrollLeft;
              return new a.common.Size(-b + Math.floor(b), -f + Math.floor(f))
          };
      a.common.getElementOffset = function(a) {
          var b = a.getBoundingClientRect(),
              a = a.ownerDocument.documentElement;
          return {
              top: b.top + window.pageYOffset - a.clientTop,
              left: b.left + window.pageXOffset - a.clientLeft
          }
      };
      a.common.hasClass = function(a, b) {
          var d = a.className;
          if (null != d && "string" == typeof d)
              for (var d = d.split(" "), c = 0; c < d.length; c += 1)
                  if (d[c] ==
                      b) return !0;
          return !1
      };
      a.common.stopPropagation = function(a) {
          void 0 !== a.stopPropagation ? a.stopPropagation() : void 0 !== a.cancelBubble ? a.cancelBubble = !0 : void 0 !== a.preventDefault && a.preventDefault()
      };
      a.common.getInnerSize = function(f) {
          f = window.getComputedStyle(f);
          return new a.common.Size(parseInt(f.width, 10), parseInt(f.height, 10))
      };
      a.common.isEven = function(a) {
          return 0 == a % 2
      };
      a.common.isNullOrEmpty = function(a) {
          var b = !0;
          void 0 !== a && null !== a && (a = a.toString(), 0 < a.length && (b = !1));
          return b
      };
      a.common.isArray = Array.isArray ||
          function(a) {
              return a instanceof Array
          };
      a.common.loop = function(f, b, d) {
          var c, e;
          if (null != d)
              if (a.common.isArray(b)) {
                  c = 0;
                  for (e = b.length; c < e && !d.call(f, c, b[c]); c += 1);
              } else
                  for (c in b)
                      if (b.hasOwnProperty(c) && d.call(f, c, b[c])) break
      };
      a.common.splitCamelCaseName = function(a) {
          for (var b = [], d = "", c = 0; c < a.length; c += 1) {
              var e = a[c];
              "A" <= e && "Z" >= e ? ("" !== d && b.push(d), d = e) : d += e
          }
          "" !== d && b.push(d);
          return b
      };
      a.common.isObject = function(a) {
          return null !== a && "object" == typeof a
      };
      a.common.isEmptyObject = function(a) {
          for (var b in a)
              if (a.hasOwnProperty(b)) return !1;
          return !0
      };
      a.common.cloneObject = function(f, b) {
          var d;
          if (null === f) d = null;
          else if (f instanceof Array)
              if (b) d = f.slice(0);
              else {
                  d = [];
                  for (var c = 0, e = f.length; c < e; c += 1) d.push(a.common.cloneObject(f[c], b))
              }
          else switch (typeof f) {
              case "object":
                  d = {};
                  for (c in f) f.hasOwnProperty(c) && (d[c] = b ? f[c] : a.common.cloneObject(f[c], b));
                  break;
              default:
                  d = f
          }
          return d
      };
      a.common.mergeObjects = function(a, b) {
          for (var d = 1; d < arguments.length; d += 1) {
              var c = arguments[d];
              if (null != c)
                  for (var e in c) c.hasOwnProperty(e) && (a[e] = c[e])
          }
          return a
      };
      a.common.hashCode =
          function(a) {
              var b = 0,
                  d, c;
              if (0 < a.length)
                  for (c = 0; c < a.length; c += 1) d = a.charCodeAt(c), b = (b << 5) - b + d, b &= b;
              return b
          };
      a.common.indexOf = function(a, b, d) {
          var c, e;
          for (c = 0; c < a.length; c += 1)
              if (e = a[c], null != d ? d(e, b) : e == b) return c;
          return -1
      };
      a.common._supportsSVG = null;
      a.common.supportsSVG = function() {
          null === a.common._supportsSVG && (a.common._supportsSVG = document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") || document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Shape",
              "1.0"));
          return a.common._supportsSVG
      };
      a.common._supportsCanvas = null;
      a.common.supportsCanvas = function() {
          null === a.common._supportsCanvas && (a.common._supportsCanvas = !!window.HTMLCanvasElement);
          return a.common._supportsCanvas
      };
      a.common.createGraphics = function(f, b) {
          var d = null,
              c, e;
          c = [f];
          for (e in a.common.GraphicsType) a.common.GraphicsType.hasOwnProperty(e) && c.push(a.common.GraphicsType[e]);
          for (e = 0; null === d && e < c.length; e += 1) switch (c[e]) {
              case 0:
                  a.common.supportsSVG() && (d = new a.common.SvgGraphics(b));
                  break;
              case 1:
                  a.common.supportsCanvas() && (d = new a.common.CanvasGraphics(b))
          }
          return d
      };
      a.common.isChrome = function() {
          return null != navigator ? /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor) : !1
      };
      a.common.getColorHexValue = function(f) {
          var b, d, c;
          if ("#" === f.substr(0, 1)) return f;
          b = /(.*?)rgb\((\d+), (\d+), (\d+)\)/.exec(f);
          if (null !== b && 0 < b.length) return f = parseInt(b[2], 10), d = parseInt(b[3], 10), c = parseInt(b[4], 10), f = (f << 16 | d << 8 | c).toString(16), b[1] + "000000".substr(0, 6 - f.length) + f;
          if (void 0 ===
              a.common.ColorHexs)
              for (d in a.common.ColorHexs = {}, a.common.Colors) a.common.Colors.hasOwnProperty(d) && (a.common.ColorHexs[d.toUpperCase()] = a.common.Colors[d]);
          return a.common.ColorHexs[f.toUpperCase()]
      };
      a.common.getColorName = function(f) {
          var b, f = a.common.getColorHexValue(f);
          if (void 0 === a.common.ColorNames)
              for (b in a.common.ColorNames = {}, a.common.Colors) a.common.Colors.hasOwnProperty(b) && (a.common.ColorNames[a.common.Colors[b]] = b);
          return a.common.ColorNames[f]
      };
      a.common.getRed = function(a) {
          return "#" ===
              a.substr(0, 1) && 7 === a.length ? parseInt(a.substr(1, 2), 16) : null
      };
      a.common.getGreen = function(a) {
          return "#" === a.substr(0, 1) && 7 === a.length ? parseInt(a.substr(3, 2), 16) : null
      };
      a.common.getBlue = function(a) {
          return "#" === a.substr(0, 1) && 7 === a.length ? parseInt(a.substr(5, 2), 16) : null
      };
      a.common.beforeOpacity = function(f, b) {
          var d = a.common,
              c, e, f = d.getColorHexValue(f);
          c = Math.ceil((d.getRed(f) - 255 * (1 - b)) / b);
          e = Math.ceil((d.getGreen(f) - 255 * (1 - b)) / b);
          d = Math.ceil((d.getBlue(f) - 255 * (1 - b)) / b);
          c = (c << 16 | e << 8 | d).toString(16);
          return "#" +
              "000000".substr(0, 6 - c.length) + c
      };
      a.common.highestContrast = function(f, b, d) {
          var c = b,
              e = a.common,
              g = f + "," + b + "," + d;
          void 0 === e.highestContrasts && (e.highestContrasts = {});
          e.highestContrasts.hasOwnProperty(g) ? c = e.highestContrasts[g] : (e.luminosity(b, f) < e.luminosity(d, f) && (c = d), e.highestContrasts[g] = c);
          return c
      };
      a.common.luminosity = function(f, b) {
          var d = a.common,
              c = d.getColorHexValue(f),
              e = d.getColorHexValue(b),
              c = 0.2126 * Math.pow(d.getRed(c) / 255, 2.2) + 0.7152 * Math.pow(d.getRed(c) / 255, 2.2) + 0.0722 * Math.pow(d.getRed(c) /
                  255, 2.2),
              d = 0.2126 * Math.pow(d.getRed(e) / 255, 2.2) + 0.7152 * Math.pow(d.getRed(e) / 255, 2.2) + 0.0722 * Math.pow(d.getRed(e) / 255, 2.2);
          return c > d ? (c + 0.05) / (d + 0.05) : (d + 0.05) / (c + 0.05)
      };
      a.common.compareArrays = function(a, b, d) {
          var c = !0,
              e, g, h, i;
          if (a.length != b.length) c = !1;
          else {
              i = {};
              e = 0;
              for (g = a.length; e < g; e += 1) h = null != d ? d(a[e]) : a[e], i[h] = i.hasOwnProperty(h) ? i[h] + 1 : 1;
              e = 0;
              for (g = b.length; e < g; e += 1)
                  if (h = null != d ? d(b[e]) : b[e], i.hasOwnProperty(h)) {
                      if (i[h] -= 1, 0 > i[h]) {
                          c = !1;
                          break
                      }
                  } else {
                      c = !1;
                      break
                  }
          }
          return c
      };
      a.common.JsonML = {};
      if ("undefined" !==
          typeof document) {
          var M = a.common.JsonML,
              L = document,
              Y = function(a) {
                  this.value = a
              },
              Z = function(a) {
                  return "function" === typeof a
              },
              R = function(a) {
                  switch (typeof a) {
                      case "object":
                          return !a ? 0 : W(a) ? 2 : $(a) ? 5 : a instanceof Date ? 4 : 3;
                      case "function":
                          return 1;
                      case "undefined":
                          return 0;
                      default:
                          return 4
                  }
              },
              la = {
                  accesskey: "accessKey",
                  bgcolor: "bgColor",
                  cellpadding: "cellPadding",
                  cellspacing: "cellSpacing",
                  checked: "defaultChecked",
                  "class": "className",
                  colspan: "colSpan",
                  contenteditable: "contentEditable",
                  defaultchecked: "defaultChecked",
                  "for": "htmlFor",
                  formnovalidate: "formNoValidate",
                  hidefocus: "hideFocus",
                  ismap: "isMap",
                  maxlength: "maxLength",
                  novalidate: "noValidate",
                  readonly: "readOnly",
                  rowspan: "rowSpan",
                  spellcheck: "spellCheck",
                  tabindex: "tabIndex",
                  usemap: "useMap",
                  willvalidate: "willValidate"
              },
              S = {
                  enctype: "encoding",
                  onscroll: "DOMMouseScroll"
              },
              ma = {
                  autocapitalize: 1,
                  autocomplete: 1,
                  autocorrect: 1
              },
              na = {
                  async: 1,
                  autofocus: 1,
                  checked: 1,
                  defaultchecked: 1,
                  defer: 1,
                  disabled: 1,
                  formnovalidate: 1,
                  hidden: 1,
                  indeterminate: 1,
                  ismap: 1,
                  multiple: 1,
                  novalidate: 1,
                  readonly: 1,
                  required: 1,
                  spellcheck: 1,
                  willvalidate: 1
              },
              oa = /^[\r\n]+/,
              pa = /[\r\n]+$/;
          Y.prototype.toString = function() {
              return this.value
          };
          M.raw = function(a) {
              return new Y(a)
          };
          var $ = M.isRaw = function(a) {
                  return a instanceof Y
              },
              W = Array.isArray || function(a) {
                  return a instanceof Array
              },
              O = function(a) {
                  if (a) {
                      if ("!" === a.charAt(0)) return L.createComment("!" === a ? "" : a.substr(1) + " ")
                  } else {
                      if (L.createDocumentFragment) return L.createDocumentFragment();
                      a = ""
                  }
                  return "style" === a.toLowerCase() && L.createStyleSheet ? L.createStyleSheet() :
                      L.createElement(a)
              },
              ea = function(a, b, d) {
                  "on" === b.substr(0, 2) && (b = b.substr(2));
                  switch (typeof d) {
                      case "function":
                          if (a.addEventListener) a.addEventListener(b, d, !1);
                          else if (a.attachEvent && 0 !== R(a[b])) a.attachEvent("on" + b, d);
                          else {
                              var c = a["on" + b] || a[b];
                              a["on" + b] = a[b] = !Z(c) ? d : function(a) {
                                  return !1 !== c.call(this, a) && !1 !== d.call(this, a)
                              }
                          }
                          break;
                      case "string":
                          a["on" + b] = new Function("event", d)
                  }
              },
              qa = M.applyStyles = function(a, b) {
                  for (var d in b) b.hasOwnProperty(d) && (a.style[d] = b[d]);
                  return a
              },
              X = M.appendDOM = function(a,
                  b) {
                  if (b) {
                      var d = (a.tagName || "").toLowerCase();
                      if (8 === a.nodeType) 3 === b.nodeType && (a.nodeValue += b.nodeValue);
                      else if ("table" === d && a.tBodies)
                          if (b.tagName)
                              if ((d = b.tagName.toLowerCase()) && "tbody" !== d && "thead" !== d) {
                                  var c = 0 < a.tBodies.length ? a.tBodies[a.tBodies.length - 1] : null;
                                  c || (c = O("th" === d ? "thead" : "tbody"), a.appendChild(c));
                                  c.appendChild(b)
                              } else !1 !== a.canHaveChildren && a.appendChild(b);
                      else {
                          if (11 === b.nodeType)
                              for (; b.firstChild;) X(a, b.removeChild(b.firstChild))
                      } else if ("style" === d && L.createStyleSheet) a.cssText =
                          b;
                      else if (!1 !== a.canHaveChildren) a.appendChild(b);
                      else if ("object" === d && b.tagName && "param" === b.tagName.toLowerCase()) {
                          try {
                              a.appendChild(b)
                          } catch (e) {}
                          try {
                              a.object && (a.object[b.name] = b.value)
                          } catch (g) {}
                      }
                  }
              },
              fa = function(a) {
                  return !!a && 3 === a.nodeType && (!a.nodeValue || !/\S/.exec(a.nodeValue))
              },
              ga = function(a, b) {
                  a && (3 === a.nodeType && b.exec(a.nodeValue)) && (a.nodeValue = a.nodeValue.replace(b, ""))
              },
              aa = function(a) {
                  if (a) {
                      for (; fa(a.firstChild);) a.removeChild(a.firstChild);
                      for (ga(a.firstChild, oa); fa(a.lastChild);) a.removeChild(a.lastChild);
                      ga(a.lastChild, pa)
                  }
              },
              ha = function(a) {
                  var b = O("div");
                  b.innerHTML = "" + a;
                  aa(b);
                  if (1 === b.childNodes.length) return b.firstChild;
                  for (a = O(""); b.firstChild;) a.appendChild(b.firstChild);
                  return a
              },
              ra = function(a) {
                  return L.createTextNode("[" + a + "]")
              };
          M.onerror = null;
          var ia = M.patch = function(a, b, d) {
                  for (var c = 1; c < b.length; c += 1)
                      if (W(b[c]) || "string" === typeof b[c]) X(a, ba(b[c], d));
                      else if ($(b[c])) X(a, ha(b[c].value));
                  else if ("object" === typeof b[c] && null !== b[c] && 1 === a.nodeType) {
                      var e = b[c];
                      if (e.name && L.attachEvent && !a.parentNode) try {
                          var g =
                              O("<" + a.tagName + ' name="' + e.name + '">');
                          a.tagName === g.tagName && (a = g)
                      } catch (h) {}
                      var i = void 0;
                      for (i in e)
                          if (e.hasOwnProperty(i)) {
                              var j = e[i],
                                  k = R(j);
                              if (i)
                                  if (0 === k && (j = "", k = 4), i = la[i.toLowerCase()] || i, "$" === i) j(a);
                                  else if ("className" == i)
                                  if (W(j))
                                      for (k = 0; k < j.length; k += 1) a.className += " " + j[k];
                                  else a.className += " " + j;
                              else "style" === i ? 0 !== R(a.style.cssText) ? "string" == typeof j ? a.style.cssText = j : qa(a, j) : a.style = j : "on" === i.substr(0, 2) ? (ea(a, i, j), (i = S[i]) && ea(a, i, j)) : !ma[i.toLowerCase()] && (4 !== k || "$" === i.charAt(0) ||
                                  0 !== R(a[i]) || 0 !== R(a[S[i]])) ? (a[i] = j, (i = S[i]) && (a[i] = j)) : na[i.toLowerCase()] ? j && (a.setAttribute(i, i), (i = S[i]) && a.setAttribute(i, i)) : (a.setAttribute(i, j), (i = S[i]) && a.setAttribute(i, j))
                          }
                  }
                  return a
              },
              ba = M.toHTML = function(a, b) {
                  try {
                      if (!a) return null;
                      if ("string" === typeof a) return L.createTextNode(a);
                      if ($(a)) return ha(a.value);
                      if (!W(a) || "string" !== typeof a[0]) throw new SyntaxError("invalid JsonML");
                      var d = a[0];
                      if (!d) {
                          for (var c = O(""), d = 1; d < a.length; d += 1) X(c, ba(a[d], b));
                          aa(c);
                          return 1 === c.childNodes.length ? c.firstChild :
                              c
                      }
                      if ("style" === d.toLowerCase() && L.createStyleSheet) return ia(L.createStyleSheet(), a, b), null;
                      var e = ia(O(d), a, b);
                      aa(e);
                      return e && Z(b) ? b(e) : e
                  } catch (g) {
                      try {
                          return (Z(M.onerror) ? M.onerror : ra)(g, a, b)
                      } catch (h) {
                          return L.createTextNode("[" + h + "]")
                      }
                  }
              };
          M.toHTMLText = function(a, b) {
              var d = ba(a, b);
              if (d.outerHTML) return d.outerHTML;
              var c = O("div");
              c.appendChild(d);
              var e = c.innerHTML;
              c.removeChild(d);
              return e
          }
      }
      a.common.AdviserPlacementType = {
          Auto: 0,
          Left: 2,
          Right: 3
      };
      a.orgdiagram.AdviserPlacementType = a.common.AdviserPlacementType;
      a.common.AnnotationType = {
          Connector: 0,
          Shape: 1,
          HighlightPath: 2,
          Label: 3,
          Background: 4
      };
      a.common.ChildrenPlacementType = {
          Auto: 0,
          Vertical: 1,
          Horizontal: 2,
          Matrix: 3
      };
      a.orgdiagram.ChildrenPlacementType = a.common.ChildrenPlacementType;
      a.common.Colors = {
          AliceBlue: "#f0f8ff",
          AntiqueWhite: "#faebd7",
          Aqua: "#00ffff",
          Aquamarine: "#7fffd4",
          Azure: "#f0ffff",
          Beige: "#f5f5dc",
          Bisque: "#ffe4c4",
          Black: "#000000",
          BlanchedAlmond: "#ffebcd",
          Blue: "#0000ff",
          BlueViolet: "#8a2be2",
          Brown: "#a52a2a",
          BurlyWood: "#deb887",
          Bronze: "#cd7f32",
          CadetBlue: "#5f9ea0",
          ChartReuse: "#7fff00",
          Chocolate: "#d2691e",
          Coral: "#ff7f50",
          CornflowerBlue: "#6495ed",
          Cornsilk: "#fff8dc",
          Crimson: "#dc143c",
          Cyan: "#00ffff",
          DarkBlue: "#00008b",
          DarkCyan: "#008b8b",
          DarkGoldenrod: "#b8860b",
          DarkGray: "#a9a9a9",
          DarkGreen: "#006400",
          DarkKhaki: "#bdb76b",
          DarkMagenta: "#8b008b",
          DarkOliveGreen: "#556b2f",
          Darkorange: "#ff8c00",
          DarkOrchid: "#9932cc",
          DarkRed: "#8b0000",
          DarkSalmon: "#e9967a",
          DarkSeaGreen: "#8fbc8f",
          DarkSlateBlue: "#483d8b",
          DarkSlateGray: "#2f4f4f",
          DarkTurquoise: "#00ced1",
          DarkViolet: "#9400d3",
          DeepPink: "#ff1493",
          DeepSkyBlue: "#00bfff",
          DimGray: "#696969",
          DodgerBlue: "#1e90ff",
          FireBrick: "#b22222",
          FloralWhite: "#fffaf0",
          ForestGreen: "#228b22",
          Fuchsia: "#ff00ff",
          Gainsboro: "#dcdcdc",
          GhostWhite: "#f8f8ff",
          Gold: "#ffd700",
          Goldenrod: "#daa520",
          Gray: "#808080",
          Green: "#008000",
          GreenYellow: "#adff2f",
          Honeydew: "#f0fff0",
          Hotpink: "#ff69b4",
          IndianRed: "#cd5c5c",
          Indigo: "#4b0082",
          Ivory: "#fffff0",
          Khaki: "#f0e68c",
          Lavender: "#e6e6fa",
          LavenderBlush: "#fff0f5",
          Lawngreen: "#7cfc00",
          Lemonchiffon: "#fffacd",
          LightBlue: "#add8e6",
          LightCoral: "#f08080",
          LightCyan: "#e0ffff",
          LightGoldenrodYellow: "#fafad2",
          LightGray: "#d3d3d3",
          LightGreen: "#90ee90",
          LightPink: "#ffb6c1",
          LightSalmon: "#ffa07a",
          LightSeaGreen: "#20b2aa",
          LightSkyBlue: "#87cefa",
          LightSlateGray: "#778899",
          LightSteelBlue: "#b0c4de",
          LightYellow: "#ffffe0",
          Lime: "#00ff00",
          Limegreen: "#32cd32",
          Linen: "#faf0e6",
          Magenta: "#ff00ff",
          Maroon: "#800000",
          MediumAquamarine: "#66cdaa",
          MediumBlue: "#0000cd",
          MediumOrchid: "#ba55d3",
          MediumPurple: "#9370d8",
          MediumSeaGreen: "#3cb371",
          MediumSlateBlue: "#7b68ee",
          MediumSpringGreen: "#00fa9a",
          MediumTurquoise: "#48d1cc",
          MediumVioletRed: "#c71585",
          MidnightBlue: "#191970",
          MintCream: "#f5fffa",
          MistyRose: "#ffe4e1",
          Moccasin: "#ffe4b5",
          NavajoWhite: "#ffdead",
          Navy: "#000080",
          Oldlace: "#fdf5e6",
          Olive: "#808000",
          Olivedrab: "#6b8e23",
          Orange: "#ffa500",
          OrangeRed: "#ff4500",
          Orchid: "#da70d6",
          PaleGoldenRod: "#eee8aa",
          PaleGreen: "#98fb98",
          PaleTurquoise: "#afeeee",
          PaleVioletRed: "#d87093",
          Papayawhip: "#ffefd5",
          Peachpuff: "#ffdab9",
          Peru: "#cd853f",
          Pink: "#ffc0cb",
          Plum: "#dda0dd",
          PowderBlue: "#b0e0e6",
          Purple: "#800080",
          Red: "#ff0000",
          RosyBrown: "#bc8f8f",
          RoyalBlue: "#4169e1",
          SaddleBrown: "#8b4513",
          Salmon: "#fa8072",
          SandyBrown: "#f4a460",
          SeaGreen: "#2e8b57",
          Seashell: "#fff5ee",
          Sienna: "#a0522d",
          Silver: "#c0c0c0",
          SkyBlue: "#87ceeb",
          SlateBlue: "#6a5acd",
          SlateGray: "#708090",
          Snow: "#fffafa",
          SpringGreen: "#00ff7f",
          SteelBlue: "#4682b4",
          Tan: "#d2b48c",
          Teal: "#008080",
          Thistle: "#d8bfd8",
          Tomato: "#ff6347",
          Turquoise: "#40e0d0",
          Violet: "#ee82ee",
          Wheat: "#f5deb3",
          White: "#ffffff",
          WhiteSmoke: "#f5f5f5",
          Yellow: "#ffff00",
          YellowGreen: "#9acd32"
      };
      a.common.ConnectorLabelPlacementType = {
          From: 0,
          Between: 1,
          To: 2
      };
      a.common.ConnectorPlacementType = {
          Offbeat: 0,
          Straight: 1
      };
      a.common.ConnectorShapeType = {
          OneWay: 0,
          TwoWay: 1,
          BothWay: 2
      };
      a.common.ConnectorStyleType = {
          Extra: 0,
          Regular: 1,
          Highlight: 2
      };
      a.common.ConnectorType = {
          Squared: 0,
          Angular: 1,
          Curved: 2
      };
      a.orgdiagram.ConnectorType = a.common.ConnectorType;
      a.common.ElbowType = {
          None: 0,
          Dot: 1,
          Bevel: 2,
          Round: 3
      };
      a.common.Enabled = {
          Auto: 0,
          True: 1,
          False: 2
      };
      a.common.GraphicsType = {
          SVG: 0,
          Canvas: 1
      };
      a.common.GroupByType = {
          None: 0,
          Parents: 1,
          Children: 2
      };
      a.common.HorizontalAlignmentType = {
          Center: 0,
          Left: 1,
          Right: 2
      };
      a.orgdiagram.ItemType = {
          Regular: 0,
          Assistant: 1,
          SubAssistant: 4,
          SuperAssistant: 10,
          SuperAdviser: 9,
          SubAdviser: 5,
          Adviser: 2,
          Director: 11,
          GeneralPartner: 6,
          LimitedPartner: 7,
          AdviserPartner: 8
      };
      a.common.LabelType = {
          Regular: 0,
          Dummy: 1,
          Fixed: 2,
          None: 3
      };
      a.common.Layers = {
          BackgroundAnnotation: 2,
          BackgroundAnnotations: 3,
          BackgroundConnectorAnnotation: 4,
          BackgroundHighlightPathAnnotations: 5,
          Connector: 6,
          ForegroundHighlightPathAnnotations: 7,
          Highlight: 8,
          Marker: 9,
          Label: 10,
          Cursor: 11,
          Item: 12,
          ForegroundAnnotations: 13,
          ForegroundConnectorAnnotation: 14,
          Annotation: 15,
          Controls: 16
      };
      a.common.LineType = {
          Solid: 0,
          Dotted: 1,
          Dashed: 2
      };
      a.common.NavigationMode = {
          Default: 0,
          CursorOnly: 1,
          HighlightOnly: 3,
          Inactive: 2
      };
      a.common.NeighboursSelectionMode = {
          ParentsAndChildren: 0,
          ParentsChildrenSiblingsAndSpouses: 1
      };
      a.common.OrientationType = {
          Top: 0,
          Bottom: 1,
          Left: 2,
          Right: 3,
          None: 4
      };
      a.orgdiagram.OrientationType = a.common.OrientationType;
      a.common.PageFitMode = {
          None: 0,
          PageWidth: 1,
          PageHeight: 2,
          FitToPage: 3,
          AutoSize: 5,
          SelectionOnly: 6
      };
      a.orgdiagram.PageFitMode =
          a.common.PageFitMode;
      a.common.PlacementType = {
          Auto: 0,
          TopLeft: 8,
          Top: 1,
          TopRight: 2,
          RightTop: 11,
          Right: 3,
          RightBottom: 12,
          BottomRight: 4,
          Bottom: 5,
          BottomLeft: 6,
          LeftBottom: 10,
          Left: 7,
          LeftTop: 9
      };
      a.common.RenderingMode = {
          Create: 0,
          Update: 1
      };
      a.common.SegmentType = {
          Line: 0,
          Move: 1,
          QuadraticArc: 2,
          CubicArc: 3,
          Dot: 4
      };
      a.common.SelectionPathMode = {
          None: 0,
          FullStack: 1
      };
      a.orgdiagram.SelectionPathMode = a.common.SelectionPathMode;
      a.common.ShapeType = {
          Rectangle: 0,
          Oval: 1,
          Triangle: 2,
          CrossOut: 3,
          Circle: 4,
          Rhombus: 5,
          Wedge: 7,
          FramedOval: 8,
          FramedTriangle: 9,
          FramedWedge: 10,
          FramedRhombus: 11,
          None: 6
      };
      a.common.SideFlag = {
          Top: 1,
          Right: 2,
          Bottom: 4,
          Left: 8
      };
      a.text.TextOrientationType = {
          Horizontal: 0,
          RotateLeft: 1,
          RotateRight: 2,
          Auto: 3
      };
      a.common.UpdateMode = {
          Recreate: 0,
          Refresh: 1,
          PositonHighlight: 2
      };
      a.orgdiagram.UpdateMode = a.common.UpdateMode;
      a.common.VectorRelationType = {
          None: 0,
          Null: 1,
          Collinear: 2,
          Opposite: 3
      };
      a.common.VerticalAlignmentType = {
          Top: 0,
          Middle: 1,
          Bottom: 2
      };
      a.common.Visibility = {
          Auto: 0,
          Normal: 1,
          Dot: 2,
          Line: 3,
          Invisible: 4
      };
      a.common.ZOrderType = {
          Auto: 0,
          Background: 1,
          Foreground: 2
      };
      a.common.RenderEventArgs = function() {
          this.renderingMode = this.templateName = this.context = this.element = this.id = null;
          this.isSelected = this.isCursor = !1
      };
      a.common.BaseShape = function() {};
      a.common.BaseShape.prototype._getLabelPosition = function(f, b, d, c, e, g, h, i) {
          var j = null;
          switch (i) {
              case 1:
                  j = new a.common.Rect(f + d / 2 - e / 2, b - h - g, e, g);
                  break;
              case 2:
                  j = new a.common.Rect(f + d - e, b - h - g, e, g);
                  break;
              case 8:
                  j = new a.common.Rect(f, b - h - g, e, g);
                  break;
              case 3:
                  j = new a.common.Rect(f + d + h, b + c / 2 - g / 2, e, g);
                  break;
              case 11:
                  j = new a.common.Rect(f + d + h, b, e, g);
                  break;
              case 12:
                  j = new a.common.Rect(f + d + h, b + c - g, e, g);
                  break;
              case 4:
                  j = new a.common.Rect(f + d - e, b + c + h, e, g);
                  break;
              case 6:
                  j = new a.common.Rect(f, b + c + h, e, g);
                  break;
              case 7:
                  j = new a.common.Rect(f - e - h, b + c / 2 - g / 2, e, g);
                  break;
              case 9:
                  j = new a.common.Rect(f - e - h, b, e, g);
                  break;
              case 10:
                  j = new a.common.Rect(f - e - h, b + c - g, e, g);
                  break;
              default:
                  j = new a.common.Rect(f + d / 2 - e / 2, b + c + h, e, g)
          }
          return j
      };
      a.common.BaseShape.prototype._betweenPoint = function(f, b) {
          return new a.common.Point((f.x + b.x) / 2, (f.y +
              b.y) / 2)
      };
      a.common.BaseShape.prototype._offsetPoint = function(f, b, d) {
          var c = null,
              c = f.distanceTo(b);
          return c = 0 === c || 0 === d ? new a.common.Point(f) : new a.common.Point(f.x + (b.x - f.x) / c * d, f.y + (b.y - f.y) / c * d)
      };
      a.common.Callout = function(a) {
          this.m_graphics = a;
          this.pointerPlacement = 0;
          this.cornerRadius = "10%";
          this.offset = 0;
          this.lineWidth = this.opacity = 1;
          this.pointerWidth = "10%";
          this.borderColor = "#000000";
          this.lineType = 0;
          this.fillColor = "#d3d3d3";
          this.m_map = [
              [8, 7, 6],
              [1, null, 5],
              [2, 3, 4]
          ]
      };
      a.common.Callout.prototype = new a.common.BaseShape;
      a.common.Callout.prototype.draw = function(f, b) {
          var b = (new a.common.Rect(b)).offset(this.offset),
              d = new a.common.Point(b.x, b.y),
              c = new a.common.Point(b.right(), b.y),
              e = new a.common.Point(b.right(), b.bottom()),
              g = new a.common.Point(b.left(), b.bottom()),
              h = [null, null, null, null, null, null, null, null],
              g = [d, c, e, g],
              c = this.m_graphics.getPxSize(this.cornerRadius, Math.min(d.distanceTo(c), c.distanceTo(e))),
              i, j;
          i = {};
          null !== this.fillColor && (i.fillColor = this.fillColor, i.opacity = this.opacity);
          null !== this.lineColor && (i.lineColor =
              this.borderColor);
          i.lineWidth = this.lineWidth;
          i.lineType = this.lineType;
          j = new a.common.PaletteItem(i);
          i = new a.common.PolylinesBuffer;
          j = i.getPolyline(j);
          null !== f && (d = 0 === this.pointerPlacement ? this._getPlacement(f, d, e) : this.pointerPlacement, null !== d && (h[d] = f));
          for (e = 0; e < g.length; e += 1) this._drawSegment(j, g[0], g[1], g[2], this.pointerWidth, c, h[1], h[2]), d = g.shift(), g.push(d), d = h.shift(), h.push(d), d = h.shift(), h.push(d);
          this.m_graphics.polylinesBuffer(i)
      };
      a.common.Callout.prototype._getPlacement = function(a,
          b, d) {
          var c = null,
              e = null,
              c = a.x < b.x ? 0 : a.x > d.x ? 2 : 1,
              e = a.y < b.y ? 0 : a.y > d.y ? 2 : 1;
          return this.m_map[c][e]
      };
      a.common.Callout.prototype._drawSegment = function(f, b, d, c, e, g, h, i) {
          var j = this._offsetPoint(b, d, g),
              k = this._offsetPoint(d, b, g),
              c = this._offsetPoint(d, c, g),
              e = this.m_graphics.getPxSize(e, b.distanceTo(d) / 2);
          0 === f.length() && f.addSegment(new a.common.MoveSegment(j));
          null !== h && (j = this._betweenPoint(b, d), b = this._offsetPoint(j, b, e), e = this._offsetPoint(j, d, e), f.addSegment(new a.common.LineSegment(b)), f.addSegment(new a.common.LineSegment(h)),
              f.addSegment(new a.common.LineSegment(e)));
          f.addSegment(new a.common.LineSegment(k));
          null !== i ? (f.addSegment(new a.common.LineSegment(i)), f.addSegment(new a.common.LineSegment(c))) : f.addSegment(new a.common.QuadraticArcSegment(d, c))
      };
      a.common.ConnectorOffbeat = function() {};
      a.common.ConnectorOffbeat.prototype = new a.common.BaseShape;
      a.common.ConnectorOffbeat.prototype.draw = function(f, b, d, c, e, g, h, i, j, k, l, n, m, p, q) {
          var r, s, t, v, u, z, x, B, m = g = 0,
              y = null,
              w, A;
          w = f.getPolyline(b);
          u = [];
          switch (j) {
              case 1:
                  u = [-e / 2, e / 2];
                  A = !1;
                  break;
              case 0:
                  u = [0];
                  A = !1;
                  break;
              case 2:
                  u = [0], A = !0
          }
          r = Math.max(n ? h.width : 0, 5 * e);
          if (d.right() + r < c.left() || d.left() > c.right() + r)
              if (d.left() > c.right() ? (t = new a.common.Point(d.left(), d.verticalCenter()), v = new a.common.Point(c.right(), c.verticalCenter())) : (t = new a.common.Point(d.right(), d.verticalCenter()), v = new a.common.Point(c.left(), c.verticalCenter())), n && (d.left() > c.right() ? (g = 7, m = 3) : (g = 3, m = 7)), s = new a.common.Rect(t, v), B = t.y <= v.y, x = t.x < v.x, s.height < s.width) {
                  s.height < 2 * e && s.offset(0, B ? 2 * e : 0, 0, B ? 0 :
                      2 * e);
                  i = 0;
                  for (r = u.length; i < r; i += 1) z = u[i], f.addInverted(function(c) {
                      c = c.getPolyline(b);
                      c.addSegment(new a.common.MoveSegment(t.x, t.y + z));
                      c.addSegment(new a.common.QuadraticArcSegment(s.horizontalCenter(), (B ? s.top() : s.bottom()) + z, v.x, v.y + z));
                      A && c.addArrow(b.lineWidth, function(a) {
                          a.mergeTo(f.getPolyline(a.paletteItem))
                      })
                  }, i || 0 == j), w.addArrow(b.lineWidth, function(a) {
                      a.mergeTo(f.getPolyline(a.paletteItem))
                  });
                  n && (j = h.width < 2 * (s.width / 5) ? a.common.QuadraticArcSegment.prototype.offsetPoint(t.x, t.y, s.horizontalCenter(),
                      B ? s.top() : s.bottom(), v.x, v.y, 0.5) : new a.common.Point(t.x, B ? s.top() : s.bottom()), y = new a.common.Rect(j.x + (x ? e : -h.width - e), B ? j.y - h.height - e : j.y + e, h.width, h.height))
              } else {
                  i = 0;
                  for (r = u.length; i < r; i += 1) z = u[i], f.addInverted(function(c) {
                      c = c.getPolyline(b);
                      c.addSegment(new a.common.MoveSegment(t.x, t.y + z));
                      c.addSegment(new a.common.QuadraticArcSegment(s.horizontalCenter() + z * (B != x ? 1 : -1), (B ? s.top() : s.bottom()) + z, s.horizontalCenter() + z * (B != x ? 1 : -1), s.verticalCenter() + z));
                      c.addSegment(new a.common.QuadraticArcSegment(s.horizontalCenter() +
                          z * (B != x ? 1 : -1), (B ? s.bottom() : s.top()) + z, v.x, v.y + z));
                      A && c.addArrow(b.lineWidth, function(a) {
                          a.mergeTo(f.getPolyline(a.paletteItem))
                      })
                  }, i || 0 == j), w.addArrow(b.lineWidth, function(a) {
                      a.mergeTo(f.getPolyline(a.paletteItem))
                  });
                  n && (y = new a.common.Rect(s.horizontalCenter() + (B != x ? e : -(e + h.width)), s.verticalCenter() - h.height / 2, h.width, h.height))
              }
          else if (d.verticalCenter() < c.top() || d.verticalCenter() > c.bottom()) {
              x = d.x < i.width / 2;
              t = new a.common.Point(x ? d.right() : d.left(), d.verticalCenter());
              v = new a.common.Point(x ?
                  c.right() : c.left(), c.verticalCenter());
              s = new a.common.Rect(t, v);
              s.offset(10 * e, 0, 10 * e, 0);
              B = t.y <= v.y;
              i = 0;
              for (r = u.length; i < r; i += 1) z = u[i], f.addInverted(function(d) {
                  d = d.getPolyline(b);
                  d.addSegment(new a.common.MoveSegment(t.x, t.y + z));
                  d.addSegment(new a.common.QuadraticArcSegment(x ? s.right() + z * (B ? -1 : 1) : s.left() - z * (B ? -1 : 1), s.verticalCenter(), x ? c.right() : c.left(), c.verticalCenter() - z));
                  A && d.addArrow(b.lineWidth, function(a) {
                      a.mergeTo(f.getPolyline(a.paletteItem))
                  })
              }, i || 0 == j), w.addArrow(b.lineWidth, function(a) {
                  a.mergeTo(f.getPolyline(a.paletteItem))
              });
              n && (m = g = x ? 3 : 7, j = a.common.QuadraticArcSegment.prototype.offsetPoint(t.x, t.y, x ? s.right() : s.left(), s.verticalCenter(), v.x, v.y, 0.5), y = new a.common.Rect(j.x + (x ? e / 2 : -e / 2 - h.width), j.y - h.height / 2, h.width, h.height))
          } else {
              t = new a.common.Point(d.horizontalCenter(), d.top());
              v = new a.common.Point(c.horizontalCenter(), c.top());
              s = new a.common.Rect(t, v);
              s.offset(0, 7 * e, 0, 0);
              x = t.x < v.x;
              i = 0;
              for (r = u.length; i < r; i += 1) z = u[i], f.addInverted(function(d) {
                  d = d.getPolyline(b);
                  d.addSegment(new a.common.MoveSegment(t.x + z, t.y));
                  d.addSegment(new a.common.QuadraticArcSegment(s.horizontalCenter(),
                      s.top() - z * (x ? -1 : 1), c.horizontalCenter() - z, c.top()));
                  A && d.addArrow(b.lineWidth, function(a) {
                      a.mergeTo(f.getPolyline(a.paletteItem))
                  })
              }, i || 0 == j), w.addArrow(b.lineWidth, function(a) {
                  a.mergeTo(f.getPolyline(a.paletteItem))
              });
              n && (m = g = 1, j = a.common.QuadraticArcSegment.prototype.offsetPoint(t.x, t.y, s.horizontalCenter(), s.top(), v.x, v.y, 0.5), y = new a.common.Rect(j.x - h.width / 2, j.y - (k + h.height), h.width, h.height))
          }
          if (n) switch (l) {
              case 0:
                  y = this._getLabelPosition(d.x, d.y, d.width, d.height, y.width, y.height, k, g);
                  break;
              case 2:
                  y = this._getLabelPosition(c.x, c.y, c.width, c.height, y.width, y.height, k, m)
          }
          null != p && p(y, q)
      };
      a.common.ConnectorStraight = function() {};
      a.common.ConnectorStraight.prototype = new a.common.BaseShape;
      a.common.ConnectorStraight.prototype.draw = function(f, b, d, c, e, g, h, i, j, k, l, n, m, p, q) {
          var r, s, t, v, u, z = e / 2,
              x = null,
              B = 0,
              y = 0,
              w = this;
          v = new a.common.Vector(d.centerPoint(), c.centerPoint());
          d.loopEdges(function(a, b) {
              r = a.getIntersectionPoint(v, !0, 1);
              B = b;
              return null != r
          });
          c.loopEdges(function(a, b) {
              s = a.getIntersectionPoint(v, !0, 1);
              y = b;
              return null != s
          });
          if (null != r && null != s) {
              var A = new a.common.Vector(r, s);
              m.getOffset(A, function(c, d, e) {
                  A.offset((c * g - (d - 1) * g / 2) * e);
                  r = A.from;
                  s = A.to;
                  switch (j) {
                      case 1:
                          u = new a.common.Vector(s.clone(), r.clone());
                          u.offset(z);
                          w._drawLine(f, b, u.from, u.to, !1);
                          u = new a.common.Vector(r.clone(), s.clone());
                          u.offset(z);
                          w._drawLine(f, b, u.from, u.to, !1);
                          break;
                      case 0:
                          w._drawLine(f, b, r, s, !1);
                          break;
                      case 2:
                          w._drawLine(f, b, r, s, !0)
                  }
                  if (n) {
                      switch (l) {
                          case 0:
                              x = w._getLabelPositionBySnapPoint(r.x, r.y, h.width, h.height, k,
                                  B);
                              break;
                          case 1:
                              t = w._betweenPoint(r, s);
                              x = w._getLabelPositionBySnapPoint(t.x, t.y, h.width, h.height, k, 3);
                              break;
                          case 2:
                              x = w._getLabelPositionBySnapPoint(s.x, s.y, h.width, h.height, k, y)
                      }
                      null != p && p.call(this, x, q)
                  }
              })
          }
      };
      a.common.ConnectorStraight.prototype._drawLine = function(f, b, d, c, e) {
          var g;
          f.addInverted(function(e) {
              g = e.getPolyline(b);
              g.addSegment(new a.common.MoveSegment(d));
              g.addSegment(new a.common.LineSegment(c));
              g.addArrow(b.lineWidth, function(a) {
                  a.mergeTo(f.getPolyline(a.paletteItem))
              })
          }, !1);
          e && (g = f.getPolyline(b),
              g.addArrow(b.lineWidth, function(a) {
                  a.mergeTo(f.getPolyline(a.paletteItem))
              }))
      };
      a.common.ConnectorStraight.prototype._getLabelPositionBySnapPoint = function(f, b, d, c, e, g) {
          var h = null;
          switch (g) {
              case 0:
              case 1:
                  h = new a.common.Rect(f - d / 2, b - e - c, d, c);
                  break;
              case 3:
                  h = new a.common.Rect(f + e, b - c / 2, d, c);
                  break;
              case 5:
                  h = new a.common.Rect(f - d / 2, b + e, d, c);
                  break;
              case 7:
                  h = new a.common.Rect(f - d - e, b - c / 2, d, c)
          }
          return h
      };
      a.common.Marker = function() {};
      a.common.Marker.Markers = {};
      a.common.Marker.DrawCircle = function(f, b) {
          var d = Math.min(b.width /
                  2, b.height / 2),
              b = new a.common.Rect(b.horizontalCenter() - d, b.verticalCenter() - d, 2 * d, 2 * d);
          a.common.Marker.DrawOval(f, b)
      };
      a.common.Marker.DrawRectangle = function(f, b) {
          f.addSegment(new a.common.MoveSegment(b.x, b.verticalCenter()));
          f.addSegment(new a.common.LineSegment(b.x, b.y));
          f.addSegment(new a.common.LineSegment(b.right(), b.y));
          f.addSegment(new a.common.LineSegment(b.right(), b.bottom()));
          f.addSegment(new a.common.LineSegment(b.x, b.bottom()));
          f.addSegment(new a.common.LineSegment(b.x, b.verticalCenter()))
      };
      a.common.Marker.DrawOval = function(f, b) {
          var d, c;
          d = 0.5522848 * (b.width / 2);
          c = 0.5522848 * (b.height / 2);
          f.addSegment(new a.common.MoveSegment(b.x, b.verticalCenter()));
          f.addSegment(new a.common.CubicArcSegment(b.x, b.verticalCenter() - c, b.horizontalCenter() - d, b.y, b.horizontalCenter(), b.y));
          f.addSegment(new a.common.CubicArcSegment(b.horizontalCenter() + d, b.y, b.right(), b.verticalCenter() - c, b.right(), b.verticalCenter()));
          f.addSegment(new a.common.CubicArcSegment(b.right(), b.verticalCenter() + c, b.horizontalCenter() +
              d, b.bottom(), b.horizontalCenter(), b.bottom()));
          f.addSegment(new a.common.CubicArcSegment(b.horizontalCenter() - d, b.bottom(), b.x, b.verticalCenter() + c, b.x, b.verticalCenter()))
      };
      a.common.Marker.DrawTriangle = function(f, b) {
          f.addSegment(new a.common.MoveSegment(b.left(), b.bottom()));
          f.addSegment(new a.common.LineSegment(b.horizontalCenter(), b.y));
          f.addSegment(new a.common.LineSegment(b.right(), b.bottom()));
          f.addSegment(new a.common.LineSegment(b.left(), b.bottom()))
      };
      a.common.Marker.DrawCrossOut = function(f,
          b) {
          f.addSegment(new a.common.MoveSegment(b.horizontalCenter(), b.verticalCenter()));
          f.addSegment(new a.common.LineSegment(b.x, b.y));
          f.addSegment(new a.common.MoveSegment(b.horizontalCenter(), b.verticalCenter()));
          f.addSegment(new a.common.LineSegment(b.right(), b.bottom()));
          f.addSegment(new a.common.MoveSegment(b.horizontalCenter(), b.verticalCenter()));
          f.addSegment(new a.common.LineSegment(b.right(), b.y));
          f.addSegment(new a.common.MoveSegment(b.horizontalCenter(), b.verticalCenter()));
          f.addSegment(new a.common.LineSegment(b.left(),
              b.bottom()))
      };
      a.common.Marker.DrawRhombus = function(f, b) {
          f.addSegment(new a.common.MoveSegment(b.horizontalCenter(), b.bottom()));
          f.addSegment(new a.common.LineSegment(b.left(), b.verticalCenter()));
          f.addSegment(new a.common.LineSegment(b.horizontalCenter(), b.y));
          f.addSegment(new a.common.LineSegment(b.right(), b.verticalCenter()));
          f.addSegment(new a.common.LineSegment(b.horizontalCenter(), b.bottom()))
      };
      a.common.Marker.DrawWedge = function(f, b) {
          f.addSegment(new a.common.MoveSegment(b.horizontalCenter(),
              b.y));
          f.addSegment(new a.common.LineSegment(b.right(), b.y));
          f.addSegment(new a.common.LineSegment(b.horizontalCenter(), b.bottom()));
          f.addSegment(new a.common.LineSegment(b.left(), b.y));
          f.addSegment(new a.common.LineSegment(b.horizontalCenter(), b.y))
      };
      a.common.Marker.DrawFramedOval = function(f, b) {
          a.common.Marker.DrawRectangle(f, b);
          a.common.Marker.DrawOval(f, b)
      };
      a.common.Marker.DrawFramedTriangle = function(f, b) {
          a.common.Marker.DrawRectangle(f, b);
          a.common.Marker.DrawTriangle(f, b)
      };
      a.common.Marker.DrawFramedWedge =
          function(f, b) {
              a.common.Marker.DrawRectangle(f, b);
              a.common.Marker.DrawWedge(f, b)
          };
      a.common.Marker.DrawFramedRhombus = function(f, b) {
          a.common.Marker.DrawRectangle(f, b);
          a.common.Marker.DrawRhombus(f, b)
      };
      a.common.Marker.DrawNone = function() {};
      a.common.Marker.Markers[4] = a.common.Marker.DrawCircle;
      a.common.Marker.Markers[0] = a.common.Marker.DrawRectangle;
      a.common.Marker.Markers[1] = a.common.Marker.DrawOval;
      a.common.Marker.Markers[2] = a.common.Marker.DrawTriangle;
      a.common.Marker.Markers[3] = a.common.Marker.DrawCrossOut;
      a.common.Marker.Markers[5] = a.common.Marker.DrawRhombus;
      a.common.Marker.Markers[7] = a.common.Marker.DrawWedge;
      a.common.Marker.Markers[8] = a.common.Marker.DrawFramedOval;
      a.common.Marker.Markers[9] = a.common.Marker.DrawFramedTriangle;
      a.common.Marker.Markers[10] = a.common.Marker.DrawFramedWedge;
      a.common.Marker.Markers[11] = a.common.Marker.DrawFramedRhombus;
      a.common.Marker.Markers[6] = a.common.Marker.DrawNone;
      a.common.Marker.prototype.draw = function(f, b, d, c) {
          f = f.getPolyline(c);
          a.common.Marker.Markers[b](f, d)
      };
      a.common.MergedRectangles = function(a) {
          this.graphics = a;
          this.transform = null;
          this.opacity = this.lineWidth = 1;
          this.fillColor = null;
          this.lineType = 0;
          this.borderColor = null
      };
      a.common.MergedRectangles.prototype = new a.common.BaseShape;
      a.common.MergedRectangles.prototype.draw = function(f) {
          var b = new a.common.PaletteItem({
                  lineColor: this.borderColor,
                  lineWidth: this.lineWidth,
                  fillColor: this.fillColor,
                  lineType: this.lineType,
                  opacity: this.opacity
              }),
              d = new a.common.Polyline(b);
          a.common.getMergedRectangles(this, f, function(b) {
              for (var f =
                      0, g = b.length; f < g; f += 1) {
                  var h = b[f];
                  0 == f ? d.addSegment(new a.common.MoveSegment(h.x, h.y)) : d.addSegment(new a.common.LineSegment(h.x, h.y))
              }
          });
          d.transform(this.transform, !0);
          this.graphics.polyline(d)
      };
      a.common.Shape = function(f) {
          this.m_graphics = f;
          this.transform = null;
          this.orientationType = 0;
          this.panelSize = null;
          this.shapeType = 0;
          this.offset = new a.common.Thickness(0, 0, 0, 0);
          this.lineWidth = 1;
          this.labelOffset = 4;
          this.cornerRadius = "10%";
          this.opacity = 1;
          this.fillColor = null;
          this.labelSize = new a.common.Size(60, 30);
          this.lineType =
              0;
          this.borderColor = null;
          this.hasLabel = !1;
          this.labelTemplate = null;
          this.labelPlacement = 0
      };
      a.common.Shape.prototype = new a.common.BaseShape;
      a.common.Shape.prototype.draw = function(f, b) {
          var d, c, e, g, f = (new a.common.Rect(f)).offset(this.offset);
          this.transform = new a.common.Transform;
          this.transform.size = this.panelSize;
          this.transform.setOrientation(this.orientationType);
          this.hasLabel && (d = this._getLabelPosition(f.x, f.y, f.width, f.height, this.labelSize.width, this.labelSize.height, this.labelOffset, this.labelPlacement));
          switch (this.shapeType) {
              case 0:
                  c = new a.common.Callout(this.m_graphics);
                  c.cornerRadius = this.cornerRadius;
                  c.opacity = this.opacity;
                  c.lineWidth = this.lineWidth;
                  c.lineType = this.lineType;
                  c.borderColor = this.borderColor;
                  c.fillColor = this.fillColor;
                  c.draw(null, f);
                  break;
              default:
                  c = new a.common.PaletteItem({
                      lineColor: this.borderColor,
                      lineWidth: this.lineWidth,
                      lineType: this.lineType,
                      fillColor: this.fillColor,
                      opacity: this.opacity
                  }), this.transform.transformRect(f.x, f.y, f.width, f.height, !1, this, function(b, c, d, e) {
                      f = new a.common.Rect(b,
                          c, d, e)
                  }), g = new a.common.Marker, e = new a.common.PolylinesBuffer, g.draw(e, this.shapeType, f, c), e.transform(this.transform, !0), this.m_graphics.polylinesBuffer(e)
          }
          this.hasLabel && this.m_graphics.template(d.x, d.y, 0, 0, 0, 0, d.width, d.height, this.labelTemplate.template(), this.labelTemplate.getHashCode(), this.labelTemplate.render, b, null)
      };
      a.common.Point = function(a, b) {
          this.context = this.y = this.x = null;
          switch (arguments.length) {
              case 1:
                  this.x = a.x;
                  this.y = a.y;
                  this.context = a.context;
                  break;
              case 2:
                  this.x = a, this.y = b
          }
      };
      a.common.Point.prototype.scale =
          function(a) {
              this.x *= a;
              this.y *= a;
              return this
          };
      a.common.Point.prototype.distanceTo = function(a, b) {
          var d = 0,
              c = 0;
          switch (arguments.length) {
              case 1:
                  d = a.x;
                  c = a.y;
                  break;
              case 2:
                  d = a, c = b
          }
          d = this.x - d;
          c = this.y - c;
          return Math.sqrt(d * d + c * c)
      };
      a.common.Point.prototype.equalTo = function(a) {
          return this.x == a.x && this.y == a.y
      };
      a.common.Point.prototype.swap = function(a) {
          var b = a.x,
              d = a.y;
          a.x = this.x;
          a.y = this.y;
          this.x = b;
          this.y = d
      };
      a.common.Point.prototype.clone = function() {
          return new a.common.Point(this)
      };
      a.common.Point.prototype.toString =
          function(a) {
              var b, a = void 0 !== a ? a : "px";
              b = "" + ("left:" + this.x + a + ";");
              return b += "top:" + this.y + a + ";"
          };
      a.common.Rect = function(a, b, d, c) {
          this.context = this.height = this.width = this.y = this.x = null;
          switch (arguments.length) {
              case 1:
                  this.x = a.x;
                  this.y = a.y;
                  this.width = a.width;
                  this.height = a.height;
                  break;
              case 2:
                  this.x = Math.min(a.x, b.x);
                  this.y = Math.min(a.y, b.y);
                  this.width = Math.abs(b.x - a.x);
                  this.height = Math.abs(b.y - a.y);
                  break;
              case 4:
                  this.x = a, this.y = b, this.width = d, this.height = c
          }
      };
      a.common.Rect.prototype.left = function() {
          return this.x
      };
      a.common.Rect.prototype.top = function() {
          return this.y
      };
      a.common.Rect.prototype.right = function() {
          return this.x + this.width
      };
      a.common.Rect.prototype.bottom = function() {
          return this.y + this.height
      };
      a.common.Rect.prototype.verticalCenter = function() {
          return this.y + this.height / 2
      };
      a.common.Rect.prototype.horizontalCenter = function() {
          return this.x + this.width / 2
      };
      a.common.Rect.prototype.centerPoint = function() {
          return new a.common.Point(this.horizontalCenter(), this.verticalCenter())
      };
      a.common.Rect.prototype.isEmpty =
          function() {
              return null === this.x || null === this.y || null === this.width || null === this.height || 0 > this.width || 0 > this.height
          };
      a.common.Rect.prototype.offset = function(a, b, d, c) {
          switch (arguments.length) {
              case 1:
                  null !== a && "object" == typeof a ? (this.x -= a.left, this.y -= a.top, this.width = this.width + a.left + a.right, this.height = this.height + a.top + a.bottom) : (this.x -= a, this.y -= a, this.width += 2 * a, this.height += 2 * a);
                  break;
              case 4:
                  this.x -= a, this.y -= b, this.width = this.width + a + d, this.height = this.height + b + c
          }
          return this
      };
      a.common.Rect.prototype.scale =
          function(a) {
              this.x *= a;
              this.y *= a;
              this.width *= a;
              this.height *= a;
              return this
          };
      a.common.Rect.prototype.translate = function(a, b) {
          this.x += a;
          this.y += b;
          return this
      };
      a.common.Rect.prototype.invert = function() {
          var a = this.width,
              b = this.x;
          this.width = this.height;
          this.height = a;
          this.x = this.y;
          this.y = b;
          return this
      };
      a.common.Rect.prototype.loopEdges = function(f) {
          var b = [new a.common.Point(this.left(), this.top()), new a.common.Point(this.right(), this.top()), new a.common.Point(this.right(), this.bottom()), new a.common.Point(this.left(),
                  this.bottom())],
              d = [1, 3, 5, 7];
          b.push(b[0]);
          if (null != f)
              for (var c = 1, e = b.length; c < e && !f(new a.common.Vector(b[c - 1], b[c]), d[c - 1]); c += 1);
          return this
      };
      a.common.Rect.prototype.contains = function(a, b) {
          switch (arguments.length) {
              case 1:
                  return this.x <= a.x && a.x <= this.x + this.width && this.y <= a.y && a.y <= this.y + this.height;
              case 2:
                  return this.x <= a && a <= this.x + this.width && this.y <= b && b <= this.y + this.height;
              default:
                  return !1
          }
      };
      a.common.Rect.prototype.cropByRect = function(a) {
          this.x < a.x && (this.width -= a.x - this.x, this.x = a.x);
          this.right() >
              a.right() && (this.width -= this.right() - a.right());
          this.y < a.y && (this.height -= a.y - this.y, this.y = a.y);
          this.bottom() > a.bottom() && (this.height -= this.bottom() - a.bottom());
          this.isEmpty() && (this.height = this.width = this.y = this.x = null);
          return this
      };
      a.common.Rect.prototype.overlaps = function(a) {
          var b = !0;
          if (this.x + this.width < a.x || a.x + a.width < this.x || this.y + this.height < a.y || a.y + a.height < this.y) b = !1;
          return b
      };
      a.common.Rect.prototype.addRect = function(a, b, d, c) {
          var e, g;
          switch (arguments.length) {
              case 1:
                  a.isEmpty() || (this.isEmpty() ?
                      (this.x = a.x, this.y = a.y, this.width = a.width, this.height = a.height) : (e = Math.max(this.right(), a.right()), g = Math.max(this.bottom(), a.bottom()), this.x = Math.min(this.x, a.x), this.y = Math.min(this.y, a.y), this.width = e - this.x, this.height = g - this.y));
                  break;
              case 2:
                  this.isEmpty() ? (this.x = a, this.y = b, this.height = this.width = 0) : (e = Math.max(this.right(), a), g = Math.max(this.bottom(), b), this.x = Math.min(this.x, a), this.y = Math.min(this.y, b), this.width = e - this.x, this.height = g - this.y);
                  break;
              case 4:
                  this.isEmpty() ? (this.x = a, this.y =
                      b, this.width = d, this.height = c) : (e = Math.max(this.right(), a + d), g = Math.max(this.bottom(), b + c), this.x = Math.min(this.x, a), this.y = Math.min(this.y, b), this.width = e - this.x, this.height = g - this.y)
          }
          return this
      };
      a.common.Rect.prototype.getCSS = function(a) {
          a = void 0 !== a ? a : "px";
          return {
              left: this.x + a,
              top: this.y + a,
              width: this.width + a,
              height: this.height + a
          }
      };
      a.common.Rect.prototype.toString = function(a) {
          var b, a = void 0 !== a ? a : "px";
          b = "" + ("left:" + this.x + a + ";");
          b += "top:" + this.y + a + ";";
          b += "width:" + this.width + a + ";";
          return b += "height:" +
              this.height + a + ";"
      };
      a.common.Rect.prototype.validate = function() {
          if (isNaN(this.x) || isNaN(this.y) || isNaN(this.width) || isNaN(this.height)) throw "Invalid rect position.";
      };
      a.common.Rect.prototype.equalTo = function(a) {
          return this.x == a.x && this.y == a.y && this.width == a.width && this.height == a.height
      };
      a.common.MoveSegment = function() {
          this.parent = a.common.Point.prototype;
          this.parent.constructor.apply(this, arguments);
          this.segmentType = 1
      };
      a.common.MoveSegment.prototype = new a.common.Point;
      a.common.MoveSegment.prototype.clone =
          function() {
              return new a.common.MoveSegment(this)
          };
      a.common.MoveSegment.prototype.loop = function(a, b) {
          null != b && b.call(a, this.x, this.y, 0)
      };
      a.common.MoveSegment.prototype.setPoint = function(a) {
          this.x = a.x;
          this.y = a.y
      };
      a.common.MoveSegment.prototype.getEndPoint = function() {
          return this
      };
      a.common.MoveSegment.prototype.invert = function(a) {
          this.x = a.x;
          this.y = a.y
      };
      a.common.MoveSegment.prototype.transform = function(a, b) {
          var d = this;
          a.transformPoint(d.x, d.y, b, d, function(a, b) {
              d.x = a;
              d.y = b
          })
      };
      a.common.CubicArcSegment = function(f,
          b, d, c, e, g) {
          this.parent = a.common.Point.prototype;
          this.cpY2 = this.cpX2 = this.cpY1 = this.cpX1 = this.y = this.x = null;
          switch (arguments.length) {
              case 3:
                  this.parent.constructor.apply(this, [d.x, d.y]);
                  this.cpX1 = f.x;
                  this.cpY1 = f.y;
                  this.cpX2 = b.x;
                  this.cpY2 = b.y;
                  break;
              case 6:
                  this.parent.constructor.apply(this, [e, g]), this.cpX1 = f, this.cpY1 = b, this.cpX2 = d, this.cpY2 = c
          }
          this.segmentType = 3
      };
      a.common.CubicArcSegment.prototype = new a.common.Point;
      a.common.CubicArcSegment.prototype.clone = function() {
          return new a.common.CubicArcSegment(this.cpX1,
              this.cpY1, this.cpX2, this.cpY2, this.x, this.y)
      };
      a.common.CubicArcSegment.prototype.loop = function(a, b) {
          null != b && (b.call(a, this.cpX1, this.cpY1, 0), b.call(a, this.cpX2, this.cpY2, 1), b.call(a, this.x, this.y, 2))
      };
      a.common.CubicArcSegment.prototype.setPoint = function(a, b) {
          switch (b) {
              case 0:
                  this.cpX1 = a.x;
                  this.cpY1 = a.y;
                  break;
              case 1:
                  this.cpX2 = a.x;
                  this.cpY2 = a.y;
                  break;
              case 2:
                  this.x = a.x, this.y = a.y
          }
      };
      a.common.CubicArcSegment.prototype.getEndPoint = function() {
          return this
      };
      a.common.CubicArcSegment.prototype.invert = function(a) {
          var b =
              this.cpX1,
              d = this.cpY1;
          this.x = a.x;
          this.y = a.y;
          this.cpX1 = this.cpX2;
          this.cpY1 = this.cpY2;
          this.cpX2 = b;
          this.cpY2 = d
      };
      a.common.CubicArcSegment.prototype.transform = function(a, b) {
          var d = this;
          a.transform3Points(d.x, d.y, d.cpX1, d.cpY1, d.cpX2, d.cpY2, b, d, function(a, b, f, h, i, j) {
              d.x = a;
              d.y = b;
              d.cpX1 = f;
              d.cpY1 = h;
              d.cpX2 = i;
              d.cpY2 = j
          })
      };
      a.common.CubicArcSegment.prototype.trim = function(a, b) {
          var d = 0.5,
              c = this.offsetPoint(this.x, this.y, this.cpX2, this.cpY2, this.cpX1, this.cpY1, a.x, a.y, d),
              e = this.offsetPoint(this.x, this.y, this.cpX2,
                  this.cpY2, this.cpX1, this.cpY1, a.x, a.y, 0.1),
              d = b * (d / c.distanceTo(this.x, this.y) + 0.1 / e.distanceTo(this.x, this.y)) / 2,
              c = this.offsetPoint(this.x, this.y, this.cpX2, this.cpY2, this.cpX1, this.cpY1, a.x, a.y, d);
          this.x = c.x;
          this.y = c.y;
          return this
      };
      a.common.CubicArcSegment.prototype.offsetPoint = function(f, b, d, c, e, g, h, i, j) {
          return new a.common.Point((1 - j) * (1 - j) * (1 - j) * f + 3 * (1 - j) * (1 - j) * j * d + 3 * (1 - j) * j * j * e + j * j * j * h, (1 - j) * (1 - j) * (1 - j) * b + 3 * (1 - j) * (1 - j) * j * c + 3 * (1 - j) * j * j * g + j * j * j * i)
      };
      a.common.DotSegment = function(a, b, d, c, e) {
          this.segmentType =
              4;
          this.x = a;
          this.y = b;
          this.width = d;
          this.height = c;
          this.cornerRadius = e
      };
      a.common.Label = function() {
          this.position = this.text = null;
          this.weight = 0;
          this.isActive = !0;
          this.horizontalAlignmentType = this.labelOrientation = this.labelType = 0;
          this.verticalAlignmentType = 2;
          this.parent = a.common.Rect.prototype;
          this.parent.constructor.apply(this, arguments)
      };
      a.common.Label.prototype = new a.common.Rect;
      a.common.LineSegment = function() {
          this.parent = a.common.MoveSegment.prototype;
          this.parent.constructor.apply(this, arguments);
          this.segmentType =
              0
      };
      a.common.LineSegment.prototype = new a.common.MoveSegment;
      a.common.LineSegment.prototype.clone = function() {
          return new a.common.LineSegment(this)
      };
      a.common.LineSegment.prototype.trim = function(a, b) {
          var d = this.offsetPoint(this, a, b);
          this.x = d.x;
          this.y = d.y;
          return this
      };
      a.common.LineSegment.prototype.offsetPoint = function(f, b, d) {
          var c = null,
              c = f.distanceTo(b);
          return c = 0 === c || 0 === d ? new a.common.Point(f) : new a.common.Point(f.x + (b.x - f.x) / c * d, f.y + (b.y - f.y) / c * d)
      };
      a.common.Matrix = function(a, b, d, c) {
          this.b2 = this.a2 =
              this.b1 = this.a1 = null;
          switch (arguments.length) {
              case 1:
                  this.a1 = a.a1;
                  this.b1 = a.b1;
                  this.a2 = a.a2;
                  this.b2 = a.b2;
                  break;
              case 4:
                  this.a1 = a, this.b1 = b, this.a2 = d, this.b2 = c
          }
      };
      a.common.Matrix.prototype.determinant = function() {
          return this.a1 * this.b2 - this.b1 * this.a2
      };
      a.common.PaletteItem = function(f) {
          this.lineColor = "#c0c0c0";
          this.lineWidth = 1;
          this.lineType = 0;
          this.opacity = this.fillColor = null;
          this._key = "";
          var b, d, c, e;
          d = ["lineColor", "lineWidth", "lineType", "fillColor", "opacity"];
          c = 0;
          for (e = d.length; c < e; c += 1) b = d[c], null != f &&
              f.hasOwnProperty(b) && (this[b] = f[b]), this._key += (!a.common.isNullOrEmpty(this._key) ? ", " : "") + b + ":" + this[b]
      };
      a.common.PaletteItem.prototype.toAttr = function() {
          var a = {
              lineWidth: this.lineWidth,
              lineType: this.lineType
          };
          null !== this.fillColor && (a.fillColor = this.fillColor);
          null !== this.opacity && (a.opacity = this.opacity);
          null !== this.lineColor && (a.borderColor = this.lineColor);
          return a
      };
      a.common.PaletteItem.prototype.toString = function() {
          return this._key
      };
      a.common.PaletteManager = function(f, b) {
          this.palette = [];
          this.cursor =
              0;
          var d, c;
          if (0 === b.length) this.palette = [new a.common.PaletteItem({
              lineColor: f.linesColor,
              lineWidth: f.linesWidth,
              lineType: f.linesType
          })], this.paletteLength = this.palette.length, this.regularIndex = 0;
          else {
              d = 0;
              for (c = b.length; d < c; d += 1) this.palette.push(new a.common.PaletteItem(b[d]));
              this.paletteLength = this.palette.length;
              this.palette.push(new a.common.PaletteItem({
                  lineColor: f.linesColor,
                  lineWidth: f.linesWidth,
                  lineType: f.linesType
              }));
              this.regularIndex = this.palette.length - 1
          }
          this.palette.push(new a.common.PaletteItem({
              lineColor: f.highlightLinesColor,
              lineWidth: f.highlightLinesWidth,
              lineType: f.highlightLinesType
          }));
          this.highlightIndex = this.palette.length - 1
      };
      a.common.PaletteManager.prototype.selectPalette = function(a) {
          this.cursor = a % this.paletteLength
      };
      a.common.PaletteManager.prototype.getPalette = function(a) {
          var b = null;
          switch (a) {
              case 1:
                  b = this.regularIndex;
                  break;
              case 2:
                  b = this.highlightIndex;
                  break;
              case 0:
                  b = this.cursor
          }
          return this.palette[b]
      };
      a.common.Polyline = function(f) {
          function b(a, b) {
              var f, c, d;
              if (null != b) {
                  f = 0;
                  for (c = j.length; f < c && (!(d = j[f]) || !b.call(a,
                          d, f)); f += 1);
              }
          }
  
          function d() {
              return a.common.isNullOrEmpty(i.fillColor)
          }
  
          function c(b, f, c, d, e, h) {
              for (var i = new a.common.Polyline(l), g, j, e = [new a.common.Point(e, -h / 2), new a.common.Point(0, 0), new a.common.Point(e, h / 2), new a.common.Point(3 * (e / 4), 0)], k = Math.atan2(f - d, b - c), b = 0, f = e.length; b < f; b += 1) h = e[b], g = h.x * Math.cos(k) - h.y * Math.sin(k), j = h.x * Math.sin(k) + h.y * Math.cos(k), h.x = g + c, h.y = j + d;
              i.addSegment(new a.common.MoveSegment(e[0].x, e[0].y));
              i.addSegment(new a.common.LineSegment(e[1].x, e[1].y));
              i.addSegment(new a.common.LineSegment(e[2].x,
                  e[2].y));
              i.addSegment(new a.common.QuadraticArcSegment(e[3].x, e[3].y, e[0].x, e[0].y));
              return i
          }
  
          function e(a, b) {
              this.segment = a;
              this.pointIndex = b
          }
  
          function g(b, f, c, d, h) {
              var i = b.relateTo(f),
                  g = h ? 0 : c;
              2 == i ? f.offset(g) : 3 == i && 0 === f.from.context.pointIndex ? (i = new a.common.LineSegment(f.from), d.addSegment(i), f.offset(g), d = f.from.clone(), d.context = new e(i, 0), g = new a.common.Vector(b.to.clone(), d), h || (f.from = d.clone()), g.offset(c), g.intersect(b), g.from.context.pushToSegment(g.from), f.intersect(g), h && g.to.context.pushToSegment(g.to)) :
                  (f.offset(g), f.intersect(b));
              f.from.context.pushToSegment(f.from)
          }
  
          function h(a, b, f, c) {
              var d, e = a[0],
                  h = e.to.context.segment.getEndPoint().toString();
              b.hasOwnProperty(h) && (d = b[h], g(e, d, f, c, !0), delete b[h]);
              e.to.context.pushToSegment(e.to);
              a.length = 0
          }
          var i = new a.common.PaletteItem,
              j = [],
              k, l;
          switch (arguments.length) {
              case 1:
                  i = f
          }
          l = new a.common.PaletteItem({
              lineColor: i.lineColor,
              lineWidth: 0,
              fillColor: i.lineColor,
              opacity: i.opacity || 1
          });
          e.prototype.pushToSegment = function(a) {
              this.segment.setPoint(a, this.pointIndex)
          };
          return k = {
              paletteItem: i,
              arrowPaletteItem: l,
              addSegment: function(a) {
                  j.push(a)
              },
              addSegments: function(a) {
                  var b, f;
                  b = 0;
                  for (f = a.length; b < f; b += 1) j.push(a[b])
              },
              mergeTo: function(a) {
                  a.addSegments(j)
              },
              length: function() {
                  return j.length
              },
              loop: b,
              loopReversed: function(a, b) {
                  var f, c;
                  if (null != b)
                      for (f = j.length - 1; 0 <= f && (!(c = j[f]) || !b.call(a, c, f)); f -= 1);
              },
              transform: function(a, f) {
                  b(this, function(b) {
                      null != b.transform && b.transform(a, f)
                  })
              },
              isInvertable: d,
              addInverted: function(b) {
                  var f = !1,
                      c = [];
                  d() ? b.loopReversed(this, function(b) {
                      4 !=
                          b.segmentType && (f || (j.push(new a.common.MoveSegment(b.getEndPoint())), f = !0), c.unshift(b), 1 < c.length && (c[1].invert(c[0].getEndPoint()), j.push(c[1]), c.length = 1))
                  }) : b.mergeTo(k)
              },
              addArrow: function(b, f) {
                  var d, e, h, i;
                  e = j.length;
                  i = 3 * b;
                  var g = 2 * b;
                  switch (b) {
                      case 1:
                          i = 8;
                          g = 6;
                          break;
                      case 2:
                          i = 12;
                          g = 8;
                          break;
                      case 3:
                          i = 16, g = 10
                  }
                  null != f && 1 < e && (d = j[e - 2].getEndPoint(), h = j[e - 1], null != h.trim && (e = new a.common.Point(h.getEndPoint()), d = h.trim(d, g), i = c(d.x, d.y, e.x, e.y, i, g), f(i, d)))
              },
              addOffsetArrow: function(b, f, d, e, h) {
                  var i, g, l;
                  i = j.length;
                  l = 3 * f;
                  var k = 2 * f,
                      z;
                  switch (f) {
                      case 1:
                          l = 8;
                          k = 6;
                          break;
                      case 2:
                          l = 12;
                          k = 8;
                          break;
                      case 3:
                          l = 16, k = 10
                  }
                  null != h && 1 < i && (f = j[i - 2].getEndPoint(), g = j[i - 1], null != g.offsetPoint && (i = new a.common.Point(g.getEndPoint()), z = f.distanceTo(i), z > e && (d *= z, b ? (b = g.offsetPoint(f, i, d), l = c(f.x, f.y, b.x, b.y, l, k)) : (b = g.offsetPoint(i, f, d), l = c(i.x, i.y, b.x, b.y, l, k)), h(l))))
              },
              optimizeMoveSegments: function() {
                  var a, b, f, c, d;
                  f = {};
                  var e = [],
                      i = [];
                  a = 0;
                  for (b = j.length; a < b - 1; a += 1) switch (c = j[a], d = j[a + 1], c.segmentType) {
                      case 0:
                      case 2:
                      case 3:
                          switch (d.segmentType) {
                              case 1:
                              case 4:
                                  c =
                                      c.x + "&" + c.y, f.hasOwnProperty(c) || (f[c] = a)
                          }
                          break;
                      case 1:
                          c = c.x + "&" + c.y, f.hasOwnProperty(c) && !e[f[c]] && (e[f[c]] = a + 1, i[a] = !0)
                  }
                  d = [];
                  for (a = 0; a < b; a += 1)
                      if (!i[a] && (c = j[a], d.push(c), i[a] = !0, 0 < e[a]))
                          for (f = e[a]; f < b && !i[f];) c = j[f], d.push(c), i[f] = !0, f = 0 < e[f] ? e[f] : f + 1;
                  j = d
              },
              getOffsetPolyine: function(f) {
                  var c = new a.common.Polyline(i),
                      d = {},
                      l = [],
                      j = [];
                  b(this, function(b) {
                      var i = b.clone();
                      switch (i.segmentType) {
                          case 4:
                          case 1:
                              0 < j.length && h(j, d, f, c);
                              l.length = 0;
                              1 == i.segmentType && (b = new a.common.Point(i), b.context = new e(i, 0),
                                  l.push(b));
                              break;
                          default:
                              i.loop(this, function(b, h, k) {
                                  b = new a.common.Point(b, h);
                                  b.context = new e(i, k);
                                  l.unshift(b);
                                  1 < l.length && (j.unshift(new a.common.Vector(l[1].clone(), l[0].clone())), l.length = 1);
                                  switch (j.length) {
                                      case 1:
                                          k = j[0];
                                          b = k.from.toString();
                                          d[b] = k;
                                          k.offset(f);
                                          k.from.context.pushToSegment(k.from);
                                          break;
                                      case 2:
                                          b = j[1], k = j[0], g(b, k, f, c, !1), j.length = 1
                                  }
                              })
                      }
                      c.addSegment(i)
                  });
                  0 < j.length && h(j, d, f, c);
                  return c
              },
              toString: function() {
                  return i.toString()
              },
              getStartPoint: function() {
                  var a = null;
                  0 < j.length && (a =
                      j[0].getEndPoint());
                  return a
              },
              getEndPoint: function() {
                  var a = null;
                  0 < j.length && (a = j[j.length - 1].getEndPoint());
                  return a
              },
              clone: function() {
                  var b, f, c = new a.common.Polyline(i),
                      d = [],
                      e;
                  b = 0;
                  for (f = j.length; b < f; b += 1) e = j[b], d.push(e.clone());
                  c.addSegments(d);
                  return c
              }
          }
      };
      a.common.PolylinesBuffer = function() {
          function f(b, f) {
              b[f.toString()] || (b[f.toString()] = new a.common.Polyline(f));
              return b[f.toString()]
          }
  
          function b(a, b) {
              var f, h;
              if (null != b)
                  for (f in d)
                      if (d.hasOwnProperty(f) && (h = d[f]))
                          if (h.optimizeMoveSegments(),
                              b.call(a, h)) break
          }
          var d = {};
          return {
              getPolyline: function(a) {
                  return f(d, a)
              },
              loop: b,
              addInverted: function(a, e) {
                  var g, h;
                  g = d;
                  d = {};
                  null != a && a(this);
                  b(this, function(a) {
                      h = f(g, a.paletteItem);
                      e ? a.mergeTo(h) : h.addInverted(a)
                  });
                  d = g
              },
              transform: function(a, f) {
                  b(this, function(b) {
                      b.transform(a, f)
                  })
              }
          }
      };
      a.common.QuadraticArcSegment = function(a, b, d, c) {
          this.cpY = this.cpX = this.y = this.x = null;
          switch (arguments.length) {
              case 2:
                  this.x = b.x;
                  this.y = b.y;
                  this.cpX = a.x;
                  this.cpY = a.y;
                  break;
              case 4:
                  this.cpX = a, this.cpY = b, this.x = d, this.y = c
          }
          this.segmentType =
              2
      };
      a.common.QuadraticArcSegment.prototype.clone = function() {
          return new a.common.QuadraticArcSegment(this.cpX, this.cpY, this.x, this.y)
      };
      a.common.QuadraticArcSegment.prototype.loop = function(a, b) {
          null != b && (b.call(a, this.cpX, this.cpY, 0), b.call(a, this.x, this.y, 1))
      };
      a.common.QuadraticArcSegment.prototype.setPoint = function(a, b) {
          switch (b) {
              case 0:
                  this.cpX = a.x;
                  this.cpY = a.y;
                  break;
              case 1:
                  this.x = a.x, this.y = a.y
          }
      };
      a.common.QuadraticArcSegment.prototype.getEndPoint = function() {
          return this
      };
      a.common.QuadraticArcSegment.prototype.invert =
          function(a) {
              this.x = a.x;
              this.y = a.y
          };
      a.common.QuadraticArcSegment.prototype.transform = function(a, b) {
          var d = this;
          a.transformPoints(d.x, d.y, d.cpX, d.cpY, b, d, function(a, b, f, h) {
              d.x = a;
              d.y = b;
              d.cpX = f;
              d.cpY = h
          })
      };
      a.common.QuadraticArcSegment.prototype.trim = function(a, b) {
          var d = 0.5,
              c = this.offsetPoint(this.x, this.y, this.cpX, this.cpY, a.x, a.y, d),
              e = this.offsetPoint(this.x, this.y, this.cpX, this.cpY, a.x, a.y, 0.1),
              d = b * (d / c.distanceTo(this.x, this.y) + 0.1 / e.distanceTo(this.x, this.y)) / 2,
              c = this.offsetPoint(this.x, this.y, this.cpX,
                  this.cpY, a.x, a.y, d);
          this.x = c.x;
          this.y = c.y;
          return this
      };
      a.common.QuadraticArcSegment.prototype.offsetPoint = function(f, b, d, c, e, g, h) {
          return new a.common.Point((1 - h) * (1 - h) * f + 2 * (1 - h) * h * d + h * h * e, (1 - h) * (1 - h) * b + 2 * (1 - h) * h * c + h * h * g)
      };
      a.common.Size = function(a, b) {
          this.height = this.width = 0;
          switch (arguments.length) {
              case 1:
                  this.width = a.width;
                  this.height = a.height;
                  break;
              case 2:
                  this.width = a, this.height = b
          }
      };
      a.common.Size.prototype.invert = function() {
          var a = this.width;
          this.width = this.height;
          this.height = a;
          return this
      };
      a.common.Size.prototype.scale =
          function(a) {
              this.width *= a;
              this.height *= a;
              return this
          };
      a.common.Size.prototype.getCSS = function(a) {
          a = void 0 !== a ? a : "px";
          return {
              left: this.x + a,
              top: this.y + a,
              width: this.width + a,
              height: this.height + a
          }
      };
      a.common.Size.prototype.cropBySize = function(a) {
          this.width = Math.min(this.width, a.width);
          this.height = Math.min(this.height, a.height);
          return this
      };
      a.common.Size.prototype.addSize = function(a) {
          this.width = Math.max(this.width, a.width);
          this.height = Math.max(this.height, a.height);
          return this
      };
      a.common.Size.prototype.validate =
          function() {
              if (isNaN(this.width) || isNaN(this.height)) throw "Invalid size.";
          };
      a.common.Thickness = function(a, b, d, c) {
          this.left = a;
          this.top = b;
          this.right = d;
          this.bottom = c
      };
      a.common.Thickness.prototype.isEmpty = function() {
          return 0 === this.left && 0 === this.top && 0 === this.right && 0 === this.bottom
      };
      a.common.Thickness.prototype.toString = function(a) {
          a = void 0 !== a ? a : "px";
          return this.left + a + ", " + this.top + a + ", " + this.right + a + ", " + this.bottom + a
      };
      a.common.Vector = function(a, b) {
          this.context = this.to = this.from = null;
          switch (arguments.length) {
              case 1:
                  this.from =
                      a.from;
                  this.to = a.to;
                  break;
              case 2:
                  this.from = a, this.to = b
          }
      };
      a.common.Vector.prototype.isNull = function() {
          return this.from.x == this.to && this.from.y == this.to.y
      };
      a.common.Vector.prototype.length = function() {
          return this.from.distanceTo(this.to)
      };
      a.common.Vector.prototype.equalTo = function(a) {
          return this.from.equalTo(a.from) && this.to.equalTo(a.to)
      };
      a.common.Vector.prototype.getMiddlePoint = function() {
          return new a.common.Point((this.from.x + this.to.x) / 2, (this.from.y + this.to.y) / 2)
      };
      a.common.Vector.prototype.relateTo =
          function(a) {
              var b = 0,
                  d = this.to.x - this.from.x,
                  c = this.to.y - this.from.y,
                  e = a.to.x - a.from.x,
                  a = a.to.y - a.from.y;
              switch ((d ? 8 : 0) + (c ? 4 : 0) + (e ? 2 : 0) + (a ? 1 : 0)) {
                  case 0:
                  case 1:
                  case 2:
                  case 3:
                  case 4:
                  case 8:
                  case 12:
                      b = 1;
                      break;
                  case 5:
                      b = 0 < c * a ? 2 : 3;
                      break;
                  case 10:
                      b = 0 < d * e ? 2 : 3;
                      break;
                  case 15:
                      d / e == c / a && (b = 0 < d / e ? 2 : 3)
              }
              return b
          };
      a.common.Vector.prototype.offset = function(a) {
          var b = this.length(),
              d = (this.to.y - this.from.y) * a / b,
              a = -(this.to.x - this.from.x) * a / b;
          this.from.x += d;
          this.from.y += a;
          this.to.x += d;
          this.to.y += a
      };
      a.common.Vector.prototype.getLine =
          function() {
              var a = this.from.x,
                  b = this.from.y,
                  d = this.to.x,
                  c = this.to.y;
              return [c - b, a - d, a * (b - c) + b * (d - a)]
          };
      a.common.Vector.prototype.getLineKey = function() {
          var a = this.getLine(),
              b = a[0],
              d = a[1],
              a = a[2],
              a = 0 !== d ? [Math.floor(1E4 * (b / d)), 1, Math.floor(1E4 * (a / d))] : [1, 0, Math.floor(1E4 * (a / b))];
          return a.toString()
      };
      a.common.Vector.prototype.intersect = function(f) {
          var b = this.getLine(),
              d = f.getLine(),
              c = (new a.common.Matrix(b[0], b[1], d[0], d[1])).determinant(),
              e;
          e = !1;
          0 !== c && (e = new a.common.Matrix(-b[2], b[1], -d[2], d[1]), e = e.determinant(),
              b = new a.common.Matrix(b[0], -b[2], d[0], -d[2]), b = b.determinant(), d = e / c, c = b / c, f.to.x = d, f.to.y = c, this.from.x = d, this.from.y = c, e = !0);
          return e
      };
      a.common.Vector.prototype.getIntersectionPoint = function(f, b, d) {
          var c = this.getLine(),
              e = f.getLine(),
              g = (new a.common.Matrix(c[0], c[1], e[0], e[1])).determinant(),
              h, i = null;
          0 !== g && (h = new a.common.Matrix(-c[2], c[1], -e[2], e[1]), h = h.determinant(), c = new a.common.Matrix(c[0], -c[2], e[0], -e[2]), c = c.determinant(), h /= g, g = c / g, b ? f._contains(h, g, d) && this._contains(h, g, d) && (i = new a.common.Point(h,
              g)) : i = new a.common.Point(h, g));
          return i
      };
      a.common.Vector.prototype._contains = function(a, b, d) {
          var c = Math.min(this.from.x, this.to.x),
              e = Math.min(this.from.y, this.to.y),
              g = Math.max(this.from.x, this.to.x),
              h = Math.max(this.from.y, this.to.y);
          return c - d <= a && a <= g + d && e - d <= b && b <= h + d
      };
      a.common.Graphics = function(f) {
          this.m_element = f;
          this.m_placeholders = {};
          this.m_activePlaceholder = null;
          this.m_cache = new a.common.Cache;
          this.graphicsType = null;
          this.debug = this.hasGraphics = !1;
          this.layerNames = {};
          a.common.loop(this, a.common.Layers,
              function(a, f) {
                  this.layerNames[f] = a
              })
      };
      a.common.Graphics.prototype.clean = function() {
          var a, b, d, c;
          this.m_cache.clear();
          this.m_element = this.m_cache = null;
          for (a in this.m_placeholders)
              if (this.m_placeholders.hasOwnProperty(a)) {
                  b = this.m_placeholders[a];
                  for (d in b.layers) b.layers.hasOwnProperty(d) && (c = b.layers[d], c.canvas.parentNode.removeChild(c.canvas), c.canvas = null);
                  b.layers.length = 0;
                  b.activeLayer = null;
                  b.size = null;
                  b.rect = null;
                  b.div = null
              }
          this.m_placeholders.length = 0;
          this.m_activePlaceholder = null
      };
      a.common.Graphics.prototype.resize =
          function(a, b, d) {
              a = this.m_placeholders[a];
              null != a && this.resizePlaceholder(a, b, d)
          };
      a.common.Graphics.prototype.resizePlaceholder = function(f, b, d) {
          var c;
          f.size = new a.common.Size(b, d);
          f.rect = new a.common.Rect(0, 0, b, d);
          for (c in f.layers) f.layers.hasOwnProperty(c) && (b = f.layers[c], -1 !== b.name && a.common.JsonML.applyStyles(b.canvas, {
              position: "absolute",
              width: "0px",
              height: "0px"
          }))
      };
      a.common.Graphics.prototype.begin = function() {
          this.m_cache.begin()
      };
      a.common.Graphics.prototype.end = function() {
          this.m_cache.end()
      };
      a.common.Graphics.prototype.reset = function(a, b) {
          var d = "none",
              c = -1;
          switch (arguments.length) {
              case 1:
                  "string" === typeof a ? d = a : c = a;
                  break;
              case 2:
                  d = a, c = b
          }
          this.m_cache.reset(d, c)
      };
      a.common.Graphics.prototype.activate = function(a, b) {
          switch (arguments.length) {
              case 1:
                  "string" === typeof a ? (this._activatePlaceholder(a), this._activateLayer(-1)) : (this._activatePlaceholder("none"), this._activateLayer(a));
                  break;
              case 2:
                  this._activatePlaceholder(a), this._activateLayer(b)
          }
          return this.m_activePlaceholder
      };
      a.common.Graphics.prototype._activatePlaceholder =
          function(f) {
              var b = this.m_placeholders[f],
                  d;
              void 0 === b && ("none" === f ? d = this.m_element : (b = this.m_element.getElementsByClassName(f), d = 0 < b.length ? b[0] : this.m_element), b = new a.common.Placeholder(f), b.div = d, b.size = a.common.getInnerSize(d), b.rect = new a.common.Rect(0, 0, b.size.width, b.size.height), this.m_placeholders[f] = b);
              this.m_activePlaceholder = b
          };
      a.common.Graphics.prototype._activateLayer = function(f) {
          var b = this.m_activePlaceholder.layers[f],
              d, c, e, g;
          if (void 0 === b) {
              d = this.m_activePlaceholder;
              if (-1 === f) b =
                  new a.common.Layer(f), b.canvas = d.div;
              else {
                  c = a.common.JsonML.toHTML(["div", {
                      style: {
                          position: "absolute",
                          width: "0px",
                          height: "0px"
                      },
                      "class": ["Layer" + f, "Layer" + this.layerNames[f]]
                  }]);
                  e = null;
                  for (g in d.layers) d.layers.hasOwnProperty(g) && (b = d.layers[g], b.name < f && (e = null !== e ? Math.max(e, b.name) : b.name));
                  b = new a.common.Layer(f);
                  b.canvas = c;
                  null === e ? this.prepend(d.div, b.canvas) : this.insertAfter(d.layers[e].canvas, b.canvas)
              }
              d.layers[f] = b
          }
          this.m_activePlaceholder.activeLayer = b
      };
      a.common.Graphics.prototype.prepend =
          function(a, b) {
              null == a.firstChild ? a.appendChild(b) : a.insertBefore(b, a.firstChild)
          };
      a.common.Graphics.prototype.insertAfter = function(a, b) {
          var d = a.parentNode;
          d.lastChild == a ? d.appendChild(b) : d.insertBefore(b, a.nextSibling)
      };
      a.common.Graphics.prototype.text = function(f, b, d, c, e, g, h, i, j) {
          var k = this.m_activePlaceholder,
              h = {
                  position: "absolute",
                  padding: 0,
                  margin: 0,
                  textAlign: this._getTextAlign(h),
                  fontSize: j.fontSize,
                  fontFamily: j.fontFamily,
                  fontWeight: j.fontWeight,
                  fontStyle: j.fontStyle,
                  color: j.fontColor,
                  lineHeight: 1
              },
              j = "";
          switch (g) {
              case 0:
              case 3:
                  h.left = f + "px";
                  h.top = b + "px";
                  h.width = d + "px";
                  h.height = c + "px";
                  break;
              case 1:
                  h.left = f + Math.round(d / 2 - c / 2) + "px";
                  h.top = b + Math.round(c / 2 - d / 2) + "px";
                  h.width = c + "px";
                  h.height = d + "px";
                  j = "rotate(-90deg)";
                  break;
              case 2:
                  h.left = f + Math.round(d / 2 - c / 2) + "px", h.top = b + Math.round(c / 2 - d / 2) + "px", h.width = c + "px", h.height = d + "px", j = "rotate(90deg)"
          }
          h["-webkit-transform-origin"] = "center center";
          h["-moz-transform-origin"] = "center center";
          h["-o-transform-origin"] = "center center";
          h["-ms-transform-origin"] =
              "center center";
          h["-webkit-transform"] = j;
          h["-moz-transform"] = j;
          h["-o-transform"] = j;
          h["-ms-transform"] = j;
          h.transform = j;
          h.maxWidth = h.width;
          h.maxHeight = h.height;
          e = e.replace(RegExp("\n", "g"), "");
          switch (i) {
              case 0:
                  this.debug && (h.border = "solid 1px black");
                  b = this.m_cache.get(k.name, k.activeLayer.name, "text");
                  null === b ? (b = a.common.JsonML.toHTML(["div", {
                      style: h,
                      $: function(a) {
                          a.innerHTML = e
                      }
                  }]), k.activeLayer.canvas.appendChild(b), this.m_cache.put(k.name, k.activeLayer.name, "text", b)) : (a.common.JsonML.applyStyles(b,
                      h), b.innerHTML = e);
                  break;
              default:
                  h.borderCollapse = "collapse", f = {
                      verticalAlign: this._getVerticalAlignment(i),
                      padding: 0
                  }, this.debug && (f.border = "solid 1px black"), b = this.m_cache.get(k.name, k.activeLayer.name, "textintable"), null === b ? (b = a.common.JsonML.toHTML(["table", {
                          style: h
                      },
                      ["tbody", ["tr", ["td", {
                          style: f,
                          $: function(a) {
                              a.innerHTML = e
                          }
                      }]]]
                  ]), k.activeLayer.canvas.appendChild(b), this.m_cache.put(k.name, k.activeLayer.name, "textintable", b)) : (a.common.JsonML.applyStyles(b, h), k = b.getElementsByTagName("td")[0],
                      a.common.JsonML.applyStyles(k, f), k.innerHTML = e)
          }
      };
      a.common.Graphics.prototype._getTextAlign = function(a) {
          var b = null;
          switch (a) {
              case 0:
                  b = "center";
                  break;
              case 1:
                  b = "left";
                  break;
              case 2:
                  b = "right"
          }
          return b
      };
      a.common.Graphics.prototype._getVerticalAlignment = function(a) {
          var b = null;
          switch (a) {
              case 1:
                  b = "middle";
                  break;
              case 0:
                  b = "top";
                  break;
              case 2:
                  b = "bottom"
          }
          return b
      };
      a.common.Graphics.prototype.polylinesBuffer = function(a) {
          a.loop(this, function(a) {
              0 < a.length() && this.polyline(a)
          })
      };
      a.common.Graphics.prototype.polyline =
          function(a) {
              var b = null,
                  d = null,
                  c = a.paletteItem.toAttr();
              a.loop(this, function(a) {
                  switch (a.segmentType) {
                      case 1:
                          b = Math.round(a.x) + 0.5;
                          d = Math.round(a.y) + 0.5;
                          break;
                      case 0:
                          this.rightAngleLine(b, d, Math.round(a.x) + 0.5, Math.round(a.y) + 0.5, c);
                          b = Math.round(a.x) + 0.5;
                          d = Math.round(a.y) + 0.5;
                          break;
                      case 4:
                          this.dot(a.x, a.y, a.width, a.height, a.cornerRadius, c)
                  }
              })
          };
      a.common.Graphics.prototype.dot = function(f, b, d, c, e, g) {
          var h = this.m_activePlaceholder,
              i = this.m_cache.get(h.name, h.activeLayer.name, "dot"),
              j = void 0 !== g.lineWidth &&
              void 0 !== g.borderColor,
              f = {
                  position: "absolute",
                  width: d - (j ? 1 : 0),
                  top: Math.round(b),
                  left: Math.round(f),
                  padding: 0,
                  margin: 0,
                  lineHeight: "0px",
                  overflow: "hidden",
                  height: c - (j ? 1 : 0),
                  background: g.fillColor,
                  MozBorderRadius: e,
                  WebkitBorderRadius: e,
                  "-khtml-border-radius": e,
                  borderRadius: e,
                  fontSize: "0px",
                  borderStyle: j ? "Solid" : "None",
                  borderWidth: j ? "1px" : "0px",
                  borderColor: j ? g.borderColor : ""
              };
          null === i ? (i = a.common.JsonML.toHTML(["div", {
              style: f
          }]), h.activeLayer.canvas.appendChild(i), this.m_cache.put(h.name, h.activeLayer.name,
              "dot", i)) : a.common.JsonML.applyStyles(i, f)
      };
      a.common.Graphics.prototype.rightAngleLine = function(f, b, d, c, e) {
          var g = this.m_activePlaceholder,
              h = Math.abs(c - b) > Math.abs(d - f),
              i = e.lineWidth,
              e = {
                  position: "absolute",
                  top: Math.round(Math.min(b, c) - (h ? 0 : i / 2)),
                  left: Math.round(Math.min(f, d) - (h ? i / 2 : 0)),
                  padding: 0,
                  margin: 0,
                  opacity: 0.5,
                  lineHeight: "0px",
                  overflow: "hidden",
                  background: e.borderColor,
                  fontSize: "0px"
              };
          h ? (e.width = i, e.height = Math.abs(Math.round(c - b))) : (e.width = Math.abs(Math.round(d - f)), e.height = i);
          f = this.m_cache.get(g.name,
              g.activeLayer.name, "rect");
          null === f ? (f = a.common.JsonML.toHTML(["div", {
              style: e
          }]), g.activeLayer.canvas.appendChild(f), this.m_cache.put(g.name, g.activeLayer.name, "rect", f)) : a.common.JsonML.applyStyles(f, e)
      };
      a.common.Graphics.prototype.template = function(f, b, d, c, e, g, h, i, j, k, l, n, m) {
          var d = this.m_activePlaceholder,
              c = "template" + (null !== k ? k : a.common.hashCode(j)),
              p = 0,
              q, k = this.m_cache.get(d.name, d.activeLayer.name, c);
          null !== m && void 0 !== m.borderWidth && (p = this.getPxSize(m.borderWidth));
          q = {
              width: h - p + "px",
              height: i -
                  p + "px",
              top: b + g + "px",
              left: f + e + "px"
          };
          a.common.mergeObjects(q, m);
          null == n && (n = new a.common.RenderEventArgs);
          n.x = f + e;
          n.y = b + g;
          n.width = h - p;
          n.height = i - p;
          null == k ? (k = this.getElementByTemplate(j), q = a.common.mergeObjects(q, {
              position: "absolute",
              padding: "0px",
              margin: "0px"
          }, m), a.common.JsonML.applyStyles(k, q), n.element = k, n.renderingMode = 0, null !== l && l(null, n), d.activeLayer.canvas.appendChild(k), this.m_cache.put(d.name, d.activeLayer.name, c, k)) : (n.element = k, n.renderingMode = 1, a.common.JsonML.applyStyles(k, q), null !==
              l && l(null, n));
          return k
      };
      a.common.Graphics.prototype.getElementByTemplate = function(f) {
          var b = null;
          a.common.isArray(f) ? b = a.common.JsonML.toHTML(f) : (b = document.createElement("div"), b.innerHTML = f, b = b.firstChild);
          return b
      };
      a.common.Graphics.prototype.getPxSize = function(a, b) {
          var d = a;
          "string" === typeof a && (d = 0 < a.indexOf("pt") ? 96 * parseInt(a, 10) / 72 : 0 < a.indexOf("%") ? parseFloat(a) / 100 * b : parseInt(a, 10));
          return d
      };
      a.common.Cache = function() {
          this.threshold = 20;
          this.m_visible = {};
          this.m_invisible = {}
      };
      a.common.Cache.prototype.begin =
          function() {
              var a, b, d, c;
              for (a in this.m_visible)
                  if (this.m_visible.hasOwnProperty(a))
                      for (b in this.m_visible[a])
                          if (this.m_visible[a].hasOwnProperty(b)) {
                              for (d = this.m_visible[a][b].length - 1; 0 <= d; d -= 1) c = this.m_visible[a][b][d], c.style.visibility = "hidden", this.m_invisible[a][b].push(c);
                              this.m_visible[a][b].length = 0
                          }
          };
      a.common.Cache.prototype.end = function() {
          var a, b, d;
          for (a in this.m_visible)
              if (this.m_visible.hasOwnProperty(a))
                  for (b in this.m_visible[a])
                      if (this.m_visible[a].hasOwnProperty(b) && this.m_invisible[a][b].length >
                          this.threshold)
                          for (; void 0 !== (d = this.m_invisible[a][b].pop());) d.parentNode.removeChild(d)
      };
      a.common.Cache.prototype.reset = function(a, b) {
          var a = a + "-" + b,
              d = null,
              c, e;
          for (c in this.m_visible[a])
              if (this.m_visible[a].hasOwnProperty(c)) {
                  for (e = this.m_visible[a][c].length - 1; 0 <= e; e -= 1) d = this.m_visible[a][c][e], this.m_invisible[a][c].push(d), d.style.visibility = "hidden";
                  this.m_visible[a][c].length = 0
              }
      };
      a.common.Cache.prototype.clear = function() {
          var a, b, d;
          for (a in this.m_visible)
              if (this.m_visible.hasOwnProperty(a))
                  for (b in this.m_visible[a])
                      if (this.m_visible[a].hasOwnProperty(b)) {
                          for (; void 0 !==
                              (d = this.m_visible[a][b].pop());) d.parentNode.removeChild(d);
                          for (; void 0 !== (d = this.m_invisible[a][b].pop());) d.parentNode.removeChild(d)
                      }
      };
      a.common.Cache.prototype.get = function(a, b, d) {
          a = a + "-" + b;
          b = null;
          void 0 === this.m_visible[a] && (this.m_visible[a] = {}, this.m_invisible[a] = {});
          void 0 === this.m_visible[a][d] && (this.m_visible[a][d] = [], this.m_invisible[a][d] = []);
          b = this.m_invisible[a][d].pop() || null;
          null !== b && (this.m_visible[a][d].push(b), b.style.visibility = "inherit");
          return b
      };
      a.common.Cache.prototype.put =
          function(a, b, d, c) {
              this.m_visible[a + "-" + b][d].push(c)
          };
      a.common.CanvasGraphics = function(f) {
          this.parent = a.common.Graphics.prototype;
          this.parent.constructor.apply(this, arguments);
          this.graphicsType = 1;
          this.m_maximum = 8E3
      };
      a.common.CanvasGraphics.prototype = new a.common.Graphics;
      a.common.CanvasGraphics.prototype.clean = function() {
          var a, b, d, c;
          for (a in this.m_placeholders)
              if (this.m_placeholders.hasOwnProperty(a))
                  for (d in b = this.m_placeholders[a], b.layers) b.layers.hasOwnProperty(d) && (c = b.layers[d], null !== c.canvascanvas &&
                      (c.canvascanvas.parentNode.removeChild(c.canvascanvas), c.canvascanvas = null));
          this.parent.clean.apply(this, arguments)
      };
      a.common.CanvasGraphics.prototype._activatePlaceholder = function(a) {
          var b, d, c;
          this.parent._activatePlaceholder.apply(this, arguments);
          b = this.m_activePlaceholder;
          d = b.size.width;
          c = b.size.height;
          b.hasGraphics = d > this.m_maximum || c > this.m_maximum ? !1 : !0
      };
      a.common.CanvasGraphics.prototype.resizePlaceholder = function(a, b, d) {
          var c, e;
          this.parent.resizePlaceholder.apply(this, arguments);
          for (c in a.layers) a.layers.hasOwnProperty(c) &&
              (e = a.layers[c], null !== e.canvascanvas && (e.canvascanvas.width = b, e.canvascanvas.height = d))
      };
      a.common.CanvasGraphics.prototype.begin = function() {
          var a, b, d, c, e, g;
          this.parent.begin.apply(this);
          for (a in this.m_placeholders)
              if (this.m_placeholders.hasOwnProperty(a))
                  for (d in b = this.m_placeholders[a], e = b.size.width, g = b.size.height, b.layers) b.layers.hasOwnProperty(d) && (c = b.layers[d], null !== c.canvascanvas && c.canvascontext.clearRect(0, 0, e, g))
      };
      a.common.Graphics.prototype._getContext = function(a, b) {
          var d = a.size.width,
              c = a.size.height;
          null === b.canvascanvas && (b.canvascanvas = document.createElement("canvas"), b.canvascanvas.width = d, b.canvascanvas.height = c, this.prepend(a.activeLayer.canvas, b.canvascanvas), b.canvascontext = b.canvascanvas.getContext("2d"));
          return b.canvascontext
      };
      a.common.CanvasGraphics.prototype.reset = function(a, b) {
          var d = "none",
              c = -1,
              e, g;
          switch (arguments.length) {
              case 1:
                  "string" === typeof a ? d = a : c = a;
                  break;
              case 2:
                  d = a, c = b
          }
          this.parent.reset.apply(this, arguments);
          e = this.m_placeholders[d];
          void 0 !== e && (d = e.size.width,
              g = e.size.height, c = e.layers[c], void 0 !== c && null !== c.canvascanvas && c.canvascontext.clearRect(0, 0, d, g))
      };
      a.common.CanvasGraphics.prototype.polyline = function(a) {
          var b = this.m_activePlaceholder,
              d, c, e = a.paletteItem.toAttr(),
              g, h;
          if (b.hasGraphics) {
              d = b.activeLayer;
              c = this._getContext(b, d);
              c.save();
              void 0 !== e.lineWidth && void 0 !== e.borderColor ? (c.strokeStyle = e.borderColor, c.lineWidth = e.lineWidth) : (c.lineWidth = 0, c.strokeStyle = "Transparent");
              if (null != e.lineType) {
                  b = Math.round(e.lineWidth) || 1;
                  switch (e.lineType) {
                      case 0:
                          g = [];
                          break;
                      case 1:
                          g = [b, b];
                          break;
                      case 2:
                          g = [5 * b, 3 * b]
                  }
                  void 0 !== c.setLineDash ? c.setLineDash(g) : void 0 !== c.webkitLineDash ? c.webkitLineDash = g : void 0 !== c.mozDash && (c.mozDash = g)
              }
              c.beginPath();
              a.loop(this, function(a) {
                  switch (a.segmentType) {
                      case 1:
                          c.moveTo(Math.round(a.x) + 0.5, Math.round(a.y) + 0.5);
                          break;
                      case 0:
                          c.lineTo(Math.round(a.x) + 0.5, Math.round(a.y) + 0.5);
                          break;
                      case 4:
                          a.width == a.height && a.width / 2 <= a.cornerRadius ? (c.moveTo(Math.round(a.x) + a.width + 0.5, Math.round(a.y) + a.height / 2 + 0.5), c.arc(Math.round(a.x) + a.width /
                              2 + 0.5, Math.round(a.y) + a.height / 2 + 0.5, Math.round(a.width / 2), 0, 2 * Math.PI, !1)) : 0 === a.cornerRadius ? (c.moveTo(Math.round(a.x) + 0.5, Math.round(a.y) + 0.5), c.lineTo(Math.round(a.x + a.width) + 0.5, Math.round(a.y) + 0.5), c.lineTo(Math.round(a.x + a.width) + 0.5, Math.round(a.y + a.height) + 0.5), c.lineTo(Math.round(a.x) + 0.5, Math.round(a.y + a.height) + 0.5), c.lineTo(Math.round(a.x) + 0.5, Math.round(a.y) + 0.5)) : (h = Math.min(a.cornerRadius, Math.min(a.width / 2, a.height / 2)), c.moveTo(Math.round(a.x) + 0.5, Math.round(a.y + h) + 0.5), c.arc(Math.round(a.x +
                              h) + 0.5, Math.round(a.y + h) + 0.5, Math.round(h), Math.PI, -Math.PI / 2, !1), c.lineTo(Math.round(a.x + a.width - h) + 0.5, Math.round(a.y) + 0.5), c.arc(Math.round(a.x + a.width - h) + 0.5, Math.round(a.y + h) + 0.5, Math.round(h), -Math.PI / 2, 0, !1), c.lineTo(Math.round(a.x + a.width) + 0.5, Math.round(a.y + a.height - h) + 0.5), c.arc(Math.round(a.x + a.width - h) + 0.5, Math.round(a.y + a.height - h) + 0.5, Math.round(h), 0, Math.PI / 2, !1), c.lineTo(Math.round(a.x + h) + 0.5, Math.round(a.y + a.height) + 0.5), c.arc(Math.round(a.x + h) + 0.5, Math.round(a.y + a.height - h) + 0.5,
                              Math.round(h), Math.PI / 2, Math.PI, !1), c.lineTo(Math.round(a.x) + 0.5, Math.round(a.y + h) + 0.5));
                          break;
                      case 2:
                          c.quadraticCurveTo(Math.round(a.cpX) + 0.5, Math.round(a.cpY) + 0.5, Math.round(a.x) + 0.5, Math.round(a.y) + 0.5);
                          break;
                      case 3:
                          c.bezierCurveTo(Math.round(a.cpX1) + 0.5, Math.round(a.cpY1) + 0.5, Math.round(a.cpX2) + 0.5, Math.round(a.cpY2) + 0.5, Math.round(a.x) + 0.5, Math.round(a.y) + 0.5)
                  }
              });
              null != e.opacity && (c.globalAlpha = e.opacity);
              void 0 !== e.lineWidth && c.stroke();
              void 0 !== e.fillColor && (c.fillStyle = e.fillColor, c.fill());
              c.restore()
          } else this.parent.polyline.apply(this, arguments)
      };
      a.common.Element = function(a, b) {
          this.name = this.ns = null;
          this.attr = {};
          this.style = {};
          this.children = [];
          switch (arguments.length) {
              case 1:
                  this.name = a;
                  break;
              case 2:
                  this.ns = a, this.name = b
          }
      };
      a.common.Element.prototype.setAttribute = function(a, b) {
          this.attr[a] = b
      };
      a.common.Element.prototype.appendChild = function(a) {
          this.children[this.children.length] = a
      };
      a.common.Element.prototype.create = function(a) {
          var b = null,
              d, c, b = null !== this.ns ? document.createElementNS(this.ns,
                  this.name) : document.createElement(this.name);
          for (d in this.attr) this.attr.hasOwnProperty(d) && (void 0 !== a ? b[d] = this.attr[d] : b.setAttribute(d, this.attr[d]));
          for (d in this.style) this.style.hasOwnProperty(d) && (b.style[d] = this.style[d]);
          for (c = 0; c < this.children.length; c += 1) d = this.children[c], "string" === typeof d ? b.appendChild(document.createTextNode(d)) : b.appendChild(d.create(a));
          return b
      };
      a.common.Element.prototype.update = function(a, b) {
          var d, c, e;
          for (d in this.style) this.style.hasOwnProperty(d) && (c = this.style[d],
              a.style[d] !== c && (a.style[d] = c));
          for (d in this.attr) this.attr.hasOwnProperty(d) && (c = this.attr[d], void 0 !== b ? a[d] !== c && (a[d] = c) : a.getAttribute(d) !== c && a.setAttribute(d, c));
          d = this.children.length;
          for (c = 0; c < d; c += 1) e = this.children[c], "string" === typeof e ? a.innerHtml !== e && (a.innerHtml = e) : this.children[c].update(a.children[c], b)
      };
      a.common.Layer = function(a) {
          this.name = a;
          this.svgcanvas = this.canvascanvas = this.canvas = null
      };
      a.common.Placeholder = function(a) {
          this.name = a;
          this.layers = {};
          this.div = this.rect = this.size =
              this.activeLayer = null;
          this.hasGraphics = !0
      };
      a.common.SvgGraphics = function(f) {
          this.parent = a.common.Graphics.prototype;
          this.parent.constructor.apply(this, arguments);
          this._svgxmlns = "http://www.w3.org/2000/svg";
          this.graphicsType = 0;
          this.hasGraphics = !0
      };
      a.common.SvgGraphics.prototype = new a.common.Graphics;
      a.common.SvgGraphics.prototype.clean = function() {
          var a, b, d, c;
          for (a in this.m_placeholders)
              if (this.m_placeholders.hasOwnProperty(a))
                  for (d in b = this.m_placeholders[a], b.layers) b.layers.hasOwnProperty(d) &&
                      (c = b.layers[d], null !== c.svgcanvas && (c.svgcanvas.parentNode.removeChild(c.svgcanvas), c.svgcanvas = null));
          this.parent.clean.apply(this, arguments)
      };
      a.common.SvgGraphics.prototype.resizePlaceholder = function(f, b, d) {
          var c, e;
          this.parent.resizePlaceholder.apply(this, arguments);
          for (c in f.layers) f.layers.hasOwnProperty(c) && (e = f.layers[c], null !== e.svgcanvas && (a.common.JsonML.applyStyles(e.svgcanvas, {
              position: "absolute",
              width: b + "px",
              height: d + "px"
          }), e.svgcanvas.viewBox = "0 0 " + b + " " + d))
      };
      a.common.SvgGraphics.prototype._getCanvas =
          function() {
              var f = this.m_activePlaceholder,
                  b = f.activeLayer,
                  d = f.rect;
              null === b.svgcanvas && (b.svgcanvas = document.createElementNS(this._svgxmlns, "svg"), b.svgcanvas.viewBox = d.x + " " + d.y + " " + d.width + " " + d.height, a.common.JsonML.applyStyles(b.svgcanvas, {
                  width: d.width + "px",
                  height: d.height + "px"
              }), this.prepend(f.activeLayer.canvas, b.svgcanvas));
              return b.svgcanvas
          };
      a.common.SvgGraphics.prototype.polyline = function(f) {
          var b = this.m_activePlaceholder,
              d, c, e = f.paletteItem.toAttr(),
              g, h, i;
          d = new a.common.Element(this._svgxmlns,
              "path");
          void 0 !== e.fillColor ? (d.setAttribute("fill", e.fillColor), d.setAttribute("fill-opacity", e.opacity)) : d.setAttribute("fill-opacity", 0);
          void 0 !== e.lineWidth && void 0 !== e.borderColor ? (d.setAttribute("stroke", e.borderColor), d.setAttribute("stroke-width", e.lineWidth), void 0 !== e.opacity ? d.setAttribute("stroke-opacity", e.opacity) : d.setAttribute("stroke-opacity", 1)) : (d.setAttribute("stroke", "transparent"), d.setAttribute("stroke-width", 0));
          if (null != e.lineType) switch (g = Math.round(e.lineWidth) || 1, e.lineType) {
              case 0:
                  d.setAttribute("stroke-dasharray",
                      "");
                  break;
              case 1:
                  d.setAttribute("stroke-dasharray", g + "," + g);
                  break;
              case 2:
                  d.setAttribute("stroke-dasharray", 5 * g + "," + 3 * g)
          }
          c = "";
          f.loop(this, function(a) {
              switch (a.segmentType) {
                  case 1:
                      c += "M" + (Math.round(a.x) + 0.5) + " " + (Math.round(a.y) + 0.5);
                      break;
                  case 0:
                      c += "L" + (Math.round(a.x) + 0.5) + " " + (Math.round(a.y) + 0.5);
                      break;
                  case 2:
                      c += "Q" + (Math.round(a.cpX) + 0.5) + " " + (Math.round(a.cpY) + 0.5) + " " + (Math.round(a.x) + 0.5) + " " + (Math.round(a.y) + 0.5);
                      break;
                  case 4:
                      a.width == a.height && a.width / 2 <= a.cornerRadius ? (h = a.width / 2, c += "M" +
                          (Math.round(a.x) + 0.5) + " " + (Math.round(a.y) + a.height / 2 + 0.5), c += "A" + h + " " + h + " 0 0 0 " + (Math.round(a.x + a.width) + 0.5) + " " + (Math.round(a.y) + a.height / 2 + 0.5), c += "A" + h + " " + h + " 0 0 0 " + (Math.round(a.x) + 0.5) + " " + (Math.round(a.y) + a.height / 2 + 0.5)) : 0 === a.cornerRadius ? (c += "M" + (Math.round(a.x) + 0.5) + " " + (Math.round(a.y) + 0.5), c += "L" + (Math.round(a.x + a.width) + 0.5) + " " + (Math.round(a.y) + 0.5), c += "L" + (Math.round(a.x + a.width) + 0.5) + " " + (Math.round(a.y + a.height) + 0.5), c += "L" + (Math.round(a.x) + 0.5) + " " + (Math.round(a.y + a.height) +
                          0.5), c += "L" + (Math.round(a.x) + 0.5) + " " + (Math.round(a.y) + 0.5)) : (i = Math.min(a.cornerRadius, Math.min(a.width / 2, a.height / 2)), c += "M" + (Math.round(a.x) + 0.5) + " " + (Math.round(a.y + i) + 0.5), c += "A" + Math.round(i) + " " + Math.round(i) + " 0 0 1 " + (Math.round(a.x + i) + 0.5) + " " + (Math.round(a.y) + 0.5), c += "L" + (Math.round(a.x + a.width - i) + 0.5) + " " + (Math.round(a.y) + 0.5), c += "A" + Math.round(i) + " " + Math.round(i) + " 0 0 1 " + (Math.round(a.x + a.width) + 0.5) + " " + (Math.round(a.y + i) + 0.5), c += "L" + (Math.round(a.x + a.width) + 0.5) + " " + (Math.round(a.y +
                          a.height - i) + 0.5), c += "A" + Math.round(i) + " " + Math.round(i) + " 0 0 1 " + (Math.round(a.x + a.width - i) + 0.5) + " " + (Math.round(a.y + a.height) + 0.5), c += "L" + (Math.round(a.x + i) + 0.5) + " " + (Math.round(a.y + a.height) + 0.5), c += "A" + Math.round(i) + " " + Math.round(i) + " 0 0 1 " + (Math.round(a.x) + 0.5) + " " + (Math.round(a.y + a.height - i) + 0.5), c += "L" + (Math.round(a.x) + 0.5) + " " + (Math.round(a.y + i) + 0.5));
                      break;
                  case 3:
                      c += "C" + (Math.round(a.cpX1) + 0.5) + " " + (Math.round(a.cpY1) + 0.5) + " " + (Math.round(a.cpX2) + 0.5) + " " + (Math.round(a.cpY2) + 0.5) + " " +
                          (Math.round(a.x) + 0.5) + " " + (Math.round(a.y) + 0.5)
              }
          });
          d.setAttribute("d", c);
          f = this.m_cache.get(b.name, b.activeLayer.name, "path");
          null === f ? (f = d.create(), d = this._getCanvas(), d.appendChild(f), this.m_cache.put(b.name, b.activeLayer.name, "path", f)) : d.update(f)
      };
      a.common.Transform = function() {
          this.invertVertically = this.invertHorizontally = this.invertArea = !1;
          this.size = null
      };
      a.common.Transform.prototype.setOrientation = function(a) {
          switch (a) {
              case 0:
                  this.invertVertically = this.invertHorizontally = this.invertArea = !1;
                  break;
              case 1:
                  this.invertHorizontally = this.invertArea = !1;
                  this.invertVertically = !0;
                  break;
              case 2:
                  this.invertArea = !0;
                  this.invertVertically = this.invertHorizontally = !1;
                  break;
              case 3:
                  this.invertHorizontally = this.invertArea = !0, this.invertVertically = !1
          }
      };
      a.common.Transform.prototype.getOrientation = function(a) {
          var b = a;
          if (this.invertHorizontally) switch (a) {
              case 2:
                  b = 3;
                  break;
              case 3:
                  b = 2
          }
          if (this.invertVertically) switch (a) {
              case 0:
                  b = 1;
                  break;
              case 1:
                  b = 0
          }
          if (this.invertArea) switch (b) {
              case 0:
                  b = 2;
                  break;
              case 1:
                  b = 3;
                  break;
              case 2:
                  b =
                      0;
                  break;
              case 3:
                  b = 1
          }
          return b
      };
      a.common.Transform.prototype.transformPoint = function(a, b, d, c, e) {
          var g;
          d && this.invertArea && (g = a, a = b, b = g);
          this.invertHorizontally && (a = this.size.width - a);
          this.invertVertically && (b = this.size.height - b);
          !d && this.invertArea && (g = a, a = b, b = g);
          e.call(c, a, b)
      };
      a.common.Transform.prototype.transformPoints = function(a, b, d, c, e, g, h) {
          var i;
          e && this.invertArea && (i = a, a = b, b = i, i = d, d = c, c = i);
          this.invertHorizontally && (a = this.size.width - a, d = this.size.width - d);
          this.invertVertically && (b = this.size.height -
              b, c = this.size.height - c);
          !e && this.invertArea && (i = a, a = b, b = i, i = d, d = c, c = i);
          h.call(g, a, b, d, c)
      };
      a.common.Transform.prototype.transform3Points = function(a, b, d, c, e, g, h, i, j) {
          var k;
          h && this.invertArea && (k = a, a = b, b = k, k = d, d = c, c = k, k = e, e = g, g = k);
          this.invertHorizontally && (a = this.size.width - a, d = this.size.width - d, e = this.size.width - e);
          this.invertVertically && (b = this.size.height - b, c = this.size.height - c, g = this.size.height - g);
          !h && this.invertArea && (k = a, a = b, b = k, k = d, d = c, c = k, k = e, e = g, g = k);
          j.call(i, a, b, d, c, e, g)
      };
      a.common.Transform.prototype.transformRect =
          function(a, b, d, c, e, g, h) {
              var i;
              e && this.invertArea && (i = a, a = b, b = i, i = d, d = c, c = i);
              this.invertHorizontally && (a = this.size.width - a - d);
              this.invertVertically && (b = this.size.height - b - c);
              !e && this.invertArea && (i = a, a = b, b = i, i = d, d = c, c = i);
              h.call(g, a, b, d, c)
          };
      a.common.ArrayReader = function(f, b, d, c, e) {
          this.itemTemplate = f;
          this.containsUniqueItems = b;
          this.uniquePropertyKey = d;
          this.containsPrimitiveValues = a.common.isNullOrEmpty(d);
          this.createSourceHash = c;
          this.isOrdered = e
      };
      a.common.ArrayReader.prototype.read = function(f, b, d, c) {
          var e = [],
              g = {},
              h, i, j = {},
              k = {},
              l, n, m, p, q, r = d + "-seq";
          if (!b || !a.common.isArray(b)) b = [];
          h = c.hash.hasOwnProperty(d) ? c.hash[d] : {};
          i = c.hash.hasOwnProperty(r) ? c.hash[r] : {};
          m = 0;
          for (p = b.length; m < p; m += 1) l = b[m], n = this.containsUniqueItems ? this.containsPrimitiveValues ? l : l[this.uniquePropertyKey] : m, g.hasOwnProperty(n) || (q = this.itemTemplate.read(h.hasOwnProperty(n) ? h[n] : {}, l, d + "-" + m, c), e.push(q), g[n] = q, j[m] = n, this.createSourceHash && (k[n] = l), this.isOrdered && i[m] != j[m] && (c.isChanged = !0));
          c.hash[d] = g;
          c.hash[r] = j;
          this.createSourceHash &&
              (c.sourceHash[d] = k);
          if (null == f || f.length != e.length) c.isChanged = !0;
          return e
      };
      a.common.EnumerationReader = function(a, b, d) {
          this.enumeration = a;
          this.isNullable = b;
          this.defaultValue = d;
          this.hash = {};
          for (var c in a) this.hash[a[c]] = c
      };
      a.common.EnumerationReader.prototype.read = function(a, b, d, c) {
          if (null === b || "undefined" == typeof b || !this.hash.hasOwnProperty(b)) b = this.isNullable ? null : this.defaultValue;
          a !== b && (c.isChanged = !0);
          return b
      };
      a.common.FunctionReader = function() {};
      a.common.FunctionReader.prototype.read = function(a,
          b) {
          return "function" == typeof b ? b : null
      };
      a.common.ObjectReader = function(a, b, d) {
          this.dataTemplate = a;
          this.isNullable = b;
          this.defaultValue = d
      };
      a.common.ObjectReader.prototype.read = function(f, b, d, c) {
          var e = null,
              g, h;
          b || (b = this.isNullable ? null : this.defaultValue);
          if (a.common.isObject(b))
              for (g in e = {}, this.dataTemplate) this.dataTemplate.hasOwnProperty(g) && (h = this.dataTemplate[g], e[g] = h.read(a.common.isObject(f) ? f[g] : null, b[g], d + "-" + g, c));
          else e = b, f !== b && (c.isChanged = !0);
          return e
      };
      a.common.ValueReader = function(a,
          b, d) {
          this.acceptedTypes = a;
          this.isNullable = b;
          this.defaultValue = d;
          this.hash = {};
          for (b = 0; b < a.length; b += 1) this.hash[a[b]] = !0
      };
      a.common.ValueReader.prototype.read = function(a, b, d, c) {
          d = null;
          if (null === b || "undefined" == typeof b || !this.hash.hasOwnProperty(typeof b)) b = this.isNullable ? null : this.defaultValue;
          d = b;
          JSON.stringify(a) !== JSON.stringify(b) && (c.isChanged = !0);
          return d
      };
      a.famdiagram.EventArgs = function() {
          this.context = this.oldContext = null;
          this.parentItems = [];
          this.childrenItems = [];
          this.name = this.position = null;
          this.cancel = !1
      };
      a.famdiagram.TemplateConfig = function() {
          this.name = null;
          this.isActive = !0;
          this.itemSize = new a.common.Size(120, 100);
          this.itemBorderWidth = 1;
          this.minimizedItemShapeType = this.itemTemplate = null;
          this.minimizedItemSize = new a.common.Size(4, 4);
          this.minimizedItemCornerRadius = null;
          this.minimizedItemLineWidth = 1;
          this.minimizedItemBorderColor = null;
          this.minimizedItemLineType = 0;
          this.minimizedItemFillColor = null;
          this.minimizedItemOpacity = 1;
          this.highlightPadding = new a.common.Thickness(2, 2, 2, 2);
          this.highlightBorderWidth =
              1;
          this.highlightTemplate = null;
          this.cursorPadding = new a.common.Thickness(3, 3, 3, 3);
          this.cursorBorderWidth = 2;
          this.buttons = this.cursorTemplate = null
      };
      a.famdiagram.BackgroundAnnotationConfig = function(f) {
          var b;
          this.annotationType = 4;
          this.items = [];
          this.zOrderType = 0;
          this.offset = new a.common.Thickness(18, 18, 18, 18);
          this.lineWidth = 2;
          this.opacity = 1;
          this.fillColor = this.borderColor = null;
          this.lineType = 0;
          this.selectItems = !1;
          switch (arguments.length) {
              case 1:
                  if (null !== f)
                      if (f instanceof Array) this.items = f;
                      else if ("object" ==
                      typeof f)
                      for (b in f) f.hasOwnProperty(b) && (this[b] = f[b])
          }
      };
      a.famdiagram.ButtonConfig = function(f, b, d) {
          this.name = f;
          this.icon = b;
          this.text = !1;
          this.label = null;
          this.tooltip = d;
          this.size = new a.common.Size(16, 16)
      };
      a.famdiagram.Config = function(f) {
          this.name = void 0 !== f ? f : "FamDiagram";
          this.classPrefix = "famdiagram";
          this.graphicsType = this.navigationMode = 0;
          this.pageFitMode = 3;
          this.minimalVisibility = 2;
          this.orientationType = 0;
          this.verticalAlignment = 1;
          this.arrowsDirection = 0;
          this.showExtraArrows = !0;
          this.extraArrowsMinimumSpace =
              30;
          this.groupByType = 2;
          this.alignBylevels = !0;
          this.enableMatrixLayout = !1;
          this.minimumMatrixSize = 4;
          this.maximumColumnsInMatrix = 6;
          this.hideGrandParentsConnectors = !1;
          this.elbowType = 3;
          this.elbowDotSize = this.bevelSize = 4;
          this.emptyDiagramMessage = "Diagram is empty.";
          this.items = [];
          this.annotations = [];
          this.highlightItem = this.cursorItem = null;
          this.highlightGravityRadius = 40;
          this.selectedItems = [];
          this.hasSelectorCheckbox = 0;
          this.selectCheckBoxLabel = "Selected";
          this.neighboursSelectionMode = this.selectionPathMode = 0;
          this.templates = [];
          this.defaultLabelAnnotationTemplate = this.defaultTemplateName = null;
          this.hasButtons = 0;
          this.buttons = [];
          this.onCursorRender = this.onHighlightRender = this.onItemRender = this.onMouseDblClick = this.onMouseClick = this.onButtonClick = this.onSelectionChanged = this.onSelectionChanging = this.onCursorChanged = this.onCursorChanging = this.onHighlightChanged = this.onHighlightChanging = null;
          this.dotLevelShift = this.normalLevelShift = 20;
          this.normalItemsInterval = this.lineLevelShift = 10;
          this.dotItemsInterval = 1;
          this.lineItemsInterval =
              2;
          this.cousinsIntervalMultiplier = 5;
          this.itemTitleFirstFontColor = "#ffffff";
          this.itemTitleSecondFontColor = "#000080";
          this.minimizedItemShapeType = 6;
          this.linesColor = "#c0c0c0";
          this.linesWidth = 1;
          this.linesType = 0;
          this.showNeigboursConnectorsHighlighted = !1;
          this.highlightLinesColor = "#ff0000";
          this.highlightLinesWidth = 1;
          this.highlightLinesType = 0;
          this.linesPalette = [];
          this.calloutMaximumVisibility = 2;
          this.showCallout = !0;
          this.calloutPlacementOffset = 100;
          this.defaultCalloutTemplateName = null;
          this.calloutfillColor = "#000000";
          this.calloutBorderColor = null;
          this.calloutCornerRadius = this.calloutOffset = 4;
          this.calloutPointerWidth = "10%";
          this.calloutLineWidth = 1;
          this.calloutOpacity = 0.2;
          this.buttonsPanelSize = 28;
          this.checkBoxPanelSize = this.groupTitlePanelSize = 24;
          this.groupTitleOrientation = this.groupTitlePlacementType = 2;
          this.groupTitleVerticalAlignment = 1;
          this.groupTitleHorizontalAlignment = 0;
          this.groupTitleFontSize = "12px";
          this.groupTitleFontFamily = "Arial";
          this.groupTitleColor = "#4169e1";
          this.groupTitleFontStyle = this.groupTitleFontWeight =
              "normal";
          this.distance = 3;
          this.scale = 1;
          this.minimumScale = 0.5;
          this.maximumScale = 1;
          this.showLabels = 0;
          this.labelSize = new a.common.Size(80, 24);
          this.labelOffset = 1;
          this.labelOrientation = 0;
          this.labelPlacement = 1;
          this.labelFontSize = "10px";
          this.labelFontFamily = "Arial";
          this.labelColor = "#000000";
          this.labelFontStyle = this.labelFontWeight = "normal";
          this.enablePanning = !0;
          this.autoSizeMinimum = new a.common.Size(800, 600);
          this.autoSizeMaximum = new a.common.Size(1024, 768)
      };
      a.famdiagram.ConnectorAnnotationConfig = function(f,
          b) {
          var d;
          this.annotationType = 0;
          this.zOrderType = 2;
          this.toItem = this.fromItem = null;
          this.connectorPlacementType = this.connectorShapeType = 0;
          this.labelPlacementType = 1;
          this.offset = new a.common.Thickness(0, 0, 0, 0);
          this.lineWidth = 2;
          this.color = "#000000";
          this.lineType = 0;
          this.selectItems = !0;
          this.label = null;
          this.labelSize = new a.common.Size(60, 30);
          switch (arguments.length) {
              case 1:
                  for (d in f) f.hasOwnProperty(d) && (this[d] = f[d]);
                  break;
              case 2:
                  this.fromItem = f, this.toItem = b
          }
      };
      a.famdiagram.HighlightPathAnnotationConfig =
          function(a) {
              var b;
              this.zOrderType = this.annotationType = 2;
              this.items = [];
              this.lineWidth = 2;
              this.color = "#ff0000";
              this.lineType = 0;
              this.opacity = 1;
              this.showArrows = !0;
              this.selectItems = !1;
              switch (arguments.length) {
                  case 1:
                      if (null !== a)
                          if (a instanceof Array) this.items = a;
                          else if ("object" == typeof a)
                          for (b in a) a.hasOwnProperty(b) && (this[b] = a[b])
              }
          };
      a.famdiagram.ItemConfig = function(a, b, d, c, e) {
          var g;
          this.id = null;
          this.parents = [];
          this.spouses = [];
          this.relativeItem = null;
          this.placementType = 3;
          this.context = this.image = this.description = 
              this.title = this.position = null;
          this.itemTitleColor = "#4169e1";
          this.groupTitle = this.minimizedItemShapeType = null;
          this.groupTitleColor = "#4169e1";
          this.isActive = !0;
          this.hasButtons = this.hasSelectorCheckbox = 0;
          this.templateName = null;
          this.showCallout = 0;
          this.label = this.calloutTemplateName = null;
          this.showLabel = 0;
          this.labelSize = null;
          this.labelOrientation = 3;
          this.labelPlacement = 0;
          switch (arguments.length) {
              case 1:
                  for (g in a) a.hasOwnProperty(g) && (this[g] = a[g]);
                  break;
              case 5:
                  this.id = a, this.parent = b, this.title = d, this.description =
                      c, this.image = e
          }
      };
      a.famdiagram.LabelAnnotationConfig = function(a, b) {
          var d;
          this.annotationType = 3;
          this.fromItem = null;
          this.toItems = [];
          this.title = null;
          this.itemTitleColor = "#4169e1";
          this.templateName = null;
          switch (arguments.length) {
              case 1:
                  for (d in a) a.hasOwnProperty(d) && (this[d] = a[d]);
                  break;
              case 2:
                  this.fromItem = a, this.toItem = b
          }
      };
      a.famdiagram.PaletteItemConfig = function(a, b, d) {
          var c;
          this.lineColor = "#c0c0c0";
          this.lineWidth = 1;
          this.lineType = 0;
          switch (arguments.length) {
              case 1:
                  for (c in a) a.hasOwnProperty(c) && (this[c] =
                      a[c]);
                  break;
              case 3:
                  this.lineColor = a, this.lineWidth = b, this.lineType = d
          }
      };
      a.famdiagram.ShapeAnnotationConfig = function(f) {
          var b;
          this.annotationType = 1;
          this.zOrderType = 0;
          this.items = [];
          this.shapeType = 0;
          this.offset = new a.common.Thickness(0, 0, 0, 0);
          this.lineWidth = 2;
          this.cornerRadius = "10%";
          this.opacity = 1;
          this.fillColor = this.borderColor = null;
          this.lineType = 0;
          this.selectItems = !1;
          this.label = null;
          this.labelSize = new a.common.Size(60, 30);
          this.labelPlacement = 0;
          this.labelOffset = 4;
          switch (arguments.length) {
              case 1:
                  if (null !==
                      f)
                      if (f instanceof Array) this.items = f;
                      else if ("object" == typeof f)
                      for (b in f) f.hasOwnProperty(b) && (this[b] = f[b])
          }
      };
      a.famdiagram.EdgeItem = function(a, b, d, c) {
          this.values = [b, c];
          this[a] = 0;
          this[d] = 1
      };
      a.famdiagram.EdgeItem.prototype.getNear = function(a) {
          return this.values[this[a]]
      };
      a.famdiagram.EdgeItem.prototype.getFar = function(a) {
          return this.values[Math.abs(this[a] - 1)]
      };
      a.famdiagram.EdgeItem.prototype.setNear = function(a, b) {
          this.values[this[a]] = b
      };
      a.famdiagram.EdgeItem.prototype.setFar = function(a, b) {
          this.values[Math.abs(this[a] -
              1)] = b
      };
      a.famdiagram.EdgeItem.prototype.toString = function() {
          return this.parent + "," + this.child
      };
      a.famdiagram.FamilyItem = function(a) {
          var b;
          this.itemConfig = this.familyId = this.id = null;
          this.isActive = this.isVisible = !0;
          this.isLevelNeutral = !1;
          this.level = null;
          this.levelGravity = 0;
          this.hideChildrenConnection = this.hideParentConnection = !1;
          switch (arguments.length) {
              case 1:
                  for (b in a) a.hasOwnProperty(b) && (this[b] = a[b])
          }
      };
      a.famdiagram.Slot = function(a) {
          this.itemId = a;
          this.position = null;
          this.balance = 0;
          this.left = {};
          this.right = {};
          this.crossings = {}
      };
      a.famdiagram.Slot.prototype.clone = function(f) {
          var b = new a.famdiagram.Slot(f),
              d;
          for (d in this.left) this.left.hasOwnProperty(d) && (b.left[d] = this.left[d]);
          for (d in this.right) this.right.hasOwnProperty(d) && (b.right[d] = this.right[d]);
          for (d in this.crossings) this.crossings.hasOwnProperty(d) && (b.crossings[d] = this.crossings[d]);
          b.itemid = f;
          return b
      };
      a.famdiagram.LabelAnnotationOptionTask = function(f, b, d) {
          var c = [],
              e = {},
              g = null,
              h = {},
              i = new a.common.ArrayReader(new a.common.ObjectReader({
                  zOrderType: new a.common.EnumerationReader(a.common.ZOrderType, !1, d.zOrderType),
                  fromItem: new a.common.ValueReader(["string", "number"], !0),
                  toItems: new a.common.ArrayReader(new a.common.ValueReader(["string", "number"], !0), !0),
                  title: new a.common.ValueReader(["string"], !0),
                  itemTitleColor: new a.common.ValueReader(["string"], !1, d.itemTitleColor),
                  templateName: new a.common.ValueReader(["string"], !0)
              }, !1), !1, null, !0);
          return {
              process: function() {
                  var a = {
                          isChanged: !1,
                          hash: h,
                          sourceHash: {}
                      },
                      d = b.getMaximumId(),
                      l, n, m;
                  c = i.read(c, f.getAnnotations(3), "annotations", a);
                  e = {};
                  var p =
                      a.sourceHash.annotations;
                  l = 0;
                  for (n = c.length; l < n; l += 1) m = c[l], d += 1, m.id = d, e[m.id] = p[l];
                  g = d;
                  return a.isChanged
              },
              getAnnotations: function() {
                  return c
              },
              getMaximumId: function() {
                  return g
              },
              getConfig: function(a) {
                  return e[a]
              }
          }
      };
      a.famdiagram.LabelAnnotationPlacementOptionTask = function(f) {
          var b = [],
              d = {},
              c = new a.common.ArrayReader(new a.common.ObjectReader({
                  id: new a.common.ValueReader(["number"], !0),
                  fromItem: new a.common.ValueReader(["string", "number"], !0),
                  toItems: new a.common.ArrayReader(new a.common.ValueReader(["string",
                      "number"
                  ], !0), !0)
              }), !0, "id");
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: d
                  };
                  b = c.read(b, f.getAnnotations(), "annotations", a);
                  return a.isChanged
              },
              getAnnotations: function() {
                  return b
              },
              getMaximumId: function() {
                  return f.getMaximumId()
              }
          }
      };
      a.famdiagram.LabelAnnotationTemplateOptionTask = function(f, b) {
          var d = [],
              c = {},
              e = new a.common.ArrayReader(new a.common.ObjectReader({
                  id: new a.common.ValueReader(["number"], !0),
                  title: new a.common.ValueReader(["string"], !0),
                  itemTitleColor: new a.common.ValueReader(["string"], !1, b.itemTitleColor),
                  templateName: new a.common.ValueReader(["string"], !0)
              }), !0, "id");
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: c
                  };
                  d = e.read(d, f.getAnnotations(), "annotations", a);
                  return a.isChanged
              },
              getAnnotations: function() {
                  return d
              }
          }
      };
      a.famdiagram.NeighboursSelectionModeOptionTask = function(f, b) {
          var d = {},
              c = new a.common.ObjectReader({
                  neighboursSelectionMode: new a.common.EnumerationReader(a.common.NeighboursSelectionMode, !1, b.neighboursSelectionMode)
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1
                  };
                  d = c.read(d, f.getOptions(), "options", a);
                  return a.isChanged
              },
              getNeighboursSelectionMode: function() {
                  return d.neighboursSelectionMode
              }
          }
      };
      a.famdiagram.HideGrandParentsConnectorsOptionTask = function(f, b) {
          var d = {},
              c = {},
              e = new a.common.ObjectReader({
                  hideGrandParentsConnectors: new a.common.ValueReader(["boolean"], !1, b.hideGrandParentsConnectors)
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: c
                  };
                  d = e.read(d, f.getOptions(), "options", a);
                  return a.isChanged
              },
              getOptions: function() {
                  return d
              }
          }
      };
      a.famdiagram.ItemsOptionTask =
          function(f, b) {
              var d = {},
                  c = {},
                  e = {},
                  g = new a.common.ObjectReader({
                      items: new a.common.ArrayReader(new a.common.ObjectReader({
                          id: new a.common.ValueReader(["string", "number"], !0),
                          parents: new a.common.ArrayReader(new a.common.ValueReader(["string", "number"], !0), !0),
                          isActive: new a.common.ValueReader(["boolean"], !1, b.isActive)
                      }), !0, "id", !0)
                  });
              return {
                  process: function() {
                      var a = {
                          isChanged: !1,
                          hash: c,
                          sourceHash: e
                      };
                      d = g.read(d, f.getOptions(), "options", a);
                      return a.isChanged
                  },
                  getItems: function() {
                      return d.items
                  },
                  getConfig: function(a) {
                      return e["options-items"][a]
                  }
              }
          };
      a.famdiagram.LinePaletteOptionTask = function(f, b) {
          var d = {},
              c = {},
              e = new a.common.ObjectReader({
                  linesPalette: new a.common.ArrayReader(new a.common.ObjectReader({
                      lineColor: new a.common.ValueReader(["string"], !1, b.lineColor),
                      lineWidth: new a.common.ValueReader(["number"], !1, b.lineWidth),
                      lineType: new a.common.EnumerationReader(a.common.LineType, !1, b.lineType)
                  }), !1)
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: c
                  };
                  d = e.read(d, f.getOptions(), "options", a);
                  return a.isChanged
              },
              getOptions: function() {
                  return d
              }
          }
      };
      a.famdiagram.NormalizeOptionTask = function(f, b) {
          var d = {},
              c = {},
              e = new a.common.ObjectReader({
                  groupByType: new a.common.EnumerationReader(a.common.GroupByType, !1, b.groupByType),
                  alignBylevels: new a.common.ValueReader(["boolean"], !1, b.alignBylevels)
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: c
                  };
                  d = e.read(d, f.getOptions(), "options", a);
                  return a.isChanged
              },
              getOptions: function() {
                  return d
              }
          }
      };
      a.famdiagram.OptionsTask = function(a) {
          return {
              process: function() {
                  return !0
              },
              getOptions: a,
              description: "Raw options."
          }
      };
      a.famdiagram.OrderFamilyNodesOptionTask = function(f, b, d) {
          var c = {},
              e = {},
              g = new a.common.ObjectReader({
                  enableMatrixLayout: new a.common.ValueReader(["boolean"], !1, b.enableMatrixLayout),
                  minimumMatrixSize: new a.common.ValueReader(["number"], !1, b.minimumMatrixSize),
                  maximumColumnsInMatrix: new a.common.ValueReader(["number"], !1, b.maximumColumnsInMatrix),
                  items: new a.common.ArrayReader(new a.common.ObjectReader({
                      id: new a.common.ValueReader(["string", "number"], !0),
                      position: new a.common.ValueReader(["number"], !0),
                      relativeItem: new a.common.ValueReader(["string", "number"], !0),
                      placementType: new a.common.EnumerationReader(a.common.AdviserPlacementType, !1, d.placementType)
                  }), !0, "id")
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: e
                  };
                  c = g.read(c, f.getOptions(), "options", a);
                  return a.isChanged
              },
              getOptions: function() {
                  return c
              }
          }
      };
      a.famdiagram.SpousesOptionTask = function(f) {
          var b = {},
              d = {},
              c = new a.common.ObjectReader({
                  items: new a.common.ArrayReader(new a.common.ObjectReader({
                      id: new a.common.ValueReader(["string",
                          "number"
                      ], !0),
                      spouses: new a.common.ArrayReader(new a.common.ValueReader(["string", "number"], !0), !0)
                  }), !0, "id")
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: d
                  };
                  b = c.read(b, f.getOptions(), "options", a);
                  return a.isChanged
              },
              getItems: function() {
                  return b.items
              }
          }
      };
      a.famdiagram.VisualTreeOptionTask = function() {
          var a = {
              leavesPlacementType: 2,
              childrenPlacementType: 2,
              maximumColumnsInMatrix: 6,
              horizontalAlignment: 0
          };
          return {
              process: function() {
                  return !1
              },
              getOptions: function() {
                  return a
              }
          }
      };
      a.famdiagram.CombinedTemplateParamsTask =
          function(a, b) {
              return {
                  process: function() {
                      return !0
                  },
                  getTemplateParams: function(d) {
                      return a.getTemplateParams(d) || b.getTemplateParams(d)
                  }
              }
          };
      a.famdiagram.LabelAnnotationTemplateParamsTask = function(f, b, d) {
          var c = {};
          return {
              process: function() {
                  var e = f.getOptions(),
                      g = b.getAnnotations(),
                      h, i;
                  c = {};
                  h = 0;
                  for (i = g.length; h < i; h += 1) {
                      var j = g[h],
                          k = new a.orgdiagram.TemplateParams,
                          l = d.getTemplate(j.templateName, e.defaultLabelAnnotationTemplate, d.DefaultWidgetLabelAnnotationTemplateName);
                      k.template = l;
                      c[j.id] = k
                  }
                  return !0
              },
              getTemplateParams: function(a) {
                  return c[a]
              }
          }
      };
      a.famdiagram.BaseTransformer = function(a) {
          this.debug = a
      };
      a.famdiagram.BaseTransformer.prototype.validate = function(a, b) {
          if (!a.validate()) throw "Family structure failed to pass validation!";
          a.loop(this, function(d, c) {
              a.loopChildren(this, d, function(d, g) {
                  if (null === g.level || null === c.level || (b ? g.level != c.level + 1 : g.level <= c.level)) throw "Family tree is broken. Children/Parents or levels mismatch!";
                  return a.SKIP
              })
          })
      };
      a.famdiagram.FamilyBalance = function() {
          this.properties =
              "title description image itemTitleColor groupTitle groupTitleColor isActive hasSelectorCheckbox hasButtons templateName showCallout calloutTemplateName label showLabel labelSize labelOrientation labelPlacement minimizedItemShapeType".split(" ")
      };
      a.famdiagram.FamilyBalance.prototype.balance = function(f) {
          var b = {
                  maximumId: null,
                  treeLevels: a.common.TreeLevels(),
                  bundles: [],
                  connectorStacks: []
              },
              d = {
                  orgTree: a.common.tree(),
                  maximumId: f.maximumId,
                  orgPartners: {},
                  itemByChildrenKey: {},
                  minimumLevel: null,
                  maximumLevel: null
              };
          this.createOrgTree(f, d);
          d.orgTree.loopLevels(this, function(a, d, f) {
              b.treeLevels.addItem(f, a, d)
          });
          this.recalcLevelsDepth(b.bundles, b.connectorStacks, b.treeLevels, d.orgTree, d.orgPartners);
          b.maximumId = d.maximumId;
          return b
      };
      a.famdiagram.FamilyBalance.prototype.Family = function(a) {
          this.id = null;
          this.familyPriority = 1;
          this.childFamilies = [];
          this.items = [];
          this.links = [];
          this.backLinks = [];
          1 == arguments.length && (this.id = a)
      };
      a.famdiagram.FamilyBalance.prototype.FamLink = function(a, b) {
          this.fromItem = a;
          this.toItem = b
      };
      a.famdiagram.FamilyBalance.prototype.createOrgTree = function(f, b) {
          var d, c, e, g, h, i, j, k, l = [],
              n, m, p, q, r, s, t, v, u, z, x = [],
              B;
          if (0 < f.logicalFamily.hasNodes()) {
              z = {};
              m = 0;
              B = [];
              f.logicalFamily.loopRoots(this, function(a) {
                  p = new this.Family(m);
                  this.extractOrgChart(a, f.logicalFamily, f.defaultItemConfig, b.orgTree, b.orgPartners, b.itemByChildrenKey, z, p);
                  x.push(p);
                  B.push(p);
                  m += 1
              });
              B.sort(function(a, b) {
                  var c = a.items[0].level,
                      d = b.items[0].level;
                  return c != d ? c - d : b.items.length - a.items.length
              });
              l = [];
              n = {};
              if (0 < x.length) {
                  h =
                      a.common.graph();
                  d = 0;
                  for (c = x.length; d < c; d += 1) {
                      p = x[d];
                      e = 0;
                      for (g = p.links.length; e < g; e += 1) i = p.links[e], j = f.logicalFamily.node(i.fromItem).familyId, k = f.logicalFamily.node(i.toItem).familyId, j != k && (h.addEdge(j, k, {
                          weight: 0
                      }), h.edge(j, k).weight += 1), x[k].backLinks.push(new this.FamLink(i.toItem, i.fromItem))
                  }
                  for (; l.length < x.length;) {
                      d = 0;
                      for (c = B.length; d < c; d += 1) p = B[d], n.hasOwnProperty(p.id) || (v = h.getSpanningTree(p.id, function(a) {
                          return -a.weight
                      }), null != v.node(p.id) ? (v.loopPostOrder(this, function(a, b, c) {
                          var b =
                              x[a],
                              d = x[c],
                              e = [];
                          null != c && (d.familyPriority += b.familyPriority);
                          e = [];
                          v.loopChildren(this, a, function(a) {
                              e.push(a)
                          });
                          e.sort(function(a, b) {
                              return x[a].familyPriority - x[b].familyPriority
                          });
                          v.arrangeChildren(a, e)
                      }), v.loopPreOrder(this, function(a) {
                          l.push(a);
                          n[a] = !0
                      })) : (l.push(p.id), n[p.id] = !0))
                  }
              }
              b.maximumId += 1;
              u = this.createOrgItem(b.orgTree, f.defaultItemConfig, b.maximumId, null, null, b.minimumLevel - 1, null);
              u.hideParentConnection = !0;
              u.hideChildrenConnection = !0;
              u.title = "internal root";
              u.isVisible = !1;
              u.isActive = !1;
              u.childIndex = 0;
              h = {};
              d = 0;
              for (c = l.length; d < c; d += 1) {
                  p = x[l[d]];
                  k = {};
                  s = u;
                  t = 0;
                  g = p.links.concat(p.backLinks);
                  for (e = 0; e < g.length; e += 1) i = g[e], j = b.orgTree.node(i.toItem), b.orgTree.node(i.fromItem), !0 === h[j.familyId] && (q = p.items[0], r = j, r.level >= q.level && b.orgTree.loopParents(this, r.id, function(a, b) {
                      r = b;
                      if (b.level < q.level) return !0
                  }), k[r.id] = k.hasOwnProperty(r.id) ? k[r.id] + 1 : 1, t < k[r.id] && (s = r, t = k[r.id]));
                  this.attachFamilyToOrgChart(b, f.defaultItemConfig, s, p);
                  h[p.id] = !0
              }
              d = this.getExtraGravity(b);
              c = this.getGrandChildren(b);
              this.balanceOrgTree(b.orgTree, d, c, f.itemsPositions, f.itemsGroups)
          }
      };
      a.famdiagram.FamilyBalance.prototype.getGrandChildren = function(a) {
          var b = {};
          a.orgTree.loopPostOrder(this, function(d, c, e) {
              a.minimumLevel = null != a.minimumLevel ? Math.min(a.minimumLevel, c.level) : c.level;
              a.maximumLevel = null != a.maximumLevel ? Math.max(a.maximumLevel, c.level) : c.level;
              if (null != e && (b[e] || (b[e] = {}), c = c.level - 1, b[e][c] = b[e][c] ? b[e][c] + 1 : 1, null != b[d]))
                  for (c in b[d]) b[d].hasOwnProperty(c) && (b[e][c] = b[e][c] ? b[e][c] + b[d][c] : b[d][c])
          });
          return b
      };
      a.famdiagram.FamilyBalance.prototype.balanceOrgTree = function(f, b, d, c, e) {
          var g, h, i, j, k, l, n, m, p, q, r;
          f.loopLevels(this, function(s, t) {
              var v = a.common.graph(),
                  u = {},
                  z = null,
                  x;
              n = [];
              f.loopChildren(this, t.id, function(a, c, d) {
                  var e;
                  null == z && (z = c);
                  u[c.id] = {};
                  if (b.hasOwnProperty(c.id))
                      for (e in l = b[c.id], l)
                          if (l.hasOwnProperty(e)) {
                              q = l[e];
                              u[c.id][e] = {};
                              g = 0;
                              for (h = q.length; g < h; g += 1) k = q[g], x = k.commonParent == t.id ? k.toParent : f.node(k.fromParent).childIndex < f.node(k.toParent).childIndex ? "__right__" : "__left__",
                                  c.id != x && (v.addEdge(c.id, x, {
                                      weight: 0
                                  }), v.edge(c.id, x).weight += 1, null == u[c.id][e][x] && (u[c.id][e][x] = 0), u[c.id][e][x] += 1)
                          }
                  0 < d && v.addEdge(c.id, z.id, {
                      weight: 0
                  })
              });
              if (null != z) {
                  r = [];
                  v.getTotalWeightGrowthSequence(this, function(a) {
                      return a.weight
                  }, function(a) {
                      r.push(a)
                  });
                  0 === r.length && (r = [z.id]);
                  m = this.balanceItems(r, "__left__", "__right__", u, d, c, e);
                  i = 0;
                  for (j = m.length; i < j; i += 1) p = f.node(m[i]), p.childIndex = i, n.push(p.id)
              }
              f.arrangeChildren(t.id, n)
          })
      };
      a.famdiagram.FamilyBalance.prototype.balanceItems = function(f,
          b, d, c, e, g, h) {
          var i = [],
              j, k = a.common.LinkedHashItems(),
              l = 0,
              n = {},
              m, p, q, r = {},
              s, t, v, u, z, x, B, y, w, A, E, D, F, C, J, K, H, G;
          p = [b, null, d];
          for (j = 0; j < p.length; j += 1) s = p[j], m = l++, q = new a.famdiagram.Slot(s), q.position = j, k.add(m, q), null !== s && (r[s] = m);
          for (j = 0; j < f.length; j += 1)
              if (s = f[j], s != b && s != d)
                  for (C in p = m = B = x = z = u = v = t = null, h.hasOwnProperty(s) && (q = h[s], n.hasOwnProperty(q) && (p = g[s], q = n[q], m = q.previousContext(p), p = q.nextContext(p))), k.iterate(function(a, b) {
                          var d, f, h, i;
                          if (null == a.itemId) {
                              D = e[s];
                              E = A = w = y = 0;
                              for (d in a.crossings) a.crossings.hasOwnProperty(d) &&
                                  (D && null != D[d] && (y += a.crossings[d] * D[d]), E += a.crossings[d]);
                              for (d in c[s])
                                  if (c[s].hasOwnProperty(d))
                                      for (f in h = c[s][d], h) h.hasOwnProperty(f) && r.hasOwnProperty(f) && (i = k.item(r[f]), null != i && (i.position < a.position ? (y += (a.left[d] || 0) - (i.left[d] || 0), A += Math.abs(i.balance + 1)) : (y += (a.right[d] || 0) - (i.right[d] || 0), A += Math.abs(i.balance - 1)), w += Math.abs(i.position - a.position)));
                              if (null == u || u > y || u == y && (z > w || z == w && (x > A || x == A && B > E))) t = b, u = y, v = a, z = w, x = A, B = E
                          }
                      }, m, p), k.insertBefore(t, l++, v.clone(null)), F = r[s] = l, m =
                      v.clone(s), g.hasOwnProperty(s) && (q = h[s], n.hasOwnProperty(q) || (n[q] = a.common.SortedList()), q = n[q], q.add(g[s], l)), k.insertBefore(t, l++, m), H = m.position = 0, k.iterate(function(a, b) {
                          var c, d;
                          if (b != F) {
                              d = e[s];
                              for (c in d) d.hasOwnProperty(c) && (a.left[c] = a.left[c] ? a.left[c] + d[c] : d[c]);
                              H += 1;
                              a.position = H
                          }
                      }, F), H = 0, k.iterateBack(function(a, b) {
                          var c, d;
                          if (b != F) {
                              d = e[s];
                              for (c in e[s]) e[s].hasOwnProperty(c) && (a.right[c] = a.right[c] ? a.right[c] + d[c] : d[c]);
                              H -= 1;
                              a.position = H
                          }
                      }, F), c[s])
                      if (c[s].hasOwnProperty(C))
                          for (K in J = c[s][C],
                              J) J.hasOwnProperty(K) && r.hasOwnProperty(K) && (G = r[K], q = k.item(G), null != q && (0 > q.position ? (q.balance += 1, m.balance -= 1, k.iterateBack(function(a, b) {
                              b != F && b != G && (a.crossings[C] = a.crossings[C] ? a.crossings[C] + J[K] : J[K])
                          }, F, G)) : (q.balance -= 1, m.balance += 1, k.iterate(function(a, b) {
                              b != F && b != G && (a.crossings[C] = a.crossings[C] ? a.crossings[C] + J[K] : J[K])
                          }, F, G))));
          k.iterate(function(a) {
              a = a.itemId;
              null != a && (a != b && a != d) && i.push(a)
          });
          return i
      };
      a.famdiagram.FamilyBalance.prototype.ExtraGravity = function(a) {
          this.toParent =
              this.fromParent = this.commonParent = null;
          this.level = a
      };
      a.famdiagram.FamilyBalance.prototype.getExtraGravity = function(a) {
          var b, d, c = {},
              e, g, h, i;
          for (b in a.orgPartners)
              if (a.orgPartners.hasOwnProperty(b)) {
                  d = a.orgTree.node(b);
                  h = a.orgPartners[b];
                  e = 0;
                  for (g = h.length; e < g; e += 1) i = a.orgTree.node(h[e]), this.addExtraGravitiesForConnection(a.orgTree, c, i, d)
              }
          return c
      };
      a.famdiagram.FamilyBalance.prototype.addExtraGravitiesForConnection = function(a, b, d, c) {
          var e = new this.ExtraGravity(d.level),
              g = new this.ExtraGravity(c.level);
          a.zipUp(this, d.id, c.id, function(a, c, d, f) {
              this.addExtraGravityForItem(b, a, e);
              this.addExtraGravityForItem(b, d, g);
              if (c == f) return e.commonParent = c, e.fromParent = a, e.toParent = d, g.commonParent = c, g.fromParent = d, g.toParent = a, !0
          })
      };
      a.famdiagram.FamilyBalance.prototype.addExtraGravityForItem = function(a, b, d) {
          a.hasOwnProperty(b) || (a[b] = {});
          null == a[b][d.level] && (a[b][d.level] = []);
          a[b][d.level].push(d)
      };
      a.famdiagram.FamilyBalance.prototype.attachFamilyToOrgChart = function(a, b, d, c) {
          for (var e = c.items[0], g = null, g = d,
                  d = d.level + 1; d < e.level; d += 1) a.maximumId += 1, g = this.createOrgItem(a.orgTree, b, a.maximumId, g.id, null, d, null), g.title = "shift", g.isVisible = !1, g.isActive = !1, g.hideParentConnection = !0, g.hideChildrenConnection = !0, c.items.push(g);
          e.hideParentConnection = !0;
          a.orgTree.adopt(g.id, e.id, e)
      };
      a.famdiagram.FamilyBalance.prototype.extractOrgChart = function(a, b, d, c, e, g, h, i) {
          var j, k = [],
              l, n, a = b.node(a),
              k = this.createOrgItem(c, d, a.id, null, i.id, a.level, a.itemConfig);
          k.hideParentConnection = !0;
          k.isVisible = a.isVisible;
          k.isActive =
              a.isActive;
          k.hideParentConnection = a.hideParentConnection;
          k.hideChildrenConnection = a.hideChildrenConnection;
          i.items.push(k);
          h[a.id] = !0;
          a.familyId = i.id;
          for (k = this.extractChildren(a, b, d, c, e, g, h, i); 0 < k.length;) {
              l = [];
              a = 0;
              for (j = k.length; a < j; a += 1) n = k[a], l = l.concat(this.extractChildren(n, b, d, c, e, g, h, i));
              k = l
          }
      };
      a.famdiagram.FamilyBalance.prototype.extractChildren = function(a, b, d, c, e, g, h, i) {
          var j = [],
              k = null,
              l = null,
              n;
          1 == b.countChildren(a.id) && (k = b.firstChild(a.id));
          null != g[k] ? (l = g[k], null == e[l.id] && (e[l.id] = []),
              e[l.id].push(a.id), i.links.push(new this.FamLink(a.id, k))) : (null != k && (g[k] = a), b.loopChildren(this, a.id, function(e, g) {
              if (h[g.id]) throw "Many to many relations should not exist at this stage";
              j.push(g);
              n = this.createOrgItem(c, d, g.id, a.id, i.id, g.level, g.itemConfig);
              n.hideParentConnection = g.hideParentConnection;
              n.hideChildrenConnection = g.hideChildrenConnection;
              n.isVisible = g.isVisible;
              n.isActive = g.isActive;
              i.items.push(n);
              h[g.id] = !0;
              g.familyId = i.id;
              return b.SKIP
          }));
          return j
      };
      a.famdiagram.FamilyBalance.prototype.createOrgItem =
          function(f, b, d, c, e, g, h) {
              var i = new a.orgdiagram.OrgItem({});
              i.id = d;
              i.familyId = e;
              i.level = g;
              d = 0;
              for (e = this.properties.length; d < e; d += 1) g = this.properties[d], i[g] = null != h && void 0 !== h[g] ? h[g] : b[g];
              f.add(c, i.id, i);
              return i
          };
      a.famdiagram.FamilyBalance.prototype.recalcLevelsDepth = function(f, b, d, c, e) {
          var g, h, i, j, k, l, n, m, p, q = {},
              r, s, t;
          d.loopLevels(this, function(v) {
              var u = new a.orgdiagram.TreeLevelConnectorStackSize;
              b[v] = u;
              p = [];
              d.loopLevelItems(this, v, function(b, d) {
                  var i = [],
                      l = [],
                      n;
                  if (!q.hasOwnProperty(b)) {
                      q[b] = !0;
                      d.hideChildrenConnection || i.push(b);
                      n = e[b];
                      if (null != n) {
                          g = 0;
                          for (h = n.length; g < h; g += 1) {
                              var j = n[g];
                              q[j] = !0;
                              i.push(j)
                          }
                      }
                      c.loopChildren(this, b, function(a, b) {
                          b.hideParentConnection || l.push(a)
                      });
                      if (1 < i.length || 0 < l.length) m = new a.common.VerticalConnectorBundle(i, l), f.push(m), 1 < i.length && p.push(m)
                  }
              });
              if (0 < p.length) {
                  t = a.common.pile();
                  i = 0;
                  for (j = p.length; i < j; i += 1) {
                      m = p[i];
                      s = r = null;
                      k = 0;
                      for (l = m.fromItems.length; k < l; k += 1) n = d.getItemPosition(m.fromItems[k]), r = null != r ? Math.min(r, n) : n, s = null != s ? Math.max(s, n) : n;
                      t.add(r,
                          s, m)
                  }
                  u.parentsStackSize = t.resolve(this, function(a, b, c, d, e) {
                      c.fromOffset = d + 1;
                      c.fromStackSize = e
                  })
              }
          })
      };
      a.famdiagram.FamilyMatrixesExtractor = function(f) {
          this.parent = a.famdiagram.BaseTransformer.prototype;
          this.parent.constructor.apply(this, arguments)
      };
      a.famdiagram.FamilyMatrixesExtractor.prototype = new a.famdiagram.BaseTransformer;
      a.famdiagram.FamilyMatrixesExtractor.prototype.extract = function(f, b, d, c, e, g) {
          0 < b.hasNodes() && f.enableMatrixLayout && b.groupBy(this, Math.max(2, f.minimumMatrixSize), function(h, i,
              j, k) {
              var l = g += 1,
                  n = g += 1,
                  m = b.node(j[0]),
                  m = new a.famdiagram.FamilyItem({
                      id: l,
                      level: m.level,
                      isVisible: !1,
                      isActive: !1,
                      itemConfig: {
                          title: "dummy #" + l,
                          description: "This is item used as aggregator of matrixed nodes."
                      },
                      levelGravity: 1,
                      hideParentConnection: !0,
                      hideChildrenConnection: !0
                  });
              c[l] = n;
              for (var p = 0, q = j.length; p < q; p += 1) b.removeNode(j[p]);
              null != h ? (b.add([h], l, m), m.hideParentConnection = !1, e.push(new a.common.MatrixConnectorBundle(!0, j, l, l, this.getMatrixWidth(f.maximumColumnsInMatrix, j.length)))) : b.add(null,
                  l, m);
              null != i && (b.adopt([l], i), m.hideChildrenConnection = !1, e.push(new a.common.MatrixConnectorBundle(!1, j, l, n, this.getMatrixWidth(f.maximumColumnsInMatrix, j.length))));
              d[l] = k
          });
          return g
      };
      a.famdiagram.FamilyMatrixesExtractor.prototype.getMatrixWidth = function(a, b) {
          return Math.min(a, Math.ceil(Math.sqrt(b)))
      };
      a.famdiagram.FamilyNormalizer = function(f) {
          this.parent = a.famdiagram.BaseTransformer.prototype;
          this.parent.constructor.apply(this, arguments)
      };
      a.famdiagram.FamilyNormalizer.prototype = new a.famdiagram.BaseTransformer;
      a.famdiagram.FamilyNormalizer.prototype.normalize = function(f, b, d) {
          if (0 < b.hasNodes()) {
              b.loopLevels(this, 1 == f.groupByType, function(a, b, d) {
                  b.level = d
              });
              b.optimizeReferences(function() {
                  d += 1;
                  return new a.famdiagram.FamilyItem({
                      id: d,
                      isVisible: !1,
                      isActive: !1,
                      itemConfig: {
                          title: "bundle #" + d,
                          description: " This item was created by references optimizer."
                      },
                      levelGravity: 2
                  })
              });
              if (this.debug && !b.validate()) throw "References are broken in family structure!";
              if (this.debug && b.hasLoops()) throw "Structure has loops!";
              b.eliminateManyToMany(function() {
                  d +=
                      1;
                  return new a.famdiagram.FamilyItem({
                      id: d,
                      isVisible: !1,
                      isActive: !1,
                      itemConfig: {
                          title: "dummy #" + d,
                          description: "This is item used to eliminate M:M relations."
                      },
                      levelGravity: 2,
                      hideParentConnection: !1,
                      hideChildrenConnection: !1
                  })
              });
              if (this.debug && !b.validate()) throw "References are broken in family structure!";
              f.alignBylevels ? this.resortItemsBylevels(b) : b.loopLevels(this, 1 == f.groupByType, function(a, b, d) {
                  b.level = d
              });
              this.debug && this.validate(b, !1);
              this.fillInItems(b, function() {
                  d += 1;
                  return new a.famdiagram.FamilyItem({
                      id: d,
                      levelGravity: 2,
                      isVisible: !1,
                      isActive: !1,
                      itemConfig: {
                          title: "extension #" + d,
                          description: "This is item used to fill gaps in levels."
                      }
                  })
              });
              this.debug && this.validate(b, !0)
          }
          return d
      };
      a.famdiagram.FamilyNormalizer.prototype.resortItemsBylevels = function(a) {
          var b = [],
              d = null,
              c = null,
              e, g;
          a.loop(this, function(a, e) {
              e.originalLevel = e.level;
              e.level = null;
              null != e.originalLevel && (b[e.originalLevel] || (b[e.originalLevel] = {}), b[e.originalLevel][a] = e, d = null != d ? Math.min(e.originalLevel, d) : e.originalLevel, c = null != c ? Math.max(e.originalLevel,
                  c) : e.originalLevel)
          });
          for (e = d; e <= c; e += 1) g = b[e], this.setLevelsForItems(g, a);
          a.loopTopo(this, function(b, c) {
              var d;
              1 == c.levelGravity && (d = null, a.loopParents(this, b, function(b, c) {
                  d = null == d ? c.level + 1 : Math.max(c.level + 1, d);
                  return a.SKIP
              }), c.level = !d ? c.level : d)
          })
      };
      a.famdiagram.FamilyNormalizer.prototype.setLevelsForItems = function(f, b) {
          var d = 0,
              c, e, g;
          for (c in f) f.hasOwnProperty(c) && b.loopParents(this, c, function(a, c) {
              d = Math.max(c.level + 1, d);
              return b.SKIP
          });
          for (c in f) f.hasOwnProperty(c) && (e = f[c], e.level = d);
          for (; !a.common.isEmptyObject(f);) {
              g = {};
              for (c in f) f.hasOwnProperty(c) && (e = f[c], b.loopChildren(this, c, function(a, c) {
                  if (null == c.originalLevel || c.isLevelNeutral) c.level = null == c.level ? e.level + 1 : Math.max(c.level, e.level + 1), g[a] = c;
                  return b.SKIP
              }));
              f = g
          }
      };
      a.famdiagram.FamilyNormalizer.prototype.fillInItems = function(a, b) {
          var d;
          a.loop(this, function(c, e) {
              for (var g = !0, h; g;) g = !1, h = [], a.loopParents(this, c, function(b, c) {
                  e.level - 1 > c.level && h.push(b);
                  return a.SKIP
              }), 1 < h.length && (d = b(e), d.level = e.level - 1, d.hideParentConnection = !1, d.hideChildrenConnection = !1, a.bundleParents(c, h, d.id, d), g = !0, c = d.id, e = d)
          });
          a.loop(this, function(c, e) {
              for (var g = !0, h, i = !0; g;) g = !1, h = [], a.loopChildren(this, c, function(b, c) {
                  e.level + 1 < c.level ? h.push(b) : i = !1;
                  return a.SKIP
              }), 1 < h.length && (d = b(e), d.level = e.level + 1, i && (d.hideParentConnection = !1, d.hideChildrenConnection = !1), a.bundleChildren(c, h, d.id, d), g = !0, c = d.id, e = d)
          });
          a.loop(this, function(c, e) {
              for (var g = !0, h; g;) g = !1, h = [], a.loopParents(this, c, function(b, c) {
                  e.level - 1 > c.level && h.push(b);
                  return a.SKIP
              }), 0 < h.length && (d = b(e), d.level =
                  e.level - 1, d.hideParentConnection = !1, d.hideChildrenConnection = !1, a.bundleParents(c, h, d.id, d), g = !0, c = d.id, e = d)
          })
      };
      a.famdiagram.UserDefinedNodesOrder = function() {};
      a.famdiagram.UserDefinedNodesOrder.prototype.getUserDefinedPositions = function(f) {
          function b(a, b) {
              this.position = a;
              this.items = b
          }
          var d, c, e, g = a.common.tree(),
              h = {};
          c = 0;
          for (e = f.length; c < e; c += 1) d = f[c], null != d.relativeItem && (h[d.relativeItem] = !0), null != d.id && (h[d.id] = !0);
          c = 0;
          for (e = f.length; c < e; c += 1) d = f[c], h.hasOwnProperty(d.id) && g.add(d.relativeItem ||
              null, d.id, d);
          var i = {},
              j = {},
              k = {};
          g.loopPostOrder(this, function(a, c, d) {
              var e = [],
                  f = j[a],
                  h = k[a],
                  g;
              if (null != f) {
                  f.sort(function(a, b) {
                      return b.position - a.position
                  });
                  for (g = 0; g < f.length; g += 1) e = e.concat(f[g].items)
              }
              e.push(a);
              if (null != h) {
                  h.sort(function(a, b) {
                      return a.position - b.position
                  });
                  for (g = 0; g < h.length; g += 1) e = e.concat(h[g].items)
              }
              null != d ? 2 == c.placementType ? (j.hasOwnProperty(d) || (j[d] = []), j[d].push(new b(c.position, e))) : (k.hasOwnProperty(d) || (k[d] = []), k[d].push(new b(c.position, e))) : i[a] = e
          });
          d = {};
          e = {};
          for (var l in i)
              if (i.hasOwnProperty(l)) {
                  f =
                      i[l];
                  for (c = 0; c < f.length; c += 1) g = f[c], d[g] = c, e[g] = l
              }
          return {
              position: d,
              group: e
          }
      };
      a.common.BaseLayout = function(a, b) {
          this._children = {};
          if (null != this.params)
              for (var d in this.params) this.params.hasOwnProperty(d) && a.hasOwnProperty(d) && (this.params[d] = a[d]);
          if (null != this.options) {
              for (d in this.options) this.options.hasOwnProperty(d) && b.hasOwnProperty(d) && (this.options[d] = b[d]);
              this.options.shifts = this.getShifts(this.options);
              this.options.intervals = this.getIntervals(this.options)
          }
      };
      a.common.BaseLayout.prototype.add =
          function(a, b) {
              this._children[a] = b
          };
      a.common.BaseLayout.prototype.getLayout = function(a) {
          return this._children[a] || null
      };
      a.common.BaseLayout.prototype.getShifts = function(a) {
          var b = [];
          b[1] = a.normalLevelShift;
          b[2] = a.dotLevelShift;
          b[3] = a.lineLevelShift;
          b[4] = a.lineLevelShift;
          return b
      };
      a.common.BaseLayout.prototype.getIntervals = function(a) {
          var b = [];
          b[1] = a.normalItemsInterval;
          b[2] = a.dotItemsInterval;
          b[3] = a.lineItemsInterval;
          b[4] = a.lineItemsInterval;
          return b
      };
      a.common.BaseLayout.prototype.getItemSize = function(f,
          b, d, c) {
          var e, g;
          switch (f) {
              case 1:
                  f = d.template.templateConfig;
                  e = new a.common.Size(f.itemSize);
                  g = new a.common.Rect(0, 0, e.width, e.height);
                  b && (e.height += f.cursorPadding.top + f.cursorPadding.bottom, e.width += f.cursorPadding.left + f.cursorPadding.right, g.x = f.cursorPadding.left, g.y = f.cursorPadding.top);
                  d.hasSelectorCheckbox && (e.height += c.checkBoxPanelSize);
                  if (d.hasButtons) switch (e.width += c.buttonsPanelSize, c.groupTitlePlacementType) {
                      case 3:
                          g.x += c.buttonsPanelSize
                  }
                  if (d.hasGroupTitle) switch (e.width += c.groupTitlePanelSize,
                      c.groupTitlePlacementType) {
                      case 3:
                          break;
                      default:
                          g.x += c.groupTitlePanelSize
                  }
                  break;
              case 2:
                  f = d.template.templateConfig;
                  e = new a.common.Size(f.minimizedItemSize);
                  break;
              case 3:
              case 4:
                  e = new a.common.Size
          }
          switch (c.orientationType) {
              case 2:
              case 3:
                  e.invert()
          }
          return {
              actualSize: e,
              contentPosition: g
          }
      };
      a.famdiagram.FamilyLayout = function(f, b) {
          this.params = {
              logicalFamily: null,
              treeLevels: null,
              getConnectorsStacksSizes: null,
              isItemSelected: null,
              cursorItemId: null,
              getTemplateParams: null
          };
          this.options = {
              verticalAlignment: 1,
              pageFitMode: 0,
              minimalVisibility: 2,
              orientationType: 0,
              arrowsDirection: 0,
              linesWidth: 1,
              checkBoxPanelSize: 24,
              buttonsPanelSize: 28,
              groupTitlePanelSize: 24,
              groupTitlePlacementType: 2,
              normalLevelShift: 20,
              dotLevelShift: 20,
              lineLevelShift: 20,
              normalItemsInterval: 10,
              dotItemsInterval: 1,
              lineItemsInterval: 2
          };
          this.data = {
              treeItemsPositions: {},
              treeLevelsPositions: []
          };
          this.parent = a.common.BaseLayout.prototype;
          this.parent.constructor.apply(this, arguments)
      };
      a.famdiagram.FamilyLayout.prototype = new a.common.BaseLayout;
      a.famdiagram.FamilyLayout.prototype.measure =
          function(f) {
              var b = new a.common.Rect(0, 0, 0, 0),
                  d, c, e = {
                      treeItemsPositions: {},
                      treeLevelsPositions: []
                  };
              switch (this.options.orientationType) {
                  case 2:
                  case 3:
                      f.invert()
              }
              if (!this.params.treeLevels.isEmpty()) switch (this.options.pageFitMode) {
                  case 0:
                  case a.common.PageFitMode.PrintPreview:
                  case 5:
                      d = [new a.orgdiagram.LevelVisibility(0, 1)];
                      b = this.setTreeLevelsVisibilityAndPositionTreeItems(e, this.params, this.options, d, 0);
                      break;
                  default:
                      d = this.getLevelVisibilities(this.params.treeLevels, this.options.minimalVisibility),
                          c = this.setTreeLevelsVisibilityAndPositionTreeItems(e, this.params, this.options, d, d.length - 1), this.checkDiagramSize(c, f, this.options.pageFitMode) ? (c.addRect(f), c.offset(0, 0, 5, 5), this.findOptimalSize(this, d.length - 1, function(a) {
                              b = this.setTreeLevelsVisibilityAndPositionTreeItems(e, this.params, this.options, d, a);
                              return this.checkDiagramSize(b, c, this.options.pageFitMode)
                          })) : b = c
              }
              this.data = e;
              return b
          };
      a.famdiagram.FamilyLayout.prototype.getLevelVisibilities = function(f, b) {
          var d = [new a.orgdiagram.LevelVisibility(0,
                  1)],
              c = [];
          switch (b) {
              case 2:
                  c.push(2);
                  break;
              case 0:
              case 3:
              case 4:
                  c.push(2), c.push(3)
          }
          f.loopLevelsReversed(this, function(b) {
              for (var f = 0; f < c.length; f += 1) d.push(new a.orgdiagram.LevelVisibility(b, c[f]))
          });
          return d
      };
      a.famdiagram.FamilyLayout.prototype.findOptimalSize = function(a, b, d) {
          var c = 0,
              e;
          if (!d.call(a, c)) {
              for (e = b; 1 < b - c;) e = Math.floor((b + c) / 2), d.call(a, e) ? b = e : c = e;
              b !== e && d.call(a, b)
          }
      };
      a.famdiagram.FamilyLayout.prototype.setTreeLevelsVisibilityAndPositionTreeItems = function(f, b, d, c, e) {
          var g, h;
          f.treeLevelsPositions = [];
          b.treeLevels.loopLevels(this, function() {
              var b = new a.orgdiagram.TreeLevelPosition;
              b.currentvisibility = 1;
              f.treeLevelsPositions.push(b)
          });
          for (g = 0; g <= e; g += 1) h = c[g], f.treeLevelsPositions[h.level].currentvisibility = h.currentvisibility;
          f.treeItemsPositions = {};
          this.recalcItemsSize(b.treeLevels, f.treeItemsPositions, f.treeLevelsPositions, b.isItemSelected, b.cursorItemId, b.getTemplateParams, d);
          this.setOffsets(b.treeLevels, f.treeItemsPositions, f.treeLevelsPositions, b.logicalFamily, d.intervals);
          this.recalcLevelsDepth(b.treeLevels,
              f.treeItemsPositions, f.treeLevelsPositions, d.verticalAlignment);
          this.shiftLevels(f.treeLevelsPositions, d.shifts[3], d.shifts, d.arrowsDirection, d.linesWidth, b.getConnectorsStacksSizes);
          return this.getLayoutSize(b.treeLevels, f.treeItemsPositions, f.treeLevelsPositions)
      };
      a.famdiagram.FamilyLayout.prototype.checkDiagramSize = function(a, b, d) {
          var c = !1;
          switch (d) {
              case 1:
                  b.width >= a.width && (c = !0);
                  break;
              case 2:
                  b.height >= a.height && (c = !0);
                  break;
              case 3:
                  b.height >= a.height && b.width >= a.width && (c = !0)
          }
          return c
      };
      a.famdiagram.FamilyLayout.prototype.getLayoutSize =
          function(f, b, d) {
              return new a.common.Rect(0, 0, Math.round(this.getLayoutWidth(f, b)), Math.round(this.getLayoutHeight(d)))
          };
      a.famdiagram.FamilyLayout.prototype.getLayoutWidth = function(a, b) {
          var d = 0;
          a.loopLevels(this, function(c) {
              var e = a.getLevelLength(c);
              0 < e && (c = a.getItemAtPosition(c, e - 1), c = b[c], d = Math.max(d, c.offset + c.actualSize.width + c.rightPadding))
          });
          return d
      };
      a.famdiagram.FamilyLayout.prototype.getLayoutHeight = function(a) {
          a = a[a.length - 1];
          return a.shift + a.nextLevelShift
      };
      a.famdiagram.FamilyLayout.prototype.recalcItemsSize =
          function(f, b, d, c, e, g, h) {
              f.loopLevels(this, function(i) {
                  var j = d[i];
                  f.loopLevelItems(this, i, function(d, f) {
                      var i = new a.orgdiagram.TreeItemPosition,
                          m = this.getLayout(d);
                      if (null == m) {
                          var p = c(d) ? 1 : !f.isVisible ? 4 : 0,
                              m = g(d),
                              p = 0 === p ? j.currentvisibility : p,
                              m = this.getItemSize(p, e == d, m, h);
                          i.actualVisibility = p;
                          i.actualSize = m.actualSize;
                          i.contentPosition = m.contentPosition
                      } else m = m.measure(j.currentvisibility), i.actualVisibility = 4, i.actualSize = m;
                      b[d] = i
                  })
              })
          };
      a.famdiagram.FamilyLayout.prototype.recalcLevelsDepth = function(a,
          b, d, c) {
          var e, g;
          a.loopLevels(this, function(h) {
              var i = d[h];
              i.shift = 0;
              i.depth = 0;
              i.actualVisibility = 4;
              g = e = null;
              a.loopLevelItems(this, h, function(a) {
                  a = b[a];
                  i.depth = Math.max(i.depth, a.actualSize.height);
                  switch (a.actualVisibility) {
                      case 2:
                      case 3:
                      case 4:
                          g = !g ? a.actualSize.height : Math.min(g, a.actualSize.height);
                          break;
                      default:
                          e = !e ? a.actualSize.height : Math.min(e, a.actualSize.height)
                  }
                  i.actualVisibility = Math.min(i.actualVisibility, a.actualVisibility)
              });
              null == e && (e = i.depth);
              null != g && g > e && (e = g);
              switch (c) {
                  case 0:
                      i.horizontalConnectorsDepth =
                          e / 2;
                      break;
                  case 1:
                      i.horizontalConnectorsDepth = i.depth / 2;
                      break;
                  case 2:
                      i.horizontalConnectorsDepth = i.depth - e / 2
              }
          })
      };
      a.famdiagram.FamilyLayout.prototype.shiftLevels = function(a, b, d, c, e, g) {
          var h, i, j = 0,
              k = 0,
              e = 8 * e;
          switch (c) {
              case 1:
                  j = e;
                  k = 0;
                  break;
              case 2:
                  j = 0, k = e
          }
          c = 0;
          for (e = a.length; c < e; c += 1) h = a[c], i = g(c), b += h.setShift(b, d[h.actualVisibility], k, j, i.parentsStackSize)
      };
      a.famdiagram.FamilyLayout.prototype.setOffsets = function(f, b, d, c, e) {
          var g, h;
          g = 0;
          for (h = d.length; g < h; g += 1) d[g].currentOffset = 0;
          var d = c.getPlanarFamily(f),
              i = new a.common.FamilyAlignment(this, d, f, function(a) {
                  var a = b[a],
                      c = e[a.actualVisibility] / 2;
                  a.leftPadding = c;
                  a.rightPadding = c;
                  return a.leftPadding + a.actualSize.width + a.rightPadding
              }),
              j = null;
          f.loopLevels(this, function(a) {
              a = f.getItemAtPosition(a, 0);
              if (null != a) {
                  var c = b[a],
                      a = i.getOffset(a) - c.leftPadding - c.actualSize.width / 2;
                  j = null == j ? a : Math.min(j, a)
              }
          });
          f.loopLevels(this, function(a) {
              f.loopLevelItems(this, a, function(a) {
                  var c = b[a],
                      a = i.getOffset(a);
                  c.offset = a - c.actualSize.width / 2;
                  c.offset -= j
              })
          })
      };
      a.famdiagram.FamilyLayout.prototype.arrange =
          function(a, b) {
              var d = null;
              null != b && this.params.treeLevels.loopLevels(this, function(c) {
                  var e = this.data.treeLevelsPositions[c];
                  this.params.treeLevels.loopLevelItems(this, c, function(c) {
                      var h = this.data.treeItemsPositions[c],
                          i = this.getItemPosition(h.actualVisibility, h.offset, h.actualSize, d, e, this.options.verticalAlignment);
                      h.actualPosition = i.position;
                      h.horizontalConnectorsShift = i.horizontalConnectorsShift;
                      h.topConnectorShift = i.topConnectorShift;
                      h.topConnectorInterval = i.topConnectorInterval;
                      h.bottomConnectorShift =
                          i.bottomConnectorShift;
                      h.bottomConnectorInterval = i.bottomConnectorInterval;
                      b.call(a, c, h);
                      c = this.getLayout(c);
                      null != c && c.arrange(a, i.position, b)
                  });
                  d = e
              })
          };
      a.famdiagram.FamilyLayout.prototype.getItemPosition = function(f, b, d, c, e, g) {
          var h = 0;
          switch (f) {
              case 1:
                  switch (g) {
                      case 0:
                          h = 0;
                          break;
                      case 1:
                          h = (e.depth - d.height) / 2;
                          break;
                      case 2:
                          h = e.depth - d.height
                  }
                  break;
              case 2:
              case 3:
              case 4:
                  h = e.horizontalConnectorsDepth - d.height / 2
          }
          return {
              position: new a.common.Rect(b, e.shift + h, d.width, d.height),
              horizontalConnectorsShift: e.shift +
                  e.horizontalConnectorsDepth,
              topConnectorShift: null != c ? c.shift + c.connectorShift : null,
              topConnectorInterval: null != c ? c.levelSpace / 2 : null,
              bottomConnectorShift: e.shift + e.connectorShift,
              bottomConnectorInterval: e.levelSpace / 2
          }
      };
      a.famdiagram.MatrixLayout = function(f, b) {
          this.params = {
              items: [],
              isItemSelected: null,
              cursorItemId: null,
              getTemplateParams: null,
              hideParentConnection: !1,
              hideChildrenConnection: !1
          };
          this.options = {
              verticalAlignment: 1,
              orientationType: 0,
              arrowsDirection: 0,
              linesWidth: 1,
              checkBoxPanelSize: 24,
              buttonsPanelSize: 28,
              groupTitlePanelSize: 24,
              groupTitlePlacementType: 2,
              normalLevelShift: 20,
              dotLevelShift: 20,
              lineLevelShift: 20,
              normalItemsInterval: 10,
              dotItemsInterval: 1,
              lineItemsInterval: 2,
              maximumColumnsInMatrix: 6
          };
          this.data = {
              treeItemsPositions: {},
              columns: [],
              rows: []
          };
          this.parent = a.common.BaseLayout.prototype;
          this.parent.constructor.apply(this, arguments)
      };
      a.famdiagram.MatrixLayout.prototype = new a.common.BaseLayout;
      a.famdiagram.MatrixLayout.prototype.Column = function() {
          this.rightPadding = this.leftPadding = this.offset = this.depth =
              0
      };
      a.famdiagram.MatrixLayout.prototype.Row = function() {
          this.horizontalConnectorsDepth = this.offset = this.depth = 0;
          this.dotsDepth = this.minimalDepth = null
      };
      a.famdiagram.MatrixLayout.prototype.getMatrixWidth = function(a, b) {
          return Math.min(a, Math.ceil(Math.sqrt(b)))
      };
      a.famdiagram.MatrixLayout.prototype.measure = function(a) {
          var b = {
              treeItemsPositions: {},
              columns: [],
              rows: []
          };
          this.measureItems(b, this.params, this.options, a);
          this.measureColumns(b, this.params, this.options);
          this.measureRows(b, this.params, this.options);
          this.data = b;
          return this.getLayoutSize(b)
      };
      a.famdiagram.MatrixLayout.prototype.measureItems = function(f, b, d, c) {
          for (var e = 0, g = b.items.length; e < g; e += 1) {
              var h = b.items[e],
                  i = h.id,
                  j = new a.orgdiagram.TreeItemPosition,
                  k = b.isItemSelected(i) ? 1 : !h.isVisible ? 4 : 0,
                  h = b.getTemplateParams(i),
                  k = 0 === k ? c : k,
                  h = this.getItemSize(k, b.cursorItemId == i, h, d);
              j.actualVisibility = k;
              j.actualSize = h.actualSize;
              j.contentPosition = h.contentPosition;
              f.treeItemsPositions[i] = j
          }
      };
      a.famdiagram.MatrixLayout.prototype.measureColumns = function(a,
          b, d) {
          var c, e, g, h = this.getMatrixWidth(d.maximumColumnsInMatrix, b.items.length);
          e = 0;
          for (g = b.items.length; e < g; e += 1) {
              var i = a.treeItemsPositions[b.items[e].id];
              c = d.intervals[i.actualVisibility] / 2;
              i.leftPadding = c;
              i.rightPadding = c;
              var j = e % h;
              c = a.columns[j];
              null == c && (c = new this.Column, a.columns[j] = c);
              c.depth = Math.max(c.depth, i.leftPadding + i.actualSize.width + i.rightPadding)
          }
          h = 8 * d.linesWidth;
          e = i = 0;
          for (g = a.columns.length; e < g; e += 1) {
              c = a.columns[e];
              if (0 == e % 2) switch (d.arrowsDirection) {
                  case 1:
                      c.leftPadding = b.hideChildrenConnection ?
                          0 : h;
                      c.rightPadding = 0;
                      break;
                  case 2:
                      c.leftPadding = 0, c.rightPadding = b.hideParentConnection ? 0 : h
              } else switch (d.arrowsDirection) {
                  case 1:
                      c.leftPadding = 0;
                      c.rightPadding = b.hideChildrenConnection ? 0 : h;
                      break;
                  case 2:
                      c.leftPadding = b.hideParentConnection ? 0 : h, c.rightPadding = 0
              }
              c.offset = i + c.leftPadding + c.depth / 2;
              i = c.offset + c.depth / 2 + c.rightPadding
          }
      };
      a.famdiagram.MatrixLayout.prototype.measureRows = function(a, b, d) {
          var c, e, g, h = this.getMatrixWidth(d.maximumColumnsInMatrix, b.items.length);
          c = 0;
          for (e = b.items.length; c < e; c +=
              1) {
              var i = a.treeItemsPositions[b.items[c].id],
                  j = Math.floor(c / h),
                  k = d.shifts[i.actualVisibility] / 2;
              g = a.rows[j];
              null == g && (g = new this.Row, a.rows[j] = g);
              g.depth = Math.max(g.depth, k + i.actualSize.height + k);
              switch (i.actualVisibility) {
                  case 2:
                  case 3:
                  case 4:
                      g.dotsDepth = !g.dotsDepth ? i.actualSize.height : Math.min(g.dotsDepth, i.actualSize.height);
                      break;
                  default:
                      g.minimalDepth = !g.minimalDepth ? i.actualSize.height : Math.min(g.minimalDepth, i.actualSize.height)
              }
          }
          c = b = 0;
          for (e = a.rows.length; c < e; c += 1) switch (g = a.rows[c], g.offset =
              b + g.depth / 2, b = g.offset + g.depth / 2, null == g.minimalDepth && (g.minimalDepth = g.depth), null != g.dotsDepth && g.dotsDepth > g.minimalDepth && (g.minimalDepth = g.dotsDepth), d.verticalAlignment) {
              case 0:
                  g.horizontalConnectorsDepth = g.minimalDepth / 2;
                  break;
              case 1:
                  g.horizontalConnectorsDepth = g.depth / 2;
                  break;
              case 2:
                  g.horizontalConnectorsDepth = g.depth - g.minimalDepth / 2
          }
      };
      a.famdiagram.MatrixLayout.prototype.getLayoutSize = function(f) {
          return new a.common.Rect(0, 0, Math.round(this.getLayoutWidth(f)), Math.round(this.getLayoutHeight(f)))
      };
      a.famdiagram.MatrixLayout.prototype.getLayoutWidth = function(a) {
          var b = 0,
              d = a.columns.length;
          0 < d && (a = a.columns[d - 1], b = a.offset + a.depth / 2 + a.rightPadding);
          return b
      };
      a.famdiagram.MatrixLayout.prototype.getLayoutHeight = function(a) {
          var b = 0,
              d = a.rows.length;
          0 < d && (a = a.rows[d - 1], b = a.offset + a.depth / 2);
          return b
      };
      a.famdiagram.MatrixLayout.prototype.arrange = function(a, b, d) {
          if (null != d)
              for (var c = this.getMatrixWidth(this.options.maximumColumnsInMatrix, this.params.items.length), e = 0, g = this.params.items.length; e < g; e +=
                  1) {
                  var h = this.params.items[e].id,
                      i = this.data.columns[e % c],
                      j = this.data.rows[Math.floor(e / c)],
                      k = this.data.treeItemsPositions[h],
                      l = this.getItemPosition(k.actualVisibility, i, j, k.actualSize, this.options);
                  l.translate(b.x, b.y);
                  k.actualPosition = l;
                  k.horizontalConnectorsShift = b.y + j.offset - j.depth / 2 + j.horizontalConnectorsDepth;
                  k.leftMedianOffset = i.depth / 2 + i.leftPadding;
                  k.rightMedianOffset = i.depth / 2 + i.rightPadding;
                  k.topConnectorShift = j.depth / 2;
                  k.bottomConnectorShift = j.depth / 2;
                  d.call(a, h, k)
              }
      };
      a.famdiagram.MatrixLayout.prototype.getItemPosition =
          function(f, b, d, c, e) {
              var g = 0;
              switch (f) {
                  case 1:
                      switch (e.verticalAlignment) {
                          case 0:
                              g = 0;
                              break;
                          case 1:
                              g = (d.depth - c.height) / 2;
                              break;
                          case 2:
                              g = d.depth - c.height
                      }
                      break;
                  case 2:
                  case 3:
                  case 4:
                      g = d.horizontalConnectorsDepth - c.height / 2
              }
              return new a.common.Rect(b.offset - c.width / 2, d.offset - d.depth / 2 + g, c.width, c.height)
          };
      a.famdiagram.CursorNeighboursTask = function(f, b, d, c) {
          function e(a, b, c, d) {
              var e = [],
                  f = {};
              if (null !== a) switch (b) {
                  case 0:
                      c.loopParents(this, a, function(a) {
                          f.hasOwnProperty(a) || (f[a] = !0, e.push(a));
                          if (d.hasOwnProperty(a)) return c.SKIP
                      });
                      c.loopChildren(this, a, function(a) {
                          f.hasOwnProperty(a) || (f[a] = !0, e.push(a));
                          if (d.hasOwnProperty(a)) return c.SKIP
                      });
                      break;
                  case 1:
                      c.loopNeighbours(this, a, function(a) {
                          f.hasOwnProperty(a) || (f[a] = !0, e.push(a));
                          if (d.hasOwnProperty(a)) return !0
                      })
              }
              return e
          }
          var g = [],
              h = {},
              i = new a.common.ArrayReader(new a.common.ValueReader(["string", "number"], !0), !0);
          return {
              process: function() {
                  var a = {
                          isChanged: !1,
                          hash: h
                      },
                      k = f.getCursorTreeItem(),
                      l = d.getNavigationFamily(),
                      n = b.getNeighboursSelectionMode(),
                      m = c.getActiveItems();
                  g =
                      i.read(g, e(k, n, l, m), "items", a);
                  return a.isChanged
              },
              getItems: function() {
                  return g
              }
          }
      };
      a.famdiagram.AddLabelAnnotationsTask = function(f, b) {
          function d(b, c) {
              var d = a.common.graph(),
                  e = {},
                  f, l, n, m;
              if (0 < c.length) {
                  m = 0;
                  for (f = c.length; m < f; m += 1) l = c[m], e.hasOwnProperty(l.fromItem) ? e[l.fromItem].push(l) : (e[l.fromItem] = [l], b.loopChildren(this, l.fromItem, function(c) {
                      d.addEdge(l.fromItem, c, new a.famdiagram.EdgeItem(l.fromItem, l.fromItem, c, c));
                      return b.SKIP
                  }), b.loopParents(this, l.fromItem, function(c) {
                      d.addEdge(c, l.fromItem,
                          new a.famdiagram.EdgeItem(c, c, l.fromItem, l.fromItem));
                      return b.SKIP
                  }));
                  for (n in e)
                      if (e.hasOwnProperty(n)) {
                          f = e[n];
                          f.sort(function(a, b) {
                              return b.toItems.length - a.toItems.length
                          });
                          for (m = 0; m < f.length; m += 1) {
                              l = f[m];
                              for (var p = b, q = d, r = l.fromItem, s = l.toItems, t = void 0, v = !0, u = null, z = void 0, x = void 0, B = void 0, y = void 0, w = [], x = 0, B = s.length; x < B; x += 1)
                                  if (z = s[x], t = q.edge(r, z), null != t) {
                                      if (null == u) u = t.getFar(z);
                                      else if (u != t.getFar(z)) {
                                          v = !1;
                                          break
                                      }
                                      w.push(t.getNear(z))
                                  } else {
                                      v = !1;
                                      break
                                  }
                              if (v && (y = new a.famdiagram.FamilyItem({
                                      id: l.id,
                                      isVisible: !0,
                                      isLevelNeutral: !0,
                                      isActive: !1,
                                      itemConfig: l
                                  }), p.bundleParents(u, w, y.id, y) ? (y.levelGravity = 2, v = !0) : p.bundleChildren(u, w, y.id, y) ? (y.levelGravity = 1, v = !0) : p.bundleParents(u, s, y.id, y) ? (y.levelGravity = 2, v = !0) : p.bundleParents(u, s, y.id, y) && (y.levelGravity = 1, v = !0), v)) {
                                  x = 0;
                                  for (B = s.length; x < B; x += 1) z = s[x], t = q.edge(r, z), t.setFar(z, y.id)
                              }
                          }
                      }
              }
          }
          var c = null,
              e = null;
          return {
              process: function(a) {
                  var h = b.getLogicalFamily(),
                      i = f.getAnnotations(),
                      h = h.clone();
                  d(h, i);
                  c = h;
                  e = f.getMaximumId();
                  if (a && !h.validate()) throw "References are broken in family structure!";
                  return !0
              },
              getNavigationFamily: function() {
                  return c
              },
              getMaximumId: function() {
                  return e
              }
          }
      };
      a.famdiagram.AddSpousesTask = function(f, b) {
          var d = null,
              c = null;
          return {
              process: function(e) {
                  var g = b.getLogicalFamily(),
                      h = b.getMaximumId(),
                      i = f.getItems(),
                      j = g = g.clone(),
                      k, l, n, m, p, q, r, s;
                  n = 0;
                  for (m = i.length; n < m; n += 1) {
                      p = i[n];
                      s = p.spouses.slice(0);
                      q = 0;
                      for (r = s.length; q < r; q += 1) k = [p.id, s[q]], j.hasCommonChild(k) || (h += 1, l = new a.famdiagram.FamilyItem({
                          id: h,
                          isVisible: !1,
                          isActive: !1,
                          isLevelNeutral: !0,
                          hideParentConnection: !0,
                          hideChildrenConnection: !0,
                          itemConfig: {
                              title: "fake child #" + h,
                              description: "This is fake child keeps spouses together."
                          },
                          levelGravity: 1
                      }), j.add(k, l.id, l))
                  }
                  d = g;
                  c = h;
                  if (e && !g.validate()) throw "References are broken in family structure!";
                  return !0
              },
              getLogicalFamily: function() {
                  return d
              },
              getMaximumId: function() {
                  return c
              }
          }
      };
      a.famdiagram.HideGrandParentsConnectorsTask = function(a, b) {
          var d = null,
              c = null;
          return {
              process: function() {
                  var e = b.getLogicalFamily(),
                      g = b.getMaximumId();
                  c = e = !0 == a.getOptions().hideGrandParentsConnectors ? e.getFamilyWithoutGrandParentsRelations() :
                      e.clone();
                  d = g;
                  return !0
              },
              getLogicalFamily: function() {
                  return c
              },
              getMaximumId: function() {
                  return d
              }
          }
      };
      a.famdiagram.ItemsPositionsTask = function(f, b, d, c, e, g, h, i, j, k) {
          var l = {},
              n = null;
          return {
              process: function() {
                  var m = c.getOptions(),
                      p = e.getOptions(),
                      q = g.getOptions(),
                      r = {
                          logicalFamily: h.getLogicalFamily(),
                          treeLevels: h.getTreeLevels(),
                          getConnectorsStacksSizes: h.getConnectorsStacksSizes,
                          isItemSelected: k.isItemSelected,
                          cursorItemId: j.getCursorTreeItem(),
                          getTemplateParams: i.getTemplateParams
                      },
                      m = {
                          verticalAlignment: m.verticalAlignment,
                          pageFitMode: m.pageFitMode,
                          minimalVisibility: m.minimalVisibility,
                          normalLevelShift: m.normalLevelShift,
                          dotLevelShift: m.dotLevelShift,
                          lineLevelShift: m.lineLevelShift,
                          normalItemsInterval: m.normalItemsInterval,
                          dotItemsInterval: m.dotItemsInterval,
                          lineItemsInterval: m.lineItemsInterval,
                          orientationType: d.getOptions().orientationType,
                          arrowsDirection: p.arrowsDirection,
                          linesWidth: p.linesWidth,
                          checkBoxPanelSize: m.checkBoxPanelSize,
                          buttonsPanelSize: m.buttonsPanelSize,
                          groupTitlePanelSize: m.groupTitlePanelSize,
                          groupTitlePlacementType: m.groupTitlePlacementType,
                          maximumColumnsInMatrix: q.maximumColumnsInMatrix
                      },
                      p = f.getOptimalPanelSize(),
                      q = b.getOptions().scale;
                  p.scale(1 / q);
                  var p = new a.common.Rect(0, 0, p.width, p.height),
                      q = new a.famdiagram.FamilyLayout(r, m),
                      s = h.getMatrixes(),
                      t;
                  for (t in s)
                      if (s.hasOwnProperty(t)) {
                          var v = r.logicalFamily.node(t);
                          q.add(t, new a.famdiagram.MatrixLayout({
                                  items: s[t],
                                  isItemSelected: r.isItemSelected,
                                  cursorItemId: r.cursorItemId,
                                  getTemplateParams: r.getTemplateParams,
                                  hideParentConnection: v.hideParentConnection,
                                  hideChildrenConnection: v.hideChildrenConnection
                              },
                              m))
                      }
                  n = q.measure(p);
                  l = {};
                  q.arrange(this, function(a, b) {
                      l[a] = b
                  });
                  return !0
              },
              getItemsPositions: function() {
                  return l
              },
              getItemPosition: function(a) {
                  return l[a]
              },
              getContentSize: function() {
                  return n
              }
          }
      };
      a.famdiagram.LogicalFamilyTask = function(f) {
          var b = null,
              d = null;
          return {
              process: function(c) {
                  var e, g, h, i, j = f.getItems(),
                      k = a.common.family(),
                      l = 0;
                  if (0 < j.length) {
                      e = 0;
                      for (g = j.length; e < g; e += 1) h = j[e], null != h && (i = new a.famdiagram.FamilyItem({
                          id: h.id,
                          itemConfig: h,
                          isActive: h.isActive
                      }), k.add(h.parents, i.id, i), h = parseInt(h.id,
                          10), l = Math.max(isNaN(h) ? 0 : h, l))
                  }
                  b = k;
                  d = l;
                  if (c && !k.validate()) throw "References are broken in family structure!";
                  return !0
              },
              getLogicalFamily: function() {
                  return b
              },
              getMaximumId: function() {
                  return d
              }
          }
      };
      a.famdiagram.NormalizeLogicalFamilyTask = function(f, b) {
          var d = null,
              c = null,
              e = new a.famdiagram.FamilyNormalizer(!1);
          return {
              process: function() {
                  var a = b.getLogicalFamily(),
                      h = b.getMaximumId(),
                      i = f.getOptions(),
                      i = {
                          groupByType: i.groupByType,
                          alignBylevels: i.alignBylevels
                      },
                      a = a.clone(),
                      h = e.normalize(i, a, h);
                  c = a;
                  d = h;
                  return !0
              },
              getLogicalFamily: function() {
                  return c
              },
              getMaximumId: function() {
                  return d
              }
          }
      };
      a.famdiagram.OrderFamilyNodesTask = function(f, b, d, c) {
          var e = null,
              g = null,
              h = {},
              i = {},
              j = null,
              k = null,
              l = null,
              n = new a.famdiagram.FamilyBalance,
              m = new a.famdiagram.FamilyMatrixesExtractor(!1),
              p = new a.orgdiagram.TreeLevelConnectorStackSize;
          return {
              process: function() {
                  var a = d.getLogicalFamily(),
                      p = d.getMaximumId(),
                      s = {},
                      t = {},
                      v = [],
                      u = f.getOptions(),
                      u = {
                          enableMatrixLayout: u.enableMatrixLayout,
                          minimumMatrixSize: u.minimumMatrixSize,
                          maximumColumnsInMatrix: u.maximumColumnsInMatrix
                      },
                      a = a.clone(),
                      p = m.extract(u, a, s, t, v, p);
                  g = a;
                  h = s;
                  i = t;
                  k = v;
                  a = {
                      logicalFamily: a,
                      maximumId: p,
                      defaultItemConfig: c,
                      itemsPositions: b.getPositions(),
                      itemsGroups: b.getGroups()
                  };
                  a = n.balance(a);
                  e = a.maximumId;
                  j = a.treeLevels;
                  k = k.concat(a.bundles);
                  l = a.connectorStacks;
                  return !0
              },
              getLogicalFamily: function() {
                  return g
              },
              getMatrixes: function() {
                  return h
              },
              getNestedLayoutBottomConnectorIds: function() {
                  return i
              },
              getMaximumId: function() {
                  return e
              },
              getTreeLevels: function() {
                  return j
              },
              getBundles: function() {
                  return k
              },
              getConnectorsStacksSizes: function(a) {
                  return l[a] ||
                      p
              }
          }
      };
      a.famdiagram.RemoveLoopsTask = function(f, b) {
          function d(b, c, d) {
              var e, f, l, n, m, p, q, r, s;
              e = c.clone();
              c.loopTopo(this, function(a) {
                  e.removeNode(a)
              });
              if (e.hasNodes()) {
                  n = 0;
                  for (m = b.length; n < m; n += 1)
                      if (f = b[n], null != e.node(f.id)) {
                          s = [];
                          e.loopParents(this, f.id, function(a) {
                              s.push(a);
                              return e.SKIP
                          });
                          p = 0;
                          for (q = s.length; p < q; p += 1) e.removeRelation(s[p], f.id), c.removeRelation(s[p], f.id);
                          d += 1;
                          l = new a.famdiagram.FamilyItem({
                              id: d,
                              isVisible: !1,
                              isActive: !0,
                              isLevelNeutral: !0,
                              hideParentConnection: !0,
                              hideChildrenConnection: !0,
                              itemConfig: {
                                  title: "fake parent #" + d,
                                  description: "This is fake parent item was created by loops reversal."
                              }
                          });
                          c.add([], l.id, l);
                          c.adopt([l.id], f.id);
                          p = 0;
                          for (q = s.length; p < q; p += 1) d += 1, f = new a.famdiagram.FamilyItem({
                              id: d,
                              isVisible: !1,
                              isActive: !0,
                              isLevelNeutral: !0,
                              hideParentConnection: !0,
                              hideChildrenConnection: !0,
                              itemConfig: {
                                  title: "fake child #" + d,
                                  description: "This is fake child item was created by loops reversal."
                              }
                          }), c.add([l.id, s[p]], f.id, f);
                          r = [];
                          e.loopTopo(this, function(a) {
                              r.push(a)
                          });
                          p = 0;
                          for (q = r.length; p <
                              q; p += 1) e.removeNode(r[p])
                      }
              }
              return d
          }
          var c = null,
              e = null;
          return {
              process: function(a) {
                  var h = b.getNavigationFamily(),
                      i = b.getMaximumId(),
                      j = f.getItems(),
                      h = h.clone(),
                      i = d(j, h, i, a);
                  c = h;
                  e = i;
                  if (a && !h.validate()) throw "References are broken in family structure!";
                  return !0
              },
              getLogicalFamily: function() {
                  return c
              },
              getMaximumId: function() {
                  return e
              }
          }
      };
      a.famdiagram.UserDefinedNodesOrderTask = function(f) {
          var b = null,
              d = null,
              c = new a.famdiagram.UserDefinedNodesOrder;
          return {
              process: function() {
                  var a = f.getOptions(),
                      a = c.getUserDefinedPositions(a.items);
                  b = a.position;
                  d = a.group;
                  return !0
              },
              getPositions: function() {
                  return b
              },
              getGroups: function() {
                  return d
              }
          }
      };
      a.common.LabelAnnotationTemplate = function() {
          var a = ["div", {
              "class": ["bp-item", "bp-label-annotation"]
          }];
          return {
              template: function() {
                  return a
              },
              getHashCode: function() {
                  return "defaultLabelAnnotationTemplate"
              },
              render: function(a, d) {
                  d.element.innerHTML = d.context.title
              }
          }
      };
      a.famdiagram.Control = function(f, b) {
          return a.orgdiagram.BaseControl(f, b, a.famdiagram.TaskManagerFactory, a.famdiagram.EventArgsFactory, {
              AnnotationLabelTemplate: a.common.AnnotationLabelTemplate,
              ButtonsTemplate: a.common.ButtonsTemplate,
              CheckBoxTemplate: a.common.CheckBoxTemplate,
              CursorTemplate: a.common.CursorTemplate,
              DotHighlightTemplate: a.common.DotHighlightTemplate,
              GroupTitleTemplate: a.common.GroupTitleTemplate,
              HighlightTemplate: a.common.HighlightTemplate,
              ItemTemplate: a.common.ItemTemplate,
              UserTemplate: a.common.UserTemplate,
              LabelAnnotationTemplate: a.common.LabelAnnotationTemplate
          })
      };
      a.famdiagram.EventArgsFactory = function(f, b, d, c) {
          var e = new a.famdiagram.EventArgs,
              g = f.tasks.getTask("CombinedContextsTask"),
              h = f.tasks.getTask("AlignDiagramTask"),
              i = f.tasks.getTask("LogicalFamilyTask"),
              b = g.getConfig(b),
              j = g.getConfig(d),
              k = i.getLogicalFamily();
          b && null != b.id && (e.oldContext = b);
          j && null != j.id && (e.context = j, k.loopParents(this, j.id, function(a, b, c) {
                  if (0 < c) return k.BREAK;
                  e.parentItems.push(g.getConfig(a))
              }), k.loopChildren(this, j.id, function(a, b, c) {
                  if (0 < c) return k.BREAK;
                  e.childrenItems.push(g.getConfig(a))
              }), i = a.common.getElementOffset(f.layout.mousePanel), f = a.common.getElementOffset(f.layout.element), d = h.getItemPosition(d),
              e.position = (new a.common.Rect(d.actualPosition)).translate(i.left, i.top).translate(-f.left, -f.top));
          null != c && (e.name = c);
          return e
      };
      a.famdiagram.getProcessDiagramConfig = function() {
          var f = function() {};
          return a.famdiagram.TaskManagerFactory(f, f, f).getProcessDiagramConfig()
      };
      a.famdiagram.TaskManagerFactory = function(f, b, d, c) {
          var e = new a.common.TaskManager;
          e.addDependency("options", f);
          e.addDependency("graphics", b);
          e.addDependency("layout", d);
          e.addDependency("templates", c);
          e.addDependency("defaultConfig",
              new a.famdiagram.Config);
          e.addDependency("defaultItemConfig", new a.famdiagram.ItemConfig);
          e.addDependency("defaultTemplateConfig", new a.famdiagram.TemplateConfig);
          e.addDependency("defaultButtonConfig", new a.famdiagram.ButtonConfig);
          e.addDependency("defaultPaletteItemConfig", new a.famdiagram.PaletteItemConfig);
          e.addDependency("defaultBackgroundAnnotationConfig", new a.famdiagram.BackgroundAnnotationConfig);
          e.addDependency("defaultConnectorAnnotationConfig", new a.famdiagram.ConnectorAnnotationConfig);
          e.addDependency("defaultHighlightPathAnnotationConfig", new a.famdiagram.HighlightPathAnnotationConfig);
          e.addDependency("defaultShapeAnnotationConfig", new a.famdiagram.ShapeAnnotationConfig);
          e.addDependency("defaultLabelAnnotationConfig", new a.famdiagram.LabelAnnotationConfig);
          e.addDependency("isFamilyChartMode", !0);
          e.addDependency("showElbowDots", !0);
          e.addDependency("null", null);
          e.addDependency("foreground", 2);
          e.addDependency("background", 1);
          e.addTask("OptionsTask", ["options"], a.famdiagram.OptionsTask,
              "#000000");
          e.addTask("CurrentControlSizeTask", ["layout", "OptionsTask", "ItemsSizesOptionTask"], a.orgdiagram.CurrentControlSizeTask, "#000000");
          e.addTask("CurrentScrollPositionTask", ["layout", "OptionsTask"], a.orgdiagram.CurrentScrollPositionTask, "#000000");
          e.addTask("CalloutOptionTask", ["OptionsTask", "defaultConfig", "defaultItemConfig"], a.orgdiagram.CalloutOptionTask, "#000080");
          e.addTask("ConnectorsOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.ConnectorsOptionTask, "#000080");
          e.addTask("ItemsOptionTask", ["OptionsTask", "defaultItemConfig"], a.famdiagram.ItemsOptionTask, "#000080");
          e.addTask("ItemsContentOptionTask", ["OptionsTask", "defaultItemConfig"], a.orgdiagram.ItemsContentOptionTask, "#000080");
          e.addTask("SpousesOptionTask", ["OptionsTask", "defaultItemConfig"], a.famdiagram.SpousesOptionTask, "#000080");
          e.addTask("ItemsSizesOptionTask", ["OptionsTask", "defaultConfig", "defaultItemConfig", "defaultButtonConfig"], a.orgdiagram.ItemsSizesOptionTask, "#000080");
          e.addTask("LabelsOptionTask", ["OptionsTask", "defaultConfig",
              "defaultItemConfig"
          ], a.orgdiagram.LabelsOptionTask, "#000080");
          e.addTask("TemplatesOptionTask", ["OptionsTask", "defaultConfig", "defaultButtonConfig", "defaultTemplateConfig"], a.orgdiagram.TemplatesOptionTask, "#000080");
          e.addTask("OrientationOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.OrientationOptionTask, "#000080");
          e.addTask("VisualTreeOptionTask", ["OptionsTask"], a.famdiagram.VisualTreeOptionTask, "#000080");
          e.addTask("MinimizedItemsOptionTask", ["OptionsTask"], a.orgdiagram.MinimizedItemsOptionTask,
              "#000080");
          e.addTask("HideGrandParentsConnectorsOptionTask", ["OptionsTask", "defaultConfig"], a.famdiagram.HideGrandParentsConnectorsOptionTask, "#000080");
          e.addTask("NormalizeOptionTask", ["OptionsTask", "defaultConfig"], a.famdiagram.NormalizeOptionTask, "#000080");
          e.addTask("OrderFamilyNodesOptionTask", ["OptionsTask", "defaultConfig", "defaultItemConfig"], a.famdiagram.OrderFamilyNodesOptionTask, "#000080");
          e.addTask("LinePaletteOptionTask", ["OptionsTask", "defaultPaletteItemConfig"], a.famdiagram.LinePaletteOptionTask,
              "#000080");
          e.addTask("CursorItemOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.CursorItemOptionTask, "#000080");
          e.addTask("HighlightItemOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.HighlightItemOptionTask, "#000080");
          e.addTask("SelectedItemsOptionTask", ["OptionsTask"], a.orgdiagram.SelectedItemsOptionTask, "#000080");
          e.addTask("CursorSelectionPathModeOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.CursorSelectionPathModeOptionTask, "#000080");
          e.addTask("NeighboursSelectionModeOptionTask", ["OptionsTask", "defaultConfig"], a.famdiagram.NeighboursSelectionModeOptionTask, "#000080");
          e.addTask("SplitAnnotationsOptionTask", ["OptionsTask"], a.orgdiagram.SplitAnnotationsOptionTask, "#00ffff");
          e.addTask("ForegroundShapeAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultShapeAnnotationConfig", "foreground"], a.orgdiagram.ShapeAnnotationOptionTask, "#000080");
          e.addTask("BackgroundShapeAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultShapeAnnotationConfig", "background"], a.orgdiagram.ShapeAnnotationOptionTask,
              "#000080");
          e.addTask("ForegroundHighlightPathAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultHighlightPathAnnotationConfig", "foreground"], a.orgdiagram.HighlightPathAnnotationOptionTask, "#000080");
          e.addTask("BackgroundHighlightPathAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultHighlightPathAnnotationConfig", "background"], a.orgdiagram.HighlightPathAnnotationOptionTask, "#000080");
          e.addTask("ForegroundConnectorAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultConnectorAnnotationConfig",
              "foreground"
          ], a.orgdiagram.ConnectorAnnotationOptionTask, "#000080");
          e.addTask("BackgroundConnectorAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultConnectorAnnotationConfig", "background"], a.orgdiagram.ConnectorAnnotationOptionTask, "#000080");
          e.addTask("BackgroundAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultBackgroundAnnotationConfig"], a.orgdiagram.BackgroundAnnotationOptionTask, "#000080");
          e.addTask("ScaleOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.ScaleOptionTask,
              "#000080");
          e.addTask("UserDefinedNodesOrderTask", ["OrderFamilyNodesOptionTask", "defaultItemConfig"], a.famdiagram.UserDefinedNodesOrderTask, "#ff0000");
          e.addTask("LogicalFamilyTask", ["ItemsOptionTask"], a.famdiagram.LogicalFamilyTask, "#00ffff");
          e.addTask("LabelAnnotationOptionTask", ["SplitAnnotationsOptionTask", "LogicalFamilyTask", "defaultLabelAnnotationConfig"], a.famdiagram.LabelAnnotationOptionTask, "#000080");
          e.addTask("LabelAnnotationTemplateOptionTask", ["LabelAnnotationOptionTask", "defaultLabelAnnotationConfig"],
              a.famdiagram.LabelAnnotationTemplateOptionTask, "#000080");
          e.addTask("LabelAnnotationPlacementOptionTask", ["LabelAnnotationOptionTask", "defaultLabelAnnotationConfig"], a.famdiagram.LabelAnnotationPlacementOptionTask, "#000080");
          e.addTask("CombinedContextsTask", ["ItemsContentOptionTask", "LabelAnnotationOptionTask"], a.orgdiagram.CombinedContextsTask, "#00ffff");
          e.addTask("AddLabelAnnotationsTask", ["LabelAnnotationPlacementOptionTask", "LogicalFamilyTask"], a.famdiagram.AddLabelAnnotationsTask, "#ff0000");
          e.addTask("RemoveLoopsTask", ["ItemsOptionTask", "AddLabelAnnotationsTask"], a.famdiagram.RemoveLoopsTask, "#ff0000");
          e.addTask("AddSpousesTask", ["SpousesOptionTask", "RemoveLoopsTask"], a.famdiagram.AddSpousesTask, "#ff0000");
          e.addTask("HideGrandParentsConnectorsTask", ["HideGrandParentsConnectorsOptionTask", "AddSpousesTask"], a.famdiagram.HideGrandParentsConnectorsTask, "#ff0000");
          e.addTask("NormalizeLogicalFamilyTask", ["NormalizeOptionTask", "HideGrandParentsConnectorsTask"], a.famdiagram.NormalizeLogicalFamilyTask,
              "#ff0000");
          e.addTask("OrderFamilyNodesTask", ["OrderFamilyNodesOptionTask", "UserDefinedNodesOrderTask", "NormalizeLogicalFamilyTask", "defaultItemConfig"], a.famdiagram.OrderFamilyNodesTask, "#ff0000");
          e.addTask("ReadTemplatesTask", ["TemplatesOptionTask"], a.orgdiagram.ReadTemplatesTask, "#00ffff");
          e.addTask("ActiveItemsTask", ["ItemsSizesOptionTask", "ReadTemplatesTask"], a.orgdiagram.ActiveItemsTask, "#00ffff");
          e.addTask("ItemTemplateParamsTask", ["ItemsSizesOptionTask", "CursorItemOptionTask", "ReadTemplatesTask"],
              a.orgdiagram.ItemTemplateParamsTask, "#00ffff");
          e.addTask("LabelAnnotationTemplateParamsTask", ["ItemsSizesOptionTask", "LabelAnnotationTemplateOptionTask", "ReadTemplatesTask"], a.famdiagram.LabelAnnotationTemplateParamsTask, "#00ffff");
          e.addTask("CombinedTemplateParamsTask", ["ItemTemplateParamsTask", "LabelAnnotationTemplateParamsTask"], a.famdiagram.CombinedTemplateParamsTask, "#00ffff");
          e.addTask("GroupTitleTemplateTask", ["TemplatesOptionTask"], a.orgdiagram.GroupTitleTemplateTask, "#00ffff");
          e.addTask("CheckBoxTemplateTask", ["ItemsSizesOptionTask"], a.orgdiagram.CheckBoxTemplateTask, "#00ffff");
          e.addTask("ButtonsTemplateTask", ["ItemsSizesOptionTask", "templates"], a.orgdiagram.ButtonsTemplateTask, "#00ffff");
          e.addTask("AnnotationLabelTemplateTask", ["ItemsOptionTask"], a.orgdiagram.AnnotationLabelTemplateTask, "#00ffff");
          e.addTask("ConnectionsGraphTask", ["graphics", "CreateTransformTask", "ConnectorsOptionTask", "OrderFamilyNodesTask", "AlignDiagramTask"], a.orgdiagram.ConnectionsGraphTask, "#00ffff");
          e.addTask("HighlightItemTask", ["HighlightItemOptionTask", "ActiveItemsTask"], a.orgdiagram.HighlightItemTask, "#00ffff");
          e.addTask("CursorItemTask", ["CursorItemOptionTask", "ActiveItemsTask"], a.orgdiagram.CursorItemTask, "#00ffff");
          e.addTask("CursorNeighboursTask", ["CursorItemTask", "NeighboursSelectionModeOptionTask", "AddLabelAnnotationsTask", "ActiveItemsTask"], a.famdiagram.CursorNeighboursTask, "#00ffff");
          e.addTask("SelectedItemsTask", ["SelectedItemsOptionTask"], a.orgdiagram.SelectedItemsTask, "#00ffff");
          e.addTask("SelectionPathItemsTask", ["AddLabelAnnotationsTask", "CursorItemTask", "SelectedItemsTask", "CursorSelectionPathModeOptionTask"], a.orgdiagram.SelectionPathItemsTask, "#00ffff");
          e.addTask("NormalVisibilityItemsByForegroundShapeAnnotationTask", ["ForegroundShapeAnnotationOptionTask"], a.orgdiagram.NormalVisibilityItemsByAnnotationTask, "#00ffff");
          e.addTask("NormalVisibilityItemsByBackgroundShapeAnnotationTask", ["BackgroundShapeAnnotationOptionTask"], a.orgdiagram.NormalVisibilityItemsByAnnotationTask, "#00ffff");
          e.addTask("NormalVisibilityItemsByBackgroundAnnotationTask", ["BackgroundAnnotationOptionTask"], a.orgdiagram.NormalVisibilityItemsByAnnotationTask, "#00ffff");
          e.addTask("NormalVisibilityItemsByForegroundHighlightPathAnnotationTask", ["ForegroundHighlightPathAnnotationOptionTask"], a.orgdiagram.NormalVisibilityItemsByAnnotationTask, "#00ffff");
          e.addTask("NormalVisibilityItemsByBackgroundHighlightPathAnnotationTask", ["BackgroundHighlightPathAnnotationOptionTask"], a.orgdiagram.NormalVisibilityItemsByAnnotationTask, "#00ffff");
          e.addTask("NormalVisibilityItemsByForegroundConnectorAnnotationTask", ["ForegroundConnectorAnnotationOptionTask"], a.orgdiagram.NormalVisibilityItemsByConnectorAnnotationTask, "#00ffff");
          e.addTask("NormalVisibilityItemsByBackgroundConnectorAnnotationTask", ["BackgroundConnectorAnnotationOptionTask"], a.orgdiagram.NormalVisibilityItemsByConnectorAnnotationTask, "#00ffff");
          e.addTask("CombinedNormalVisibilityItemsTask", "ItemsSizesOptionTask CursorItemTask CursorNeighboursTask SelectedItemsTask SelectionPathItemsTask NormalVisibilityItemsByForegroundShapeAnnotationTask NormalVisibilityItemsByBackgroundShapeAnnotationTask NormalVisibilityItemsByBackgroundAnnotationTask NormalVisibilityItemsByForegroundHighlightPathAnnotationTask NormalVisibilityItemsByBackgroundHighlightPathAnnotationTask NormalVisibilityItemsByForegroundConnectorAnnotationTask NormalVisibilityItemsByBackgroundConnectorAnnotationTask".split(" "),
              a.orgdiagram.CombinedNormalVisibilityItemsTask, "#00ffff");
          e.addTask("ItemsPositionsTask", "CurrentControlSizeTask ScaleOptionTask OrientationOptionTask ItemsSizesOptionTask ConnectorsOptionTask OrderFamilyNodesOptionTask OrderFamilyNodesTask CombinedTemplateParamsTask CursorItemTask CombinedNormalVisibilityItemsTask".split(" "), a.famdiagram.ItemsPositionsTask, "#ff0000");
          e.addTask("AlignDiagramTask", "OrientationOptionTask ItemsSizesOptionTask VisualTreeOptionTask ScaleOptionTask CurrentControlSizeTask ActiveItemsTask ItemsPositionsTask isFamilyChartMode".split(" "),
              a.orgdiagram.AlignDiagramTask, "#ff0000");
          e.addTask("CreateTransformTask", ["OrientationOptionTask", "AlignDiagramTask"], a.orgdiagram.CreateTransformTask, "#00ffff");
          e.addTask("CenterOnCursorTask", "layout CurrentControlSizeTask CurrentScrollPositionTask CursorItemTask AlignDiagramTask CreateTransformTask ScaleOptionTask".split(" "), a.orgdiagram.CenterOnCursorTask, "#00ffff");
          e.addTask("PaletteManagerTask", ["ConnectorsOptionTask", "LinePaletteOptionTask"], a.orgdiagram.PaletteManagerTask, "#00ffff");
          e.addTask("ApplyLayoutChangesTask",
              "graphics layout ItemsSizesOptionTask CurrentControlSizeTask ScaleOptionTask AlignDiagramTask".split(" "), a.orgdiagram.ApplyLayoutChangesTask, "#00ffff");
          e.addTask("DrawBackgroundHighlightPathAnnotationTask", ["graphics", "ConnectorsOptionTask", "ForegroundHighlightPathAnnotationOptionTask", "ConnectionsGraphTask", "foreground"], a.orgdiagram.DrawHighlightPathAnnotationTask, "#00ffff");
          e.addTask("DrawForegroundHighlightPathAnnotationTask", ["graphics", "ConnectorsOptionTask", "BackgroundHighlightPathAnnotationOptionTask",
              "ConnectionsGraphTask", "background"
          ], a.orgdiagram.DrawHighlightPathAnnotationTask, "#00ffff");
          e.addTask("DrawBackgroundAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask BackgroundAnnotationOptionTask AddLabelAnnotationsTask AlignDiagramTask".split(" "), a.orgdiagram.DrawBackgroundAnnotationTask, "#008000");
          e.addTask("DrawForegroundConnectorAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask OrientationOptionTask ForegroundConnectorAnnotationOptionTask AlignDiagramTask AnnotationLabelTemplateTask foreground".split(" "),
              a.orgdiagram.DrawConnectorAnnotationTask, "#008000");
          e.addTask("DrawBackgroundConnectorAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask OrientationOptionTask BackgroundConnectorAnnotationOptionTask AlignDiagramTask AnnotationLabelTemplateTask background".split(" "), a.orgdiagram.DrawConnectorAnnotationTask, "#008000");
          e.addTask("DrawForegroundShapeAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask OrientationOptionTask ForegroundShapeAnnotationOptionTask AlignDiagramTask AnnotationLabelTemplateTask foreground".split(" "),
              a.orgdiagram.DrawShapeAnnotationTask, "#008000");
          e.addTask("DrawBackgroundShapeAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask OrientationOptionTask BackgroundShapeAnnotationOptionTask AlignDiagramTask AnnotationLabelTemplateTask background".split(" "), a.orgdiagram.DrawShapeAnnotationTask, "#008000");
          e.addTask("DrawCursorTask", "graphics CreateTransformTask ApplyLayoutChangesTask CombinedContextsTask AlignDiagramTask CombinedTemplateParamsTask CursorItemTask SelectedItemsTask".split(" "),
              a.orgdiagram.DrawCursorTask, "#008000");
          e.addTask("DrawHighlightTask", "graphics CreateTransformTask ApplyLayoutChangesTask CombinedContextsTask AlignDiagramTask CombinedTemplateParamsTask HighlightItemTask CursorItemTask SelectedItemsTask".split(" "), a.orgdiagram.DrawHighlightTask, "#008000");
          e.addTask("DrawHighlightAnnotationTask", "layout graphics CreateTransformTask ApplyLayoutChangesTask ScaleOptionTask CombinedContextsTask CalloutOptionTask ReadTemplatesTask AlignDiagramTask CenterOnCursorTask HighlightItemTask CursorItemTask SelectedItemsTask".split(" "),
              a.orgdiagram.DrawHighlightAnnotationTask, "#008000");
          e.addTask("DrawTreeItemsTask", "graphics CreateTransformTask ApplyLayoutChangesTask ScaleOptionTask ItemsSizesOptionTask CombinedContextsTask AlignDiagramTask CenterOnCursorTask CombinedTemplateParamsTask CursorItemTask SelectedItemsTask GroupTitleTemplateTask CheckBoxTemplateTask ButtonsTemplateTask".split(" "), a.orgdiagram.DrawTreeItemsTask, "#008000");
          e.addTask("DrawMinimizedItemsTask", "graphics CreateTransformTask ApplyLayoutChangesTask MinimizedItemsOptionTask CombinedTemplateParamsTask AlignDiagramTask".split(" "),
              a.orgdiagram.DrawMinimizedItemsTask, "#008000");
          e.addTask("DrawConnectorsTask", ["graphics", "ConnectionsGraphTask", "ConnectorsOptionTask", "showElbowDots", "PaletteManagerTask"], a.orgdiagram.DrawConnectorsTask, "#008000");
          e.addTask("DrawItemLabelsTask", ["graphics", "CreateTransformTask", "ApplyLayoutChangesTask", "LabelsOptionTask", "AlignDiagramTask"], a.orgdiagram.DrawItemLabelsTask, "#008000");
          return e
      };
  
      //holicraft96 editar tamaño cuadros
      a.orgdiagram.TemplateConfig = function() {
          this.name = null;
          this.isActive = !0;
          this.itemSize = new a.common.Size(120,
              75);
          this.itemBorderWidth = 1;
          this.minimizedItemShapeType = this.itemTemplate = null;
          this.minimizedItemSize = new a.common.Size(4, 4);
          this.minimizedItemCornerRadius = null;
          this.minimizedItemLineWidth = 1;
          this.minimizedItemBorderColor = null;
          this.minimizedItemLineType = 0;
          this.minimizedItemFillColor = null;
          this.minimizedItemOpacity = 1;
          this.highlightPadding = new a.common.Thickness(2, 2, 2, 2);
          this.highlightBorderWidth = 1;
          this.highlightTemplate = null;
          this.cursorPadding = new a.common.Thickness(3, 3, 3, 3);
          this.cursorBorderWidth = 2;
          this.buttons = this.cursorTemplate = null
      };
      a.orgdiagram.BackgroundAnnotationConfig = function(f) {
          var b;
          this.annotationType = 4;
          this.items = [];
          this.includeChildren = !1;
          this.zOrderType = 0;
          this.offset = new a.common.Thickness(18, 18, 18, 18);
          this.lineWidth = 2;
          this.opacity = 1;
          this.fillColor = this.borderColor = null;
          this.lineType = 0;
          this.selectItems = !1;
          switch (arguments.length) {
              case 1:
                  if (null !== f)
                      if (f instanceof Array) this.items = f;
                      else if ("object" == typeof f)
                      for (b in f) f.hasOwnProperty(b) && (this[b] = f[b])
          }
      };
      a.orgdiagram.ButtonConfig =
          function(f, b, d) {
              this.name = f;
              this.icon = b;
              this.text = !1;
              this.label = null;
              this.tooltip = d;
              this.size = new a.common.Size(16, 16)
          };
      a.orgdiagram.Config = function(f) {
          this.name = void 0 !== f ? f : "OrgDiagram";
          this.classPrefix = "orgdiagram";
          this.graphicsType = this.navigationMode = 0;
          this.pageFitMode = 3;
          this.minimalVisibility = 2;
          this.horizontalAlignment = this.orientationType = 0;
          this.verticalAlignment = 1;
          this.arrowsDirection = 0;
          this.showExtraArrows = !1;
          this.extraArrowsMinimumSpace = 30;
          this.showHorizontalArrows = !1;
          this.connectorType =
              0;
          this.bevelSize = 4;
          this.elbowType = 0;
          this.elbowDotSize = 4;
          this.emptyDiagramMessage = "Diagram is empty.";
          this.items = [];
          this.annotations = [];
          this.highlightItem = this.cursorItem = null;
          this.highlightGravityRadius = 40;
          this.selectedItems = [];
          this.hasSelectorCheckbox = 0;
          this.selectCheckBoxLabel = "";
          this.selectionPathMode = 1;
          this.templates = [];
          this.defaultTemplateName = null;
          this.hasButtons = 0;
          this.buttons = [];
          this.onCursorRender = this.onHighlightRender = this.onItemRender = this.onMouseDblClick = this.onMouseClick = this.onButtonClick =
              this.onSelectionChanged = this.onSelectionChanging = this.onCursorChanged = this.onCursorChanging = this.onHighlightChanged = this.onHighlightChanging = null;
          this.dotLevelShift = this.normalLevelShift = 20;
          this.normalItemsInterval = this.lineLevelShift = 10;
          this.dotItemsInterval = 1;
          this.lineItemsInterval = 2;
          this.cousinsIntervalMultiplier = 5;
          this.itemTitleFirstFontColor = "#ffffff";
          this.itemTitleSecondFontColor = "#000080";
          this.minimizedItemShapeType = 6;
          this.linesColor = "#c0c0c0";
          this.linesWidth = 1;
          this.linesType = 0;
          this.highlightLinesColor =
              "#ff0000";
          this.highlightLinesWidth = 1;
          this.highlightLinesType = 0;
          this.calloutMaximumVisibility = 2;
          this.showCallout = !0;
          this.calloutPlacementOffset = 100;
          this.defaultCalloutTemplateName = null;
          this.calloutfillColor = "#000000";
          this.calloutBorderColor = null;
          this.calloutCornerRadius = this.calloutOffset = 4;
          this.calloutPointerWidth = "10%";
          this.calloutLineWidth = 1;
          this.calloutOpacity = 0.2;
          this.leavesPlacementType = this.childrenPlacementType = 2;
          this.maximumColumnsInMatrix = 6;
          this.buttonsPanelSize = 28;
          this.checkBoxPanelSize =
              this.groupTitlePanelSize = 24;
          this.groupTitleOrientation = this.groupTitlePlacementType = 2;
          this.groupTitleVerticalAlignment = 1;
          this.groupTitleHorizontalAlignment = 0;
          this.groupTitleFontSize = "12px";
          this.groupTitleFontFamily = "Arial";
          this.groupTitleColor = "#4169e1";
          this.groupTitleFontStyle = this.groupTitleFontWeight = "normal";
          this.distance = 3;
          this.scale = 1;
          this.minimumScale = 0.5;
          this.maximumScale = 2;
          this.showLabels = 0;
          this.labelSize = new a.common.Size(80, 24);
          this.labelOffset = 1;
          this.labelOrientation = 0;
          this.labelPlacement =
              1;
          this.labelFontSize = "10px";
          this.labelFontFamily = "Arial";
          this.labelColor = "#000000";
          this.labelFontStyle = this.labelFontWeight = "normal";
          this.enablePanning = !0;
          this.autoSizeMinimum = new a.common.Size(800, 600);
          this.autoSizeMaximum = new a.common.Size(1024, 768)
      };
      a.orgdiagram.ConnectorAnnotationConfig = function(f, b) {
          var d;
          this.annotationType = 0;
          this.zOrderType = 2;
          this.toItem = this.fromItem = null;
          this.connectorPlacementType = this.connectorShapeType = 0;
          this.labelPlacementType = 1;
          this.offset = new a.common.Thickness(0, 0,
              0, 0);
          this.lineWidth = 2;
          this.color = "#000000";
          this.lineType = 0;
          this.selectItems = !0;
          this.label = null;
          this.labelSize = new a.common.Size(60, 30);
          switch (arguments.length) {
              case 1:
                  for (d in f) f.hasOwnProperty(d) && (this[d] = f[d]);
                  break;
              case 2:
                  this.fromItem = f, this.toItem = b
          }
      };
      a.orgdiagram.HighlightPathAnnotationConfig = function(a) {
          var b;
          this.zOrderType = this.annotationType = 2;
          this.items = [];
          this.lineWidth = 2;
          this.color = "#ff0000";
          this.lineType = 0;
          this.opacity = 1;
          this.showArrows = !0;
          this.selectItems = !1;
          switch (arguments.length) {
              case 1:
                  if (null !==
                      a)
                      if (a instanceof Array) this.items = a;
                      else if ("object" == typeof a)
                      for (b in a) a.hasOwnProperty(b) && (this[b] = a[b])
          }
      };
      a.orgdiagram.ItemConfig = function(a, b, d, c, e) {
          var g;
          this.context = this.image = this.description = this.title = this.parent = this.id = null;
          this.itemTitleColor = "#4169e1";
          this.groupTitle = this.minimizedItemShapeType = null;
          this.groupTitleColor = "#4169e1";
          this.isActive = this.isVisible = !0;
          this.childrenPlacementType = this.adviserPlacementType = this.itemType = this.hasButtons = this.hasSelectorCheckbox = 0;
          this.templateName =
              null;
          this.showCallout = 0;
          this.label = this.calloutTemplateName = null;
          this.showLabel = 0;
          this.labelSize = null;
          this.labelOrientation = 3;
          this.labelPlacement = 0;
          switch (arguments.length) {
              case 1:
                  for (g in a) a.hasOwnProperty(g) && (this[g] = a[g]);
                  break;
              case 5:
                  this.id = a, this.parent = b, this.title = d, this.description = c, this.image = e
          }
      };
      a.orgdiagram.ShapeAnnotationConfig = function(f) {
          var b;
          this.annotationType = 1;
          this.zOrderType = 0;
          this.items = [];
          this.shapeType = 0;
          this.offset = new a.common.Thickness(0, 0, 0, 0);
          this.lineWidth = 2;
          this.cornerRadius =
              "10%";
          this.opacity = 1;
          this.fillColor = this.borderColor = null;
          this.lineType = 0;
          this.selectItems = !1;
          this.label = null;
          this.labelSize = new a.common.Size(60, 30);
          this.labelPlacement = 0;
          this.labelOffset = 4;
          switch (arguments.length) {
              case 1:
                  if (null !== f)
                      if (f instanceof Array) this.items = f;
                      else if ("object" == typeof f)
                      for (b in f) f.hasOwnProperty(b) && (this[b] = f[b])
          }
      };
      a.orgdiagram.EventArgs = function() {
          this.name = this.position = this.parentItem = this.context = this.oldContext = null;
          this.cancel = !1
      };
      a.common.BaseConnectorBundle = function() {
          this.NORMAL_ITEM_WEIGHT =
              10010;
          this.LINE_ITEM_WEIGHT = 1E4
      };
      a.common.BaseConnectorBundle.prototype.trace = function() {};
      a.common.BaseConnectorBundle.prototype.getId = function(a) {
          var b = "_" + a.nodeid;
          a.nodeid += 1;
          return b
      };
      a.common.BaseConnectorBundle.prototype.ConnectorEdge = function(a, b, d, c, e, g, h, i, j, k) {
          this.polyline = d;
          this.from = a;
          this.to = b;
          this.weight = h || 0;
          this.fromOffset = i || 0;
          this.parentsArrowId = c;
          this.childrenArrowId = e;
          this.dotId = g;
          this.hasMiddle = j;
          this.middleParent = k
      };
      a.common.BaseConnectorBundle.prototype.ConnectorDestination =
          function(a) {
              this.bundleid = this.y = this.x = this.id = null;
              this.hasElbow = !1;
              this.visibility = this.elbowPoint2 = this.elbowPoint1 = null;
              this.isSquared = !0;
              for (var b in a) a.hasOwnProperty(b) && (this[b] = a[b])
          };
      a.common.BaseConnectorBundle.prototype.traceFork = function(f, b, d, c, e, g, h, i, j) {
          var k, l, n, m = [],
              p, q, r;
          if (g) {
              m = [];
              g = 0;
              for (l = e.length; g < l; g += 1)
                  if (n = e[g], n.x < c.x && !n.isSquared) m.push(n);
                  else break;
              l = m.length;
              0 < l && (n = m[l - 1], n = n.x == c.x ? c : new this.ConnectorDestination({
                  id: n.bundleid,
                  x: n.x,
                  y: c.y
              }), this.traceAngularSegments(f,
                  b, d, n, m, !1));
              m = [];
              for (k = e.length - 1; k >= g; k -= 1)
                  if (n = e[k], n.x > c.x && !n.isSquared) m.push(n);
                  else break;
              l = m.length;
              0 < l && (n = m[l - 1], n = n.x == c.x ? c : new this.ConnectorDestination({
                  id: n.bundleid,
                  x: n.x,
                  y: c.y
              }), this.traceAngularSegments(f, b, d, n, m, !1));
              for (m = g; m <= k; m += 1) {
                  n = e[m];
                  l = d.bevelSize;
                  2 > l && (l = 0);
                  if (b.hasGraphics) switch (d.elbowType) {
                      case 2:
                      case 3:
                          0 < l && (Math.abs(c.x - n.x) > l && Math.abs(c.y - n.y) > l) && (n.hasElbow = !0, n.elbowPoint1 = new a.common.Point(n.x, c.y + (c.y > n.y ? -l : l)), n.elbowPoint2 = new a.common.Point(n.x + (c.x >
                              n.x ? l : -l), c.y))
                  }
                  p = new a.common.Polyline;
                  n.hasElbow ? (b.transform.transform3Points(n.elbowPoint2.x, n.elbowPoint2.y, n.elbowPoint1.x, n.elbowPoint2.y, n.elbowPoint1.x, n.elbowPoint1.y, !0, this, function(b, c, e, f, h, i) {
                      switch (d.elbowType) {
                          case 2:
                              p.addSegment(new a.common.MoveSegment(b, c));
                              p.addSegment(new a.common.LineSegment(h, i));
                              break;
                          case 3:
                              p.addSegment(new a.common.MoveSegment(b, c)), p.addSegment(new a.common.CubicArcSegment(b, c, e, f, h, i))
                      }
                  }), b.transform.transformPoints(n.elbowPoint1.x, n.elbowPoint1.y, n.x,
                      n.y, !0, this,
                      function(b, c, d, e) {
                          p.addSegment(new a.common.LineSegment(d, e))
                      })) : b.transform.transformPoints(n.x, c.y, n.x, n.y, !0, this, function(b, c, d, e) {
                      p.addSegment(new a.common.MoveSegment(b, c));
                      p.addSegment(new a.common.LineSegment(d, e))
                  });
                  l = n.x == c.x ? c.id : n.bundleid;
                  q = 4 !== n.visibility;
                  f.graph.addEdge(l, n.id, new this.ConnectorEdge(l, n.id, p, h && q ? n.id : null, !h && q ? n.id : null, null, q ? this.NORMAL_ITEM_WEIGHT : this.LINE_ITEM_WEIGHT, i))
              }
              g = Math.max(g - 1, 0);
              k = Math.min(k + 1, e.length - 1);
              n = c;
              l = c.id;
              for (m = g; m <= k; m += 1) q =
                  e[m], r = q.bundleid, q.x > n.x && (p = new a.common.Polyline, b.transform.transformPoints(n.x, c.y, null != q.elbowPoint2 ? q.elbowPoint2.x : q.x, c.y, !0, this, function(b, c, d, e) {
                      p.addSegment(new a.common.MoveSegment(b, c));
                      p.addSegment(new a.common.LineSegment(d, e))
                  }), f.graph.addEdge(l, r, new this.ConnectorEdge(l, r, p, null, null, l, Math.abs(q.x - n.x) / 1E4, i, j, h ? r : l)), n = q.elbowPoint2 || q, l = r);
              n = c;
              l = c.id;
              for (m = k; m >= g; m -= 1) q = e[m], r = q.bundleid, q.x < n.x && (p = new a.common.Polyline, b.transform.transformPoints(n.x, c.y, null != q.elbowPoint2 ?
                  q.elbowPoint2.x : q.x, c.y, !0, this,
                  function(b, c, d, e) {
                      p.addSegment(new a.common.MoveSegment(b, c));
                      p.addSegment(new a.common.LineSegment(d, e))
                  }), f.graph.addEdge(l, r, new this.ConnectorEdge(l, r, p, null, null, l, Math.abs(q.x - n.x) / 1E4, i, j, h ? r : l)), n = q.elbowPoint2 || q, l = r)
          } else this.traceAngularSegments(f, b, d, c, e, !0)
      };
      a.common.BaseConnectorBundle.prototype.traceAngularSegments = function(f, b, d, c, e, g) {
          var h, i, j, k, l;
          h = 0;
          for (i = e.length; h < i; h += 1) {
              k = e[h];
              l = new a.common.Polyline;
              b.transform.transformPoint(c.x, c.y, !0, this,
                  function(b, c) {
                      l.addSegment(new a.common.MoveSegment(b, c))
                  });
              switch (d.connectorType) {
                  case 1:
                      b.transform.transformPoint(k.x, k.y, !0, this, function(b, c) {
                          l.addSegment(new a.common.LineSegment(b, c))
                      });
                      break;
                  case 2:
                      j = new a.common.Rect(c, k), g ? c.x > j.x ? b.transform.transform3Points(j.right(), j.verticalCenter(), j.x, j.verticalCenter(), j.x, j.bottom(), !0, this, function(b, c, d, e, f, h) {
                          l.addSegment(new a.common.CubicArcSegment(b, c, d, e, f, h))
                      }) : b.transform.transform3Points(j.x, j.verticalCenter(), j.right(), j.verticalCenter(),
                          j.right(), j.bottom(), !0, this,
                          function(b, c, d, e, f, h) {
                              l.addSegment(new a.common.CubicArcSegment(b, c, d, e, f, h))
                          }) : c.x > j.x ? b.transform.transformPoints(j.x, j.y, j.x, j.bottom(), !0, this, function(b, c, d, e) {
                          l.addSegment(new a.common.QuadraticArcSegment(b, c, d, e))
                      }) : b.transform.transformPoints(j.right(), j.y, j.right(), j.bottom(), !0, this, function(b, c, d, e) {
                          l.addSegment(new a.common.QuadraticArcSegment(b, c, d, e))
                      })
              }
              j = 4 !== k.visibility;
              f.graph.addEdge(c.id, k.id, new this.ConnectorEdge(c.id, k.id, l, null, j ? k.id : null, j ? this.NORMAL_ITEM_WEIGHT :
                  this.LINE_ITEM_WEIGHT))
          }
      };
      a.common.HorizontalConnectorBundle = function(a, b) {
          this.fromItem = a;
          this.toItem = b
      };
      a.common.HorizontalConnectorBundle.prototype = new a.common.BaseConnectorBundle;
      a.common.HorizontalConnectorBundle.prototype.trace = function(f, b) {
          var d = this.fromItem,
              c = this.toItem,
              e = b.treeItemsPositions[d],
              g = b.treeItemsPositions[c],
              h = new a.common.Polyline;
          e.actualPosition.x < g.actualPosition.x ? b.transform.transformPoints(e.actualPosition.right(), e.horizontalConnectorsShift, g.actualPosition.x, g.horizontalConnectorsShift, !0, this, function(b, c, d, e) {
              h.addSegment(new a.common.MoveSegment(b, c));
              h.addSegment(new a.common.LineSegment(d, e))
          }) : b.transform.transformPoints(e.actualPosition.x, e.horizontalConnectorsShift, g.actualPosition.right(), e.horizontalConnectorsShift, !0, this, function(b, c, d, e) {
              h.addSegment(new a.common.MoveSegment(b, c));
              h.addSegment(new a.common.LineSegment(d, e))
          });
          g = 4 !== g.actualVisibility;
          e = 4 !== e.actualVisibility;
          f.graph.addEdge(d, c, new this.ConnectorEdge(d, c, h, g ? c : null, e ? d : null, g || e ? this.NORMAL_ITEM_WEIGHT :
              this.LINE_ITEM_WEIGHT))
      };
      a.common.MatrixConnectorBundle = function(a, b, d, c, e) {
          this.isChildren = a;
          this.items = b;
          this.len = b.length;
          this.matrixNodeId = d;
          this.connectionId = c;
          this.matrixWidth = e;
          this.blocksCount = Math.ceil(this.matrixWidth / 2);
          this.rowsCount = Math.ceil(this.len / this.matrixWidth)
      };
      a.common.MatrixConnectorBundle.prototype = new a.common.BaseConnectorBundle;
      a.common.MatrixConnectorBundle.prototype.trace = function(a, b, d) {
          this.isChildren ? this.traceChildrenLayout(a, b, d) : this.traceParentsLayout(a, b, d)
      };
      a.common.MatrixConnectorBundle.prototype.traceChildrenLayout = function(f, b, d) {
          for (var c, e = [], g = 0; g < this.blocksCount; g += 1) {
              for (var h = null, i = this.rowsCount - 1; 0 <= i; i -= 1) {
                  var j = this.getNodeIndex(g, i, !0, !0),
                      k = null;
                  c = null;
                  j < this.len && (k = this.items[j], c = b.treeItemsPositions[k]);
                  var l = this.getNodeIndex(g, i, !1, !0),
                      n = null,
                      j = null;
                  l < this.len && (n = this.items[l], j = b.treeItemsPositions[n]);
                  var m = null;
                  null == m && null != c && (m = new this.ConnectorDestination({
                      id: this.getId(f),
                      x: c.actualPosition.horizontalCenter() + c.rightMedianOffset,
                      y: c.horizontalConnectorsShift
                  }));
                  null == m && null != j && (m = new this.ConnectorDestination({
                      id: this.getId(f),
                      x: j.actualPosition.horizontalCenter() - j.leftMedianOffset,
                      y: j.horizontalConnectorsShift
                  }));
                  null != c && (c = c.actualPosition, b.transform.transformPoints(c.right(), c.verticalCenter(), m.x, m.y, !0, this, function(b, c, d, e) {
                      var h = new a.common.Polyline;
                      h.addSegment(new a.common.MoveSegment(b, c));
                      h.addSegment(new a.common.LineSegment(d, e));
                      f.graph.addEdge(k, m.id, new this.ConnectorEdge(k, m.id, h, null, k, null, 10))
                  }));
                  null != j && (c = j.actualPosition, b.transform.transformPoints(c.left(), c.verticalCenter(), m.x, m.y, !0, this, function(b, c, d, e) {
                      var h = new a.common.Polyline;
                      h.addSegment(new a.common.MoveSegment(b, c));
                      h.addSegment(new a.common.LineSegment(d, e));
                      f.graph.addEdge(n, m.id, new this.ConnectorEdge(n, m.id, h, null, n, null, 10))
                  }));
                  null != h && null != m && b.transform.transformPoints(h.x, h.y, m.x, m.y, !0, this, function(b, c, d, e) {
                      var i = new a.common.Polyline;
                      i.addSegment(new a.common.MoveSegment(b, c));
                      i.addSegment(new a.common.LineSegment(d,
                          e));
                      f.graph.addEdge(h.id, m.id, new this.ConnectorEdge(h.id, m.id, i, null, null, null, 0))
                  });
                  null != m && (h = m)
              }
              null != h && e.push(new this.ConnectorDestination({
                  id: h.id,
                  bundleid: this.getId(f),
                  x: h.x,
                  y: h.y,
                  isSquared: !0,
                  visibility: 4
              }))
          }
          c = b.treeItemsPositions[this.matrixNodeId].actualPosition;
          g = new this.ConnectorDestination({
              id: this.matrixNodeId,
              x: c.horizontalCenter(),
              y: c.top()
          });
          this.traceFork(f, b, d, g, e, !0, !1, 0, d.showExtraArrows)
      };
      a.common.MatrixConnectorBundle.prototype.traceParentsLayout = function(f, b, d) {
          for (var c,
                  e = [], g = 0; g <= this.blocksCount; g += 1) {
              for (var h = null, i = 0; i < this.rowsCount; i += 1) {
                  var j = this.getNodeIndex(g, i, !0, !1),
                      k = null;
                  c = null;
                  j < this.len && (k = this.items[j], c = b.treeItemsPositions[k]);
                  var l = this.getNodeIndex(g, i, !1, !1),
                      n = null,
                      j = null;
                  l < this.len && (n = this.items[l], j = b.treeItemsPositions[n]);
                  var m = null;
                  null == m && null != c && (m = new this.ConnectorDestination({
                      id: this.getId(f),
                      x: c.actualPosition.horizontalCenter() + c.rightMedianOffset,
                      y: c.horizontalConnectorsShift
                  }));
                  null == m && null != j && (m = new this.ConnectorDestination({
                      id: this.getId(f),
                      x: j.actualPosition.horizontalCenter() - j.leftMedianOffset,
                      y: j.horizontalConnectorsShift
                  }));
                  null != c && (c = c.actualPosition, b.transform.transformPoints(c.right(), c.verticalCenter(), m.x, m.y, !0, this, function(b, c, d, e) {
                      var h = new a.common.Polyline;
                      h.addSegment(new a.common.MoveSegment(b, c));
                      h.addSegment(new a.common.LineSegment(d, e));
                      f.graph.addEdge(k, m.id, new this.ConnectorEdge(k, m.id, h, k, null, null, 10))
                  }));
                  null != j && (c = j.actualPosition, b.transform.transformPoints(c.left(), c.verticalCenter(), m.x, m.y, !0, this,
                      function(b, c, d, e) {
                          var h = new a.common.Polyline;
                          h.addSegment(new a.common.MoveSegment(b, c));
                          h.addSegment(new a.common.LineSegment(d, e));
                          f.graph.addEdge(n, m.id, new this.ConnectorEdge(n, m.id, h, n, null, null, 10))
                      }));
                  null != h && null != m && b.transform.transformPoints(h.x, h.y, m.x, m.y, !0, this, function(b, c, d, e) {
                      var i = new a.common.Polyline;
                      i.addSegment(new a.common.MoveSegment(b, c));
                      i.addSegment(new a.common.LineSegment(d, e));
                      f.graph.addEdge(h.id, m.id, new this.ConnectorEdge(h.id, m.id, i, null, null, null, 0))
                  });
                  null !=
                      m && (h = m)
              }
              null != h && e.push(new this.ConnectorDestination({
                  id: h.id,
                  bundleid: this.getId(f),
                  x: h.x,
                  y: h.y,
                  isSquared: !0,
                  visibility: 4
              }))
          }
          c = b.treeItemsPositions[this.matrixNodeId].actualPosition;
          g = new this.ConnectorDestination({
              id: this.connectionId,
              x: c.horizontalCenter(),
              y: c.bottom()
          });
          this.traceFork(f, b, d, g, e, !0, !0, 0, d.showExtraArrows)
      };
      a.common.MatrixConnectorBundle.prototype.getNodeIndex = function(a, b, d, c) {
          var e = null;
          c ? (a = 2 * a + (d ? 0 : 1), this.matrixWidth > a && (e = b * this.matrixWidth + a)) : (a = 2 * a + (d ? -1 : 0), 0 <= a && a < this.matrixWidth &&
              (e = b * this.matrixWidth + a));
          return e
      };
      a.common.VerticalConnectorBundle = function(a, b) {
          this.fromItems = a;
          this.toItems = b;
          this.childConnectorId = {};
          this.fromStackSize = this.fromOffset = 0
      };
      a.common.VerticalConnectorBundle.prototype = new a.common.BaseConnectorBundle;
      a.common.VerticalConnectorBundle.prototype.trace = function(f, b, d) {
          var c, e, g, h, i, j, k, l, n, m = 0 === d.connectorType;
          c = [];
          if (0 < this.fromItems.length) {
              g = this.fromItems;
              j = 0;
              for (e = g.length; j < e; j += 1) h = g[j], i = b.treeItemsPositions[h], h = new this.ConnectorDestination({
                  id: b.nestedLayoutBottomConnectorIds.hasOwnProperty(h) ?
                      b.nestedLayoutBottomConnectorIds[h] : h,
                  bundleid: this.getId(f),
                  x: i.actualPosition.horizontalCenter(),
                  y: i.actualPosition.bottom(),
                  isSquared: !0,
                  visibility: i.actualVisibility
              }), c.push(h);
              c.sort(function(a, b) {
                  return a.x - b.x
              });
              n = i.bottomConnectorShift - i.bottomConnectorInterval * (this.fromStackSize - this.fromOffset + 1)
          }
          e = [];
          if (0 < this.toItems.length) {
              l = !1;
              g = this.toItems;
              for (j = 0; j < g.length; j += 1) {
                  h = g[j];
                  i = b.treeItemsPositions[h];
                  k = !0;
                  if (b.hasGraphics) switch (i.actualVisibility) {
                      case 2:
                      case 3:
                          k = m
                  }
                  h = new this.ConnectorDestination({
                      id: h,
                      bundleid: this.getId(f),
                      x: i.actualPosition.horizontalCenter() + 0,
                      y: i.actualPosition.top(),
                      isSquared: k,
                      visibility: i.actualVisibility
                  });
                  e.push(h);
                  l = l || h.isSquared
              }
              e.sort(function(a, b) {
                  return a.x - b.x
              });
              k = i.topConnectorShift
          }
          g = 1 == e.length ? e[0].x : 1 == c.length ? c[0].x : 0 < e.length && 0 < c.length ? (c[0].x + c[c.length - 1].x + e[0].x + e[e.length - 1].x) / 4 : 0 < e.length ? (e[0].x + e[e.length - 1].x) / 2 : (c[0].x + c[c.length - 1].x) / 2;
          var p = null;
          0 < c.length && (p = new this.ConnectorDestination({
              id: this.getId(f),
              x: g,
              y: n
          }), this.traceFork(f, b, d,
              p, c, !0, !0, this.fromOffset, d.showExtraArrows && 0 < e.length));
          var q = null;
          0 < e.length && (q = new this.ConnectorDestination({
              id: this.getId(f),
              x: g,
              y: k
          }), null != p && q.y == p.y && (q = p), this.traceFork(f, b, d, q, e, l, !1, 0, d.showExtraArrows && 0 < c.length));
          null != p && (null != q && p.id != q.id) && b.transform.transformPoints(p.x, p.y, q.x, q.y, !0, this, function(b, c, d, e) {
              var h = new a.common.Polyline;
              h.addSegment(new a.common.MoveSegment(b, c));
              h.addSegment(new a.common.LineSegment(d, e));
              f.graph.addEdge(p.id, q.id, new this.ConnectorEdge(p.id,
                  q.id, h, null, null, null, 0))
          })
      };
      a.orgdiagram.LevelVisibility = function(a, b) {
          this.level = a;
          this.currentvisibility = b
      };
      a.orgdiagram.OrgItem = function(a) {
          var b, d, c;
          this.id = null;
          this.isActive = this.isVisible = !0;
          this.hasVisibleChildren = !1;
          this.childrenPlacementType = this.adviserPlacementType = this.itemType = 0;
          this.level = null;
          this.hideChildrenConnection = this.hideParentConnection = !1;
          this.childIndex = null;
          var e = "id parent isVisible isActive itemType adviserPlacementType childrenPlacementType".split(" ");
          b = 0;
          for (d = e.length; b <
              d; b += 1) c = e[b], a.hasOwnProperty(c) && (this[c] = a[c])
      };
      a.orgdiagram.Template = function(f, b) {
          this.cursorTemplate = this.dotHighlightTemplate = this.highlightTemplate = this.itemTemplate = this.templateConfig = null;
          null != b && (this.templateConfig = b, this.itemTemplate = a.common.isNullOrEmpty(b.itemTemplate) ? new a.common.ItemTemplate(f, b) : new a.common.UserTemplate(f, b.itemTemplate, f.onItemRender), this.highlightTemplate = a.common.isNullOrEmpty(b.highlightTemplate) ? new a.common.HighlightTemplate(f, b) : new a.common.UserTemplate(f,
              b.highlightTemplate, f.onHighlightRender), this.dotHighlightTemplate = new a.common.DotHighlightTemplate(f, b), this.cursorTemplate = a.common.isNullOrEmpty(b.cursorTemplate) ? new a.common.CursorTemplate(f, b) : new a.common.UserTemplate(f, b.cursorTemplate, f.onCursorRender))
      };
      a.orgdiagram.TemplateParams = function() {
          this.template = null;
          this.hasGroupTitle = this.hasButtons = this.hasSelectorCheckbox = this.isActive = !1;
          this.buttons = []
      };
      a.orgdiagram.TreeItem = function() {
          this.visualAggregatorId = this.id = null;
          this.visualDepth =
              1;
          this.partners = [];
          this.visibility = 1;
          this.actualItemType = null;
          this.relationDegree = this.gravity = this.connectorPlacement = 0
      };
      a.orgdiagram.TreeItemPosition = function(f) {
          this.partnerConnectorOffset = 0;
          this.levelPosition = this.level = null;
          this.rightPadding = this.leftPadding = this.offset = 0;
          this.actualVisibility = 1;
          this.topConnectorShift = this.horizontalConnectorsShift = this.contentPosition = this.actualPosition = this.actualSize = null;
          this.topConnectorInterval = 0;
          this.bottomConnectorShift = null;
          this.bottomConnectorInterval =
              0;
          this.rightMedianOffset = this.leftMedianOffset = null;
          if (null != f)
              for (var b in f)
                  if (f.hasOwnProperty(b)) switch (b) {
                      case "actualPosition":
                          this.actualPosition = new a.common.Rect(f.actualPosition);
                          break;
                      default:
                          this[b] = f[b]
                  }
      };
      a.orgdiagram.TreeLevelConnectorStackSize = function() {
          this.parentsStackSize = 0
      };
      a.orgdiagram.TreeLevelPosition = function(a) {
          this.actualVisibility = this.currentvisibility = 1;
          this.currentOffset = this.levelSpace = this.connectorShift = this.topConnectorShift = this.horizontalConnectorsDepth = this.nextLevelShift =
              this.depth = this.shift = 0;
          this.labels = [];
          this.labelsRect = null;
          this.showLabels = !0;
          this.hasFixedLabels = !1;
          if (null != a)
              for (var b in a) a.hasOwnProperty(b) && (this[b] = a[b])
      };
      a.orgdiagram.TreeLevelPosition.prototype.setShift = function(a, b, d, c, e) {
          this.shift = a;
          this.levelSpace = b;
          this.topConnectorShift = -b / 2 - d;
          this.connectorShift = this.depth + c + (e + 1) * (b / 2);
          return this.nextLevelShift = d + this.depth + c + b + e * b / 2
      };
      a.orgdiagram.TreeLevelPosition.prototype.shiftDown = function(a) {
          this.shift += a
      };
      a.orgdiagram.TreeLevelPosition.prototype.toString =
          function() {
              return this.currentvisibility
          };
      a.orgdiagram.AlignDiagramTask = function(f, b, d, c, e, g, h, i) {
          function j() {
              var a = [],
                  b = {},
                  c;
              for (c in k.treeItemsPositions)
                  if (k.treeItemsPositions.hasOwnProperty(c)) {
                      var d = k.treeItemsPositions[c];
                      switch (d.actualVisibility) {
                          case 1:
                          case 2:
                          case 3:
                              d = d.actualPosition, d = Math.max(d.width, d.height), b.hasOwnProperty(d) || (b[d] = !0, a.push(d))
                      }
                  }
              return a
          }
          var k = {
                  treeItemsPositions: {},
                  panelSize: null
              },
              l, n, m, p, q, r, s, t;
          return {
              process: function() {
                  var j = new a.common.Size(h.getContentSize()),
                      u = new a.common.Size(e.getOptimalPanelSize());
                  t = s = null;
                  l = null != g ? g.getActiveItems() : {};
                  n = h.getItemsPositions();
                  m = b.getOptions();
                  p = f.getOptions();
                  q = d.getOptions();
                  r = c.getOptions();
                  switch (p.orientationType) {
                      case 2:
                      case 3:
                          u.invert()
                  }
                  u.scale(1 / r.scale);
                  k.panelSize = u;
                  k.treeItemsPositions = n;
                  switch (m.pageFitMode) {
                      case 5:
                          k.panelSize = new a.common.Size(j);
                          break;
                      default:
                          k.panelSize = new a.common.Size(j);
                          if (j.width < u.width) {
                              k.treeItemsPositions = {};
                              var z = j.width,
                                  x = u.width,
                                  B;
                              if (i) B = (x - z) / 2;
                              else switch (q.horizontalAlignment) {
                                  case 1:
                                      B =
                                          0;
                                      break;
                                  case 2:
                                      B = x - z;
                                      break;
                                  case 0:
                                      B = (x - z) / 2
                              }
                              var z = k.treeItemsPositions,
                                  y;
                              for (y in n) n.hasOwnProperty(y) && (x = new a.orgdiagram.TreeItemPosition(n[y]), x.actualPosition.translate(B, 0), z[y] = x);
                              k.panelSize.width = u.width
                          }
                          j.height < u.height && (k.panelSize.height = u.height)
                  }
                  switch (p.orientationType) {
                      case 2:
                      case 3:
                          k.panelSize.invert()
                  }
                  return !0
              },
              getItemPosition: function(a) {
                  return k.treeItemsPositions[a]
              },
              getItemsPositions: function() {
                  return k.treeItemsPositions
              },
              getContentSize: function() {
                  return k.panelSize
              },
              getTreeItemForMousePosition: function(b,
                  c, d) {
                  var e = null,
                      f = null,
                      h = r.scale,
                      i;
                  if (null == s)
                      for (i in s = a.common.SpatialIndex(j()), k.treeItemsPositions)
                          if (k.treeItemsPositions.hasOwnProperty(i)) {
                              var g = k.treeItemsPositions[i];
                              if (l.hasOwnProperty(i)) switch (g.actualVisibility) {
                                  case 1:
                                  case 2:
                                  case 3:
                                      g = new a.common.Rect(g.actualPosition), g.context = i, s.addRect(g)
                              }
                          }
                  i = s;
                  var n, b = b / h,
                      c = c / h,
                      h = new a.common.Rect(b, c, 0, 0);
                  n = new a.common.Point(b, c);
                  h.offset(d, d, d, d);
                  i.loopArea(this, h, function(a) {
                      var d = a.context;
                      if (a.contains(b, c)) return e = d, !0;
                      switch (k.treeItemsPositions[d].actualVisibility) {
                          case 2:
                          case 3:
                              if (a =
                                  n.distanceTo(a.horizontalCenter(), a.verticalCenter()), null == f || a < f) f = a, e = d
                      }
                  });
                  return e
              },
              getNextItem: function(b, c) {
                  var d;
                  if (null == t)
                      for (d in t = a.common.KeyboardNavigationManager(), k.treeItemsPositions)
                          if (k.treeItemsPositions.hasOwnProperty(d)) {
                              var e = k.treeItemsPositions[d];
                              if (l.hasOwnProperty(d)) switch (e.actualVisibility) {
                                  case 1:
                                      e = new a.common.Rect(e.actualPosition), t.addRect(e, d)
                              }
                          }
                  d = t;
                  var f;
                  switch (c) {
                      case 0:
                          f = d.getItemAbove(b);
                          break;
                      case 1:
                          f = d.getItemBelow(b);
                          break;
                      case 2:
                          f = d.getItemOnLeft(b);
                          break;
                      case 3:
                          f = d.getItemOnRight(b)
                  }
                  return f
              }
          }
      };
      a.orgdiagram.ApplyLayoutChangesTask = function(f, b, d, c, e, g) {
          var h = null,
              i;
          return {
              process: function() {
                  var j = b(),
                      k = f(),
                      l = e.getOptions().scale;
                  i = d.getOptions();
                  var n = new a.common.Size(g.getContentSize());
                  n.scale(1 * l);
                  a.common.JsonML.applyStyles(j.mousePanel, n.getCSS());
                  var m = new a.common.Size(g.getContentSize());
                  a.common.JsonML.applyStyles(j.placeholder, m.getCSS());
                  k.resize("placeholder", m.width, m.height);
                  switch (i.pageFitMode) {
                      case 5:
                          h = new a.common.Size(n.width + 25,
                              n.height + 25);
                          h.cropBySize(i.autoSizeMaximum);
                          h.addSize(i.autoSizeMinimum);
                          a.common.JsonML.applyStyles(j.element, h.getCSS());
                          break;
                      default:
                          h = new a.common.Size(c.getScrollPanelSize())
                  }
                  k = a.common.getFixOfPixelALignment(j.element);
                  a.common.JsonML.applyStyles(j.scrollPanel, {
                      top: "0px",
                      left: "0px",
                      width: h.width + "px",
                      height: h.height + "px",
                      marginBottom: "0px",
                      marginRight: "0px",
                      marginLeft: k.width + "px",
                      marginTop: k.height + "px"
                  });
                  l = "scale(" + l + "," + l + ")";
                  a.common.JsonML.applyStyles(j.placeholder, {
                      "transform-origin": "0 0",
                      transform: l,
                      "-ms-transform": l,
                      "-webkit-transform": l,
                      "-o-transform": l,
                      "-moz-transform": l
                  });
                  return !0
              },
              getOptimalPanelSize: function() {
                  return new a.common.Size(h.width - 25, h.height - 25)
              }
          }
      };
      a.orgdiagram.CenterOnCursorTask = function(f, b, d, c, e, g, h) {
          function i(b) {
              var c = !1;
              k.transformRect(b.x, b.y, b.width, b.height, !0, this, function(b, d, e, f) {
                  c = new a.common.Rect(b, d, e, f)
              });
              return c
          }
          var j = null,
              k;
          return {
              process: function() {
                  var l;
                  l = f();
                  var n = c.getCursorTreeItem(),
                      m = e.getItemPosition(n),
                      n = e.getContentSize(),
                      p;
                  p = h.getOptions().scale;
                  j = d.getPlaceholderOffset();
                  l.forceCenterOnCursor && (k = g.getTransform(), null != m && (l = i(m.actualPosition), l.scale(p), n.scale(p), p = b.getScrollPanelSize(), j = new a.common.Point(Math.max(Math.min(l.horizontalCenter() - p.width / 2, n.width - p.width), 0), Math.max(Math.min(l.verticalCenter() - p.height / 2, n.height - p.height), 0))));
                  return !0
              },
              getPlaceholderOffset: function() {
                  return j
              }
          }
      };
      a.orgdiagram.CreateTransformTask = function(f, b) {
          var d = null;
          return {
              process: function() {
                  var c = f.getOptions(),
                      e = new a.common.Size(b.getContentSize());
                  d = new a.common.Transform;
                  d.setOrientation(c.orientationType);
                  d.size = new a.common.Size(e);
                  return !0
              },
              getTransform: function() {
                  return d
              },
              getTreeItemForMousePosition: function(a, e, f) {
                  var h = null;
                  d.transformPoint(a, e, !1, this, function(a, c) {
                      h = b.getTreeItemForMousePosition(a, c, f)
                  });
                  return h
              },
              description: "Create oordiante system tranfromation object."
          }
      };
      a.orgdiagram.CurrentControlSizeTask = function(f, b, d) {
          var c = {
                  scrollPanelSize: null
              },
              e = {},
              g = new a.common.ObjectReader({
                  scrollPanelSize: new a.common.ObjectReader({
                      width: new a.common.ValueReader(["number"], !0),
                      height: new a.common.ValueReader(["number"], !0)
                  }, !0)
              });
          return {
              process: function() {
                  var b = {
                          isChanged: !1,
                          hash: e
                      },
                      i = f(),
                      i = {
                          scrollPanelSize: a.common.getInnerSize(i.element)
                      },
                      j = !1,
                      k = d.getOptions();
                  c = g.read(c, i, "layout", b);
                  switch (k.pageFitMode) {
                      case 1:
                      case 2:
                      case 3:
                      case 0:
                          j = b.isChanged
                  }
                  return j
              },
              getScrollPanelSize: function() {
                  return c.scrollPanelSize
              },
              getOptimalPanelSize: function() {
                  return new a.common.Size(c.scrollPanelSize.width - 25, c.scrollPanelSize.height - 25)
              }
          }
      };
      a.orgdiagram.CurrentScrollPositionTask =
          function(f) {
              var b = {
                      placeholderOffset: null
                  },
                  d = {},
                  c = new a.common.ObjectReader({
                      placeholderOffset: new a.common.ObjectReader({
                          x: new a.common.ValueReader(["number"], !0),
                          y: new a.common.ValueReader(["number"], !0)
                      }, !0)
                  });
              return {
                  process: function() {
                      var e = {
                              isChanged: !1,
                              hash: d
                          },
                          g = f(),
                          g = {
                              placeholderOffset: new a.common.Point(g.scrollPanel.scrollLeft, g.scrollPanel.scrollTop)
                          };
                      b = c.read(b, g, "layout", e);
                      return e.isChanged
                  },
                  getPlaceholderOffset: function() {
                      return b.placeholderOffset
                  }
              }
          };
      a.orgdiagram.BackgroundAnnotationOptionTask =
          function(f, b) {
              var d = [],
                  c = {},
                  e = new a.common.ArrayReader(new a.common.ObjectReader({
                      items: new a.common.ArrayReader(new a.common.ValueReader(["string", "number"], !0), !0),
                      includeChildren: new a.common.ValueReader(["boolean"], !1, b.includeChildren),
                      zOrderType: new a.common.EnumerationReader(a.common.ZOrderType, !1, b.zOrderType),
                      offset: new a.common.ObjectReader({
                          left: new a.common.ValueReader(["number"], !1, b.offset.left),
                          top: new a.common.ValueReader(["number"], !1, b.offset.top),
                          right: new a.common.ValueReader(["number"], !1, b.offset.right),
                          bottom: new a.common.ValueReader(["number"], !1, b.offset.bottom)
                      }, !1, b.offset),
                      lineWidth: new a.common.ValueReader(["number"], !1, b.lineWidth),
                      opacity: new a.common.ValueReader(["number"], !1, b.opacity),
                      borderColor: new a.common.ValueReader(["string"], !1, b.borderColor),
                      fillColor: new a.common.ValueReader(["string"], !1, b.fillColor),
                      lineType: new a.common.EnumerationReader(a.common.LineType, !1, b.lineType),
                      selectItems: new a.common.ValueReader(["boolean"], !1, b.selectItems)
                  }), !1);
              return {
                  process: function() {
                      var a = {
                          isChanged: !1,
                          hash: c
                      };
                      d = e.read(d, f.getAnnotations(4, null), "annotations", a);
                      return a.isChanged
                  },
                  getAnnotations: function() {
                      return d
                  }
              }
          };
      a.orgdiagram.ConnectorAnnotationOptionTask = function(f, b, d) {
          var c = [],
              e = {},
              g = new a.common.ArrayReader(new a.common.ObjectReader({
                  zOrderType: new a.common.EnumerationReader(a.common.ZOrderType, !1, b.zOrderType),
                  fromItem: new a.common.ValueReader(["string", "number"], !0),
                  toItem: new a.common.ValueReader(["string", "number"], !0),
                  connectorShapeType: new a.common.EnumerationReader(a.common.ShapeType, !1, b.connectorShapeType),
                  connectorPlacementType: new a.common.EnumerationReader(a.common.ConnectorPlacementType, !1, b.connectorPlacementType),
                  labelPlacementType: new a.common.EnumerationReader(a.common.ConnectorLabelPlacementType, !1, b.labelPlacementType),
                  offset: new a.common.ObjectReader({
                      left: new a.common.ValueReader(["number"], !1, b.offset.left),
                      top: new a.common.ValueReader(["number"], !1, b.offset.top),
                      right: new a.common.ValueReader(["number"], !1, b.offset.right),
                      bottom: new a.common.ValueReader(["number"], !1, b.offset.bottom)
                  }, !1, b.offset),
                  lineWidth: new a.common.ValueReader(["number"], !1, b.lineWidth),
                  color: new a.common.ValueReader(["string"], !1, b.color),
                  lineType: new a.common.EnumerationReader(a.common.LineType, !1, b.lineType),
                  selectItems: new a.common.ValueReader(["boolean"], !1, b.selectItems),
                  label: new a.common.ValueReader(["string", "object"], !1, b.label),
                  labelSize: new a.common.ObjectReader({
                      width: new a.common.ValueReader(["number"], !1, b.labelSize.width),
                      height: new a.common.ValueReader(["number"], !1, b.labelSize.height)
                  }, !1, b.labelSize)
              }), !1);
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: e
                  };
                  c = g.read(c, f.getAnnotations(0, d), "annotations", a);
                  return a.isChanged
              },
              getAnnotations: function() {
                  return c
              }
          }
      };
      a.orgdiagram.HighlightPathAnnotationOptionTask = function(f, b, d) {
          var c = [],
              e = {},
              g = new a.common.ArrayReader(new a.common.ObjectReader({
                  zOrderType: new a.common.EnumerationReader(a.common.ZOrderType, !1, b.zOrderType),
                  lineWidth: new a.common.ValueReader(["number"], !1, b.lineWidth),
                  opacity: new a.common.ValueReader(["number"], !1,
                      b.opacity),
                  color: new a.common.ValueReader(["string"], !1, b.color),
                  lineType: new a.common.EnumerationReader(a.common.LineType, !1, b.lineType),
                  items: new a.common.ArrayReader(new a.common.ValueReader(["string", "number"], !0), !1),
                  selectItems: new a.common.ValueReader(["boolean"], !1, b.selectItems),
                  showArrows: new a.common.ValueReader(["boolean"], !1, b.showArrows)
              }, !1));
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: e
                  };
                  c = g.read(c, f.getAnnotations(2, d), "annotations", a);
                  return a.isChanged
              },
              getAnnotations: function() {
                  return c
              }
          }
      };
      a.orgdiagram.ShapeAnnotationOptionTask = function(f, b, d) {
          var c = [],
              e = {},
              g = new a.common.ArrayReader(new a.common.ObjectReader({
                  zOrderType: new a.common.EnumerationReader(a.common.ZOrderType, !1, b.zOrderType),
                  items: new a.common.ArrayReader(new a.common.ValueReader(["string", "number"], !0), !0),
                  shapeType: new a.common.EnumerationReader(a.common.ShapeType, !1, b.shapeType),
                  offset: new a.common.ObjectReader({
                      left: new a.common.ValueReader(["number"], !1, b.offset.left),
                      top: new a.common.ValueReader(["number"], !1, b.offset.top),
                      right: new a.common.ValueReader(["number"], !1, b.offset.right),
                      bottom: new a.common.ValueReader(["number"], !1, b.offset.bottom)
                  }, !1, b.offset),
                  lineWidth: new a.common.ValueReader(["number"], !1, b.lineWidth),
                  cornerRadius: new a.common.ValueReader(["string"], !1, b.cornerRadius),
                  opacity: new a.common.ValueReader(["number"], !1, b.opacity),
                  borderColor: new a.common.ValueReader(["string"], !1, b.borderColor),
                  fillColor: new a.common.ValueReader(["string"], !1, b.fillColor),
                  lineType: new a.common.EnumerationReader(a.common.LineType, !1, b.lineType),
                  selectItems: new a.common.ValueReader(["boolean"], !1, b.selectItems),
                  label: new a.common.ValueReader(["string", "object"], !1, b.label),
                  labelSize: new a.common.ObjectReader({
                      width: new a.common.ValueReader(["number"], !1, b.labelSize.width),
                      height: new a.common.ValueReader(["number"], !1, b.labelSize.height)
                  }, !1, b.labelSize),
                  labelPlacement: new a.common.EnumerationReader(a.common.PlacementType, !1, b.labelPlacement),
                  labelOffset: new a.common.ValueReader(["number"], !1, b.labelOffset)
              }, !1));
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: e
                  };
                  c = g.read(c, f.getAnnotations(1, d), "annotations", a);
                  return a.isChanged
              },
              getAnnotations: function() {
                  return c
              }
          }
      };
      a.orgdiagram.SplitAnnotationsOptionTask = function(f) {
          var b = {};
          return {
              process: function() {
                  var d = f.getOptions().annotations,
                      c, e, g, h, i, j = {};
                  if (a.common.isArray(d)) {
                      c = 0;
                      for (e = d.length; c < e; c += 1) {
                          g = d[c];
                          h = g.annotationType;
                          switch (h) {
                              case 1:
                              case 0:
                              case 2:
                                  switch (g.zOrderType) {
                                      case 1:
                                          i = 1;
                                          break;
                                      default:
                                          i = 2
                                  }
                                  break;
                              default:
                                  i = null
                          }
                          null != h && (h = 1E3 * h + (i || 0), j.hasOwnProperty(h) || (j[h] = []),
                              j[h].push(g))
                      }
                  }
                  b = j;
                  return !0
              },
              getAnnotations: function(a, c) {
                  return b[1E3 * a + (c || 0)]
              }
          }
      };
      a.orgdiagram.CursorItemOptionTask = function(f, b) {
          var d = {},
              c = new a.common.ObjectReader({
                  cursorItem: new a.common.ValueReader(["string", "number"], !0),
                  navigationMode: new a.common.EnumerationReader(a.common.NavigationMode, !1, b.navigationMode)
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1
                  };
                  d = c.read(d, f.getOptions(), "options", a);
                  return a.isChanged
              },
              getCursorItem: function() {
                  return d.cursorItem
              },
              hasCursorEnabled: function() {
                  switch (d.navigationMode) {
                      case 0:
                      case 1:
                          return !0
                  }
                  return !1
              },
              description: "Checks currenct cursor item option."
          }
      };
      a.orgdiagram.CursorSelectionPathModeOptionTask = function(f, b) {
          var d = {},
              c = new a.common.ObjectReader({
                  selectionPathMode: new a.common.EnumerationReader(a.common.SelectionPathMode, !1, b.selectionPathMode)
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1
                  };
                  d = c.read(d, f.getOptions(), "options", a);
                  return a.isChanged
              },
              getSelectionPathMode: function() {
                  return d.selectionPathMode
              },
              description: "Checks cursor selection path option."
          }
      };
      a.orgdiagram.HighlightItemOptionTask =
          function(f, b) {
              var d = {},
                  c = new a.common.ObjectReader({
                      highlightItem: new a.common.ValueReader(["string", "number"], !0),
                      navigationMode: new a.common.EnumerationReader(a.common.NavigationMode, !1, b.navigationMode),
                      highlightGravityRadius: new a.common.ValueReader(["number"], !1, b.highlightGravityRadius)
                  });
              return {
                  process: function() {
                      var a = {
                          isChanged: !1
                      };
                      d = c.read(d, f.getOptions(), "options", a);
                      return a.isChanged
                  },
                  getHighlightItem: function() {
                      return d.highlightItem
                  },
                  hasHighlightEnabled: function() {
                      switch (d.navigationMode) {
                          case 0:
                          case 3:
                              return !0
                      }
                      return !1
                  },
                  getGravityRadius: function() {
                      return d.highlightGravityRadius
                  },
                  description: "Checks highlight item option."
              }
          };
      a.orgdiagram.SelectedItemsOptionTask = function(f) {
          var b = {},
              d = {},
              c = new a.common.ObjectReader({
                  selectedItems: new a.common.ArrayReader(new a.common.ValueReader(["string", "number"], !0), !0)
              });
          return {
              process: function() {
                  var a = {
                          isChanged: !1,
                          hash: d
                      },
                      g = f.getOptions();
                  b = c.read(b, g, "options", a);
                  return a.isChanged
              },
              getSelectedItems: function() {
                  return b.selectedItems
              },
              description: "Checks user selected items option."
          }
      };
      a.orgdiagram.CalloutOptionTask = function(f, b) {
          var d = {},
              c = {},
              e = new a.common.ObjectReader({
                  calloutMaximumVisibility: new a.common.EnumerationReader(a.common.Visibility, !1, b.calloutMaximumVisibility),
                  showCallout: new a.common.ValueReader(["boolean"], !1, b.showCallout),
                  calloutPlacementOffset: new a.common.ValueReader(["number"], !1, b.calloutPlacementOffset),
                  orientationType: new a.common.EnumerationReader(a.common.OrientationType, !1, b.orientationType),
                  defaultTemplateName: new a.common.ValueReader(["string"], !0),
                  defaultCalloutTemplateName: new a.common.ValueReader(["string"], !0),
                  calloutfillColor: new a.common.ValueReader(["string"], !1, b.calloutfillColor),
                  calloutBorderColor: new a.common.ValueReader(["string"], !0),
                  calloutOffset: new a.common.ValueReader(["number"], !1, b.calloutOffset),
                  calloutCornerRadius: new a.common.ValueReader(["string"], !1, b.calloutCornerRadius),
                  calloutPointerWidth: new a.common.ValueReader(["string"], !1, b.calloutPointerWidth),
                  calloutLineWidth: new a.common.ValueReader(["number"], !1, b.calloutLineWidth),
                  calloutOpacity: new a.common.ValueReader(["number"], !1, b.calloutOpacity),
                  items: new a.common.ArrayReader(new a.common.ObjectReader({
                      id: new a.common.ValueReader(["string", "number"], !0),
                      showCallout: new a.common.EnumerationReader(a.common.Enabled, !1, b.showCallout),
                      calloutTemplateName: new a.common.ValueReader(["string"], !0),
                      templateName: new a.common.ValueReader(["string"], !0)
                  }), !0, "id")
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: c
                  };
                  d = e.read(d, f.getOptions(), "options", a);
                  return a.isChanged
              },
              getOptions: function() {
                  return d
              },
              getItemOptions: function(a) {
                  return c["options-items"][a]
              },
              description: "Checks item callout options."
          }
      };
      a.orgdiagram.ConnectorsOptionTask = function(f, b) {
          var d = {},
              c = {},
              e = new a.common.ObjectReader({
                  arrowsDirection: new a.common.EnumerationReader(a.common.GroupByType, !1, b.arrowsDirection),
                  showExtraArrows: new a.common.ValueReader(["boolean"], !1, b.showExtraArrows),
                  extraArrowsMinimumSpace: new a.common.ValueReader(["number"], !1, b.extraArrowsMinimumSpace),
                  connectorType: new a.common.EnumerationReader(a.common.ConnectorType, !1, b.hasOwnProperty("connectorType") ? b.connectorType : 0),
                  showNeigboursConnectorsHighlighted: new a.common.EnumerationReader(a.common.ConnectorType, !1, b.hasOwnProperty("showNeigboursConnectorsHighlighted") ? b.showNeigboursConnectorsHighlighted : !1),
                  elbowType: new a.common.EnumerationReader(a.common.ElbowType, !1, b.elbowType),
                  bevelSize: new a.common.ValueReader(["number"], !1, b.bevelSize),
                  elbowDotSize: new a.common.ValueReader(["number"], !1, b.elbowDotSize),
                  linesColor: new a.common.ValueReader(["string"], !1, b.linesColor),
                  linesWidth: new a.common.ValueReader(["number"], !1, b.linesWidth),
                  linesType: new a.common.EnumerationReader(a.common.LineType, !1, b.linesType),
                  highlightLinesColor: new a.common.ValueReader(["string"], !1, b.highlightLinesColor),
                  highlightLinesWidth: new a.common.ValueReader(["number"], !1, b.highlightLinesWidth),
                  highlightLinesType: new a.common.EnumerationReader(a.common.LineType, !1, b.highlightLinesType)
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: c
                  };
                  d = e.read(d, f.getOptions(), "options", a);
                  return a.isChanged
              },
              getOptions: function() {
                  return d
              },
              description: "Checks connector lines drawing options."
          }
      };
      a.orgdiagram.ItemsContentOptionTask = function(f, b) {
          var d = {},
              c = {},
              e = {},
              g = new a.common.ObjectReader({
                  items: new a.common.ArrayReader(new a.common.ObjectReader({
                      id: new a.common.ValueReader(["string", "number"], !0),
                      title: new a.common.ValueReader(["string"], !0),
                      description: new a.common.ValueReader(["string"], !0),
                      image: new a.common.ValueReader(["string"], !0),
                      context: new a.common.ValueReader(["string", "number", "object"], !0),
                      itemTitleColor: new a.common.ValueReader(["string"], !1, b.itemTitleColor),
                      groupTitle: new a.common.ValueReader(["string"], !1, b.groupTitle),
                      groupTitleColor: new a.common.ValueReader(["string"], !1, b.groupTitleColor)
                  }), !0, "id", !0, !0)
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: c,
                      sourceHash: e
                  };
                  d = g.read(d, f.getOptions(), "options", a);
                  return a.isChanged
              },
              getItems: function() {
                  return d.items
              },
              getConfig: function(a) {
                  return e["options-items"][a]
              },
              description: "Checks items configuration options effecting their placement in layout."
          }
      };
      a.orgdiagram.ItemsOptionTask = function(f, b) {
          var d = {},
              c = {},
              e = {},
              g = new a.common.ObjectReader({
                  items: new a.common.ArrayReader(new a.common.ObjectReader({
                      id: new a.common.ValueReader(["string", "number"], !0),
                      parent: new a.common.ValueReader(["string", "number"], !0),
                      itemType: new a.common.EnumerationReader(a.orgdiagram.ItemType, !1, b.itemType),
                      adviserPlacementType: new a.common.EnumerationReader(a.common.AdviserPlacementType, !1, b.adviserPlacementType),
                      childrenPlacementType: new a.common.EnumerationReader(a.common.ChildrenPlacementType, !1, b.childrenPlacementType),
                      isVisible: new a.common.ValueReader(["boolean"], !1, b.isVisible),
                      isActive: new a.common.ValueReader(["boolean"], !1, b.isActive)
                  }), !0, "id", !0, !0)
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: c,
                      sourceHash: e
                  };
                  d = g.read(d, f.getOptions(), "options", a);
                  return a.isChanged
              },
              getItems: function() {
                  return d.items
              },
              getConfig: function(a) {
                  return e["options-items"][a]
              },
              description: "Checks items configuration options effecting their placement in layout."
          }
      };
      a.orgdiagram.ItemsSizesOptionTask =
          function(f, b, d, c) {
              var e = {},
                  g = {},
                  h = new a.common.ObjectReader({
                      defaultTemplateName: new a.common.ValueReader(["string"], !0),
                      defaultLabelAnnotationTemplate: new a.common.ValueReader(["string"], !0),
                      hasSelectorCheckbox: new a.common.EnumerationReader(a.common.Enabled, !1, b.hasSelectorCheckbox),
                      hasButtons: new a.common.EnumerationReader(a.common.Enabled, !1, b.hasButtons),
                      buttonsPanelSize: new a.common.ValueReader(["number"], !1, b.buttonsPanelSize),
                      groupTitlePanelSize: new a.common.ValueReader(["number"], !1, b.groupTitlePanelSize),
                      groupTitlePlacementType: new a.common.EnumerationReader(a.common.AdviserPlacementType, !1, b.groupTitlePlacementType),
                      checkBoxPanelSize: new a.common.ValueReader(["number"], !1, b.checkBoxPanelSize),
                      selectCheckBoxLabel: new a.common.ValueReader(["string"], !1, b.selectCheckBoxLabel),
                      buttons: new a.common.ArrayReader(new a.common.ObjectReader({
                          name: new a.common.ValueReader(["string"], !0),
                          icon: new a.common.ValueReader(["string"], !0),
                          text: new a.common.ValueReader(["boolean"], !1, !1),
                          tooltip: new a.common.ValueReader(["string"], !0),
                          size: new a.common.ObjectReader({
                              width: new a.common.ValueReader(["number"], !1, c.size.width),
                              height: new a.common.ValueReader(["number"], !1, c.size.height)
                          }, !1, c.size)
                      }), !0, "name"),
                      pageFitMode: new a.common.EnumerationReader(a.common.PageFitMode, !1, b.pageFitMode),
                      minimalVisibility: new a.common.EnumerationReader(a.common.Visibility, !1, b.minimalVisibility),
                      selectionPathMode: new a.common.EnumerationReader(a.common.SelectionPathMode, !1, b.selectionPathMode),
                      autoSizeMinimum: new a.common.ObjectReader({
                          width: new a.common.ValueReader(["number"], !1, b.autoSizeMinimum.width),
                          height: new a.common.ValueReader(["number"], !1, b.autoSizeMinimum.height)
                      }, !1, b.autoSizeMinimum),
                      autoSizeMaximum: new a.common.ObjectReader({
                          width: new a.common.ValueReader(["number"], !1, b.autoSizeMaximum.width),
                          height: new a.common.ValueReader(["number"], !1, b.autoSizeMaximum.height)
                      }, !1, b.autoSizeMaximum),
                      scale: new a.common.ValueReader(["number"], !1, b.scale),
                      maximumScale: new a.common.ValueReader(["number"], !1, b.maximumScale),
                      minimumScale: new a.common.ValueReader(["number"], !1, b.minimumScale),
                      normalLevelShift: new a.common.ValueReader(["number"], !1, b.normalLevelShift),
                      dotLevelShift: new a.common.ValueReader(["number"], !1, b.dotLevelShift),
                      lineLevelShift: new a.common.ValueReader(["number"], !1, b.lineLevelShift),
                      normalItemsInterval: new a.common.ValueReader(["number"], !1, b.normalItemsInterval),
                      dotItemsInterval: new a.common.ValueReader(["number"], !1, b.dotItemsInterval),
                      lineItemsInterval: new a.common.ValueReader(["number"], !1, b.lineItemsInterval),
                      cousinsIntervalMultiplier: new a.common.ValueReader(["number"], !1, b.cousinsIntervalMultiplier),
                      verticalAlignment: new a.common.EnumerationReader(a.common.VerticalAlignmentType, !1, b.verticalAlignment),
                      items: new a.common.ArrayReader(new a.common.ObjectReader({
                          id: new a.common.ValueReader(["string", "number"], !0),
                          groupTitle: new a.common.ValueReader(["string", "number"], !0),
                          isVisible: new a.common.ValueReader(["boolean", "number"], !1, d.isVisible),
                          isActive: new a.common.ValueReader(["boolean", "number"], !1, d.isActive),
                          hasSelectorCheckbox: new a.common.EnumerationReader(a.common.Enabled, !1, d.hasSelectorCheckbox),
                          hasButtons: new a.common.EnumerationReader(a.common.Enabled, !1, d.hasButtons),
                          templateName: new a.common.ValueReader(["string"], !0)
                      }), !0, "id")
                  });
              return {
                  process: function() {
                      var a = {
                          isChanged: !1,
                          hash: g
                      };
                      e = h.read(e, f.getOptions(), "options", a);
                      return a.isChanged
                  },
                  getItemOptions: function(a) {
                      return g["options-items"][a]
                  },
                  getOptions: function() {
                      return e
                  },
                  description: "Checks items size options."
              }
          };
      a.orgdiagram.LabelsOptionTask = function(f, b, d) {
          var c = {},
              e = {},
              g = new a.common.ObjectReader({
                  showLabels: new a.common.EnumerationReader(a.common.Enabled, !1, b.showLabels),
                  labelOffset: new a.common.ValueReader(["number"], !1, b.labelOffset),
                  labelFontSize: new a.common.ValueReader(["string"], !1, b.labelFontSize),
                  labelFontFamily: new a.common.ValueReader(["string"], !1, b.labelFontFamily),
                  labelFontStyle: new a.common.ValueReader(["string"], !1, b.labelFontStyle),
                  labelFontWeight: new a.common.ValueReader(["string"], !1, b.labelFontWeight),
                  labelColor: new a.common.ValueReader(["string"], !1, b.labelColor),
                  labelSize: new a.common.ObjectReader({
                      width: new a.common.ValueReader(["number"], !1, b.labelSize.width),
                      height: new a.common.ValueReader(["number"], !1, b.labelSize.height)
                  }, !1, b.labelSize),
                  labelOrientation: new a.common.EnumerationReader(a.text.TextOrientationType, !1, b.labelOrientation),
                  labelPlacement: new a.common.EnumerationReader(a.common.PlacementType, !1, b.labelPlacement),
                  arrowsDirection: new a.common.EnumerationReader(a.common.GroupByType, !1, b.arrowsDirection),
                  items: new a.common.ArrayReader(new a.common.ObjectReader({
                      id: new a.common.ValueReader(["string", "number"], !0),
                      label: new a.common.ValueReader(["string",
                          "number"
                      ], !0),
                      showLabel: new a.common.EnumerationReader(a.common.Enabled, !1, d.showLabel),
                      labelSize: new a.common.ObjectReader({
                          width: new a.common.ValueReader(["number"], !1, 0),
                          height: new a.common.ValueReader(["number"], !1, 0)
                      }, !0),
                      labelOrientation: new a.common.EnumerationReader(a.text.TextOrientationType, !1, d.labelOrientation),
                      labelPlacement: new a.common.EnumerationReader(a.common.PlacementType, !1, d.labelPlacement)
                  }), !0, "id")
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: e
                  };
                  c = g.read(c, f.getOptions(),
                      "options", a);
                  return a.isChanged
              },
              getItemOptions: function(a) {
                  return e["options-items"][a]
              },
              getItemsOptions: function() {
                  return e["options-items"]
              },
              getOptions: function() {
                  return c
              },
              description: "Checks items labels options."
          }
      };
      a.orgdiagram.MinimizedItemsOptionTask = function(f) {
          var b = {},
              d = {},
              c = new a.common.ObjectReader({
                  minimizedItemShapeType: new a.common.EnumerationReader(a.common.ShapeType, !0),
                  items: new a.common.ArrayReader(new a.common.ObjectReader({
                      id: new a.common.ValueReader(["string", "number"], !0),
                      minimizedItemShapeType: new a.common.EnumerationReader(a.common.ShapeType, !0),
                      itemTitleColor: new a.common.ValueReader(["string"], !0)
                  }), !0, "id")
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: d
                  };
                  b = c.read(b, f.getOptions(), "options", a);
                  return a.isChanged
              },
              getItemOptions: function(a) {
                  return d["options-items"][a]
              },
              getOptions: function() {
                  return b
              },
              description: "Checks minimized items drawing options."
          }
      };
      a.orgdiagram.OptionsTask = function(a) {
          return {
              process: function() {
                  return !0
              },
              getOptions: a,
              description: "Raw options."
          }
      };
      a.orgdiagram.OrientationOptionTask = function(f, b) {
          var d = {},
              c = {},
              e = new a.common.ObjectReader({
                  orientationType: new a.common.EnumerationReader(a.common.OrientationType, !1, b.orientationType)
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: c
                  };
                  d = e.read(d, f.getOptions(), "options", a);
                  return a.isChanged
              },
              getOptions: function() {
                  return d
              },
              description: "Checks diagram orientation options."
          }
      };
      a.orgdiagram.ScaleOptionTask = function(f, b) {
          var d = {},
              c = {},
              e = new a.common.ObjectReader({
                  scale: new a.common.ValueReader(["number"], !1, b.scale),
                  minimumScale: new a.common.ValueReader(["number"], !1, b.minimumScale),
                  maximumScale: new a.common.ValueReader(["number"], !1, b.maximumScale)
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: c
                  };
                  d = e.read(d, f.getOptions(), "options", a);
                  return a.isChanged
              },
              getOptions: function() {
                  return d
              },
              description: "Checks control scale options."
          }
      };
      a.orgdiagram.TemplatesOptionTask = function(f, b, d, c) {
          var e = {},
              g = {},
              h = new a.common.ObjectReader({
                  groupTitleVerticalAlignment: new a.common.EnumerationReader(a.common.VerticalAlignmentType, !1, b.groupTitleVerticalAlignment),
                  groupTitleHorizontalAlignment: new a.common.EnumerationReader(a.common.HorizontalAlignmentType, !1, b.groupTitleHorizontalAlignment),
                  groupTitleOrientation: new a.common.EnumerationReader(a.text.TextOrientationType, !1, b.groupTitleOrientation),
                  groupTitleFontSize: new a.common.ValueReader(["string"], !1, b.groupTitleFontSize),
                  groupTitleFontFamily: new a.common.ValueReader(["string"], !1, b.groupTitleFontFamily),
                  groupTitleColor: new a.common.ValueReader(["string"], !1, b.groupTitleColor),
                  groupTitleFontWeight: new a.common.ValueReader(["string"], !1, b.groupTitleFontWeight),
                  groupTitleFontStyle: new a.common.ValueReader(["string"], !1, b.groupTitleFontStyle),
                  itemTitleFirstFontColor: new a.common.ValueReader(["string"], !1, b.itemTitleFirstFontColor),
                  itemTitleSecondFontColor: new a.common.ValueReader(["string"], !1, b.itemTitleSecondFontColor),
                  selectCheckBoxLabel: new a.common.ValueReader(["string"], !1, b.selectCheckBoxLabel),
                  onItemRender: new a.common.FunctionReader,
                  onCursorRender: new a.common.FunctionReader,
                  onHighlightRender: new a.common.FunctionReader,
                  templates: new a.common.ArrayReader(new a.common.ObjectReader({
                      name: new a.common.ValueReader(["string"], !0),
                      isActive: new a.common.ValueReader(["boolean"], !1, c.isActive),
                      itemSize: new a.common.ObjectReader({
                          width: new a.common.ValueReader(["number"], !1, c.itemSize.width),
                          height: new a.common.ValueReader(["number"], !1, c.itemSize.height)
                      }, !1, c.itemSize),
                      itemBorderWidth: new a.common.ValueReader(["number"], !1, c.itemBorderWidth),
                      itemTemplate: new a.common.ValueReader(["string",
                          "object"
                      ], !0),
                      minimizedItemShapeType: new a.common.EnumerationReader(a.common.ShapeType, !0),
                      minimizedItemSize: new a.common.ObjectReader({
                          width: new a.common.ValueReader(["number"], !1, c.minimizedItemSize.width),
                          height: new a.common.ValueReader(["number"], !1, c.minimizedItemSize.height)
                      }, !1, c.minimizedItemSize),
                      minimizedItemCornerRadius: new a.common.ValueReader(["number"], !0),
                      minimizedItemLineWidth: new a.common.ValueReader(["number"], !1, c.minimizedItemLineWidth),
                      minimizedItemBorderColor: new a.common.ValueReader(["string"], !0),
                      minimizedItemLineType: new a.common.EnumerationReader(a.common.LineType, !1, c.minimizedItemLineType),
                      minimizedItemFillColor: new a.common.ValueReader(["string"], !0),
                      minimizedItemOpacity: new a.common.ValueReader(["number"], !1, c.minimizedItemOpacity),
                      highlightPadding: new a.common.ObjectReader({
                          left: new a.common.ValueReader(["number"], !1, c.highlightPadding.left),
                          top: new a.common.ValueReader(["number"], !1, c.highlightPadding.top),
                          right: new a.common.ValueReader(["number"], !1, c.highlightPadding.right),
                          bottom: new a.common.ValueReader(["number"], !1, c.highlightPadding.bottom)
                      }, !1, c.highlightPadding),
                      highlightBorderWidth: new a.common.ValueReader(["number"], !1, c.highlightBorderWidth),
                      highlightTemplate: new a.common.ValueReader(["string", "object"], !0),
                      cursorPadding: new a.common.ObjectReader({
                          left: new a.common.ValueReader(["number"], !1, c.cursorPadding.left),
                          top: new a.common.ValueReader(["number"], !1, c.cursorPadding.top),
                          right: new a.common.ValueReader(["number"], !1, c.cursorPadding.right),
                          bottom: new a.common.ValueReader(["number"], !1, c.cursorPadding.bottom)
                      }, !1, c.cursorPadding),
                      cursorBorderWidth: new a.common.ValueReader(["number"], !1, c.cursorBorderWidth),
                      cursorTemplate: new a.common.ValueReader(["string", "object"], !0),
                      buttons: new a.common.ArrayReader(new a.common.ObjectReader({
                          name: new a.common.ValueReader(["string"], !0),
                          icon: new a.common.ValueReader(["string"], !0),
                          text: new a.common.ValueReader(["boolean"], !1, !1),
                          tooltip: new a.common.ValueReader(["string"], !0),
                          size: new a.common.ObjectReader({
                              width: new a.common.ValueReader(["number"], !1, d.size.width),
                              height: new a.common.ValueReader(["number"], !1, d.size.height)
                          }, !1, d.size)
                      }), !0, "name")
                  }), !0, "name")
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: g
                  };
                  e = h.read(e, f.getOptions(), "options", a);
                  return a.isChanged
              },
              getOptions: function() {
                  return e
              },
              description: "Checks items template options."
          }
      };
      a.orgdiagram.VisualTreeOptionTask = function(f, b) {
          var d = {},
              c = {},
              e = new a.common.ObjectReader({
                  leavesPlacementType: new a.common.EnumerationReader(a.common.ChildrenPlacementType, !1, b.leavesPlacementType),
                  childrenPlacementType: new a.common.EnumerationReader(a.common.ChildrenPlacementType, !1, b.childrenPlacementType),
                  maximumColumnsInMatrix: new a.common.ValueReader(["number"], !1, b.maximumColumnsInMatrix),
                  horizontalAlignment: new a.common.EnumerationReader(a.common.HorizontalAlignmentType, !1, b.horizontalAlignment)
              });
          return {
              process: function() {
                  var a = {
                      isChanged: !1,
                      hash: c
                  };
                  d = e.read(d, f.getOptions(), "options", a);
                  return a.isChanged
              },
              getOptions: function() {
                  return d
              },
              description: "Checks items layout options."
          }
      };
      a.orgdiagram.CollinearVectorBundle = function() {
          var f = new a.common.Rect,
              b = [],
              d = [];
          return {
              addVector: function(a, e) {
                  b.push(a);
                  d.push(e);
                  f.addRect(a.from.x, a.from.y);
                  f.addRect(a.to.x, a.to.y)
              },
              resolve: function() {
                  if (1 == b.length) d[0](0, 1, 1);
                  else {
                      var c = a.common.pile(),
                          e, g, h;
                      if (f.width > f.height) {
                          e = 0;
                          for (g = b.length; e < g; e += 1) h = b[e], c.add(h.from.x, h.to.x, d[e])
                      } else {
                          e = 0;
                          for (g = b.length; e < g; e += 1) h = b[e], c.add(h.from.y, h.to.y, d[e])
                      }
                      c.resolve(this, function(a, b, c, d, e, f) {
                          c(d, e, f)
                      })
                  }
              }
          }
      };
      a.orgdiagram.ConnectorAnnotationOffsetResolver =
          function() {
              var f = {};
              return {
                  getOffset: function(b, d) {
                      var c = b.getLineKey();
                      f.hasOwnProperty(c) || (f[c] = new a.orgdiagram.CollinearVectorBundle);
                      f[c].addVector(b, d)
                  },
                  resolve: function() {
                      for (var a in f) f.hasOwnProperty(a) && f[a].resolve()
                  }
              }
          };
      a.orgdiagram.DrawBackgroundAnnotationTask = function(f, b, d, c, e, g) {
          function h(b, c, d) {
              var e, f, h, j, t, v, u, z, x, B, y, w, c = 0;
              for (e = b.length; c < e; c += 1)
                  if (y = b[c], null != y.items && 0 < y.items.length) {
                      j = new a.common.MergedRectangles(i);
                      j.transform = k;
                      t = new a.orgdiagram.BackgroundAnnotationConfig;
                      x = ["opacity", "lineWidth", "borderColor", "fillColor", "lineType"];
                      f = 0;
                      for (h = x.length; f < h; f += 1) B = x[f], j[B] = y.hasOwnProperty(B) ? y[B] : t[B];
                      i.activate("placeholder", 2);
                      v = [];
                      z = {};
                      f = 0;
                      for (h = y.items.length; f < h; f += 1) t = y.items[f], w = g.getItemPosition(t), null != w && (z[t] = !0, u = new a.common.Rect(w.actualPosition), u.offset(y.offset), v.push(u), y.includeChildren && d.loopChildren(this, t, function(b) {
                          z[b] || (z[b] = !0, w = g.getItemPosition(b), u = new a.common.Rect(w.actualPosition), u.offset(y.offset), v.push(u))
                      }));
                      j.draw(v)
                  }
          }
          var i,
              j, k;
          return {
              process: function() {
                  var a = c.getAnnotations(),
                      d;
                  i = f();
                  i.reset("placeholder", 2);
                  0 < a.length && (j = g.getItemsPositions(), k = b.getTransform(), d = e.getNavigationFamily(), h(a, j, d));
                  return !1
              }
          }
      };
      a.orgdiagram.DrawConnectorAnnotationTask = function(f, b, d, c, e, g, h, i) {
          function j(b, c) {
              var d, e, f, h, g, j, x, B, y, w = new a.common.PolylinesBuffer,
                  A = a.orgdiagram.ConnectorAnnotationOffsetResolver(),
                  E = 0;
              switch (i) {
                  case 1:
                      k.activate("placeholder", 4);
                      break;
                  case 2:
                      k.activate("placeholder", 14)
              }
              d = 0;
              for (e = b.length; d < e; d += 1) B = b[d],
                  E = Math.max(E, B.lineWidth);
              d = 0;
              for (e = b.length; d < e; d += 1)
                  if (B = b[d], null != B.fromItem && null != B.toItem && (f = c(B.fromItem), g = c(B.toItem), null != f && null != g)) {
                      h = f.actualPosition;
                      j = g.actualPosition;
                      switch (B.connectorPlacementType) {
                          case 0:
                              x = new a.common.ConnectorOffbeat;
                              break;
                          case 1:
                              x = new a.common.ConnectorStraight
                      }
                      var D;
                      l.transformRect(0, 0, B.labelSize.width, B.labelSize.height, !1, this, function(b, c, d, e) {
                          D = new a.common.Size(d, e)
                      });
                      var F = null;
                      l.transformRect(0, 0, m.width, m.height, !1, this, function(b, c, d, e) {
                          F = new a.common.Size(d,
                              e)
                      });
                      g = new a.common.PaletteItem({
                          lineColor: B.color,
                          lineWidth: B.lineWidth,
                          lineType: B.lineType
                      });
                      f = !a.common.isNullOrEmpty(B.label);
                      h = (new a.common.Rect(h)).offset(B.offset);
                      j = (new a.common.Rect(j)).offset(B.offset);
                      x.draw(w, g, h, j, 3 * B.lineWidth, 6 * E, D, F, B.connectorShapeType, 4, B.labelPlacementType, f, A, function(b, c) {
                          !a.common.isNullOrEmpty(c.label) && null != b && (l.transformRect(b.x, b.y, b.width, b.height, !0, this, function(c, d, e, f) {
                              b = new a.common.Rect(c, d, e, f)
                          }), y = new a.common.RenderEventArgs, y.context = c, k.template(b.x,
                              b.y, 0, 0, 0, 0, b.width, b.height, n.template(), n.getHashCode(), n.render, y, null))
                      }, B)
                  }
              A.resolve();
              w.transform(l, !0);
              k.polylinesBuffer(w)
          }
          var k, l, n, m;
          return {
              process: function() {
                  k = f();
                  l = b.getTransform();
                  c.getOptions();
                  n = h.getTemplate();
                  m = new a.common.Size(g.getContentSize());
                  switch (i) {
                      case 1:
                          k.reset("placeholder", 4);
                          break;
                      case 2:
                          k.reset("placeholder", 14)
                  }
                  j(e.getAnnotations(), g.getItemPosition);
                  return !1
              }
          }
      };
      a.orgdiagram.DrawConnectorsTask = function(f, b, d, c, e) {
          return {
              process: function() {
                  var g = f(),
                      h = b.getGraph(),
                      i = d.getOptions(),
                      j = e.getPaletteManager();
                  g.reset("placeholder", 6);
                  g.activate("placeholder", 6);
                  var k = new a.common.PolylinesBuffer,
                      l = Math.round(i.elbowDotSize / 2),
                      n = {},
                      m = {};
                  h.loopNodes(this, null, function(b) {
                      h.loopNodeEdges(this, b, function(d, e) {
                          if (!n.hasOwnProperty(d)) {
                              var f = null;
                              1 >= e.fromOffset ? f = j.getPalette(1) : (j.selectPalette(e.fromOffset), f = j.getPalette(0));
                              var h = k.getPolyline(f);
                              if (c && null != e.dotId && 0 != i.elbowType && !m.hasOwnProperty(e.dotId)) {
                                  var f = k.getPolyline(h.arrowPaletteItem),
                                      g = e.dotId == e.from ?
                                      e.polyline.getStartPoint() : e.polyline.getEndPoint();
                                  f.addSegment(new a.common.DotSegment(g.x - l, g.y - l, 2 * l, 2 * l, l));
                                  m[e.dotId] = !0
                              }
                              f = null;
                              null != e.parentsArrowId && 1 == i.arrowsDirection ? f = e.parentsArrowId : null != e.childrenArrowId && 2 == i.arrowsDirection && (f = e.childrenArrowId);
                              null == f ? (f = e.polyline.clone(), e.hasMiddle && 0 != i.arrowsDirection && (g = !0, g = e.from == e.middleParent ? 2 == i.arrowsDirection : 1 == i.arrowsDirection, f.addOffsetArrow(g, i.linesWidth, 0.4, i.extraArrowsMinimumSpace, function(a) {
                                      a.mergeTo(k.getPolyline(h.arrowPaletteItem))
                                  })),
                                  e.from == b ? f.mergeTo(h) : h.addInverted(f)) : (f == e.to ? e.polyline.clone().mergeTo(h) : h.addInverted(e.polyline.clone()), h.addArrow(i.linesWidth, function(a) {
                                  a.mergeTo(k.getPolyline(a.paletteItem))
                              }))
                          }
                      });
                      n[b] = !0
                  });
                  g.polylinesBuffer(k);
                  return !1
              }
          }
      };
      a.orgdiagram.DrawCursorTask = function(f, b, d, c, e, g, h, i) {
          function j(b) {
              var d;
              k.activate("placeholder", 11);
              var f = e.getItemPosition(b),
                  h = f.actualPosition,
                  j = new a.common.Rect(f.contentPosition),
                  s = g.getTemplateParams(b).template,
                  t = s.templateConfig,
                  f = t.cursorPadding;
              j.offset(f.left,
                  f.top, f.right, f.bottom);
              d = new a.common.RenderEventArgs;
              d.context = c.getConfig(b);
              d.isCursor = !0;
              d.isSelected = i.isSelected(b);
              d.templateName = t.name;
              l.transformRect(h.x, h.y, h.width, h.height, !0, this, function(a, b, c, e) {
                  k.template(a, b, c, e, j.x, j.y, j.width, j.height, s.cursorTemplate.template(), s.cursorTemplate.getHashCode(), s.cursorTemplate.render, d, {
                      borderWidth: t.cursorBorderWidth
                  })
              })
          }
          var k, l;
          return {
              process: function() {
                  var a = h.getCursorTreeItem();
                  k = f();
                  k.reset("placeholder", 11);
                  null != a && (l = b.getTransform(),
                      j(a));
                  return !1
              }
          }
      };
      a.orgdiagram.DrawHighlightAnnotationTask = function(f, b, d, c, e, g, h, i, j, k, l, n, m) {
          function p(b) {
              var d, f, l, p, A, E, D = !0,
                  F, C = j.getItemPosition(b),
                  J = C.actualPosition;
              switch (C.actualVisibility) {
                  case 2:
                  case 3:
                  case 1:
                      d = h.getItemOptions(b);
                      switch (d.showCallout) {
                          case 2:
                              D = !1;
                              break;
                          case 1:
                              D = !1;
                              break;
                          default:
                              D = v.showCallout
                      }
                      D ? (r.activate("placeholder", 12), s.transformRect(J.x, J.y, J.width, J.height, !0, this, function(h, s, G, I) {
                          var s = new a.common.Rect(h, s, G, I),
                              h = new a.common.Point(s.horizontalCenter(), s.verticalCenter()),
                              G = e.getOptions().scale,
                              I = new a.common.Point(k.getPlaceholderOffset()),
                              J = new a.common.Rect(j.getContentSize()),
                              D = c.getOptimalPanelSize();
                          I.scale(1 / G);
                          D.scale(1 / G);
                          J.scale(1 / G);
                          G = new a.common.Rect(I.x, I.y, Math.min(D.width, J.width), Math.min(D.height, J.height));
                          if (C.actualVisibility >= v.calloutMaximumVisibility && 4 != C.actualVisibility || !G.overlaps(s)) {
                              A = !a.common.isNullOrEmpty(d.calloutTemplateName) ? d.calloutTemplateName : !a.common.isNullOrEmpty(d.templateName) ? d.templateName : !a.common.isNullOrEmpty(v.defaultCalloutTemplateName) ?
                                  v.defaultCalloutTemplateName : v.defaultTemplateName;
                              E = i.getTemplate(A, i.DefaultWidgetTemplateName);
                              s = E.templateConfig.itemSize;
                              I = new a.common.Rect(h.x, h.y, s.width, s.height);
                              switch (v.orientationType) {
                                  case 0:
                                  case 1:
                                      I.y -= s.height / 4;
                                      I.x = h.x < G.horizontalCenter() ? I.x + v.calloutPlacementOffset : I.x - (v.calloutPlacementOffset + s.width);
                                      break;
                                  default:
                                      I.x -= s.width / 4, I.y = h.y < G.verticalCenter() ? I.y + v.calloutPlacementOffset : I.y - (v.calloutPlacementOffset + s.height)
                              }
                              I.x < G.x ? I.x = G.x + 5 : I.right() > G.right() && (I.x -= I.right() -
                                  G.right() + 5);
                              I.y < G.y ? I.y = G.y + 5 : I.bottom() > G.bottom() && (I.y -= I.bottom() - G.bottom() + 5);
                              l = I;
                              f = new a.common.Rect(l);
                              f.addRect(h.x, h.y);
                              f.offset(50);
                              F = f.getCSS();
                              F.display = "inherit";
                              F.visibility = "inherit";
                              a.common.JsonML.applyStyles(u.calloutPlaceholder, F);
                              h.x -= f.x;
                              h.y -= f.y;
                              l.x -= f.x;
                              l.y -= f.y;
                              p = new a.common.RenderEventArgs;
                              p.context = g.getConfig(b);
                              p.isCursor = n.getCursorTreeItem() == b;
                              p.isSelected = m.isSelected(b);
                              p.templateName = E.templateConfig.name;
                              r.resize("calloutplaceholder", f.width, f.height);
                              r.activate("calloutplaceholder",
                                  15);
                              r.template(l.x, l.y, l.width, l.height, 0, 0, l.width, l.height, E.itemTemplate.template(), E.itemTemplate.getHashCode(), E.itemTemplate.render, p, null);
                              t.pointerPlacement = 0;
                              t.cornerRadius = v.calloutCornerRadius;
                              t.offset = v.calloutOffset;
                              t.opacity = v.calloutOpacity;
                              t.lineWidth = v.calloutLineWidth;
                              t.pointerWidth = v.calloutPointerWidth;
                              t.borderColor = v.calloutBorderColor;
                              t.fillColor = v.calloutfillColor;
                              t.draw(h, l)
                          } else q()
                      })) : q();
                      break;
                  case 4:
                      q()
              }
          }
  
          function q() {
              a.common.JsonML.applyStyles(u.calloutPlaceholder, {
                  display: "none",
                  visibility: "hidden"
              })
          }
          var r, s, t = new a.common.Callout(b()),
              v, u;
          return {
              process: function() {
                  var a = l.getHighlightTreeItem();
                  r = b();
                  r.reset("calloutplaceholder", 15);
                  null !== a && (s = d.getTransform(), v = h.getOptions(), u = f(), p(a));
                  return !1
              }
          }
      };
      a.orgdiagram.DrawHighlightPathAnnotationTask = function(f, b, d, c, e) {
          function g(b, c, d, f) {
              var g, n, m, p, q, r, s, t, v, u, z, x, B;
              if (0 < d.length) {
                  z = new a.common.PolylinesBuffer;
                  switch (e) {
                      case 1:
                          b.activate("placeholder", 5);
                          break;
                      case 2:
                          b.activate("placeholder", 7)
                  }
                  var y = {};
                  g = 0;
                  for (n = d.length; g <
                      n; g += 1)
                      if (u = d[g], null != u.items && 0 < u.items.length && (t = u.items.slice(0), q = t[0], f.hasNode(q))) {
                          m = 1;
                          for (p = t.length; m < p; m += 1) r = t[m], f.hasNode(r) && (y.hasOwnProperty(q) ? y[q].push(r) : y[q] = [r], q = r)
                      }
                  var w = {};
                  for (x in y) w[x] = {}, y.hasOwnProperty(x) && f.getShortestPath(this, x, y[x], function(a) {
                      return a.weight
                  }, function(a, b) {
                      w[x][b] = a
                  });
                  g = 0;
                  for (n = d.length; g < n; g += 1)
                      if (u = d[g], m = new a.common.PaletteItem({
                              lineColor: null != u.color ? u.color : c.highlightLinesColor,
                              lineWidth: null != u.lineWidth ? u.lineWidth : c.highlightLinesWidth,
                              lineType: null != u.lineType ? u.lineType : c.highlightLinesType,
                              fillColor: null,
                              opacity: u.opacity
                          }), y = z.getPolyline(m), null != u.items && 0 < u.items.length && (t = u.items.slice(0), q = t[0], f.hasNode(q))) {
                          m = 1;
                          for (p = t.length; m < p; m += 1)
                              if (r = t[m], f.hasNode(r)) {
                                  s = w[q][r] || [];
                                  for (q = s.length - 2; 0 <= q; q -= 1) x = s[q + 1], B = s[q], v = f.edge(x, B), v.from == x ? v.polyline.clone().mergeTo(y) : y.addInverted(v.polyline.clone()), u.showArrows && (B == v.parentsArrowId || B == v.childrenArrowId) && y.addArrow(u.lineWidth, function(a) {
                                      a.mergeTo(z.getPolyline(a.paletteItem))
                                  });
                                  q = r
                              }
                      }
                  b.polylinesBuffer(z)
              }
          }
          return {
              process: function() {
                  var a = c.getGraph(),
                      i = b.getOptions(),
                      j = d.getAnnotations(),
                      k = f();
                  switch (e) {
                      case 1:
                          k.reset("placeholder", 5);
                          break;
                      case 2:
                          k.reset("placeholder", 7)
                  }
                  g(k, i, j, a);
                  return !1
              }
          }
      };
      a.orgdiagram.DrawHighlightTask = function(f, b, d, c, e, g, h, i, j) {
          function k(b) {
              var d;
              l.activate("placeholder", 8);
              var f = e.getItemPosition(b),
                  h = f.actualPosition,
                  k = g.getTemplateParams(b).template,
                  t = k.templateConfig,
                  v = t.highlightPadding;
              d = new a.common.RenderEventArgs;
              d.context = c.getConfig(b);
              d.isCursor = i.getCursorTreeItem() == b;
              d.isSelected = j.isSelected(b);
              d.templateName = t.name;
              n.transformRect(h.x, h.y, h.width, h.height, !0, this, function(b, c, e, h) {
                  var i = new a.common.Rect(0, 0, Math.round(e), Math.round(h));
                  i.offset(v.left, v.top, v.right, v.bottom);
                  1 == f.actualVisibility ? l.template(b, c, e, h, i.x, i.y, i.width, i.height, k.highlightTemplate.template(), k.highlightTemplate.getHashCode(), k.highlightTemplate.render, d, null) : l.template(b, c, e, h, i.x, i.y, i.width - 1, i.height - 1, k.dotHighlightTemplate.template(), k.dotHighlightTemplate.getHashCode(),
                      k.dotHighlightTemplate.render, d, null)
              })
          }
          var l, n;
          return {
              process: function() {
                  var a = h.getHighlightTreeItem();
                  l = f();
                  l.reset("placeholder", 8);
                  null != a && (n = b.getTransform(), k(a));
                  return !1
              }
          }
      };
      a.orgdiagram.DrawItemLabelsTask = function(f, b, d, c, e) {
          function g(b, c) {
              var d = [];
              if (0 == c.showLabels || 1 == c.showLabels)
                  for (var e in b.treeItemsPositions)
                      if (b.treeItemsPositions.hasOwnProperty(e)) {
                          var f = c.itemsOptions[e],
                              g = b.treeItemsPositions[e],
                              m = g.actualPosition;
                          null != f && b.transform.transformRect(m.x, m.y, m.width, m.height, !0, this, function(b, e, h, k) {
                              var m;
                              switch (g.actualVisibility) {
                                  case 1:
                                      0 == c.showLabels && (p = new a.common.Label(b, e, h, k), p.weight = 1E4, p.labelType = 1, d.push(p));
                                      break;
                                  case 2:
                                  case 3:
                                      var p;
                                      p = f;
                                      var q = g,
                                          B = null,
                                          y, w, A, E;
                                      if (!a.common.isNullOrEmpty(p.label)) {
                                          var D;
                                          D = 3;
                                          switch (p.showLabel) {
                                              case 0:
                                                  switch (c.showLabels) {
                                                      case 0:
                                                          switch (q.actualVisibility) {
                                                              case 3:
                                                              case 2:
                                                                  D = 0
                                                          }
                                                          break;
                                                      case 1:
                                                          D = 2
                                                  }
                                                  break;
                                              case 1:
                                                  D = 2
                                          }
                                          switch (D) {
                                              case 0:
                                                  E = q.leftPadding + q.rightPadding;
                                                  break;
                                              case 2:
                                                  E = 1E4;
                                                  break;
                                              case 3:
                                                  E = 0
                                          }
                                          if (3 != D) {
                                              A = null != p.labelSize ? p.labelSize :
                                                  c.labelSize;
                                              q = 3 != p.labelOrientation ? p.labelOrientation : 3 != c.labelOrientation ? c.labelOrientation : 0;
                                              B = 0 != p.labelPlacement ? p.labelPlacement : 0 != c.labelPlacement ? c.labelPlacement : 1;
                                              switch (q) {
                                                  case 0:
                                                      y = A.width;
                                                      w = A.height;
                                                      break;
                                                  case 1:
                                                  case 2:
                                                      w = A.width, y = A.height
                                              }
                                              A = c.labelOffset;
                                              var F, C;
                                              switch (B) {
                                                  case 0:
                                                  case 1:
                                                      F = new a.common.Rect(b + h / 2 - y / 2, e - A - w, y, w);
                                                      switch (q) {
                                                          case 0:
                                                              C = 0;
                                                              m = 2;
                                                              break;
                                                          case 1:
                                                              m = C = 1;
                                                              break;
                                                          case 2:
                                                              C = 2, m = 1
                                                      }
                                                      break;
                                                  case 2:
                                                  case 11:
                                                      F = new a.common.Rect(b + h + A, e - A - w, y, w);
                                                      switch (q) {
                                                          case 0:
                                                              C = 1;
                                                              m = 2;
                                                              break;
                                                          case 1:
                                                              C =
                                                                  1;
                                                              m = 0;
                                                              break;
                                                          case 2:
                                                              m = C = 2
                                                      }
                                                      break;
                                                  case 3:
                                                      F = new a.common.Rect(b + h + A, e + k / 2 - w / 2, y, w);
                                                      switch (q) {
                                                          case 0:
                                                              m = C = 1;
                                                              break;
                                                          case 1:
                                                              m = C = 0;
                                                              break;
                                                          case 2:
                                                              C = 0, m = 2
                                                      }
                                                      break;
                                                  case 4:
                                                  case 12:
                                                      F = new a.common.Rect(b + h + A, e + k + A, y, w);
                                                      switch (q) {
                                                          case 0:
                                                              C = 1;
                                                              m = 0;
                                                              break;
                                                          case 1:
                                                              C = 2;
                                                              m = 0;
                                                              break;
                                                          case 2:
                                                              C = 1, m = 2
                                                      }
                                                      break;
                                                  case 5:
                                                      F = new a.common.Rect(b + h / 2 - y / 2, e + k + A, y, w);
                                                      switch (q) {
                                                          case 0:
                                                              m = C = 0;
                                                              break;
                                                          case 1:
                                                              C = 2;
                                                              m = 1;
                                                              break;
                                                          case 2:
                                                              m = C = 1
                                                      }
                                                      break;
                                                  case 6:
                                                  case 10:
                                                      F = new a.common.Rect(b - y - A, e + k + A, y, w);
                                                      switch (q) {
                                                          case 0:
                                                              C = 2;
                                                              m = 0;
                                                              break;
                                                          case 1:
                                                              m = C = 2;
                                                              break;
                                                          case 2:
                                                              C =
                                                                  1, m = 0
                                                      }
                                                      break;
                                                  case 7:
                                                      F = new a.common.Rect(b - y - A, e + k / 2 - w / 2, y, w);
                                                      switch (q) {
                                                          case 0:
                                                              C = 2;
                                                              m = 1;
                                                              break;
                                                          case 1:
                                                              C = 0;
                                                              m = 2;
                                                              break;
                                                          case 2:
                                                              m = C = 0
                                                      }
                                                      break;
                                                  case 8:
                                                  case 9:
                                                      switch (F = new a.common.Rect(b - y - A, e - A - w, y, w), q) {
                                                          case 0:
                                                              m = C = 2;
                                                              break;
                                                          case 1:
                                                              C = 1;
                                                              m = 2;
                                                              break;
                                                          case 2:
                                                              C = 2, m = 0
                                                      }
                                              }
                                              b = C;
                                              B = new a.common.Label(F);
                                              B.labelType = D;
                                              B.weight = E;
                                              B.text = p.label;
                                              B.labelOrientation = q;
                                              B.horizontalAlignmentType = b;
                                              B.verticalAlignmentType = m
                                          }
                                      }
                                      p = B;
                                      null != p && d.push(p)
                              }
                          })
                      }
              0 == c.showLabels && a.common.getCrossingRectangles(this, d, function(a, b) {
                  if (a.isActive &&
                      b.isActive) switch (a.labelType) {
                      case 1:
                          switch (b.labelType) {
                              case 0:
                                  b.isActive = !1;
                                  break;
                              case 2:
                                  b.isActive = !1
                          }
                          break;
                      case 2:
                          switch (b.labelType) {
                              case 1:
                                  a.isActive = !1;
                                  break;
                              case 0:
                                  b.isActive = !1
                          }
                          break;
                      case 0:
                          switch (b.labelType) {
                              case 1:
                                  a.isActive = !1;
                                  break;
                              case 0:
                                  a.weight <= b.weight ? a.isActive = !1 : b.isActive = !1;
                                  break;
                              case 2:
                                  a.isActive = !1
                          }
                  }
              });
              b.graphics.activate("placeholder", 10);
              e = {
                  fontSize: c.labelFontSize,
                  fontFamily: c.labelFontFamily,
                  fontStyle: c.labelFontStyle,
                  fontWeight: c.labelFontWeight,
                  fontColor: c.labelColor
              };
              for (var m = 0, p = d.length; m < p; m += 1) {
                  var q = d[m];
                  if (q.isActive) switch (q.labelType) {
                      case 0:
                      case 2:
                          b.graphics.text(q.x, q.y, q.width, q.height, q.text, q.labelOrientation, q.horizontalAlignmentType, q.verticalAlignmentType, e)
                  }
              }
          }
          return {
              process: function() {
                  var a = c.getOptions(),
                      d = {
                          graphics: f(),
                          transform: b.getTransform(),
                          treeItemsPositions: e.getItemsPositions()
                      },
                      a = {
                          showLabels: a.showLabels,
                          labelFontSize: a.labelFontSize,
                          labelFontFamily: a.labelFontFamily,
                          labelFontStyle: a.labelFontStyle,
                          labelFontWeight: a.labelFontWeight,
                          labelColor: a.labelColor,
                          itemsOptions: c.getItemsOptions(),
                          labelSize: a.labelSize,
                          labelOrientation: a.labelOrientation,
                          labelPlacement: a.labelPlacement,
                          labelOffset: a.labelOffset
                      };
                  d.graphics.reset("placeholder", 10);
                  g(d, a);
                  return !1
              }
          }
      };
      a.orgdiagram.DrawMinimizedItemsTask = function(f, b, d, c, e, g) {
          function h() {
              var b = new a.common.PolylinesBuffer,
                  d = {},
                  f, h = new a.common.Marker,
                  g, t, v, u, z, x, B, y, w, A;
              for (A in n) n.hasOwnProperty(A) && (z = n[A], x = z.actualPosition, B = c.getItemOptions(A), j.transformRect(x.x, x.y, x.width, x.height, !0, this, function(c, i, n, j) {
                  switch (z.actualVisibility) {
                      case 2:
                          y = e.getTemplateParams(A);
                          w = y.template.templateConfig;
                          v = t = g = null;
                          u = 0;
                          null != B && (t = g = B.itemTitleColor, v = B.minimizedItemShapeType);
                          g = g || w.minimizedItemBorderColor || "#000080";
                          t = t || w.minimizedItemFillColor || "#000080";
                          null == v && (v = null !== w.minimizedItemShapeType ? w.minimizedItemShapeType : l.minimizedItemShapeType);
                          u = null === w.minimizedItemCornerRadius ? w.minimizedItemSize.width / 2 : w.minimizedItemCornerRadius;
                          null == v || 6 == v ? (f = b.getPolyline(new a.common.PaletteItem({
                              lineColor: g,
                              lineWidth: w.minimizedItemLineWidth,
                              lineType: w.minimizedItemLineType,
                              fillColor: t,
                              opacity: w.minimizedItemOpacity
                          })), f.addSegment(new a.common.DotSegment(c, i, n, j, u))) : h.draw(b, v, new a.common.Rect(c, i, n, j), new a.common.PaletteItem({
                              lineColor: g,
                              lineWidth: w.minimizedItemLineWidth,
                              lineType: w.minimizedItemLineType,
                              fillColor: t,
                              opacity: w.minimizedItemOpacity
                          }));
                          break;
                      default:
                          k && (g = "#ff0000", d.hasOwnProperty(g) || (d[g] = new a.common.PaletteItem({
                                  lineColor: g,
                                  lineWidth: 1,
                                  lineType: 0,
                                  fillColor: g,
                                  opacity: 1
                              })), f = b.getPolyline(d[g]),
                              f.addSegment(new a.common.DotSegment(c - 1, i - 1, 2, 2, 1)))
                  }
              }));
              i.activate("placeholder", 9);
              i.polylinesBuffer(b)
          }
          var i, j, k = !1,
              l, n;
          return {
              process: function() {
                  i = f();
                  j = b.getTransform();
                  l = c.getOptions();
                  n = g.getItemsPositions();
                  i.reset("placeholder", 9);
                  h();
                  return !1
              }
          }
      };
      a.orgdiagram.DrawShapeAnnotationTask = function(f, b, d, c, e, g, h, i) {
          function j(b, c) {
              var d, e, f, h, g, j, x, B, y, w, A, E;
              switch (i) {
                  case 1:
                      d = k.activate("placeholder", 3);
                      break;
                  case 2:
                      d = k.activate("placeholder", 13)
              }
              e = 0;
              for (f = b.length; e < f; e += 1)
                  if (A = b[e], null != A.items &&
                      0 < A.items.length) {
                      B = new a.common.Rect;
                      h = 0;
                      for (g = A.items.length; h < g; h += 1) x = c(A.items[h]), null != x && B.addRect(x.actualPosition);
                      if (!B.isEmpty()) {
                          j = new a.common.Shape(k);
                          x = new a.orgdiagram.ShapeAnnotationConfig;
                          y = "opacity cornerRadius shapeType offset lineWidth borderColor fillColor lineType labelSize labelOffset labelPlacement zOrderType".split(" ");
                          h = 0;
                          for (g = y.length; h < g; h += 1) w = y[h], j[w] = A.hasOwnProperty(w) ? A[w] : x[w];
                          j.position = B;
                          j.orientationType = n.orientationType;
                          j.panelSize = d.size;
                          j.labelTemplate =
                              m;
                          j.hasLabel = null != A.templateName || null != A.label;
                          E = new a.common.RenderEventArgs;
                          E.context = A;
                          E.templateName = j.labelTemplate;
                          l.transformRect(B.x, B.y, B.width, B.height, !0, this, function(b, c, d, e) {
                              b = new a.common.Rect(b, c, d, e);
                              j.draw(b, E)
                          })
                      }
                  }
          }
          var k, l, n, m;
          return {
              process: function() {
                  k = f();
                  l = b.getTransform();
                  n = c.getOptions();
                  m = h.getTemplate();
                  switch (i) {
                      case 1:
                          k.reset("placeholder", 3);
                          break;
                      case 2:
                          k.reset("placeholder", 13)
                  }
                  j(e.getAnnotations(), g.getItemPosition);
                  return !1
              }
          }
      };
      a.orgdiagram.DrawTreeItemsTask = function(f,
          b, d, c, e, g, h, i, j, k, l, n, m, p) {
          function q() {
              var b, e = k.getCursorTreeItem(),
                  f, n, m;
              n = null;
              if (null != i) {
                  n = c.getOptions().scale;
                  var p = new a.common.Point(i.getPlaceholderOffset()),
                      q = new a.common.Rect(h.getContentSize()),
                      C = d.getOptimalPanelSize();
                  p.scale(1 / n);
                  C.scale(1 / n);
                  q.scale(1 / n);
                  n = new a.common.Rect(p.x, p.y, Math.min(C.width, q.width), Math.min(C.height, q.height))
              }
              m = n;
              for (var J in r) r.hasOwnProperty(J) && (f = r[J], n = f.actualPosition, 1 == f.actualVisibility && t.transformRect(n.x, n.y, n.width, n.height, !0, this, function(c,
                  d, h, i) {
                  var n = new a.common.Rect(c, d, h, i);
                  if (null == m || m.overlaps(n)) {
                      var n = j.getTemplateParams(J),
                          k = n.template;
                      b = new a.common.RenderEventArgs;
                      b.id = J;
                      b.context = g.getConfig(J);
                      b.isCursor = J == e;
                      b.isSelected = l.isSelected(J);
                      b.templateName = k.templateConfig.name;
                      s.activate("placeholder", 12);
                      s.template(c, d, h, i, f.contentPosition.x, f.contentPosition.y, f.contentPosition.width, f.contentPosition.height, k.itemTemplate.template(), k.itemTemplate.getHashCode(), k.itemTemplate.render, b, {
                          borderWidth: k.templateConfig.itemBorderWidth
                      });
                      if (n.hasGroupTitle) {
                          var p = 0;
                          switch (v.groupTitlePlacementType) {
                              case 2:
                              case 0:
                                  p = 2;
                                  break;
                              case 3:
                                  p = h - (v.groupTitlePanelSize - 4)
                          }
                          s.template(c, d, h, i, p, f.contentPosition.y, v.groupTitlePanelSize - 4, f.contentPosition.height + 2, x.template(), x.getHashCode(), x.render, b, null)
                      }
                      n.hasSelectorCheckbox && (s.activate("placeholder", 16), s.template(c, d, h, i, f.contentPosition.x, i - (v.checkBoxPanelSize - 4), f.contentPosition.width, v.checkBoxPanelSize - 4, z.template(), z.getHashCode(), z.render, b, null));
                      if (n.hasButtons) {
                          s.activate("placeholder",
                              16);
                          p = 0;
                          switch (v.groupTitlePlacementType) {
                              case 2:
                              case 0:
                                  p = h - (v.buttonsPanelSize - 4);
                                  break;
                              case 3:
                                  p = 2
                          }
                          s.template(c, d, h, i, p, f.contentPosition.y, v.buttonsPanelSize - 4, Math.max(f.contentPosition.height, i - f.contentPosition.y), u.template(), k.templateConfig.name + u.getHashCode(), u.render, n, null)
                      }
                  }
              }))
          }
          var r, s, t, v, u, z, x;
          return {
              process: function() {
                  s = f();
                  v = e.getOptions();
                  r = h.getItemsPositions();
                  t = b.getTransform();
                  u = p.getTemplate();
                  z = m.getTemplate();
                  x = n.getTemplate();
                  s.reset("placeholder", 12);
                  s.reset("placeholder",
                      16);
                  q();
                  return !1
              }
          }
      };
      a.orgdiagram.ActiveItemsTask = function(f, b) {
          function d(a, c) {
              var d = [],
                  e, f;
              e = 0;
              for (f = c.length; e < f; e += 1) {
                  var g = c[e],
                      m = b.getTemplate(g.templateName, a.defaultTemplateName, b.DefaultWidgetTemplateName).templateConfig;
                  g.isActive && m.isActive && d.push(g.id)
              }
              return d
          }
          var c = [],
              e = {},
              g = new a.common.ArrayReader(new a.common.ValueReader(["string", "number"], !0), !0);
          return {
              process: function() {
                  var a = {
                          isChanged: !1,
                          hash: e
                      },
                      b = f.getOptions();
                  c = g.read(c, d(b, b.items), "items", a);
                  return a.isChanged
              },
              getActiveItems: function() {
                  return e.items
              }
          }
      };
      a.orgdiagram.AnnotationLabelTemplateTask = function() {
          var f = null;
          return {
              process: function() {
                  return !1
              },
              getTemplate: function() {
                  null == f && (f = new a.common.AnnotationLabelTemplate);
                  return f
              }
          }
      };
      a.orgdiagram.ButtonsTemplateTask = function(a, b) {
          var d = null;
          return {
              process: function() {
                  return !1
              },
              getTemplate: function() {
                  null == d && (d = new b.ButtonsTemplate);
                  return d
              }
          }
      };
      a.orgdiagram.CheckBoxTemplateTask = function(f) {
          var b = null;
          return {
              process: function() {
                  b = null;
                  return !0
              },
              getTemplate: function() {
                  var d;
                  null == b && (d = f.getOptions(),
                      b = new a.common.CheckBoxTemplate(d.selectCheckBoxLabel));
                  return b
              }
          }
      };
      a.orgdiagram.GroupTitleTemplateTask = function(f) {
          var b = null;
          return {
              process: function() {
                  b = null;
                  return !0
              },
              getTemplate: function() {
                  var d;
                  null == b && (d = f.getOptions(), b = new a.common.GroupTitleTemplate(d));
                  return b
              }
          }
      };
      a.orgdiagram.ItemTemplateParamsTask = function(f, b, d) {
          function c(a, b, c) {
              var d = !1;
              switch (b) {
                  case 0:
                      switch (c) {
                          case 0:
                              d = a;
                              break;
                          case 1:
                              d = !0;
                              break;
                          case 2:
                              d = !1
                      }
                      break;
                  case 1:
                      d = !0;
                      break;
                  case 2:
                      d = !1
              }
              return d
          }
          var e = {};
          return {
              process: function() {
                  var g =
                      f.getOptions(),
                      h = 0 < g.buttons.length,
                      i = b.getCursorItem(),
                      j = g.items,
                      k, l;
                  e = {};
                  k = 0;
                  for (l = j.length; k < l; k += 1) {
                      var n = j[k],
                          m = new a.orgdiagram.TemplateParams,
                          p = i == n.id,
                          q = d.getTemplate(n.templateName, g.defaultTemplateName, d.DefaultWidgetTemplateName),
                          r = q.templateConfig,
                          s = null != r.buttons && 0 < r.buttons.length;
                      m.template = q;
                      m.isActive = n.isActive && r.isActive;
                      m.isActive && (m.hasSelectorCheckbox = c(p, n.hasSelectorCheckbox, g.hasSelectorCheckbox), m.hasButtons = (h || s) && c(p, n.hasButtons, g.hasButtons), m.hasButtons && (m.buttons =
                          s ? r.buttons : g.buttons));
                      m.hasGroupTitle = !a.common.isNullOrEmpty(n.groupTitle);
                      e[n.id] = m
                  }
                  return !0
              },
              getTemplateParams: function(a) {
                  return e[a]
              }
          }
      };
      a.orgdiagram.ReadTemplatesTask = function(f) {
          var b = {};
          return {
              process: function() {
                  var d, c, e, g = f.getOptions(),
                      h = g.templates;
                  b = {};
                  b.DefaultWidgetTemplate = new a.orgdiagram.Template(g, new a.orgdiagram.TemplateConfig);
                  d = new a.orgdiagram.TemplateConfig;
                  d.name = "DefaultWidgetLabelAnnotationTemplate";
                  d.isActive = !1;
                  d.itemSize = new a.common.Size(100, 20);
                  d.minimizedItemSize =
                      new a.common.Size(0, 0);
                  c = new a.orgdiagram.Template;
                  c.templateConfig = d;
                  c.minimizedItemCornerRadius = d.minimizedItemSize.width / 2;
                  c.itemTemplate = new a.common.LabelAnnotationTemplate;
                  c.dotHighlightTemplate = new a.common.DotHighlightTemplate(g, d);
                  b.DefaultWidgetLabelAnnotationTemplate = c;
                  d = 0;
                  for (c = h.length; d < c; d += 1) e = h[d], b[e.name] = new a.orgdiagram.Template(g, e);
                  return !0
              },
              getTemplate: function(a, c, e) {
                  return b[a] || b[c] || b[e]
              },
              DefaultWidgetTemplateName: "DefaultWidgetTemplate",
              DefaultWidgetLabelAnnotationTemplateName: "DefaultWidgetLabelAnnotationTemplate"
          }
      };
      a.orgdiagram.CombinedNormalVisibilityItemsTask = function(f, b, d, c, e, g, h, i, j, k, l, n) {
          function m(a) {
              var b = [],
                  c, d, e, f, h, g, i = {};
              c = 0;
              for (d = a.length; c < d; c += 1) {
                  e = a[c];
                  h = e.getItems();
                  e = 0;
                  for (f = h.length; e < f; e += 1) g = h[e], i.hasOwnProperty(g) || (b.push(g), i[g] = !0)
              }
              return b
          }
          var p = [],
              q = {},
              r = [b, d, c, e, g, h, i, j, k, l, n],
              s = new a.common.ArrayReader(new a.common.ValueReader(["string", "number"], !0), !0);
          return {
              process: function() {
                  var a = {
                          isChanged: !1,
                          hash: q
                      },
                      b = f.getOptions();
                  p = s.read(p, m(r), "items", a);
                  if (0 == b.pageFitMode || 1 == b.minimalVisibility) a.isChanged = !1;
                  return a.isChanged
              },
              isItemSelected: function(a) {
                  return q.items.hasOwnProperty(a)
              }
          }
      };
      a.orgdiagram.CursorItemTask = function(a, b) {
          var d = null;
          return {
              process: function() {
                  var c = a.getCursorItem(),
                      e = null != b ? b.getActiveItems() : {};
                  d = null != c && e.hasOwnProperty(c) ? c : null;
                  return !0
              },
              getCursorTreeItem: function() {
                  return d
              },
              getItems: function() {
                  return null != d ? [d] : []
              }
          }
      };
      a.orgdiagram.CursorNeighboursTask = function(a, b) {
          function d(a, b) {
              var c = [];
              null !== a && b.loopNeighbours(this, a, function(a, b) {
                  0 === b.visibility && c.push(a);
                  return !0
              });
              return c
          }
          var c = [];
          return {
              process: function() {
                  var e = b.getNavigationFamily(),
                      g = a.getCursorTreeItem();
                  c = d(g, e);
                  return !0
              },
              getItems: function() {
                  return c
              }
          }
      };
      a.orgdiagram.HighlightItemTask = function(a, b) {
          var d = null;
          return {
              process: function() {
                  var c = a.getHighlightItem(),
                      e = null != b ? b.getActiveItems() : {};
                  d = null != c && e.hasOwnProperty(c) ? c : null;
                  return !0
              },
              getHighlightTreeItem: function() {
                  return d
              }
          }
      };
      a.orgdiagram.NormalVisibilityItemsByAnnotationTask = function(f) {
          function b(a) {
              var b = [],
                  c = {},
                  d, e, f, n, m, p;
              d = 0;
              for (e =
                  a.length; d < e; d += 1)
                  if (f = a[d], f.selectItems) {
                      m = f.items;
                      f = 0;
                      for (n = m.length; f < n; f += 1) p = m[f], null != p && !c.hasOwnProperty(p) && (b.push(p), c[p] = !0)
                  }
              return b
          }
          var d = [],
              c = {},
              e = new a.common.ArrayReader(new a.common.ValueReader(["string", "number"], !0), !0);
          return {
              process: function() {
                  var a = {
                          isChanged: !1,
                          hash: c
                      },
                      h = f.getAnnotations();
                  d = e.read(d, b(h), "items", a);
                  return a.isChanged
              },
              getItems: function() {
                  return d
              }
          }
      };
      a.orgdiagram.NormalVisibilityItemsByConnectorAnnotationTask = function(f) {
          function b(a) {
              var b = [],
                  c = {},
                  d, e, f;
              d = 0;
              for (e = a.length; d < e; d += 1) f = a[d], f.selectItems && (null != f.fromItem && !c.hasOwnProperty(f.fromItem) && (b.push(f.fromItem), c[f.fromItem] = !0), null != f.toItem && !c.hasOwnProperty(f.toItem) && (b.push(f.toItem), c[f.toItem] = !0));
              return b
          }
          var d = [],
              c = {},
              e = new a.common.ArrayReader(new a.common.ValueReader(["string", "number"], !0), !0);
          return {
              process: function() {
                  var a = {
                          isChanged: !1,
                          hash: c
                      },
                      h = f.getAnnotations();
                  d = e.read(d, b(h), "items", a);
                  return a.isChanged
              },
              getItems: function() {
                  return d
              }
          }
      };
      a.orgdiagram.SelectedItemsTask =
          function(f) {
              function b(a) {
                  var b = [],
                      c = {},
                      d, e, f;
                  d = 0;
                  for (e = a.length; d < e; d += 1) f = a[d], null != f && !c.hasOwnProperty(f) && (b.push(f), c[f] = !0);
                  return b
              }
              var d = [],
                  c = {},
                  e = new a.common.ArrayReader(new a.common.ValueReader(["string", "number"], !0), !0);
              return {
                  process: function() {
                      var a = {
                              isChanged: !1,
                              hash: c
                          },
                          h = f.getSelectedItems();
                      d = e.read(d, b(h), "items", a);
                      return a.isChanged
                  },
                  getItems: function() {
                      return d
                  },
                  isSelected: function(a) {
                      return c.items.hasOwnProperty(a)
                  }
              }
          };
      a.orgdiagram.SelectionPathItemsTask = function(a, b, d, c) {
          function e(a,
              b, c) {
              var d = [],
                  e = {},
                  f, g, p;
              g = 0;
              for (p = a.length; g < p; g += 1) switch (f = a[g], c) {
                  case 1:
                      b.loopParents(this, f, function(a, c) {
                          if (null != e[a]) return b.SKIP;
                          4 != c.visibility && d.push(a);
                          e[a] = !0
                      })
              }
              return d
          }
          var g = [];
          return {
              process: function() {
                  var h = c.getSelectionPathMode(),
                      i = a.getNavigationFamily(),
                      j = b.getCursorTreeItem(),
                      k = d.getItems().slice(0);
                  k.push(j);
                  g = e(k, i, h);
                  return !0
              },
              getItems: function() {
                  return g
              }
          }
      };
      a.orgdiagram.CombinedContextsTask = function(a, b) {
          return {
              process: function() {
                  return !0
              },
              getConfig: function(d) {
                  return a.getConfig(d) ||
                      null != b && b.getConfig(d)
              }
          }
      };
      a.orgdiagram.ConnectionsGraphTask = function(f, b, d, c, e) {
          var g = {
              graph: null,
              nodeid: 0
          };
          return {
              process: function() {
                  for (var h = f().activate("placeholder", 6), i = c.getBundles(), j = c.getNestedLayoutBottomConnectorIds(), k = d.getOptions(), l = {
                          graph: a.common.graph(),
                          nodeid: 0
                      }, h = {
                          treeItemsPositions: e.getItemsPositions(),
                          nestedLayoutBottomConnectorIds: j,
                          transform: b.getTransform(),
                          hasGraphics: h.hasGraphics
                      }, k = {
                          connectorType: k.connectorType,
                          showExtraArrows: k.showExtraArrows,
                          bevelSize: k.bevelSize,
                          elbowType: k.elbowType
                      }, j = 0, n = i.length; j < n; j += 1) i[j].trace(l, h, k);
                  g = l;
                  return !0
              },
              getGraph: function() {
                  return g.graph
              }
          }
      };
      a.orgdiagram.ItemsPositionsTask = function(f, b, d, c, e, g, h, i, j, k, l) {
          var n, m;
  
          function p(b) {
              var c = new a.common.Rect(0, 0, 0, 0),
                  d, e, f, h, g;
              switch (K.orientationType) {
                  case 2:
                  case 3:
                      b.invert()
              }
              if (!E.isEmpty()) switch (I.pageFitMode) {
                  case 0:
                  case 5:
                      d = [new a.orgdiagram.LevelVisibility(0, 1)];
                      c = q(d, 0);
                      break;
                  default:
                      d = [new a.orgdiagram.LevelVisibility(0, 1)];
                      e = [];
                      switch (I.minimalVisibility) {
                          case 2:
                              e.push(2);
                              break;
                          case 0:
                          case 3:
                          case 4:
                              e.push(2), e.push(3)
                      }
                      E.loopLevelsReversed(this, function(b) {
                          var c;
                          for (c = 0; c < e.length; c += 1) d.push(new a.orgdiagram.LevelVisibility(b, e[c]))
                      });
                      f = q(d, d.length - 1);
                      f.addRect(b);
                      f.offset(0, 0, 5, 5);
                      g = h = b = null;
                      c = q(d, 0);
                      if (!r(c, f) && (b = 0, c = q(d, d.length - 1), r(c, f))) {
                          for (g = h = d.length - 1; 1 < h - b;) g = Math.floor((h + b) / 2), c = q(d, g), r(c, f) ? h = g : b = g;
                          h !== g && (c = q(d, h))
                      }
              }
              return c
          }
  
          function q(b, c) {
              var d, e;
              D = [];
              E.loopLevels(this, function() {
                  var b = new a.orgdiagram.TreeLevelPosition;
                  b.currentvisibility = 1;
                  D.push(b)
              });
              for (d = 0; d <= c; d += 1) e = b[d], D[e.level].currentvisibility = e.currentvisibility;
              v();
              x();
              u();
              d = I.lineLevelShift;
              var f, h, g, l, n = e = 0;
              f = 8 * H.linesWidth;
              switch (H.arrowsDirection) {
                  case 1:
                      e = f;
                      n = 0;
                      break;
                  case 2:
                      e = 0, n = f
              }
              f = 0;
              for (h = D.length; f < h; f += 1) g = D[f], l = i.getConnectorsStacksSizes(f), d += g.setShift(d, z(g.actualVisibility), n, e, l.parentsStackSize);
              return new a.common.Rect(0, 0, Math.round(t()), Math.round(s()))
          }
  
          function r(a, b) {
              var c = !1;
              switch (I.pageFitMode) {
                  case 1:
                      b.width >= a.width && (c = !0);
                      break;
                  case 2:
                      b.height >= a.height &&
                          (c = !0);
                      break;
                  case 3:
                      b.height >= a.height && b.width >= a.width && (c = !0)
              }
              return c
          }
  
          function s() {
              var a = D[D.length - 1];
              return a.shift + a.nextLevelShift
          }
  
          function t() {
              var a = 0,
                  b, c;
              b = 0;
              for (c = D.length; b < c; b += 1) a = Math.max(a, D[b].currentOffset);
              return a += I.normalItemsInterval
          }
  
          function v() {
              var b = k.getCursorTreeItem();
              n = {};
              E.loopLevels(this, function(c) {
                  var d = D[c];
                  E.loopLevelItems(this, c, function(c, e) {
                      var f = new a.orgdiagram.TreeItemPosition,
                          h = l.isItemSelected(c) ? 1 : e.visibility,
                          g = j.getTemplateParams(c),
                          h = 0 === h ? d.currentvisibility :
                          h,
                          i = b == c,
                          k = I,
                          m = K.orientationType,
                          p, q, r;
                      switch (h) {
                          case 1:
                              p = g.template.templateConfig;
                              q = new a.common.Size(p.itemSize);
                              r = new a.common.Rect(0, 0, q.width, q.height);
                              i && (q.height += p.cursorPadding.top + p.cursorPadding.bottom, q.width += p.cursorPadding.left + p.cursorPadding.right, r.x = p.cursorPadding.left, r.y = p.cursorPadding.top);
                              g.hasSelectorCheckbox && (q.height += k.checkBoxPanelSize);
                              if (g.hasButtons) switch (q.width += k.buttonsPanelSize, k.groupTitlePlacementType) {
                                  case 3:
                                      r.x += k.buttonsPanelSize
                              }
                              if (g.hasGroupTitle) switch (q.width +=
                                  k.groupTitlePanelSize, k.groupTitlePlacementType) {
                                  case 3:
                                      break;
                                  default:
                                      r.x += k.groupTitlePanelSize
                              }
                              break;
                          case 2:
                              p = g.template.templateConfig;
                              q = new a.common.Size(p.minimizedItemSize);
                              break;
                          case 3:
                          case 4:
                              q = new a.common.Size
                      }
                      switch (m) {
                          case 2:
                          case 3:
                              q.invert()
                      }
                      f.actualVisibility = h;
                      f.actualSize = q;
                      f.contentPosition = r;
                      n[c] = f
                  })
              })
          }
  
          function u() {
              var a, b;
              E.loopLevels(this, function(c) {
                  var d = D[c];
                  d.shift = 0;
                  d.depth = 0;
                  d.actualVisibility = 4;
                  b = a = null;
                  E.loopLevelItems(this, c, function(c) {
                      c = n[c];
                      d.depth = Math.max(d.depth,
                          c.actualSize.height);
                      switch (c.actualVisibility) {
                          case 2:
                          case 3:
                          case 4:
                              b = !b ? c.actualSize.height : Math.min(b, c.actualSize.height);
                              break;
                          default:
                              a = !a ? c.actualSize.height : Math.min(a, c.actualSize.height)
                      }
                      d.actualVisibility = Math.min(d.actualVisibility, c.actualVisibility)
                  });
                  null == a && (a = d.depth);
                  null != b && b > a && (a = b);
                  switch (I.verticalAlignment) {
                      case 0:
                          d.horizontalConnectorsDepth = a / 2;
                          break;
                      case 1:
                          d.horizontalConnectorsDepth = d.depth / 2;
                          break;
                      case 2:
                          d.horizontalConnectorsDepth = d.depth - a / 2
                  }
              })
          }
  
          function z(a) {
              var b =
                  0;
              switch (a) {
                  case 1:
                      b = I.normalLevelShift;
                      break;
                  case 2:
                      b = I.dotLevelShift;
                      break;
                  case 3:
                  case 4:
                      b = I.lineLevelShift
              }
              return b
          }
  
          function x() {
              var a, b;
              a = 0;
              for (b = D.length; a < b; a += 1) D[a].currentOffset = 0;
              F.loopPostOrder(this, function(a, b) {
                  var c = n[a],
                      d = c.actualVisibility,
                      e = E.getLevelIndex(a),
                      e = D[e],
                      d = N[0 === d ? e.currentvisibility : d] / 2,
                      f, h, g, i, l, j, k, m;
                  f = 8 * H.linesWidth;
                  c.leftPadding = d + (0 < e.currentOffset ? d * b.relationDegree * I.cousinsIntervalMultiplier : 0);
                  c.rightPadding = d;
                  0 != H.arrowsDirection && (b.connectorPlacement & 8 &&
                      (c.leftPadding += f), b.connectorPlacement & 2 && (c.rightPadding += f));
                  c.offset = e.currentOffset + c.leftPadding;
                  e.currentOffset = c.offset + c.actualSize.width + c.rightPadding;
                  if (F.hasChildren(a))
                      if (c = B(b), 0 < c) w(b, c);
                      else if (0 > c && (c = -c, y(b, c), h = null, g = {}, l = null, e = F.parent(b.id), null !== e && (F.loopChildrenReversed(this, e.id, function(a, c) {
                          if (c === b) h = [];
                          else if (null !== h) {
                              var d = null,
                                  e = [],
                                  f, j, k, m;
                              f = J[c.id];
                              void 0 === f && (f = []);
                              f = f.slice();
                              f.splice(0, 0, c.id);
                              j = 0;
                              for (k = f.length; j < k; j += 1) m = n[f[j]], e[j] = m.offset + m.actualSize.width +
                                  m.rightPadding;
                              f = [];
                              var p;
                              j = C[b.id];
                              void 0 === j && (j = []);
                              j = j.slice();
                              j.splice(0, 0, b.id);
                              k = 0;
                              for (m = j.length; k < m; k += 1) p = n[j[k]], f[k] = p.offset - p.leftPadding;
                              j = Math.min(e.length, f.length);
                              for (k = 0; k < j && !(m = f[k] - e[k], d = null !== d ? Math.min(d, m) : m, 0 >= m); k += 1);
                              i = Math.floor(d);
                              g[c.id] = i;
                              if (0 < i) h.splice(0, 0, c);
                              else return l = c, !0
                          }
                      }), 0 < h.length))) {
                      d = null;
                      if (null !== l) {
                          j = [l];
                          j = j.concat(h);
                          j.push(b);
                          d = [
                              [l]
                          ];
                          e = 1;
                          for (f = j.length; e < f; e += 1) k = j[e - 1], m = j[e], 2 == k.gravity || 1 == m.gravity ? d[d.length - 1].push(m) : d.push([m])
                      } else d = [h.slice(0)], d[d.length - 1].push(b);
                      if (0 < d.length) {
                          h = d[d.length - 1];
                          for (e = h.length - 2; 0 <= e; e -= 1) m = h[e], i = g[m.id], c = Math.min(i, c), y(m, c), w(m, c)
                      }
                      j = c / (d.length - 1);
                      for (f = d.length - 2; 0 < f; f -= 1) {
                          k = d[f];
                          for (e = k.length - 1; 0 <= e; e -= 1) m = k[e], i = g[m.id], c = Math.min(f * j, Math.min(i, c)), y(m, c), w(m, c)
                      }
                  }
              })
          }
  
          function B(a) {
              var b = n[a.id],
                  b = b.offset + b.actualSize.width / 2,
                  c = null,
                  d, e, f;
              if (null === a.visualAggregatorId) switch (d = null, F.loopChildren(this, a.id, function(a, b) {
                  d = b;
                  if (d.connectorPlacement & 1) return !0
              }), e = n[d.id], f = null, F.loopChildrenReversed(this,
                  a.id,
                  function(a, b) {
                      f = b;
                      if (f.connectorPlacement & 1) return !0
                  }), a = n[f.id], G.horizontalAlignment) {
                  case 1:
                      c = e.offset + e.actualSize.width / 2;
                      break;
                  case 2:
                      c = a.offset + a.actualSize.width / 2;
                      break;
                  case 0:
                      c = (e.offset + a.offset + a.actualSize.width) / 2
              } else a = n[a.visualAggregatorId], c = a.offset + a.actualSize.width / 2;
              return b - c
          }
  
          function y(a, b) {
              var c = n[a.id];
              c.offset += b;
              var d = D[E.getLevelIndex(a.id)];
              d.currentOffset = Math.max(d.currentOffset, c.offset + c.actualSize.width + c.rightPadding)
          }
  
          function w(a, b) {
              var c, d;
              F.loopLevels(this,
                  a.id,
                  function(a) {
                      c = n[a];
                      c.offset += b;
                      d = D[E.getLevelIndex(a)];
                      d.currentOffset = Math.max(d.currentOffset, c.offset + c.actualSize.width);
                      return !0
                  })
          }
  
          function A() {
              var b = null;
              E.loopLevels(this, function(c) {
                  var d = D[c];
                  E.loopLevelItems(this, c, function(c) {
                      var e, f, h, g, i, l, c = n[c];
                      e = c.actualSize;
                      g = b;
                      f = 0;
                      switch (c.actualVisibility) {
                          case 1:
                              switch (I.verticalAlignment) {
                                  case 0:
                                      f = 0;
                                      break;
                                  case 1:
                                      f = (d.depth - e.height) / 2;
                                      break;
                                  case 2:
                                      f = d.depth - e.height
                              }
                              break;
                          case 2:
                          case 3:
                          case 4:
                              f = d.horizontalConnectorsDepth - e.height / 2
                      }
                      e = new a.common.Rect(c.offset,
                          d.shift + f, e.width, e.height);
                      f = d.shift + d.horizontalConnectorsDepth;
                      h = null != g ? g.shift + g.connectorShift : null;
                      g = null != g ? g.levelSpace / 2 : null;
                      i = d.shift + d.connectorShift;
                      l = d.levelSpace / 2;
                      c.actualPosition = e;
                      c.horizontalConnectorsShift = f;
                      c.topConnectorShift = h;
                      c.topConnectorInterval = g;
                      c.bottomConnectorShift = i;
                      c.bottomConnectorInterval = l
                  });
                  b = d
              })
          }
          n = {};
          m = null;
          var E, D, F, C, J, K, H, G, I, Q, N;
          return {
              process: function() {
                  var l;
                  l = I = c.getOptions();
                  var j = [];
                  j[1] = l.normalItemsInterval;
                  j[2] = l.dotItemsInterval;
                  j[3] = l.lineItemsInterval;
                  j[4] = l.lineItemsInterval;
                  N = j;
                  K = d.getOptions();
                  H = e.getOptions();
                  G = g.getOptions();
                  E = i.getTreeLevels();
                  F = h.getVisualTree();
                  C = h.getLeftMargins();
                  J = h.getRightMargins();
                  D = [];
                  n = {};
                  l = f.getOptimalPanelSize();
                  Q = b.getOptions();
                  l.scale(1 / Q.scale);
                  l = new a.common.Rect(0, 0, l.width, l.height);
                  m = p(l);
                  A();
                  return !0
              },
              getItemsPositions: function() {
                  return n
              },
              getItemPosition: function(a) {
                  return n[a]
              },
              getContentSize: function() {
                  return m
              }
          }
      };
      a.orgdiagram.OrgTreeTask = function(f) {
          var b, d;
  
          function c(c) {
              var f, i, j, k, l, n = 0,
                  m, p = a.common.tree();
              k = 0;
              for (l = c.length; k < l; k += 1) j = c[k], null != j.id && (f = new a.orgdiagram.OrgItem(j), m = parseInt(j.id, 10), n = Math.max(isNaN(m) ? 0 : m, n), p.add(j.parent, f.id, f));
              n += 1;
              c = new a.orgdiagram.ItemConfig;
              c.id = n;
              c.title = "internal root";
              c.isVisible = !1;
              c.isActive = !1;
              i = new a.orgdiagram.OrgItem(c);
              i.hideParentConnection = !0;
              i.hideChildrenConnection = !0;
              p.add(null, i.id, i);
              p.loopLevels(this, function(a, b, c) {
                  if (0 < c) return p.BREAK;
                  i.id != a && (p.adopt(i.id, a), b.itemType = 0)
              });
              e(p);
              b = p;
              d = n;
              return !0
          }
  
          function e(a) {
              a.loopLevels(this, function(b,
                  c) {
                  var d = !0;
                  if (c.isVisible) return a.SKIP;
                  a.loopChildren(this, b, function(a, b) {
                      if (0 != b.itemType) return d = !1, !0
                  });
                  if (d) c.hideChildrenConnection = !0, a.loopChildren(this, b, function(a, b) {
                      b.hideParentConnection = !0
                  });
                  else return a.SKIP
              })
          }
          d = b = null;
          return {
              process: function() {
                  c(f.getItems());
                  return !0
              },
              getOrgTree: function() {
                  return b
              },
              getMaximumId: function() {
                  return d
              }
          }
      };
      a.orgdiagram.PaletteManagerTask = function(f, b) {
          var d;
          return {
              process: function() {
                  var c = [];
                  null != b && (c = b.getOptions().linesPalette);
                  d = new a.common.PaletteManager(f.getOptions(),
                      c);
                  return !0
              },
              getPaletteManager: function() {
                  return d
              }
          }
      };
      a.orgdiagram.VisualTreeLevelsTask = function(f) {
          function b(b, c, d, e) {
              var f, g, m, p, q, r, s, t = {},
                  v, u, z;
              d.loopLevels(this, function(x) {
                  var B = new a.orgdiagram.TreeLevelConnectorStackSize;
                  c[x] = B;
                  s = [];
                  d.loopLevelItems(this, x, function(c, f) {
                      var g = [];
                      if (!t.hasOwnProperty(c) && (f.connectorPlacement & 4 && g.push(c), g = g.concat(f.partners), 0 < g.length)) {
                          r = new a.common.VerticalConnectorBundle(g, []);
                          for (var i = 0, l = g.length; i < l; i += 1) t[g[i]] = r;
                          e.loopChildren(this, c, function(a,
                              b) {
                              b.connectorPlacement & 1 && r.toItems.push(a)
                          });
                          1 < g.length && s.push(r);
                          (1 < r.fromItems.length || 0 < r.toItems.length) && b.push(r)
                      }
                      f.connectorPlacement & 8 && (r = new a.common.HorizontalConnectorBundle(c, d.getPrevItem(c)), b.push(r));
                      f.connectorPlacement & 2 && (r = new a.common.HorizontalConnectorBundle(c, d.getNextItem(c)), b.push(r))
                  });
                  if (0 < s.length) {
                      z = a.common.pile();
                      f = 0;
                      for (g = s.length; f < g; f += 1) {
                          r = s[f];
                          u = v = null;
                          m = 0;
                          for (p = r.fromItems.length; m < p; m += 1) q = d.getItemPosition(r.fromItems[m]), v = null != v ? Math.min(v, q) : q, u = null !=
                              u ? Math.max(u, q) : q;
                          z.add(v, u, r)
                      }
                      B.parentsStackSize = z.resolve(this, function(a, b, c, d, e) {
                          c.fromOffset = d + 1;
                          c.fromStackSize = e
                      })
                  }
              })
          }
          var d = null,
              c = null,
              e = null,
              g = new a.orgdiagram.TreeLevelConnectorStackSize;
          return {
              process: function() {
                  var h = f.getVisualTree();
                  d = a.common.TreeLevels();
                  h.loopLevels(this, function(a, b, c) {
                      d.addItem(c, a, b)
                  });
                  c = [];
                  e = [];
                  b(c, e, d, h);
                  return !0
              },
              getTreeLevels: function() {
                  return d
              },
              getBundles: function() {
                  return c
              },
              getConnectorsStacksSizes: function(a) {
                  return e[a] || g
              },
              getNestedLayoutBottomConnectorIds: function() {
                  return {}
              }
          }
      };
      a.orgdiagram.VisualTreeTask = function(f, b, d, c) {
          function e(a, b, d) {
              var e, f, h, s, v, u, C, J, K, H, G, I, Q = {},
                  N, ca = {},
                  P, T, U, da = {},
                  V;
              a.loopPostOrder(this, function(a, b, c, d) {
                  b.hasVisibleChildren = b.isVisible || b.hasVisibleChildren;
                  null != d && (d.hasVisibleChildren = d.hasVisibleChildren || b.hasVisibleChildren)
              });
              a.loopLevels(this, function(h, g) {
                  var i, j, I;
                  if (!c && !g.hasVisibleChildren) return a.SKIP;
                  i = d.node(h);
                  i || (i = q({
                      visibility: 4,
                      connectorPlacement: 0,
                      parentId: null,
                      actualItemType: 0
                  }, g), d.add(null, h, i));
                  U = T = 0;
                  if (null != (u = d.indexOf(h))) T =
                      u, U = d.countSiblings(h) - u - 1;
                  j = [];
                  a.loopChildren(this, h, function(a, b) {
                      if (c || b.hasVisibleChildren) {
                          e = q({
                              parentId: h,
                              actualItemType: b.itemType
                          }, b);
                          switch (i.actualItemType) {
                              case 7:
                              case 8:
                              case 6:
                                  switch (e.actualItemType) {
                                      case 7:
                                      case 8:
                                      case 6:
                                          e.actualItemType = 2;
                                          break;
                                      case 0:
                                          e.actualItemType = 1
                                  }
                          }
                          switch (e.actualItemType) {
                              case 5:
                                  r(i, e), e.connectorPlacement = 5, I = q({
                                      visibility: 4
                                  }), d.add(I.id, e.id, e), e = I;
                              case 8:
                              case 2:
                                  f = d.parent(h);
                                  if (i.connectorPlacement & 2) s = n(d, t.navigationFamily, i), d.add(f.id, e.id, e, s + 1), e.connectorPlacement =
                                      6, e.gravity = 2;
                                  else if (i.connectorPlacement & 8) v = m(d, t.navigationFamily, i), d.add(f.id, e.id, e, v), e.connectorPlacement = 12, e.gravity = 1;
                                  else switch (b.adviserPlacementType) {
                                      case 2:
                                          s = n(d, t.navigationFamily, i);
                                          d.add(f.id, e.id, e, s + 1);
                                          e.connectorPlacement = 6;
                                          e.gravity = 2;
                                          break;
                                      default:
                                          v = m(d, t.navigationFamily, i), d.add(f.id, e.id, e, v), e.connectorPlacement = 12, e.gravity = 1
                                  }
                                  switch (e.actualItemType) {
                                      case 8:
                                          null != i.parentId ? r(d.node(i.parentId), e) : r(i, e, !0);
                                          break;
                                      case 2:
                                          r(i, e)
                                  }
                                  break;
                              case 4:
                                  r(i, e), e.connectorPlacement =
                                      5, I = q({
                                          visibility: 4
                                      }), d.add(I.id, e.id, e), e = I;
                              case 1:
                                  null === i.visualAggregatorId && p(d, i, !1);
                                  switch (b.adviserPlacementType) {
                                      case 2:
                                          d.add(h, e.id, e, 0);
                                          e.connectorPlacement = 6;
                                          e.gravity = 2;
                                          break;
                                      default:
                                          d.add(h, e.id, e), e.connectorPlacement = 12, e.gravity = 1
                                  }
                                  1 == e.actualItemType && r(i, e);
                                  break;
                              case 0:
                                  j.push(e);
                                  r(i, e);
                                  break;
                              case 7:
                              case 6:
                                  f = d.parent(h);
                                  if (i.connectorPlacement & 2) d.add(f.id, e.id, e, T), e.connectorPlacement = 6, e.gravity = 2;
                                  else if (i.connectorPlacement & 8) d.add(f.id, e.id, e, d.countChildren(f.id) - U), e.connectorPlacement =
                                      12, e.gravity = 1;
                                  else {
                                      switch (b.adviserPlacementType) {
                                          case 2:
                                              d.add(f.id, e.id, e, T);
                                              e.gravity = 2;
                                              break;
                                          default:
                                              d.add(f.id, e.id, e, d.countChildren(f.id) - U), e.gravity = 1
                                      }
                                      switch (e.actualItemType) {
                                          case 6:
                                              e.connectorPlacement = 5;
                                              break;
                                          case 7:
                                              e.connectorPlacement = 4
                                      }
                                  }
                                  null != i.parentId ? r(d.node(i.parentId), e) : r(i, e, !0)
                          }
                      }
                  });
                  switch (i.actualItemType) {
                      case 7:
                      case 8:
                      case 6:
                          break;
                      default:
                          V = [], null != (f = d.parent(h)) && d.loopChildrenRange(this, f.id, T, d.countChildren(f.id) - U, function(b, c) {
                              if (c.id == h) V.push(c);
                              else switch (c.actualItemType) {
                                  case 7:
                                  case 8:
                                  case 6:
                                      a.parentid(c.id) ==
                                          h && V.push(c)
                              }
                          }), 1 < V.length && (da[h] = V)
                  }
                  Q[h] = [];
                  ca[h] = [];
                  var H = i,
                      G = g.childrenPlacementType,
                      J = Q[h],
                      K = ca[h],
                      A, C, N, P, ja, ka, M, L, O = 4 == H.visibility && 0 === H.connectorPlacement;
                  switch (b.horizontalAlignment) {
                      case 0:
                      case 1:
                          C = 3;
                          break;
                      case 2:
                          C = 2
                  }
                  0 === G && (G = l(a, H) ? 0 === b.leavesPlacementType ? 3 : b.leavesPlacementType : 0 === b.childrenPlacementType ? 2 : b.childrenPlacementType);
                  A = H;
                  null !== H.visualAggregatorId && (A = d.node(H.visualAggregatorId));
                  3 == G && 3 > j.length && (G = 2);
                  switch (G) {
                      case 2:
                          G = 0;
                          for (P = j.length; G < P; G += 1) H = j[G], J = a.node(H.id),
                              d.add(A.id, H.id, H), H.connectorPlacement = (J.hideParentConnection ? 0 : 1) | (J.hideChildrenConnection ? 0 : 4), 0 === G && (H.relationDegree = 1);
                          break;
                      case 3:
                          P = Math.min(b.maximumColumnsInMatrix, Math.ceil(Math.sqrt(j.length)));
                          ja = Math.ceil(j.length / P);
                          ka = Math.ceil(P / 2);
                          for (M = 0; M < ka; M += 1) {
                              C = A;
                              for (L = 0; L < ja; L += 1) {
                                  H = k(j, 2 * M, L, P);
                                  G = k(j, 2 * M + 1, L, P);
                                  void 0 === J[L] && (J[L] = [], K[L] = []);
                                  null !== H && (0 === M && (H.relationDegree = 1), d.add(C.id, H.id, H), H.connectorPlacement = (O ? 0 : 2) | 4, H.gravity = 2, K[L].push(H));
                                  if (null !== H || null !== G) N = q({
                                      visibility: 4,
                                      connectorPlacement: O ? 0 : 5
                                  }), d.add(C.id, N.id, N), J[L].push(N);
                                  null !== G && (d.add(C.id, G.id, G), G.connectorPlacement = (O ? 0 : 8) | 4, G.gravity = 1, K[L].push(G));
                                  C = N
                              }
                          }
                          2 < P && (A.visualAggregatorId = null);
                          break;
                      case 1:
                          G = 0;
                          for (P = j.length; G < P; G += 1) {
                              H = j[G];
                              N = q({
                                  visibility: 4,
                                  connectorPlacement: O ? 0 : 5
                              });
                              switch (C) {
                                  case 2:
                                      d.add(A.id, H.id, H);
                                      d.add(A.id, N.id, N);
                                      H.connectorPlacement = (O ? 0 : 2) | 4;
                                      H.gravity = 2;
                                      break;
                                  case 3:
                                      d.add(A.id, N.id, N), d.add(A.id, H.id, H), H.connectorPlacement = (O ? 0 : 8) | 4, H.gravity = 1
                              }
                              J[G] = [N];
                              K[G] = [H];
                              A = N
                          }
                          break;
                      default:
                          throw "Children placement is undefined!";
                  }
              });
              a.loopPostOrder(this, function(a) {
                  var b = d.node(a),
                      c, e, f;
                  if (null != b) {
                      c = ca[a];
                      e = Q[a];
                      H = i(d, b);
                      if (0 < H && (b.visualDepth = H + 1, null !== b.visualAggregatorId)) {
                          h = d.node(b.visualAggregatorId);
                          f = d.hasChildren(h.id);
                          for (u = 0; u < H - 1; u += 1) h = p(d, h, !f)
                      }
                      f = 0;
                      var l = d.parent(b.id),
                          n, k, m;
                      if (null !== l) {
                          n = d.indexOf(b.id);
                          for (k = 1; null != (m = d.getChild(l.id, n + k));)
                              if (m.connectorPlacement & 8) f = Math.max(f, j(d, m)), k += 1;
                              else break;
                          for (k = 1; null != (m = d.getChild(l.id, n - k));)
                              if (m.connectorPlacement & 2) f = Math.max(f, j(d, m)), k += 1;
                              else break
                      }
                      H =
                          f;
                      if (1 < H) {
                          b.visualDepth += H - 1;
                          f = d.hasChildren(a);
                          h = b;
                          for (u = 0; u < H - 1; u += 1) h = p(d, h, !f)
                      }
                      G = [];
                      u = 0;
                      for (C = c.length; u < C; u += 1) {
                          P = c[u];
                          J = G[u] = 0;
                          for (K = P.length; J < K; J += 1) G[u] = Math.max(G[u], j(d, P[J]))
                      }
                      u = 0;
                      for (C = G.length; u < C; u += 1)
                          if (I = G[u], 1 < I) {
                              J = 0;
                              for (K = e[u].length; J < K; J += 1)
                                  if (N = e[u][J], d.hasChildren(N.id))
                                      for (H = I; 1 < H;) N = p(d, N, !1), H -= 1
                          }
                      null != da[a] && g(d, b, da[a])
                  }
              })
          }
  
          function g(a, b, c) {
              var d, e, f, g, i = 0,
                  l = [],
                  j, k;
              e = 0;
              for (f = c.length; e < f; e += 1) d = c[e], i = Math.max(i, d.visualDepth);
              e = 0;
              for (f = c.length; e < f; e += 1) {
                  d = c[e];
                  j = h(a,
                      d);
                  g = 1;
                  for (k = d; null != k.visualAggregatorId;) k = a.node(k.visualAggregatorId), k.connectorPlacement = 5, g += 1;
                  for (; g < i;) j = p(a, j, !1), g += 1;
                  l.push(h(a, j).id)
              }
              k = h(a, b);
              if (a.hasChildren(k.id)) {
                  j = c[Math.floor(c.length / 2)];
                  if (1 < c.length && 0 === c.length % 2) {
                      e = a.parent(j.id);
                      f = n(a, t.navigationFamily, j);
                      g = a.getChild(e.id, f).gravity || a.getChild(e.id, f + 1).gravity;
                      j = q({
                          visibility: 4,
                          connectorPlacement: j.connectorPlacement & 10,
                          gravity: g
                      });
                      a.add(e.id, j.id, j, f + 1);
                      for (g = 1; g < i;) j = p(a, j, !1), j.connectorPlacement = 0, g += 1
                  }
                  e = 0;
                  for (f =
                      c.length; e < f; e += 1) d = c[e], t.navigationFamily.loopChildren(this, b.id, function(a, c) {
                      switch (c.actualItemType) {
                          case 5:
                          case 2:
                          case 4:
                          case 1:
                              break;
                          default:
                              b.id != d.id && r(d, c)
                      }
                      return t.navigationFamily.SKIP
                  });
                  j = h(a, j);
                  a.moveChildren(k.id, j.id)
              }
              j.partners = l
          }
  
          function h(a, b) {
              for (var c = b; null != c.visualAggregatorId;) c = a.node(c.visualAggregatorId);
              return c
          }
  
          function i(a, b) {
              var c = 0;
              null != b.visualAggregatorId && a.loopLevels(this, b.id, function(d, e, f) {
                  if (b.visualAggregatorId == d) return a.SKIP;
                  c = f + 1
              });
              return c
          }
  
          function j(a,
              b) {
              var c = 0;
              a.loopLevels(this, b.id, function(a, b, d) {
                  c = d + 1
              });
              return c + 1
          }
  
          function k(a, b, c, d) {
              0 < d % 2 && (b === d - 1 ? b = a.length : b === d && (b = d - 1));
              b = c * d + b;
              return b > a.length - 1 ? null : a[b]
          }
  
          function l(a, b) {
              var c = !1,
                  d = !0;
              a.loopChildren(this, b.id, function(b, e) {
                  c = !0;
                  if (0 === e.itemType && a.hasChildren(b)) return d = !1, !0
              });
              return c && d
          }
  
          function n(a, b, c) {
              var d = null,
                  e = {},
                  f = a.parent(c.id);
              a.loopChildrenReversed(this, f.id, function(a, f, h) {
                  if (null === d) a == c.id && (d = -1, e[c.id] = !0, b.loopChildren(this, c.id, function(a, c, d) {
                      if (0 < d) return b.BREAK;
                      e[a] = !0
                  }));
                  else if (e.hasOwnProperty(a)) b.loopChildren(this, f.id, function(a, c, d) {
                      if (0 < d) return b.BREAK;
                      e[a] = !0
                  });
                  else return d = h, !0
              });
              return d
          }
  
          function m(a, b, c) {
              var d = null,
                  e = {},
                  f = a.parent(c.id);
              a.loopChildren(this, f.id, function(a, f, h, g) {
                  if (null === d) a == c.id && (d = g + 1, e[c.id] = !0, b.loopChildren(this, c.id, function(a, c, d) {
                      if (0 < d) return b.BREAK;
                      e[a] = !0
                  }));
                  else if (e.hasOwnProperty(a)) b.loopChildren(this, a, function(a, c, d) {
                      if (0 < d) return b.BREAK;
                      e[a] = !0
                  });
                  else return d = h, !0
              });
              return d
          }
  
          function p(a, b, c) {
              c = q({
                  visibility: 4,
                  visualAggregatorId: b.visualAggregatorId,
                  connectorPlacement: 4 == b.visibility && 0 === b.connectorPlacement || c ? 0 : 5
              });
              a.insert(b.id, c.id, c);
              b.visualAggregatorId = c.id;
              return c
          }
  
          function q(b, c) {
              var d = new a.orgdiagram.TreeItem,
                  e;
              for (e in b) b.hasOwnProperty(e) && (d[e] = b[e]);
              null != c ? (d.id = c.id, d.visibility = c.isVisible ? 0 : 4) : (v += 1, d.id = v);
              return d
          }
  
          function r(a, b, c) {
              var d = [];
              c || 4 == a.visibility || !u.hasOwnProperty(a.id) ? (c || d.push(a.id), t.navigationFamily.loopParents(this, a.id, function(a, b) {
                  if (4 != b.visibility && (d.push(a),
                          u.hasOwnProperty(a))) return t.navigationFamily.SKIP
              })) : d.push(a.id);
              null != t.navigationFamily.node(b.id) ? t.navigationFamily.adopt(d, b.id) : t.navigationFamily.add(d, b.id, b)
          }
  
          function s(a, b, c) {
              a.loop(this, function(a) {
                  b[a] = [];
                  c[a] = []
              });
              a.loopPostOrder(this, function(a, d, e) {
                  var d = b[e],
                      f = c[e],
                      h = b[a],
                      g = c[a],
                      i;
                  if (null != e) {
                      d[0] || (d[0] = a);
                      e = 0;
                      for (i = h.length; e < i; e += 1) d[e + 1] || (d[e + 1] = h[e]);
                      f[0] = a;
                      e = 0;
                      for (i = g.length; e < i; e += 1) f[e + 1] = g[e]
                  }
              })
          }
          var t = {
                  visualTree: null,
                  leftMargins: {},
                  rightMargins: {},
                  navigationFamily: null
              },
              v, u;
          return {
              process: function() {
                  var c = f.getOrgTree(),
                      h = d.getOptions();
                  u = null != b ? b.getActiveItems() : {};
                  t.visualTree = a.common.tree();
                  t.navigationFamily = a.common.family();
                  v = f.getMaximumId();
                  c.hasNodes() && e(c, h, t.visualTree);
                  t.leftMargins = {};
                  t.rightMargins = {};
                  s(t.visualTree, t.leftMargins, t.rightMargins);
                  return !0
              },
              getVisualTree: function() {
                  return t.visualTree
              },
              getNavigationFamily: function() {
                  return t.navigationFamily
              },
              getConnectionsFamily: function() {
                  return t.connectionsFamily
              },
              getLeftMargins: function() {
                  return t.leftMargins
              },
              getRightMargins: function() {
                  return t.rightMargins
              }
          }
      };
      a.common.AnnotationLabelTemplate = function() {
          var f = ["div", {
              type: "checkbox",
              name: "checkbox",
              "class": ["bp-item", "bp-corner-all", "bp-connector-label"]
          }];
          return {
              template: function() {
                  return f
              },
              getHashCode: function() {
                  return "defaultAnnotationLabelTemplate"
              },
              render: function(b, d) {
                  var c = d.context;
                  a.common.isArray(c.label) ? (d.element.innerHTML = "", d.element.appendChild(a.common.JsonML.toHTML(c.label))) : d.element.innerHTML = c.label
              }
          }
      };
      a.common.ButtonsTemplate = function() {
          var f = ["div", {
              style: {
                  position: "absolute"
              }
          }];
          return {
              template: function() {
                  return f
              },
              getHashCode: function() {
                  return "defaultButtonsTemplate"
              },
              render: function(b, d) {
                  var c = 0,
                      e, f = d.buttons,
                      h, i;
                  switch (d.renderingMode) {
                      case 0:
                          for (i = 0; i < f.length; i += 1) e = f[i], h = ["button", {
                                      style: {
                                          position: "absolute",
                                          top: c + "px",
                                          left: "0px"
                                      },
                                      "class": ["orgdiagrambutton", "bp-button"],
                                      "data-buttonname": e.name
                                  },
                                  ["span", {
                                      style: {
                                          width: e.size.width + "px",
                                          height: e.size.height + "px"
                                      },
                                      "class": ["bp-icon", e.icon]
                                  }]
                              ], d.element.appendChild(a.common.JsonML.toHTML(h)),
                              c += 10 + e.size.height
                  }
              }
          }
      };
      a.common.CheckBoxTemplate = function() {
          var b = ["div", ["label", {
                  style: {
                      width: "100%"
                  }
              },
              ["div", {
                      style: {
                          width: "100%",
                          float: "none",
                          "text-align":"center"
                      }
                  },
                  ["input",{
                      type: "button",
                      "field-id":"",
                      onclick: "clickInfo(this)",
                      name: "checkbox:",
                      value: "Gestionar",
                      class: "bp-selectioncheckbox btn btn-outline-warning",
                      style:{
                          height:"22px",
                          width:"100%",
                          color:"black",
                          padding:"0px 5px 0px 5px"
                      }
                  }], "\u00a0", ["span", {
                      name: "selectiontext",
                      "class": "bp-selectiontext"
                  }, a]
              ]
          ]];
          return {
              template: function() {
                  return b
              },
              getHashCode: function() {
                  return "defaultCheckBoxTemplate"
              },
              render: function(a, b) {
                  var e = b.element.firstChild.firstChild.firstChild;
                  e.checked = b.isSelected;
                  e.setAttribute("id", b.id);
                  e.setAttribute("data-id", b.context.dataId);
                  b.element.firstChild.firstChild.childNodes[2].setAttribute("data-id",
                      b.context.dataId)
              }
          }
      };
      a.common.CursorTemplate = function(a, b) {
          var d = ["div", {
              style: {
                  width: b.itemSize.width + b.cursorPadding.left + b.cursorPadding.right + "px",
                  height: b.itemSize.height + b.cursorPadding.top + b.cursorPadding.bottom + "px",
                  borderWidth: b.cursorBorderWidth + "px"
              },
              "class": ["bp-item", "bp-corner-all", "bp-cursor-frame"]
          }];
          return {
              template: function() {
                  return d
              },
              getHashCode: function() {
                  return "defaultCursorTemplate"
              },
              render: function() {}
          }
      };
      a.common.DotHighlightTemplate = function(a, b) {
          var d, c = b.minimizedItemCornerRadius + b.highlightPadding.left;
          d = ["div", {
              style: {
                  borderWidth: b.highlightBorderWidth + "px",
                  MozBorderRadius: c + "px",
                  WebkitBorderRadius: c + "px",
                  "-khtml-border-radius": c + "px",
                  borderRadius: c + "px"
              },
              "class": ["bp-item", "bp-highlight-dot-frame"]
          }];
          return {
              template: function() {
                  return d
              },
              getHashCode: function() {
                  return "defaultDotHighlightTemplate"
              },
              render: function() {}
          }
      };
      a.common.GroupTitleTemplate = function(f) {
          var b = {
                  style: {
                      fontSize: f.groupTitleFontSize,
                      fontFamily: f.groupTitleFontFamily,
                      fontWeight: f.groupTitleFontWeight,
                      fontStyle: f.groupTitleFontStyle
                  },
                  "class": ["bp-item", "bp-corner-all", "bp-grouptitle-frame"]
              },
              d = f.groupTitleVerticalAlignment,
              c = "";
          switch (f.groupTitleOrientation) {
              case 1:
                  c = "rotate(-90deg)";
                  break;
              case 2:
                  c = "rotate(90deg)"
          }
          var e = f.groupTitleFontSize,
              g = f.groupTitleFontFamily,
              h = f.groupTitleFontWeight,
              i = f.groupTitleFontStyle,
              j = null;
          switch (f.groupTitleHorizontalAlignment) {
              case 0:
                  j = "center";
                  break;
              case 1:
                  j = "left";
                  break;
              case 2:
                  j = "right"
          }
          c = {
              fontSize: e,
              fontFamily: g,
              fontWeight: h,
              fontStyle: i,
              position: "absolute",
              padding: 0,
              margin: 0,
              textAlign: j,
              lineHeight: 1,
              "-webkit-transform-origin": "center center",
              "-moz-transform-origin": "center center",
              "-o-transform-origin": "center center",
              "-ms-transform-origin": "center center",
              "-webkit-transform": c,
              "-moz-transform": c,
              "-o-transform": c,
              "-ms-transform": c,
              transform: c
          };
          switch (d) {
              case 0:
                  d = ["div", {
                      style: c,
                      "class": ["bp-title-content", "bp-item", "bp-corner-all"]
                  }];
                  break;
              default:
                  c.borderCollapse = "collapse";
                  c = {
                      style: c
                  };
                  e = null;
                  switch (d) {
                      case 1:
                          e = "middle";
                          break;
                      case 0:
                          e = "top";
                          break;
                      case 2:
                          e = "bottom"
                  }
                  d = ["table", c, ["tbody", ["tr", ["td", {
                      style: {
                          verticalAlign: e,
                          padding: 0
                      },
                      "class": "bp-title-content"
                  }]]]]
          }
          var k = ["div", b, d];
          return {
              template: function() {
                  return k
              },
              getHashCode: function() {
                  return "defaultGroupTitleTemplate"
              },
              render: function(b, c) {
                  var d = c.context,
                      e = d.groupTitleColor || f.groupTitleColor,
                      h = {},
                      g = c.width,
                      i = c.height;
                  h.left = Math.round(g / 2 - i / 2) + "px";
                  h.top = Math.round(i / 2 - g / 2) + "px";
                  h.width = i + "px";
                  h.height = g + "px";
                  h.maxWidth = h.width;
                  h.maxHeight = h.height;
                  a.common.JsonML.applyStyles(c.element.firstChild, h);
                  d = d.groupTitle || "";
                  d = d.replace(RegExp("\n",
                      "g"),"");
                  switch (f.groupTitleVerticalAlignment) {
                      case 0:
                          h = c.element.firstChild;
                          break;
                      default:
                          h = c.element.firstChild.firstChild.firstChild.firstChild, h.style.borderCollapse = "collapse"
                  }
                  h.style.color = a.common.highestContrast(e, f.itemTitleSecondFontColor, f.itemTitleFirstFontColor);
                  h.textContent = d;
                  a.common.JsonML.applyStyles(c.element, {
                      backgroundColor: e
                  })
              }
          }
      };
      a.common.HighlightTemplate = function(a, b) {
          var d = ["div", {
              style: {
                  borderWidth: b.highlightBorderWidth + "px"
              },
              "class": ["bp-item", "bp-corner-all", "bp-highlight-frame"]
          }];
          return {
              template: function() {
                  return d
              },
              getHashCode: function() {
                  return "defaultHighlightTemplate"
              },
              render: function() {}
          }
      };
      a.common.ItemTemplate = function(f, b) {
          // holicraft96
          var d, c = new a.common.Size(b.itemSize);
          c.width -= 2 * b.itemBorderWidth;
          c.height -= 2 * b.itemBorderWidth;
          d = ["div", {
                  style: {
                      borderWidth: b.itemBorderWidth + "px",
                      estilo: "10px !important"
                  },
                  "class": ["bp-item", "bp-corner-all", "bt-item-frame", "holitoxd"]
              },
              ["div", {
                      name: "titleBackground",
                      style: {
                          top: "2px",
                          left: "2px",
                          width: c.width - 4 + "px",
                          height: "18px"
                      },
                      "class": ["bp-item", "bp-corner-all", "bp-title-frame"]
                  },
                  ["div", {
                      name: "title",
                      style: {
                          top: "1px",
                          left: "4px",
                          width: c.width - 4 - 8 + "px",
                          height: "16px"
                      },
                      "class": ["bp-item", "bp-title"]
                  }]
              ],
              ["div", {
                      name: "photoBorder",
                      style: {
                          display: "none",
                          top: "24px",
                          left: "2px",
                          width: "50px",
                          height: "60px"
                      },
                      "class": ["bp-item", "bp-photo-frame"]
                  },
                  ["img", {
                      name: "photoxd",
                      alt: "",
                      style: {
                          width: "0",
                          height: "0"
                      }
                  }]
              ],
              ["div", {
                  name: "description",
                  style: {
                      top: "24px",
                      left: "5px",
                      height: "100%"
                  },
                  "class": ["bp-item", "bp-description"]
              }]
          ];
          return {
              template: function() {
                  return d
              },
              getHashCode: function() {
                  return "defaultItemTemplate"
              },
              render: function(b, c) {
                  var d = c.context,
                      i = null != d.itemTitleColor ? d.itemTitleColor : "#4169e1",
                      j = a.common.highestContrast(i, f.itemTitleSecondFontColor, f.itemTitleFirstFontColor),
                      k = c.element,
                      l = k.firstChild,
                      n = k.childNodes[1].firstChild,
                      m = l.firstChild,
                      k = k.childNodes[2];
                  a.common.JsonML.applyStyles(l, {
                      backgroundColor: i
                  });
                  n.src = d.image;
                  n.alt = d.title;
                  a.common.JsonML.applyStyles(m, {
                      color: j
                  });
                  m.textContent = d.title;
                  k.textContent = d.description
              }
          }
      };
      a.common.UserTemplate = function(f, b, d) {
          var c = a.common.hashCode(JSON.stringify(b));
          return {
              template: function() {
                  return b
              },
              getHashCode: function() {
                  return c
              },
              render: function(b, c) {
                  if (null != d) d(b, c);
                  else {
                      var h = c.context,
                          i = null != h.itemTitleColor ? h.itemTitleColor : "#4169e1",
                          j = a.common.highestContrast(i, f.itemTitleSecondFontColor, f.itemTitleFirstFontColor);
                      a.common.getElementsByName(this, c.element, "photo", function(a) {
                          a.src = h.image;
                          a.alt = h.title
                      });
                      a.common.getElementsByName(this, c.element, "titleBackground", function(b) {
                          a.common.JsonML.applyStyles(b, {
                              background: i
                          })
                      });
                      a.common.getElementsByName(this,
                          c.element, "title",
                          function(b) {
                              a.common.JsonML.applyStyles(b, {
                                  color: j
                              });
                              b.textContent = h.title
                          });
                      a.common.getElementsByName(this, c.element, "description", function(a) {
                          a.textContent = h.description
                      })
                  }
              }
          }
      };
      a.orgdiagram.BaseControl = function(f, b, d, c, e) {
          function g(b, c) {
              null == c && (c = !0);
              switch (b) {
                  case 1:
                      h(c, J);
                      break;
                  case 2:
                      var g = J;
                      w.layout.forceCenterOnCursor = !1;
                      w.tasks.process("HighlightItemOptionTask", null, g);
                      w.graphics.end();
                      break;
                  default:
                      m(w.layout);
                      n(w.layout);
                      var K = w.layout,
                          g = w.name,
                          x = a.common.getInnerSize(K.element),
                          x = new a.common.Rect(0, 0, x.width, x.height),
                          A = new a.common.Rect(x),
                          y = a.common.getFixOfPixelALignment(f);
                      a.common.JsonML.appendDOM(K.element, a.common.JsonML.toHTML(["div", {
                              tabindex: 0,
                              style: {
                                  position: "relative",
                                  overflow: "auto",
                                  "-webkit-overflow-scrolling": "touch",
                                  top: "0px",
                                  left: "0px",
                                  width: x.width + "px",
                                  height: x.height + "px",
                                  padding: "0px",
                                  marginBottom: "0px",
                                  marginRight: "0px",
                                  marginLeft: y.width + "px",
                                  marginTop: y.height + "px"
                              },
                              "class": g,
                              $: function(a) {
                                  K.scrollPanel = a
                              }
                          },
                          ["div", {
                                  style: a.common.mergeObjects({
                                      position: "absolute",
                                      overflow: "hidden"
                                  }, A.getCSS()),
                                  "class": g,
                                  $: function(a) {
                                      K.mousePanel = a
                                  }
                              },
                              ["div", {
                                      style: a.common.mergeObjects({
                                          position: "absolute",
                                          overflow: "hidden"
                                      }, A.getCSS()),
                                      "class": ["placeholder", g],
                                      $: function(a) {
                                          K.placeholder = a
                                      }
                                  },
                                  ["div", {
                                      style: {
                                          position: "absolute",
                                          overflow: "visible",
                                          top: "0px",
                                          left: "0px",
                                          width: "0px",
                                          height: "0px"
                                      },
                                      "class": ["calloutplaceholder", g],
                                      $: function(a) {
                                          K.calloutPlaceholder = a
                                      }
                                  }]
                              ]
                          ]
                      ]));
                      g = w.layout;
                      g.mousePanel.addEventListener("mousemove", p);
                      g.mousePanel.addEventListener("click", r);
                      g.mousePanel.addEventListener("dblclick",
                          s);
                      g.mousePanel.addEventListener("change", q);
                      g.scrollPanel.addEventListener("keydown", t);
                      g.scrollPanel.addEventListener("scroll", i);
                      w.options.enablePanning && a.common.isChrome() && (g.scrollPanel.draggable = !0, g.scrollPanel.addEventListener("dragstart", v), g.scrollPanel.addEventListener("drag", z), g.scrollPanel.addEventListener("dragend", z), g.scrollPanel.addEventListener("dragover", u));
                      w.tasks = d(j, k, l, e);
                      w.graphics = a.common.createGraphics(w.options.graphicsType, w.layout.element);
                      w.graphics.debug = J;
                      h(!0,
                          J)
              }
          }
  
          function h(a, b) {
              var c;
              w.layout.forceCenterOnCursor = a;
              w.tasks.process("OptionsTask", null, b);
              w.graphics.end();
              a && (c = w.tasks.getTask("CenterOnCursorTask"), c = c.getPlaceholderOffset(), w.layout.scrollPanel.scrollLeft = c.x, w.layout.scrollPanel.scrollTop = c.y)
          }
  
          function i() {
              null == K && (K = window.setTimeout(function() {
                  var a = J;
                  w.layout.forceCenterOnCursor = !1;
                  w.tasks.process("CurrentScrollPositionTask", null, a);
                  w.graphics.end();
                  window.clearTimeout(K);
                  K = null
              }, 200))
          }
  
          function j() {
              return w.options
          }
  
          function k() {
              return w.graphics
          }
  
          function l() {
              return w.layout
          }
  
          function n() {
              if (null != w.layout.scrollPanel) {
                  var a = w.layout.scrollPanel.parentNode;
                  null != a && a.removeChild(w.layout.scrollPanel)
              }
          }
  
          function m(a) {
              null != a.mousePanel && (a.mousePanel.removeEventListener("mousemove", p), a.mousePanel.removeEventListener("click", r), a.mousePanel.removeEventListener("dblclick", s), a.mousePanel.removeEventListener("change", q));
              null != a.scrollPanel && (a.scrollPanel.removeEventListener("keydown", t), a.scrollPanel.removeEventListener("scroll", i), a.scrollPanel.removeEventListener("dragstart",
                  v), a.scrollPanel.removeEventListener("drag", z), a.scrollPanel.removeEventListener("dragend", z), a.scrollPanel.removeEventListener("dragover", u))
          }
  
          function p(b) {
              var c = a.common.getElementOffset(w.layout.mousePanel),
                  d = b.pageX - c.left,
                  c = b.pageY - c.top,
                  e = w.tasks.getTask("CreateTransformTask"),
                  f = w.tasks.getTask("HighlightItemOptionTask");
              f.hasHighlightEnabled() && (d = e.getTreeItemForMousePosition(d, c, f.getGravityRadius()), x(b, d))
          }
  
          function q(b) {
              var d = b.target,
                  e = d.getAttribute("data-id");
              if (null != e) {
                  var f = (w.options.selectedItems || []).slice(),
                      h = c(w, null, e, void 0),
                      g = a.common.indexOf(f, e);
                  y("onSelectionChanging", b, h);
                  h.cancel || (0 <= g ? f.splice(g, 1) : f.push(e), w.options.selectedItems = f, 0 > g ? d.setAttribute("checked", "checked") : d.removeAttribute("checked"), y("onSelectionChanged", b, h))
              }
          }
  
          function r(b) {
              var d = a.common.getElementOffset(w.layout.mousePanel),
                  e = b.pageX - d.left,
                  f = b.pageY - d.top,
                  h = w.tasks.getTask("CreateTransformTask"),
                  d = w.tasks.getTask("CursorItemOptionTask"),
                  g = w.tasks.getTask("HighlightItemOptionTask"),
                  e = h.getTreeItemForMousePosition(e,
                      f, g.getGravityRadius()),
                  f = b.target;
              null !== e && (a.common.hasClass(f, w.name + "button") || a.common.hasClass(f.parentNode, w.name + "button") ? (d = a.common.hasClass(f, w.name + "button") ? f : f.parentNode, d = d.getAttribute("data-buttonname"), f = c(w, null, e, d), y("onButtonClick", b, f)) : "checkbox" === f.getAttribute("name") || "selectiontext" === f.getAttribute("name") || (f = c(w, null, e, void 0), y("onMouseClick", b, f), !f.cancel && d.hasCursorEnabled() && (B(b, e), w.layout.scrollPanel.focus())))
          }
  
          function s(a) {
              var b;
              b = w.tasks.getTask("HighlightItemTask").getHighlightTreeItem();
              null !== b && (b = c(w, null, b, void 0), y("onMouseDblClick", a, b))
          }
  
          function t(a) {
              var b = w.tasks.getTask("HighlightItemTask"),
                  c = w.tasks.getTask("HighlightItemOptionTask"),
                  d = w.tasks.getTask("CursorItemTask"),
                  e = w.tasks.getTask("CursorItemOptionTask"),
                  f = w.tasks.getTask("AlignDiagramTask"),
                  h = w.tasks.getTask("CreateTransformTask").getTransform(),
                  g = null,
                  i = null,
                  l = w.layout;
              c.hasHighlightEnabled() && e.hasCursorEnabled() ? (g = b.getHighlightTreeItem(), null === g && (g = d.getCursorTreeItem())) : c.hasHighlightEnabled() ? g = b.getHighlightTreeItem() :
                  e.hasCursorEnabled() && (g = d.getCursorTreeItem());
              if (null != g) {
                  switch (a.which) {
                      case 13:
                          e.hasCursorEnabled() && (B(a, g), a.preventDefault(), l.scrollPanel.focus());
                          break;
                      case 40:
                          i = 1;
                          break;
                      case 38:
                          i = 0;
                          break;
                      case 37:
                          i = 2;
                          break;
                      case 39:
                          i = 3
                  }
                  if (null != i) {
                      for (d = !1; !d;) d = !0, i = h.getOrientation(i), b = f.getNextItem(g, i), null != b && (a.preventDefault(), c.hasHighlightEnabled() ? x(a, b) : e.hasCursorEnabled() && B(a, b));
                      l.scrollPanel.focus()
                  }
              }
          }
  
          function v(b) {
              var c = w.layout.scrollPanel;
              A = new a.common.Point(b.clientX, b.clientY);
              E = new a.common.Point(c.scrollLeft,
                  c.scrollTop);
              F = F || new Image;
              b.dataTransfer.setDragImage(F, 0, 0)
          }
  
          function u(a) {
              a.preventDefault();
              a.dataTransfer.dropEffect = "move"
          }
  
          function z(b) {
              D = new a.common.Point(E.x - (b.clientX - A.x), E.y - (b.clientY - A.y));
              null == C && (C = window.setTimeout(function() {
                  var a = w.layout.scrollPanel;
                  a.scrollLeft = D.x;
                  a.scrollTop = D.y;
                  window.clearTimeout(C);
                  C = null
              }, 50))
          }
  
          function x(a, b) {
              var d = !0,
                  e;
              null !== b ? b !== w.options.highlightItem && (e = c(w, w.options.highlightItem, b, void 0), w.options.highlightItem = b, y("onHighlightChanging", a, e),
                  e.cancel ? d = !1 : (h(!1, !1), y("onHighlightChanged", a, e))) : null !== w.options.highlightItem && (e = c(w, w.options.highlightItem, null, void 0), w.options.highlightItem = null, y("onHighlightChanging", a, e), e.cancel ? d = !1 : (h(!1, !1), y("onHighlightChanged", a, e)));
              return d
          }
  
          function B(a, b) {
              var d;
              b !== w.options.cursorItem && (d = c(w, w.options.cursorItem, b, void 0), w.options.cursorItem = b, y("onCursorChanging", a, d), d.cancel || (h(!0, J), y("onCursorChanged", a, d)))
          }
  
          function y(a, b, c) {
              a = w.options[a];
              null != a && a(b, c)
          }
          var w = {
                  name: "orgdiagram",
                  options: b,
                  tasks: null,
                  graphics: null,
                  mouse: null,
                  layout: {
                      element: f,
                      scrollPanel: null,
                      mousePanel: null,
                      placeholder: null,
                      calloutPlaceholder: null,
                      forceCenterOnCursor: !0
                  }
              },
              A, E, D, F, C, J = !1,
              K = null;
          g();
          return {
              destroy: function() {
                  m(w.layout);
                  n(w.layout);
                  w.tasks = null;
                  w.graphics = null
              },
              setOptions: function(a) {
                  for (var b in a) a.hasOwnProperty(b) && (w.options[b] = a[b])
              },
              getOptions: j,
              setOption: function(a, b) {
                  return w.options[a] = b
              },
              getOption: function(a) {
                  return w.options[a]
              },
              update: g
          }
      };
      a.orgdiagram.Control = function(f, b) {
          return a.orgdiagram.BaseControl(f,
              b, a.orgdiagram.TaskManagerFactory, a.orgdiagram.EventArgsFactory, {
                  AnnotationLabelTemplate: a.common.AnnotationLabelTemplate,
                  ButtonsTemplate: a.common.ButtonsTemplate,
                  CheckBoxTemplate: a.common.CheckBoxTemplate,
                  CursorTemplate: a.common.CursorTemplate,
                  DotHighlightTemplate: a.common.DotHighlightTemplate,
                  GroupTitleTemplate: a.common.GroupTitleTemplate,
                  HighlightTemplate: a.common.HighlightTemplate,
                  ItemTemplate: a.common.ItemTemplate,
                  UserTemplate: a.common.UserTemplate
              })
      };
      a.orgdiagram.EventArgsFactory = function(f,
          b, d, c) {
          var e = new a.orgdiagram.EventArgs,
              g = f.tasks.getTask("CombinedContextsTask"),
              h = f.tasks.getTask("AlignDiagramTask"),
              b = g.getConfig(b),
              i = g.getConfig(d);
          b && null != b.id && (e.oldContext = b);
          i && null != i.id && (e.context = i, null !== i.parent && (e.parentItem = g.getConfig(i.parent)), g = a.common.getElementOffset(f.layout.mousePanel), f = a.common.getElementOffset(f.layout.element), d = h.getItemPosition(d), e.position = (new a.common.Rect(d.actualPosition)).translate(g.left, g.top).translate(-f.left, -f.top));
          null != c && (e.name =
              c);
          return e
      };
      a.orgdiagram.getProcessDiagramConfig = function() {
          var f = function() {};
          return a.orgdiagram.TaskManagerFactory(f, f, f).getProcessDiagramConfig()
      };
      a.orgdiagram.TaskManagerFactory = function(f, b, d, c) {
          var e = new a.common.TaskManager;
          e.addDependency("options", f);
          e.addDependency("graphics", b);
          e.addDependency("layout", d);
          e.addDependency("templates", c);
          e.addDependency("defaultConfig", new a.orgdiagram.Config);
          e.addDependency("defaultItemConfig", new a.orgdiagram.ItemConfig);
          e.addDependency("defaultTemplateConfig",
              new a.orgdiagram.TemplateConfig);
          e.addDependency("defaultButtonConfig", new a.orgdiagram.ButtonConfig);
          e.addDependency("defaultBackgroundAnnotationConfig", new a.orgdiagram.BackgroundAnnotationConfig);
          e.addDependency("defaultConnectorAnnotationConfig", new a.orgdiagram.ConnectorAnnotationConfig);
          e.addDependency("defaultHighlightPathAnnotationConfig", new a.orgdiagram.HighlightPathAnnotationConfig);
          e.addDependency("defaultShapeAnnotationConfig", new a.orgdiagram.ShapeAnnotationConfig);
          e.addDependency("isFamilyChartMode", !1);
          e.addDependency("showElbowDots", !1);
          e.addDependency("null", null);
          e.addDependency("foreground", 2);
          e.addDependency("background", 1);
          e.addTask("OptionsTask", ["options"], a.orgdiagram.OptionsTask, "#000000");
          e.addTask("CurrentControlSizeTask", ["layout", "OptionsTask", "ItemsSizesOptionTask"], a.orgdiagram.CurrentControlSizeTask, "#000000");
          e.addTask("CurrentScrollPositionTask", ["layout", "OptionsTask"], a.orgdiagram.CurrentScrollPositionTask, "#000000");
          e.addTask("CalloutOptionTask", ["OptionsTask", "defaultConfig",
              "defaultItemConfig"
          ], a.orgdiagram.CalloutOptionTask, "#000080");
          e.addTask("ConnectorsOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.ConnectorsOptionTask, "#000080");
          e.addTask("ItemsOptionTask", ["OptionsTask", "defaultItemConfig"], a.orgdiagram.ItemsOptionTask, "#000080");
          e.addTask("ItemsContentOptionTask", ["OptionsTask", "defaultItemConfig"], a.orgdiagram.ItemsContentOptionTask, "#000080");
          e.addTask("ItemsSizesOptionTask", ["OptionsTask", "defaultConfig", "defaultItemConfig", "defaultButtonConfig"],
              a.orgdiagram.ItemsSizesOptionTask, "#000080");
          e.addTask("LabelsOptionTask", ["OptionsTask", "defaultConfig", "defaultItemConfig"], a.orgdiagram.LabelsOptionTask, "#000080");
          e.addTask("TemplatesOptionTask", ["OptionsTask", "defaultConfig", "defaultButtonConfig", "defaultTemplateConfig"], a.orgdiagram.TemplatesOptionTask, "#000080");
          e.addTask("OrientationOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.OrientationOptionTask, "#000080");
          e.addTask("VisualTreeOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.VisualTreeOptionTask,
              "#000080");
          e.addTask("MinimizedItemsOptionTask", ["OptionsTask"], a.orgdiagram.MinimizedItemsOptionTask, "#000080");
          e.addTask("CursorItemOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.CursorItemOptionTask, "#000080");
          e.addTask("HighlightItemOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.HighlightItemOptionTask, "#000080");
          e.addTask("SelectedItemsOptionTask", ["OptionsTask"], a.orgdiagram.SelectedItemsOptionTask, "#000080");
          e.addTask("CursorSelectionPathModeOptionTask", ["OptionsTask", "defaultConfig"],
              a.orgdiagram.CursorSelectionPathModeOptionTask, "#000080");
          e.addTask("SplitAnnotationsOptionTask", ["OptionsTask"], a.orgdiagram.SplitAnnotationsOptionTask, "#00ffff");
          e.addTask("ForegroundShapeAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultShapeAnnotationConfig", "foreground"], a.orgdiagram.ShapeAnnotationOptionTask, "#000080");
          e.addTask("BackgroundShapeAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultShapeAnnotationConfig", "background"], a.orgdiagram.ShapeAnnotationOptionTask, "#000080");
          e.addTask("ForegroundHighlightPathAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultHighlightPathAnnotationConfig", "foreground"], a.orgdiagram.HighlightPathAnnotationOptionTask, "#000080");
          e.addTask("BackgroundHighlightPathAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultHighlightPathAnnotationConfig", "background"], a.orgdiagram.HighlightPathAnnotationOptionTask, "#000080");
          e.addTask("ForegroundConnectorAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultConnectorAnnotationConfig",
              "foreground"
          ], a.orgdiagram.ConnectorAnnotationOptionTask, "#000080");
          e.addTask("BackgroundConnectorAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultConnectorAnnotationConfig", "background"], a.orgdiagram.ConnectorAnnotationOptionTask, "#000080");
          e.addTask("BackgroundAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultBackgroundAnnotationConfig"], a.orgdiagram.BackgroundAnnotationOptionTask, "#000080");
          e.addTask("ScaleOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.ScaleOptionTask,
              "#000080");
          e.addTask("CombinedContextsTask", ["ItemsContentOptionTask"], a.orgdiagram.CombinedContextsTask, "#00ffff");
          e.addTask("OrgTreeTask", ["ItemsOptionTask"], a.orgdiagram.OrgTreeTask, "#ff0000");
          e.addTask("ReadTemplatesTask", ["TemplatesOptionTask"], a.orgdiagram.ReadTemplatesTask, "#00ffff");
          e.addTask("ActiveItemsTask", ["ItemsSizesOptionTask", "ReadTemplatesTask"], a.orgdiagram.ActiveItemsTask, "#00ffff");
          e.addTask("ItemTemplateParamsTask", ["ItemsSizesOptionTask", "CursorItemOptionTask", "ReadTemplatesTask"],
              a.orgdiagram.ItemTemplateParamsTask, "#00ffff");
          e.addTask("GroupTitleTemplateTask", ["TemplatesOptionTask"], a.orgdiagram.GroupTitleTemplateTask, "#00ffff");
          e.addTask("CheckBoxTemplateTask", ["ItemsSizesOptionTask"], a.orgdiagram.CheckBoxTemplateTask, "#00ffff");
          e.addTask("ButtonsTemplateTask", ["ItemsSizesOptionTask", "templates"], a.orgdiagram.ButtonsTemplateTask, "#00ffff");
          e.addTask("AnnotationLabelTemplateTask", ["ItemsOptionTask"], a.orgdiagram.AnnotationLabelTemplateTask, "#00ffff");
          e.addTask("VisualTreeTask", ["OrgTreeTask", "ActiveItemsTask", "VisualTreeOptionTask", "isFamilyChartMode"], a.orgdiagram.VisualTreeTask, "#ff0000");
          e.addTask("VisualTreeLevelsTask", ["VisualTreeTask", "ItemTemplateParamsTask"], a.orgdiagram.VisualTreeLevelsTask, "#ff0000");
          e.addTask("ConnectionsGraphTask", ["graphics", "CreateTransformTask", "ConnectorsOptionTask", "VisualTreeLevelsTask", "AlignDiagramTask"], a.orgdiagram.ConnectionsGraphTask, "#00ffff");
          e.addTask("HighlightItemTask", ["HighlightItemOptionTask", "ActiveItemsTask"], a.orgdiagram.HighlightItemTask,
              "#00ffff");
          e.addTask("CursorItemTask", ["CursorItemOptionTask", "ActiveItemsTask"], a.orgdiagram.CursorItemTask, "#00ffff");
          e.addTask("CursorNeighboursTask", ["CursorItemTask", "VisualTreeTask"], a.orgdiagram.CursorNeighboursTask, "#00ffff");
          e.addTask("SelectedItemsTask", ["SelectedItemsOptionTask"], a.orgdiagram.SelectedItemsTask, "#00ffff");
          e.addTask("SelectionPathItemsTask", ["VisualTreeTask", "CursorItemTask", "SelectedItemsTask", "CursorSelectionPathModeOptionTask"], a.orgdiagram.SelectionPathItemsTask, "#00ffff");
          e.addTask("NormalVisibilityItemsByForegroundShapeAnnotationTask", ["ForegroundShapeAnnotationOptionTask"], a.orgdiagram.NormalVisibilityItemsByAnnotationTask, "#00ffff");
          e.addTask("NormalVisibilityItemsByBackgroundShapeAnnotationTask", ["BackgroundShapeAnnotationOptionTask"], a.orgdiagram.NormalVisibilityItemsByAnnotationTask, "#00ffff");
          e.addTask("NormalVisibilityItemsByBackgroundAnnotationTask", ["BackgroundAnnotationOptionTask"], a.orgdiagram.NormalVisibilityItemsByAnnotationTask, "#00ffff");
          e.addTask("NormalVisibilityItemsByForegroundHighlightPathAnnotationTask", ["ForegroundHighlightPathAnnotationOptionTask"], a.orgdiagram.NormalVisibilityItemsByAnnotationTask, "#00ffff");
          e.addTask("NormalVisibilityItemsByBackgroundHighlightPathAnnotationTask", ["BackgroundHighlightPathAnnotationOptionTask"], a.orgdiagram.NormalVisibilityItemsByAnnotationTask, "#00ffff");
          e.addTask("NormalVisibilityItemsByForegroundConnectorAnnotationTask", ["ForegroundConnectorAnnotationOptionTask"], a.orgdiagram.NormalVisibilityItemsByConnectorAnnotationTask, "#00ffff");
          e.addTask("NormalVisibilityItemsByBackgroundConnectorAnnotationTask", ["BackgroundConnectorAnnotationOptionTask"], a.orgdiagram.NormalVisibilityItemsByConnectorAnnotationTask, "#00ffff");
          e.addTask("CombinedNormalVisibilityItemsTask", "ItemsSizesOptionTask CursorItemTask CursorNeighboursTask SelectedItemsTask SelectionPathItemsTask NormalVisibilityItemsByForegroundShapeAnnotationTask NormalVisibilityItemsByBackgroundShapeAnnotationTask NormalVisibilityItemsByBackgroundAnnotationTask NormalVisibilityItemsByForegroundHighlightPathAnnotationTask NormalVisibilityItemsByBackgroundHighlightPathAnnotationTask NormalVisibilityItemsByForegroundConnectorAnnotationTask NormalVisibilityItemsByBackgroundConnectorAnnotationTask".split(" "),
              a.orgdiagram.CombinedNormalVisibilityItemsTask, "#00ffff");
          e.addTask("ItemsPositionsTask", "CurrentControlSizeTask ScaleOptionTask OrientationOptionTask ItemsSizesOptionTask ConnectorsOptionTask VisualTreeOptionTask VisualTreeTask VisualTreeLevelsTask ItemTemplateParamsTask CursorItemTask CombinedNormalVisibilityItemsTask".split(" "), a.orgdiagram.ItemsPositionsTask, "#ff0000");
          e.addTask("AlignDiagramTask", "OrientationOptionTask ItemsSizesOptionTask VisualTreeOptionTask ScaleOptionTask CurrentControlSizeTask ActiveItemsTask ItemsPositionsTask isFamilyChartMode".split(" "),
              a.orgdiagram.AlignDiagramTask, "#ff0000");
          e.addTask("CreateTransformTask", ["OrientationOptionTask", "AlignDiagramTask"], a.orgdiagram.CreateTransformTask, "#00ffff");
          e.addTask("CenterOnCursorTask", "layout CurrentControlSizeTask CurrentScrollPositionTask CursorItemTask AlignDiagramTask CreateTransformTask ScaleOptionTask".split(" "), a.orgdiagram.CenterOnCursorTask, "#00ffff");
          e.addTask("PaletteManagerTask", ["ConnectorsOptionTask", "null"], a.orgdiagram.PaletteManagerTask, "#00ffff");
          e.addTask("ApplyLayoutChangesTask",
              "graphics layout ItemsSizesOptionTask CurrentControlSizeTask ScaleOptionTask AlignDiagramTask".split(" "), a.orgdiagram.ApplyLayoutChangesTask, "#008000");
          e.addTask("DrawBackgroundAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask BackgroundAnnotationOptionTask VisualTreeTask AlignDiagramTask".split(" "), a.orgdiagram.DrawBackgroundAnnotationTask, "#008000");
          e.addTask("DrawBackgroundHighlightPathAnnotationTask", ["graphics", "ConnectorsOptionTask", "ForegroundHighlightPathAnnotationOptionTask",
              "ConnectionsGraphTask", "foreground"
          ], a.orgdiagram.DrawHighlightPathAnnotationTask, "#00ffff");
          e.addTask("DrawForegroundHighlightPathAnnotationTask", ["graphics", "ConnectorsOptionTask", "BackgroundHighlightPathAnnotationOptionTask", "ConnectionsGraphTask", "background"], a.orgdiagram.DrawHighlightPathAnnotationTask, "#00ffff");
          e.addTask("DrawForegroundConnectorAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask OrientationOptionTask ForegroundConnectorAnnotationOptionTask AlignDiagramTask AnnotationLabelTemplateTask foreground".split(" "),
              a.orgdiagram.DrawConnectorAnnotationTask, "#008000");
          e.addTask("DrawBackgroundConnectorAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask OrientationOptionTask BackgroundConnectorAnnotationOptionTask AlignDiagramTask AnnotationLabelTemplateTask background".split(" "), a.orgdiagram.DrawConnectorAnnotationTask, "#008000");
          e.addTask("DrawForegroundShapeAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask OrientationOptionTask ForegroundShapeAnnotationOptionTask AlignDiagramTask AnnotationLabelTemplateTask foreground".split(" "),
              a.orgdiagram.DrawShapeAnnotationTask, "#008000");
          e.addTask("DrawBackgroundShapeAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask OrientationOptionTask BackgroundShapeAnnotationOptionTask AlignDiagramTask AnnotationLabelTemplateTask background".split(" "), a.orgdiagram.DrawShapeAnnotationTask, "#008000");
          e.addTask("DrawCursorTask", "graphics CreateTransformTask ApplyLayoutChangesTask CombinedContextsTask AlignDiagramTask ItemTemplateParamsTask CursorItemTask SelectedItemsTask".split(" "),
              a.orgdiagram.DrawCursorTask, "#008000");
          e.addTask("DrawHighlightTask", "graphics CreateTransformTask ApplyLayoutChangesTask CombinedContextsTask AlignDiagramTask ItemTemplateParamsTask HighlightItemTask CursorItemTask SelectedItemsTask".split(" "), a.orgdiagram.DrawHighlightTask, "#008000");
          e.addTask("DrawHighlightAnnotationTask", "layout graphics CreateTransformTask ApplyLayoutChangesTask ScaleOptionTask CombinedContextsTask CalloutOptionTask ReadTemplatesTask AlignDiagramTask CenterOnCursorTask HighlightItemTask CursorItemTask SelectedItemsTask".split(" "),
              a.orgdiagram.DrawHighlightAnnotationTask, "#008000");
          e.addTask("DrawTreeItemsTask", "graphics CreateTransformTask ApplyLayoutChangesTask ScaleOptionTask ItemsSizesOptionTask CombinedContextsTask AlignDiagramTask CenterOnCursorTask ItemTemplateParamsTask CursorItemTask SelectedItemsTask GroupTitleTemplateTask CheckBoxTemplateTask ButtonsTemplateTask".split(" "), a.orgdiagram.DrawTreeItemsTask, "#008000");
          e.addTask("DrawMinimizedItemsTask", "graphics CreateTransformTask ApplyLayoutChangesTask MinimizedItemsOptionTask ItemTemplateParamsTask AlignDiagramTask".split(" "),
              a.orgdiagram.DrawMinimizedItemsTask, "#008000");
          e.addTask("DrawConnectorsTask", ["graphics", "ConnectionsGraphTask", "ConnectorsOptionTask", "showElbowDots", "PaletteManagerTask"], a.orgdiagram.DrawConnectorsTask, "#008000");
          e.addTask("DrawItemLabelsTask", ["graphics", "CreateTransformTask", "ApplyLayoutChangesTask", "LabelsOptionTask", "AlignDiagramTask"], a.orgdiagram.DrawItemLabelsTask, "#008000");
          return e
      };
      a.common.binarySearch = function(a, b, d, c) {
          var e = null,
              g, d = d || 0,
              h = c || a.length - 1,
              i, j;
          if (0 < a.length && (j = a[d],
                  e = {
                      index: d,
                      item: j
                  }, c = b(j, d), 0 < c))
              if (g = Math.abs(c), j = a[h], c = b(j, h), 0 <= c) e = {
                  index: h,
                  item: j
              };
              else {
                  c = Math.abs(c);
                  g > c && (g = c, e = {
                      index: h,
                      item: j
                  });
                  for (; d + 1 < h;)
                      if (i = Math.round((d + h) / 2), j = a[i], c = b(j, i), 0 === c) {
                          e = {
                              index: i,
                              item: j
                          };
                          break
                      } else 0 < c ? d = i : h = i, c = Math.abs(c), g > c && (g = c, e = {
                          index: i,
                          item: j
                      })
              }
          return e
      };
      a.common.family = function(f) {
          function b(a, b, c, d) {
              var e;
              if (null != d && (b = b[c], null != b))
                  for (e in b)
                      if (b.hasOwnProperty(e) && d.call(a, e, b[e])) break
          }
  
          function d(a, b) {
              var c = !1;
              null != A[a] && null != A[a][b] && (delete A[a][b],
                  E[a] -= 1, delete D[b][a], F[b] -= 1, E[a] || (delete A[a], delete E[a]), D[b] || (delete D[b], delete F[b], null == y[null] && (y[null] = {}, w[null] = 0), y[null][b] = !0, w[null] += 1), c = !0);
              return c
          }
  
          function c(a, b) {
              var c;
              if (null != b)
                  for (c in C)
                      if (C.hasOwnProperty(c) && b.call(a, c, C[c])) break
          }
  
          function e(a, c, d, e) {
              for (var f, h, g = {}, i = 0, l = !0; l;) {
                  f = {};
                  l = !1;
                  for (h in d)
                      if (d.hasOwnProperty(h) && !g[h]) switch (g[h] = !0, e.call(a, h, C[h], i)) {
                          case 1:
                              f = {};
                              l = !1;
                              break;
                          case 2:
                              break;
                          default:
                              b(this, c, h, function(a) {
                                  g[a] || (l = f[a] = !0)
                              })
                      }
                  d = f;
                  i += 1
              }
          }
  
          function g(a,
              b, c) {
              null != c && null != b && (null != C[b] && null != A[b]) && e(a, A, A[b], c)
          }
  
          function h(a, b, c) {
              null != c && null != b && (null != C[b] && null != D[b]) && e(a, D, D[b], c)
          }
  
          function i(a, c, d, e, f, h) {
              var g, i, l, j;
              if (null != h) {
                  c = [];
                  i = {};
                  for (g in C) C.hasOwnProperty(g) && (i[g] = d[g] || 0, i[g] || c.push(g));
                  for (j = 0; 0 < c.length;) {
                      l = [];
                      d = 0;
                      for (f = c.length; d < f; d += 1) {
                          g = c[d];
                          if (h.call(a, g, C[g], j)) {
                              l = [];
                              break
                          }
                          j += 1;
                          b(this, e, g, function(a) {
                              i[a] -= 1;
                              0 === i[a] && l.push(a)
                          })
                      }
                      c = l
                  }
              }
          }
  
          function j(a, b) {
              i(a, D, F, A, E, b)
          }
  
          function k(a, b) {
              i(a, A, E, D, F, b)
          }
  
          function l(a, b, c, d,
              e, f, h, g, i) {
              var l = !1,
                  j, n;
              if (null != C[a] && null != h[a]) {
                  l = !0;
                  if (i) {
                      i = 0;
                      for (j = b.length; i < j; i += 1)
                          if (n = b[i], null == C[n] || null == h[a][n]) l = !1
                  }
                  if (l && (null != d && (C[c] = d), null != C[c])) {
                      e[c] || (e[c] = {}, f[c] = 0);
                      h[c] || (h[c] = {}, g[c] = 0);
                      e[c][a] || (e[c][a] = !0, f[c] += 1);
                      h[a][c] || (h[a][c] = !0, g[a] += 1);
                      i = 0;
                      for (j = b.length; i < j; i += 1) n = b[i], c != n && (null != h[a][n] && (delete h[a][n], g[a] -= 1), null != e[n][a] && (delete e[n][a], f[n] -= 1), e[n][c] || (e[n][c] = !0, f[n] += 1), h[c][n] || (h[c][n] = !0, g[c] += 1))
                  }
              }
              return l
          }
  
          function n(a, b, c, d) {
              return l(a, b,
                  c, d, D, F, A, E, !0)
          }
  
          function m() {
              this.key = this.id = "";
              this.children = [];
              this.childrenHash = {};
              this.processed = !1
          }
  
          function p(a) {
              this.items = [];
              this.difference = this.weight = 0;
              0 < arguments.length && (this.difference = a)
          }
  
          function q(c) {
              var d = a.common.graph(),
                  e, f, h, g, i, l, n, j, k = {};
              for (e in c) c.hasOwnProperty(e) && b(this, A, e, function(a) {
                  if (!k.hasOwnProperty(a)) {
                      k[a] = !0;
                      f = [];
                      b(this, D, a, function(a) {
                          f.push(a)
                      });
                      h = 0;
                      for (i = f.length; h < i - 1; h += 1)
                          if (l = f[h], c.hasOwnProperty(l))
                              for (g = h + 1; g < i; g += 1)
                                  if (n = f[g], c.hasOwnProperty(n)) {
                                      j =
                                          Math.abs(c[l].children.length - c[n].children.length);
                                      var e = d.edge(l, n);
                                      null == e && (e = new p(j), d.addEdge(l, n, e));
                                      e.items.push(a);
                                      e.weight += 1
                                  }
                  }
              });
              return d
          }
  
          function r(a, b) {
              this.parentid = a;
              this.childid = b;
              this.key = a + "," + b
          }
  
          function s(a, b) {
              this.from = a;
              this.to = b;
              this.distance = 0
          }
  
          function t(a) {
              return E[a] || 0
          }
  
          function v(a) {
              return F[a] || 0
          }
  
          function u(a) {
              var b = null,
                  a = A[a] || {};
              for (b in a)
                  if (a.hasOwnProperty(b)) return b;
              return null
          }
  
          function z(a) {
              var b = null,
                  a = D[a] || {};
              for (b in a)
                  if (a.hasOwnProperty(b)) return b;
              return null
          }
  
          function x(a, b) {
              this.parentid = a;
              this.childid = b;
              this.ids = [];
              this.nodes = []
          }
  
          function B() {
              return a.common.family({
                  roots: y,
                  rootsCount: w,
                  children: A,
                  childrenCount: E,
                  parents: D,
                  parentsCount: F,
                  nodes: C
              })
          }
          var y = {},
              w = {},
              A = {},
              E = {},
              D = {},
              F = {},
              C = {};
          a.common.isObject(f) && (y = a.common.cloneObject(f.roots, !1), w = a.common.cloneObject(f.rootsCount, !0), A = a.common.cloneObject(f.children, !1), E = a.common.cloneObject(f.childrenCount, !0), D = a.common.cloneObject(f.parents, !1), F = a.common.cloneObject(f.parentsCount, !0), C = a.common.cloneObject(f.nodes, !0));
          return {
              add: function(a, c, d) {
                  var e, f, h = {};
                  if (!a || 0 === a.length) a = [null];
                  if (null == C[c] && null != d) {
                      C[c] = d;
                      d = 0;
                      for (e = a.length; d < e; d += 1) f = a[d], null == h[f] && f != c && (h[f] = !0, null != C[f] ? (null == D[c] && (D[c] = {}, F[c] = 0), D[c][f] || (D[c][f] = !0, F[c] += 1), null == A[f] && (A[f] = {}, E[f] = 0), A[f][c] || (A[f][c] = !0, E[f] += 1)) : (null == y[f] && (y[f] = {}, w[f] = 0), y[f][c] || (y[f][c] = !0, w[f] += 1)));
                      null != y[c] && (A[c] = y[c], E[c] = w[c], delete y[c], delete w[c], b(this, A, c, function(a) {
                          null == D[a] && (D[a] = {}, F[a] = 0);
                          D[a][c] || (D[a][c] = !0, F[a] += 1)
                      }))
                  }
              },
              adopt: function(a, b) {
                  var c, d, e;
                  if (null != C[b]) {
                      c = 0;
                      for (d = a.length; c < d; c += 1)
                          if (e = a[c], null == D[b] && (D[b] = {}, F[b] = 0), e != b && null != C[e]) D[b][e] || (D[b][e] = !0, F[b] += 1), null == A[e] && (A[e] = {}, E[e] = 0), A[e][b] || (A[e][b] = !0, E[e] += 1);
                          else throw "Item cannot be parent of itself and parent should exist in the structure!";
                  } else throw "Child should be in hierarchy!";
              },
              bundleChildren: n,
              bundleParents: function(a, b, c, d) {
                  return l(a, b, c, d, A, E, D, F, !0)
              },
              optimizeReferences: function(c) {
                  var d = {},
                      e = {},
                      f = {},
                      h, i, n, j, k, p;
                  k = 0;
                  var r = 10,
                      s;
                  if (null != c) {
                      for (h in C) k += 1, C.hasOwnProperty(h) && (i = new m, b(this, A, h, function(a) {
                          i.children.push(a);
                          i.childrenHash[a] = !0
                      }), i.children.sort(), i.id = h, i.key = i.children.join(","), f[i.id] = i);
                      for (r = Math.pow(10, k.toString().length); !a.common.isEmptyObject(f);) {
                          n = {};
                          s = {};
                          j = q(f);
                          for (h in f) f.hasOwnProperty(h) && (k = f[h], k.processed || (p = j.getSpanningTree(h, function(a) {
                              return a.weight * r + r - a.difference
                          }), p.loopLevels(this, function(a, b) {
                              f[a].processed = !0;
                              p.loopChildren(this, a, function(h, i) {
                                  var k = j.edge(a, h),
                                      p =
                                      null,
                                      q, r, t, u, v, w;
                                  f[h].processed = !0;
                                  if (1 < k.weight) {
                                      r = k.items.join(",");
                                      if (d.hasOwnProperty(r)) p = d[r];
                                      else {
                                          q = c();
                                          C[q.id] = q;
                                          p = new m;
                                          p.id = q.id;
                                          p.key = r;
                                          r = 0;
                                          for (t = k.items.length; r < t; r += 1) w = k.items[r], p.children.push(w), p.childrenHash[w] = !0, s[w] = !0;
                                          p.children.sort();
                                          d[p.key] = p;
                                          e[p.id] = p;
                                          n[p.id] = p;
                                          s[p.id] = p;
                                          u = p.children.slice(0);
                                          g(this, b.replacementItem || a, function(a) {
                                              !p.childrenHash[a] && null != e[a] && (v = !0, g(this, a, function(a) {
                                                  if (!p.childrenHash[a]) return v = !1, 1;
                                                  if (!s.hasOwnProperty(a)) return 2
                                              }), v && u.push(a));
                                              return 2
                                          });
                                          l(b.replacementItem || a, u, p.id, q, D, F, A, E, !1);
                                          if (1 >= (E[a] || 0) && null == b.replacementItem) b.replacementItem = p.id
                                      }
                                      if (p.id != h && (u = p.children.slice(0), g(this, i.replacementItem || h, function(a) {
                                              null != e[a] && !p.childrenHash[a] && (v = !0, g(this, a, function(a) {
                                                  return !p.childrenHash[a] ? (v = !1, 1) : (s.hasOwnProperty(a), 2)
                                              }), v && u.push(a));
                                              return 2
                                          }), l(i.replacementItem || h, u, p.id, null, D, F, A, E, !1), 1 >= (E[h] || 0) && null == i.replacementItem)) i.replacementItem = p.id
                                  }
                              })
                          })));
                          f = n
                      }
                  }
              },
              eliminateManyToMany: function(a) {
                  var c, d;
                  for (c in A) A.hasOwnProperty(c) && 1 < (E[c] || 0) && b(this, A, c, function(b) {
                      if (1 < (F[b] || 0)) d = a(), n(c, [b], d.id, d)
                  })
              },
              groupBy: function(a, b, c) {
                  if (null != c) {
                      var d = {},
                          e;
                      for (e in C) {
                          var f = E[e] || 0;
                          if (1 >= (F[e] || 0) && 1 >= f) {
                              var f = z(e),
                                  h = u(e),
                                  g = f + " * " + h;
                              d.hasOwnProperty(g) || (d[g] = new x(f, h));
                              d[g].ids.push(e);
                              d[g].nodes.push(C[e])
                          }
                      }
                      for (g in d)
                          if (d.hasOwnProperty(g) && (e = d[g], e.ids.length >= b && c.call(a, e.parentid, e.childid, e.ids, e.nodes))) break
                  }
              },
              getPlanarFamily: function(b) {
                  var c = new a.common.family,
                      d, e;
                  b.loopLevels(this,
                      function(f) {
                          var h = new a.common.LinkedHashItems,
                              i = {},
                              l = {},
                              n = [];
                          b.loopLevelItems(this, f, function(a) {
                              g(this, a, function(c) {
                                  var d = b.getItemPosition(c),
                                      e = new r(a, c);
                                  l[e.key] = e;
                                  var f = [];
                                  h.isEmpty() ? h.add(d, [e]) : (h.iterateBack(function(b, c) {
                                      if (c < d) return h.insertAfter(c, d, [e]), !0;
                                      if (c == d) return b.push(e), !0;
                                      for (var g = 0, i = b.length; g < i; g += 1) {
                                          var l = b[g];
                                          l.parentid != a && f.push(l)
                                      }
                                  }), h.startKey() > d && h.unshift(d, [e]));
                                  i[e.key] = f;
                                  for (var c = 0, g = f.length; c < g; c += 1) i[f[c].key].push(e);
                                  return 2
                              });
                              if (1 == t(a)) {
                                  var c = u(a);
                                  1 == v(c) && (c = new r(a, c), n.push(c.key))
                              }
                          });
                          var f = [],
                              j, k;
                          for (k in i) {
                              j = i[k];
                              var m = j.length;
                              null != f[m] ? f[m].push(k) : f[m] = [k]
                          }
                          m = {};
                          f.unshift(n);
                          for (var p = 0, q = f.length; p < q; p += 1) {
                              var s = f[p];
                              if (null != s) {
                                  d = 0;
                                  for (e = s.length; d < e; d += 1)
                                      if (k = s[d], !m.hasOwnProperty(k)) {
                                          m[k] = !0;
                                          j = l[k];
                                          null == c.node(j.parentid) && c.add(null, j.parentid, {});
                                          null == c.node(j.childid) ? c.add([j.parentid], j.childid, {}) : c.adopt([j.parentid], j.childid);
                                          j = i[k];
                                          k = 0;
                                          for (var w = j.length; k < w; k += 1) m[j[k].key] = !0
                                      }
                              }
                          }
                      });
                  return c
              },
              getFamilyWithoutGrandParentsRelations: function() {
                  var d =
                      new a.common.family,
                      e = {},
                      f = [],
                      h = 0,
                      g;
                  for (g in D) D.hasOwnProperty(g) && b(this, D, g, function(a) {
                      var b = e[g];
                      null == b && (b = {}, e[g] = b);
                      b.hasOwnProperty(a) || (b = new s(g, a, h), f.push(b), e[g][a] = b)
                  });
                  for (; 0 < f.length;) {
                      for (var i = [], h = h + 1, l = 0, j = f.length; l < j; l += 1) {
                          var n = f[l];
                          g = n.to;
                          D.hasOwnProperty(g) && b(this, D, g, function(a) {
                              var b = e[n.from];
                              null == b && (b = {}, e[n.from] = b);
                              if (b.hasOwnProperty(a)) b[a].distance = h;
                              else {
                                  var c = new s(g, a, h);
                                  i.push(c);
                                  b[a] = c
                              }
                          })
                      }
                      f = i
                  }
                  c(this, function(a, c) {
                      var f = [];
                      b(this, D, a, function(b) {
                          0 === e[a][b].distance &&
                              f.push(b)
                      });
                      d.add(f, a, c)
                  });
                  return d
              },
              getGraph: function() {
                  var c = a.common.graph(),
                      d;
                  for (d in A) A.hasOwnProperty(d) && b(this, A, d, function(a) {
                      var b = c.edge(d, a);
                      null == b && (b = new p({}), c.addEdge(d, a, b))
                  });
                  return c
              },
              removeNode: function(a) {
                  null != C[a] && (b(this, A, a, function(b) {
                          delete D[b][a];
                          F[b] -= 1;
                          F[b] || (delete D[b], delete F[b], null == y[null] && (y[null] = {}, w[null] = 0), y[null][b] || (y[null][b] = !0, w[null] += 1))
                      }), b(this, D, a, function(b) {
                          delete A[b][a];
                          E[b] -= 1;
                          E[b] || (delete A[b], delete E[b])
                      }), null != y[null] && null !=
                      y[null][a] && (delete y[null][a], w[null] -= 1, w[null] || (delete y[null], delete w[null])), delete A[a], delete E[a], delete D[a], delete F[a], delete C[a])
              },
              removeRelation: function(a, b) {
                  var c = !1;
                  null != C[a] && null != C[b] && (c = d(a, b) || d(b, a));
                  return c
              },
              node: function(a) {
                  return C[a]
              },
              loop: c,
              loopLevels: function(a, c, d) {
                  function e() {
                      this.items = {};
                      this.minimumLevel = null
                  }
  
                  function f(a, b, c) {
                      var d = m[b];
                      d || (d = new e, m[b] = d);
                      d.addItemToLevel(a, c);
                      u = null == u ? c : Math.min(u, c);
                      n[a] = c;
                      i[a] = !0
                  }
                  var h = [],
                      g = {},
                      i = {},
                      l = [],
                      n = {},
                      m = {},
                      p, q,
                      r, s, t, u = null;
                  r = c ? j : k;
                  var v, w, x, z, y, B, E, F;
                  e.prototype.addItemToLevel = function(a, b) {
                      var c = this.items[b];
                      c ? c.push(a) : (c = [a], this.items[b] = c);
                      this.minimumLevel = null == this.minimumLevel ? b : Math.min(this.minimumLevel, b)
                  };
                  if (null != d) {
                      r(this, function(a, b, c) {
                          h.push(a);
                          g[a] = c
                      });
                      r = 0;
                      for (v = h.length; r < v; r += 1)
                          if (p = h[r], null == i[p]) {
                              l.push(p);
                              for (f(p, r, 0); 0 < l.length;) {
                                  y = z = x = null;
                                  B = !c;
                                  E = [];
                                  p = 0;
                                  for (s = l.length; p < s; p += 1) t = l[p], w = n[t], F = !1, c ? (b(this, D, t, function(a) {
                                      var b;
                                      if (!i[a] && (F = !0, b = g[a], null == x || !B || x < b || x == b && y >
                                              w - 1)) x = b, z = a, y = w - 1, B = !0
                                  }), b(this, A, t, function(a) {
                                      var b;
                                      if (!i[a] && (F = !0, b = g[a], null == x || !B && (x > b || x == b && y < w + 1))) x = b, z = a, y = w + 1, B = !1
                                  })) : (b(this, A, t, function(a) {
                                      var b;
                                      if (!i[a] && (F = !0, b = g[a], null == x || B || x < b || x == b && y < w + 1)) x = b, z = a, y = w + 1, B = !1
                                  }), b(this, D, t, function(a) {
                                      var b;
                                      if (!i[a] && (F = !0, b = g[a], null == x || B && (x > b || x == b && y > w - 1))) x = b, z = a, y = w - 1, B = !0
                                  })), F && E.push(t);
                                  null != z && (E.push(z), f(z, r, y));
                                  l = E
                              }
                          }
                      l = !0;
                      for (c = u; l;) {
                          p = {};
                          l = !1;
                          for (q in m)
                              if (m.hasOwnProperty(q) && (r = m[q], s = r.items[r.minimumLevel - u + c], null != s)) {
                                  p[q] =
                                      r;
                                  l = !0;
                                  r = 0;
                                  for (v = s.length; r < v; r += 1)
                                      if (t = s[r], d.call(a, t, C[t], c - u)) return l = !1, !0
                              }
                          m = p;
                          c += 1
                      }
                  }
              },
              loopTopo: j,
              loopTopoReversed: k,
              loopChildren: g,
              loopParents: h,
              findLargestRoot: function() {
                  var a = null,
                      b, c = {},
                      d = {},
                      e;
                  b = null;
                  k(this, function(f, g) {
                      c.hasOwnProperty(f) || (c[f] = {}, d[f] = 0);
                      c[f][f] = !0;
                      d[f] += 1;
                      e = !0;
                      h(this, g.id, function(a) {
                          var b, h;
                          e = !1;
                          c.hasOwnProperty(a) || (c[a] = {}, d[a] = 0);
                          if (!d[a] && 1 == F[f]) c[a] = c[f], d[a] = d[f];
                          else
                              for (h in b = c[f], b) b.hasOwnProperty(h) && (c[a][h] = !0, d[a] += 1);
                          return 2
                      });
                      if (e && (!b || d[f] > b)) b =
                          d[f], a = f
                  });
                  return a
              },
              loopRoots: function(a, b) {
                  var c = null,
                      d, e = 0,
                      f = {},
                      g = {},
                      i, l = {},
                      n = {},
                      j, m, p, q, r, s, t;
                  k(this, function(a, b) {
                      f.hasOwnProperty(a) || (f[a] = {}, g[a] = 0);
                      f[a][a] = !0;
                      g[a] += 1;
                      i = !0;
                      h(this, b.id, function(b) {
                          var c, d;
                          i = !1;
                          f.hasOwnProperty(b) || (f[b] = {}, g[b] = 0);
                          if (!g[b] && 1 == F[a]) f[b] = f[a], g[b] = g[a];
                          else
                              for (d in c = f[a], c) c.hasOwnProperty(d) && !f[b][d] && (f[b][d] = !0, g[b] += 1);
                          return 2
                      });
                      i && (l[a] = !0, e += 1)
                  });
                  q = {};
                  for (p in l)
                      if (l.hasOwnProperty(p))
                          for (m in d = f[p], d) d.hasOwnProperty(m) && (q[m] || (q[m] = []), q[m].push(p.toString()));
                  for (; 0 < e;) {
                      d = null;
                      for (j in l)
                          if (l.hasOwnProperty(j) && (!d || g[j] < d)) d = g[j], c = j;
                      if (null != c) {
                          null != b && b.call(a, c, C[c]);
                          d = f[c];
                          for (m in d)
                              if (d.hasOwnProperty(m) && !n[m]) {
                                  p = q[m];
                                  s = 0;
                                  for (t = p.length; s < t; s += 1) r = p[s], g[r] -= 1;
                                  n[m] = !0
                              }
                          delete l[c];
                          e -= 1
                      }
                  }
              },
              hasNodes: function() {
                  return !a.common.isEmptyObject(C)
              },
              hasCommonChild: function(a) {
                  var c = !1,
                      d, e, f, h, g, i, l;
                  d = {};
                  h = f = 0;
                  for (g = a.length; h < g; h += 1) i = a[h], null != C[i] && !d[i] && (d[i] = !0, f += 1);
                  e = {};
                  for (i in d) d.hasOwnProperty(i) && b(this, A, i, function(a) {
                      e[a] = e[a] ? e[a] + 1 : 1
                  });
                  for (l in e)
                      if (e.hasOwnProperty(l) && null != D[l] && (F[l] || 0) == e[l] && e[l] == f) {
                          c = !0;
                          break
                      }
                  return c
              },
              loopNeighbours: function(a, b, c) {
                  var d = {};
                  null != c && (g(this, b, function(b, e) {
                      d.hasOwnProperty(b) || (d[b] = null, c.call(a, b, e, 1) && (d[b] = 2, h(this, b, function(b, e) {
                          d.hasOwnProperty(b) || (d[b] = null, c.call(a, b, e, 2) && (d[b] = 2));
                          return d[b]
                      })));
                      return d[b]
                  }), h(this, b, function(b, e) {
                      d.hasOwnProperty(b) || (d[b] = null, c.call(a, b, e, 1) && (d[b] = 2, g(this, b, function(b, e) {
                          d.hasOwnProperty(b) || (d[b] = !0, c.call(a, b, e, 2) && (d[b] = 2));
                          return d[b]
                      })));
                      return d[b]
                  }))
              },
              countChildren: t,
              countParents: v,
              firstParent: z,
              firstChild: u,
              validate: function(a) {
                  function d(a) {
                      var b = 0,
                          c;
                      if (null != a)
                          for (c in a) a.hasOwnProperty(c) && (b += 1);
                      return b
                  }
                  var e, f;
                  c(this, function(c) {
                      b(this, A, c, function(b) {
                          if (!D.hasOwnProperty(b) || !D[b].hasOwnProperty(c)) return null != a && (a.message = "Child #" + b + " does not reference parent #" + c), !1
                      });
                      b(this, D, c, function(b) {
                          if (!A.hasOwnProperty(b) || !A[b].hasOwnProperty(c)) return null != a && (a.message = "Parent #" + b + " does not reference child #" + c), !1
                      })
                  });
                  for (e in D)
                      if (D.hasOwnProperty(e)) {
                          if ((F[e] || 0) != d(D[e])) return null != a && (a.message = "Parents count for item #" + e + " missmatch."), !1;
                          if (D.hasOwnProperty(e) && !C.hasOwnProperty(e)) return null != a && (a.message = "Orphant parents for item #" + e), !1
                      }
                  for (f in A)
                      if (A.hasOwnProperty(f)) {
                          if ((E[f] || 0) != d(A[f])) return null != a && (a.message = "Children count for item " + f + " missmatch."), !1;
                          if (A.hasOwnProperty(f) && !C.hasOwnProperty(f)) return null != a && (a.message = "Orphant children of item " + f), !1
                      }
                  for (f in y)
                      if (y.hasOwnProperty(f)) {
                          if ((w[f] ||
                                  0) != d(y[f])) return null != a && (a.message = "Root children count for item @" + f + " missmatch."), !1;
                          b(this, y, f, function(b) {
                              if (!C.hasOwnProperty(b)) return null != a && (a.message = "Child #" + b + "of root #" + f + " does not exists."), !1
                          })
                      }
                  return !0
              },
              hasLoops: function() {
                  var a = B();
                  j(this, function(b) {
                      a.removeNode(b)
                  });
                  return a.hasNodes()
              },
              clone: B,
              BREAK: 1,
              SKIP: 2
          }
      };
      a.common.FamilyAlignment = function(f, b, d, c) {
          function e(b, c) {
              var d = b[c];
              null == d && (d = new a.common.FamilyMargins, b[c] = d);
              return d
          }
  
          function g(a, b, c, d, e, f, h, g) {
              var j =
                  f,
                  v = f;
              c.loopSiblings(this, b, function(a) {
                  a = h.getItemPosition(a);
                  j = Math.min(j, a);
                  v = Math.max(v, a)
              });
              for (var u = f - 1; u >= j; u -= 1) {
                  var z = h.getItemAtPosition(d, u);
                  if (!a.hasOwnProperty(z)) {
                      var x = h.getItemAtPosition(d, u + 1);
                      a[z] = a[x] - (i[z] / 2 + (g[x] || 0) + i[x] / 2)
                  }
              }
              for (u = f + 1; u <= v; u += 1) z = h.getItemAtPosition(d, u), a.hasOwnProperty(z) || (x = h.getItemAtPosition(d, u - 1), a[z] = a[x] + (i[x] / 2 + (g[z] || 0) + i[z] / 2));
              z = h.getItemAtPosition(d, j);
              x = a[z] - i[z] / 2;
              z = h.getItemAtPosition(d, v);
              x += a[z] + i[z] / 2;
              x /= 2;
              v = j = null;
              c.loopNonSiblings(this,
                  b,
                  function(a) {
                      a = h.getItemPosition(a);
                      j = null != j ? Math.min(j, a) : a;
                      v = null != v ? Math.max(v, a) : a
                  });
              c = 0;
              for (u = j; u <= v; u += 1) b = h.getItemAtPosition(e, u), c += i[b], u > j && (c += g[b] || 0);
              u = x - c / 2;
              b = h.getItemAtPosition(e, j);
              a.hasOwnProperty(b) || (a[b] = u + i[b] / 2);
              for (u = j + 1; u <= v; u += 1) b = h.getItemAtPosition(e, u), a.hasOwnProperty(b) || (x = h.getItemAtPosition(e, u - 1), a[b] = a[x] + (i[x] / 2 + (g[b] || 0) + i[b] / 2))
          }
          var h, i = {},
              j;
          null != c && d.loopItems(this, function(a, b) {
              i[a] = c.call(f, a, b)
          });
          j = function(b, c) {
              var d = {},
                  f = {},
                  h = null;
              c.loopLevelsReversed(this,
                  function(g) {
                      var j = new a.common.FamilyMargins;
                      null != h && (h.add(0, Number.MAX_VALUE), j.merge(h, 0));
                      var s = h = j;
                      c.loopLevelItems(this, g, function(a, h, g) {
                          var j = e(f, a);
                          j.add(i[a], g);
                          switch (b.countParents(a)) {
                              case 0:
                                  null != s && (d[a] = s.attach(j));
                                  break;
                              case 1:
                                  b.loopParents(this, a, function(c) {
                                      c = e(f, c);
                                      d[a] = c.merge(j);
                                      s = c;
                                      return b.BREAK
                                  });
                                  break;
                              default:
                                  var p = 0,
                                      q = null,
                                      r = null,
                                      w = {};
                                  b.loopParents(this, a, function(a, d, e) {
                                      if (0 < e) return b.BREAK;
                                      p += i[a];
                                      d = c.getItemPosition(a);
                                      q = null == q ? d : Math.min(q, d);
                                      r = null == r ? d : Math.max(r,
                                          d);
                                      w[d] = a
                                  });
                                  h = -p / 2;
                                  for (g = q; g <= r; g += 1) {
                                      var A = w[g],
                                          h = h + i[A] / 2,
                                          E = e(f, A);
                                      E.attach(j, -h);
                                      s = E;
                                      h += i[A] / 2
                                  }
                          }
                      })
                  });
              return d
          }(b, d);
          h = function(b, c, d) {
              var e = {},
                  f = a.common.getFamilyUnits(b),
                  h = {};
              c.loopLevels(this, function(a) {
                  c.loopLevelItems(this, a, function(b, j, k) {
                      if (!e.hasOwnProperty(b)) {
                          j = 0;
                          if (0 === k) null != d[b] && (j += d[b] + i[b] / 2);
                          else var u = c.getItemAtPosition(a, k - 1),
                              j = j + (e[u] + i[u] / 2 + (d[b] || 0) + i[b] / 2);
                          e[b] = j
                      }
                      j = f[b];
                      if (null != j)
                          for (u = 0; u < j.length; u += 1) {
                              var z = j[u];
                              h.hasOwnProperty(z.id) || (h[z.id] = !0, g(e, b, z, a, a + 1,
                                  k, c, d))
                          }
                  })
              });
              return e
          }(b, d, j);
          return {
              getOffset: function(a) {
                  return h[a]
              }
          }
      };
      a.common.FamilyMargins = function() {
          function a(b, d, c, e) {
              this.left = b;
              this.right = d;
              this.leftIndex = c;
              this.rightIndex = e
          }
          this.items = [];
          this.add = function(b, d, c, e) {
              switch (arguments.length) {
                  case 2:
                      this.items.push(new a(-b / 2, b / 2, d, d));
                      break;
                  case 4:
                      this.items.push(new a(b, d, c, e))
              }
          };
          this.merge = function(b, d) {
              for (var c = this.getDistanceTo(b), e = 0, g = 0, h = this.items.length, i = b.items.length, j = Math.min(h, i), k = Math.max(h, i), l = 0; l < j; l += 1) {
                  var n = this.items[h -
                          1 - l],
                      m = b.items[i - 1 - l];
                  0 === l && (g = n.right - n.left + (c || 0) + (d || 0) + m.right - m.left, e = g / 2 + n.left, g = g / 2 - m.right);
                  n.left -= e;
                  n.right = m.right + g;
                  n.rightIndex = m.rightIndex;
                  this.items[k - 1 - l] = n
              }
              for (l = j; l < k; l += 1) n = this.items[h - 1 - l], m = b.items[i - 1 - l], null == n ? this.items[k - 1 - l] = new a(m.left + g, m.right + g, m.leftIndex, m.rightIndex) : (n.left -= e, n.right -= e);
              return c
          };
          this.attach = function(b, d) {
              for (var c = this.getDistanceTo(b), e = d || 0, g = this.items.length, h = b.items.length, i = Math.min(g, h), j = Math.max(g, h), k = 0; k < i; k += 1) {
                  var l = this.items[g -
                          1 - k],
                      n = b.items[h - 1 - k];
                  0 === k && (e = l.right + (c || 0) + (d || 0) - n.left);
                  l.right = n.right + e;
                  l.rightIndex = n.rightIndex;
                  this.items[j - 1 - k] = l
              }
              for (k = i; k < j; k += 1) l = this.items[g - 1 - k], null == l && (n = b.items[h - 1 - k], this.items[j - 1 - k] = new a(n.left + e, n.right + e, n.leftIndex, n.rightIndex));
              return c
          };
          this.getDistanceTo = function(a) {
              var d = null,
                  c = 0,
                  e = this.items.length,
                  f = a.items.length,
                  h = Math.min(e, f);
              if (0 < h) {
                  for (var i = 0; i < h; i += 1) {
                      var j = this.items[e - 1 - i],
                          k = a.items[f - 1 - i];
                      0 === i ? d = c = j.right - k.left : j.rightIndex < k.leftIndex && (d = Math.max(d,
                          j.right - k.left))
                  }
                  d -= c
              }
              return d
          };
          this.loop = function(a, d) {
              if (null != d)
                  for (var c = 0, e = this.items.length; c < e; c += 1) {
                      var f = this.items[e - 1 - c];
                      if (d.call(a, c, f.left, f.right, f.leftIndex, f.rightIndex)) break
                  }
          };
          this.getLeft = function(a) {
              var d = this.items.length - 1;
              if (d >= a) return this.items[d - a].left
          }
      };
      a.common.FibonacciHeap = function(a) {
          function b(a) {
              this.key = a.key;
              this.priority = a.priority;
              this.item = a.item
          }
  
          function d(a, b, c) {
              this.key = a;
              this.priority = b;
              this.item = c;
              this.degree = 0;
              this.marked = !1;
              this.right = this.left = this.child =
                  this.parent = null
          }
  
          function c(a, b) {
              var c = p[a.right];
              b.right = a.right;
              b.left = a.key;
              a.right = b.key;
              c.left = b.key
          }
  
          function e(a) {
              var b = p[a.left],
                  c = p[a.right];
              b.right = c.key;
              c.left = b.key;
              a.right = a.key;
              a.left = a.key
          }
  
          function g() {
              var a = null;
              null != m && (a = new b(p[m]));
              return a
          }
  
          function h() {
              var a = g();
              if (null != a) {
                  var b = p[m],
                      c = p[b.right];
                  if (null != b.child) {
                      var d = p[b.child],
                          f = p[d.left];
                      b.right = d.key;
                      c.left = f.key;
                      d.left = b.key;
                      f.right = c.key;
                      e(b);
                      delete p[b.key];
                      m = null;
                      i(d.key)
                  } else e(b), delete p[b.key], m = null, c.key != b.key &&
                      i(c.key)
              }
              return a
          }
  
          function i(b) {
              var c = [],
                  d, e = {};
              for (d = b; !e.hasOwnProperty(d);) {
                  var b = p[d],
                      h = b.right;
                  e[d] = !0;
                  for (b.parent = null; null != (d = c[b.degree]);)(a ? b.priority > d.priority : b.priority < d.priority) ? j(b, d) : (j(d, b), b = d), c[b.degree - 1] = null;
                  c[b.degree] = b;
                  if (null == m || null == p[m] || (a ? p[m].priority <= b.priority : p[m].priority >= b.priority)) m = b.key;
                  d = h
              }
          }
  
          function j(b, d) {
              b.degree += 1;
              e(d);
              var h = p[b.child];
              if (null != h) {
                  if (c(h, d), a ? h.priority < d.priority : h.priority > d.priority) b.child = d.key
              } else b.child = d.key;
              d.parent =
                  b.key
          }
  
          function k(b, c) {
              var d = p[b];
              if (a ? d.priority > c : d.priority < c) throw "Priority increase is not supported";
              d.priority = c;
              if (null != d.parent) {
                  var e = p[d.parent];
                  if (a ? e.priority < d.priority : e.priority > d.priority) l(e, d), n(e)
              }
              if (a ? p[m].priority < d.priority : p[m].priority > d.priority) m = d.key
          }
  
          function l(a, b) {
              b.marked = !1;
              b.parent = null;
              b.right == b.key ? a.child = null : (a.child = b.right, e(b));
              a.degree -= 1;
              c(p[m], b)
          }
  
          function n(a) {
              if (null != a.parent)
                  if (a.marked) {
                      var b = p[a.parent];
                      l(b, a);
                      n(b)
                  } else a.marked = !0
          }
          var m = null,
              p = {};
          return {
              add: function(b, e, h) {
                  if (p.hasOwnProperty(b)) throw "Duplicate keys are not supported!";
                  e = new d(b, e, h);
                  p[b] = e;
                  if (null == m) e.left = b, m = e.right = b;
                  else if (h = p[m], c(h, e), a ? h.priority < e.priority : h.priority > e.priority) m = b
              },
              getPriority: function(a) {
                  var b = null;
                  p.hasOwnProperty(a) && (b = p[a].priority);
                  return b
              },
              setPriority: k,
              heapRoot: g,
              extractRoot: h,
              deleteKey: function(b) {
                  k(b, a ? Infinity : -1);
                  h()
              },
              validate: function() {
                  var a = 0,
                      b;
                  for (b in p)
                      if (p.hasOwnProperty(b)) {
                          var c = p[b],
                              a = a + 1;
                          if (null != c.child) {
                              if (!p.hasOwnProperty(c.child)) throw "Child does not exists";
                              var d = p[c.child];
                              if (d.parent != c.key) throw "Child references wrong parent";
                          }
                          if (null != c.parent && !p.hasOwnProperty(c.parent)) throw "Parent does not exists";
                          if (null != c.left) {
                              if (!p.hasOwnProperty(c.left)) throw "Left does not exists";
                              d = p[c.left];
                              if (d.right != c.key) throw "Left references wrong right";
                          }
                          if (null != c.right) {
                              if (!p.hasOwnProperty(c.right)) throw "Right does not exists";
                              d = p[c.right];
                              if (d.left != c.key) throw "Right references wrong left";
                          }
                      }
                  if (null == m && 0 < a) throw "Orphans";
                  if (null != m) {
                      if (!p.hasOwnProperty(m)) throw "Root node does not exists";
                      c = p[m];
                      if (null != c.parent) throw "Root node has parent reference";
                      b = [m];
                      c = {};
                      for (d = 0; 0 < b.length;) {
                          for (var e = [], f = 0, h = b.length; f < h; f += 1)
                              for (var g = p[b[f]]; !c.hasOwnProperty(g.key);) c[g.key] = !0, d += 1, null != g.child && e.push(g.child), g = p[g.right];
                          b = e
                      }
                      if (a != d) throw "Tree has loops or orpants";
                  }
              }
          }
      };
      a.common.getCrossingRectangles = function(f, b, d) {
          function c(a, b, c, d) {
              this.isStart = a;
              this.index = b;
              this.x = c;
              this.rect = d
          }
  
          function e() {
              this.count = 0;
              this.rectangles = {};
              this.add = function(a) {
                  this.count += 1;
                  this.rectangles[a] = !0
              };
              this.remove = function(a) {
                  this.count -= 1;
                  delete this.rectangles[a];
                  return 0 == this.count
              }
          }
  
          function g(a, c, e, h, g) {
              a.loopForward(this, c, function(a, c) {
                  if (a > e) return !0;
                  for (var i in c.rectangles)
                      if (c.rectangles.hasOwnProperty(i)) {
                          var j = h > i ? h + "-" + i : i + "-" + h;
                          l.hasOwnProperty(j) || (l[j] = !0, d.call(f, g, b[i]))
                      }
              })
          }
          if (null != d) {
              for (var h = [], i = 0; i < b.length; i += 1) {
                  var j = b[i];
                  h.push(new c(1, i, j.x, j));
                  h.push(new c(0, i, j.right(), j))
              }
              h.sort(function(a, b) {
                  return a.x == b.x ? b.isStart - a.isStart : a.x - b.x
              });
              for (var j = a.common.SortedList(),
                      k = {}, l = {}, i = 0; i < h.length; i += 1) {
                  var n = h[i],
                      m = [n.rect.y, n.rect.bottom()];
                  if (1 == n.isStart) {
                      g(j, m[0], m[1], n.index, n.rect);
                      for (var p = 0, q = m.length; p < q; p += 1) {
                          var r = m[p],
                              s = k[r];
                          null == s && (s = new e, k[r] = s, j.add(r, s));
                          s.add(n.index)
                      }
                  } else {
                      p = 0;
                      for (q = m.length; p < q; p += 1) r = m[p], s = k[r], s.remove(n.index) && (delete k[r], j.remove(r));
                      g(j, m[0], m[1], n.index, n.rect)
                  }
              }
          }
      };
      a.common.getFamilyUnits = function(a) {
          function b() {
              this.toIndex = this.fromIndex = 0;
              this.items = [];
              this.hash = {}
          }
  
          function d(a) {
              this.id = a;
              this.parents = new b;
              this.children =
                  new b;
              this.loopSiblings = function(a, b, c) {
                  this._loop(a, this.parents.hash.hasOwnProperty(b) ? this.parents.items : this.children.items, c)
              };
              this.loopNonSiblings = function(a, b, c) {
                  this._loop(a, !this.parents.hash.hasOwnProperty(b) ? this.parents.items : this.children.items, c)
              };
              this.loop = function(a, b) {
                  this._loop(a, this.parents.items, b);
                  this._loop(a, this.children.items, b)
              };
              this._loop = function(a, b, c) {
                  if (null != c)
                      for (var d = 0, e = b.length; d < e; d += 1) c.call(a, b[d])
              };
              this.addParent = function(a) {
                  this._add(a, this.parents)
              };
              this.addChild =
                  function(a) {
                      this._add(a, this.children)
                  };
              this._add = function(a, b) {
                  b.hash.hasOwnProperty(a) || (b.items.push(a), b.hash[a] = !0)
              }
          }
          var c = [],
              e = {},
              g, h;
          g = 0;
          a.loop(this, function(b) {
              var h = a.countChildren(b);
              if (0 < h && !e.hasOwnProperty(b)) {
                  var i = new d(g);
                  g += 1;
                  i.addParent(b);
                  a.loopChildren(this, b, function(b) {
                      i.addChild(b);
                      1 == h && a.loopParents(this, b, function(b) {
                          i.addParent(b);
                          e[b] = i;
                          return a.SKIP
                      });
                      return a.SKIP
                  });
                  c.push(i);
                  e[b] = i
              }
          });
          var i = {};
          g = 0;
          for (h = c.length; g < h; g += 1) {
              var j = c[g];
              j.loop(this, function(a) {
                  i.hasOwnProperty(a) ?
                      i[a].push(j) : i[a] = [j]
              })
          }
          return i
      };
      a.common.getLiniarBreaks = function(f) {
          function b(b, d) {
              var e = 0,
                  h = (c[d] - c[b] + f[b]) / (d - b + 1),
                  g = a.common.binarySearch(f, function(a) {
                      return h - a
                  }, b, d);
              g.item <= h ? (e += h * (g.index + 1 - b) - (c[g.index] - c[b] + f[b]), e += c[d] - c[g.index] - h * (d - g.index)) : (e += h * (g.index - b) - (c[g.index] - c[b] - f[g.index] + f[b]), e += c[d] - c[g.index] + f[g.index] - h * (d - g.index + 1));
              return e
          }
  
          function d(a, c) {
              var d;
              d = 0 + b(0, a);
              c > a + 1 && (d += b(a + 1, c - 1));
              return d += b(c, e - 1)
          }
          for (var c = [], e = f.length, g = 0, h = 0; h < e; h += 1) g += f[h], c[h] =
              g;
          for (var g = 0, h = e - 1, i = d(g, h); g < h + 1;) {
              var j = d(g + 1, h),
                  k = d(g, h - 1);
              if (j < k) {
                  if (j >= i) break;
                  g += 1;
                  i = j
              } else {
                  if (k >= i) break;
                  h -= 1;
                  i = k
              }
          }
          return [g, h - 1, e - 1]
      };
      a.common.getMergedRectangles = function(f, b, d) {
          function c(a, b) {
              this.start = a;
              this.startHead = null;
              this.end = b;
              this.endHead = null;
              this.overlap = function(a) {
                  return !(this.end < a.start || this.start > a.end)
              }
          }
  
          function e(a, b) {
              this.x = a;
              this.ranges = b
          }
  
          function g(a, b) {
              this.isHead = a;
              this.list = b;
              B.hasOwnProperty(b) || (B[b] = []);
              B[b].push(this);
              this.add = function(a) {
                  a.from.equalTo(a.to) ||
                      (this.isHead ? x[this.list].add(y, a) : x[this.list].unshift(y, a), y += 1)
              };
              this.getTail = function() {
                  return new g(!this.isHead, this.list)
              };
              this.attach = function(a) {
                  if (this.list != a.list) {
                      x[this.list].attach(x[a.list]);
                      var b = B[a.list];
                      delete B[a.list];
                      if (null != b)
                          for (var c = 0, d = b.length; c < d; c += 1) {
                              var e = b[c];
                              e != a && (e.list = this.list, B[this.list].push(e))
                          }
                  }
              }
          }
  
          function h(b) {
              x.push(new a.common.LinkedHashItems);
              return new g(b, x.length - 1)
          }
          var i, j, k, l, n;
          b.sort(function(a, b) {
              return a.x == b.x ? a.y - b.y : a.x - b.x
          });
          var m = [],
              p = {};
          i = 0;
          for (j = b.length; i < j; i += 1) {
              k = b[i];
              l = [k.x, k.right()];
              for (var q = 0; q < l.length; q += 1) {
                  var r = l[q];
                  n = p[r];
                  null == n && (n = {
                      x: r,
                      add: [],
                      remove: []
                  }, p[r] = n, m.push(n));
                  r == k.x ? n.add.push(i) : n.remove.push(i)
              }
          }
          m.sort(function(a, b) {
              return a.x - b.x
          });
          q = {};
          p = [];
          p.push(new e(null, []));
          i = 0;
          for (j = m.length; i < j; i += 1) {
              n = m[i];
              k = 0;
              for (l = n.add.length; k < l; k += 1) q[n.add[k]] = !0;
              k = 0;
              for (l = n.remove.length; k < l; k += 1) delete q[n.remove[k]];
              var r = [],
                  s;
              for (s in q) q.hasOwnProperty(s) && r.push(b[s]);
              r.sort(function(a, b) {
                  return a.y - b.y
              });
              var t = [],
                  v = null,
                  u = null;
              k = 0;
              for (l = r.length; k < l; k += 1) {
                  var z = r[k];
                  null == v ? (v = z.y, u = z.bottom()) : u < z.y ? (t.push(new c(v, u)), v = z.y, u = z.bottom()) : u = Math.max(u, z.bottom())
              }
              null != v && t.push(new c(v, u));
              p.push(new e(n.x, t))
          }
          var x = [],
              B = {},
              y = 1;
          i = 1;
          for (j = p.length; i < j; i += 1) {
              b = p[i - 1];
              n = p[i];
              for (k = s = 0; s < b.ranges.length || k < n.ranges.length;)
                  if (l = s < b.ranges.length ? b.ranges[s] : null, q = k < n.ranges.length ? n.ranges[k] : null, null == q) {
                      m = [new a.common.Point(b.x, l.end), new a.common.Point(n.x, l.end), new a.common.Point(n.x, l.start),
                          new a.common.Point(b.x, l.start)
                      ];
                      for (t = 1; t < m.length; t += 1) l.endHead.add(new a.common.Vector(m[t - 1], m[t]));
                      l.endHead.attach(l.startHead);
                      s += 1
                  } else if (null == l) q.endHead = h(!0), q.endHead.add(new a.common.Vector(new a.common.Point(n.x, q.start), new a.common.Point(n.x, q.end))), q.startHead = q.endHead.getTail(), k += 1;
              else if (q.overlap(l)) {
                  m = [new a.common.Point(b.x, l.start), new a.common.Point(n.x, l.start), new a.common.Point(n.x, q.start)];
                  for (t = 1; t < m.length; t += 1) l.startHead.add(new a.common.Vector(m[t], m[t - 1]));
                  q.startHead = l.startHead;
                  for (t = !0; t;)
                      if (t = !1, l.end > q.end) r = k + 1 < n.ranges.length ? n.ranges[k + 1] : null, null != r && r.overlap(l) && (t = new a.common.Point(n.x, r.start), v = new a.common.Point(n.x, q.end), q.endHead = h(!0), q.endHead.add(new a.common.Vector(t, v)), r.startHead = q.endHead.getTail(), k += 1, q = r, t = !0);
                      else if (r = s + 1 < b.ranges.length ? b.ranges[s + 1] : null, null != r && r.overlap(q)) {
                      m = [new a.common.Point(b.x, l.end), new a.common.Point(n.x, l.end), new a.common.Point(n.x, r.start), new a.common.Point(b.x, r.start)];
                      for (t = 1; t < m.length; t +=
                          1) l.endHead.add(new a.common.Vector(m[t - 1], m[t]));
                      l.endHead.attach(r.startHead);
                      s += 1;
                      l = r;
                      t = !0
                  }
                  m = [new a.common.Point(b.x, l.end), new a.common.Point(n.x, l.end), new a.common.Point(n.x, q.end)];
                  for (t = 1; t < m.length; t += 1) l.endHead.add(new a.common.Vector(m[t - 1], m[t]));
                  q.endHead = l.endHead;
                  s += 1;
                  k += 1
              } else if (l.start < q.start) {
                  m = [new a.common.Point(b.x, l.end), new a.common.Point(n.x, l.end), new a.common.Point(n.x, l.start), new a.common.Point(b.x, l.start)];
                  for (t = 1; t < m.length; t += 1) l.endHead.add(new a.common.Vector(m[t -
                      1], m[t]));
                  l.endHead.attach(l.startHead);
                  s += 1
              } else q.endHead = h(!0), q.endHead.add(new a.common.Vector(new a.common.Point(n.x, q.start), new a.common.Point(n.x, q.end))), q.startHead = q.endHead.getTail(), k += 1
          }
          if (null != d)
              for (i = 0; i < x.length; i += 1) B.hasOwnProperty(i) && (j = x[i], m = [], j.iterate(function(a) {
                  0 == m.length && m.push(a.from);
                  m.push(a.to)
              }), d.call(f, m))
      };
      a.common.getMinimumCrossingRows = function(a, b, d) {
          var c = a = null;
          if (null != d) {
              b.sort(function(a, b) {
                  return a.y - b.y
              });
              for (var e = 0; e < b.length; e += 1) {
                  var g = b[e],
                      h =
                      g.bottom();
                  null === a ? (a = g.y, c = h) : g.y >= c ? (d.call(this.Arg, a), a = g.y, c = h) : (g.y > a && (a = g.y), h < c && (c = h))
              }
              null !== a && d.call(this.Arg, a)
          }
      };
      a.common.graph = function() {
          function f(a, b, d, e) {
              var f = [],
                  g, m, p, q;
              f.push(b);
              d[b] = !0;
              if (null != e)
                  for (; 0 < f.length;) {
                      b = [];
                      m = 0;
                      for (p = f.length; m < p; m += 1)
                          for (q in g = f[m], e.call(a, g), g = c[g], g) g.hasOwnProperty(q) && !d.hasOwnProperty(q) && (d[q] = !0, b.push(q));
                      f = b
                  }
          }
  
          function b(a, b) {
              var d = null,
                  e, f, g, m = 0,
                  p = null;
              for (e in c)
                  if (c.hasOwnProperty(e)) {
                      f = c[e];
                      m = 0;
                      for (g in f) f.hasOwnProperty(g) && (m +=
                          b.call(a, f[g], e, g));
                      if (m > p || null == p) d = e, p = m
                  }
              return d
          }
  
          function d(a, d, f, k, l) {
              var n = {},
                  m, p = [],
                  q = {},
                  r = 0,
                  s, t, v, u, z, x;
              if (null != f && null != k && (null == d && (d = b(a, f)), null != d)) {
                  k.call(a, d);
                  n[d] = !0;
                  r += 1;
                  for (q[d] = null; 0 < r;) {
                      p = [];
                      t = s = null;
                      v = {};
                      for (m in n)
                          if (n.hasOwnProperty(m)) {
                              u = c[m];
                              d = !1;
                              for (z in u)
                                  if (u.hasOwnProperty(z) && !q.hasOwnProperty(z)) switch (x = f.call(a, u[z], m, z), d = !0, l) {
                                      case e:
                                          null == v[z] && (v[z] = 0);
                                          v[z] += x;
                                          if (!t || v[z] > t) s = z, t = v[z];
                                          break;
                                      case g:
                                          if (v[z] = null == v[z] ? x : Math.min(v[z], x), !t || v[z] < t) s = z, t = v[z]
                                  }
                              d ||
                                  p.push(m)
                          }
                      if (null == s) break;
                      else n[s] = !0, r += 1, q[s] = !0, k.call(a, s);
                      d = 0;
                      for (s = p.length; d < s; d += 1) delete n[p[d]], r -= 1
                  }
              }
          }
          var c = {},
              e = 1,
              g = 2;
          return {
              addEdge: function(a, b, d) {
                  if ((null == c[a] || null == c[a][b]) && null != d) null == c[a] && (c[a] = {}), c[a][b] = d, null == c[b] && (c[b] = {}), c[b][a] = d
              },
              edge: function(a, b) {
                  var d = null;
                  null != c[a] && c[a][b] && (d = c[a][b]);
                  return d
              },
              hasNode: function(a) {
                  return c.hasOwnProperty(a)
              },
              loopNodes: function(a, b, d) {
                  a = {};
                  if (null == b)
                      for (b in c) c.hasOwnProperty(b) && (a.hasOwnProperty[b] || f(this, b, a, d));
                  else f(this,
                      b, a, d)
              },
              loopNodeEdges: function(a, b, d) {
                  var e;
                  if (null != d && (b = c[b], null != b))
                      for (e in b) b.hasOwnProperty(e) && d.call(a, e, b[e])
              },
              getSpanningTree: function(b, d) {
                  var e = a.common.tree(),
                      f = a.common.FibonacciHeap(!0),
                      g, n = {},
                      m, p, q, r;
                  f.add(b, 0, null);
                  for (n[b] = null; null != (g = f.extractRoot());) {
                      m = c[g.key];
                      for (p in m) m.hasOwnProperty(p) && !e.node(p) && (q = null != d ? d(m[p]) : m[p], r = f.getPriority(p), null == r ? (f.add(p, q, null), n[p] = g.key.toString()) : r <= q && (f.setPriority(p, q), n[p] = g.key.toString()));
                      e.add(n[g.key], g.key.toString(), {})
                  }
                  return e
              },
              getTotalWeightGrowthSequence: function(a, c, f) {
                  var g = b(a, c);
                  d(a, g, c, f, e)
              },
              getMinimumWeightGrowthSequence: function(a, b, c, e) {
                  d(a, b, c, e, g)
              },
              getShortestPath: function(b, d, e, f, g) {
                  var n = a.common.FibonacciHeap(!1),
                      m = {},
                      p = {},
                      q, r, s = {},
                      t = 0,
                      v = 0,
                      m = 0;
                  for (r = e.length; m < r; m += 1) q = e[m], s.hasOwnProperty(q) || (t += 1, s[q] = !0);
                  n.add(d, 0, null);
                  for (p[d] = null; null != (d = n.extractRoot());) {
                      e = c[d.key];
                      for (q in e) e.hasOwnProperty(q) && (r = d.priority + (null != f ? f.call(b, e[q], d, q) : 1), m = n.getPriority(q), null != m ? m > r && (n.setPriority(q,
                          r), p[q] = d.key) : p.hasOwnProperty(q) || (n.add(q, r, null), p[q] = d.key));
                      if (s.hasOwnProperty(d.key)) {
                          m = [];
                          for (e = d.key; null != e;) m.push(e), e = p[e];
                          g.call(b, m, d.key);
                          v += 1;
                          if (v >= t) break
                      }
                  }
              }
          }
      };
      a.common.LCA = function(f) {
          var b = [],
              d = [],
              c = {},
              e;
          (function() {
              var g = 0;
              f.loopEulerWalk(this, function(a, e, f) {
                  b.push(a);
                  d.push(f);
                  c.hasOwnProperty(a) || (c[a] = g);
                  g += 1
              });
              e = a.common.RMQ(d)
          })();
          return {
              getLowestCommonAncestor: function(a, d) {
                  var f = c[a],
                      j = c[d],
                      f = f < j ? e.getRangeMinimumIndex(f, j) : e.getRangeMinimumIndex(j, f);
                  return b[f]
              }
          }
      };
      a.common.LinkedHashItems = function() {
          function a(b, c) {
              if (g.hasOwnProperty(b)) throw "Duplicate segments are not supported!";
              g[b] = c;
              h[b] = null;
              null == k ? (j = b, i[b] = null) : (h[k] = b, i[b] = k);
              k = b
          }
  
          function b(a, b) {
              if (g.hasOwnProperty(a)) throw "Duplicate segments are not supported!";
              g[a] = b;
              i[a] = null;
              null == j ? (k = a, h[a] = null) : (i[j] = a, h[a] = j);
              j = a
          }
  
          function d(c, d, e) {
              if (g.hasOwnProperty(d)) throw "Duplicate segments are not supported!";
              if (null == c) b(d, e);
              else {
                  var j = h[c];
                  null == j ? a(d, e) : (g[d] = e, h[c] = d, h[d] = j, i[j] = d, i[d] = c)
              }
          }
  
          function c(a,
              b, c, d) {
              var e;
              null == c && (c = a ? j : k);
              if (null != b)
                  for (; null != c;) {
                      e = g[c];
                      if (null != e && b(e, c)) break;
                      c = c == d ? null : a ? h[c] : i[c]
                  }
          }
  
          function e(a, b, d) {
              c(!0, a, b, d)
          }
          var g = {},
              h = {},
              i = {},
              j = null,
              k = null;
          return {
              add: a,
              item: function(a) {
                  return g[a]
              },
              nextKey: function(a) {
                  return h[a]
              },
              prevKey: function(a) {
                  return i[a]
              },
              startKey: function() {
                  return j
              },
              endKey: function() {
                  return k
              },
              unshift: b,
              insertAfter: d,
              insertBefore: function(a, c, e) {
                  if (g.hasOwnProperty(c)) throw "Duplicate segments are not supported!";
                  if (null == a || !g.hasOwnProperty(a)) throw "Before key should be defined!";
                  a = i[a];
                  null == a ? b(c, e) : d(a, c, e)
              },
              remove: function(a) {
                  var b = i[a],
                      c = h[a];
                  null != b ? h[b] = c : j = c;
                  null != c ? i[c] = b : k = b;
                  delete g[a];
                  delete h[a];
                  delete i[a]
              },
              isEmpty: function() {
                  return null == j
              },
              attach: function(b) {
                  b.iterate(function(b, c) {
                      a(c, b)
                  })
              },
              iterate: e,
              iterateBack: function(a, b, d) {
                  c(!1, a, b, d)
              },
              empty: function() {
                  g = {};
                  h = {};
                  i = {};
                  k = j = null
              },
              toArray: function() {
                  var a = [];
                  e(function(b) {
                      a.push(b)
                  });
                  return a
              },
              validate: function(a) {
                  var b, c;
                  for (b in g)
                      if (g.hasOwnProperty(b) && (!h.hasOwnProperty(b) || !i.hasOwnProperty(b))) return null !=
                          a && (a.message = "Orphant key found!"), !1;
                  if (!g.hasOwnProperty(j) || !g.hasOwnProperty(k)) return null != a && (a.message = "Start or end values are missing!"), !1;
                  for (b in h)
                      if (h.hasOwnProperty(b)) {
                          if (!g.hasOwnProperty(b) || !i.hasOwnProperty(b)) return null != a && (a.message = "Orphant key found!"), !1;
                          if ((c = h[b]) && !h.hasOwnProperty(c)) return null != a && (a.message = "Next key not found!"), !1
                      }
                  for (b in i)
                      if (i.hasOwnProperty(b)) {
                          if (!g.hasOwnProperty(b) || !h.hasOwnProperty(b)) return null != a && (a.message = "Orphant key found!"), !1;
                          if ((c = i[b]) && !i.hasOwnProperty(c)) return null != a && (a.message = "Prev key not found!"), !1
                      }
                  return !0
              }
          }
      };
      a.common.mergeSort = function(a, b, d) {
          var c = null,
              e, g, h, i, j, k, l, n, m, p, q, r;
          switch (a.length) {
              case 0:
                  c = [];
                  break;
              default:
                  c = [];
                  for (h = 0; h < a.length; h += 1) {
                      e = a[h];
                      g = [];
                      k = c.length;
                      l = e.length;
                      j = i = 0;
                      q = m = p = n = null;
                      0 < k && (n = c[i], p = !b ? n : b(n));
                      0 < l && (m = e[j], q = !b ? m : b(m));
                      for (r = null; i < k || j < l;)
                          if (i >= k) {
                              if (!d || r != m) g.push(m), r = m;
                              j += 1;
                              j < l && (m = e[j], q = !b ? m : b(m))
                          } else if (j >= l) {
                          if (!d || r != n) g.push(n), r = n;
                          i += 1;
                          i < k && (n = c[i], p = !b ? n :
                              b(n))
                      } else if (p < q) {
                          if (!d || r != n) g.push(n), r = n;
                          i += 1;
                          i < k && (n = c[i], p = !b ? n : b(n))
                      } else {
                          if (!d || r != m) g.push(m), r = m;
                          j += 1;
                          j < l && (m = e[j], q = !b ? m : b(m))
                      }
                      c = g
                  }
          }
          return c
      };
      a.common.pile = function() {
          function a(b, d, f, h) {
              this.context = f;
              this.from = b;
              this.to = d;
              this.offset = null;
              this.direction = h
          }
  
          function b(a, d, f, h, i) {
              if (a >= d.length) return 0;
              if (f.hasOwnProperty(a)) return f[a];
              for (var j = d[a], k = b(a + 1, d, f, h, i), l = a + 1; l < d.length && !(d[l].from >= j.to);) l += 1;
              d = 1 + b(l, d, f, h, i);
              d > k ? (f[a] = d, h[a] = l, i[a] = !0) : (f[a] = k, h[a] = a + 1, i[a] = !1);
              return f[a]
          }
          var d = [];
          return {
              add: function(b, e, g) {
                  b < e ? d.push(new a(b, e, g, 1)) : d.push(new a(e, b, g, -1))
              },
              resolve: function(a, e) {
                  var f, h, i, j, k, l, n = 0;
                  if (null != e) {
                      j = d.slice(0);
                      j.sort(function(a, b) {
                          return a.from - b.from
                      });
                      for (k = []; 0 < j.length;) {
                          f = {};
                          h = {};
                          i = {};
                          b(0, j, f, h, i);
                          f = [];
                          k[n] = [];
                          for (l = 0; h.hasOwnProperty(l);) i[l] && (f.push(l), k[n].push(j[l])), l = h[l];
                          for (l = f.length - 1; 0 <= l; l -= 1) j.splice(f[l], 1);
                          n += 1
                      }
                      for (i = 0; i < n; i += 1) {
                          f = k[i];
                          for (l = 0; l < f.length; l += 1)
                              if (h = f[l], e.call(a, h.from, h.to, h.context, i, n, h.direction)) return n
                      }
                  }
                  return n
              }
          }
      };
      a.common.QuadTree = function(f) {
          function b(a, b, c, d) {
              this.x = a;
              this.y = b;
              this.scale = c;
              this.size = d;
              this.quadrants = [];
              this.points = []
          }
  
          function d(a) {
              var c = a.size / 2;
              a.quadrants = [new b(a.x, a.y, a.scale - 1, c), new b(a.x + c, a.y, a.scale - 1, c), new b(a.x, a.y + c, a.scale - 1, c), new b(a.x + c, a.y + c, a.scale - 1, c)];
              for (var c = 0, d = a.points.length; c < d; c += 1) {
                  var e = a.points[c];
                  a.quadrants[a.getQuadrantIndex(Math.floor(e.x), Math.floor(e.y))].points.push(e)
              }
              a.points = null
          }
          var c = Math.max(1, Math.floor(Math.log(f) / Math.log(2))),
              e = 8,
              g = 256,
              h = null,
              h = new b(0, 0, e, g);
          b.prototype.notEnclosed = function(a) {
              return this.x < a.x || this.x + this.size > a.x + a.width || this.y < a.y || this.y + this.size > a.y + a.height ? !0 : !1
          };
          b.prototype.overlaps = function(a) {
              return this.x + this.size < a.x || a.x + a.width < this.x || this.y + this.size < a.y || a.y + a.height < this.y ? !1 : !0
          };
          b.prototype.getQuadrantIndex = function(a, b) {
              var c = this.scale - 1;
              return a >> c & 1 | (b >> c & 1) << 1
          };
          return {
              addPoint: function(a) {
                  for (var f = Math.max(Math.floor(a.x), Math.floor(a.y)); g <= f;) {
                      e += 1;
                      g *= 2;
                      var k = new b(0, 0, e, g);
                      d(k);
                      k.quadrants[0] = h;
                      h = k
                  }
                  var f = Math.floor(a.x),
                      k = Math.floor(a.y),
                      l = h;
                  if (0 > f || 0 > k) throw "Negative values are not supported in the quad tree.";
                  for (;
                      (null == l.points || 0 < l.points.length) && !(l.scale == c && null != l.points);) null != l.points && 0 < l.points.length && d(l), l = l.quadrants[l.getQuadrantIndex(f, k)];
                  l.points.push(a)
              },
              loopArea: function(a, b, c) {
                  var d, e, f;
                  if (null != c)
                      for (var g = [h], q = []; 0 < g.length || 0 < q.length;) {
                          var r = [],
                              s = [];
                          e = 0;
                          for (f = g.length; e < f; e += 1)
                              if (d = g[e], d.overlaps(b))
                                  if (d.notEnclosed(b))
                                      if (null == d.points)
                                          for (var t =
                                                  0; 4 > t; t += 1) r.push(d.quadrants[t]);
                                      else
                                          for (var t = 0, v = d.points.length; t < v; t += 1) {
                                              var u = d.points[t];
                                              if (b.contains(u) && c.call(a, u)) return
                                          } else q.push(d);
                          e = 0;
                          for (f = q.length; e < f; e += 1)
                              if (d = q[e], null == d.points)
                                  for (t = 0; 4 > t; t += 1) s.push(d.quadrants[t]);
                              else {
                                  t = 0;
                                  for (v = d.points.length; t < v; t += 1)
                                      if (c.call(a, d.points[t])) return
                              }
                          g = r;
                          q = s
                      }
              },
              validate: function() {
                  for (var b = [h]; 0 < b.length;) {
                      for (var c = [], d = 0, e = b.length; d < e; d += 1) {
                          var f = b[d],
                              g = new a.common.Rect(f.x, f.y, f.size, f.size);
                          if (null != f.points && 0 < f.quadrants.length) return !1;
                          if (null == f.points)
                              for (g = 0; 4 > g; g += 1) c.push(f.quadrants[g]);
                          else
                              for (var p = 0, q = f.points.length; p < q; p += 1)
                                  if (!g.contains(f.points[p])) return !1
                      }
                      b = c
                  }
                  return !0
              },
              getPositions: function(b) {
                  for (var c = [], d = [h]; 0 < d.length;) {
                      for (var e = [], f = 0, g = d.length; f < g; f += 1) {
                          var p = d[f],
                              q = new a.common.Rect(p.x, p.y, p.size, p.size);
                          q.context = {
                              isHighlighted: !1
                          };
                          null != b && (b.overlaps(q) && null != p.points && 0 < p.points.length) && (q.context.isHighlighted = !0);
                          c.push(q);
                          for (q = 0; 4 > q; q += 1) {
                              var r = p.quadrants[q];
                              null != r && e.push(r)
                          }
                      }
                      d = e
                  }
                  return c
              }
          }
      };
      a.common.RMQ = function(a) {
          function b(b, e) {
              var h = Math.floor(Math.log(e - b + 1) / c);
              return a[d[b][h]] <= a[d[e - (1 << h) + 1][h]] ? d[b][h] : d[e - (1 << h) + 1][h]
          }
          for (var d = [], c = Math.log(2), e, g = 0, h = a.length; g < h; g += 1) d[g] = [g];
          e = 1;
          for (h = a.length; 1 << e < h; e += 1)
              for (g = 0; g + (1 << e) - 1 < h; g += 1) d[g][e] = a[d[g][e - 1]] < a[d[g + (1 << e - 1)][e - 1]] ? d[g][e - 1] : d[g + (1 << e - 1)][e - 1];
          return {
              getRangeMinimumIndex: b,
              getRangeMinimum: function(c, d) {
                  return a[b(c, d)]
              }
          }
      };
      a.common.SortedList = function() {
          function a(b, c) {
              this.value = b;
              this.context = c;
              this.right = this.left =
                  null;
              this.balance = 0
          }
  
          function b(a) {
              var b;
              if (2 == a.balance) {
                  var e = a.right;
                  b = e.balance;
                  if (0 <= b) d(e, a), 1 == e.balance ? (a.balance = 0, e.balance = 0) : (a.balance = -1, e.balance = 1);
                  else {
                      var f = e.left;
                      c(f, e);
                      d(e, a);
                      a.balance = 0;
                      switch (f.balance) {
                          case 1:
                              e.balance = -1;
                              f.balance = 0;
                              break;
                          case 0:
                              f.balance = 0;
                              e.balance = 0;
                              break;
                          default:
                              f.balance = 1, e.balance = 0
                      }
                  }
              } else if (-2 == a.balance)
                  if (b = a.left.balance, 0 >= b) e = a.left, c(e, a), -1 == e.balance ? (a.balance = 0, e.balance = 0) : (a.balance = 1, e.balance = -1);
                  else switch (e = a.left, f = e.right, d(f, e),
                      c(e, a), a.balance = 0, f.balance) {
                      case -1:
                          f.balance = 0;
                          e.balance = 1;
                          break;
                      case 0:
                          f.balance = 0;
                          e.balance = 0;
                          break;
                      default:
                          f.balance = -1, e.balance = 0
                  }
              return b
          }
  
          function d(a, b) {
              g(a, b);
              b.right = a.right;
              a.right = a.left;
              a.left = b.left;
              b.left = a
          }
  
          function c(a, b) {
              g(a, b);
              b.left = a.left;
              a.left = a.right;
              a.right = b.right;
              b.right = a
          }
  
          function e(a, b) {
              var c = null != a.right ? a.right : a.left;
              null != b ? b.value > a.value ? b.left = c : b.right = c : k = c
          }
  
          function g(a, b) {
              var c = a.value;
              a.value = b.value;
              b.value = c;
              c = a.context;
              a.context = b.context;
              b.context = c
          }
  
          function h(a,
              b, c) {
              if (null != c) {
                  for (var d = [], e = null, e = k; null != e;) e.value >= b || null == b ? (d.push(e), e = e.left) : e = e.right;
                  for (; null != (e = d.pop()) && !c.call(a, e.value, e.context);)
                      for (e = e.right; null != e;)
                          if (null != e.left) d.push(e), e = e.left;
                          else {
                              if (c.call(a, e.value, e.context)) return;
                              e = e.right
                          }
              }
          }
  
          function i(a, b, c) {
              if (null != c) {
                  for (var d = [], e = null, e = k; null != e;) e.value <= b || null == b ? (d.push(e), e = e.right) : e = e.left;
                  for (; null != (e = d.pop()) && !c.call(a, e.value, e.context);)
                      for (e = e.left; null != e;)
                          if (null != e.right) d.push(e), e = e.right;
                          else {
                              if (c.call(a,
                                      e.value, e.context)) return;
                              e = e.left
                          }
              }
          }
  
          function j(a) {
              var b = [],
                  c = 0;
              if (null != a)
                  for (b.push(a); 0 < b.length;) {
                      for (var d = [], e = 0; e < b.length; e += 1) a = b[e], null != a.left && d.push(a.left), null != a.right && d.push(a.right);
                      b = d;
                      c += 1
                  }
              return c
          }
          var k = null;
          return {
              add: function(c, d, e, h) {
                  if (null == k) k = new a(c, d);
                  else {
                      for (var g = [], i = null, j = k; null != j;)
                          if (null != i && g.push(i), i = j, i.value == c)
                              if (null != h) h.call(e, i.context);
                              else throw "Structure does not support duplicates.";
                      else j = i.value > c ? i.left : i.right;
                      g.push(i);
                      d = new a(c, d);
                      i.value >
                          c ? i.left = d : i.right = d;
                      for (i = d; null != (j = g.pop());) {
                          if (i.value < j.value)
                              if (0 > j.balance) {
                                  j.balance -= 1;
                                  b(j);
                                  break
                              } else {
                                  if (0 < j.balance) {
                                      j.balance -= 1;
                                      break
                                  }
                                  j.balance -= 1
                              }
                          else if (0 < j.balance) {
                              j.balance += 1;
                              b(j);
                              break
                          } else {
                              if (0 > j.balance) {
                                  j.balance += 1;
                                  break
                              }
                              j.balance += 1
                          }
                          i = j
                      }
                  }
              },
              remove: function(a) {
                  for (var c = [], d = k; null != d;)
                      if (d.value == a) {
                          if (null != d.right && null != d.left) {
                              c.push(d);
                              for (a = d.right; null != a.left;) c.push(a), a = a.left;
                              var f = a;
                              d.value = f.value;
                              d.context = f.context;
                              e(a, c[c.length - 1]);
                              c.push(a)
                          } else e(d, c[c.length -
                              1]), c.push(d);
                          for (a = c.length - 2; 0 <= a; a -= 1)
                              if (f = c[a], d = c[a + 1], f.value > d.value)
                                  if (0 < f.balance) {
                                      if (f.balance += 1, 0 === b(f)) break
                                  } else {
                                      if (0 === f.balance) {
                                          f.balance += 1;
                                          break
                                      }
                                      f.balance += 1
                                  }
                          else if (0 > f.balance) {
                              if (f.balance -= 1, 0 === b(f)) break
                          } else {
                              if (0 === f.balance) {
                                  f.balance -= 1;
                                  break
                              }
                              f.balance -= 1
                          }
                          break
                      } else c.push(d), d = d.value > a ? d.left : d.right
              },
              loopForward: h,
              loopBackward: i,
              nextContext: function(a) {
                  var b = null;
                  h(this, a, function(a, c) {
                      b = c;
                      return !0
                  });
                  return b
              },
              previousContext: function(a) {
                  var b = null;
                  i(this, a, function(a,
                      c) {
                      b = c;
                      return !0
                  });
                  return b
              },
              validate: function() {
                  if (null != k)
                      for (var a = [k]; 0 < a.length;) {
                          for (var b = [], c = 0; c < a.length; c += 1) {
                              var d = a[c];
                              if (null == d.value || null != d.left && (b.push(d.left), d.left.value >= d.value) || null != d.right && (b.push(d.right), d.right.value <= d.value)) return !1;
                              if (d.balance != j(d.right) - j(d.left)) return console.log("Disbalanced node: " + d.value + " - " + JSON.stringify(k)), !1
                          }
                          a = b
                      }
                  return !0
              }
          }
      };
      a.common.SpatialIndex = function(f) {
          function b(b, c) {
              this.minimum = b;
              this.maximum = c;
              this.quadTree = a.common.QuadTree(2 *
                  c)
          }
          var d = [];
          f.sort(function(a, b) {
              return a - b
          });
          switch (f.length) {
              case 0:
                  d.push(new b(0, 1E6));
                  break;
              case 1:
                  var c = f[0];
                  d.push(new b(0, c));
                  break;
              case 2:
                  c = f[0];
                  f = f[1];
                  f > 2 * c ? (d.push(new b(0, c)), d.push(new b(c, f))) : d.push(new b(0, f));
                  break;
              default:
                  for (var c = a.common.getLiniarBreaks(f), e = 0, g = 0; g < c.length; g += 1) {
                      var h = f[c[g]];
                      d.push(new b(e, h));
                      e = h
                  }
          }
          return {
              addRect: function(a) {
                  for (var b = Math.max(a.width, a.height), c = a.centerPoint(), e = 0, f = d.length; e < f; e += 1) {
                      var h = d[e];
                      if (b <= h.maximum || e == f - 1) {
                          c.context = a;
                          h.quadTree.addPoint(c);
                          break
                      }
                  }
              },
              loopArea: function(b, c, e) {
                  if (null != e)
                      for (var f = 0, h = d.length; f < h; f += 1) {
                          var g = d[f],
                              p = new a.common.Rect(c);
                          p.offset(g.maximum / 2);
                          g.quadTree.loopArea(this, p, function(a) {
                              a = a.context;
                              if (c.overlaps(a)) return e.call(b, a)
                          })
                      }
              },
              validate: function() {
                  for (var a = !0, b = 0, c = d.length; b < c; b += 1) var e = d[b],
                      a = a && e.quadTree.validate();
                  return a
              },
              getPositions: function(a) {
                  for (var b = [], c = 0, e = d.length; c < e; c += 1) b = b.concat(d[c].quadTree.getPositions(a));
                  return b
              }
          }
      };
      a.common.tree = function(f) {
          function b(a, b, c) {
              var d, e, f;
              if (null !=
                  g[b] && (b = i[b], null != b)) {
                  e = 0;
                  for (f = b.length; e < f && !(d = b[e], c.call(a, d, g[d], e, f - 1)); e += 1);
              }
          }
  
          function d(a) {
              var b = null;
              null != h[a] && (b = h[a]);
              return b
          }
  
          function c(a, b) {
              var c, d = a.length;
              for (c = 0; c < d; c += 1)
                  if (a[c] == b) return a.splice(c, 1), d - 1;
              return d
          }
  
          function e(a, c, e) {
              if (null != e && g.hasOwnProperty(c)) {
                  var f = d(c);
                  null != f && e.call(a, f, g[f]) || (b(a, f, function(b, d) {
                      b != c && e.call(a, b, d)
                  }), b(a, c, function(b, c) {
                      e.call(a, b, c)
                  }))
              }
          }
          var g = {},
              h = {},
              i = {},
              j = {},
              k = {};
          a.common.isObject(f) && (g = a.common.cloneObject(f.nodes, !0), h = a.common.cloneObject(f.parents, !0), i = a.common.cloneObject(f.children, !1), j = a.common.cloneObject(f.roots, !1), k = a.common.cloneObject(f.rootChildren, !0));
          return {
              loop: function(a, b) {
                  var c;
                  if (null != b)
                      for (c in g)
                          if (g.hasOwnProperty(c) && b.call(a, c, g[c])) break
              },
              loopLevels: function(a, b, c) {
                  var d = 0,
                      e = [],
                      f, h, j, v, u;
                  switch (arguments.length) {
                      case 2:
                          h = b;
                          break;
                      case 3:
                          f = b, h = c
                  }
                  if (null != h) {
                      if (null == f)
                          for (j in k) k.hasOwnProperty(j) && (e = e.concat(k[j]));
                      else null != i[f] && (e = e.concat(i[f]));
                      for (; 0 < e.length;) {
                          j = [];
                          v = 0;
                          for (u = e.length; v < u; v += 1) switch (f = e[v],
                              h.call(a, f, g[f], d)) {
                              case 1:
                                  j = [];
                                  break;
                              case 2:
                                  break;
                              default:
                                  null != i[f] && (j = j.concat(i[f]))
                          }
                          e = j;
                          d += 1
                      }
                  }
              },
              loopParents: function(a, b, c, d) {
                  if (null != g[b] && null != c && !(!0 === d && c.call(a, b, g[b])))
                      for (; null != (b = h[b]) && !c.call(a, b, g[b]););
              },
              loopChildren: b,
              loopChildrenRange: function(a, b, c, d, e) {
                  var f;
                  if (null != g[b] && (b = i[b], null != b))
                      if (c < d) {
                          c = Math.max(c, 0);
                          d = Math.min(d, b.length - 1);
                          for (f = c; f <= d && !(c = b[f], e.call(a, c, g[c], f, NaN)); f += 1);
                      } else {
                          c = Math.min(c, b.length - 1);
                          d = Math.max(0, d);
                          for (f = c; f >= d && !(c = b[f], e.call(a, c,
                                  g[c], f, NaN)); f -= 1);
                      }
              },
              loopChildrenReversed: function(a, b, c) {
                  var d, e, f;
                  if (null != g[b] && (b = i[b], f = b.length - 1, null != b))
                      for (e = f; 0 <= e && !(d = b[e], c.call(a, d, g[d], e, f)); e -= 1);
              },
              loopPostOrder: function(a, b) {
                  var c = [],
                      d, e, f;
                  if (null != b) {
                      for (d in k) k.hasOwnProperty(d) && (c = c.concat(k[d]));
                      for (; 0 < c.length;)
                          if (d = c[c.length - 1], d != e && null != (f = i[d]))
                              for (d = f.length - 1; 0 <= d; d -= 1) c.push(f[d]);
                          else if (c.pop(), e = h[d], b.call(a, d, g[d], e, g[e])) break
                  }
              },
              loopPreOrder: function(a, b) {
                  var c = [],
                      d, e, f, j;
                  if (null != b) {
                      for (d in k) k.hasOwnProperty(d) &&
                          (c = c.concat(k[d]));
                      for (; 0 < c.length;) {
                          d = c[c.length - 1];
                          if (d != f && (e = h[d], b.call(a, d, g[d], e, g[e]))) break;
                          if (d != f && null != (j = i[d]))
                              for (d = j.length - 1; 0 <= d; d -= 1) c.push(j[d]);
                          else c.pop(), f = h[d]
                      }
                  }
              },
              loopEulerWalk: function(a, b) {
                  var c = [],
                      d, e = [],
                      f = 0,
                      j, t, v;
                  if (null != b) {
                      for (d in k)
                          if (k.hasOwnProperty(d)) {
                              v = k[d];
                              j = 0;
                              for (f = v.length; j < f; j += 1) c.push(v[j]), e.push(0)
                          }
                      for (; 0 < c.length;) {
                          j = c.length - 1;
                          d = c[j];
                          f = e[j];
                          if (b.call(a, d, g[d], f)) break;
                          if (d != t && null != (v = i[d]))
                              for (j = v.length - 1; 0 <= j; j -= 1) c.push(v[j]), e.push(f + 1), 0 < j &&
                                  (c.push(d), e.push(f));
                          else c.pop(), e.pop(), t = h[d]
                      }
                  }
              },
              loopNeighbours: function(a, b, c, d) {
                  var f = {},
                      h = [b],
                      i, j = 0;
                  if (null != d && g.hasOwnProperty(b))
                      for (f[b] = !0; 0 < h.length;) {
                          i = [];
                          for (var b = 0, k = h.length; b < k; b += 1) {
                              var u = h[b];
                              if (0 < j && d.call(a, u, g[u], j)) return;
                              j < c && e(this, u, function(a) {
                                  f.hasOwnProperty(a) || (i.push(a), f[a] = !0)
                              })
                          }
                          h = i;
                          j += 1
                      }
              },
              zipUp: function(a, b, c, d) {
                  var e, f;
                  if (null != d)
                      for (; null != b && null != c && b != c;) {
                          e = h[b];
                          f = h[c];
                          if (d.call(a, b, e, c, f)) break;
                          b = e;
                          c = f
                      }
              },
              parentid: d,
              parent: function(a) {
                  var b = null;
                  null != h[a] &&
                      (b = g[h[a]]);
                  return b
              },
              adopt: function(a, b) {
                  if (null != g[a] && null != g[b])
                      if (a != b) j.hasOwnProperty(b) && (c(k[j[b]], b) || delete k[j[b]], delete j[b]), h.hasOwnProperty(b) && (c(i[h[b]], b) || delete i[h[b]]), h[b] = a, null != i[a] ? i[a].push(b) : i[a] = [b];
                      else throw "Item cannot be parent of itself!";
                  else throw "Both parent and child should be in hierarchy!";
              },
              moveChildren: function(a, c) {
                  null != g[a] && (null != g[c] && a != c) && null != i[a] && (b(this, a, function(a) {
                      h[a] = c
                  }), i[c] = null != i[c] ? i[c].concat(i[a]) : i[a], delete i[a])
              },
              node: function(a) {
                  return g[a]
              },
              add: function(a, b, c, d) {
                  var e;
                  if (null != g[b]) throw "Node already exists";
                  if (null != b && (null != c && null == g[b]) && (null != g[a] ? (h[b] = a, null != i[a] ? null == d ? i[a].push(b) : i[a].splice(d, 0, b) : i[a] = [b]) : (j[b] = a, null != k[a] ? null == d ? k[a].push(b) : k[a].splice(d, 0, b) : k[a] = [b]), g[b] = c, null != k[b])) {
                      i[b] = k[b];
                      delete k[b];
                      d = i[b];
                      a = 0;
                      for (c = d.length; a < c; a += 1) e = d[a], delete j[e], h[e] = b
                  }
              },
              insert: function(a, c, d) {
                  null != g[a] && (null != c && null == g[c] && null != d) && (g[c] = d, null != i[a] && (i[c] = i[a]), i[a] = [c], b(this, c, function(a) {
                          h[a] = c
                      }), h[c] =
                      a)
              },
              hasNodes: function() {
                  return !a.common.isEmptyObject(k)
              },
              hasChildren: function(a) {
                  return null != i[a]
              },
              countChildren: function(a) {
                  return null != i[a] ? i[a].length : 0
              },
              countSiblings: function(a) {
                  a = d(a);
                  return null != a ? i[a].length : 0
              },
              indexOf: function(b) {
                  var c = d(b);
                  return null != c ? a.common.indexOf(i[c], b) : null
              },
              getChild: function(a, b) {
                  var c = null,
                      d;
                  if (null != (d = i[a])) c = g[d[b]];
                  return c
              },
              arrangeChildren: function(a, b) {
                  var c, d, e, b = b.slice(0);
                  if (null != g[a])
                      if (null != i[a])
                          if (i[a].length == b.length) {
                              d = 0;
                              for (e = b.length; d <
                                  e; d += 1)
                                  if (c = b[d], h[c] != a) throw "Child " + c + " does not belong to given node!";
                              i[a] = b
                          } else throw "Collections of children don't match each other!";
                  else if (0 < b.length) throw "Collections of children don't match each other!";
              },
              validate: function() {
                  var a = !0,
                      b;
                  for (b in j)
                      if (j.hasOwnProperty(b) && null != j[b]) {
                          a = !1;
                          break
                      }
                  return a
              },
              clone: function() {
                  return a.common.family({
                      nodes: g,
                      parents: h,
                      children: i,
                      roots: j,
                      rootChildren: k
                  })
              },
              BREAK: 1,
              SKIP: 2
          }
      };
      a.common.TreeLevels = function(f) {
          function b(a) {
              this.context = a;
              this.items = []
          }
  
          function d(a, b, c) {
              this.context = a;
              this.positions = {};
              this.positions[c] = b;
              this.endLevel = this.startLevel = c
          }
  
          function c(a) {
              null == e[a] && (e[a] = new b(null), h = null === h ? a : Math.min(h, a), i = null === i ? a : Math.max(i, a));
              return e[a]
          }
          var e = [],
              g = {},
              h = null,
              i = null;
          a.common.isObject(f) && (e = a.common.cloneObject(f.levels, !0), g = a.common.cloneObject(f.items, !0), h = a.common.cloneObject(f.minimum, !0), i = a.common.cloneObject(f.maximum, !0));
          return {
              addlevel: function(a, b) {
                  c(a).context = b
              },
              hasLevel: function(a) {
                  return null != e[a]
              },
              hasItem: function(a) {
                  return g.hasOwnProperty(a)
              },
              addItem: function(a, b, e) {
                  var f;
                  g.hasOwnProperty(b) ? (f = c(a), f.items.push(b), b = g[b], b.positions[a] = f.items.length - 1, b.startLevel = Math.min(b.startLevel, a), b.endLevel = Math.max(b.endLevel, a)) : (f = c(a), f.items.push(b), g[b] = new d(e, f.items.length - 1, a))
              },
              getItemContext: function(a) {
                  var b = null;
                  g.hasOwnProperty(a) && (b = g[a].context);
                  return b
              },
              getLevelIndex: function(a) {
                  return g.hasOwnProperty(a) ? g[a].startLevel : null
              },
              getEndLevelIndex: function(a) {
                  return g.hasOwnProperty(a) ? g[a].endLevel : null
              },
              getItemPosition: function(a,
                  b) {
                  var c = g[a];
                  return null != c ? null != b ? c.positions[b] : c.positions[c.startLevel] : null
              },
              getItemAtPosition: function(a, b) {
                  var c = e[a],
                      d = null;
                  null != c && (d = c.items[b]);
                  return d
              },
              loopLevels: function(a, b) {
                  var c, d;
                  if (null != b)
                      for (c = h; c <= i && !(d = e[c], null != d && b.call(a, c, d.context)); c += 1);
              },
              loopLevelsReversed: function(a, b) {
                  var c, d;
                  if (null != b)
                      for (c = i; c >= h && !(d = e[c], null != d && b.call(a, c, d.context)); c -= 1);
              },
              loopLevelItems: function(a, b, c) {
                  var d, f, h;
                  if (null != c && (f = e[b], null != f)) {
                      b = 0;
                      for (d = f.items.length; b < d && !(h = f.items[b],
                              c.call(a, h, g[h].context, b)); b += 1);
                  }
              },
              getLevelLength: function(a) {
                  var b = 0,
                      a = e[a];
                  null != a && (b = a.items.length);
                  return b
              },
              loopItems: function(a, b) {
                  var c, d, f, p, q, r, s = {};
                  if (null != b)
                      for (p = h; p <= i; p += 1)
                          if (f = e[p], null != f) {
                              q = f.items;
                              c = 0;
                              for (d = q.length; c < d; c += 1)
                                  if (r = q[c], !s.hasOwnProperty(r) && (s[r] = !0, b.call(a, r, g[r].context, c, p, f.context))) return
                          }
              },
              binarySearch: function(b, c, d) {
                  var f = null;
                  null != d && (c = e[c], null != c && (f = a.common.binarySearch(c.items, function(a) {
                      return d.call(b, a, g[a].context)
                  })));
                  return f.item
              },
              loopMerged: function(b,
                  c, d) {
                  var f, h, i, q = [];
                  f = 0;
                  for (h = e.length; f < h; f += 1) i = e[f], null != i && q.push(i.items);
                  i = a.common.mergeSort(q, c, !0);
                  if (null != d) {
                      f = 0;
                      for (h = i.length; f < h && !(c = i[f], d.call(b, c, g[c].context)); f += 1);
                  }
              },
              loopFromItem: function(a, b, c, d, f) {
                  var h;
                  if (g.hasOwnProperty(b) && (b = g[b], h = f || b.startLevel, f = e[h].items, b = b.positions[h], null != d))
                      if (c)
                          for (c = b - 1; 0 <= c && !(h = f[c], d.call(a, h, g[h].context)); c -= 1);
                      else {
                          c = b + 1;
                          for (b = f.length; c < b && !(h = f[c], d.call(a, h, g[h].context)); c += 1);
                      }
              },
              loopLevelsFromItem: function(a, b, c, d) {
                  if (g.hasOwnProperty(b) &&
                      (b = g[b], null != d))
                      if (c)
                          for (c = b.endLevel + 1; c <= i && !(b = e[c], d.call(a, c, null != b ? b.context : null)); c += 1);
                      else
                          for (c = b.startLevel - 1; c >= h && !(b = e[c], d.call(a, c, null != b ? b.context : null)); c -= 1);
              },
              getPrevItem: function(a, b) {
                  var c = null;
                  g.hasOwnProperty(a) && (c = g[a], b = b || c.startLevel, c = e[b].items[c.positions[b] - 1]);
                  return c
              },
              getNextItem: function(a, b) {
                  var c = null;
                  g.hasOwnProperty(a) && (c = g[a], b = b || c.startLevel, c = e[b].items[c.positions[b] + 1]);
                  return c
              },
              length: function() {
                  return e.length
              },
              isEmpty: function() {
                  return !e.length
              },
              clone: function() {
                  return a.common.TreeLevels({
                      levels: e,
                      items: g,
                      minimum: h,
                      maximum: i
                  })
              }
          }
      };
      a.common.DependencyManager = function() {
          var a = {};
          return {
              register: function(b, d) {
                  return a[b] = d
              },
              resolve: function(b, d, c) {
                  var e = [],
                      g = c || {};
                  return function() {
                      for (var c = Array.prototype.slice.call(arguments, 0), i = 0; i < b.length; i += 1) {
                          var j = b[i];
                          e.push(a.hasOwnProperty(j) && "" !== j ? a[j] : c.shift())
                      }
                      e = e.concat(c);
                      return d.apply(g || {}, e)
                  }
              }
          }
      };
      a.common.KeyboardNavigationManager = function() {
          function f(a, b) {
              this.itemid = a;
              this.row = b
          }
  
          function b() {
              if (null ==
                  h) {
                  var b = 0;
                  g = a.common.SortedList();
                  a.common.getMinimumCrossingRows(this, e, function(a) {
                      g.add(a, b);
                      b += 1
                  });
                  h = a.common.TreeLevels();
                  e.sort(function(a, b) {
                      return a.horizontalCenter() - b.horizontalCenter()
                  });
                  for (var c = 0, d = e.length; c < d; c += 1) {
                      var f = e[c];
                      g.loopForward(this, f.y, function(a, b) {
                          if (a > f.bottom()) return !0;
                          h.addItem(b, f.context, f)
                      })
                  }
              }
          }
  
          function d(a) {
              b();
              if (null == i || i.itemid != a) i = new f(a, h.getLevelIndex(a));
              return i
          }
  
          function c(a) {
              var b = h.getItemContext(i.itemid).horizontalCenter(),
                  c = i.itemid;
              h.loopLevelsFromItem(this,
                  i.itemid, a,
                  function(a) {
                      i.row = a;
                      i.itemid = h.binarySearch(this, a, function(a, c) {
                          return b - c.horizontalCenter()
                      });
                      return !0
                  });
              c == i.itemid && (i.row = a ? h.getEndLevelIndex(i.itemid) : h.getLevelIndex(i.itemid))
          }
          var e = [],
              g, h, i = null;
          return {
              addRect: function(b, c) {
                  var d = new a.common.Rect(b);
                  d.context = c;
                  e.push(d)
              },
              prepair: b,
              getItemAbove: function(a) {
                  i = d(a);
                  c(!1);
                  return i.itemid
              },
              getItemBelow: function(a) {
                  i = d(a);
                  c(!0);
                  return i.itemid
              },
              getItemOnLeft: function(a) {
                  i = d(a);
                  a = h.getPrevItem(i.itemid, i.row);
                  null != a && (i.itemid = a);
                  return i.itemid
              },
              getItemOnRight: function(a) {
                  i = d(a);
                  a = h.getNextItem(i.itemid, i.row);
                  null != a && (i.itemid = a);
                  return i.itemid
              },
              getNavigationLevels: function() {
                  b();
                  var a = [];
                  h.loopLevels(this, function(b) {
                      var c = [];
                      h.loopLevelItems(this, b, function(a) {
                          c.push(a)
                      });
                      a.push(c)
                  });
                  return a
              }
          }
      };
      a.common.TaskManager = function() {
          function f(a, b, c, d) {
              this.name = a;
              this.dependencies = b;
              this.factory = c;
              this.task = null;
              this.color = d
          }
          var b = new a.common.family,
              d = new a.common.DependencyManager,
              c = [];
          return {
              addTask: function(a, d, h, i) {
                  if (0 <
                      c.length) throw "Task Manager is already initialized";
                  b.add(d, a, new f(a, d, h, i))
              },
              addDependency: function(a, b) {
                  if (0 < c.length) throw "Task Manager is already initialized";
                  d.register(a, b)
              },
              getTask: function(a) {
                  return (a = b.node(a)) && a.task
              },
              process: function(a, f, h) {
                  var i = !1;
                  0 === c.length && b.loopTopo(this, function(a, b) {
                      b.task = d.register(a, d.resolve(b.dependencies, b.factory)());
                      c.push(b)
                  });
                  h && console.log("-- process --");
                  for (var j = {}, k = 0, l = c.length; k < l; k += 1) {
                      var n = c[k],
                          m = [];
                      if (n.name == a || j.hasOwnProperty(n.name)) {
                          if (h) var p =
                              performance.now();
                          (i = n.task.process(h)) && b.loopChildren(this, n.name, function(a) {
                              j[a] = !0;
                              h && m.push(a);
                              return b.SKIP
                          });
                          if (h) var q = performance.now();
                          if (h) {
                              var r = Math.round(q - p, 2);
                              console.log(k + ". " + n.name + (", " + r + " ms. ") + (i ? " - forces: " + m.toString() : ""))
                          }
                      }
                      if (n.name == f) break
                  }
              },
              getProcessDiagramConfig: function() {
                  var e = new a.famdiagram.Config;
                  0 === c.length && b.loopTopo(this, function(a, b) {
                      b.task = d.register(a, d.resolve(b.dependencies, b.factory)());
                      c.push(b)
                  });
                  for (var f = 0, h = c.length; f < h; f += 1) {
                      var i = c[f],
                          j =
                          new a.famdiagram.ItemConfig;
                      j.id = i.name;
                      j.title = a.common.splitCamelCaseName(i.name).join(" ");
                      j.description = i.task.description || "";
                      j.itemTitleColor = i.color;
                      j.parents = [];
                      b.loopParents(this, i.name, function(a) {
                          j.parents.push(a);
                          return b.SKIP
                      });
                      e.items.push(j)
                  }
                  return e
              }
          }
      };
      a.pdf.graphics = function(f) {
          this._context = this._doc = f;
          this._dummyPlaceholder = new a.common.Placeholder
      };
      a.pdf.graphics.prototype.clean = function() {};
      a.pdf.graphics.prototype.resize = function() {};
      a.pdf.graphics.prototype.begin = function() {};
      a.pdf.graphics.prototype.end = function() {};
      a.pdf.graphics.prototype.reset = function() {};
      a.pdf.graphics.prototype.activate = function() {
          return this._dummyPlaceholder
      };
      a.pdf.graphics.prototype.text = function() {};
      a.pdf.graphics.prototype.polylinesBuffer = function(a) {
          a.loop(this, function(a) {
              0 < a.length() && this.polyline(a)
          })
      };
      a.pdf.graphics.prototype.polyline = function(a) {
          var b = a.paletteItem.toAttr(),
              d, c = this._doc;
          c.save();
          a.loop(this, function(a) {
              switch (a.segmentType) {
                  case 1:
                      c.moveTo(Math.round(a.x) + 0.5, Math.round(a.y) +
                          0.5);
                      break;
                  case 0:
                      c.lineTo(Math.round(a.x) + 0.5, Math.round(a.y) + 0.5);
                      break;
                  case 4:
                      a.width == a.height && a.width / 2 <= a.cornerRadius ? c.roundedRect(Math.round(a.x) + 0.5, Math.round(a.y) + 0.5, a.width, a.height, Math.min(a.width, a.height) / 2) : 0 === a.cornerRadius ? (c.moveTo(Math.round(a.x) + 0.5, Math.round(a.y) + 0.5), c.lineTo(Math.round(a.x + a.width) + 0.5, Math.round(a.y) + 0.5), c.lineTo(Math.round(a.x + a.width) + 0.5, Math.round(a.y + a.height) + 0.5), c.lineTo(Math.round(a.x) + 0.5, Math.round(a.y + a.height) + 0.5), c.lineTo(Math.round(a.x) +
                          0.5, Math.round(a.y) + 0.5)) : (d = Math.min(a.cornerRadius, Math.min(a.width / 2, a.height / 2)), c.roundedRect(Math.round(a.x) + 0.5, Math.round(a.y) + 0.5, a.width, a.height, d));
                      break;
                  case 2:
                      c.quadraticCurveTo(Math.round(a.cpX) + 0.5, Math.round(a.cpY) + 0.5, Math.round(a.x) + 0.5, Math.round(a.y) + 0.5);
                      break;
                  case 3:
                      c.bezierCurveTo(Math.round(a.cpX1) + 0.5, Math.round(a.cpY1) + 0.5, Math.round(a.cpX2) + 0.5, Math.round(a.cpY2) + 0.5, Math.round(a.x) + 0.5, Math.round(a.y) + 0.5)
              }
          });
          c.lineJoin("round");
          if (null != b.lineType) switch (a = Math.round(b.lineWidth) ||
              1, b.lineType) {
              case 1:
                  c.dash(a, 2 * a);
                  break;
              case 2:
                  c.dash(5 * a, 3 * a)
          }
          void 0 !== b.lineWidth && void 0 !== b.fillColor ? c.lineWidth(b.lineWidth).fillOpacity(b.opacity).fillAndStroke(b.fillColor, b.borderColor) : void 0 !== b.lineWidth ? c.lineWidth(b.lineWidth).stroke(b.borderColor) : void 0 !== b.fillColor && c.fillOpacity(b.opacity).fillColor(b.fillColor);
          c.restore()
      };
      a.pdf.graphics.prototype.rightAngleLine = function() {};
      a.pdf.graphics.prototype.template = function(f, b, d, c, e, g, h, i, j, k, l, n, m) {
          d = 0;
          null !== m && void 0 !== m.borderWidth &&
              (d = this.getPxSize(m.borderWidth));
          f = new a.common.Rect(f + e, b + g, h - d, i - d);
          null == n && (n = new a.common.RenderEventArgs);
          null !== l && l(this._doc, f, n)
      };
      a.pdf.graphics.prototype.getPxSize = function(a, b) {
          var d = a;
          "string" === typeof a && (d = 0 < a.indexOf("pt") ? 96 * parseInt(a, 10) / 72 : 0 < a.indexOf("%") ? parseFloat(a) / 100 * b : parseInt(a, 10));
          return d
      };
      a.pdf.famdiagram.Plugin = function(f) {
          function b() {
              return g.options
          }
  
          function d() {
              return g.graphics
          }
  
          function c() {
              var c = new a.common.TaskManager;
              c.addDependency("options", b);
              c.addDependency("graphics",
                  d);
              c.addDependency("defaultConfig", new a.famdiagram.Config);
              c.addDependency("defaultItemConfig", new a.famdiagram.ItemConfig);
              c.addDependency("defaultTemplateConfig", new a.famdiagram.TemplateConfig);
              c.addDependency("defaultButtonConfig", new a.famdiagram.ButtonConfig);
              c.addDependency("defaultPaletteItemConfig", new a.famdiagram.PaletteItemConfig);
              c.addDependency("defaultBackgroundAnnotationConfig", new a.famdiagram.BackgroundAnnotationConfig);
              c.addDependency("defaultConnectorAnnotationConfig", new a.famdiagram.ConnectorAnnotationConfig);
              c.addDependency("defaultHighlightPathAnnotationConfig", new a.famdiagram.HighlightPathAnnotationConfig);
              c.addDependency("defaultShapeAnnotationConfig", new a.famdiagram.ShapeAnnotationConfig);
              c.addDependency("defaultLabelAnnotationConfig", new a.famdiagram.LabelAnnotationConfig);
              c.addDependency("isFamilyChartMode", !0);
              c.addDependency("showElbowDots", !0);
              c.addDependency("null", null);
              c.addDependency("foreground", 2);
              c.addDependency("background", 1);
              c.addTask("OptionsTask", ["options"], a.famdiagram.OptionsTask,
                  "#000000");
              c.addTask("CalloutOptionTask", ["OptionsTask", "defaultConfig", "defaultItemConfig"], a.orgdiagram.CalloutOptionTask, "#000080");
              c.addTask("ConnectorsOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.ConnectorsOptionTask, "#000080");
              c.addTask("ItemsOptionTask", ["OptionsTask", "defaultItemConfig"], a.famdiagram.ItemsOptionTask, "#000080");
              c.addTask("SpousesOptionTask", ["OptionsTask", "defaultItemConfig"], a.famdiagram.SpousesOptionTask, "#000080");
              c.addTask("ItemsSizesOptionTask", ["OptionsTask",
                  "defaultConfig", "defaultItemConfig", "defaultButtonConfig"
              ], a.orgdiagram.ItemsSizesOptionTask, "#000080");
              c.addTask("TemplatesOptionTask", ["OptionsTask", "defaultConfig", "defaultButtonConfig", "defaultTemplateConfig"], a.orgdiagram.TemplatesOptionTask, "#000080");
              c.addTask("OrientationOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.OrientationOptionTask, "#000080");
              c.addTask("VisualTreeOptionTask", ["OptionsTask"], a.famdiagram.VisualTreeOptionTask, "#000080");
              c.addTask("HideGrandParentsConnectorsOptionTask", ["OptionsTask", "defaultConfig"], a.famdiagram.HideGrandParentsConnectorsOptionTask, "#000080");
              c.addTask("NormalizeOptionTask", ["OptionsTask", "defaultConfig"], a.famdiagram.NormalizeOptionTask, "#000080");
              c.addTask("OrderFamilyNodesOptionTask", ["OptionsTask", "defaultConfig", "defaultItemConfig"], a.famdiagram.OrderFamilyNodesOptionTask, "#000080");
              c.addTask("LinePaletteOptionTask", ["OptionsTask", "defaultPaletteItemConfig"], a.famdiagram.LinePaletteOptionTask, "#000080");
              c.addTask("CursorItemOptionTask", ["OptionsTask",
                  "defaultConfig"
              ], a.orgdiagram.CursorItemOptionTask, "#000080");
              c.addTask("HighlightItemOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.HighlightItemOptionTask, "#000080");
              c.addTask("SelectedItemsOptionTask", ["OptionsTask"], a.orgdiagram.SelectedItemsOptionTask, "#000080");
              c.addTask("SplitAnnotationsOptionTask", ["OptionsTask"], a.orgdiagram.SplitAnnotationsOptionTask, "#00ffff");
              c.addTask("ForegroundShapeAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultShapeAnnotationConfig", "foreground"],
                  a.orgdiagram.ShapeAnnotationOptionTask, "#000080");
              c.addTask("BackgroundShapeAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultShapeAnnotationConfig", "background"], a.orgdiagram.ShapeAnnotationOptionTask, "#000080");
              c.addTask("ForegroundHighlightPathAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultHighlightPathAnnotationConfig", "foreground"], a.orgdiagram.HighlightPathAnnotationOptionTask, "#000080");
              c.addTask("BackgroundHighlightPathAnnotationOptionTask", ["SplitAnnotationsOptionTask",
                  "defaultHighlightPathAnnotationConfig", "background"
              ], a.orgdiagram.HighlightPathAnnotationOptionTask, "#000080");
              c.addTask("ForegroundConnectorAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultConnectorAnnotationConfig", "foreground"], a.orgdiagram.ConnectorAnnotationOptionTask, "#000080");
              c.addTask("BackgroundConnectorAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultConnectorAnnotationConfig", "background"], a.orgdiagram.ConnectorAnnotationOptionTask, "#000080");
              c.addTask("BackgroundAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultBackgroundAnnotationConfig"], a.orgdiagram.BackgroundAnnotationOptionTask, "#000080");
              c.addTask("ScaleOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.ScaleOptionTask, "#000080");
              c.addTask("UserDefinedNodesOrderTask", ["OrderFamilyNodesOptionTask", "defaultItemConfig"], a.famdiagram.UserDefinedNodesOrderTask, "#ff0000");
              c.addTask("LogicalFamilyTask", ["ItemsOptionTask"], a.famdiagram.LogicalFamilyTask, "#00ffff");
              c.addTask("LabelAnnotationOptionTask", ["SplitAnnotationsOptionTask",
                  "LogicalFamilyTask", "defaultLabelAnnotationConfig"
              ], a.famdiagram.LabelAnnotationOptionTask, "#000080");
              c.addTask("LabelAnnotationTemplateOptionTask", ["LabelAnnotationOptionTask", "defaultLabelAnnotationConfig"], a.famdiagram.LabelAnnotationTemplateOptionTask, "#000080");
              c.addTask("LabelAnnotationPlacementOptionTask", ["LabelAnnotationOptionTask", "defaultLabelAnnotationConfig"], a.famdiagram.LabelAnnotationPlacementOptionTask, "#000080");
              c.addTask("CombinedContextsTask", ["ItemsOptionTask", "LabelAnnotationOptionTask"],
                  a.orgdiagram.CombinedContextsTask, "#00ffff");
              c.addTask("AddLabelAnnotationsTask", ["LabelAnnotationPlacementOptionTask", "LogicalFamilyTask"], a.famdiagram.AddLabelAnnotationsTask, "#ff0000");
              c.addTask("RemoveLoopsTask", ["ItemsOptionTask", "AddLabelAnnotationsTask"], a.famdiagram.RemoveLoopsTask, "#ff0000");
              c.addTask("AddSpousesTask", ["SpousesOptionTask", "RemoveLoopsTask"], a.famdiagram.AddSpousesTask, "#ff0000");
              c.addTask("HideGrandParentsConnectorsTask", ["HideGrandParentsConnectorsOptionTask", "AddSpousesTask"],
                  a.famdiagram.HideGrandParentsConnectorsTask, "#ff0000");
              c.addTask("NormalizeLogicalFamilyTask", ["NormalizeOptionTask", "HideGrandParentsConnectorsTask"], a.famdiagram.NormalizeLogicalFamilyTask, "#ff0000");
              c.addTask("OrderFamilyNodesTask", ["OrderFamilyNodesOptionTask", "UserDefinedNodesOrderTask", "NormalizeLogicalFamilyTask", "defaultItemConfig"], a.famdiagram.OrderFamilyNodesTask, "#ff0000");
              c.addTask("ReadTemplatesTask", ["TemplatesOptionTask"], a.pdf.orgdiagram.ReadTemplatesTask, "#00ffff");
              c.addTask("ItemTemplateParamsTask", ["ItemsSizesOptionTask", "CursorItemOptionTask", "ReadTemplatesTask"], a.orgdiagram.ItemTemplateParamsTask, "#00ffff");
              c.addTask("LabelAnnotationTemplateParamsTask", ["ItemsSizesOptionTask", "LabelAnnotationTemplateOptionTask", "ReadTemplatesTask"], a.famdiagram.LabelAnnotationTemplateParamsTask, "#00ffff");
              c.addTask("CombinedTemplateParamsTask", ["ItemTemplateParamsTask", "LabelAnnotationTemplateParamsTask"], a.famdiagram.CombinedTemplateParamsTask, "#00ffff");
              c.addTask("GroupTitleTemplateTask", ["TemplatesOptionTask"],
                  a.pdf.orgdiagram.GroupTitleTemplateTask, "#00ffff");
              c.addTask("CheckBoxTemplateTask", ["ItemsSizesOptionTask"], a.pdf.orgdiagram.CheckBoxTemplateTask, "#00ffff");
              c.addTask("ButtonsTemplateTask", ["ItemsSizesOptionTask"], a.pdf.orgdiagram.ButtonsTemplateTask, "#00ffff");
              c.addTask("AnnotationLabelTemplateTask", ["ItemsOptionTask"], a.pdf.orgdiagram.AnnotationLabelTemplateTask, "#00ffff");
              c.addTask("ConnectionsGraphTask", ["graphics", "CreateTransformTask", "ConnectorsOptionTask", "OrderFamilyNodesTask", "AlignDiagramTask"],
                  a.orgdiagram.ConnectionsGraphTask, "#00ffff");
              c.addTask("HighlightItemTask", ["HighlightItemOptionTask", "null"], a.orgdiagram.HighlightItemTask, "#00ffff");
              c.addTask("CursorItemTask", ["CursorItemOptionTask", "null"], a.orgdiagram.CursorItemTask, "#00ffff");
              c.addTask("SelectedItemsTask", ["SelectedItemsOptionTask"], a.orgdiagram.SelectedItemsTask, "#00ffff");
              c.addTask("CombinedNormalVisibilityItemsTask", ["OptionsTask"], a.pdf.orgdiagram.DummyCombinedNormalVisibilityItemsTask, "#00ffff");
              c.addTask("CurrentControlSizeTask", ["OptionsTask"], a.pdf.orgdiagram.DummyCurrentControlSizeTask, "#00ffff");
              c.addTask("ItemsPositionsTask", "CurrentControlSizeTask ScaleOptionTask OrientationOptionTask ItemsSizesOptionTask ConnectorsOptionTask OrderFamilyNodesOptionTask OrderFamilyNodesTask CombinedTemplateParamsTask CursorItemTask CombinedNormalVisibilityItemsTask".split(" "), a.famdiagram.ItemsPositionsTask, "#ff0000");
              c.addTask("AlignDiagramTask", "OrientationOptionTask ItemsSizesOptionTask VisualTreeOptionTask ScaleOptionTask CurrentControlSizeTask null ItemsPositionsTask isFamilyChartMode".split(" "),
                  a.orgdiagram.AlignDiagramTask, "#ff0000");
              c.addTask("CreateTransformTask", ["OrientationOptionTask", "AlignDiagramTask"], a.orgdiagram.CreateTransformTask, "#00ffff");
              c.addTask("PaletteManagerTask", ["ConnectorsOptionTask", "LinePaletteOptionTask"], a.orgdiagram.PaletteManagerTask, "#00ffff");
              c.addTask("DrawBackgroundAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask BackgroundAnnotationOptionTask AddLabelAnnotationsTask AlignDiagramTask".split(" "), a.orgdiagram.DrawBackgroundAnnotationTask,
                  "#008000");
              c.addTask("DrawBackgroundShapeAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask OrientationOptionTask BackgroundShapeAnnotationOptionTask AlignDiagramTask AnnotationLabelTemplateTask background DrawBackgroundAnnotationTask".split(" "), a.orgdiagram.DrawShapeAnnotationTask, "#008000");
              c.addTask("DrawBackgroundConnectorAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask OrientationOptionTask BackgroundConnectorAnnotationOptionTask AlignDiagramTask AnnotationLabelTemplateTask background DrawBackgroundShapeAnnotationTask".split(" "),
                  a.orgdiagram.DrawConnectorAnnotationTask, "#008000");
              c.addTask("DrawBackgroundHighlightPathAnnotationTask", "graphics ConnectorsOptionTask ForegroundHighlightPathAnnotationOptionTask ConnectionsGraphTask foreground DrawBackgroundConnectorAnnotationTask".split(" "), a.orgdiagram.DrawHighlightPathAnnotationTask, "#00ffff");
              c.addTask("DrawConnectorsTask", "graphics ConnectionsGraphTask ConnectorsOptionTask showElbowDots PaletteManagerTask DrawBackgroundHighlightPathAnnotationTask".split(" "), a.orgdiagram.DrawConnectorsTask,
                  "#008000");
              c.addTask("DrawForegroundHighlightPathAnnotationTask", "graphics ConnectorsOptionTask BackgroundHighlightPathAnnotationOptionTask ConnectionsGraphTask background DrawConnectorsTask".split(" "), a.orgdiagram.DrawHighlightPathAnnotationTask, "#00ffff");
              c.addTask("DrawTreeItemsTask", "graphics CreateTransformTask ApplyLayoutChangesTask null ItemsSizesOptionTask CombinedContextsTask AlignDiagramTask null CombinedTemplateParamsTask CursorItemTask SelectedItemsTask GroupTitleTemplateTask CheckBoxTemplateTask ButtonsTemplateTask DrawForegroundHighlightPathAnnotationTask".split(" "),
                  a.orgdiagram.DrawTreeItemsTask, "#008000");
              c.addTask("DrawCursorTask", "graphics CreateTransformTask ApplyLayoutChangesTask CombinedContextsTask AlignDiagramTask CombinedTemplateParamsTask CursorItemTask SelectedItemsTask DrawTreeItemsTask".split(" "), a.orgdiagram.DrawCursorTask, "#008000");
              c.addTask("DrawHighlightTask", "graphics CreateTransformTask ApplyLayoutChangesTask CombinedContextsTask AlignDiagramTask CombinedTemplateParamsTask HighlightItemTask CursorItemTask SelectedItemsTask DrawCursorTask".split(" "),
                  a.orgdiagram.DrawHighlightTask, "#008000");
              c.addTask("DrawForegroundShapeAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask OrientationOptionTask ForegroundShapeAnnotationOptionTask AlignDiagramTask AnnotationLabelTemplateTask foreground DrawHighlightTask".split(" "), a.orgdiagram.DrawShapeAnnotationTask, "#008000");
              c.addTask("DrawForegroundConnectorAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask OrientationOptionTask ForegroundConnectorAnnotationOptionTask AlignDiagramTask AnnotationLabelTemplateTask foreground DrawForegroundShapeAnnotationTask".split(" "),
                  a.orgdiagram.DrawConnectorAnnotationTask, "#008000");
              return c
          }
  
          function e() {
              g.options.hasButtons = 2;
              g.options.pageFitMode = 5;
              g.options.autoSizeMaximum = new a.common.Size(1E5, 1E5)
          }
          var g = {
              name: "famdiagram",
              doc: null,
              options: f,
              tasks: null,
              graphics: null
          };
          return {
              draw: function(f, i, j) {
                  g.doc = f;
                  g.tasks = c(b, d);
                  g.graphics = new a.pdf.graphics(g.doc);
                  g.graphics.debug = !1;
                  e();
                  g.doc.save();
                  g.doc.translate(i, j);
                  g.tasks.process("OptionsTask", null, !1);
                  g.doc.restore();
                  f = g.tasks.getTask("AlignDiagramTask");
                  return new a.common.Size(f.getContentSize())
              },
              getSize: function() {
                  g.tasks = c(b, d);
                  e();
                  g.tasks.process("OptionsTask", "AlignDiagramTask", !1);
                  var f = g.tasks.getTask("AlignDiagramTask");
                  return new a.common.Size(f.getContentSize())
              }
          }
      };
      a.pdf.Template = function(f, b) {
          this.cursorTemplate = this.dotHighlightTemplate = this.highlightTemplate = this.itemTemplate = this.templateConfig = null;
          null != b && (this.templateConfig = b, this.itemTemplate = a.common.isNullOrEmpty(b.itemTemplate) ? new a.pdf.ItemTemplate(f, b) : new a.pdf.UserTemplate(f, b, f.onItemRender), this.highlightTemplate =
              a.common.isNullOrEmpty(b.highlightTemplate) ? new a.pdf.HighlightTemplate(f, b) : new a.pdf.UserTemplate(f, b, f.onHighlightRender), this.dotHighlightTemplate = new a.pdf.DummyTemplate(f, b), this.cursorTemplate = a.common.isNullOrEmpty(b.cursorTemplate) ? new a.pdf.CursorTemplate(f, b) : new a.pdf.UserTemplate(f, b, f.onCursorRender))
      };
      a.pdf.orgdiagram.DummyCurrentControlSizeTask = function() {
          return {
              process: function() {
                  return !0
              },
              getScrollPanelSize: function() {
                  return new a.common.Size(800, 600)
              },
              getOptimalPanelSize: function() {
                  return new a.common.Size(775,
                      575)
              }
          }
      };
      a.pdf.orgdiagram.AnnotationLabelTemplateTask = function() {
          var f = null;
          return {
              process: function() {
                  return !1
              },
              getTemplate: function() {
                  null == f && (f = new a.pdf.AnnotationLabelTemplate);
                  return f
              }
          }
      };
      a.pdf.orgdiagram.ButtonsTemplateTask = function() {
          var f = null;
          return {
              process: function() {
                  return !1
              },
              getTemplate: function() {
                  null == f && (f = new a.pdf.DummyTemplate);
                  return f
              }
          }
      };
      a.pdf.orgdiagram.CheckBoxTemplateTask = function(f) {
          var b = null;
          return {
              process: function() {
                  b = null;
                  return !0
              },
              getTemplate: function() {
                  var d;
                  null == b &&
                      (d = f.getOptions(), b = new a.pdf.CheckBoxTemplate(d.selectCheckBoxLabel));
                  return b
              }
          }
      };
      a.pdf.orgdiagram.GroupTitleTemplateTask = function(f) {
          var b = null;
          return {
              process: function() {
                  b = null;
                  return !0
              },
              getTemplate: function() {
                  var d;
                  null == b && (d = f.getOptions(), b = new a.pdf.GroupTitleTemplate(d.itemTitleFirstFontColor, d.itemTitleSecondFontColor));
                  return b
              }
          }
      };
      a.pdf.orgdiagram.ReadTemplatesTask = function(f) {
          var b = {};
          return {
              process: function() {
                  var d, c, e, g = f.getOptions(),
                      h = g.templates;
                  b = {};
                  b.DefaultWidgetTemplate = new a.pdf.Template(g,
                      new a.orgdiagram.TemplateConfig);
                  d = new a.orgdiagram.TemplateConfig;
                  d.name = "DefaultWidgetLabelAnnotationTemplate";
                  d.isActive = !1;
                  d.itemSize = new a.common.Size(100, 20);
                  d.minimizedItemSize = new a.common.Size(0, 0);
                  c = new a.pdf.Template;
                  c.templateConfig = d;
                  c.minimizedItemCornerRadius = d.minimizedItemSize.width / 2;
                  c.itemTemplate = new a.pdf.LabelAnnotationTemplate;
                  c.dotHighlightTemplate = new a.pdf.DummyTemplate;
                  b.DefaultWidgetLabelAnnotationTemplate = c;
                  d = 0;
                  for (c = h.length; d < c; d += 1) e = h[d], b[e.name] = new a.pdf.Template(g,
                      e);
                  return !0
              },
              getTemplate: function(a, c, e) {
                  return b[a] || b[c] || b[e]
              },
              DefaultWidgetTemplateName: "DefaultWidgetTemplate",
              DefaultWidgetLabelAnnotationTemplateName: "DefaultWidgetLabelAnnotationTemplate"
          }
      };
      a.pdf.orgdiagram.DummyCombinedNormalVisibilityItemsTask = function() {
          return {
              process: function() {
                  return !0
              },
              isItemSelected: function() {
                  return !1
              }
          }
      };
      a.pdf.orgdiagram.Plugin = function(f) {
          function b() {
              return g.options
          }
  
          function d() {
              return g.graphics
          }
  
          function c() {
              var c = new a.common.TaskManager;
              c.addDependency("options",
                  b);
              c.addDependency("graphics", d);
              c.addDependency("defaultConfig", new a.orgdiagram.Config);
              c.addDependency("defaultItemConfig", new a.orgdiagram.ItemConfig);
              c.addDependency("defaultTemplateConfig", new a.orgdiagram.TemplateConfig);
              c.addDependency("defaultButtonConfig", new a.orgdiagram.ButtonConfig);
              c.addDependency("defaultBackgroundAnnotationConfig", new a.orgdiagram.BackgroundAnnotationConfig);
              c.addDependency("defaultConnectorAnnotationConfig", new a.orgdiagram.ConnectorAnnotationConfig);
              c.addDependency("defaultHighlightPathAnnotationConfig",
                  new a.orgdiagram.HighlightPathAnnotationConfig);
              c.addDependency("defaultShapeAnnotationConfig", new a.orgdiagram.ShapeAnnotationConfig);
              c.addDependency("isFamilyChartMode", !1);
              c.addDependency("showElbowDots", !1);
              c.addDependency("null", null);
              c.addDependency("foreground", 2);
              c.addDependency("background", 1);
              c.addTask("OptionsTask", ["options"], a.orgdiagram.OptionsTask, "#000000");
              c.addTask("CalloutOptionTask", ["OptionsTask", "defaultConfig", "defaultItemConfig"], a.orgdiagram.CalloutOptionTask, "#000080");
              c.addTask("ConnectorsOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.ConnectorsOptionTask, "#000080");
              c.addTask("ItemsOptionTask", ["OptionsTask", "defaultItemConfig"], a.orgdiagram.ItemsOptionTask, "#000080");
              c.addTask("ItemsSizesOptionTask", ["OptionsTask", "defaultConfig", "defaultItemConfig", "defaultButtonConfig"], a.orgdiagram.ItemsSizesOptionTask, "#000080");
              c.addTask("TemplatesOptionTask", ["OptionsTask", "defaultConfig", "defaultButtonConfig", "defaultTemplateConfig"], a.orgdiagram.TemplatesOptionTask, "#000080");
              c.addTask("OrientationOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.OrientationOptionTask, "#000080");
              c.addTask("VisualTreeOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.VisualTreeOptionTask, "#000080");
              c.addTask("CursorItemOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.CursorItemOptionTask, "#000080");
              c.addTask("HighlightItemOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.HighlightItemOptionTask, "#000080");
              c.addTask("SelectedItemsOptionTask", ["OptionsTask"], a.orgdiagram.SelectedItemsOptionTask,
                  "#000080");
              c.addTask("SplitAnnotationsOptionTask", ["OptionsTask"], a.orgdiagram.SplitAnnotationsOptionTask, "#00ffff");
              c.addTask("ForegroundShapeAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultShapeAnnotationConfig", "foreground"], a.orgdiagram.ShapeAnnotationOptionTask, "#000080");
              c.addTask("BackgroundShapeAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultShapeAnnotationConfig", "background"], a.orgdiagram.ShapeAnnotationOptionTask, "#000080");
              c.addTask("ForegroundHighlightPathAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultHighlightPathAnnotationConfig", "foreground"], a.orgdiagram.HighlightPathAnnotationOptionTask, "#000080");
              c.addTask("BackgroundHighlightPathAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultHighlightPathAnnotationConfig", "background"], a.orgdiagram.HighlightPathAnnotationOptionTask, "#000080");
              c.addTask("ForegroundConnectorAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultConnectorAnnotationConfig", "foreground"], a.orgdiagram.ConnectorAnnotationOptionTask,
                  "#000080");
              c.addTask("BackgroundConnectorAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultConnectorAnnotationConfig", "background"], a.orgdiagram.ConnectorAnnotationOptionTask, "#000080");
              c.addTask("BackgroundAnnotationOptionTask", ["SplitAnnotationsOptionTask", "defaultBackgroundAnnotationConfig"], a.orgdiagram.BackgroundAnnotationOptionTask, "#000080");
              c.addTask("ScaleOptionTask", ["OptionsTask", "defaultConfig"], a.orgdiagram.ScaleOptionTask, "#000080");
              c.addTask("CombinedContextsTask", ["ItemsOptionTask"],
                  a.orgdiagram.CombinedContextsTask, "#00ffff");
              c.addTask("OrgTreeTask", ["ItemsOptionTask"], a.orgdiagram.OrgTreeTask, "#ff0000");
              c.addTask("ReadTemplatesTask", ["TemplatesOptionTask"], a.pdf.orgdiagram.ReadTemplatesTask, "#00ffff");
              c.addTask("ItemTemplateParamsTask", ["ItemsSizesOptionTask", "CursorItemOptionTask", "ReadTemplatesTask"], a.orgdiagram.ItemTemplateParamsTask, "#00ffff");
              c.addTask("GroupTitleTemplateTask", ["TemplatesOptionTask"], a.pdf.orgdiagram.GroupTitleTemplateTask, "#00ffff");
              c.addTask("CheckBoxTemplateTask", ["ItemsSizesOptionTask"], a.pdf.orgdiagram.CheckBoxTemplateTask, "#00ffff");
              c.addTask("ButtonsTemplateTask", ["ItemsSizesOptionTask"], a.pdf.orgdiagram.ButtonsTemplateTask, "#00ffff");
              c.addTask("AnnotationLabelTemplateTask", ["ItemsOptionTask"], a.pdf.orgdiagram.AnnotationLabelTemplateTask, "#00ffff");
              c.addTask("VisualTreeTask", ["OrgTreeTask", "null", "VisualTreeOptionTask", "isFamilyChartMode"], a.orgdiagram.VisualTreeTask, "#ff0000");
              c.addTask("VisualTreeLevelsTask", ["VisualTreeTask", "ItemTemplateParamsTask"],
                  a.orgdiagram.VisualTreeLevelsTask, "#ff0000");
              c.addTask("ConnectionsGraphTask", ["graphics", "CreateTransformTask", "ConnectorsOptionTask", "VisualTreeLevelsTask", "AlignDiagramTask"], a.orgdiagram.ConnectionsGraphTask, "#00ffff");
              c.addTask("HighlightItemTask", ["HighlightItemOptionTask", "null"], a.orgdiagram.HighlightItemTask, "#00ffff");
              c.addTask("CursorItemTask", ["CursorItemOptionTask", "null"], a.orgdiagram.CursorItemTask, "#00ffff");
              c.addTask("SelectedItemsTask", ["SelectedItemsOptionTask"], a.orgdiagram.SelectedItemsTask,
                  "#00ffff");
              c.addTask("CombinedNormalVisibilityItemsTask", ["OptionsTask"], a.pdf.orgdiagram.DummyCombinedNormalVisibilityItemsTask, "#00ffff");
              c.addTask("CurrentControlSizeTask", ["OptionsTask"], a.pdf.orgdiagram.DummyCurrentControlSizeTask, "#00ffff");
              c.addTask("ItemsPositionsTask", "CurrentControlSizeTask ScaleOptionTask OrientationOptionTask ItemsSizesOptionTask ConnectorsOptionTask VisualTreeOptionTask VisualTreeTask VisualTreeLevelsTask ItemTemplateParamsTask CursorItemTask CombinedNormalVisibilityItemsTask".split(" "),
                  a.orgdiagram.ItemsPositionsTask, "#ff0000");
              c.addTask("AlignDiagramTask", "OrientationOptionTask ItemsSizesOptionTask VisualTreeOptionTask ScaleOptionTask CurrentControlSizeTask null ItemsPositionsTask isFamilyChartMode".split(" "), a.orgdiagram.AlignDiagramTask, "#ff0000");
              c.addTask("CreateTransformTask", ["OrientationOptionTask", "AlignDiagramTask"], a.orgdiagram.CreateTransformTask, "#00ffff");
              c.addTask("PaletteManagerTask", ["ConnectorsOptionTask", "null"], a.orgdiagram.PaletteManagerTask, "#00ffff");
              c.addTask("DrawBackgroundAnnotationTask",
                  "graphics CreateTransformTask ApplyLayoutChangesTask BackgroundAnnotationOptionTask VisualTreeTask AlignDiagramTask".split(" "), a.orgdiagram.DrawBackgroundAnnotationTask, "#008000");
              c.addTask("DrawBackgroundShapeAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask OrientationOptionTask BackgroundShapeAnnotationOptionTask AlignDiagramTask AnnotationLabelTemplateTask background DrawBackgroundAnnotationTask".split(" "), a.orgdiagram.DrawShapeAnnotationTask, "#008000");
              c.addTask("DrawBackgroundConnectorAnnotationTask",
                  "graphics CreateTransformTask ApplyLayoutChangesTask OrientationOptionTask BackgroundConnectorAnnotationOptionTask AlignDiagramTask AnnotationLabelTemplateTask background DrawBackgroundShapeAnnotationTask".split(" "), a.orgdiagram.DrawConnectorAnnotationTask, "#008000");
              c.addTask("DrawTreeItemsTask", "graphics CreateTransformTask ApplyLayoutChangesTask null ItemsSizesOptionTask CombinedContextsTask AlignDiagramTask null ItemTemplateParamsTask CursorItemTask SelectedItemsTask GroupTitleTemplateTask CheckBoxTemplateTask ButtonsTemplateTask DrawBackgroundConnectorAnnotationTask".split(" "),
                  a.orgdiagram.DrawTreeItemsTask, "#008000");
              c.addTask("DrawBackgroundHighlightPathAnnotationTask", "graphics ConnectorsOptionTask ForegroundHighlightPathAnnotationOptionTask ConnectionsGraphTask foreground DrawTreeItemsTask".split(" "), a.orgdiagram.DrawHighlightPathAnnotationTask, "#00ffff");
              c.addTask("DrawConnectorsTask", "graphics ConnectionsGraphTask ConnectorsOptionTask showElbowDots PaletteManagerTask DrawBackgroundHighlightPathAnnotationTask".split(" "), a.orgdiagram.DrawConnectorsTask, "#008000");
              c.addTask("DrawForegroundHighlightPathAnnotationTask", "graphics ConnectorsOptionTask BackgroundHighlightPathAnnotationOptionTask ConnectionsGraphTask background DrawConnectorsTask".split(" "), a.orgdiagram.DrawHighlightPathAnnotationTask, "#00ffff");
              c.addTask("DrawForegroundShapeAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask OrientationOptionTask ForegroundShapeAnnotationOptionTask AlignDiagramTask AnnotationLabelTemplateTask foreground DrawForegroundHighlightPathAnnotationTask".split(" "),
                  a.orgdiagram.DrawShapeAnnotationTask, "#008000");
              c.addTask("DrawForegroundConnectorAnnotationTask", "graphics CreateTransformTask ApplyLayoutChangesTask OrientationOptionTask ForegroundConnectorAnnotationOptionTask AlignDiagramTask AnnotationLabelTemplateTask foreground DrawForegroundShapeAnnotationTask".split(" "), a.orgdiagram.DrawConnectorAnnotationTask, "#008000");
              c.addTask("DrawCursorTask", "graphics CreateTransformTask ApplyLayoutChangesTask CombinedContextsTask AlignDiagramTask ItemTemplateParamsTask CursorItemTask SelectedItemsTask DrawForegroundConnectorAnnotationTask".split(" "),
                  a.orgdiagram.DrawCursorTask, "#008000");
              c.addTask("DrawHighlightTask", "graphics CreateTransformTask ApplyLayoutChangesTask CombinedContextsTask AlignDiagramTask ItemTemplateParamsTask HighlightItemTask CursorItemTask SelectedItemsTask DrawCursorTask".split(" "), a.orgdiagram.DrawHighlightTask, "#008000");
              return c
          }
  
          function e() {
              g.options.hasButtons = 2;
              g.options.pageFitMode = 5;
              g.options.autoSizeMaximum = new a.common.Size(1E5, 1E5)
          }
          var g = {
              name: "orgdiagram",
              doc: null,
              options: f,
              tasks: null,
              graphics: null
          };
          return {
              draw: function(f,
                  i, j) {
                  g.doc = f;
                  g.tasks = c(b, d);
                  g.graphics = new a.pdf.graphics(g.doc);
                  g.graphics.debug = !1;
                  e();
                  g.doc.save();
                  g.doc.translate(i, j);
                  g.tasks.process("OptionsTask", null, !1);
                  g.doc.restore();
                  f = g.tasks.getTask("AlignDiagramTask");
                  return new a.common.Size(f.getContentSize())
              },
              getSize: function() {
                  g.tasks = c(b, d);
                  e();
                  g.tasks.process("OptionsTask", "AlignDiagramTask", !1);
                  var f = g.tasks.getTask("AlignDiagramTask");
                  return new a.common.Size(f.getContentSize())
              }
          }
      };
      a.pdf.AnnotationLabelTemplate = function() {
          return {
              template: function() {
                  return {}
              },
              getHashCode: function() {
                  return 0
              },
              render: function(a, b, d) {
                  d = d.context;
                  a.save();
                  a.font("Helvetica", 12).text(d.label, b.x, b.y, {
                      width: b.width,
                      height: b.height,
                      align: "center"
                  });
                  a.restore()
              }
          }
      };
      a.pdf.CheckBoxTemplate = function(a) {
          return {
              template: function() {
                  return {}
              },
              getHashCode: function() {
                  return 0
              },
              render: function(b, d, c) {
                  c = c.isSelected ? "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAF/SURBVDhPpZM7rwFREMf/u4hEY5vVkigoSERiKwq1QqOh28R30QnFRqnSKHwFn0C37Sbi0SCE2KzE41wzd/feG48g91ftmdn5zznzkLLZrNhutzidTvgEv98PRVEgxeNx0e12EYvFcDweXfdjZFmGEIKDx+MxdF0HotGomEwmV/tnUAzFyqT8KrNHLpdDJpPBZrPh81UHLPAO7XYb6/Ua8/kcpmnC5/NBkqT3BJbLJRqNBgKBACqVCgqFAg6HA/veEiiVSlBVFZfLBZ1Ox7V+81KAMtPVV6sV+v2+a/2FBeg9RDqdhqZp/E1Mp1O0Wi32V6tVLuAtLEBvGw6HmM1m2O/3yOfz7CyXy4hEItz3ZrPJtr/8dIEKUiwWYRgGX3e32yGZTOJ8PnMBB4MBB9xy14VarcaZFosFQqEQHMdBvV5HIpFw/3gATZNlWTxdHr1eT4TDYZFKpVzLPRRDsU9HeTQaCdu23dM91wKzwNNlCgaDXINHW0pF95bpn+us4AsY2TIOZFyZ9AAAAABJRU5ErkJggg==" :
                      "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAACjSURBVDhPrZNNCsQgDEY/f2q33sCCN+iNPJlXE2/gTtDiVBln1TJo+zZBJS+YELLvewkhIOeMETjnkFKCaK2LtRbbtiGl9H2+hlKKUkpLds7BGAMopYr3/rwfo+bUXFrN/yrfcXrQBDMwxkAImRfEGFucFnTeEdT/zNIEy7K0wyi/KfSGjPJoCp13BDM9EEK0eLtM67riOI7LLa0F+zI9XGeJDyTldfBA9FNyAAAAAElFTkSuQmCC";
                  b.save();
                  b.image(c, d.x, d.y);
                  b.font("Helvetica", 11).text(a, d.x + 20, d.y + 4, {
                      ellipsis: !0,
                      width: d.width - 4,
                      height: d.height,
                      align: "left"
                  });
                  b.restore()
              }
          }
      };
      a.pdf.CursorTemplate = function(a, b) {
          return {
              template: function() {
                  return {}
              },
              getHashCode: function() {
                  return 0
              },
              render: function(a, c) {
                  a.save();
                  a.roundedRect(c.x, c.y, c.width, c.height, 4).lineWidth(b.cursorBorderWidth).stroke("#fbd850");
                  a.restore()
              }
          }
      };
      a.pdf.DummyTemplate = function() {
          return {
              template: function() {
                  return {}
              },
              getHashCode: function() {
                  return 0
              },
              render: function() {}
          }
      };
      a.pdf.GroupTitleTemplate = function(f, b) {
          return {
              template: function() {
                  return {}
              },
              getHashCode: function() {
                  return 0
              },
              render: function(d, c, e) {
                  var e = e.context,
                      g = e.groupTitleColor || "#4169e1",
                      h = a.common.highestContrast(g, b, f);
                  d.save();
                  d.translate(c.width, 0).rotate(90, {
                      origin: [c.x, c.y]
                  });
                  d.fillColor(g).roundedRect(c.x, c.y, c.height - 2, c.width, 4).fill();
                  d.fillColor(h).font("Helvetica", 12).text(e.groupTitle, c.x + 4, c.y + 6, {
                      ellipsis: !0,
                      width: c.height - 4,
                      height: c.width - 4,
                      align: "center"
                  });
                  d.restore()
              }
          }
      };
      a.pdf.HighlightTemplate = function(a, b) {
          return {
              template: function() {
                  return {}
              },
              getHashCode: function() {
                  return 0
              },
              render: function(a,
                  c) {
                  a.save();
                  a.roundedRect(c.x, c.y, c.width, c.height, 4).lineWidth(b.highlightBorderWidth).stroke("#fbcb09");
                  a.restore()
              }
          }
      };
      a.pdf.ItemTemplate = function(f, b) {
          return {
              template: function() {
                  return {}
              },
              getHashCode: function() {
                  return 0
              },
              render: function(d, c, e) {
                  var e = e.context,
                      g = null != e.itemTitleColor ? e.itemTitleColor : "#4169e1",
                      h = a.common.highestContrast(g, f.itemTitleSecondFontColor, f.itemTitleFirstFontColor),
                      i = new a.common.Size(b.itemSize);
                  i.width -= 2 * b.itemBorderWidth;
                  i.height -= 2 * b.itemBorderWidth;
                  d.save();
                  d.roundedRect(c.x,
                      c.y, c.width, c.height, 4).lineWidth(b.itemBorderWidth).stroke("#dddddd");
                  d.fillColor(g).roundedRect(c.x + 2, c.y + 2, i.width - 4, 18, 2).fill();
                  d.fillColor(h).font("Helvetica", 12).text(e.title, c.x + 4, c.y + 7, {
                      ellipsis: !0,
                      width: i.width - 4 - 8,
                      height: 16,
                      align: "left"
                  });
                  null != e.image && d.image(e.image, c.x + 3, c.y + 24);
                  d.rect(c.x + 3, c.y + 24, 50, 60).stroke("#cccccc");
                  d.fillColor("black").font("Helvetica", 10).text(e.description, c.x + 56, c.y + 24, {
                      ellipsis: !0,
                      width: i.width - 4 - 56,
                      height: 74,
                      align: "left"
                  });
                  d.restore()
              }
          }
      };
      a.pdf.LabelAnnotationTemplate =
          function() {
              return {
                  template: function() {
                      return {}
                  },
                  getHashCode: function() {
                      return 0
                  },
                  render: function(a, b, d) {
                      d = d.context;
                      a.save();
                      a.font("Helvetica", 12).text(d.title, b.x, b.y, {
                          width: b.width,
                          height: b.height,
                          align: "center"
                      });
                      a.restore()
                  }
              }
          };
      a.pdf.UserTemplate = function(f, b, d) {
          return {
              template: function() {
                  return {}
              },
              getHashCode: function() {
                  return 0
              },
              render: function(c, e, g) {
                  null != d ? d(c, e, g) : a.pdf.ItemTemplate(f, b).render(c, e, g)
              }
          }
      };
      return a
  });