").appendTo(r) }, _createAttribution: function (e) { var t = this._createControlElement(e, "bottomRight"); this.attribution = new u.Attribution(t, e) }, _createNavigator: function (e) { var t = this._createControlElement(e, "topLeft"), n = this.navigator = new u.Navigator(t, e); this._navigatorPan = a(this._navigatorPan, this), n.bind("pan", this._navigatorPan), this._navigatorCenter = a(this._navigatorCenter, this), n.bind("center", this._navigatorCenter) }, _navigatorPan: function (e) { var t = this, n = t.scroller, i = n.scrollLeft + e.x, o = n.scrollTop - e.y, r = this._virtualSize, a = this.element.height(), s = this.element.width(); i = y(i, r.x.min, r.x.max - s), o = y(o, r.y.min, r.y.max - a), t.scroller.one("scroll", function (e) { t._scrollEnd(e) }), t.scroller.scrollTo(-i, -o) }, _navigatorCenter: function () { this.center(this.options.center) }, _createZoomControl: function (e) { var t = this._createControlElement(e, "topLeft"), n = this.zoomControl = new u.ZoomControl(t, e); this._zoomControlChange = a(this._zoomControlChange, this), n.bind("change", this._zoomControlChange) }, _zoomControlChange: function (e) { this.trigger("zoomStart", { originalEvent: e }) || (this.zoom(this.zoom() + e.delta), this.trigger("zoomEnd", { originalEvent: e })) }, _initScroller: function () { var e = s.support.mobileOS ? T : S, t = this.options.zoomable !== !1, n = this.scroller = new s.mobile.ui.Scroller(this.element.children(0), { friction: e, velocityMultiplier: A, zoom: t, mousewheelScrolling: !1, supportDoubleTap: !0 }); n.bind("scroll", a(this._scroll, this)), n.bind("scrollEnd", a(this._scrollEnd, this)), n.userEvents.bind("gesturestart", a(this._scaleStart, this)), n.userEvents.bind("gestureend", a(this._scale, this)), n.userEvents.bind("doubleTap", a(this._doubleTap, this)), n.userEvents.bind("tap", a(this._tap, this)), this.scrollElement = n.scrollElement }, _initLayers: function () { var e, t, n, i, o, r = this.options.layers, a = this.layers = []; for (e = 0; e < r.length; e++)t = r[e], n = t.type || "shape", i = this.options.layerDefaults[n], o = c.map.layers[n], a.push(new o(this, d({}, i, t))) }, _initMarkers: function () { this.markers = new f.layers.MarkerLayer(this, this.options.markerDefaults), this.markers.add(this.options.markers) }, _scroll: function (e) { var t = this.locationToLayer(this._viewOrigin).round(), n = e.sender.movable, i = new h.Point(n.x, n.y).scale(-1).scale(1 / n.scale); t.x += i.x, t.y += i.y, this._scrollOffset = i, this._setOrigin(this.layerToLocation(t)), this.trigger("pan", { originalEvent: e, origin: this._getOrigin(), center: this.center() }) }, _scrollEnd: function (e) { this._scrollOffset && this._panComplete() && (this._scrollOffset = null, this._panEndTS = new Date, this.trigger("panEnd", { originalEvent: e, origin: this._getOrigin(), center: this.center() })) }, _panComplete: function () { return new Date - (this._panEndTS || 0) > 50 }, _scaleStart: function (e) { if (this.trigger("zoomStart", { originalEvent: e })) { var t = e.touches[1]; t && t.cancel() } }, _scale: function (e) { var t = this.scroller.movable.scale, n = this._scaleToZoom(t), i = new h.Point(e.center.x, e.center.y), o = this.viewToLocation(i, n), r = this.locationToLayer(o, n), a = r.translate(-i.x, -i.y); this._zoomAround(a, n), this.trigger("zoomEnd", { originalEvent: e }) }, _scaleToZoom: function (e) { var t = this._layerSize() * e, n = t / this.options.minSize, o = i.log(n) / i.log(2); return i.round(o) }, _reset: function () { this.attribution && this.attribution.filter(this.center(), this.zoom()), this._viewOrigin = this._getOrigin(!0), this._resetScroller(), this.trigger("beforeReset"), this.trigger("reset") }, _resetScroller: function () { var e, t, n, i, o = this.scroller, a = o.dimensions.x, s = o.dimensions.y, l = this._layerSize(), d = this.extent().nw, c = this.locationToLayer(d).round(); o.movable.round = !0, o.reset(), o.userEvents.cancel(), e = this.zoom(), o.dimensions.forcedMinScale = r(2, this.options.minZoom - e), o.dimensions.maxScale = r(2, this.options.maxZoom - e), t = { min: -c.x, max: l - c.x }, n = { min: -c.y, max: l - c.y }, this.options.wraparound && (t.max = 20 * l, t.min = -t.max), this.options.pannable === !1 && (i = this.viewSize(), t.min = n.min = 0, t.max = i.width, n.max = i.height), a.makeVirtual(), s.makeVirtual(), a.virtualSize(t.min, t.max), s.virtualSize(n.min, n.max), this._virtualSize = { x: t, y: n } }, _renderLayers: function () { var e, t, n, i, o, r = this.options.layers, a = this.layers = [], s = this.scrollWrap; for (s.empty(), e = 0; e < r.length; e++)t = r[e], n = t.type || "shape", i = this.options.layerDefaults[n], o = c.map.layers[n], a.push(new o(this, d({}, i, t))) }, _layerSize: function (e) { return e = x(e, this.options.zoom), this.options.minSize * r(2, e) }, _tap: function (e) { if (this._panComplete()) { var t = this.eventOffset(e); this.trigger("click", { originalEvent: e, location: this.viewToLocation(t) }) } }, _doubleTap: function (e) { var t, n, i, o, r, a = this.options; a.zoomable !== !1 && (this.trigger("zoomStart", { originalEvent: e }) || (t = this.zoom() + E, n = this.eventOffset(e), i = this.viewToLocation(n), o = this.locationToLayer(i, t), r = o.translate(-n.x, -n.y), this._zoomAround(r, t), this.trigger("zoomEnd", { originalEvent: e }))) }, _mousewheel: function (e) { var t, n, i, o, r, a, s, l; e.preventDefault(), t = c.mwDelta(e) > 0 ? -1 : 1, n = this.options, i = this.zoom(), o = y(i + t, n.minZoom, n.maxZoom), n.zoomable !== !1 && o !== i && (this.trigger("zoomStart", { originalEvent: e }) || (r = this.eventOffset(e), a = this.viewToLocation(r), s = this.locationToLayer(a, o), l = s.translate(-r.x, -r.y), this._zoomAround(l, o), this.trigger("zoomEnd", { originalEvent: e }))) } }); c.ui.plugin(I) }(window.kendo.jQuery) }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.dataviz.map.min", ["kendo.data.min", "kendo.userevents.min", "kendo.tooltip.min", "kendo.mobile.scroller.min", "kendo.draganddrop.min", "kendo.dataviz.core.min", "dataviz/map/location.min", "dataviz/map/attribution.min", "dataviz/map/navigator.min", "dataviz/map/zoom.min", "dataviz/map/crs.min", "dataviz/map/layers/base.min", "dataviz/map/layers/shape.min", "dataviz/map/layers/bubble.min", "dataviz/map/layers/tile.min", "dataviz/map/layers/bing.min", "dataviz/map/layers/marker.min", "dataviz/map/main.min"], e) }(function () { return window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("dataviz/diagram/utils.min", ["kendo.core.min"], e) }(function () {
!function (e, t) {
function n(e, n, i) { function o(e) { for (var t = 1; e * t % 1;)t *= 10; return t } var r, a, s, l; if (t === e || t === n) return []; if (i && u.sign(n - e) != u.sign(i)) throw "The sign of the increment should allow to reach the stop-value."; if (i = i || 1, e = e || 0, n = n || e, (n - e) / i === 1 / 0) throw "Infinite range defined."; if (r = [], a = -1, l = o(Math.abs(i)), e *= l, n *= l, i *= l, e > n && i > 0 && (i = -i), i < 0) for (; (s = e + i * ++a) >= n;)r.push(s / l); else for (; (s = e + i * ++a) <= n;)r.push(s / l); return r } function i(e, t) { if (e == t) return 0; var n = t.x - e.x, i = e.y - t.y, o = Math.atan(n / i); return i >= 0 ? n < 0 ? o + 2 * Math.PI : o : o + Math.PI } var o, r, a = window.kendo, s = a.dataviz.diagram = {}, l = a.deepExtend, d = e.isArray, c = 1e-6, u = {}; l(u, { isNearZero: function (e) { return Math.abs(e) < c }, isDefined: function (e) { return t !== e }, isUndefined: function (e) { return t === e || null === e }, isObject: function (e) { return e === Object(e) }, has: function (e, t) { return Object.hasOwnProperty.call(e, t) }, isString: function (e) { return "[object String]" == Object.prototype.toString.call(e) }, isBoolean: function (e) { return "[object Boolean]" == Object.prototype.toString.call(e) }, isType: function (e, t) { return Object.prototype.toString.call(e) == "[object " + t + "]" }, isNumber: function (e) { return !isNaN(parseFloat(e)) && isFinite(e) }, isEmpty: function (e) { if (null === e) return !0; if (d(e) || u.isString(e)) return 0 === e.length; for (var t in e) if (u.has(e, t)) return !1; return !0 }, simpleExtend: function (e, t) { if (u.isObject(t)) for (var n in t) e[n] = t[n] }, initArray: function (e, t) { var n, i = []; for (n = 0; n < e; ++n)i[n] = t; return i }, serializePoints: function (e) { var t, n, i = []; for (t = 0; t < e.length; t++)n = e[t], i.push(n.x + ";" + n.y); return i.join(";") }, deserializePoints: function (e) { var t, n = e.split(";"), i = []; if (n.length % 2 !== 0) throw "Not an array of points."; for (t = 0; t < n.length; t += 2)i.push(new s.Point(parseInt(n[t], 10), parseInt(n[t + 1], 10))); return i }, randomInteger: function (e, t) { return parseInt(Math.floor(Math.random() * t) + e, 10) }, DFT: function (e, t) { var n, i; if (t(e), e.childNodes) for (n = 0; n < e.childNodes.length; n++)i = e.childNodes[n], this.DFT(i, t) }, getMatrixAngle: function (e) { return null === e || 0 === e.d ? 0 : 180 * Math.atan2(e.b, e.d) / Math.PI }, getMatrixScaling: function (e) { var t = Math.sqrt(e.a * e.a + e.c * e.c), n = Math.sqrt(e.b * e.b + e.d * e.d); return [t, n] } }), u.sign = function (e) { return e ? e < 0 ? -1 : 1 : 0 }, u.findAngle = function (e, t) { return 180 * i(e, t) / Math.PI }, u.forEach = function (e, t, n) { for (var i = 0; i < e.length; i++)t.call(n, e[i], i, e) }, u.any = function (e, t) { for (var n = 0; n < e.length; ++n)if (t(e[n])) return e[n]; return null }, u.remove = function (e, t) { for (var n; (n = u.indexOf(e, t)) !== -1;)e.splice(n, 1); return e }, u.contains = function (e, t) { return u.indexOf(e, t) !== -1 }, u.indexOf = function (t, n) { return e.inArray(n, t) }, u.fold = function (e, t, n, i) { var o, r, a = arguments.length > 2; for (o = 0; o < e.length; o++)r = e[o], a ? n = t.call(i, n, r, o, e) : (n = r, a = !0); if (!a) throw "Reduce of empty array with no initial value"; return n }, u.find = function (e, t, n) { var i; return u.any(e, function (e, o, r) { return !!t.call(n, e, o, r) && (i = e, !0) }), i }, u.first = function (e, t, n) { return 0 === e.length ? null : u.isUndefined(t) ? e[0] : u.find(e, t, n) }, u.insert = function (e, t, n) { return e.splice(n, 0, t), e }, u.all = function (e, t, n) { var i, o, r = !0; for (o = 0; o < e.length && (i = e[o], r = r && t.call(n, i, o, e), r); o++); return r }, u.clear = function (e) { e.splice(0, e.length) }, u.bisort = function (e, t, n) { if (u.isUndefined(e)) throw "First array is not specified."; if (u.isUndefined(t)) throw "Second array is not specified."; if (e.length != t.length) throw "The two arrays should have equal length"; var i, o = []; for (i = 0; i < e.length; i++)o.push({ x: e[i], y: t[i] }); for (o.sort(u.isUndefined(n) ? function (e, t) { return e.x - t.x } : function (e, t) { return n(e.x, t.x) }), u.clear(e), u.clear(t), i = 0; i < o.length; i++)e.push(o[i].x), t.push(o[i].y) }, u.addRange = function (e, t) { e.push.apply(e, t) }, o = { easeInOut: function (e) { return -Math.cos(e * Math.PI) / 2 + .5 } }, r = a.Class.extend({
init: function () { this.adapters = [], this.target = 0, this.tick = 0, this.interval = 20, this.duration = 800, this.lastTime = null, this.handlers = []; var e = this; this.transition = o.easeInOut, this.timerDelegate = function () { e.onTimerEvent() } }, addAdapter: function (e) { this.adapters.push(e) }, onComplete: function (e) { this.handlers.push(e) }, removeHandler: function (t) { this.handlers = e.grep(this.handlers, function (e) { return e !== t }) }, trigger: function () { var e = this; this.handlers && u.forEach(this.handlers, function (t) { return t.call(null !== e.caller ? e.caller : e) }) }, onStep: function () { }, seekTo: function (e) { this.seekFromTo(this.tick, e) }, seekFromTo: function (e, t) { this.target = Math.max(0, Math.min(1, t)), this.tick = Math.max(0, Math.min(1, e)), this.lastTime = (new Date).getTime(), this.intervalId || (this.intervalId = window.setInterval(this.timerDelegate, this.interval)) }, stop: function () { this.intervalId && (window.clearInterval(this.intervalId), this.intervalId = null, this.trigger()) }, play: function (e) { 0 !== this.adapters.length && (null !== e && (this.caller = e), this.initState(), this.seekFromTo(0, 1)) }, reverse: function () { this.seekFromTo(1, 0) }, initState: function () { if (0 !== this.adapters.length) for (var e = 0; e < this.adapters.length; e++)this.adapters[e].initState() }, propagate: function () {
var e, t = this.transition(this.tick);
for (e = 0; e < this.adapters.length; e++)this.adapters[e].update(t)
}, onTimerEvent: function () { var e, t = (new Date).getTime(), n = t - this.lastTime; this.lastTime = t, e = n / this.duration * (this.tick < this.target ? 1 : -1), Math.abs(e) >= Math.abs(this.tick - this.target) ? this.tick = this.target : this.tick += e; try { this.propagate() } finally { this.onStep.call(this), this.target == this.tick && this.stop() } }
}), a.deepExtend(s, { init: function (e) { a.init(e, s.ui) }, Utils: u, Range: n, Ticker: r })
}(window.kendo.jQuery)
}, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("dataviz/diagram/math.min", ["dataviz/diagram/utils.min", "kendo.dataviz.core.min"], e) }(function () {
!function (e, t) {
function n(e) { return Math.abs(e) < F } function i(e, t, i, o, r) { var a, s, l, d, c = (t.x - e.x) * (o.y - i.y) - (t.y - e.y) * (o.x - i.x); if (!n(c) && (a = (e.y - i.y) * (o.x - i.x) - (e.x - i.x) * (o.y - i.y), s = (e.y - i.y) * (t.x - e.x) - (e.x - i.x) * (t.y - e.y), l = a / c, d = s / c, !r || !(l < 0 || l > 1 || d < 0 || d > 1))) return new A(e.x + l * (t.x - e.x), e.y + l * (t.y - e.y)) } function o(e, t) { var n, i, o; do n = 2 * Math.random() - 1, i = 2 * Math.random() - 1, o = n * n + i * i; while (!o || o > 1); return e + t * n * Math.sqrt(-2 * Math.log(o) / o) } function r(e) { var t, n, i; for (D.isUndefined(e) && (e = 10), t = "", n = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", i = e; i > 0; --i)t += n.charAt(Math.round(Math.random() * (n.length - 1))); return t } var a, s, l, d, c, u, h, p, f, g, m, v, _, b, w, k, y = window.kendo, x = y.dataviz.diagram, C = y.Class, S = y.deepExtend, T = y.dataviz, D = x.Utils, A = T.Point2D, E = y.isFunction, I = D.contains, M = e.map, R = 3, F = 1e-6; S(A.fn, { plus: function (e) { return new A(this.x + e.x, this.y + e.y) }, minus: function (e) { return new A(this.x - e.x, this.y - e.y) }, offset: function (e) { return new A(this.x - e, this.y - e) }, times: function (e) { return new A(this.x * e, this.y * e) }, normalize: function () { return 0 === this.length() ? new A : this.times(1 / this.length()) }, length: function () { return Math.sqrt(this.x * this.x + this.y * this.y) }, toString: function () { return "(" + this.x + "," + this.y + ")" }, lengthSquared: function () { return this.x * this.x + this.y * this.y }, middleOf: function (e, t) { return new A(t.x - e.x, t.y - e.y).times(.5).plus(e) }, toPolar: function (e) { var t, n, i, o = 1; if (e && (o = 180 / Math.PI), t = Math.atan2(Math.abs(this.y), Math.abs(this.x)), n = Math.PI / 2, i = this.length(), 0 === this.x) { if (0 === this.y) return new u(0, 0); if (this.y > 0) return new u(i, o * n); if (this.y < 0) return new u(i, 3 * o * n) } else if (this.x > 0) { if (0 === this.y) return new u(i, 0); if (this.y > 0) return new u(i, o * t); if (this.y < 0) return new u(i, o * (4 * n - t)) } else { if (0 === this.y) return new u(i, 2 * n); if (this.y > 0) return new u(i, o * (2 * n - t)); if (this.y < 0) return new u(i, o * (2 * n + t)) } }, isOnLine: function (e, t) { var n, i, o, r, a; return e.x > t.x && (n = t, t = e, e = n), i = new s(e.x, e.y).inflate(R, R), o = new s(t.x, t.y).inflate(R, R), !!i.union(o).contains(this) && (e.x === t.x || e.y === t.y || (e.y < t.y ? (r = i.x + (o.x - i.x) * (this.y - (i.y + i.height)) / (o.y + o.height - (i.y + i.height)), a = i.x + i.width + (o.x + o.width - (i.x + i.width)) * (this.y - i.y) / (o.y - i.y)) : (r = i.x + (o.x - i.x) * (this.y - i.y) / (o.y - i.y), a = i.x + i.width + (o.x + o.width - (i.x + i.width)) * (this.y - (i.y + i.height)) / (o.y + o.height - (i.y + i.height))), this.x > r && this.x < a)) } }), S(A, { parse: function (e) { var t = e.slice(1, e.length - 1), n = t.split(","), i = parseInt(n[0], 10), o = parseInt(n[1], 10); if (!isNaN(i) && !isNaN(o)) return new A(i, o) } }), a = C.extend({ init: function (e, t, n) { this.point = e, this.left = t, this.right = n } }), s = C.extend({ init: function (e, t, n, i) { this.x = e || 0, this.y = t || 0, this.width = n || 0, this.height = i || 0 }, contains: function (e) { return e.x >= this.x && e.x <= this.x + this.width && e.y >= this.y && e.y <= this.y + this.height }, inflate: function (e, n) { return n === t && (n = e), this.x -= e, this.y -= n, this.width += 2 * e + 1, this.height += 2 * n + 1, this }, offset: function (e, t) { var n = e, i = t; return e instanceof A && (n = e.x, i = e.y), this.x += n, this.y += i, this }, union: function (e) { var t = Math.min(this.x, e.x), n = Math.min(this.y, e.y), i = Math.max(this.x + this.width, e.x + e.width), o = Math.max(this.y + this.height, e.y + e.height); return new s(t, n, i - t, o - n) }, center: function () { return new A(this.x + this.width / 2, this.y + this.height / 2) }, top: function () { return new A(this.x + this.width / 2, this.y) }, right: function () { return new A(this.x + this.width, this.y + this.height / 2) }, bottom: function () { return new A(this.x + this.width / 2, this.y + this.height) }, left: function () { return new A(this.x, this.y + this.height / 2) }, topLeft: function () { return new A(this.x, this.y) }, topRight: function () { return new A(this.x + this.width, this.y) }, bottomLeft: function () { return new A(this.x, this.y + this.height) }, bottomRight: function () { return new A(this.x + this.width, this.y + this.height) }, clone: function () { return new s(this.x, this.y, this.width, this.height) }, isEmpty: function () { return !this.width && !this.height }, equals: function (e) { return this.x === e.x && this.y === e.y && this.width === e.width && this.height === e.height }, rotatedBounds: function (e) { var t = this.clone(), n = this.rotatedPoints(e), i = n[0], o = n[1], r = n[2], a = n[3]; return t.x = Math.min(r.x, i.x, o.x, a.x), t.y = Math.min(r.y, i.y, o.y, a.y), t.width = Math.max(r.x, i.x, o.x, a.x) - t.x, t.height = Math.max(r.y, i.y, o.y, a.y) - t.y, t }, rotatedPoints: function (e) { var t = this, n = t.center(), i = t.bottomRight().rotate(n, 360 - e), o = t.topLeft().rotate(n, 360 - e), r = t.topRight().rotate(n, 360 - e), a = t.bottomLeft().rotate(n, 360 - e); return [o, r, i, a] }, toString: function (e) { return e = e || " ", this.x + e + this.y + e + this.width + e + this.height }, scale: function (e, t, n, i, o) { var r, a, s, l = this.topLeft(), d = this.center(); l.rotate(d, 360 - o).rotate(i, o), r = n.minus(l), a = new A(r.x * e, r.y * t), s = r.minus(a), l = l.plus(s), l.rotate(i, 360 - o).rotate(d, o), this.x = l.x, this.y = l.y, this.width *= e, this.height *= t }, zoom: function (e) { return this.x *= e, this.y *= e, this.width *= e, this.height *= e, this }, overlaps: function (e) { var t = this.bottomRight(), n = e.bottomRight(), i = !(t.x < e.x || t.y < e.y || n.x < this.x || n.y < this.y); return i } }), l = C.extend({ init: function (e, t) { this.width = e, this.height = t } }), l.prototype.Empty = new l(0, 0), s.toRect = function (e) { return e instanceof s || (e = new s(e.x, e.y, e.width, e.height)), e }, s.empty = function () { return new s(0, 0, 0, 0) }, s.fromPoints = function (e, t) { if (isNaN(e.x) || isNaN(e.y) || isNaN(t.x) || isNaN(t.y)) throw "Some values are NaN."; return new s(Math.min(e.x, t.x), Math.min(e.y, t.y), Math.abs(e.x - t.x), Math.abs(e.y - t.y)) }, d = { lines: function (e, t, n, o) { return i(e, t, n, o) }, segments: function (e, t, n, o) { return i(e, t, n, o, !0) }, rectWithLine: function (e, t, n) { return d.segments(t, n, e.topLeft(), e.topRight()) || d.segments(t, n, e.topRight(), e.bottomRight()) || d.segments(t, n, e.bottomLeft(), e.bottomRight()) || d.segments(t, n, e.topLeft(), e.bottomLeft()) }, rects: function (e, t, n) { var i, o, r = t.topLeft(), a = t.topRight(), s = t.bottomLeft(), l = t.bottomRight(), c = t.center(); return n && (r = r.rotate(c, n), a = a.rotate(c, n), s = s.rotate(c, n), l = l.rotate(c, n)), i = e.contains(r) || e.contains(a) || e.contains(s) || e.contains(l) || d.rectWithLine(e, r, a) || d.rectWithLine(e, r, s) || d.rectWithLine(e, a, l) || d.rectWithLine(e, s, l), i || (r = e.topLeft(), a = e.topRight(), s = e.bottomLeft(), l = e.bottomRight(), n && (o = 360 - n, r = r.rotate(c, o), a = a.rotate(c, o), s = s.rotate(c, o), l = l.rotate(c, o)), i = t.contains(r) || t.contains(a) || t.contains(s) || t.contains(l)), i } }, c = C.extend({ init: function (e) { this.container = s.toRect(e) }, align: function (e, t) { var n, i = t.toLowerCase().split(" "); for (n = 0; n < i.length; n++)e = this._singleAlign(e, i[n]); return e }, _singleAlign: function (e, t) { return E(this[t]) ? this[t](e) : e }, left: function (e) { return this._align(e, this._left) }, center: function (e) { return this._align(e, this._center) }, right: function (e) { return this._align(e, this._right) }, stretch: function (e) { return this._align(e, this._stretch) }, top: function (e) { return this._align(e, this._top) }, middle: function (e) { return this._align(e, this._middle) }, bottom: function (e) { return this._align(e, this._bottom) }, _left: function (e, t) { t.x = e.x }, _center: function (e, t) { t.x = (e.width - t.width) / 2 || 0 }, _right: function (e, t) { t.x = e.width - t.width }, _top: function (e, t) { t.y = e.y }, _middle: function (e, t) { t.y = (e.height - t.height) / 2 || 0 }, _bottom: function (e, t) { t.y = e.height - t.height }, _stretch: function (e, t) { t.x = 0, t.y = 0, t.height = e.height, t.width = e.width }, _align: function (e, t) { return e = s.toRect(e), t(this.container, e), e } }), u = C.extend({ init: function (e, t) { this.r = e, this.angle = t } }), h = C.extend({ init: function (e, t, n, i, o, r) { this.a = e || 0, this.b = t || 0, this.c = n || 0, this.d = i || 0, this.e = o || 0, this.f = r || 0 }, plus: function (e) { this.a += e.a, this.b += e.b, this.c += e.c, this.d += e.d, this.e += e.e, this.f += e.f }, minus: function (e) { this.a -= e.a, this.b -= e.b, this.c -= e.c, this.d -= e.d, this.e -= e.e, this.f -= e.f }, times: function (e) { return new h(this.a * e.a + this.c * e.b, this.b * e.a + this.d * e.b, this.a * e.c + this.c * e.d, this.b * e.c + this.d * e.d, this.a * e.e + this.c * e.f + this.e, this.b * e.e + this.d * e.f + this.f) }, apply: function (e) { return new A(this.a * e.x + this.c * e.y + this.e, this.b * e.x + this.d * e.y + this.f) }, applyRect: function (e) { return s.fromPoints(this.apply(e.topLeft()), this.apply(e.bottomRight())) }, toString: function () { return "matrix(" + this.a + " " + this.b + " " + this.c + " " + this.d + " " + this.e + " " + this.f + ")" } }), S(h, { fromSVGMatrix: function (e) { var t = new h; return t.a = e.a, t.b = e.b, t.c = e.c, t.d = e.d, t.e = e.e, t.f = e.f, t }, fromMatrixVector: function (e) { var t = new h; return t.a = e.a, t.b = e.b, t.c = e.c, t.d = e.d, t.e = e.e, t.f = e.f, t }, fromList: function (e) { if (6 !== e.length) throw "The given list should consist of six elements."; var t = new h; return t.a = e[0], t.b = e[1], t.c = e[2], t.d = e[3], t.e = e[4], t.f = e[5], t }, translation: function (e, t) { var n = new h; return n.a = 1, n.b = 0, n.c = 0, n.d = 1, n.e = e, n.f = t, n }, unit: function () { return new h(1, 0, 0, 1, 0, 0) }, rotation: function (e, t, n) { var i = new h; return i.a = Math.cos(e * Math.PI / 180), i.b = Math.sin(e * Math.PI / 180), i.c = -i.b, i.d = i.a, i.e = t - t * i.a + n * i.b || 0, i.f = n - n * i.a - t * i.b || 0, i }, scaling: function (e, t) { var n = new h; return n.a = e, n.b = 0, n.c = 0, n.d = t, n.e = 0, n.f = 0, n }, parse: function (e) { var t, n; if (e) { if (e = e.trim(), "matrix" === e.slice(0, 6).toLowerCase()) { if (n = e.slice(7, e.length - 1).trim(), t = n.split(","), 6 === t.length) return h.fromList(M(t, function (e) { return parseFloat(e) })); if (t = n.split(" "), 6 === t.length) return h.fromList(M(t, function (e) { return parseFloat(e) })) } if ("(" === e.slice(0, 1) && ")" === e.slice(e.length - 1) && (e = e.substr(1, e.length - 1)), e.indexOf(",") > 0 && (t = e.split(","), 6 === t.length)) return h.fromList(M(t, function (e) { return parseFloat(e) })); if (e.indexOf(" ") > 0 && (t = e.split(" "), 6 === t.length)) return h.fromList(M(t, function (e) { return parseFloat(e) })) } return t } }), p = C.extend({ init: function (e, t, n, i, o, r) { this.a = e || 0, this.b = t || 0, this.c = n || 0, this.d = i || 0, this.e = o || 0, this.f = r || 0 }, fromMatrix: function (e) { var t = new p; return t.a = e.a, t.b = e.b, t.c = e.c, t.d = e.d, t.e = e.e, t.f = e.f, t } }), f = { _distanceToLineSquared: function (e, t, n) { function i(e, t) { return (e.x - t.x) * (e.x - t.x) + (e.y - t.y) * (e.y - t.y) } if (t === n) return i(e, t); var o = n.x - t.x, r = n.y - t.y, a = (e.x - t.x) * o + (e.y - t.y) * r; return a < 0 ? i(t, e) : (a = (n.x - e.x) * o + (n.y - e.y) * r, a < 0 ? i(n, e) : (a = (n.x - e.x) * r - (n.y - e.y) * o, a * a / (o * o + r * r))) }, distanceToLine: function (e, t, n) { return Math.sqrt(this._distanceToLineSquared(e, t, n)) }, distanceToPolyline: function (e, t) { var n, i, o, r, a = Number.MAX_VALUE; if (D.isUndefined(t) || 0 === t.length) return Number.MAX_VALUE; for (n = 0; n < t.length - 1; n++)i = t[n], o = t[n + 1], r = this._distanceToLineSquared(e, i, o), r < a && (a = r); return Math.sqrt(a) } }, g = y.Class.extend({ init: function () { this._buckets = [], this.length = 0 }, add: function (e, t) { var n = this._createGetBucket(e); return D.isDefined(t) && (n.value = t), n }, get: function (e) { return this._bucketExists(e) ? this._createGetBucket(e) : null }, set: function (e, t) { this.add(e, t) }, containsKey: function (e) { return this._bucketExists(e) }, remove: function (e) { if (this._bucketExists(e)) { var t = this._hash(e); return delete this._buckets[t], this.length--, e } }, forEach: function (e) { var t, n, i, o, r = this._hashes(); for (t = 0, n = r.length; t < n; t++)i = r[t], o = this._buckets[i], D.isUndefined(o) || e(o) }, clone: function () { var e, t, n, i, o = new g, r = this._hashes(); for (e = 0, t = r.length; e < t; e++)n = r[e], i = this._buckets[n], D.isUndefined(i) || o.add(i.key, i.value); return o }, _hashes: function () { var e, t = []; for (e in this._buckets) this._buckets.hasOwnProperty(e) && t.push(e); return t }, _bucketExists: function (e) { var t = this._hash(e); return D.isDefined(this._buckets[t]) }, _createGetBucket: function (e) { var t = this._hash(e), n = this._buckets[t]; return D.isUndefined(n) && (n = { key: e }, this._buckets[t] = n, this.length++), n }, _hash: function (e) { if (D.isNumber(e)) return e; if (D.isString(e)) return this._hashString(e); if (D.isObject(e)) return this._objectHashId(e); throw "Unsupported key type." }, _hashString: function (e) { var t, n, i = 0; if (0 === e.length) return i; for (t = 0; t < e.length; t++)n = e.charCodeAt(t), i = 32 * i - i + n; return i }, _objectHashId: function (e) { var t = e._hashId; return D.isUndefined(t) && (t = r(), e._hashId = t), t } }), m = y.Observable.extend({ init: function (t) { var n, i = this; if (y.Observable.fn.init.call(i), this._hashTable = new g, this.length = 0, D.isDefined(t)) if (e.isArray(t)) for (n = 0; n < t.length; n++)this.add(t[n]); else t.forEach(function (e, t) { this.add(e, t) }, this) }, add: function (e, t) { var n = this._hashTable.get(e); n || (n = this._hashTable.add(e), this.length++, this.trigger("changed")), n.value = t }, set: function (e, t) { this.add(e, t) }, get: function (e) { var t = this._hashTable.get(e); if (t) return t.value; throw Error("Cannot find key " + e) }, containsKey: function (e) { return this._hashTable.containsKey(e) }, remove: function (e) { if (this.containsKey(e)) return this.trigger("changed"), this.length--, this._hashTable.remove(e) }, forEach: function (e, t) { this._hashTable.forEach(function (n) { e.call(t, n.key, n.value) }) }, forEachValue: function (e, t) { this._hashTable.forEach(function (n) { e.call(t, n.value) }) }, forEachKey: function (e, t) { this._hashTable.forEach(function (n) { e.call(t, n.key) }) }, keys: function () { var e = []; return this.forEachKey(function (t) { e.push(t) }), e } }), v = y.Class.extend({ init: function () { this._tail = null, this._head = null, this.length = 0 }, enqueue: function (e) { var t = { value: e, next: null }; this._head ? (this._tail.next = t, this._tail = this._tail.next) : (this._head = t, this._tail = this._head), this.length++ }, dequeue: function () { if (this.length < 1) throw Error("The queue is empty."); var e = this._head.value; return this._head = this._head.next, this.length--, e }, contains: function (e) { for (var t = this._head; t;) { if (t.value === e) return !0; t = t.next } return !1 } }), _ = y.Observable.extend({ init: function (e) { var t = this; y.Observable.fn.init.call(t), this._hashTable = new g, this.length = 0, D.isDefined(e) && (e instanceof g ? e.forEach(function (e) { this.add(e) }) : e instanceof m && e.forEach(function (e, t) { this.add({ key: e, value: t }) }, this)) }, contains: function (e) { return this._hashTable.containsKey(e) }, add: function (e) { var t = this._hashTable.get(e); t || (this._hashTable.add(e, e), this.length++, this.trigger("changed")) }, get: function (e) { return this.contains(e) ? this._hashTable.get(e).value : null }, hash: function (e) { return this._hashTable._hash(e) }, remove: function (e) { this.contains(e) && (this._hashTable.remove(e), this.length--, this.trigger("changed")) }, forEach: function (e, t) { this._hashTable.forEach(function (t) { e(t.value) }, t) }, toArray: function () { var e = []; return this.forEach(function (t) { e.push(t) }), e } }), b = y.Class.extend({ init: function (e, t) { if (this.links = [], this.outgoing = [], this.incoming = [], this.weight = 1, this.id = D.isDefined(e) ? e : r(), D.isDefined(t)) { this.associatedShape = t; var n = t.bounds(); this.width = n.width, this.height = n.height, this.x = n.x, this.y = n.y } else this.associatedShape = null; this.data = null, this.type = "Node", this.shortForm = "Node '" + this.id + "'", this.isVirtual = !1 }, isIsolated: function () { return D.isEmpty(this.links) }, bounds: function (e) { return D.isDefined(e) ? (this.x = e.x, this.y = e.y, this.width = e.width, this.height = e.height, t) : new x.Rect(this.x, this.y, this.width, this.height) }, isLinkedTo: function (e) { var t = this; return D.any(t.links, function (n) { return n.getComplement(t) === e }) }, getChildren: function () { var e, t, n, i; if (0 === this.outgoing.length) return []; for (e = [], t = 0, n = this.outgoing.length; t < n; t++)i = this.outgoing[t], e.push(i.getComplement(this)); return e }, getParents: function () { var e, t, n, i; if (0 === this.incoming.length) return []; for (e = [], t = 0, n = this.incoming.length; t < n; t++)i = this.incoming[t], e.push(i.getComplement(this)); return e }, clone: function () { var e = new b; return D.isDefined(this.weight) && (e.weight = this.weight), D.isDefined(this.balance) && (e.balance = this.balance), D.isDefined(this.owner) && (e.owner = this.owner), e.associatedShape = this.associatedShape, e.x = this.x, e.y = this.y, e.width = this.width, e.height = this.height, e }, adjacentTo: function (e) { return null !== this.isLinkedTo(e) }, removeLink: function (e) { e.source === this && (D.remove(this.links, e), D.remove(this.outgoing, e), e.source = null), e.target === this && (D.remove(this.links, e), D.remove(this.incoming, e), e.target = null) }, hasLinkTo: function (e) { return D.any(this.outgoing, function (t) { return t.target === e }) }, degree: function () { return this.links.length }, incidentWith: function (e) { return I(this.links, e) }, getLinksWith: function (e) { return D.all(this.links, function (t) { return t.getComplement(this) === e }, this) }, getNeighbors: function () { var e = []; return D.forEach(this.incoming, function (t) { e.push(t.getComplement(this)) }, this), D.forEach(this.outgoing, function (t) { e.push(t.getComplement(this)) }, this), e } }), w = y.Class.extend({ init: function (e, t, n, i) { if (D.isUndefined(e)) throw "The source of the new link is not set."; if (D.isUndefined(t)) throw "The target of the new link is not set."; var o, a; o = D.isString(e) ? new b(e) : e, a = D.isString(t) ? new b(t) : t, this.source = o, this.target = a, this.source.links.push(this), this.target.links.push(this), this.source.outgoing.push(this), this.target.incoming.push(this), this.id = D.isDefined(n) ? n : r(), this.associatedConnection = D.isDefined(i) ? i : null, this.type = "Link", this.shortForm = "Link '" + this.source.id + "->" + this.target.id + "'" }, getComplement: function (e) { if (this.source !== e && this.target !== e) throw "The given node is not incident with this link."; return this.source === e ? this.target : this.source }, getCommonNode: function (e) { return this.source === e.source || this.source === e.target ? this.source : this.target === e.source || this.target === e.target ? this.target : null }, isBridging: function (e, t) { return this.source === e && this.target === t || this.source === t && this.target === e }, getNodes: function () { return [this.source, this.target] }, incidentWith: function (e) { return this.source === e || this.target === e }, adjacentTo: function (e) { return I(this.source.links, e) || I(this.target.links, e) }, changeSource: function (e) { D.remove(this.source.links, this), D.remove(this.source.outgoing, this), e.links.push(this), e.outgoing.push(this), this.source = e }, changeTarget: function (e) { D.remove(this.target.links, this), D.remove(this.target.incoming, this), e.links.push(this), e.incoming.push(this), this.target = e }, changesNodes: function (e, t) { this.source === e ? this.changeSource(t) : this.target === e && this.changeTarget(t) }, reverse: function () { var e = this.source, t = this.target; return this.source = t, D.remove(e.outgoing, this), this.source.outgoing.push(this), this.target = e, D.remove(t.incoming, this), this.target.incoming.push(this), this }, directTo: function (e) { if (this.source !== e && this.target !== e) throw "The given node is not incident with this link."; this.target !== e && this.reverse() }, createReverseEdge: function () { var e = this.clone(); return e.reverse(), e.reversed = !0, e }, clone: function () { var e = new w(this.source, this.target); return e } }), k = y.Class.extend({ init: function (e) { this.links = [], this.nodes = [], this._nodeMap = new m, this.diagram = null, this._root = null, D.isDefined(e) ? D.isString(e) ? this.id = e : (this.diagram = e, this.id = e.id) : this.id = r(), this.bounds = new s, this._hasCachedRelationships = !1, this.type = "Graph" }, cacheRelationships: function (e) { var t, n, i; if (D.isUndefined(e) && (e = !1), !this._hasCachedRelationships || e) { for (t = 0, n = this.nodes.length; t < n; t++)i = this.nodes[t], i.children = this.getChildren(i), i.parents = this.getParents(i); this._hasCachedRelationships = !0 } }, assignLevels: function (e, t, n) { var i, o, r, a; if (!e) throw "Start node not specified."; for (D.isUndefined(t) && (t = 0), this.cacheRelationships(), D.isUndefined(n) && (n = new m, D.forEach(this.nodes, function (e) { n.add(e, !1) })), n.set(e, !0), e.level = t, i = e.children, o = 0, r = i.length; o < r; o++)a = i[o], a && !n.get(a) && this.assignLevels(a, t + 1, n) }, root: function (e) { if (D.isUndefined(e)) { if (this._root) return this._root; var t = D.first(this.nodes, function (e) { return 0 === e.incoming.length }); return t ? t : D.first(this.nodes) } this._root = e }, getConnectedComponents: function () { var e, t, n, i, o; for (this.componentIndex = 0, this.setItemIndices(), e = D.initArray(this.nodes.length, -1), t = 0; t < this.nodes.length; t++)e[t] === -1 && (this._collectConnectedNodes(e, t), this.componentIndex++); for (n = [], i = 0; i < this.componentIndex; ++i)n[i] = new k; for (i = 0; i < e.length; ++i)o = n[e[i]], o.addNodeAndOutgoings(this.nodes[i]); return n.sort(function (e, t) { return t.nodes.length - e.nodes.length }), n }, _collectConnectedNodes: function (e, t) { e[t] = this.componentIndex; var n = this.nodes[t]; D.forEach(n.links, function (t) { var i = t.getComplement(n), o = i.index; e[o] === -1 && this._collectConnectedNodes(e, o) }, this) }, calcBounds: function () { var e, t, n, i; if (this.isEmpty()) return this.bounds = new s; for (e = null, t = 0, n = this.nodes.length; t < n; t++)i = this.nodes[t], e = e ? e.union(i.bounds()) : i.bounds(); return this.bounds = e }, getSpanningTree: function (e) { var t, n, i, o, r, a, s, l, d, c, u, h, p = new k, f = new m; for (p.root = e.clone(), p.root.level = 0, p.root.id = e.id, f.add(e, p.root), e.level = 0, i = [], o = [], p._addNode(p.root), i.push(e), o.push(e), r = 1; o.length > 0;)for (a = o.pop(), s = 0; s < a.links.length; s++)l = a.links[s], d = l.getComplement(a), I(i, d) || (d.level = a.level + 1, r < d.level + 1 && (r = d.level + 1), I(o, d) || o.push(d), I(i, d) || i.push(d), f.containsKey(a) ? t = f.get(a) : (t = a.clone(), t.level = a.level, t.id = a.id, f.add(a, t)), f.containsKey(d) ? n = f.get(d) : (n = d.clone(), n.level = d.level, n.id = d.id, f.add(d, n)), c = new w(t, n), p.addLink(c)); for (u = [], h = 0; h < r; h++)u.push([]); return D.forEach(p.nodes, function (e) { u[e.level].push(e) }), p.treeLevels = u, p.cacheRelationships(), p }, takeRandomNode: function (t, n) { if (D.isUndefined(t) && (t = []), D.isUndefined(n) && (n = 4), 0 === this.nodes.length) return null; if (1 === this.nodes.length) return I(t, this.nodes[0]) ? null : this.nodes[0]; var i = e.grep(this.nodes, function (e) { return !I(t, e) && e.degree() <= n }); return D.isEmpty(i) ? null : i[D.randomInteger(0, i.length)] }, isEmpty: function () { return D.isEmpty(this.nodes) }, isHealthy: function () { return D.all(this.links, function (e) { return I(this.nodes, e.source) && I(this.nodes, e.target) }, this) }, getParents: function (e) { if (!this.hasNode(e)) throw "The given node is not part of this graph."; return e.getParents() }, getChildren: function (e) { if (!this.hasNode(e)) throw "The given node is not part of this graph."; return e.getChildren() }, addLink: function (e, n, i) { var o, r, a; if (D.isUndefined(e)) throw "The source of the link is not defined."; if (D.isUndefined(n)) { if (D.isDefined(e.type) && "Link" === e.type) return this.addExistingLink(e), t; throw "The target of the link is not defined." } return o = this.getNode(e), D.isUndefined(o) && (o = this.addNode(e)), r = this.getNode(n), D.isUndefined(r) && (r = this.addNode(n)), a = new w(o, r), D.isDefined(i) && (a.owner = i), this.links.push(a), a }, removeAllLinks: function () { for (; this.links.length > 0;) { var e = this.links[0]; this.removeLink(e) } }, addExistingLink: function (e) { var t, n; this.hasLink(e) || (this.links.push(e), this.hasNode(e.source.id) ? (t = this.getNode(e.source.id), e.changeSource(t)) : this.addNode(e.source), this.hasNode(e.target.id) ? (n = this.getNode(e.target.id), e.changeTarget(n)) : this.addNode(e.target)) }, hasLink: function (e) { if (D.isString(e)) return D.any(this.links, function (t) { return t.id === e }); if ("Link" === e.type) return I(this.links, e); throw "The given object is neither an identifier nor a Link." }, getNode: function (e) { var t = e.id || e; if (this._nodeMap.containsKey(t)) return this._nodeMap.get(t) }, hasNode: function (e) { var t = e.id || e; return this._nodeMap.containsKey(t) }, _addNode: function (e) { this.nodes.push(e), this._nodeMap.add(e.id, e) }, _removeNode: function (e) { D.remove(this.nodes, e), this._nodeMap.remove(e.id) }, removeNode: function (e) { var t, n, i, o, r = e; if (D.isString(e) && (r = this.getNode(e)), !D.isDefined(r)) throw "The identifier should be a Node or the Id (string) of a node."; for (t = r.links, r.links = [], n = 0, i = t.length; n < i; n++)o = t[n], this.removeLink(o); this._removeNode(r) }, areConnected: function (e, t) { return D.any(this.links, function (n) { return n.source == e && n.target == t || n.source == t && n.target == e }) }, removeLink: function (e) { D.remove(this.links, e), D.remove(e.source.outgoing, e), D.remove(e.source.links, e), D.remove(e.target.incoming, e), D.remove(e.target.links, e) }, addNode: function (e, t, n) { var i = null; if (!D.isDefined(e)) throw "No Node or identifier for a new Node is given."; if (D.isString(e)) { if (this.hasNode(e)) return this.getNode(e); i = new b(e) } else { if (this.hasNode(e)) return this.getNode(e); i = e } return D.isDefined(t) && i.bounds(t), D.isDefined(n) && (i.owner = n), this._addNode(i), i }, addNodeAndOutgoings: function (e) { this.hasNode(e) || this._addNode(e); var t = e.outgoing; e.outgoing = [], D.forEach(t, function (e) { this.addExistingLink(e) }, this) }, setItemIndices: function () { var e; for (e = 0; e < this.nodes.length; ++e)this.nodes[e].index = e; for (e = 0; e < this.links.length; ++e)this.links[e].index = e }, clone: function (e) { var t, n = new k, i = D.isDefined(e) && e === !0; return i && (n.nodeMap = new m, n.linkMap = new m), t = new m, D.forEach(this.nodes, function (e) { var o = e.clone(); t.set(e, o), n._addNode(o), i && n.nodeMap.set(o, e) }), D.forEach(this.links, function (e) { if (t.containsKey(e.source) && t.containsKey(e.target)) { var o = n.addLink(t.get(e.source), t.get(e.target)); i && n.linkMap.set(o, e) } }), n }, linearize: function (e) { return k.Utils.linearize(this, e) }, depthFirstTraversal: function (e, t) { var n, i; if (D.isUndefined(e)) throw "You need to supply a starting node."; if (D.isUndefined(t)) throw "You need to supply an action."; if (!this.hasNode(e)) throw "The given start-node is not part of this graph"; n = this.getNode(e), i = [], this._dftIterator(n, t, i) }, _dftIterator: function (e, t, n) { var i, o, r, a; for (t(e), n.push(e), i = e.getChildren(), o = 0, r = i.length; o < r; o++)a = i[o], I(n, a) || this._dftIterator(a, t, n) }, breadthFirstTraversal: function (e, t) { var n, i, o, r, a, s, l, d; if (D.isUndefined(e)) throw "You need to supply a starting node."; if (D.isUndefined(t)) throw "You need to supply an action."; if (!this.hasNode(e)) throw "The given start-node is not part of this graph"; for (n = this.getNode(e), i = new v, o = [], i.enqueue(n); i.length > 0;)for (r = i.dequeue(), t(r), o.push(r), a = r.getChildren(), s = 0, l = a.length; s < l; s++)d = a[s], I(o, d) || I(i, d) || i.enqueue(d) }, _stronglyConnectedComponents: function (e, t, n, i, o, r, a) { var s, l, d, c, u; for (n.add(t, a), i.add(t, a), a++, r.push(t), s = t.getChildren(), d = 0, c = s.length; d < c; d++)l = s[d], n.containsKey(l) ? I(r, l) && i.add(t, Math.min(i.get(t), n.get(l))) : (this._stronglyConnectedComponents(e, l, n, i, o, r, a), i.add(t, Math.min(i.get(t), i.get(l)))); if (i.get(t) === n.get(t)) { u = []; do l = r.pop(), u.push(l); while (l !== t); (!e || u.length > 1) && o.push(u) } }, findCycles: function (e) { var t, n, i, o, r, a, s; for (D.isUndefined(e) && (e = !0), t = new m, n = new m, i = [], o = [], r = 0, a = this.nodes.length; r < a; r++)s = this.nodes[r], t.containsKey(s) || this._stronglyConnectedComponents(e, s, t, n, i, o, 0); return i }, isAcyclic: function () { return D.isEmpty(this.findCycles()) }, isSubGraph: function (e) { var t = e.linearize(), n = this.linearize(); return D.all(t, function (e) { return I(n, e) }) }, makeAcyclic: function () { var e, t, n, i, o, r, a, s, l, d, c, u, h, p, f, g, v, _, b, w, k, y, x, C, S, T, A, E, I, M, R, F; if (this.isEmpty() || this.nodes.length <= 1 || this.links.length <= 1) return []; if (2 == this.nodes.length) { if (e = [], this.links.length > 1) for (t = this.links[0], n = t.source, i = 0, o = this.links.length; i < o; i++)r = this.links[i], r.source != n && (a = r.reverse(), e.push(a)); return e } for (s = this.clone(!0), l = this.nodes.length, d = new m, c = function (e) { return 0 === e.outgoing.length ? 2 - l : 0 === e.incoming.length ? l - 2 : e.outgoing.length - e.incoming.length }, u = function (e, t) { var n = c(e, l); t.containsKey(n) || t.set(n, []), t.get(n).push(e) }, D.forEach(s.nodes, function (e) { u(e, d) }), h = [], p = []; s.nodes.length > 0;) { if (d.containsKey(2 - l)) for (_ = d.get(2 - l); _.length > 0;) { for (g = _.pop(), b = 0; b < g.links.length; b++)w = g.links[b], f = w.getComplement(g), v = c(f, l), D.remove(d.get(v), f), f.removeLink(w), u(f, d); s._removeNode(g), p.unshift(g) } if (d.containsKey(l - 2)) for (k = d.get(l - 2); k.length > 0;) { for (f = k.pop(), y = 0; y < f.links.length; y++)x = f.links[y], g = x.getComplement(f), v = c(g, l), D.remove(d.get(v), g), g.removeLink(x), u(g, d); h.push(f), s._removeNode(f) } if (s.nodes.length > 0) for (C = l - 3; C > 2 - l; C--)if (d.containsKey(C) && d.get(C).length > 0) { for (S = d.get(C), T = S.pop(), A = 0; A < T.links.length; A++)E = T.links[A], I = E.getComplement(T), v = c(I, l), D.remove(d.get(v), I), I.removeLink(E), u(I, d); h.push(T), s._removeNode(T); break } } for (h = h.concat(p), M = new m, R = 0; R < this.nodes.length; R++)M.set(s.nodeMap.get(h[R]), R); return F = [], D.forEach(this.links, function (e) { M.get(e.source) > M.get(e.target) && (e.reverse(), F.push(e)) }), F } }), k.Predefined = { EightGraph: function () { return k.Utils.parse(["1->2", "2->3", "3->4", "4->1", "3->5", "5->6", "6->7", "7->3"]) }, Mindmap: function () { return k.Utils.parse(["0->1", "0->2", "0->3", "0->4", "0->5", "1->6", "1->7", "7->8", "2->9", "9->10", "9->11", "3->12", "12->13", "13->14", "4->15", "4->16", "15->17", "15->18", "18->19", "18->20", "14->21", "14->22", "5->23", "23->24", "23->25", "6->26"]) }, ThreeGraph: function () { return k.Utils.parse(["1->2", "2->3", "3->1"]) }, BinaryTree: function (e) { return D.isUndefined(e) && (e = 5), k.Utils.createBalancedTree(e, 2) }, Linear: function (e) { return D.isUndefined(e) && (e = 10), k.Utils.createBalancedTree(e, 1) }, Tree: function (e, t) { return k.Utils.createBalancedTree(e, t) }, Forest: function (e, t, n) { return k.Utils.createBalancedForest(e, t, n) }, Workflow: function () { return k.Utils.parse(["0->1", "1->2", "2->3", "1->4", "4->3", "3->5", "5->6", "6->3", "6->7", "5->4"]) }, Grid: function (e, t) { var n, i, o, r, a, s = new x.Graph; if (e <= 0 && t <= 0) return s; for (n = 0; n < e + 1; n++)for (i = null, o = 0; o < t + 1; o++)r = new b("" + n + "." + o), s.addNode(r), i && s.addLink(i, r), n > 0 && (a = s.getNode("" + (n - 1) + "." + o), s.addLink(a, r)), i = r; return s } }, k.Utils = {
parse: function (e) { var t, n, i, o, r, a = new x.Graph, s = e.slice(); for (n = 0, i = s.length; n < i; n++) { if (o = s[n], D.isString(o)) { if (o.indexOf("->") < 0) throw "The link should be specified as 'a->b'."; if (r = o.split("->"), 2 != r.length) throw "The link should be specified as 'a->b'."; t = new w(r[0], r[1]), a.addLink(t) } if (D.isObject(o)) { if (!t) throw "Specification found before Link definition."; y.deepExtend(t, o) } } return a }, linearize: function (e, t) { var n, i, o, r; if (D.isUndefined(e)) throw "Expected an instance of a Graph object in slot one."; for (D.isUndefined(t) && (t = !1), n = [], i = 0, o = e.links.length; i < o; i++)r = e.links[i], n.push(r.source.id + "->" + r.target.id), t && n.push({ id: r.id }); return n }, _addShape: function (e, t, n, i) { return D.isUndefined(t) && (t = new x.Point(0, 0)), D.isUndefined(n) && (n = r()), i = y.deepExtend({ width: 20, height: 20, id: n, radius: 10, fill: "#778899", data: "circle", undoable: !1, x: t.x, y: t.y }, i), e.addShape(i) }, _addConnection: function (e, t, n, i) { return e.connect(t, n, i) }, createDiagramFromGraph: function (e, t, n, i) { var o, r, a, l, d, c, u, h, p, f, g, m, v, _, b, w; if (D.isUndefined(e)) throw "The diagram surface is undefined."; if (D.isUndefined(t)) throw "No graph specification defined."; for (D.isUndefined(n) && (n = !0), D.isUndefined(i) && (i = !1), o = e.element.clientWidth || 200, r = e.element.clientHeight || 200, a = [], c = 0, u = t.nodes.length; c < u; c++)l = t.nodes[c], h = l.position, D.isUndefined(h) && (h = D.isDefined(l.x) && D.isDefined(l.y) ? new A(l.x, l.y) : new A(D.randomInteger(10, o - 20), D.randomInteger(10, r - 20))), p = {}, "0" === l.id || i && y.deepExtend(p, { width: 150 * Math.random() + 20, height: 80 * Math.random() + 50, data: "rectangle", fill: { color: "#778899" } }), d = this._addShape(e, h, l.id, p), f = d.bounds(), D.isDefined(f) && (l.x = f.x, l.y = f.y, l.width = f.width, l.height = f.height), a[l.id] = d; for (g = 0; g < t.links.length; g++)m = t.links[g], v = a[m.source.id], D.isUndefined(v) || (_ = a[m.target.id], D.isUndefined(_) || this._addConnection(e, v, _, { id: m.id })); if (n) for (b = new e.SpringLayout(e), b.layoutGraph(t, { limitToView: !1 }), w = 0; w < t.nodes.length; w++)l = t.nodes[w], d = a[l.id], d.bounds(new s(l.x, l.y, l.width, l.height)) }, createBalancedTree: function (e, t) { var n, i, o, r, a, s, l, d, c, u; if (D.isUndefined(e) && (e = 3), D.isUndefined(t) && (t = 3), n = new x.Graph, i = -1, o = [], e <= 0 || t <= 0) return n; for (a = new b("" + ++i), n.addNode(a), n.root = a, o.push(a), s = 0; s < e; s++) { for (r = [], l = 0; l < o.length; l++)for (d = o[l], c = 0; c < t; c++)u = new b("" + ++i), n.addLink(d, u), r.push(u); o = r } return n }, createBalancedForest: function (e, t, n) { var i, o, r, a, s, l, d, c, u, h, p; if (D.isUndefined(e) && (e = 3), D.isUndefined(t) && (t = 3), D.isUndefined(n) && (n = 5), i = new x.Graph, o = -1, r = [], e <= 0 || t <= 0 || n <= 0) return i; for (s = 0; s < n; s++)for (l = new b("" + ++o), i.addNode(l), r = [l], d = 0; d < e; d++) { for (a = [], c = 0; c < r.length; c++)for (u = r[c], h = 0; h < t; h++)p = new b("" + ++o), i.addLink(u, p), a.push(p); r = a } return i }, createRandomConnectedGraph: function (e, t, n) {
var i, o, r, a, s, l, d, c, u, h; if (D.isUndefined(e) && (e = 40), D.isUndefined(t) && (t = 4), D.isUndefined(n) && (n = !1), i = new x.Graph, o = -1, e <= 0) return i; if (r = new b("" + ++o), i.addNode(r), 1 === e) return i; if (e > 1) {
for (a = 1; a < e && (s = i.takeRandomNode([], t), s); a++)l = i.addNode("" + a), i.addLink(s, l); if (!n && e > 1) for (d = D.randomInteger(1, e), c = 0; c < d; c++)u = i.takeRandomNode([], t), h = i.takeRandomNode([], t), u && h && !i.areConnected(u, h) && i.addLink(u, h);
return i
}
}, randomDiagram: function (e, t, n, i, o) { var r = y.dataviz.diagram.Graph.Utils.createRandomConnectedGraph(t, n, i); k.Utils.createDiagramFromGraph(e, r, !1, o) }
}, y.deepExtend(x, { init: function (e) { y.init(e, x.ui) }, Point: A, Intersect: d, Geometry: f, Rect: s, Size: l, RectAlign: c, Matrix: h, MatrixVector: p, normalVariable: o, randomId: r, Dictionary: m, HashTable: g, Queue: v, Set: _, Node: b, Link: w, Graph: k, PathDefiner: a })
}(window.kendo.jQuery)
}, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("dataviz/diagram/svg.min", ["kendo.drawing.min", "dataviz/diagram/math.min"], e) }(function () { !function (e, t) { function n(e, t) { var n, i, o, r = this.options, a = !1; for (o = 0; o < t.length; o++)i = t[o], n = e[i], H(n) && r[i] !== n && (r[i] = n, a = !0); return a } function i(e) { return { x: e.x || 0, y: e.y || 0, width: e.width || 0, height: e.height || 0 } } function o(e) { if (e) { var t = e; return N(t) && (t = { color: t }), t.color && (t.color = r(t.color)), t } } function r(e) { var t; return t = e != q ? new W.Color(e).toHex() : e } function a(e, t) { var n = t.x - e.x, i = t.y - e.y, o = W.util.deg(Math.atan2(i, n)); return o } function s(e, t) { return new W.Segment(new V.Point(e, t)) } function l(e) { if (e) return new V.Rect([e.x, e.y], [e.width, e.height]) } var d, c, u, h, p, f, g, m, v, _, b, w, k, y, x, C, S, T, D, A, E, I = window.kendo, M = I.dataviz.diagram, R = I.Class, F = I.deepExtend, P = M.Point, z = M.Rect, B = M.Matrix, L = M.Utils, H = L.isNumber, N = L.isString, O = M.MatrixVector, V = I.geometry, W = I.drawing, U = W.util.defined, j = e.inArray, q = "transparent", G = { none: "none", arrowStart: "ArrowStart", filledCircle: "FilledCircle", arrowEnd: "ArrowEnd" }, $ = 360, K = "start", Y = "end", Q = "width", X = "height", J = "x", Z = "y"; M.Markers = G, d = R.extend({ init: function (e, t) { this.x = e, this.y = t }, toMatrix: function () { return B.scaling(this.x, this.y) }, toString: function () { return I.format("scale({0},{1})", this.x, this.y) }, invert: function () { return new d(1 / this.x, 1 / this.y) } }), c = R.extend({ init: function (e, t) { this.x = e, this.y = t }, toMatrixVector: function () { return new O(0, 0, 0, 0, this.x, this.y) }, toMatrix: function () { return B.translation(this.x, this.y) }, toString: function () { return I.format("translate({0},{1})", this.x, this.y) }, plus: function (e) { this.x += e.x, this.y += e.y }, times: function (e) { this.x *= e, this.y *= e }, length: function () { return Math.sqrt(this.x * this.x + this.y * this.y) }, normalize: function () { 0 !== this.Length && this.times(1 / this.length()) }, invert: function () { return new c((-this.x), (-this.y)) } }), u = R.extend({ init: function (e, t, n) { this.x = t || 0, this.y = n || 0, this.angle = e }, toString: function () { return this.x && this.y ? I.format("rotate({0},{1},{2})", this.angle, this.x, this.y) : I.format("rotate({0})", this.angle) }, toMatrix: function () { return B.rotation(this.angle, this.x, this.y) }, center: function () { return new P(this.x, this.y) }, invert: function () { return new u($ - this.angle, this.x, this.y) } }), u.ZERO = new u(0), u.create = function (e) { return new u(e.angle, e.x, e.y) }, u.parse = function (e) { var t = e.slice(1, e.length - 1).split(","), n = t[0], i = t[1], o = t[2], r = new u(n, i, o); return r }, h = R.extend({ init: function (e, n, i, o, r, a) { this.translate = new c(e, n), i !== t && o !== t && (this.scale = new d(i, o)), r !== t && (this.rotate = a ? new u(r, a.x, a.y) : new u(r)) }, toString: function () { var e = function (e) { return e ? "" + e : "" }; return e(this.translate) + e(this.rotate) + e(this.scale) }, render: function (e) { e._transform = this, e._renderTransform() }, toMatrix: function () { var e = B.unit(); return this.translate && (e = e.times(this.translate.toMatrix())), this.rotate && (e = e.times(this.rotate.toMatrix())), this.scale && (e = e.times(this.scale.toMatrix())), e }, invert: function () { var e, n, i = this.rotate ? this.rotate.invert() : t, o = i ? i.toMatrix() : B.unit(), r = this.scale ? this.scale.invert() : t, a = r ? r.toMatrix() : B.unit(), s = new P((-this.translate.x), (-this.translate.y)); return s = o.times(a).apply(s), e = new c(s.x, s.y), n = new h, n.translate = e, n.rotate = i, n.scale = r, n } }), p = { _setScale: function () { var e = this.options, t = this._originWidth, n = this._originHeight, i = e.width / t, o = e.height / n; H(i) || (i = 1), H(o) || (o = 1), this._transform.scale = new d(i, o) }, _setTranslate: function () { var e = this.options, t = e.x || 0, n = e.y || 0; this._transform.translate = new c(t, n) }, _initSize: function () { var e = this.options, t = !1; e.autoSize !== !1 && (U(e.width) || U(e.height)) && (this._measure(!0), this._setScale(), t = !0), (U(e.x) || U(e.y)) && (this._setTranslate(), t = !0), t && this._renderTransform() }, _updateSize: function (e) { var t = !1; return this.options.autoSize !== !1 && this._diffNumericOptions(e, [Q, X]) && (t = !0, this._measure(!0), this._setScale()), this._diffNumericOptions(e, [J, Z]) && (t = !0, this._setTranslate()), t && this._renderTransform(), t } }, f = R.extend({ init: function (e) { var t = this; t.options = F({}, t.options, e), t.id = t.options.id, t._originSize = z.empty(), t._transform = new h }, visible: function (e) { return this.drawingContainer().visible(e) }, redraw: function (e) { e && e.id && (this.id = e.id) }, position: function (e, n) { var i = this.options; return U(e) ? (U(n) ? (i.x = e, i.y = n) : e instanceof P && (i.x = e.x, i.y = e.y), this._transform.translate = new c(i.x, i.y), this._renderTransform(), t) : new P(i.x, i.y) }, rotate: function (e, t) { return U(e) && (this._transform.rotate = new u(e, t.x, t.y), this._renderTransform()), this._transform.rotate || u.ZERO }, drawingContainer: function () { return this.drawingElement }, _renderTransform: function () { var e = this._transform.toMatrix(); this.drawingContainer().transform(new V.Matrix(e.a, e.b, e.c, e.d, e.e, e.f)) }, _hover: function () { }, _diffNumericOptions: n, _measure: function (e) { var t, n, i; return !this._measured || e ? (n = this._boundingBox() || new V.Rect, i = n.topLeft(), t = new z(i.x, i.y, n.width(), n.height()), this._originSize = t, this._originWidth = t.width, this._originHeight = t.height, this._measured = !0) : t = this._originSize, t }, _boundingBox: function () { return this.drawingElement.rawBBox() } }), g = f.extend({ init: function (e) { f.fn.init.call(this, e), e = this.options, e.fill = o(e.fill), e.stroke = o(e.stroke) }, options: { stroke: { color: "gray", width: 1 }, fill: { color: q } }, fill: function (e, t) { this._fill({ color: r(e), opacity: t }) }, stroke: function (e, t, n) { this._stroke({ color: r(e), width: t, opacity: n }) }, redraw: function (e) { var t, n; e && (t = e.stroke, n = e.fill, t && this._stroke(o(t)), n && this._fill(o(n)), f.fn.redraw.call(this, e)) }, _hover: function (e) { var t, n = this.drawingElement, i = this.options, r = i.hover; r && r.fill && (t = e ? o(r.fill) : i.fill, n.fill(t.color, t.opacity)) }, _stroke: function (e) { var t, n = this.options; F(n, { stroke: e }), e = n.stroke, t = null, e.width > 0 && (t = { color: e.color, width: e.width, opacity: e.opacity, dashType: e.dashType }), this.drawingElement.options.set("stroke", t) }, _fill: function (e) { var t, n, i, o = this.options; F(o, { fill: e || {} }), t = o.fill, t.gradient ? (n = t.gradient, i = "radial" === n.type ? W.RadialGradient : W.LinearGradient, this.drawingElement.fill(new i(n))) : this.drawingElement.fill(t.color, t.opacity) } }), m = g.extend({ init: function (e) { e = this._textColor(e), g.fn.init.call(this, e), this._font(), this._initText(), this._initSize() }, options: { fontSize: 15, fontFamily: "sans-serif", stroke: { width: 0 }, fill: { color: "black" }, autoSize: !0 }, _initText: function () { var e = this.options; this.drawingElement = new W.Text(U(e.text) ? e.text : "", new V.Point, { font: e.font }), this._fill(), this._stroke() }, _textColor: function (e) { return e && e.color && (e = F({}, e, { fill: { color: e.color } })), e }, _font: function () { var e, t = this.options; t.fontFamily && U(t.fontSize) ? (e = [], t.fontStyle && e.push(t.fontStyle), t.fontWeight && e.push(t.fontWeight), e.push(t.fontSize + (H(t.fontSize) ? "px" : "")), e.push(t.fontFamily), t.font = e.join(" ")) : delete t.font }, content: function (e) { return this.drawingElement.content(e) }, redraw: function (e) { var t, n; e && (t = !1, n = this.options, e = this._textColor(e), g.fn.redraw.call(this, e), (e.fontFamily || U(e.fontSize) || e.fontStyle || e.fontWeight) && (F(n, { fontFamily: e.fontFamily, fontSize: e.fontSize, fontStyle: e.fontStyle, fontWeight: e.fontWeight }), this._font(), this.drawingElement.options.set("font", n.font), t = !0), e.text && (this.content(e.text), t = !0), !this._updateSize(e) && t && this._initSize()) } }), F(m.fn, p), v = g.extend({ init: function (e) { g.fn.init.call(this, e), this._initPath(), this._setPosition() }, _setPosition: function () { var e = this.options, t = e.x, n = e.y; (U(t) || U(n)) && this.position(t || 0, n || 0) }, redraw: function (e) { e && (g.fn.redraw.call(this, e), this._diffNumericOptions(e, [Q, X]) && this._drawPath(), this._diffNumericOptions(e, [J, Z]) && this._setPosition()) }, _initPath: function () { var e = this.options; this.drawingElement = new W.Path({ stroke: e.stroke, closed: !0 }), this._fill(), this._drawPath() }, _drawPath: function () { var e = this.drawingElement, t = i(this.options), n = t.width, o = t.height; e.segments.elements([s(0, 0), s(n, 0), s(n, o), s(0, o)]) } }), _ = g.extend({ init: function (e) { g.fn.init.call(this, e); var t = this.options.anchor; this.anchor = new V.Point(t.x, t.y), this.createElement() }, options: { stroke: { color: q, width: 0 }, fill: { color: "black" } }, _transformToPath: function (e, t) { var n = t.transform(); return e && n && (e = e.transformCopy(n)), e }, redraw: function (e) { e && (e.position && (this.options.position = e.position), g.fn.redraw.call(this, e)) } }), b = _.extend({ options: { radius: 4, anchor: { x: 0, y: 0 } }, createElement: function () { var e = this.options; this.drawingElement = new W.Circle(new V.Circle(this.anchor, e.radius), { fill: e.fill, stroke: e.stroke }) }, positionMarker: function (e) { var t, n, i = this.options, o = i.position, r = e.segments; t = o == K ? r[0] : r[r.length - 1], t && (n = this._transformToPath(t.anchor(), e), this.drawingElement.transform(V.transform().translate(n.x, n.y))) } }), w = _.extend({ options: { path: "M 0 0 L 10 5 L 0 10 L 3 5 z", anchor: { x: 10, y: 5 } }, createElement: function () { var e = this.options; this.drawingElement = W.Path.parse(e.path, { fill: e.fill, stroke: e.stroke }) }, positionMarker: function (e) { var t, n, i = this._linePoints(e), o = i.start, r = i.end, s = V.transform(); o && s.rotate(a(o, r), r), r && (t = this.anchor, n = r.clone().translate(-t.x, -t.y), s.translate(n.x, n.y)), this.drawingElement.transform(s) }, _linePoints: function (e) { var t, n, i, o, r, a = this.options, s = e.segments; if (a.position == K ? (i = s[0], i && (n = i.anchor(), t = i.controlOut(), o = s[1], !t && o && (t = o.anchor()))) : (i = s[s.length - 1], i && (n = i.anchor(), t = i.controlIn(), r = s[s.length - 2], !t && r && (t = r.anchor()))), n) return { start: this._transformToPath(t, e), end: this._transformToPath(n, e) } } }), k = { _getPath: function (e) { var t = this.drawingElement; if (t instanceof W.MultiPath && (t = e == K ? t.paths[0] : t.paths[t.paths.length - 1]), t && t.segments.length) return t }, _normalizeMarkerOptions: function (e) { var t = e.startCap, n = e.endCap; N(t) && (e.startCap = { type: t }), N(n) && (e.endCap = { type: n }) }, _removeMarker: function (e) { var t = this._markers[e]; t && (this.drawingContainer().remove(t.drawingElement), delete this._markers[e]) }, _createMarkers: function () { var e = this.options; this._normalizeMarkerOptions(e), this._markers = {}, this._markers[K] = this._createMarker(e.startCap, K), this._markers[Y] = this._createMarker(e.endCap, Y) }, _createMarker: function (e, n) { var i, o, r = (e || {}).type, a = this._getPath(n); return a ? (r == G.filledCircle ? i = b : r == G.arrowStart || r == G.arrowEnd ? i = w : this._removeMarker(n), i ? (o = new i(F({}, e, { position: n })), o.positionMarker(a), this.drawingContainer().append(o.drawingElement), o) : t) : (this._removeMarker(n), t) }, _positionMarker: function (e) { var t, n = this._markers[e]; n && (t = this._getPath(e), t ? n.positionMarker(t) : this._removeMarker(e)) }, _capMap: { start: "startCap", end: "endCap" }, _redrawMarker: function (e, t, n) { var i, o, r, a, s; return this._normalizeMarkerOptions(n), i = this.options, o = this._capMap[t], r = (i[o] || {}).type, a = n[o], s = !1, a ? (i[o] = F({}, i[o], a), a.type && r != a.type ? (this._removeMarker(t), this._markers[t] = this._createMarker(i[o], t), s = !0) : this._markers[t] && this._markers[t].redraw(a)) : e && !this._markers[t] && i[o] && (this._markers[t] = this._createMarker(i[o], t), s = !0), s }, _redrawMarkers: function (e, t) { !this._redrawMarker(e, K, t) && e && this._positionMarker(K), !this._redrawMarker(e, Y, t) && e && this._positionMarker(Y) } }, y = g.extend({ init: function (e) { g.fn.init.call(this, e), this.container = new W.Group, this._createElements(), this._initSize() }, options: { autoSize: !0 }, drawingContainer: function () { return this.container }, data: function (e) { var n = this.options; return e ? (n.data != e && (n.data = e, this._setData(e), this._initSize(), this._redrawMarkers(!0, {})), t) : n.data }, redraw: function (e) { var t, n; e && (g.fn.redraw.call(this, e), t = this.options, n = e.data, U(n) && t.data != n ? (t.data = n, this._setData(n), this._updateSize(e) || this._initSize(), this._redrawMarkers(!0, e)) : (this._updateSize(e), this._redrawMarkers(!1, e))) }, _createElements: function () { var e = this.options; this.drawingElement = W.Path.parse(e.data || "", { stroke: e.stroke }), this._fill(), this.container.append(this.drawingElement), this._createMarkers() }, _setData: function (e) { var t = this.drawingElement, n = W.Path.parse(e || ""), i = n.paths.slice(0); n.paths.elements([]), t.paths.elements(i) } }), F(y.fn, p), F(y.fn, k), x = g.extend({ init: function (e) { g.fn.init.call(this, e), this.container = new W.Group, this._initPath(), this._createMarkers() }, drawingContainer: function () { return this.container }, redraw: function (e) { var t, n; e && (e = e || {}, t = e.from, n = e.to, t && (this.options.from = t), n && (this.options.to = n), t || n ? (this._drawPath(), this._redrawMarkers(!0, e)) : this._redrawMarkers(!1, e), g.fn.redraw.call(this, e)) }, _initPath: function () { var e = this.options, t = this.drawingElement = new W.Path({ stroke: e.stroke }); this._fill(), this._drawPath(), this.container.append(t) }, _drawPath: function () { var e = this.options, t = this.drawingElement, n = e.from || new P, i = e.to || new P; t.segments.elements([s(n.x, n.y), s(i.x, i.y)]) } }), F(x.fn, k), C = g.extend({ init: function (e) { g.fn.init.call(this, e), this.container = new W.Group, this._initPath(), this._createMarkers() }, drawingContainer: function () { return this.container }, points: function (e) { var n = this.options; return e ? (n.points = e, this._updatePath(), t) : n.points }, redraw: function (e) { if (e) { var t = e.points; g.fn.redraw.call(this, e), t && this._pointsDiffer(t) ? (this.points(t), this._redrawMarkers(!0, e)) : this._redrawMarkers(!1, e) } }, _initPath: function () { var e = this.options; this.drawingElement = new W.Path({ stroke: e.stroke }), this._fill(), this.container.append(this.drawingElement), e.points && this._updatePath() }, _pointsDiffer: function (e) { var t, n = this.options.points, i = n.length !== e.length; if (!i) for (t = 0; t < e.length; t++)if (n[t].x !== e[t].x || n[t].y !== e[t].y) { i = !0; break } return i }, _updatePath: function () { var e, t, n = this.drawingElement, i = this.options, o = i.points, r = []; for (t = 0; t < o.length; t++)e = o[t], r.push(s(e.x, e.y)); n.segments.elements(r) }, options: { points: [] } }), F(C.fn, k), S = f.extend({ init: function (e) { f.fn.init.call(this, e), this._initImage() }, redraw: function (e) { e && (e.source && this.drawingElement.src(e.source), this._diffNumericOptions(e, [Q, X, J, Z]) && this.drawingElement.rect(this._rect()), f.fn.redraw.call(this, e)) }, _initImage: function () { var e = this.options, t = this._rect(); this.drawingElement = new W.Image(e.source, t, {}) }, _rect: function () { var e = i(this.options), t = new V.Point(e.x, e.y), n = new V.Size(e.width, e.height); return new V.Rect(t, n) } }), T = f.extend({ init: function (e) { this.children = [], f.fn.init.call(this, e), this.drawingElement = new W.Group, this._initSize() }, options: { autoSize: !1 }, append: function (e) { this.drawingElement.append(e.drawingContainer()), this.children.push(e), this._childrenChange = !0 }, remove: function (e) { this._remove(e) && (this._childrenChange = !0) }, _remove: function (e) { var t = j(e, this.children); if (t >= 0) return this.drawingElement.removeAt(t), this.children.splice(t, 1), !0 }, clear: function () { this.drawingElement.clear(), this.children = [], this._childrenChange = !0 }, toFront: function (e) { var t, n; for (n = 0; n < e.length; n++)t = e[n], this._remove(t) && this.append(t) }, toBack: function (e) { this._reorderChildren(e, 0) }, toIndex: function (e, t) { this._reorderChildren(e, t) }, _reorderChildren: function (e, t) { var n, i, o, r, a, s = this.drawingElement, l = s.children.slice(0), d = this.children, c = H(t); for (n = 0; n < e.length; n++)a = e[n], r = a.drawingContainer(), i = j(a, d), i >= 0 && (l.splice(i, 1), d.splice(i, 1), o = c ? t : t[n], l.splice(o, 0, r), d.splice(o, 0, a)); s.clear(), s.append.apply(s, l) }, redraw: function (e) { e && (this._childrenChange ? (this._childrenChange = !1, this._updateSize(e) || this._initSize()) : this._updateSize(e), f.fn.redraw.call(this, e)) }, _boundingBox: function () { var e, t, n, i, o = this.children; for (i = 0; i < o.length; i++)t = o[i], t.visible() && t._includeInBBox !== !1 && (n = t.drawingContainer().clippedBBox(null), n && (e = e ? V.Rect.union(e, n) : n)); return e } }), F(T.fn, p), D = T.extend({ init: function (e, t) { this.children = [], f.fn.init.call(this, t), this.drawingElement = new W.Layout(l(e), t), this._initSize() }, rect: function (e) { if (e) this.drawingElement.rect(l(e)); else { var t = this.drawingElement.rect(); if (t) return new z(t.origin.x, t.origin.y, t.size.width, t.size.height) } }, reflow: function () { this.drawingElement.reflow() }, redraw: function (e) { I.deepExtend(this.drawingElement.options, e), T.fn.redraw.call(this, e) } }), A = g.extend({ init: function (e) { g.fn.init.call(this, e), this._initCircle(), this._initSize() }, redraw: function (e) { if (e) { var t = this.options; e.center && (F(t, { center: e.center }), this._center.move(t.center.x, t.center.y)), this._diffNumericOptions(e, ["radius"]) && this._circle.setRadius(t.radius), this._updateSize(e), g.fn.redraw.call(this, e) } }, _initCircle: function () { var e, t = this.options, n = t.width, i = t.height, o = t.radius; U(o) || (U(n) || (n = i), U(i) || (i = n), t.radius = o = Math.min(n, i) / 2), e = t.center || { x: o, y: o }, this._center = new V.Point(e.x, e.y), this._circle = new V.Circle(this._center, o), this.drawingElement = new W.Circle(this._circle, { stroke: t.stroke }), this._fill() } }), F(A.fn, p), E = R.extend({ init: function (e, t) { t = t || {}, this.element = e, this.surface = W.Surface.create(e, t), I.isFunction(this.surface.translate) && (this.translate = this._translate), this.drawingElement = new W.Group, this._viewBox = new z(0, 0, t.width, t.height), this.size(this._viewBox) }, bounds: function () { var e = this.drawingElement.clippedBBox(); return new z(0, 0, e.width(), e.height()) }, size: function (e) { var t = this._viewBox; return U(e) && (t.width = e.width, t.height = e.height, this.surface.setSize(e)), { width: t.width, height: t.height } }, _translate: function (e, t) { var n = this._viewBox; return U(e) && U(t) && (n.x = e, n.y = t, this.surface.translate({ x: e, y: t })), { x: n.x, y: n.y } }, draw: function () { this.surface.draw(this.drawingElement) }, append: function (e) { return this.drawingElement.append(e.drawingContainer()), this }, remove: function (e) { this.drawingElement.remove(e.drawingContainer()) }, insertBefore: function () { }, clear: function () { this.drawingElement.clear() }, destroy: function (t) { this.surface.destroy(), t && e(this.element).remove() } }), I.deepExtend(M, { init: function (e) { I.init(e, M.ui) }, diffNumericOptions: n, Element: f, Scale: d, Translation: c, Rotation: u, Circle: A, Group: T, Rectangle: v, Canvas: E, Path: y, Layout: D, Line: x, MarkerBase: _, ArrowMarker: w, CircleMarker: b, Polyline: C, CompositeTransform: h, TextBlock: m, Image: S, VisualBase: g }) }(window.kendo.jQuery) }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("dataviz/diagram/services.min", ["kendo.drawing.min", "dataviz/diagram/svg.min"], e) }(function () {
!function (e, t) {
function n(e, t) { return t.charCodeAt(0) == e || t.toUpperCase().charCodeAt(0) == e } function i(e, t) { var n; return e.x == -1 && e.y == -1 ? n = t.bottomRight() : 1 == e.x && 1 == e.y ? n = t.topLeft() : e.x == -1 && 1 == e.y ? n = t.topRight() : 1 == e.x && e.y == -1 ? n = t.bottomLeft() : 0 === e.x && e.y == -1 ? n = t.bottom() : 0 === e.x && 1 == e.y ? n = t.top() : 1 == e.x && 0 === e.y ? n = t.left() : e.x == -1 && 0 === e.y && (n = t.right()), n } function o(e) { var t = e.options.editable; return t && t.drag !== !1 } function r(e, t) { var n, i, o, r; for (r = 0; r < e.connectors.length; r++)if (n = e.connectors[r], i = n.position(), o = new j(i.x, i.y), o.inflate(re, re), o.contains(t)) return n } function a(e) { return e.ctrlKey === !1 && e.altKey === !1 && e.shiftKey === !1 } var s, l, d, c, u, h, p, f, g, m, v, _, b, w, k, y, x, C, S, T, D, A, E, I, M, R, F, P, z, B, L, H, N = window.kendo, O = N.dataviz, V = O.diagram, W = N.Class, U = V.Group, j = V.Rect, q = V.Rectangle, G = V.Utils, $ = G.isUndefined, K = V.Point, Y = V.Circle, Q = V.Ticker, X = N.deepExtend, J = N.ui.Movable, Z = N.support.browser, ee = N.drawing.util, te = ee.defined, ne = e.inArray, ie = e.proxy, oe = { arrow: "default", grip: "pointer", cross: "pointer", add: "pointer", move: "move", select: "pointer", south: "s-resize", east: "e-resize", west: "w-resize", north: "n-resize", rowresize: "row-resize", colresize: "col-resize" }, re = 10, ae = "Auto", se = "Top", le = "Right", de = "Left", ce = "Bottom", ue = 10, he = 10, pe = "dragStart", fe = "drag", ge = "dragEnd", me = "itemRotate", ve = "itemBoundsChange", _e = 5, be = 5, we = "mouseEnter", ke = "mouseLeave", ye = "zoomStart", xe = "zoomEnd", Ce = -2e4, Se = 2e4, Te = .9, De = .93, Ae = 5, Ee = "transparent", Ie = "pan", Me = "rotated", Re = "source", Fe = "target", Pe = { "-1": Re, 1: Fe }; V.Cursors = oe, s = N.Class.extend({ init: function (e) { this.layoutState = e, this.diagram = e.diagram }, initState: function () { function e(e, t) { var n = this.diagram.getShapeById(e); n && (this.subjects.push(n), this.froms.push(n.bounds().topLeft()), this.tos.push(t.topLeft())) } this.froms = [], this.tos = [], this.subjects = [], this.layoutState.nodeMap.forEach(e, this) }, update: function (e) { if (!(this.subjects.length <= 0)) for (var t = 0; t < this.subjects.length; t++)this.subjects[t].position(new K(this.froms[t].x + (this.tos[t].x - this.froms[t].x) * e, this.froms[t].y + (this.tos[t].y - this.froms[t].y) * e)) } }), l = W.extend({ init: function (e, t, n) { this.animate = !$(n) && n, this._initialState = e, this._finalState = t, this.title = "Diagram layout" }, undo: function () { this.setState(this._initialState) }, redo: function () { this.setState(this._finalState) }, setState: function (e) { var t, n = e.diagram; this.animate ? (e.linkMap.forEach(function (e, t) { var i = n.getShapeById(e); i.visible(!1), i && i.points(t) }), t = new Q, t.addAdapter(new s(e)), t.onComplete(function () { e.linkMap.forEach(function (e) { var t = n.getShapeById(e); t.visible(!0) }) }), t.play()) : (e.nodeMap.forEach(function (e, t) { var i = n.getShapeById(e); i && i.position(t.topLeft()) }), e.linkMap.forEach(function (e, t) { var i = n.getShapeById(e); i && i.points(t) })) } }), d = W.extend({ init: function (e) { this.units = [], this.title = "Composite unit", e !== t && this.units.push(e) }, add: function (e) { this.units.push(e) }, undo: function () { for (var e = 0; e < this.units.length; e++)this.units[e].undo() }, redo: function () { for (var e = 0; e < this.units.length; e++)this.units[e].redo() } }), c = W.extend({ init: function (e, t, n) { this.item = e, this._redoSource = t, this._redoTarget = n, te(t) && (this._undoSource = e.source()), te(n) && (this._undoTarget = e.target()), this.title = "Connection Editing" }, undo: function () { this._undoSource !== t && this.item._updateConnector(this._undoSource, "source"), this._undoTarget !== t && this.item._updateConnector(this._undoTarget, "target"), this.item.updateModel() }, redo: function () { this._redoSource !== t && this.item._updateConnector(this._redoSource, "source"), this._redoTarget !== t && this.item._updateConnector(this._redoTarget, "target"), this.item.updateModel() } }), u = W.extend({ init: function (e, t, n) { this.item = e, this._undoSource = t, this._undoTarget = n, this._redoSource = e.source(), this._redoTarget = e.target(), this.title = "Connection Editing" }, undo: function () { this.item._updateConnector(this._undoSource, "source"), this.item._updateConnector(this._undoTarget, "target"), this.item.updateModel() }, redo: function () { this.item._updateConnector(this._redoSource, "source"), this.item._updateConnector(this._redoTarget, "target"), this.item.updateModel() } }), h = W.extend({ init: function (e) { this.connection = e, this.diagram = e.diagram, this.targetConnector = e.targetConnector, this.title = "Delete connection" }, undo: function () { this.diagram._addConnection(this.connection, !1) }, redo: function () { this.diagram.remove(this.connection, !1) } }), p = W.extend({ init: function (e) { this.shape = e, this.diagram = e.diagram, this.title = "Deletion" }, undo: function () { this.diagram._addShape(this.shape, !1), this.shape.select(!1) }, redo: function () { this.shape.select(!1), this.diagram.remove(this.shape, !1) } }), f = W.extend({ init: function (e, t, n) { var i, o; for (this.shapes = e, this.undoStates = t, this.title = "Transformation", this.redoStates = [], this.adorner = n, i = 0; i < this.shapes.length; i++)o = this.shapes[i], this.redoStates.push(o.bounds()) }, undo: function () { var e, t; for (e = 0; e < this.shapes.length; e++)t = this.shapes[e], t.bounds(this.undoStates[e]), t.hasOwnProperty("layout") && t.layout(t, this.redoStates[e], this.undoStates[e]), t.updateModel(); this.adorner && (this.adorner.refreshBounds(), this.adorner.refresh()) }, redo: function () { var e, t; for (e = 0; e < this.shapes.length; e++)t = this.shapes[e], t.bounds(this.redoStates[e]), t.hasOwnProperty("layout") && t.layout(t, this.undoStates[e], this.redoStates[e]), t.updateModel(); this.adorner && (this.adorner.refreshBounds(), this.adorner.refresh()) } }), g = W.extend({ init: function (e, t) { this.connection = e, this.diagram = t, this.title = "New connection" }, undo: function () { this.diagram.remove(this.connection, !1) }, redo: function () { this.diagram._addConnection(this.connection, !1) } }), m = W.extend({ init: function (e, t) { this.shape = e, this.diagram = t, this.title = "New shape" }, undo: function () { this.diagram.deselect(), this.diagram.remove(this.shape, !1) }, redo: function () { this.diagram._addShape(this.shape, !1) } }), v = W.extend({ init: function (e, t, n) { this.initial = e, this.finalPos = t, this.diagram = n, this.title = "Pan Unit" }, undo: function () { this.diagram.pan(this.initial) }, redo: function () { this.diagram.pan(this.finalPos) } }), _ = W.extend({ init: function (e, t, n) { var i, o; for (this.shapes = t, this.undoRotates = n, this.title = "Rotation", this.redoRotates = [], this.redoAngle = e._angle, this.adorner = e, this.center = e._innerBounds.center(), i = 0; i < this.shapes.length; i++)o = this.shapes[i], this.redoRotates.push(o.rotate().angle) }, undo: function () { var e, t; for (e = 0; e < this.shapes.length; e++)t = this.shapes[e], t.rotate(this.undoRotates[e], this.center, !1), t.hasOwnProperty("layout") && t.layout(t), t.updateModel(); this.adorner && (this.adorner._initialize(), this.adorner.refresh()) }, redo: function () { var e, t; for (e = 0; e < this.shapes.length; e++)t = this.shapes[e], t.rotate(this.redoRotates[e], this.center, !1), t.hasOwnProperty("layout") && t.layout(t), t.updateModel(); this.adorner && (this.adorner._initialize(), this.adorner.refresh()) } }), b = W.extend({ init: function (e, t, n) { this.diagram = e, this.indices = n, this.items = t, this.title = "Rotate Unit" }, undo: function () { this.diagram._toIndex(this.items, this.indices) }, redo: function () { this.diagram.toFront(this.items, !1) } }), w = W.extend({ init: function (e, t, n) { this.diagram = e, this.indices = n, this.items = t, this.title = "Rotate Unit" }, undo: function () { this.diagram._toIndex(this.items, this.indices) }, redo: function () { this.diagram.toBack(this.items, !1) } }), k = N.Observable.extend({ init: function (e) { N.Observable.fn.init.call(this, e), this.bind(this.events, e), this.stack = [], this.index = 0, this.capacity = 100 }, events: ["undone", "redone"], begin: function () { this.composite = new d }, cancel: function () { this.composite = t }, commit: function (e) { this.composite.units.length > 0 && this._restart(this.composite, e), this.composite = t }, addCompositeItem: function (e) { this.composite ? this.composite.add(e) : this.add(e) }, add: function (e, t) { this._restart(e, t) }, pop: function () { this.index > 0 && (this.stack.pop(), this.index--) }, count: function () { return this.stack.length }, undo: function () { this.index > 0 && (this.index--, this.stack[this.index].undo(), this.trigger("undone")) }, redo: function () { this.stack.length > 0 && this.index < this.stack.length && (this.stack[this.index].redo(), this.index++, this.trigger("redone")) }, _restart: function (e, t) { this.stack.splice(this.index, this.stack.length - this.index), this.stack.push(e), t !== !1 ? this.redo() : this.index++, this.stack.length > this.capacity && (this.stack.splice(0, this.stack.length - this.capacity), this.index = this.capacity) }, clear: function () { this.stack = [], this.index = 0 } }), y = W.extend({ init: function (e) { this.toolService = e }, start: function () { }, move: function () { }, end: function () { }, tryActivate: function () { return !1 }, getCursor: function () { return oe.arrow } }), x = y.extend({ init: function (t) { var n, i, o, r, a = this, s = N.support.mobileOS ? De : Te; y.fn.init.call(a, t), n = a.toolService.diagram, i = n.canvas, o = n.scroller = a.scroller = e(n.scrollable).kendoMobileScroller({ friction: s, velocityMultiplier: Ae, mousewheelScrolling: !1, zoom: !1, scroll: ie(a._move, a) }).data("kendoMobileScroller"), i.translate && (a.movableCanvas = new J(i.element)), r = function (e, t, n) { e.makeVirtual(), e.virtualSize(t || Ce, n || Se) }, r(o.dimensions.x), r(o.dimensions.y), o.disable() }, tryActivate: function (e, t) { var n = this.toolService, i = n.diagram.options.pannable, o = t.ctrlKey; return te(i.key) && (o = i.key && "none" != i.key ? t[i.key + "Key"] : a(t) && !te(n.hoveredItem)), i !== !1 && o && !te(n.hoveredAdorner) && !te(n._hoveredConnector) }, start: function () { this.scroller.enable() }, move: function () { }, _move: function (e) { var t = this, n = t.toolService.diagram, i = n.canvas, o = new K(e.scrollLeft, e.scrollTop); i.translate ? (n._storePan(o.times(-1)), t.movableCanvas.moveTo(o), i.translate(o.x, o.y)) : o = o.plus(n._pan.times(-1)), n.trigger(Ie, { pan: o }) }, end: function () { this.scroller.disable() }, getCursor: function () { return oe.move } }), C = W.extend({ init: function (e) { this.toolService = e }, tryActivate: function () { return !0 }, start: function (e, t) { var n = this.toolService, i = n.diagram, o = n.hoveredItem; o && (n.selectSingle(o, t), o.adorner && (this.adorner = o.adorner, this.handle = this.adorner._hitTest(e))), this.handle || (this.handle = i._resizingAdorner._hitTest(e), this.handle && (this.adorner = i._resizingAdorner)), this.adorner && (this.adorner.isDragHandle(this.handle) && i.trigger(pe, { shapes: this.adorner.shapes, connections: [] }) ? (n.startPoint = e, n.end(e)) : this.adorner.start(e)) }, move: function (e) { this.adorner && (this.adorner.move(this.handle, e), this.adorner.isDragHandle(this.handle) && this.toolService.diagram.trigger(fe, { shapes: this.adorner.shapes, connections: [] })) }, end: function () { var e, n = this.toolService.diagram, i = this.adorner; i && (i.isDragHandle(this.handle) && n.trigger(ge, { shapes: i.shapes, connections: [] }) ? i.cancel() : (e = i.stop(), e && n.undoRedoService.add(e, !1))), this.adorner = t, this.handle = t }, getCursor: function (e) { return this.toolService.hoveredItem ? this.toolService.hoveredItem._getCursor(e) : oe.arrow } }), S = W.extend({ init: function (e) { this.toolService = e }, tryActivate: function (e, t) { var n = this.toolService, i = n.diagram.options.selectable, o = i && i.multiple !== !1; return o && (o = i.key && "none" != i.key ? t[i.key + "Key"] : a(t)), o && !te(n.hoveredItem) && !te(n.hoveredAdorner) }, start: function (e) { var t = this.toolService.diagram; t.deselect(), t.selector.start(e) }, move: function (e) { var t = this.toolService.diagram; t.selector.move(e) }, end: function (e, t) { var n = this.toolService.diagram, i = this.toolService.hoveredItem, o = n.selector.bounds(); i && i.isSelected || t.ctrlKey || n.deselect(), o.isEmpty() || n.selectArea(o), n.selector.end() }, getCursor: function () { return oe.arrow } }), T = W.extend({ init: function (e) { this.toolService = e, this.type = "ConnectionTool" }, tryActivate: function () { return this.toolService._hoveredConnector }, start: function (e, t) { var n = this.toolService, i = n.diagram, r = n._hoveredConnector, a = i._createConnection({}, r._c, e); o(a) && !i.trigger(pe, { shapes: [], connections: [a], connectionHandle: Fe }) && i._addConnection(a) ? (n._connectionManipulation(a, r._c.shape, !0), n._removeHover(), n.selectSingle(n.activeConnection, t), "touchmove" == t.type && (i._cachedTouchTarget = r.visual)) : (a.source(null), n.end(e)) }, move: function (e) { var t = this.toolService, n = t.activeConnection; return n.target(e), t.diagram.trigger(fe, { shapes: [], connections: [n], connectionHandle: Fe }), !0 }, end: function (e) { var t, n = this.toolService, i = n.diagram, o = n.activeConnection, r = n.hoveredItem, a = n._hoveredConnector, s = i._cachedTouchTarget; o && (t = a && a._c != o.sourceConnector ? a._c : r && r instanceof V.Shape ? r.getConnector(ae) || r.getConnector(e) : e, o.target(t), i.trigger(ge, { shapes: [], connections: [o], connectionHandle: Fe }) ? (i.remove(o, !1), i.undoRedoService.pop()) : (o.updateModel(), i._syncConnectionChanges()), n._connectionManipulation(), s && (i._connectorsAdorner.visual.remove(s), i._cachedTouchTarget = null)) }, getCursor: function () { return oe.arrow } }), D = W.extend({ init: function (e) { this.toolService = e, this.type = "ConnectionTool" }, tryActivate: function (e, t) { var n = this.toolService, i = n.diagram, o = i.options.selectable, r = n.hoveredItem, a = o !== !1 && r && r.path && !(r.isSelected && t.ctrlKey); return a && (this._c = r), a }, start: function (e, t) { var n, i, r, a = this.toolService, s = this._c; a.selectSingle(s, t), n = s.adorner, n && (i = n._hitTest(e), r = Pe[i]), o(s) && n && !a.diagram.trigger(pe, { shapes: [], connections: [s], connectionHandle: r }) ? (this.handle = i, this.handleName = r, n.start(e)) : (a.startPoint = e, a.end(e)) }, move: function (e) { var t = this._c.adorner; if (o(this._c) && t) return t.move(this.handle, e), this.toolService.diagram.trigger(fe, { shapes: [], connections: [this._c], connectionHandle: this.handleName }), !0 }, end: function (e) { var t, n = this._c, i = n.adorner, r = this.toolService, a = r.diagram; i && o(n) && (t = i.stop(e), a.trigger(ge, { shapes: [], connections: [n], connectionHandle: this.handleName }) ? t.undo() : (a.undoRedoService.add(t, !1), n.updateModel(), a._syncConnectionChanges())) }, getCursor: function () { return oe.move } }), A = W.extend({
init: function (e) { this.diagram = e, this.tools = [new x(this), new D(this), new T(this), new S(this), new C(this)], this.activeTool = t }, start: function (e, t) {
return t = X({}, t), this.activeTool && this.activeTool.end(e, t), this._updateHoveredItem(e), this._activateTool(e, t), this.activeTool.start(e, t), this._updateCursor(e), this.diagram.focus(), this.diagram.canvas.surface.suspendTracking(),
this.startPoint = e, !0
}, move: function (e, t) { t = X({}, t); var n = !0; return this.activeTool && (n = this.activeTool.move(e, t)), n && this._updateHoveredItem(e), this._updateCursor(e), !0 }, end: function (e, n) { return n = X({}, n), this.activeTool && this.activeTool.end(e, n), this.diagram.canvas.surface.resumeTracking(), this.activeTool = t, this._updateCursor(e), !0 }, keyDown: function (e, t) { var i, o = this.diagram; if (t = X({ ctrlKey: !1, metaKey: !1, altKey: !1 }, t), !t.ctrlKey && !t.metaKey || t.altKey) { if (46 === e || 8 === e) return i = this.diagram._triggerRemove(o.select()), i.length && (this.diagram.remove(i, !0), this.diagram._syncChanges(), this.diagram._destroyToolBar()), !0; if (27 === e) return this._discardNewConnection(), o.deselect(), o._destroyToolBar(), !0 } else { if (n(e, "a")) return o.selectAll(), o._destroyToolBar(), !0; if (n(e, "z")) return o.undo(), o._destroyToolBar(), !0; if (n(e, "y")) return o.redo(), o._destroyToolBar(), !0; n(e, "c") ? (o.copy(), o._destroyToolBar()) : n(e, "x") ? (o.cut(), o._destroyToolBar()) : n(e, "v") ? (o.paste(), o._destroyToolBar()) : n(e, "l") ? (o.layout(), o._destroyToolBar()) : n(e, "d") && (o._destroyToolBar(), o.copy(), o.paste()) } }, wheel: function (e, t) { var n = this.diagram, i = t.delta, o = n.zoom(), r = n.options, a = r.zoomRate, s = { point: e, meta: t, zoom: o }; if (!n.trigger(ye, s)) return i < 0 ? o += a : o -= a, o = N.dataviz.round(Math.max(r.zoomMin, Math.min(r.zoomMax, o)), 2), s.zoom = o, n.zoom(o, s), n.trigger(xe, s), !0 }, setTool: function (e, t) { e.toolService = this, this.tools[t] = e }, selectSingle: function (e, t) { var n, i = this.diagram, o = i.options.selectable; o && !e.isSelected && e.options.selectable !== !1 && (n = t.ctrlKey && o.multiple !== !1, i.select(e, { addToSelection: n })) }, _discardNewConnection: function () { this.newConnection && (this.diagram.remove(this.newConnection), this.newConnection = t) }, _activateTool: function (e, t) { var n, i; for (n = 0; n < this.tools.length; n++)if (i = this.tools[n], i.tryActivate(e, t)) { this.activeTool = i; break } }, _updateCursor: function (e) { var t = this.diagram.element, n = this.activeTool ? this.activeTool.getCursor(e) : this.hoveredAdorner ? this.hoveredAdorner._getCursor(e) : this.hoveredItem ? this.hoveredItem._getCursor(e) : oe.arrow; t.css({ cursor: n }), Z.msie && 7 == Z.version && (t[0].style.cssText = t[0].style.cssText) }, _connectionManipulation: function (e, n, i) { this.activeConnection = e, this.disabledShape = n, this.newConnection = i ? this.activeConnection : t }, _updateHoveredItem: function (e) { var n = this._hitTest(e), i = this.diagram; n == this.hoveredItem || this.disabledShape && n == this.disabledShape || (this.hoveredItem && (i.trigger(ke, { item: this.hoveredItem }), this.hoveredItem._hover(!1)), n && n.options.enable ? (i.trigger(we, { item: n }), this.hoveredItem = n, this.hoveredItem._hover(!0)) : this.hoveredItem = t) }, _removeHover: function () { this.hoveredItem && (this.hoveredItem._hover(!1), this.hoveredItem = t) }, _hitTest: function (e) { var n, i, o, r, a = this.diagram; if (this._hoveredConnector && (this._hoveredConnector._hover(!1), this._hoveredConnector = t), a._connectorsAdorner._visible && (n = a._connectorsAdorner._hitTest(e))) return n; if (n = this.diagram._resizingAdorner._hitTest(e)) { if (this.hoveredAdorner = a._resizingAdorner, 0 !== n.x || 0 !== n.y) return; n = t } else this.hoveredAdorner = t; if (!this.activeTool || "ConnectionTool" !== this.activeTool.type) { for (r = [], o = 0; o < a._selectedItems.length; o++)i = a._selectedItems[o], i instanceof V.Connection && r.push(i); n = this._hitTestItems(r, e) } return n || this._hitTestElements(e) }, _hitTestElements: function (e) { var t, n, i, o, a = this.diagram, s = this._hitTestItems(a.shapes, e), l = this._hitTestItems(a.connections, e); return this.activeTool && "ConnectionTool" == this.activeTool.type || !s || !l || r(s, e) || (n = a.mainLayer, i = ne(s.visual, n.children), o = ne(l.visual, n.children), t = i > o ? s : l), t || s || l }, _hitTestItems: function (e, t) { var n, i, o; for (n = e.length - 1; n >= 0; n--)if (i = e[n], o = i._hitTest(t)) return o }
}), E = N.Class.extend({ init: function () { } }), I = E.extend({ init: function (e) { var t = this; E.fn.init.call(t), this.connection = e }, hitTest: function (e) { var t = this.getBounds().inflate(re); return !!t.contains(e) && V.Geometry.distanceToPolyline(e, this.connection.allPoints()) < re }, getBounds: function () { var e, t = this.connection.allPoints(), n = t[0], i = t[t.length - 1], o = Math.max(n.x, i.x), r = Math.min(n.x, i.x), a = Math.min(n.y, i.y), s = Math.max(n.y, i.y); for (e = 1; e < t.length - 1; ++e)o = Math.max(o, t[e].x), r = Math.min(r, t[e].x), a = Math.min(a, t[e].y), s = Math.max(s, t[e].y); return new j(r, a, o - r, s - a) } }), M = I.extend({ init: function (e) { var t = this; I.fn.init.call(t), this.connection = e }, route: function () { } }), R = I.extend({ SAME_SIDE_DISTANCE_RATIO: 5, init: function (e) { var t = this; I.fn.init.call(t), this.connection = e }, routePoints: function (e, t, n, i) { var o; return o = n && i ? this._connectorPoints(e, t, n, i) : this._floatingPoints(e, t, n) }, route: function () { var e = this.connection._resolvedSourceConnector, t = this.connection._resolvedTargetConnector, n = this.connection.sourcePoint(), i = this.connection.targetPoint(), o = this.routePoints(n, i, e, t); this.connection.points(o) }, _connectorSides: [{ name: "Top", axis: "y", boundsPoint: "topLeft", secondarySign: 1 }, { name: "Left", axis: "x", boundsPoint: "topLeft", secondarySign: 1 }, { name: "Bottom", axis: "y", boundsPoint: "bottomRight", secondarySign: -1 }, { name: "Right", axis: "x", boundsPoint: "bottomRight", secondarySign: -1 }], _connectorSide: function (e, t) { var n, i, o, r, a, s = e.position(), l = e.shape.bounds(Me), d = { topLeft: l.topLeft(), bottomRight: l.bottomRight() }, c = this._connectorSides, u = ee.MAX_NUM; for (a = 0; a < c.length; a++)r = c[a], o = r.axis, n = Math.round(Math.abs(s[o] - d[r.boundsPoint][o])), n < u ? (u = n, i = r) : n === u && (s[o] - t[o]) * r.secondarySign > (s[i.axis] - t[i.axis]) * i.secondarySign && (i = r); return i.name }, _sameSideDistance: function (e) { var t = e.shape.bounds(Me); return Math.min(t.width, t.height) / this.SAME_SIDE_DISTANCE_RATIO }, _connectorPoints: function (e, t, n, i) { var o, r, a = this._connectorSide(n, t), s = this._connectorSide(i, e), l = t.x - e.x, d = t.y - e.y, c = this._sameSideDistance(n), u = []; return a === se || a == ce ? s == se || s == ce ? a == s ? (r = a == se ? Math.min(e.y, t.y) - c : Math.max(e.y, t.y) + c, u = [new K(e.x, r), new K(t.x, r)]) : u = [new K(e.x, e.y + d / 2), new K(t.x, e.y + d / 2)] : u = [new K(e.x, t.y)] : s == de || s == le ? a == s ? (o = a == de ? Math.min(e.x, t.x) - c : Math.max(e.x, t.x) + c, u = [new K(o, e.y), new K(o, t.y)]) : u = [new K(e.x + l / 2, e.y), new K(e.x + l / 2, e.y + d)] : u = [new K(t.x, e.y)], u }, _floatingPoints: function (e, t, n) { var i, o, r, a = n ? this._connectorSide(n, t) : null, s = this._startHorizontal(e, t, a), l = [e, e, t, t], d = t.x - e.x, c = t.y - e.y, u = l.length; for (r = 1; r < u - 1; ++r)s ? r % 2 !== 0 ? (i = d / (u / 2), o = 0) : (i = 0, o = c / ((u - 1) / 2)) : r % 2 !== 0 ? (i = 0, o = c / (u / 2)) : (i = d / ((u - 1) / 2), o = 0), l[r] = new K(l[r - 1].x + i, l[r - 1].y + o); return r--, l[u - 2] = s && r % 2 !== 0 || !s && r % 2 === 0 ? new K(l[u - 1].x, l[u - 2].y) : new K(l[u - 2].x, l[u - 1].y), [l[1], l[2]] }, _startHorizontal: function (e, t, n) { var i; return i = null !== n && (n === le || n === de) || Math.abs(e.x - t.x) > Math.abs(e.y - t.y) } }), F = W.extend({ init: function (e, t) { var n = this; n.diagram = e, n.options = X({}, n.options, t), n.visual = new U, n.diagram._adorners.push(n) }, refresh: function () { } }), P = F.extend({ init: function (e, t) { var n, i, o, r = this; r.connection = e, n = r.connection.diagram, r._ts = n.toolService, F.fn.init.call(r, n, t), i = r.connection.sourcePoint(), o = r.connection.targetPoint(), r.spVisual = new Y(X(r.options.handles, { center: i })), r.epVisual = new Y(X(r.options.handles, { center: o })), r.visual.append(r.spVisual), r.visual.append(r.epVisual) }, options: { handles: {} }, _getCursor: function () { return oe.move }, start: function (e) { switch (this.handle = this._hitTest(e), this.startPoint = e, this._initialSource = this.connection.source(), this._initialTarget = this.connection.target(), this.handle) { case -1: this.connection.targetConnector && this._ts._connectionManipulation(this.connection, this.connection.targetConnector.shape); break; case 1: this.connection.sourceConnector && this._ts._connectionManipulation(this.connection, this.connection.sourceConnector.shape) } }, move: function (e, t) { switch (e) { case -1: this.connection.source(t); break; case 1: this.connection.target(t); break; default: var n = t.minus(this.startPoint); this.startPoint = t, this.connection.sourceConnector || this.connection.source(this.connection.sourcePoint().plus(n)), this.connection.targetConnector || this.connection.target(this.connection.targetPoint().plus(n)) }return this.refresh(), !0 }, stop: function (e) { var n, i = this.diagram.toolService, o = i.hoveredItem; return n = i._hoveredConnector ? i._hoveredConnector._c : o && o instanceof V.Shape ? o.getConnector(ae) || o.getConnector(e) : e, this.handle === -1 ? this.connection.source(n) : 1 === this.handle && this.connection.target(n), this.handle = t, this._ts._connectionManipulation(), new u(this.connection, this._initialSource, this._initialTarget) }, _hitTest: function (e) { var t = this.connection.sourcePoint(), n = this.connection.targetPoint(), i = this.options.handles.width / 2 + re, o = this.options.handles.height / 2 + re, r = t.distanceTo(e), a = n.distanceTo(e), s = new j(t.x, t.y).inflate(i, o).contains(e), l = new j(n.x, n.y).inflate(i, o).contains(e), d = 0; return s && (!l || r < a) ? d = -1 : l && (!s || a < r) && (d = 1), d }, refresh: function () { this.spVisual.redraw({ center: this.diagram.modelToLayer(this.connection.sourcePoint()) }), this.epVisual.redraw({ center: this.diagram.modelToLayer(this.connection.targetPoint()) }) } }), z = F.extend({ init: function (e, t) { var n = this; F.fn.init.call(n, e, t), n._refreshHandler = function (e) { e.item == n.shape && n.refresh() } }, show: function (e) { var t, n, i, o = this; for (o._visible = !0, o.shape = e, o.diagram.bind(ve, o._refreshHandler), t = e.connectors.length, o.connectors = [], o._clearVisual(), n = 0; n < t; n++)i = new H(e.connectors[n]), o.connectors.push(i), o.visual.append(i.visual); o.visual.visible(!0), o.refresh() }, _clearVisual: function () { var e = this; e.diagram._cachedTouchTarget ? e._keepCachedTouchTarget() : e.visual.clear() }, _keepCachedTouchTarget: function () { var e, t = this, n = t.visual.children, i = n.length, o = ne(t.diagram._cachedTouchTarget, n); for (e = i - 1; e >= 0; e--)e != o && t.visual.remove(n[e]) }, destroy: function () { var e = this; e.diagram.unbind(ve, e._refreshHandler), e.shape = t, e._visible = t, e.visual.visible(!1) }, _hitTest: function (e) { var t, n; for (n = 0; n < this.connectors.length; n++)if (t = this.connectors[n], t._hitTest(e)) { t._hover(!0), this.diagram.toolService._hoveredConnector = t; break } }, refresh: function () { if (this.shape) { var t = this.shape.bounds(); t = this.diagram.modelToLayer(t), this.visual.position(t.topLeft()), e.each(this.connectors, function () { this.refresh() }) } } }), B = F.extend({ init: function (e, t) { var n = this; F.fn.init.call(n, e, t), n._manipulating = !1, n.map = [], n.shapes = [], n._initSelection(), n._createHandles(), n.redraw(), n.diagram.bind("select", function (e) { n._initialize(e.selected) }), n._refreshHandler = function () { n._internalChange || (n.refreshBounds(), n.refresh()) }, n._rotatedHandler = function () { 1 == n.shapes.length && (n._angle = n.shapes[0].rotate().angle), n._refreshHandler() }, n.diagram.bind(ve, n._refreshHandler).bind(me, n._rotatedHandler), n.refreshBounds(), n.refresh() }, options: { handles: { fill: { color: "#fff" }, stroke: { color: "#282828" }, height: 7, width: 7, hover: { fill: { color: "#282828" }, stroke: { color: "#282828" } } }, selectable: { stroke: { color: "#778899", width: 1, dashType: "dash" }, fill: { color: Ee } }, offset: 10 }, _initSelection: function () { var e = this, t = e.diagram, n = t.options.selectable, i = X({}, e.options.selectable, n); e.rect = new q(i), e.visual.append(e.rect) }, _resizable: function () { return this.options.editable && this.options.editable.resize !== !1 }, _handleOptions: function () { return (this.options.editable.resize || {}).handles || this.options.handles }, _createHandles: function () { var e, t, n, i; if (this._resizable()) for (e = this._handleOptions(), i = -1; i <= 1; i++)for (n = -1; n <= 1; n++)0 === i && 0 === n || (t = new q(e), t.drawingElement._hover = ie(this._hover, this), this.map.push({ x: i, y: n, visual: t }), this.visual.append(t)) }, bounds: function (e) { return e ? (this._innerBounds = e.clone(), this._bounds = this.diagram.modelToLayer(e).inflate(this.options.offset, this.options.offset), t) : this._bounds }, _hitTest: function (e) { var t, n, i, o, r = this.diagram.modelToLayer(e), a = this.map.length; if (this._angle && (r = r.clone().rotate(this._bounds.center(), this._angle)), this._resizable()) for (t = 0; t < a; t++)if (o = this.map[t], n = new K(o.x, o.y), i = this._getHandleBounds(n), i.offset(this._bounds.x, this._bounds.y), i.contains(r)) return n; if (this._bounds.contains(r)) return new K(0, 0) }, _getHandleBounds: function (e) { if (this._resizable()) { var t = this._handleOptions(), n = t.width, i = t.height, o = new j(0, 0, n, i); return e.x < 0 ? o.x = -n / 2 : 0 === e.x ? o.x = Math.floor(this._bounds.width / 2) - n / 2 : e.x > 0 && (o.x = this._bounds.width + 1 - n / 2), e.y < 0 ? o.y = -i / 2 : 0 === e.y ? o.y = Math.floor(this._bounds.height / 2) - i / 2 : e.y > 0 && (o.y = this._bounds.height + 1 - i / 2), o } }, _getCursor: function (e) { var t, n = this._hitTest(e); if (n && n.x >= -1 && n.x <= 1 && n.y >= -1 && n.y <= 1 && this._resizable()) { if (t = this._angle, t && (t = 360 - t, n.rotate(new K(0, 0), t), n = new K(Math.round(n.x), Math.round(n.y))), n.x == -1 && n.y == -1) return "nw-resize"; if (1 == n.x && 1 == n.y) return "se-resize"; if (n.x == -1 && 1 == n.y) return "sw-resize"; if (1 == n.x && n.y == -1) return "ne-resize"; if (0 === n.x && n.y == -1) return "n-resize"; if (0 === n.x && 1 == n.y) return "s-resize"; if (1 == n.x && 0 === n.y) return "e-resize"; if (n.x == -1 && 0 === n.y) return "w-resize" } return this._manipulating ? oe.move : oe.select }, _initialize: function () { var e, t, n = this, i = n.diagram.select(); for (n.shapes = [], e = 0; e < i.length; e++)t = i[e], t instanceof V.Shape && (n.shapes.push(t), t._rotationOffset = new K); n._angle = 1 == n.shapes.length ? n.shapes[0].rotate().angle : 0, n._startAngle = n._angle, n._rotates(), n._positions(), n.refreshBounds(), n.refresh(), n.redraw() }, _rotates: function () { var e, t, n = this; for (n.initialRotates = [], e = 0; e < n.shapes.length; e++)t = n.shapes[e], n.initialRotates.push(t.rotate().angle) }, _positions: function () { var e, t, n = this; for (n.initialStates = [], e = 0; e < n.shapes.length; e++)t = n.shapes[e], n.initialStates.push(t.bounds()) }, _hover: function (e, t) { if (this._resizable()) { var n = this._handleOptions(), i = n.hover, o = n.stroke, r = n.fill; e && G.isDefined(i.stroke) && (o = X({}, o, i.stroke)), e && G.isDefined(i.fill) && (r = i.fill), t.stroke(o.color, o.width, o.opacity), t.fill(r.color, r.opacity) } }, start: function (e) { var t, n; for (this._sp = e, this._cp = e, this._lp = e, this._manipulating = !0, this._internalChange = !0, this.shapeStates = [], t = 0; t < this.shapes.length; t++)n = this.shapes[t], this.shapeStates.push(n.bounds()) }, redraw: function () { var e, t, n = this._resizable(); for (e = 0; e < this.map.length; e++)t = this.map[e], t.visual.visible(n) }, angle: function (e) { return te(e) && (this._angle = e), this._angle }, rotate: function () { var e, t, n = this._innerBounds.center(), i = this.angle(); for (this._internalChange = !0, e = 0; e < this.shapes.length; e++)t = this.shapes[e], i = (i + this.initialRotates[e] - this._startAngle) % 360, t.rotate(i, n); this.refresh() }, move: function (e, n) { var r, a, s, l, d, c, u, h, p, f, g, m, v, _, b = new K, w = new K, k = 0; if (e.y === -2 && e.x === -1) { for (l = this._innerBounds.center(), this._angle = this._truncateAngle(G.findAngle(l, n)), c = 0; c < this.shapes.length; c++)d = this.shapes[c], u = (this._angle + this.initialRotates[c] - this._startAngle) % 360, d.rotate(u, l), d.hasOwnProperty("layout") && d.layout(d), this._rotating = !0; this.refresh() } else { if (this.shouldSnap()) { if (m = this._truncateDistance(n.minus(this._lp)), 0 === m.x && 0 === m.y) return this._cp = n, t; r = m, this._lp = new K(this._lp.x + m.x, this._lp.y + m.y) } else r = n.minus(this._cp); for (this.isDragHandle(e) ? (w = b = r, a = !0) : (this._angle && r.rotate(new K(0, 0), this._angle), e.x == -1 ? b.x = r.x : 1 == e.x && (w.x = r.x), e.y == -1 ? b.y = r.y : 1 == e.y && (w.y = r.y)), a || (p = i(e, this._innerBounds), f = (this._innerBounds.width + r.x * e.x) / this._innerBounds.width, g = (this._innerBounds.height + r.y * e.y) / this._innerBounds.height), c = 0; c < this.shapes.length; c++) { if (d = this.shapes[c], s = d.bounds(), a) { if (!o(d)) continue; h = this._displaceBounds(s, b, w, a) } else h = s.clone(), h.scale(f, g, p, this._innerBounds.center(), d.rotate().angle), v = h.center(), v.rotate(s.center(), -this._angle), h = new j(v.x - h.width / 2, v.y - h.height / 2, h.width, h.height); h.width >= d.options.minWidth && h.height >= d.options.minHeight && (_ = s, d.bounds(h), d.hasOwnProperty("layout") && d.layout(d, _, h), _.width === h.width && _.height === h.height || d.rotate(d.rotate().angle), k += 1) } k && (k == c ? (h = this._displaceBounds(this._innerBounds, b, w, a), this.bounds(h)) : this.refreshBounds(), this.refresh()), this._positions() } this._cp = n }, isDragHandle: function (e) { return 0 === e.x && 0 === e.y }, cancel: function () { var e, n = this.shapes, i = this.shapeStates; for (e = 0; e < n.length; e++)n[e].bounds(i[e]); this.refreshBounds(), this.refresh(), this._manipulating = t, this._internalChange = t, this._rotating = t }, _truncatePositionToGuides: function (e) { return this.diagram.ruler ? this.diagram.ruler.truncatePositionToGuides(e) : e }, _truncateSizeToGuides: function (e) { return this.diagram.ruler ? this.diagram.ruler.truncateSizeToGuides(e) : e }, _truncateAngle: function (e) { var t = this.snapOptions(), n = Math.max(t.angle || he, be); return t ? Math.floor(e % 360 / n) * n : e % 360 }, _truncateDistance: function (e) { var t, n; return e instanceof V.Point ? new V.Point(this._truncateDistance(e.x), this._truncateDistance(e.y)) : (t = this.snapOptions() || {}, n = Math.max(t.size || ue, _e), t ? Math.floor(e / n) * n : e) }, snapOptions: function () { var e = this.diagram.options.editable, t = ((e || {}).drag || {}).snap || {}; return t }, shouldSnap: function () { var e = this.diagram.options.editable, t = (e || {}).drag, n = (t || {}).snap; return e !== !1 && t !== !1 && n !== !1 }, _displaceBounds: function (e, t, n, i) { var o, r = e.topLeft().plus(t), a = e.bottomRight().plus(n), s = j.fromPoints(r, a); return i || (o = s.center(), o.rotate(e.center(), -this._angle), s = new j(o.x - s.width / 2, o.y - s.height / 2, s.width, s.height)), s }, stop: function () { var e, n, i, o; if (this._cp != this._sp) if (this._rotating) e = new _(this, this.shapes, this.initialRotates), this._rotating = !1; else if (this._diffStates()) { if (this.diagram.ruler) for (n = 0; n < this.shapes.length; n++)i = this.shapes[n], o = i.bounds(), o = this._truncateSizeToGuides(this._truncatePositionToGuides(o)), i.bounds(o), this.refreshBounds(), this.refresh(); for (n = 0; n < this.shapes.length; n++)i = this.shapes[n], i.updateModel(); e = new f(this.shapes, this.shapeStates, this), this.diagram._syncShapeChanges() } return this._manipulating = t, this._internalChange = t, this._rotating = t, e }, _diffStates: function () { var e, t = this.shapes, n = this.shapeStates; for (e = 0; e < t.length; e++)if (!t[e].bounds().equals(n[e])) return !0; return !1 }, refreshBounds: function () { var e = 1 == this.shapes.length ? this.shapes[0].bounds().clone() : this.diagram.boundingBox(this.shapes, !0); this.bounds(e) }, refresh: function () { var t, n, i, o, r = this; this.shapes.length > 0 ? (n = this.bounds(), this.visual.visible(!0), this.visual.position(n.topLeft()), e.each(this.map, function () { t = r._getHandleBounds(new K(this.x, this.y)), this.visual.position(t.topLeft()) }), this.visual.position(n.topLeft()), i = new K(n.width / 2, n.height / 2), this.visual.rotate(this._angle, i), this.rect.redraw({ width: n.width, height: n.height }), this.rotationThumb && (o = this.options.editable.rotate.thumb, this._rotationThumbBounds = new j(n.center().x, n.y + o.y, 0, 0).inflate(o.width), this.rotationThumb.redraw({ x: n.width / 2 - o.width / 2 }))) : this.visual.visible(!1) } }), L = W.extend({ init: function (e) { var t = e.options.selectable; this.options = X({}, this.options, t), this.visual = new q(this.options), this.diagram = e }, options: { stroke: { color: "#778899", width: 1, dashType: "dash" }, fill: { color: Ee } }, start: function (e) { this._sp = this._ep = e, this.refresh(), this.diagram._adorn(this, !0) }, end: function () { this._sp = this._ep = t, this.diagram._adorn(this, !1) }, bounds: function (e) { return e && (this._bounds = e), this._bounds }, move: function (e) { this._ep = e, this.refresh() }, refresh: function () { if (this._sp) { var e = j.fromPoints(this.diagram.modelToLayer(this._sp), this.diagram.modelToLayer(this._ep)); this.bounds(j.fromPoints(this._sp, this._ep)), this.visual.position(e.topLeft()), this.visual.redraw({ height: e.height + 1, width: e.width + 1 }) } } }), H = W.extend({ init: function (e) { this.options = X({}, e.options), this._c = e, this.visual = new Y(this.options), this.refresh() }, _hover: function (e) { var t = this.options, n = t.hover, i = t.stroke, o = t.fill; e && G.isDefined(n.stroke) && (i = X({}, i, n.stroke)), e && G.isDefined(n.fill) && (o = n.fill), this.visual.redraw({ stroke: i, fill: o }) }, refresh: function () { var e = this._c.shape.diagram.modelToView(this._c.position()), t = e.minus(this._c.shape.bounds("transformed").topLeft()), n = new j(e.x, e.y, 0, 0); n.inflate(this.options.width / 2, this.options.height / 2), this._visualBounds = n, this.visual.redraw({ center: new K(t.x, t.y) }) }, _hitTest: function (e) { var t = this._c.shape.diagram.modelToView(e); return this._visualBounds.contains(t) } }), X(V, { CompositeUnit: d, TransformUnit: f, PanUndoUnit: v, AddShapeUnit: m, AddConnectionUnit: g, DeleteShapeUnit: p, DeleteConnectionUnit: h, ConnectionEditAdorner: P, ConnectionTool: T, ConnectorVisual: H, UndoRedoService: k, ResizingAdorner: B, Selector: L, ToolService: A, ConnectorsAdorner: z, LayoutUndoUnit: l, ConnectionEditUnit: c, ToFrontUnit: b, ToBackUnit: w, ConnectionRouterBase: E, PolylineRouter: M, CascadingRouter: R, SelectionTool: S, ScrollerTool: x, PointerTool: C, ConnectionEditTool: D, RotateUnit: _ })
}(window.kendo.jQuery)
}, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("dataviz/diagram/layout.min", ["dataviz/diagram/math.min"], e) }(function () {
!function (e, t) {
var n = window.kendo, i = n.dataviz.diagram, o = i.Graph, r = i.Node, a = i.Link, s = n.deepExtend, l = i.Size, d = i.Rect, c = i.Dictionary, u = i.Set, h = i.Graph, p = i.Utils, f = i.Point, g = 1e-6, m = Math.PI / 180, v = p.contains, _ = e.grep, b = n.Class.extend({ defaultOptions: { type: "Tree", subtype: "Down", roots: null, animate: !1, limitToView: !1, friction: .9, nodeDistance: 50, iterations: 300, horizontalSeparation: 90, verticalSeparation: 50, underneathVerticalTopOffset: 15, underneathHorizontalOffset: 15, underneathVerticalSeparation: 15, grid: { width: 1500, offsetX: 50, offsetY: 50, componentSpacingX: 20, componentSpacingY: 20 }, layerSeparation: 50, layeredIterations: 2, startRadialAngle: 0, endRadialAngle: 360, radialSeparation: 150, radialFirstLevelSeparation: 200, keepComponentsInOneRadialLayout: !1, ignoreContainers: !0, layoutContainerChildren: !1, ignoreInvisible: !0, animateTransitions: !1 }, init: function () { }, gridLayoutComponents: function (e) { var t, n, i, o, r, a, s, l, d, c, u, h, g, m, v; if (!e) throw "No components supplied."; for (p.forEach(e, function (e) { e.calcBounds() }), e.sort(function (e, t) { return t.bounds.width - e.bounds.width }), t = this.options.grid.width, n = this.options.grid.componentSpacingX, i = this.options.grid.componentSpacingY, o = 0, r = this.options.grid.offsetX, a = this.options.grid.offsetY, s = r, l = a, c = [], u = []; e.length > 0;) { for (s >= t && (s = r, l += o + i, o = 0), h = e.pop(), this.moveToOffset(h, new f(s, l)), d = 0; d < h.nodes.length; d++)u.push(h.nodes[d]); for (d = 0; d < h.links.length; d++)c.push(h.links[d]); g = h.bounds, m = g.height, (m <= 0 || isNaN(m)) && (m = 0), v = g.width, (v <= 0 || isNaN(v)) && (v = 0), m >= o && (o = m), s += v + n } return { nodes: u, links: c } }, moveToOffset: function (e, t) { var n, i, o, r, a, s, l, c, u = e.bounds, h = t.x - u.x, p = t.y - u.y; for (n = 0; n < e.nodes.length; n++)o = e.nodes[n], r = o.bounds(), 0 === r.width && 0 === r.height && 0 === r.x && 0 === r.y && (r = new d(0, 0, 0, 0)), r.x += h, r.y += p, o.bounds(r); for (n = 0; n < e.links.length; n++)if (a = e.links[n], a.points) { for (s = [], l = a.points, i = 0; i < l.length; i++)c = l[i], c.x += h, c.y += p, s.push(c); a.points = s } return this.currentHorizontalOffset += u.width + this.options.grid.offsetX, new f(h, p) }, transferOptions: function (e) { this.options = n.deepExtend({}, this.defaultOptions), p.isUndefined(e) || (this.options = n.deepExtend(this.options, e || {})) } }), w = n.Class.extend({ init: function (e) { this.nodeMap = new c, this.shapeMap = new c, this.nodes = [], this.edges = [], this.edgeMap = new c, this.finalNodes = [], this.finalLinks = [], this.ignoredConnections = [], this.ignoredShapes = [], this.hyperMap = new c, this.hyperTree = new o, this.finalGraph = null, this.diagram = e }, convert: function (e) { if (p.isUndefined(this.diagram)) throw "No diagram to convert."; return this.options = n.deepExtend({ ignoreInvisible: !0, ignoreContainers: !0, layoutContainerChildren: !1 }, e || {}), this.clear(), this._renormalizeShapes(), this._renormalizeConnections(), this.finalNodes = new c(this.nodes), this.finalLinks = new c(this.edges), this.finalGraph = new o, this.finalNodes.forEach(function (e) { this.finalGraph.addNode(e) }, this), this.finalLinks.forEach(function (e) { this.finalGraph.addExistingLink(e) }, this), this.finalGraph }, mapConnection: function (e) { return this.edgeMap.get(e.id) }, mapShape: function (e) { return this.nodeMap.get(e.id) }, getEdge: function (e, t) { return p.first(e.links, function (n) { return n.getComplement(e) === t }) }, clear: function () { this.finalGraph = null, this.hyperTree = !this.options.ignoreContainers && this.options.layoutContainerChildren ? new h : null, this.hyperMap = !this.options.ignoreContainers && this.options.layoutContainerChildren ? new c : null, this.nodeMap = new c, this.shapeMap = new c, this.nodes = [], this.edges = [], this.edgeMap = new c, this.ignoredConnections = [], this.ignoredShapes = [], this.finalNodes = [], this.finalLinks = [] }, listToRoot: function (e) { var t = [], n = e.container; if (!n) return t; for (t.push(n); n.parentContainer;)n = n.parentContainer, t.push(n); return t.reverse(), t }, firstNonIgnorableContainer: function (e) { return e.isContainer && !this._isIgnorableItem(e) ? e : e.parentContainer ? this.firstNonIgnorableContainer(e.parentContainer) : null }, isContainerConnection: function (e, t) { return !(!e.isContainer || !this.isDescendantOf(e, t)) || t.isContainer && this.isDescendantOf(t, e) }, isDescendantOf: function (e, t) { var n, i, o, r; if (!e.isContainer) throw "Expecting a container."; if (e === t) return !1; if (v(e.children, t)) return !0; for (n = [], i = 0, o = e.children.length; i < o; i++)r = e.children[i], r.isContainer && this.isDescendantOf(r, t) && n.push(r); return n.length > 0 }, isIgnorableItem: function (e) { return this.options.ignoreInvisible ? (!e.isCollapsed || !this._isVisible(e)) && !(!e.isCollapsed && this._isVisible(e)) : e.isCollapsed && !this._isTop(e) }, isShapeMapped: function (e) { return e.isCollapsed && !this._isVisible(e) && !this._isTop(e) }, leastCommonAncestor: function (e, t) { var n, i, o, r, a, s; if (!e) throw "Parameter should not be null."; if (!t) throw "Parameter should not be null."; if (!this.hyperTree) throw "No hypertree available."; if (n = this.listToRoot(e), i = this.listToRoot(t), o = null, p.isEmpty(n) || p.isEmpty(i)) return this.hyperTree.root.data; for (r = n[0], a = i[0], s = 0; r === a && (o = n[s], s++, !(s >= n.length || s >= i.length));)r = n[s], a = i[s]; return o ? _(this.hyperTree.nodes, function (e) { return e.data.container === o }) : this.hyperTree.root.data }, _isTop: function (e) { return !e.parentContainer }, _isVisible: function (e) { return !!e.visible() && (e.parentContainer ? this._isVisible(e.parentContainer) : e.visible()) }, _isCollapsed: function (e) { return !(!e.isContainer || !e.isCollapsed) || e.parentContainer && this._isCollapsed(e.parentContainer) }, _renormalizeShapes: function () { var e, t, n, i; if (!this.options.ignoreContainers) throw "Containers are not supported yet, but stay tuned."; for (e = 0, t = this.diagram.shapes.length; e < t; e++)n = this.diagram.shapes[e], this.options.ignoreInvisible && !this._isVisible(n) || n.isContainer ? this.ignoredShapes.push(n) : (i = new r(n.id, n), i.isVirtual = !1, this.nodeMap.add(n.id, i), this.nodes.push(i)) }, _renormalizeConnections: function () { var e, t, n, i, o, r, s, l; if (0 !== this.diagram.connections.length) for (e = 0, t = this.diagram.connections.length; e < t; e++)if (n = this.diagram.connections[e], this.isIgnorableItem(n)) this.ignoredConnections.push(n); else if (i = n.sourceConnector ? n.sourceConnector.shape : null, o = n.targetConnector ? n.targetConnector.shape : null, i && o) if (!v(this.ignoredShapes, i) || this.shapeMap.containsKey(i)) if (!v(this.ignoredShapes, o) || this.shapeMap.containsKey(o)) if (this.shapeMap.containsKey(i) && (i = this.shapeMap[i]), this.shapeMap.containsKey(o) && (o = this.shapeMap[o]), r = this.mapShape(i), s = this.mapShape(o), r === s || this.areConnectedAlready(r, s)) this.ignoredConnections.push(n); else { if (null === r || null === s) throw "A shape was not mapped to a node."; if (!this.options.ignoreContainers) throw "Containers are not supported yet, but stay tuned."; r.isVirtual || s.isVirtual ? this.ignoredConnections.push(n) : (l = new a(r, s, n.id, n), this.edgeMap.add(n.id, l), this.edges.push(l)) } else this.ignoredConnections.push(n); else this.ignoredConnections.push(n); else this.ignoredConnections.push(n) }, areConnectedAlready: function (e, t) { return p.any(this.edges, function (n) { return n.source === e && n.target === t || n.source === t && n.target === e }) } }), k = b.extend({ init: function (e) { var t = this; if (b.fn.init.call(t), p.isUndefined(e)) throw "Diagram is not specified."; this.diagram = e }, layout: function (e) { var t, n, o, r, a, s; if (this.transferOptions(e), t = new w(this.diagram), n = t.convert(e), !n.isEmpty() && (o = n.getConnectedComponents(), !p.isEmpty(o))) { for (r = 0; r < o.length; r++)a = o[r], this.layoutGraph(a, e); return s = this.gridLayoutComponents(o), new i.LayoutState(this.diagram, s) } }, layoutGraph: function (e, t) { var n, i, o; for (p.isDefined(t) && this.transferOptions(t), this.graph = e, n = 9 * this.options.nodeDistance, this.temperature = n, i = this._expectedBounds(), this.width = i.width, this.height = i.height, o = 0; o < this.options.iterations; o++)this.refineStage = o >= 5 * this.options.iterations / 6, this.tick(), this.temperature = this.refineStage ? n / 30 : n * (1 - o / (2 * this.options.iterations)) }, tick: function () { var e, t, n; for (e = 0; e < this.graph.nodes.length; e++)this._repulsion(this.graph.nodes[e]); for (e = 0; e < this.graph.links.length; e++)this._attraction(this.graph.links[e]); for (e = 0; e < this.graph.nodes.length; e++) { if (t = this.graph.nodes[e], n = Math.sqrt(t.dx * t.dx + t.dy * t.dy), 0 === n) return; t.x += Math.min(n, this.temperature) * t.dx / n, t.y += Math.min(n, this.temperature) * t.dy / n, this.options.limitToView && (t.x = Math.min(this.width, Math.max(t.width / 2, t.x)), t.y = Math.min(this.height, Math.max(t.height / 2, t.y))) } }, _shake: function (e) { var t = Math.random() * this.options.nodeDistance / 4, n = 2 * Math.random() * Math.PI; e.x += t * Math.cos(n), e.y -= t * Math.sin(n) }, _InverseSquareForce: function (e, t, n) { var i, o, r, a, s, l, d; return this.refineStage ? (o = t.x - n.x, r = t.y - n.y, a = t.width / 2, s = t.height / 2, l = n.width / 2, d = n.height / 2, i = Math.pow(o, 2) / Math.pow(a + l + this.options.nodeDistance, 2) + Math.pow(r, 2) / Math.pow(s + d + this.options.nodeDistance, 2)) : i = Math.pow(e, 2) / Math.pow(this.options.nodeDistance, 2), 4 * i / 3 }, _SquareForce: function (e, t, n) { return 1 / this._InverseSquareForce(e, t, n) }, _repulsion: function (e) { e.dx = 0, e.dy = 0, p.forEach(this.graph.nodes, function (t) { var n, i, o, r; if (t !== e) { for (; e.x === t.x && e.y === t.y;)this._shake(t); n = e.x - t.x, i = e.y - t.y, o = Math.sqrt(n * n + i * i), r = 2 * this._SquareForce(o, e, t), e.dx += n / o * r, e.dy += i / o * r } }, this) }, _attraction: function (e) { var t, n, i, o, r, a, s = e.target, l = e.source; if (l !== s) { for (; l.x === s.x && l.y === s.y;)this._shake(s); t = l.x - s.x, n = l.y - s.y, i = Math.sqrt(t * t + n * n), o = 5 * this._InverseSquareForce(i, l, s), r = t / i * o, a = n / i * o, s.dx += r, s.dy += a, l.dx -= r, l.dy -= a } }, _expectedBounds: function () { var e, t, n, i, o, r = this.graph.nodes.length, a = 1.5, s = 4; return 0 === r ? e : (e = p.fold(this.graph.nodes, function (e, t) { var n = t.width * t.height; return n > 0 ? e += Math.sqrt(n) : 0 }, 0, this), t = e / r, n = t * Math.ceil(Math.sqrt(r)), i = n * Math.sqrt(a), o = n / Math.sqrt(a), { width: i * s, height: o * s }) } }), y = n.Class.extend({
init: function (e) { this.center = null, this.options = e }, layout: function (e, t) { if (this.graph = e, this.graph.nodes && 0 !== this.graph.nodes.length) { if (!v(this.graph.nodes, t)) throw "The given root is not in the graph."; this.center = t, this.graph.cacheRelationships(), this.layoutSwitch() } }, layoutLeft: function (e) { var t, n, i, o, r, a, s, d; for (this.setChildrenDirection(this.center, "Left", !1), this.setChildrenLayout(this.center, "Default", !1), t = 0, n = 0, o = 0; o < e.length; o++)r = e[o], r.TreeDirection = "Left", a = this.measure(r, l.Empty), n = Math.max(n, a.Width), t += a.height + this.options.verticalSeparation; for (t -= this.options.verticalSeparation, s = this.center.x - this.options.horizontalSeparation, i = this.center.y + (this.center.height - t) / 2, o = 0; o < e.length; o++)r = e[o], d = new f(s - r.Size.width, i), this.arrange(r, d), i += r.Size.height + this.options.verticalSeparation }, layoutRight: function (e) { var t, n, i, o, r, a, s, d; for (this.setChildrenDirection(this.center, "Right", !1), this.setChildrenLayout(this.center, "Default", !1), t = 0, n = 0, o = 0; o < e.length; o++)r = e[o], r.TreeDirection = "Right", a = this.measure(r, l.Empty), n = Math.max(n, a.Width), t += a.height + this.options.verticalSeparation; for (t -= this.options.verticalSeparation, s = this.center.x + this.options.horizontalSeparation + this.center.width, i = this.center.y + (this.center.height - t) / 2, o = 0; o < e.length; o++)r = e[o], d = new f(s, i), this.arrange(r, d), i += r.Size.height + this.options.verticalSeparation }, layoutUp: function (e) { var t, n, i, o, r, a, s; for (this.setChildrenDirection(this.center, "Up", !1), this.setChildrenLayout(this.center, "Default", !1), t = 0, o = 0; o < e.length; o++)i = e[o], i.TreeDirection = "Up", r = this.measure(i, l.Empty), t += r.width + this.options.horizontalSeparation; for (t -= this.options.horizontalSeparation, a = this.center.x + this.center.width / 2 - t / 2, o = 0; o < e.length; o++)i = e[o], n = this.center.y - this.options.verticalSeparation - i.Size.height, s = new f(a, n), this.arrange(i, s), a += i.Size.width + this.options.horizontalSeparation }, layoutDown: function (e) {
var t, n, i, o, r, a, s; for (this.setChildrenDirection(this.center, "Down", !1), this.setChildrenLayout(this.center, "Default", !1), i = 0, n = 0; n < e.length; n++)t = e[n], t.treeDirection = "Down", r = this.measure(t, l.Empty), i += r.width + this.options.horizontalSeparation; for (i -= this.options.horizontalSeparation, a = this.center.x + this.center.width / 2 - i / 2, o = this.center.y + this.options.verticalSeparation + this.center.height,
n = 0; n < e.length; n++)t = e[n], s = new f(a, o), this.arrange(t, s), a += t.Size.width + this.options.horizontalSeparation
}, layoutRadialTree: function () { var e, t; if (this.setChildrenDirection(this.center, "Radial", !1), this.setChildrenLayout(this.center, "Default", !1), this.previousRoot = null, e = this.options.startRadialAngle * m, t = this.options.endRadialAngle * m, t <= e) throw "Final angle should not be less than the start angle."; this.maxDepth = 0, this.origin = new f(this.center.x, this.center.y), this.calculateAngularWidth(this.center, 0), this.maxDepth > 0 && this.radialLayout(this.center, this.options.radialFirstLevelSeparation, e, t), this.center.Angle = t - e }, tipOverTree: function (e, t) { var n, i, o, r, a, s, d; for (p.isUndefined(t) && (t = 0), this.setChildrenDirection(this.center, "Down", !1), this.setChildrenLayout(this.center, "Default", !1), this.setChildrenLayout(this.center, "Underneath", !1, t), n = 0, r = 0; r < e.length; r++)o = e[r], o.TreeDirection = "Down", a = this.measure(o, l.Empty), n += a.width + this.options.horizontalSeparation; for (n -= this.options.horizontalSeparation, n -= e[e.length - 1].width, n += e[e.length - 1].associatedShape.bounds().width, s = this.center.x + this.center.width / 2 - n / 2, i = this.center.y + this.options.verticalSeparation + this.center.height, r = 0; r < e.length; r++)o = e[r], d = new f(s, i), this.arrange(o, d), s += o.Size.width + this.options.horizontalSeparation }, calculateAngularWidth: function (e, t) { var n, i, o, r, a, s, l; if (t > this.maxDepth && (this.maxDepth = t), n = 0, i = 1e3, o = 1e3, r = 0 === t ? 0 : Math.sqrt(i * i + o * o) / t, e.children.length > 0) { for (a = 0, s = e.children.length; a < s; a++)l = e.children[a], n += this.calculateAngularWidth(l, t + 1); n = Math.max(r, n) } else n = r; return e.sectorAngle = n, n }, sortChildren: function (e) { var t, n, i, o, r, a, s, l, d, c, u, h = 0; if (e.parents.length > 1) throw "Node is not part of a tree."; if (n = e.parents[0], n && (i = new f(n.x, n.y), o = new f(e.x, e.y), h = this.normalizeAngle(Math.atan2(i.y - o.y, i.x - o.x))), r = e.children.length, 0 === r) return null; for (a = [], s = [], t = 0; t < r; ++t)l = e.children[t], d = new f(l.x, l.y), s[t] = t, a[t] = this.normalizeAngle(-h + Math.atan2(d.y - d.y, d.x - d.x)); for (p.bisort(a, s), c = [], u = e.children, t = 0; t < r; ++t)c.push(u[s[t]]); return c }, normalizeAngle: function (e) { for (; e > 2 * Math.PI;)e -= 2 * Math.PI; for (; e < 0;)e += 2 * Math.PI; return e }, radialLayout: function (e, t, n, i) { var o, r, a, s, l, d = i - n, c = d / 2, u = e.sectorAngle, h = 0, p = this.sortChildren(e); for (o = 0, r = p.length; o < r; o++)a = p[o], s = a, l = s.sectorAngle / u, a.children.length > 0 && this.radialLayout(a, t + this.options.radialSeparation, n + h * d, n + (h + l) * d), this.setPolarLocation(a, t, n + h * d + l * c), s.angle = l * d, h += l }, setPolarLocation: function (e, t, n) { e.x = this.origin.x + t * Math.cos(n), e.y = this.origin.y + t * Math.sin(n), e.BoundingRectangle = new d(e.x, e.y, e.width, e.height) }, setChildrenDirection: function (e, t, n) { var i = e.treeDirection; this.graph.depthFirstTraversal(e, function (e) { e.treeDirection = t }), n || (e.treeDirection = i) }, setChildrenLayout: function (e, t, n, i) { p.isUndefined(i) && (i = 0); var o = e.childrenLayout; i > 0 ? (this.graph.assignLevels(e), this.graph.depthFirstTraversal(e, function (e) { e.level >= i + 1 && (e.childrenLayout = t) })) : (this.graph.depthFirstTraversal(e, function (e) { e.childrenLayout = t }), n || (e.childrenLayout = o)) }, measure: function (e, t) { var n, i, o, r, a, s, d, c = 0, u = 0, h = new l(0, 0); if (!e) throw ""; if (i = e.associatedShape.bounds(), o = i.width, r = i.height, 1 !== e.parents.length) throw "Node not in a spanning tree."; if (a = e.parents[0], "Undefined" === e.treeDirection && (e.treeDirection = a.treeDirection), p.isEmpty(e.children)) h = new l(Math.abs(o) < g ? 50 : o, Math.abs(r) < g ? 25 : r); else if (1 === e.children.length) { switch (e.treeDirection) { case "Radial": n = this.measure(e.children[0], t), c = o + this.options.radialSeparation * Math.cos(e.AngleToParent) + n.width, u = r + Math.abs(this.options.radialSeparation * Math.sin(e.AngleToParent)) + n.height; break; case "Left": case "Right": switch (e.childrenLayout) { case "TopAlignedWithParent": break; case "BottomAlignedWithParent": break; case "Underneath": n = this.measure(e.children[0], t), c = o + n.width + this.options.underneathHorizontalOffset, u = r + this.options.underneathVerticalTopOffset + n.height; break; case "Default": n = this.measure(e.children[0], t), c = o + this.options.horizontalSeparation + n.width, u = Math.max(r, n.height); break; default: throw "Unhandled TreeDirection in the Radial layout measuring." }break; case "Up": case "Down": switch (e.childrenLayout) { case "TopAlignedWithParent": case "BottomAlignedWithParent": break; case "Underneath": n = this.measure(e.children[0], t), c = Math.max(o, n.width + this.options.underneathHorizontalOffset), u = r + this.options.underneathVerticalTopOffset + n.height; break; case "Default": n = this.measure(e.children[0], t), u = r + this.options.verticalSeparation + n.height, c = Math.max(o, n.width); break; default: throw "Unhandled TreeDirection in the Down layout measuring." }break; default: throw "Unhandled TreeDirection in the layout measuring." }h = new l(c, u) } else { switch (e.treeDirection) { case "Left": case "Right": switch (e.childrenLayout) { case "TopAlignedWithParent": case "BottomAlignedWithParent": break; case "Underneath": for (c = o, u = r + this.options.underneathVerticalTopOffset, s = 0; s < e.children.length; s++)d = e.children[s], n = this.measure(d, t), c = Math.max(c, n.width + this.options.underneathHorizontalOffset), u += n.height + this.options.underneathVerticalSeparation; u -= this.options.underneathVerticalSeparation; break; case "Default": for (c = o, u = 0, s = 0; s < e.children.length; s++)d = e.children[s], n = this.measure(d, t), c = Math.max(c, o + this.options.horizontalSeparation + n.width), u += n.height + this.options.verticalSeparation; u -= this.options.verticalSeparation; break; default: throw "Unhandled TreeDirection in the Right layout measuring." }break; case "Up": case "Down": switch (e.childrenLayout) { case "TopAlignedWithParent": case "BottomAlignedWithParent": break; case "Underneath": for (c = o, u = r + this.options.underneathVerticalTopOffset, s = 0; s < e.children.length; s++)d = e.children[s], n = this.measure(d, t), c = Math.max(c, n.width + this.options.underneathHorizontalOffset), u += n.height + this.options.underneathVerticalSeparation; u -= this.options.underneathVerticalSeparation; break; case "Default": for (c = 0, u = 0, s = 0; s < e.children.length; s++)d = e.children[s], n = this.measure(d, t), c += n.width + this.options.horizontalSeparation, u = Math.max(u, n.height + this.options.verticalSeparation + r); c -= this.options.horizontalSeparation; break; default: throw "Unhandled TreeDirection in the Down layout measuring." }break; default: throw "Unhandled TreeDirection in the layout measuring." }h = new l(c, u) } return e.SectorAngle = Math.sqrt(c * c / 4 + u * u / 4), e.Size = h, h }, arrange: function (e, t) { var n, i, o, r, a, s, l, c, u = e.associatedShape.bounds(), h = u.width, m = u.height; if (p.isEmpty(e.children)) e.x = t.x, e.y = t.y, e.BoundingRectangle = new d(t.x, t.y, h, m); else switch (e.treeDirection) { case "Left": switch (e.childrenLayout) { case "TopAlignedWithParent": case "BottomAlignedWithParent": break; case "Underneath": for (c = t, e.x = c.x, e.y = c.y, e.BoundingRectangle = new d(e.x, e.y, e.width, e.height), l = t.y + m + this.options.underneathVerticalTopOffset, n = 0; n < r.children.length; n++)r = r.children[n], s = c.x - r.associatedShape.width - this.options.underneathHorizontalOffset, i = new f(s, l), this.arrange(r, i), l += r.Size.height + this.options.underneathVerticalSeparation; break; case "Default": for (c = new f(t.x + e.Size.width - h, t.y + (e.Size.height - m) / 2), e.x = c.x, e.y = c.y, e.BoundingRectangle = new d(e.x, e.y, e.width, e.height), s = c.x - this.options.horizontalSeparation, l = t.y, n = 0; n < e.children.length; n++)r = e.children[n], i = new f(s - r.Size.width, l), this.arrange(r, i), l += r.Size.height + this.options.verticalSeparation; break; default: throw "Unsupported TreeDirection" }break; case "Right": switch (e.childrenLayout) { case "TopAlignedWithParent": case "BottomAlignedWithParent": break; case "Underneath": for (c = t, e.x = c.x, e.y = c.y, e.BoundingRectangle = new d(e.x, e.y, e.width, e.height), s = t.x + h + this.options.underneathHorizontalOffset, l = t.y + m + this.options.underneathVerticalTopOffset, n = 0; n < e.children.length; n++)r = e.children[n], i = new f(s, l), this.arrange(r, i), l += r.Size.height + this.options.underneathVerticalSeparation; break; case "Default": for (c = new f(t.x, t.y + (e.Size.height - m) / 2), e.x = c.x, e.y = c.y, e.BoundingRectangle = new d(e.x, e.y, e.width, e.height), s = t.x + h + this.options.horizontalSeparation, l = t.y, n = 0; n < e.children.length; n++)r = e.children[n], i = new f(s, l), this.arrange(r, i), l += r.Size.height + this.options.verticalSeparation; break; default: throw "Unsupported TreeDirection" }break; case "Up": if (c = new f(t.x + (e.Size.width - h) / 2, t.y + e.Size.height - m), e.x = c.x, e.y = c.y, e.BoundingRectangle = new d(e.x, e.y, e.width, e.height), Math.abs(c.x - t.x) < g) { for (a = 0, n = 0; n < e.children.length; n++)o = e.children[n], a += o.Size.width + this.options.horizontalSeparation; a -= this.options.horizontalSeparation, s = t.x + (h - a) / 2 } else s = t.x; for (n = 0; n < e.children.length; n++)r = e.children[n], l = c.y - this.options.verticalSeparation - r.Size.height, i = new f(s, l), this.arrange(r, i), s += r.Size.width + this.options.horizontalSeparation; break; case "Down": switch (e.childrenLayout) { case "TopAlignedWithParent": case "BottomAlignedWithParent": break; case "Underneath": for (c = t, e.x = c.x, e.y = c.y, e.BoundingRectangle = new d(e.x, e.y, e.width, e.height), s = t.x + this.options.underneathHorizontalOffset, l = t.y + m + this.options.underneathVerticalTopOffset, n = 0; n < e.children.length; n++)r = e.children[n], i = new f(s, l), this.arrange(r, i), l += r.Size.height + this.options.underneathVerticalSeparation; break; case "Default": if (c = new f(t.x + (e.Size.width - h) / 2, t.y), e.x = c.x, e.y = c.y, e.BoundingRectangle = new d(e.x, e.y, e.width, e.height), Math.abs(c.x - t.x) < g) { for (a = 0, n = 0; n < e.children.length; n++)o = e.children[n], a += o.Size.width + this.options.horizontalSeparation; a -= this.options.horizontalSeparation, s = t.x + (h - a) / 2 } else s = t.x; for (n = 0; n < e.children.length; n++)r = e.children[n], l = c.y + this.options.verticalSeparation + m, i = new f(s, l), this.arrange(r, i), s += r.Size.width + this.options.horizontalSeparation; break; default: throw "Unsupported TreeDirection" }break; case "None": break; default: throw "Unsupported TreeDirection" } }, layoutSwitch: function () { var e, t, n, i, o, r; if (this.center && !p.isEmpty(this.center.children)) switch (e = this.options.subtype, p.isUndefined(e) && (e = "Down"), r = this.center.children, e.toLowerCase()) { case "radial": case "radialtree": this.layoutRadialTree(); break; case "mindmaphorizontal": case "mindmap": t = this.center.children, 1 === this.center.children.length ? this.layoutRight(t) : (o = r.length / 2, n = _(this.center.children, function (e) { return p.indexOf(r, e) < o }), i = _(this.center.children, function (e) { return p.indexOf(r, e) >= o }), this.layoutLeft(n), this.layoutRight(i)); break; case "mindmapvertical": t = this.center.children, 1 === this.center.children.length ? this.layoutDown(t) : (o = r.length / 2, n = _(this.center.children, function (e) { return p.indexOf(r, e) < o }), i = _(this.center.children, function (e) { return p.indexOf(r, e) >= o }), this.layoutUp(n), this.layoutDown(i)); break; case "right": this.layoutRight(this.center.children); break; case "left": this.layoutLeft(this.center.children); break; case "up": case "bottom": this.layoutUp(this.center.children); break; case "down": case "top": this.layoutDown(this.center.children); break; case "tipover": case "tipovertree": if (this.options.tipOverTreeStartLevel < 0) throw "The tip-over level should be a positive integer."; this.tipOverTree(this.center.children, this.options.tipOverTreeStartLevel); break; case "undefined": case "none": } }
}), x = b.extend({ init: function (e) { var t = this; if (b.fn.init.call(t), p.isUndefined(e)) throw "No diagram specified."; this.diagram = e }, layout: function (e) { var t, n; return this.transferOptions(e), t = new w(this.diagram), this.graph = t.convert(), n = this.layoutComponents(), new i.LayoutState(this.diagram, n) }, layoutComponents: function () { var e, t, n, i, o, r, a, s; if (!this.graph.isEmpty() && (e = this.graph.getConnectedComponents(), !p.isEmpty(e))) { for (t = new y(this.options), n = [], i = 0; i < e.length; i++) { if (o = e[i], r = this.getTree(o), !r) throw "Failed to find a spanning tree for the component."; a = r.root, s = r.tree, t.layout(s, a), n.push(s) } return this.gridLayoutComponents(n) } }, getTree: function (e) { var t, n, i, o, r, a = null; if (this.options.roots && this.options.roots.length > 0) for (t = 0, n = e.nodes.length; t < n; t++)for (i = e.nodes[t], o = 0; o < this.options.roots.length; o++)if (r = this.options.roots[o], r === i.associatedShape) { a = i; break } if (!a && (a = e.root(), !a)) throw "Unable to find a root for the tree."; return this.getTreeForRoot(e, a) }, getTreeForRoot: function (e, t) { var n = e.getSpanningTree(t); return p.isUndefined(n) || n.isEmpty() ? null : { tree: n, root: n.root } } }), C = b.extend({ init: function (e) { var t = this; if (b.fn.init.call(t), p.isUndefined(e)) throw "Diagram is not specified."; this.diagram = e }, layout: function (e) { var t, n, o, r, a, s; if (this.transferOptions(e), t = new w(this.diagram), n = t.convert(e), !n.isEmpty() && (o = n.getConnectedComponents(), !p.isEmpty(o))) { for (r = 0; r < o.length; r++)a = o[r], this.layoutGraph(a, e); return s = this.gridLayoutComponents(o), new i.LayoutState(this.diagram, s) } }, _initRuntimeProperties: function () { var e, t; for (e = 0; e < this.graph.nodes.length; e++)t = this.graph.nodes[e], t.layer = -1, t.downstreamLinkCount = 0, t.upstreamLinkCount = 0, t.isVirtual = !1, t.uBaryCenter = 0, t.dBaryCenter = 0, t.upstreamPriority = 0, t.downstreamPriority = 0, t.gridPosition = 0 }, _prepare: function (e) { var t, n, i, o, r, a, s, l, d, u, h, f = [], g = new c, m = 0; for (p.forEach(e.nodes, function (e) { 0 === e.incoming.length && (g.set(e, 0), f.push(e)) }); f.length > 0;)for (r = f.shift(), t = 0; t < r.outgoing.length; t++)i = r.outgoing[t], a = i.target, o = g.containsKey(a) ? Math.max(g.get(r) + 1, g.get(a)) : g.get(r) + 1, g.set(a, o), o > m && (m = o), v(f, a) || f.push(a); for (s = g.keys(), s.sort(function (e, t) { var n = g.get(e), i = g.get(t); return p.sign(i - n) }), l = 0; l < s.length; ++l)if (d = s[l], u = Number.MAX_VALUE, 0 !== d.outgoing.length) { for (n = 0; n < d.outgoing.length; ++n)i = d.outgoing[n], u = Math.min(u, g.get(i.target)); u > 1 && g.set(d, u - 1) } for (this.layers = [], t = 0; t < m + 1; t++)h = [], h.linksTo = {}, this.layers.push(h); for (g.forEach(function (e, t) { e.layer = t, this.layers[t].push(e) }, this), n = 0; n < this.layers.length; n++)for (h = this.layers[n], t = 0; t < h.length; t++)h[t].gridPosition = t }, layoutGraph: function (e, t) { if (p.isUndefined(e)) throw "No graph given or graph analysis of the diagram failed."; p.isDefined(t) && this.transferOptions(t), this.graph = e, e.setItemIndices(); var n = e.makeAcyclic(); this._initRuntimeProperties(), this._prepare(e, t), this._dummify(), this._optimizeCrossings(), this._swapPairs(), this.arrangeNodes(), this._moveThingsAround(), this._dedummify(), p.forEach(n, function (e) { e.points && e.points.reverse() }) }, setMinDist: function (e, t, n) { var i = e.layer, o = e.layerIndex; this.minDistances[i][o] = n }, getMinDist: function (e, t) { var n, i = 0, o = e.layerIndex, r = t.layerIndex, a = e.layer, s = Math.min(o, r), l = Math.max(o, r); for (n = s; n < l; ++n)i += this.minDistances[a][n]; return i }, placeLeftToRight: function (e) { var t, n, i, o, r, a, s, l, d, u, h = new c; for (i = 0; i < this.layers.length; ++i)if (o = e[i]) { for (t = 0; t < o.length; t++)n = o[t], h.containsKey(n) || this.placeLeft(n, h, i); for (r = Number.POSITIVE_INFINITY, t = 0; t < o.length; t++)n = o[t], a = this.rightSibling(n), a && this.nodeLeftClass.get(a) !== i && (r = Math.min(r, h.get(a) - h.get(n) - this.getMinDist(n, a))); if (r === Number.POSITIVE_INFINITY) { for (s = [], t = 0; t < o.length; t++)for (n = o[t], l = [], p.addRange(l, this.upNodes.get(n)), p.addRange(l, this.downNodes.get(n)), d = 0; d < l.length; d++)u = l[d], this.nodeLeftClass.get(u) < i && s.push(h.get(u) - h.get(n)); s.sort(), r = 0 === s.length ? 0 : s.length % 2 === 1 ? s[this.intDiv(s.length, 2)] : (s[this.intDiv(s.length, 2) - 1] + s[this.intDiv(s.length, 2)]) / 2 } for (t = 0; t < o.length; t++)n = o[t], h.set(n, h.get(n) + r) } return h }, placeRightToLeft: function (e) { var t, n, i, o, r, a, s, l, d, u, h = new c; for (i = 0; i < this.layers.length; ++i)if (o = e[i]) { for (t = 0; t < o.length; t++)n = o[t], h.containsKey(n) || this.placeRight(n, h, i); for (r = Number.NEGATIVE_INFINITY, t = 0; t < o.length; t++)n = o[t], a = this.leftSibling(n), a && this.nodeRightClass.get(a) !== i && (r = Math.max(r, h.get(a) - h.get(n) + this.getMinDist(a, n))); if (r === Number.NEGATIVE_INFINITY) { for (s = [], t = 0; t < o.length; t++)for (n = o[t], l = [], p.addRange(l, this.upNodes.get(n)), p.addRange(l, this.downNodes.get(n)), d = 0; d < l.length; d++)u = l[d], this.nodeRightClass.get(u) < i && s.push(h.get(n) - h.get(u)); s.sort(), r = 0 === s.length ? 0 : s.length % 2 === 1 ? s[this.intDiv(s.length, 2)] : (s[this.intDiv(s.length, 2) - 1] + s[this.intDiv(s.length, 2)]) / 2 } for (t = 0; t < o.length; t++)n = o[t], h.set(n, h.get(n) + r) } return h }, _getLeftWing: function () { var e = { value: null }, t = this.computeClasses(e, 1); return this.nodeLeftClass = e.value, t }, _getRightWing: function () { var e = { value: null }, t = this.computeClasses(e, -1); return this.nodeRightClass = e.value, t }, computeClasses: function (e, t) { var n, i, o, r, a, s, l, d, u, h = 0, p = e.value = new c; for (n = 0; n < this.layers.length; ++n)for (h = n, i = this.layers[n], o = 1 === t ? 0 : i.length - 1; 0 <= o && o < i.length; o += t)if (r = i[o], p.containsKey(r)) h = p.get(r); else if (p.set(r, h), r.isVirtual) for (a = this._nodesInLink(r), s = 0; s < a.length; s++)l = a[s], p.set(l, h); for (d = [], u = 0; u < this.layers.length; u++)d.push(null); return p.forEach(function (e, t) { null === d[t] && (d[t] = []), d[t].push(e) }), d }, _isVerticalLayout: function () { return "up" === this.options.subtype.toLowerCase() || "down" === this.options.subtype.toLowerCase() || "vertical" === this.options.subtype.toLowerCase() }, _isHorizontalLayout: function () { return "right" === this.options.subtype.toLowerCase() || "left" === this.options.subtype.toLowerCase() || "horizontal" === this.options.subtype.toLowerCase() }, _isIncreasingLayout: function () { return "right" === this.options.subtype.toLowerCase() || "down" === this.options.subtype.toLowerCase() }, _moveThingsAround: function () { function e(e, t) { var n, i, o = Number.MIN_VALUE; for (n = 0; n < e.length; ++n)i = e[n], o = t._isVerticalLayout() ? Math.max(o, i.height) : Math.max(o, i.width); return o } var t, n, i, o, r, a, s, l, d, u, h, f, g, m, v, _, b, w, k, y, x, C, S, T, D, A, E; for (n = 0; n < this.layers.length; ++n)o = this.layers[n], o.sort(this._gridPositionComparer); for (this.minDistances = [], n = 0; n < this.layers.length; ++n)for (o = this.layers[n], this.minDistances[n] = [], r = 0; r < o.length; ++r)i = o[r], i.layerIndex = r, this.minDistances[n][r] = this.options.nodeDistance, r < o.length - 1 && (this.minDistances[n][r] += this._isVerticalLayout() ? (i.width + o[r + 1].width) / 2 : (i.height + o[r + 1].height) / 2); for (this.downNodes = new c, this.upNodes = new c, p.forEach(this.graph.nodes, function (e) { this.downNodes.set(e, []), this.upNodes.set(e, []) }, this), p.forEach(this.graph.links, function (e) { var t = e.source, n = e.target, i = null, o = null; t.layer > n.layer ? (i = e.source, o = e.target) : (o = e.source, i = e.target), this.downNodes.get(o).push(i), this.upNodes.get(i).push(o) }, this), this.downNodes.forEachValue(function (e) { e.sort(this._gridPositionComparer) }, this), this.upNodes.forEachValue(function (e) { e.sort(this._gridPositionComparer) }, this), n = 0; n < this.layers.length - 1; ++n)for (o = this.layers[n], a = 0; a < o.length - 1; a++)if (s = o[a], s.isVirtual && (l = this.downNodes.get(s)[0], l.isVirtual)) for (r = a + 1; r < o.length; ++r)i = o[r], i.isVirtual && (d = this.downNodes.get(i)[0], d.isVirtual && l.gridPosition > d.gridPosition && (u = l.gridPosition, l.gridPosition = d.gridPosition, d.gridPosition = u, h = l.layerIndex, f = d.layerIndex, this.layers[n + 1][h] = d, this.layers[n + 1][f] = l, l.layerIndex = f, d.layerIndex = h)); for (g = this._getLeftWing(), m = this._getRightWing(), v = this.placeLeftToRight(g), _ = this.placeRightToLeft(m), b = new c, p.forEach(this.graph.nodes, function (e) { b.set(e, (v.get(e) + _.get(e)) / 2) }), w = new c, k = new c, n = 0; n < this.layers.length; ++n)for (o = this.layers[n], y = -1, x = -1, r = 0; r < o.length; ++r)i = o[r], w.set(i, 0), k.set(i, !1), i.isVirtual && (y === -1 ? y = r : y === r - 1 ? y = r : (x = r, w.set(o[y], 0), b.get(i) - b.get(o[y]) === this.getMinDist(o[y], i) ? k.set(o[y], !0) : k.set(o[y], !1), y = r)); for (C = [1, -1], p.forEach(C, function (e) { var n, i, o, r, a, s, l, d = 1 === e ? 0 : this.layers.length - 1; for (n = d; 0 <= n && n < this.layers.length; n += e) { if (i = this.layers[n], o = this._firstVirtualNode(i), r = null, a = null, o !== -1) for (r = i[o], a = [], t = 0; t < o; t++)a.push(i[t]); else r = null, a = i; if (a.length > 0) { for (this._sequencer(b, null, r, e, a), t = 0; t < a.length - 1; ++t)this.setMinDist(a[t], a[t + 1], b.get(a[t + 1]) - b.get(a[t])); r && this.setMinDist(a[a.length - 1], r, b.get(r) - b.get(a[a.length - 1])) } for (; r;) { if (s = this.nextVirtualNode(i, r)) { if (w.get(r) === e) { for (o = r.layerIndex, l = s.layerIndex, a = [], t = o + 1; t < l; t++)a.push(i[t]); a.length > 0 && this._sequencer(b, r, s, e, a), k.set(r, !0) } } else { for (o = r.layerIndex, a = [], t = o + 1; t < i.length; t++)a.push(i[t]); if (a.length > 0) { for (this._sequencer(b, r, null, e, a), t = 0; t < a.length - 1; ++t)this.setMinDist(a[t], a[t + 1], b.get(a[t + 1]) - b.get(a[t])); this.setMinDist(r, a[0], b.get(a[0]) - b.get(r)) } } r = s } this.adjustDirections(n, e, w, k) } }, this), S = this._isIncreasingLayout() ? 0 : this.layers.length - 1, T = function (e, t) { return t._isIncreasingLayout() ? e < t.layers.length : e >= 0 }, D = this._isIncreasingLayout() ? 1 : -1, A = 0, t = S; T(t, this); t += D) { for (o = this.layers[t], E = e(o, this), r = 0; r < o.length; ++r)i = o[r], this._isVerticalLayout() ? (i.x = b.get(i), i.y = A + E / 2) : (i.x = A + E / 2, i.y = b.get(i)); A += this.options.layerSeparation + E } }, adjustDirections: function (e, t, n, i) { var o, r, a, s, l, d, c, u, h, p, f, g, m, v; if (!(e + t < 0 || e + t >= this.layers.length)) for (o = null, r = null, a = this.layers[e + t], s = 0; s < a.length; ++s)if (l = a[s], l.isVirtual && (d = this.getNeighborOnLayer(l, e), d.isVirtual)) { if (o) { for (c = i.get(r), u = this.layers[e], h = r.layerIndex, p = d.layerIndex, f = h + 1; f < p; ++f)u[f].isVirtual && (c = c && i.get(u[f])); if (c) for (n.set(o, t), g = o.layerIndex, m = l.layerIndex, v = g + 1; v < m; ++v)a[v].isVirtual && n.set(a[v], t) } o = l, r = d } }, getNeighborOnLayer: function (e, t) { var n = this.upNodes.get(e)[0]; return n.layer === t ? n : (n = this.downNodes.get(e)[0], n.layer === t ? n : null) }, _sequencer: function (e, t, n, i, o) { if (1 === o.length && this._sequenceSingle(e, t, n, i, o[0]), o.length > 1) { var r = o.length, a = this.intDiv(r, 2); this._sequencer(e, t, n, i, o.slice(0, a)), this._sequencer(e, t, n, i, o.slice(a)), this.combineSequences(e, t, n, i, o) } }, _sequenceSingle: function (e, t, n, i, o) { var r = i === -1 ? this.downNodes.get(o) : this.upNodes.get(o), a = r.length; 0 !== a && (a % 2 === 1 ? e.set(o, e.get(r[this.intDiv(a, 2)])) : e.set(o, (e.get(r[this.intDiv(a, 2) - 1]) + e.get(r[this.intDiv(a, 2)])) / 2), t && e.set(o, Math.max(e.get(o), e.get(t) + this.getMinDist(t, o))), n && e.set(o, Math.min(e.get(o), e.get(n) - this.getMinDist(o, n)))) }, combineSequences: function (e, t, n, i, o) { var r, a, s, l, d, c, u, h, p, f, g = o.length, m = this.intDiv(g, 2), v = []; for (r = 0; r < m; ++r) { for (a = 0, l = i === -1 ? this.downNodes.get(o[r]) : this.upNodes.get(o[r]), s = 0; s < l.length; ++s)d = l[s], e.get(d) >= e.get(o[r]) ? a++ : (a--, v.push({ k: e.get(d) + this.getMinDist(o[r], o[m - 1]), v: 2 })); v.push({ k: e.get(o[r]) + this.getMinDist(o[r], o[m - 1]), v: a }) } for (t && v.push({ k: e.get(t) + this.getMinDist(t, o[m - 1]), v: Number.MAX_VALUE }), v.sort(this._positionDescendingComparer), u = [], r = m; r < g; ++r) { for (a = 0, l = i === -1 ? this.downNodes.get(o[r]) : this.upNodes.get(o[r]), s = 0; s < l.length; ++s)d = l[s], e.get(d) <= e.get(o[r]) ? a++ : (a--, u.push({ k: e.get(d) - this.getMinDist(o[r], o[m]), v: 2 })); u.push({ k: e.get(o[r]) - this.getMinDist(o[r], o[m]), v: a }) } for (n && u.push({ k: e.get(n) - this.getMinDist(n, o[m]), v: Number.MAX_VALUE }), u.sort(this._positionAscendingComparer), h = 0, p = 0, f = this.getMinDist(o[m - 1], o[m]); e.get(o[m]) - e.get(o[m - 1]) < f;)if (h < p) { if (0 === v.length) { e.set(o[m - 1], e.get(o[m]) - f); break } c = v.shift(), h += c.v, e.set(o[m - 1], c.k), e.set(o[m - 1], Math.max(e.get(o[m - 1]), e.get(o[m]) - f)) } else { if (0 === u.length) { e.set(o[m], e.get(o[m - 1]) + f); break } c = u.shift(), p += c.v, e.set(o[m], c.k), e.set(o[m], Math.min(e.get(o[m]), e.get(o[m - 1]) + f)) } for (r = m - 2; r >= 0; r--)e.set(o[r], Math.min(e.get(o[r]), e.get(o[m - 1]) - this.getMinDist(o[r], o[m - 1]))); for (r = m + 1; r < g; r++)e.set(o[r], Math.max(e.get(o[r]), e.get(o[m]) + this.getMinDist(o[r], o[m]))) }, placeLeft: function (e, t, n) { var i = Number.NEGATIVE_INFINITY; p.forEach(this._getComposite(e), function (e) { var o = this.leftSibling(e); o && this.nodeLeftClass.get(o) === this.nodeLeftClass.get(e) && (t.containsKey(o) || this.placeLeft(o, t, n), i = Math.max(i, t.get(o) + this.getMinDist(o, e))) }, this), i === Number.NEGATIVE_INFINITY && (i = 0), p.forEach(this._getComposite(e), function (e) { t.set(e, i) }) }, placeRight: function (e, t, n) { var i = Number.POSITIVE_INFINITY; p.forEach(this._getComposite(e), function (e) { var o = this.rightSibling(e); o && this.nodeRightClass.get(o) === this.nodeRightClass.get(e) && (t.containsKey(o) || this.placeRight(o, t, n), i = Math.min(i, t.get(o) - this.getMinDist(e, o))) }, this), i === Number.POSITIVE_INFINITY && (i = 0), p.forEach(this._getComposite(e), function (e) { t.set(e, i) }) }, leftSibling: function (e) { var t = this.layers[e.layer], n = e.layerIndex; return 0 === n ? null : t[n - 1] }, rightSibling: function (e) { var t = this.layers[e.layer], n = e.layerIndex; return n === t.length - 1 ? null : t[n + 1] }, _getComposite: function (e) { return e.isVirtual ? this._nodesInLink(e) : [e] }, arrangeNodes: function () { var e, t, n, i, o, r, a, s; for (t = 0; t < this.layers.length; t++)for (i = this.layers[t], n = 0; n < i.length; n++)o = i[n], o.upstreamPriority = o.upstreamLinkCount, o.downstreamPriority = o.downstreamLinkCount; for (r = 2, a = 0; a < r; a++) { for (e = this.layers.length - 1; e >= 1; e--)this.layoutLayer(!1, e); for (e = 0; e < this.layers.length - 1; e++)this.layoutLayer(!0, e) } for (s = Number.MAX_VALUE, t = 0; t < this.layers.length; t++)for (i = this.layers[t], n = 0; n < i.length; n++)o = i[n], s = Math.min(s, o.gridPosition); if (s < 0) for (t = 0; t < this.layers.length; t++)for (i = this.layers[t], n = 0; n < i.length; n++)o = i[n], o.gridPosition = o.gridPosition - s }, layoutLayer: function (e, t) { var n, i, o, r; for (i = e ? this.layers[n = t + 1] : this.layers[n = t - 1], o = [], r = 0; r < i.length; r++)o.push(i[r]); o.sort(function (e, t) { var n = (e.upstreamPriority + e.downstreamPriority) / 2, i = (t.upstreamPriority + t.downstreamPriority) / 2; return Math.abs(n - i) < 1e-4 ? 0 : n < i ? 1 : -1 }), p.forEach(o, function (e) { var t = e.gridPosition, n = this.calcBaryCenter(e), o = (e.upstreamPriority + e.downstreamPriority) / 2; if (!(Math.abs(t - n) < 1e-4 || Math.abs(t - n) < .2501)) if (t < n) for (; t < n && this.moveRight(e, i, o);)t = e.gridPosition; else for (; t > n && this.moveLeft(e, i, o);)t = e.gridPosition }, this), n > 0 && this.calcDownData(n - 1), n < this.layers.length - 1 && this.calcUpData(n + 1) }, moveRight: function (e, t, n) { var i, o, r = p.indexOf(t, e); return r === t.length - 1 ? (e.gridPosition = e.gridPosition + .5, !0) : (i = t[r + 1], o = (i.upstreamPriority + i.downstreamPriority) / 2, i.gridPosition > e.gridPosition + 1 ? (e.gridPosition = e.gridPosition + .5, !0) : !(o > n || Math.abs(o - n) < 1e-4) && (!!this.moveRight(i, t, n) && (e.gridPosition = e.gridPosition + .5, !0))) }, moveLeft: function (e, t, n) { var i, o, r = p.indexOf(t, e); return 0 === r ? (e.gridPosition = e.gridPosition - .5, !0) : (i = t[r - 1], o = (i.upstreamPriority + i.downstreamPriority) / 2, i.gridPosition < e.gridPosition - 1 ? (e.gridPosition = e.gridPosition - .5, !0) : !(o > n || Math.abs(o - n) < 1e-4) && (!!this.moveLeft(i, t, n) && (e.gridPosition = e.gridPosition - .5, !0))) }, mapVirtualNode: function (e, t) { this.nodeToLinkMap.set(e, t), this.linkToNodeMap.containsKey(t) || this.linkToNodeMap.set(t, []), this.linkToNodeMap.get(t).push(e) }, _nodesInLink: function (e) { return this.linkToNodeMap.get(this.nodeToLinkMap.get(e)) }, _dummify: function () { var e, t, n, i, o, s, l, d, u, h, f, g, m, v, _, b, w, k, y, x; for (this.linkToNodeMap = new c, this.nodeToLinkMap = new c, u = this.graph.links.slice(0), h = this.layers, f = function (e, t, n) { h[e].linksTo[t] = h[e].linksTo[t] || [], h[e].linksTo[t].push(n) }, d = 0; d < u.length; d++)if (g = u[d], m = g.source, v = g.target, _ = m.layer, b = v.layer, w = m.gridPosition, k = v.gridPosition, y = (k - w) / Math.abs(b - _), x = m, _ - b > 1) { for (l = _ - 1; l > b; l--) { for (n = new r, n.x = m.x, n.y = m.y, n.width = m.width / 100, n.height = m.height / 100, e = h[l], t = (l - b) * y + w, t > e.length && (t = e.length), w >= h[_].length - 1 && k >= h[b].length - 1 ? t = e.length : 0 === w && 0 === k && (t = 0), n.layer = l, n.uBaryCenter = 0, n.dBaryCenter = 0, n.upstreamLinkCount = 0, n.downstreamLinkCount = 0, n.gridPosition = t, n.isVirtual = !0, p.insert(e, n, t), o = t + 1; o < e.length; o++)i = e[o], i.gridPosition = i.gridPosition + 1; s = new a(x, n), s.depthOfDumminess = 0, f(l - 1, l, s), x = n, this.graph._addNode(n), this.graph.addLink(s), n.index = this.graph.nodes.length - 1, this.mapVirtualNode(n, g) } f(b - 1, b, s), g.changeSource(x), g.depthOfDumminess = _ - b - 1 } else if (_ - b < -1) { for (l = _ + 1; l < b; l++) { for (n = new r, n.x = m.x, n.y = m.y, n.width = m.width / 100, n.height = m.height / 100, e = h[l], t = (l - _) * y + w, t > e.length && (t = e.length), w >= h[_].length - 1 && k >= h[b].length - 1 ? t = e.length : 0 === w && 0 === k && (t = 0), n.layer = l, n.uBaryCenter = 0, n.dBaryCenter = 0, n.upstreamLinkCount = 0, n.downstreamLinkCount = 0, n.gridPosition = t, n.isVirtual = !0, t &= t, p.insert(e, n, t), o = t + 1; o < e.length; o++)i = e[o], i.gridPosition = i.gridPosition + 1; s = new a(x, n), s.depthOfDumminess = 0, f(l - 1, l, s), x = n, this.graph._addNode(n), this.graph.addLink(s), n.index = this.graph.nodes.length - 1, this.mapVirtualNode(n, g) } f(b - 1, b, g), g.changeSource(x), g.depthOfDumminess = b - _ - 1 } else f(_, b, g) }, _dedummify: function () { for (var e, t, n, i, o, r, a, s, l = !0; l;)for (l = !1, e = 0; e < this.graph.links.length; e++)if (t = this.graph.links[e], t.depthOfDumminess) { for (n = [], n.unshift({ x: t.target.x, y: t.target.y }), n.unshift({ x: t.source.x, y: t.source.y }), i = t, o = t.depthOfDumminess, r = 0; r < o; r++)a = i.source, s = a.incoming[0], n.unshift({ x: s.source.x, y: s.source.y }), i = s; t.changeSource(i.source), t.depthOfDumminess = 0, n.length > 2 ? (n.splice(0, 1), n.splice(n.length - 1), t.points = n) : t.points = [], l = !0; break } }, _optimizeCrossings: function () { for (var e, t = -1, n = 3, i = 0; 0 !== t && !(i++ > n);) { for (t = 0, e = this.layers.length - 1; e >= 1; e--)t += this.optimizeLayerCrossings(!1, e); for (e = 0; e < this.layers.length - 1; e++)t += this.optimizeLayerCrossings(!0, e) } }, calcUpData: function (e) { var t, n, i, o, r, a, s, l, d; if (0 !== e) { for (t = this.layers[e], r = new u, a = this.layers[e - 1], n = 0; n < a.length; n++)r.add(a[n]); for (n = 0; n < t.length; n++) { for (s = t[n], l = 0, d = 0, i = 0; i < s.incoming.length; i++)o = s.incoming[i], r.contains(o.source) && (d++, l += o.source.gridPosition); for (i = 0; i < s.outgoing.length; i++)o = s.outgoing[i], r.contains(o.target) && (d++, l += o.target.gridPosition); d > 0 ? (s.uBaryCenter = l / d, s.upstreamLinkCount = d) : (s.uBaryCenter = n, s.upstreamLinkCount = 0) } } }, calcDownData: function (e) { var t, n, i, o, r, a, s, l, d; if (e !== this.layers.length - 1) { for (t = this.layers[e], r = new u, a = this.layers[e + 1], n = 0; n < a.length; n++)r.add(a[n]); for (n = 0; n < t.length; n++) { for (s = t[n], l = 0, d = 0, i = 0; i < s.incoming.length; i++)o = s.incoming[i], r.contains(o.source) && (d++, l += o.source.gridPosition); for (i = 0; i < s.outgoing.length; i++)o = s.outgoing[i], r.contains(o.target) && (d++, l += o.target.gridPosition); d > 0 ? (s.dBaryCenter = l / d, s.downstreamLinkCount = d) : (s.dBaryCenter = n, s.downstreamLinkCount = 0) } } }, optimizeLayerCrossings: function (e, t) { var n, i, o, r, a, s, l, d; for (i = e ? this.layers[n = t + 1] : this.layers[n = t - 1], o = i.slice(0), e ? this.calcUpData(n) : this.calcDownData(n), r = this, i.sort(function (e, t) { var n, i = r.calcBaryCenter(e), o = r.calcBaryCenter(t); return Math.abs(i - o) < 1e-4 ? e.degree() === t.degree() ? r.compareByIndex(e, t) : e.degree() < t.degree() ? 1 : -1 : (n = 1e3 * (o - i), n > 0 ? -1 : n < 0 ? 1 : r.compareByIndex(e, t)) }), s = 0, a = 0; a < i.length; a++)i[a] !== o[a] && s++; if (s > 0) for (l = 0, a = 0; a < i.length; a++)d = i[a], d.gridPosition = l++; return s }, _swapPairs: function () { for (var e, t, n, i, o, r, a, s, l, d, c, u, h, p, f, g, m, v = this.options.layeredIterations, _ = 0; ;) { if (_++ > v) break; for (e = _ % 4 <= 1, t = _ % 4 === 1, n = e ? 0 : this.layers.length - 1; e ? n <= this.layers.length - 1 : n >= 0; n += e ? 1 : -1) { for (i = this.layers[n], o = !1, r = !0, a = 0, s = 0; s < i.length - 1; s++)l = 0, d = 0, c = 0, r ? (0 !== n && (l = this.countLinksCrossingBetweenTwoLayers(n - 1, n)), n !== this.layers.length - 1 && (d = this.countLinksCrossingBetweenTwoLayers(n, n + 1)), e ? l *= 2 : d *= 2, c = l + d) : c = a, 0 !== c && (u = i[s], h = i[s + 1], p = u.gridPosition, f = h.gridPosition, i[s] = h, i[s + 1] = u, u.gridPosition = f, h.gridPosition = p, l = 0, 0 !== n && (l = this.countLinksCrossingBetweenTwoLayers(n - 1, n)), d = 0, n !== this.layers.length - 1 && (d = this.countLinksCrossingBetweenTwoLayers(n, n + 1)), e ? l *= 2 : d *= 2, g = l + d, m = !1, m = t ? g >= c : g > c, m ? (u = i[s], h = i[s + 1], p = u.gridPosition, f = h.gridPosition, i[s] = h, i[s + 1] = u, u.gridPosition = f, h.gridPosition = p, a = c, r = !1) : (o = !0, r = !0)); o && (n !== this.layers.length - 1 && this.calcUpData(n + 1), 0 !== n && this.calcDownData(n - 1)) } } }, countLinksCrossingBetweenTwoLayers: function (e, t) { var n, i, o, r, a, s, l, d, c, u, h, p, f = this.layers[e].linksTo[t], g = 0, m = f.length; for (l = 0; l < m; l++)for (n = f[l], d = l + 1; d < m; d++)i = f[d], n.target.layer === t ? (o = n.source, r = n.target) : (o = n.target, r = n.source), i.target.layer === t ? (a = i.source, s = i.target) : (a = i.target, s = i.source), c = o.gridPosition, u = r.gridPosition, h = a.gridPosition, p = s.gridPosition, (c - h) * (u - p) < 0 && g++; return g }, calcBaryCenter: function (e) { var t = e.upstreamLinkCount, n = e.downstreamLinkCount, i = e.uBaryCenter, o = e.dBaryCenter; return t > 0 && n > 0 ? (i + o) / 2 : t > 0 ? i : n > 0 ? o : 0 }, _gridPositionComparer: function (e, t) { return e.gridPosition < t.gridPosition ? -1 : e.gridPosition > t.gridPosition ? 1 : 0 }, _positionAscendingComparer: function (e, t) { return e.k < t.k ? -1 : e.k > t.k ? 1 : 0 }, _positionDescendingComparer: function (e, t) { return e.k < t.k ? 1 : e.k > t.k ? -1 : 0 }, _firstVirtualNode: function (e) { for (var t = 0; t < e.length; t++)if (e[t].isVirtual) return t; return -1 }, compareByIndex: function (e, t) { var n = e.index, i = t.index; return n < i ? 1 : n > i ? -1 : 0 }, intDiv: function (e, t) { return (e - e % t) / t }, nextVirtualNode: function (e, t) { var n, i = t.layerIndex; for (n = i + 1; n < e.length; ++n)if (e[n].isVirtual) return e[n]; return null } }), S = n.Class.extend({
init: function (e, t) { if (p.isUndefined(e)) throw "No diagram given"; this.diagram = e, this.nodeMap = new c, this.linkMap = new c, this.capture(t ? t : e) }, capture: function (e) {
var t, n, o, r, a, s, l, c, u; if (e instanceof i.Graph) { for (r = 0; r < e.nodes.length; r++)t = e.nodes[r], o = t.associatedShape, this.nodeMap.set(o.visual.id, new d(t.x, t.y, t.width, t.height)); for (r = 0; r < e.links.length; r++)s = e.links[r], a = s.associatedConnection, this.linkMap.set(a.visual.id, s.points()) } else if (e instanceof Array) for (n = e,
r = 0; r < n.length; r++)t = n[r], o = t.associatedShape, o && this.nodeMap.set(o.visual.id, new d(t.x, t.y, t.width, t.height)); else if (e.hasOwnProperty("links") && e.hasOwnProperty("nodes")) { for (n = e.nodes, l = e.links, r = 0; r < n.length; r++)t = n[r], o = t.associatedShape, o && this.nodeMap.set(o.visual.id, new d(t.x, t.y, t.width, t.height)); for (r = 0; r < l.length; r++)s = l[r], a = s.associatedConnection, a && this.linkMap.set(a.visual.id, s.points) } else { for (c = this.diagram.shapes, u = this.diagram.connections, r = 0; r < c.length; r++)o = c[r], this.nodeMap.set(o.visual.id, o.bounds()); for (r = 0; r < u.length; r++)a = u[r], this.linkMap.set(a.visual.id, a.points()) }
}
}); s(i, { init: function (e) { n.init(e, i.ui) }, SpringLayout: k, TreeLayout: x, GraphAdapter: w, LayeredLayout: C, LayoutBase: b, LayoutState: S })
}(window.kendo.jQuery)
}, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("dataviz/diagram/dom.min", ["kendo.data.min", "kendo.draganddrop.min", "kendo.toolbar.min", "kendo.editable.min", "kendo.window.min", "kendo.dropdownlist.min", "kendo.dataviz.core.min", "kendo.dataviz.themes.min", "dataviz/diagram/svg.min", "dataviz/diagram/services.min", "dataviz/diagram/layout.min"], e) }(function () {
!function (e, t) {
function n(e) { var t = e.originalEvent, n = 0; return t.wheelDelta ? (n = -t.wheelDelta / 40, n = n > 0 ? ke.ceil(n) : ke.floor(n)) : t.detail && (n = t.detail), n } function i(e) { return e.options.name.toLowerCase() === Fe.toLowerCase() } function o(e, t) { var n, o, r, a, s = He; for (r = 0; r < t.length; r++)o = t[r], i(o) || (a = e.distanceTo(o.position()), a < s && (s = a, n = o)); return n } function r(e, t) { var n, i, o, r = [], a = e.drawingContainer().children, s = a.length; for (n = 0; n < t.length; n++)for (i = t[n], o = 0; o < s; o++)if (a[o] == i.drawingContainer()) { r.push(o); break } return r } function a(e) { var t = {}; return e = e || {}, me(e.text) && null !== e.text && (t.text = e.text), me(e.x) && null !== e.x && (t.x = e.x), me(e.y) && null !== e.y && (t.y = e.y), me(e.width) && null !== e.width && (t.width = e.width), me(e.height) && null !== e.height && (t.height = e.height), me(e.type) && null !== e.type && (t.type = e.type), t } function s(e) { var t = {}; return e = e || {}, me(e.text) && null !== e.text && (t.content = e.text), me(e.type) && null !== e.type && (t.type = e.type), me(e.from) && null !== e.from && (t.from = e.from), me(e.fromConnector) && null !== e.fromConnector && (t.fromConnector = e.fromConnector), me(e.fromX) && null !== e.fromX && (t.fromX = e.fromX), me(e.fromY) && null !== e.fromY && (t.fromY = e.fromY), me(e.to) && null !== e.to && (t.to = e.to), me(e.toConnector) && null !== e.toConnector && (t.toConnector = e.toConnector), me(e.toX) && null !== e.toX && (t.toX = e.toX), me(e.toY) && null !== e.toY && (t.toY = e.toY), t } function l(t, n) { var i, o = this.dataSource.reader.model; o && (i = o.fn.fields.text ? "text" : o.idField, e("
").appendTo(t).kendoDropDownList({ dataValueField: o.idField, dataTextField: i, dataSource: this.dataSource.data().toJSON(), optionLabel: " ", valuePrimitive: !0 })) } function d(e) { this.dataItem = e, this.callbacks = [] } function c() { this.items = {} } function u(e) { var t = e; return e instanceof kendo.data.Model && (t = e.toJSON(), t[e.idField] = e._defaultId), t } function h(e) { var t, n, i = [], o = []; for (n = 0; n < e.length; n++)t = e[n], t instanceof k ? o.push(t) : i.push(t); return { shapes: o, connections: i } } function p(e, t) { return e.reader.model ? new e.reader.model(t) : new kendo.data.ObservableObject(t) } function f(e, t) { me(t[e]) && t.set(e, null) } function g(e, t, n) { var i, o; for (o = 0; o < n.length; o++)i = n[o], t && !me(t[i]) && (t[i] = e[i]) } function m(e) { var t = e.drawingContainer().clippedBBox(null); 0 === t.origin.x && 0 === t.origin.y || e.position(-t.origin.x, -t.origin.y) } function v(e) { e.preventDefault() } var _, b, w, k, y, x, C, S, T, D, A, E, I = kendo.dataviz, M = kendo.drawing, R = kendo.geometry, F = I.diagram, P = kendo.ui.Widget, z = kendo.Class, B = e.proxy, L = kendo.deepExtend, H = kendo._outerWidth, N = kendo._outerHeight, O = e.extend, V = kendo.data.HierarchicalDataSource, W = F.Canvas, U = F.Group, j = F.Rectangle, q = F.Circle, G = F.CompositeTransform, $ = F.Rect, K = F.Path, Y = F.DeleteShapeUnit, Q = F.DeleteConnectionUnit, X = F.TextBlock, J = F.Image, Z = F.Point, ee = F.Intersect, te = F.ConnectionEditAdorner, ne = F.UndoRedoService, ie = F.ToolService, oe = F.Selector, re = F.ResizingAdorner, ae = F.ConnectorsAdorner, se = F.Cursors, le = F.Utils, de = kendo.Observable, ce = F.ToBackUnit, ue = F.ToFrontUnit, he = F.PolylineRouter, pe = F.CascadingRouter, fe = le.isUndefined, ge = le.isDefined, me = M.util.defined, ve = e.isArray, _e = kendo.isFunction, be = le.isString, we = e.isPlainObject, ke = Math, ye = ".kendoDiagram", xe = "cascading", Ce = "itemBoundsChange", Se = "change", Te = "click", De = "drag", Ae = "dragEnd", Ee = "dragStart", Ie = "mouseEnter", Me = "mouseLeave", Re = "error", Fe = "Auto", Pe = "Top", ze = "Right", Be = "Left", Le = "Bottom", He = 9007199254740992, Ne = "select", Oe = "itemRotate", Ve = "pan", We = "zoomStart", Ue = "zoomEnd", je = "none", qe = 600, Ge = 600, $e = "rectangle", Ke = 100, Ye = 100, Qe = 20, Xe = 20, Je = 0, Ze = "Yellow", et = Number.MAX_VALUE, tt = -Number.MAX_VALUE, nt = "absolute", it = "transformed", ot = "rotated", rt = "transparent", at = "width", st = "height", lt = "x", dt = "y", ct = "DOMMouseScroll" + ye + " mousewheel" + ye, ut = .05, ht = 5, pt = '
#=text#', ft = 5; F.DefaultConnectors = [{ name: Pe }, { name: Le }, { name: Be }, { name: ze }, { name: Fe, position: function (e) { return e.getPosition("center") } }], _ = { cancel: { text: "Cancel", imageClass: "k-i-cancel", className: "k-diagram-cancel", iconClass: "k-icon" }, update: { text: "Update", imageClass: "k-i-checkmark", className: "k-diagram-update", iconClass: "k-icon" } }, F.shapeDefaults = function (e) { var t = { type: $e, path: "", autoSize: !0, visual: null, x: Je, y: Je, minWidth: Qe, minHeight: Xe, width: Ke, height: Ye, hover: {}, editable: { connect: !0, tools: [] }, connectors: F.DefaultConnectors, rotation: { angle: 0 } }; return le.simpleExtend(t, e), t }, b = de.extend({ init: function (e) { var t = this; t.dataItem = (e || {}).dataItem, de.fn.init.call(t), t.options = L({ id: F.randomId() }, t.options, e), t.isSelected = !1, t.visual = new U({ id: t.options.id, autoSize: t.options.autoSize }), t.id = t.options.id, t._template() }, options: { hover: {}, cursor: se.grip, content: { align: "center middle" }, selectable: !0, serializable: !0, enable: !0 }, _getCursor: function (e) { return this.adorner ? this.adorner._getCursor(e) : this.options.cursor }, visible: function (e) { return fe(e) ? this.visual.visible() : (this.visual.visible(e), t) }, bounds: function () { }, refresh: function () { this.visual.redraw() }, position: function (e) { this.options.x = e.x, this.options.y = e.y, this.visual.position(e) }, toString: function () { return this.options.id }, serialize: function () { var e = L({}, { options: this.options }); return this.dataItem && (e.dataItem = "" + this.dataItem), e }, _content: function (e) { var n, i, o; return e !== t && (n = this.options, F.Utils.isString(e) ? n.content.text = e : L(n.content, e), i = n.content, o = this._contentVisual, o ? this._updateContentVisual(i) : this._createContentVisual(i)), this.options.content.text }, _createContentVisual: function (e) { e.text && (this._contentVisual = new X(e), this._contentVisual._includeInBBox = !1, this.visual.append(this._contentVisual)) }, _updateContentVisual: function (e) { this._contentVisual.redraw(e) }, _hitTest: function (e) { var t = this.bounds(); return this.visible() && t.contains(e) && this.options.enable }, _template: function () { var e, t, n = this; n.options.content.template && (e = n.dataItem || {}, t = kendo.template(n.options.content.template, { paramName: "dataItem" }), n.options.content.text = t(e)) }, _canSelect: function () { return this.options.selectable !== !1 }, toJSON: function () { return { id: this.options.id } } }), w = z.extend({ init: function (e, t) { this.options = L({}, this.options, t), this.connections = [], this.shape = e }, options: { width: 7, height: 7, fill: { color: Ze }, hover: {} }, position: function () { return this.options.position ? this.options.position(this.shape) : this.shape.getPosition(this.options.name) }, toJSON: function () { return { shapeId: "" + this.shape, connector: this.options.name } } }), w.parse = function (e, t) { var n, i, o = t.split(":"), r = o[0], a = o[1] || Fe; for (n = 0; n < e.shapes.length; n++)if (i = e.shapes[n], i.options.id == r) return i.getConnector(a.trim()) }, k = b.extend({ init: function (e, t) { var n = this; b.fn.init.call(n, e), this.diagram = t, this.updateOptionsFromModel(), e = n.options, n.connectors = [], n.type = e.type, n.createShapeVisual(), n.updateBounds(), n.content(n.content()), n._createConnectors() }, options: F.shapeDefaults(), _setOptionsFromModel: function (e) { var t = a(e || this.dataItem); this.options = L({}, this.options, t), this.redrawVisual() }, updateOptionsFromModel: function (e, t) { var n, i; this.diagram && this.diagram._isEditable && (n = a(e || this.dataItem), e && t ? I.inArray(t, ["x", "y", "width", "height"]) ? (i = this.bounds(), i[t] = e[t], this.bounds(i)) : (this.options.visual ? this._redrawVisual() : n.type && (this.options = L({}, this.options, n), this._redrawVisual()), this.options.content && (this._template(), this.content(this.options.content))) : this.options = L({}, this.options, n)) }, _redrawVisual: function () { this.visual.clear(), this._contentVisual = null, this.options.dataItem = this.dataItem, this.createShapeVisual(), this.updateBounds() }, redrawVisual: function () { this._redrawVisual(), this.options.content && (this._template(), this.content(this.options.content)) }, updateModel: function (e) { var t, n, i = this.diagram; i && i._isEditable && (t = this._bounds, n = this.dataItem, n && (i._suspendModelRefresh(), me(n.x) && t.x !== n.x && n.set("x", t.x), me(n.y) && t.y !== n.y && n.set("y", t.y), me(n.width) && t.width !== n.width && n.set("width", t.width), me(n.height) && t.height !== n.height && n.set("height", t.height), this.dataItem = n, i._resumeModelRefresh(), e && i._syncShapeChanges())) }, updateBounds: function () { var e = this.visual._measure(!0), t = this.options; this.bounds(new $(t.x, t.y, e.width, e.height)), this._rotate(), this._alignContent() }, content: function (e) { var t = this._content(e); return this._alignContent(), t }, _alignContent: function () { var e, t, n, i, o, r = this.options.content || {}, a = this._contentVisual; a && r.align && (e = this.visual._measure(), t = new F.RectAlign(e), n = a.drawingElement.bbox(null), i = new $(0, 0, n.width(), n.height()), o = t.align(i, r.align), a.position(o.topLeft())) }, _createConnectors: function () { var e, t, n = this.options, i = n.connectors.length, o = n.connectorDefaults; for (t = 0; t < i; t++)e = new w(this, L({}, o, n.connectors[t])), this.connectors.push(e) }, bounds: function (e) { var t, n; if (e) if (be(e)) switch (e) { case it: t = this._transformedBounds(); break; case nt: t = this._transformedBounds(), n = this.diagram._pan, t.x += n.x, t.y += n.y; break; case ot: t = this._rotatedBounds(); break; default: t = this._bounds } else this._setBounds(e), this._triggerBoundsChange(), this.diagram && this.diagram._layouting || this.refreshConnections(); else t = this._bounds; return t }, _setBounds: function (e) { var t = this.options, n = e.topLeft(), i = t.x = n.x, o = t.y = n.y, r = t.width = ke.max(e.width, t.minWidth), a = t.height = ke.max(e.height, t.minHeight); this._bounds = new $(i, o, r, a), this.visual.redraw({ x: i, y: o, width: r, height: a }) }, position: function (e) { return e ? (this.bounds(new $(e.x, e.y, this._bounds.width, this._bounds.height)), t) : this._bounds.topLeft() }, clone: function () { var e = this.serialize(); return e.options.id = F.randomId(), this.diagram && this.diagram._isEditable && me(this.dataItem) && (e.options.dataItem = u(this.dataItem)), new k(e.options) }, select: function (e) { var t, n, i = this.diagram; if (fe(e) && (e = !0), this._canSelect() && this.isSelected != e) return t = [], n = [], this.isSelected = e, this.isSelected ? (i._selectedItems.push(this), t.push(this)) : (le.remove(i._selectedItems, this), n.push(this)), i._internalSelection || i._selectionChanged(t, n), !0 }, rotate: function (e, n, i) { var o, r, a, s, l = this.visual.rotate(); return e !== t && (i !== !1 && this.diagram && this.diagram.undoRedoService && e !== l.angle && this.diagram.undoRedoService.add(new F.RotateUnit(this.diagram._resizingAdorner, [this], [l.angle]), !1), o = this.bounds(), r = new Z(o.width / 2, o.height / 2), n && (a = e - l.angle, s = o.center().rotate(n, 360 - a).minus(r), this._rotationOffset = this._rotationOffset.plus(s.minus(o.topLeft())), this.position(s)), this.visual.rotate(e, r), this.options.rotation.angle = e, this.diagram && this.diagram._connectorsAdorner && this.diagram._connectorsAdorner.refresh(), this.refreshConnections(), this.diagram && this.diagram.trigger(Oe, { item: this })), l }, connections: function (e) { var t, n, i, o, r, a, s, l = []; for (t = 0; t < this.connectors.length; t++)for (r = this.connectors[t], o = r.connections, n = 0, o; n < o.length; n++)i = o[n], "out" == e ? (a = i.source(), a.shape && a.shape == this && l.push(i)) : "in" == e ? (s = i.target(), s.shape && s.shape == this && l.push(i)) : l.push(i); return l }, refreshConnections: function () { e.each(this.connections(), function () { this.refresh() }) }, getConnector: function (e) { var t, n; if (!be(e)) return e instanceof Z ? o(e, this.connectors) : this.connectors.length ? this.connectors[0] : null; for (e = e.toLocaleLowerCase(), t = 0; t < this.connectors.length; t++)if (n = this.connectors[t], n.options.name.toLocaleLowerCase() == e) return n }, getPosition: function (e) { var t = this.bounds(), n = e.charAt(0).toLowerCase() + e.slice(1); return _e(t[n]) ? this._transformPoint(t[n]()) : t.center() }, redraw: function (e) { var t, n; e && (t = this.options, this.shapeVisual.redraw(this._visualOptions(e)), this._diffNumericOptions(e, [at, st, lt, dt]) && (this.bounds(new $(t.x, t.y, t.width, t.height)), n = !0), e.connectors && (t.connectors = e.connectors, this._updateConnectors()), t = L(t, e), (e.rotation || n) && this._rotate(), t.content && this.content(t.content)) }, _updateConnectors: function () { var e, t, n, i, o = this.connections(); for (this.connectors = [], this._createConnectors(), i = 0; i < o.length; i++)e = o[i], t = e.source(), n = e.target(), t.shape && t.shape === this ? e.source(this.getConnector(t.options.name) || null) : n.shape && n.shape === this && e.target(this.getConnector(n.options.name) || null), e.updateModel() }, _diffNumericOptions: F.diffNumericOptions, _visualOptions: function (e) { return { data: e.path, source: e.source, hover: e.hover, fill: e.fill, stroke: e.stroke } }, _triggerBoundsChange: function () { this.diagram && this.diagram.trigger(Ce, { item: this, bounds: this._bounds.clone() }) }, _transformPoint: function (e) { var t = this.rotate(), n = this.bounds(), i = n.topLeft(); return t.angle && e.rotate(t.center().plus(i), 360 - t.angle), e }, _transformedBounds: function () { var e = this.bounds(), t = e.topLeft(), n = e.bottomRight(); return $.fromPoints(this.diagram.modelToView(t), this.diagram.modelToView(n)) }, _rotatedBounds: function () { var e = this.bounds().rotatedBounds(this.rotate().angle), t = e.topLeft(), n = e.bottomRight(); return $.fromPoints(t, n) }, _rotate: function () { var e = this.options.rotation; e && e.angle && this.rotate(e.angle), this._rotationOffset = new Z }, _hover: function (e) { var t = this.options, n = t.hover, i = t.stroke, o = t.fill; e && ge(n.stroke) && (i = L({}, i, n.stroke)), e && ge(n.fill) && (o = n.fill), this.shapeVisual.redraw({ stroke: i, fill: o }), t.editable && t.editable.connect && this.diagram._showConnectors(this, e) }, _hitTest: function (e) { if (this.visible()) { var t, n = this.bounds(), i = this.rotate().angle; if (e.isEmpty && !e.isEmpty()) return ee.rects(e, n, i ? i : 0); if (t = e.clone().rotate(n.center(), i), n.contains(t)) return this } }, toJSON: function () { return { shapeId: this.options.id } }, createShapeVisual: function () { var e, t = this.options, n = this._visualOptions(t), i = t.visual, o = (t.type + "").toLocaleLowerCase(); n.width = t.width, n.height = t.height, _e(i) ? e = i.call(this, t) : n.data ? (e = new K(n), m(e)) : e = "rectangle" == o ? new j(n) : "circle" == o ? new q(n) : "text" == o ? new X(n) : "image" == o ? new J(n) : new K(n), this.shapeVisual = e, this.visual.append(this.shapeVisual) } }), y = b.extend({ init: function (e, t, n) { var i = this; b.fn.init.call(i, n), this.updateOptionsFromModel(), this._initRouter(), i.path = new F.Polyline(i.options), i.path.fill(rt), i.visual.append(i.path), i._sourcePoint = i._targetPoint = new Z, i._setSource(e), i._setTarget(t), i.content(i.options.content), i.definers = [], me(n) && n.points && i.points(n.points) }, options: { hover: { stroke: {} }, startCap: je, endCap: je, points: [], selectable: !0, fromConnector: Fe, toConnector: Fe }, _setOptionsFromModel: function (e) { this.updateOptionsFromModel(e || this.dataItem) }, updateOptionsFromModel: function (e) { var t, n, i, o; this.diagram && this.diagram._isEditable && (t = this.diagram._dataMap, n = s(e || this.dataItem), e ? (me(n.from) ? (i = t[n.from], i && me(n.fromConnector) && (i = i.getConnector(n.fromConnector)), this.source(i)) : me(n.fromX) && me(n.fromY) && this.source(new Z(n.fromX, n.fromY)), me(n.to) ? (o = t[n.to], o && me(n.toConnector) && (o = o.getConnector(n.toConnector)), this.target(o)) : me(n.toX) && me(n.toY) && this.target(new Z(n.toX, n.toY)), me(n.type) && this.type() !== n.type && (this.points([]), this.type(n.type)), this.dataItem = e, this._template(), this.redraw(this.options)) : this.options = L({}, n, this.options)) }, updateModel: function (e) { if (this.diagram && this.diagram._isEditable && this.diagram.connectionsDataSource) { var t = this.diagram.connectionsDataSource.getByUid(this.dataItem.uid); t && (this.diagram._suspendModelRefresh(), me(this.options.fromX) && null !== this.options.fromX ? (f("from", t), f("fromConnector", t), t.set("fromX", this.options.fromX), t.set("fromY", this.options.fromY)) : (t.set("from", this.options.from), me(t.fromConnector) && t.set("fromConnector", this.sourceConnector ? this.sourceConnector.options.name : null), f("fromX", t), f("fromY", t)), me(this.options.toX) && null !== this.options.toX ? (f("to", t), f("toConnector", t), t.set("toX", this.options.toX), t.set("toY", this.options.toY)) : (t.set("to", this.options.to), me(t.toConnector) && t.set("toConnector", this.targetConnector ? this.targetConnector.options.name : null), f("toX", t), f("toY", t)), me(this.options.type) && me(t.type) && t.set("type", this.options.type), this.dataItem = t, this.diagram._resumeModelRefresh(), e && this.diagram._syncConnectionChanges()) } }, sourcePoint: function () { return this._resolvedSourceConnector ? this._resolvedSourceConnector.position() : this._sourcePoint }, _setSource: function (e) { var n, i = e instanceof k, o = this.options.fromConnector || Fe; i && !e.getConnector(o) || (e !== t && (this.from = e), this._removeFromSourceConnector(), null === e ? this.sourceConnector && (this._sourcePoint = (this._resolvedSourceConnector || this.sourceConnector).position(), this._clearSourceConnector(), this._setFromOptions(null, this._sourcePoint)) : e instanceof w ? (n = e.shape.dataItem, n && this._setFromOptions(n.id), this.sourceConnector = e, this.sourceConnector.connections.push(this)) : e instanceof Z ? (this._setFromOptions(null, e), this._sourcePoint = e, this.sourceConnector && this._clearSourceConnector()) : i && (n = e.dataItem, n && this._setFromOptions(n.id), this.sourceConnector = e.getConnector(o), this.sourceConnector.connections.push(this))) }, source: function (e, t) { return ge(e) && (t && this.diagram && this.diagram.undoRedoService.addCompositeItem(new F.ConnectionEditUnit(this, e)), this._setSource(e), this.refresh()), this.sourceConnector ? this.sourceConnector : this._sourcePoint }, _setFromOptions: function (e, t) { this.options.from = e, t ? (this.options.fromX = t.x, this.options.fromY = t.y) : (this.options.fromX = null, this.options.fromY = null) }, sourceDefiner: function (e) { if (!e) return this._sourceDefiner || (this._sourceDefiner = new F.PathDefiner(this.sourcePoint(), null, null)), this._sourceDefiner; if (!(e instanceof F.PathDefiner)) throw "The sourceDefiner needs to be a PathDefiner."; e.left = null, this._sourceDefiner = e, this.source(e.point) }, targetPoint: function () { return this._resolvedTargetConnector ? this._resolvedTargetConnector.position() : this._targetPoint }, _setTarget: function (e) { var n, i = e instanceof k, o = this.options.toConnector || Fe; i && !e.getConnector(o) || (e !== t && (this.to = e), this._removeFromTargetConnector(), null === e ? this.targetConnector && (this._targetPoint = (this._resolvedTargetConnector || this.targetConnector).position(), this._clearTargetConnector(), this._setToOptions(null, this._targetPoint)) : e instanceof w ? (n = e.shape.dataItem, n && this._setToOptions(n.id), this.targetConnector = e, this.targetConnector.connections.push(this)) : e instanceof Z ? (this._setToOptions(null, e), this._targetPoint = e, this.targetConnector && this._clearTargetConnector()) : i && (n = e.dataItem, n && this._setToOptions(n.id), this.targetConnector = e.getConnector(o), this.targetConnector.connections.push(this))) }, target: function (e, n) { return ge(e) && (n && this.diagram && this.diagram.undoRedoService.addCompositeItem(new F.ConnectionEditUnit(this, t, e)), this._setTarget(e), this.refresh()), this.targetConnector ? this.targetConnector : this._targetPoint }, _setToOptions: function (e, t) { this.options.to = e, t ? (this.options.toX = t.x, this.options.toY = t.y) : (this.options.toX = null, this.options.toY = null) }, targetDefiner: function (e) { if (!e) return this._targetDefiner || (this._targetDefiner = new F.PathDefiner(this.targetPoint(), null, null)), this._targetDefiner; if (!(e instanceof F.PathDefiner)) throw "The sourceDefiner needs to be a PathDefiner."; e.right = null, this._targetDefiner = e, this.target(e.point) }, _updateConnectors: function () { this._updateConnector(this.source(), "source"), this._updateConnector(this.target(), "target") }, _updateConnector: function (e, t) { var n, i, o, r, a = this, s = a.diagram; e instanceof w && !s.getShapeById(e.shape.id) ? (n = e.shape.dataItem, i = e.options.name, o = function () { var o = s._dataMap[n.id]; e = o.getConnector(i), a[t](e, !1), a.updateModel() }, s._dataMap[n.id] ? o() : (r = s._inactiveShapeItems.getByUid(n.uid), r && s._deferredConnectionUpdates.push(r.onActivate(o)))) : a[t](e, !1) }, content: function (e) { var t = this._content(e); return me(e) && this._alignContent(), t }, _createContentVisual: function (e) { var t; return _e(e.visual) ? t = e.visual.call(this, e) : e.text && (t = new X(e)), t && (this._contentVisual = t, t._includeInBBox = !1, this.visual.append(t)), t }, _updateContentVisual: function (e) { _e(e.visual) ? (this.visual.remove(this._contentVisual), this._createContentVisual(e)) : this._contentVisual.redraw(e) }, _alignContent: function () { var e, t, n, i, o, r, a, s, l, d, c, u, h, p, f, g; if (this._contentVisual) { for (e = ft, t = this.allPoints(), n = ke.floor(t.length / 2), i = n - 1; i > 0 && t[i].equals(t[n]);)i--, n++; o = t[n], r = t[i], a = this._contentVisual._measure(), s = a.width, l = a.height, d = t.length % 2 === 0, c = r.distanceTo(o), d && t.length > 2 && c > 0 && (r.y === o.y && c < s || r.x === o.x && c < l) && (d = !1, e = 0), d ? (h = M.util.deg(ke.atan2(o.y - r.y, o.x - r.x)), u = new Z((o.x - r.x) / 2 + r.x, (o.y - r.y) / 2 + r.y), 90 === ke.abs(h) ? (u.x += e, u.y -= l / 2) : h % 180 === 0 ? (u.x -= s / 2, u.y -= l + e) : h < -90 || 0 < h && h < 90 ? u.y -= l : (h < 0 || h > 90) && (u.x -= s, u.y -= l)) : (p = ke.floor(t.length / 2), u = t[p].clone(), r = t[p - 1], o = t[p + 1], f = r.x <= u.x && o.x <= u.x ? e : -a.width - e, g = r.y <= u.y && o.y <= u.y ? e : -a.height - e, u.x += f, u.y += g), this._contentVisual.position(u) } }, select: function (e) { var n, i, o = this.diagram; if (this._canSelect() && this.isSelected !== e) return this.isSelected = e, n = [], i = [], this.isSelected ? (this.adorner = new te(this, this.options.selection), o._adorn(this.adorner, !0), o._selectedItems.push(this), n.push(this)) : this.adorner && (o._adorn(this.adorner, !1), le.remove(o._selectedItems, this), this.adorner = t, i.push(this)), this.adorner && this.adorner.refresh(), o._internalSelection || o._selectionChanged(n, i), !0 }, bounds: function (e) { return !e || be(e) ? this._bounds : (this._bounds = e, t) }, type: function (e) { var n = this.options; return e ? (e !== n.type && (n.type = e, this._initRouter(), this.refresh()), t) : n.type }, _initRouter: function () { var e = (this.options.type || "").toLowerCase(); this._router = e == xe ? new pe(this) : new he(this) }, points: function (e) { var t, n, i, o; if (!e) { if (i = [], ge(this.definers)) for (o = 0; o < this.definers.length; o++)i.push(this.definers[o].point); return i } for (this.definers = [], t = 0; t < e.length; t++)if (n = e[t], n instanceof F.Point) this.definers.push(new F.PathDefiner(n)); else { if (!n.hasOwnProperty("x") || !n.hasOwnProperty("y")) throw "A Connection point needs to be a Point or an object with x and y properties."; this.definers.push(new F.PathDefiner(new Z(n.x, n.y))) } }, allPoints: function () { var e, t = [this.sourcePoint()]; if (this.definers) for (e = 0; e < this.definers.length; e++)t.push(this.definers[e].point); return t.push(this.targetPoint()), t }, refresh: function () { this._resolveConnectors(), this._refreshPath(), this._alignContent(), this.adorner && this.adorner.refresh() }, _resolveConnectors: function () { var e, t, n, r, a = this, s = a.source(), l = a.target(); s instanceof Z ? e = s : s instanceof w && (n = i(s) ? s.shape.connectors : [s]), l instanceof Z ? t = l : l instanceof w && (r = i(l) ? l.shape.connectors : [l]), e ? r && (a._resolvedTargetConnector = o(e, r)) : n && (t ? a._resolvedSourceConnector = o(t, n) : r && this._resolveAutoConnectors(n, r)) }, _resolveAutoConnectors: function (e, t) { var n, o, r, a, s, l, d, c, u, h, p, f = He, g = He; for (u = 0; u < e.length; u++)if (d = e[u], !i(d)) for (r = d.position(), h = 0; h < t.length; h++)c = t[h], i(c) || (a = c.position(), p = ke.round(r.distanceTo(a)), p < f && this.diagram && this._testRoutePoints(r, a, d, c) && (f = p, n = d, o = c), p < g && (s = d, l = c, g = p)); n && (s = n, l = o), this._resolvedSourceConnector = s, this._resolvedTargetConnector = l }, _testRoutePoints: function (e, t, n, i) { var o, r, a, s, l, d, c = this._router, u = !0; if (c instanceof pe) for (o = c.routePoints(e, t, n, i), l = this._getRouteExclude(e, t, n.shape, i.shape), o.unshift(e), o.push(t), d = 1; d < o.length; d++)if (r = o[d - 1], a = o[d], s = new $(ke.min(r.x, a.x), ke.min(r.y, a.y), ke.abs(r.x - a.x), ke.abs(r.y - a.y)), s.width > 0 && (s.x++, s.width -= 2), s.height > 0 && (s.y++, s.height -= 2), !s.isEmpty() && this.diagram._shapesQuadTree.hitTestRect(s, l)) { u = !1; break } return u }, _getRouteExclude: function (e, t, n, i) { var o = []; return this._isPointInsideShape(e, n) && o.push(n), this._isPointInsideShape(t, i) && o.push(i), o }, _isPointInsideShape: function (e, t) { var n, i, o, r = t.bounds(), a = t.rotate().angle, s = r.x, l = r.y; return n = e.clone().rotate(r.center(), a), i = n.x, o = n.y, i > s && i < s + r.width && o > l && o < l + r.height }, redraw: function (e) { if (e) { this.options = L({}, this.options, e); var t = this.options.points; me(t) && t.length > 0 && (this.points(t), this._refreshPath()), (e && e.content || e.text) && this.content(e.content), this.path.redraw({ fill: e.fill, stroke: e.stroke, startCap: e.startCap, endCap: e.endCap }) } }, clone: function () { var e = this.serialize(); return this.diagram && this.diagram._isEditable && me(this.dataItem) && (e.options.dataItem = u(this.dataItem)), new y(this.from, this.to, e.options) }, serialize: function () { var e = this.from.toJSON ? this.from.toJSON : "" + this.from, t = this.to.toJSON ? this.to.toJSON : "" + this.to, n = L({}, { options: this.options, from: e, to: t }); return me(this.dataItem) && (n.dataItem = "" + this.dataItem), n.options.points = this.points(), n }, _hitTest: function (e) { if (this.visible()) { var t = new Z(e.x, e.y), n = this.sourcePoint(), i = this.targetPoint(); if (e.isEmpty && !e.isEmpty() && e.contains(n) && e.contains(i)) return this; if (this._router.hitTest(t)) return this } }, _hover: function (e) { var t = (this.options.stroke || {}).color; e && ge(this.options.hover.stroke.color) && (t = this.options.hover.stroke.color), this.path.redraw({ stroke: { color: t } }) }, _refreshPath: function () { me(this.path) && (this._drawPath(), this.bounds(this._router.getBounds())) }, _drawPath: function () { var e, t, n; this._router && this._router.route(), e = this.sourcePoint(), t = this.targetPoint(), n = this.points(), this.path.redraw({ points: [e].concat(n, [t]) }) }, _clearSourceConnector: function () { this.sourceConnector = t, this._resolvedSourceConnector = t }, _clearTargetConnector: function () { this.targetConnector = t, this._resolvedTargetConnector = t }, _removeFromSourceConnector: function () { this.sourceConnector && le.remove(this.sourceConnector.connections, this) }, _removeFromTargetConnector: function () { this.targetConnector && le.remove(this.targetConnector.connections, this) }, toJSON: function () { var e, t, n, i = this; return i.from && i.from.toJSON ? e = i.from.toJSON() : (n = i._sourcePoint, e = { x: n.x, y: n.y }), i.to && i.to.toJSON ? t = i.to.toJSON() : (n = i._targetPoint, t = { x: n.x, y: n.y }), { from: e, to: t } } }), x = P.extend({
init: function (e, t) { var n = this; kendo.destroy(e), P.fn.init.call(n, e, t), n._initTheme(), n._initElements(), n._extendLayoutOptions(n.options), n._initDefaults(t), n._interactionDefaults(), n._initCanvas(), n.mainLayer = new U({ id: "main-layer" }), n.canvas.append(n.mainLayer), n._shapesQuadTree = new E(n), n._pan = new Z, n._adorners = [], n.adornerLayer = new U({ id: "adorner-layer" }), n.canvas.append(n.adornerLayer), n._createHandlers(), n._initialize(), n._resizingAdorner = new re(n, { editable: n.options.editable }), n._connectorsAdorner = new ae(n), n._adorn(n._resizingAdorner, !0), n._adorn(n._connectorsAdorner, !0), n.selector = new oe(n), n._clipboard = [], n.pauseMouseHandlers = !1, n._fetchFreshData(), n._createGlobalToolBar(), n._createOptionElements(), n.zoom(n.options.zoom), n.canvas.draw() }, options: { name: "Diagram", theme: "default", layout: "", zoomRate: .1, zoom: 1, zoomMin: 0, zoomMax: 2, dataSource: {}, draggable: !0, template: "", autoBind: !0, editable: { rotate: {}, resize: {}, text: !0, tools: [], drag: { snap: { size: 10, angle: 10 } }, remove: !0 }, pannable: {}, selectable: { key: "none" }, tooltip: { enabled: !0, format: "{0}" }, copy: { enabled: !0, offsetX: 20, offsetY: 20 }, shapeDefaults: F.shapeDefaults({ undoable: !0 }), connectionDefaults: { editable: { tools: [] }, type: xe }, shapes: [], connections: [] }, events: [Ue, We, Ve, Ne, Oe, Ce, Se, Te, Ie, Me, "toolBarClick", "save", "cancel", "edit", "remove", "add", "dataBound", Ee, De, Ae], items: function () { return e() }, _createGlobalToolBar: function () { var e, t = this.options.editable; t && (e = t.tools, !this._isEditable || e === !1 || e && 0 !== e.length || (e = ["createShape", "undo", "redo", "rotateClockwise", "rotateAnticlockwise"]), e && e.length && (this.toolBar = new C(this, { tools: e || {}, click: B(this._toolBarClick, this), modal: !1 }), this.toolBar.element.css({ textAlign: "left" }), this.element.prepend(this.toolBar.element), this._resize())) }, createShape: function () { var e, t, n, i, o, r; (this.editor && this.editor.end() || !this.editor) && (e = this.dataSource, t = e.view() || [], n = t.length, i = p(e, {}), o = this._createShape(i, {}), this.trigger("add", { shape: o }) || (e.insert(n, i), r = this._inactiveShapeItems.getByUid(i.uid), r.element = o, this.edit(o))) }, _createShape: function (e, t) { t = L({}, this.options.shapeDefaults, t), t.dataItem = e; var n = new k(t, this); return n }, createConnection: function () { var e, t, n, i, o; (this.editor && this.editor.end() || !this.editor) && (e = this.connectionsDataSource, t = e.view() || [], n = t.length, i = p(e, {}), o = this._createConnection(i), this.trigger("add", { connection: o }) || (this._connectionsDataMap[i.uid] = o, e.insert(n, i), this.addConnection(o, !1), this.edit(o))) }, _createConnection: function (e, t, n) { var i, o = L({}, this.options.connectionDefaults); return o.dataItem = e, i = new y(t || new Z, n || new Z, o) }, editModel: function (e, t) { var n, i, o, r; if (this.cancelEdit(), o = this.options.editable, "shape" == t) n = o.shapeEditors, i = o.shapeTemplate; else { if ("connection" != t) return; r = B(l, this), n = L({}, { from: r, to: r }, o.connectionEditors), i = o.connectionTemplate } this.editor = new T(this.element, { update: B(this._update, this), cancel: B(this._cancel, this), model: e, type: t, target: this, editors: n, template: i }), this.trigger("edit", this._editArgs()) }, edit: function (e) { if (e.dataItem) { var t = e instanceof k ? "shape" : "connection"; this.editModel(e.dataItem, t) } }, cancelEdit: function () { this.editor && (this._getEditDataSource().cancelChanges(this.editor.model), this._destroyEditor()) }, saveEdit: function () { this.editor && this.editor.end() && !this.trigger("save", this._editArgs()) && this._getEditDataSource().sync() }, _update: function () { this.editor && this.editor.end() && !this.trigger("save", this._editArgs()) && (this._getEditDataSource().sync(), this._destroyEditor()) }, _cancel: function () { var e, t; this.editor && !this.trigger("cancel", this._editArgs()) && (e = this.editor.model, this._getEditDataSource().cancelChanges(e), t = this._connectionsDataMap[e.uid] || this._dataMap[e.id], t && t._setOptionsFromModel(e), this._destroyEditor()) }, _getEditDataSource: function () { return "shape" === this.editor.options.type ? this.dataSource : this.connectionsDataSource }, _editArgs: function () { var e = { container: this.editor.wrapper }; return e[this.editor.options.type] = this.editor.model, e }, _destroyEditor: function () { this.editor && (this.editor.close(), this.editor = null) }, _initElements: function () { this.wrapper = this.element.empty().css("position", "relative").attr("tabindex", 0).addClass("k-widget k-diagram"), this.scrollable = e("
").appendTo(this.element) }, _initDefaults: function (e) { var t = this.options, n = t.editable, i = t.shapeDefaults, o = t.connectionDefaults, r = (e || {}).shapeDefaults; n === !1 ? (i.editable = !1, o.editable = !1) : (g(n, i.editable, ["drag", "remove", "connect"]), g(n, o.editable, ["drag", "remove"])), r && r.connectors && (t.shapeDefaults.connectors = r.connectors) }, _interactionDefaults: function () { var e = this.options, t = e.selectable, n = e.pannable, i = kendo.support.mobileOS; t && !me(t.multiple) && (e.selectable = L({ multiple: !i }, e.selectable)), n && !me(n.key) && (e.pannable = L({ key: i ? "none" : "ctrl" }, e.pannable)) }, _initCanvas: function () { var t = e("
").appendTo(this.scrollable)[0], n = this.viewport(); this.canvas = new W(t, { width: n.width || qe, height: n.height || Ge }) }, _createHandlers: function () {
var e = this, t = e.element; t.on(ct, B(e._wheel, e)).on("keydown" + ye, B(e._keydown, e)), e._userEvents = new kendo.UserEvents(this.scrollable, { multiTouch: !0, fastTap: !0, tap: B(e._tap, e), start: B(e._dragStart, e), move: B(e._drag, e), end: B(e._dragEnd, e), gesturestart: B(e._gestureStart, e), gesturechange: B(e._gestureChange, e), gestureend: B(e._gestureEnd, e), doubleTap: B(e._doubleTap, e), supportDoubleTap: !0 }), e.toolService = new ie(e), this.scrollable.on("mouseover" + ye, B(e._mouseover, e)).on("mouseout" + ye, B(e._mouseout, e)).on("mousemove" + ye, B(e._mouseMove, e)).on("mousedown" + ye, B(e._mouseDown, e)).on("mouseup" + ye, B(e._mouseUp, e)), this._syncHandler = B(e._syncChanges, e), e._resizeHandler = B(e.resize, e, !1), kendo.onResize(e._resizeHandler),
this.bind(We, B(e._destroyToolBar, e)), this.bind(Ve, B(e._destroyToolBar, e))
}, _dragStart: function (e) { var t, n; this._pauseMouseHandlers = !0, t = this._eventPositions(e, !0), n = e.event, this.toolService.start(t, this._meta(n)) && (this._destroyToolBar(), n.preventDefault()) }, _drag: function (e) { var t = this._eventPositions(e), n = e.event; this.toolService.move(t, this._meta(n)) && n.preventDefault() }, _dragEnd: function (e) { var t, n; this._pauseMouseHandlers = !1, t = this._eventPositions(e), n = e.event, this.toolService.end(t, this._meta(n)) && (this._createToolBar(), n.preventDefault()) }, _mouseMove: function (e) { if (!this._pauseMouseHandlers) { var t = this._eventPositions(e); this.toolService._updateHoveredItem(t), this.toolService._updateCursor(t) } }, _mouseDown: function () { this._pauseMouseHandlers = !0 }, _mouseUp: function () { this._pauseMouseHandlers = !1 }, _tap: function (e) { var t, n, i, o = this.toolService, r = this.options.selectable, a = this._eventPositions(e), s = this.focus(); o._updateHoveredItem(a), o.hoveredItem ? (t = o.hoveredItem, this.trigger("click", { item: t, point: a }), r && t.options.selectable !== !1 && (n = r.multiple !== !1, i = kendo.support.mobileOS || this._meta(e.event).ctrlKey, t.isSelected ? i ? (this._destroyToolBar(), t.select(!1)) : this._createToolBar(s) : (this._destroyToolBar(), this.select(t, { addToSelection: n && i }), this._createToolBar(s)))) : r && (this._destroyToolBar(), this.deselect()) }, _keydown: function (e) { this.toolService.keyDown(e.keyCode, this._meta(e)) && e.preventDefault() }, _wheel: function (e) { var t = n(e), i = this._eventPositions(e), o = L(this._meta(e), { delta: t }); this.toolService.wheel(i, o) && e.preventDefault() }, _meta: function (e) { return { ctrlKey: e.ctrlKey, metaKey: e.metaKey, altKey: e.altKey, shiftKey: e.shiftKey, type: e.type } }, _eventPositions: function (e, t) { var n, i, o; return e.touch ? (i = t ? "startLocation" : "location", n = new Z(e.x[i], e.y[i])) : (o = e.originalEvent, n = new Z(o.pageX, o.pageY)), this.documentToModel(n) }, _gestureStart: function (e) { var t, n; this._destroyToolBar(), this.scroller.disable(), t = this.documentToModel(new Z(e.center.x, e.center.y)), n = { point: t, zoom: this.zoom() }, this.trigger(We, n) || (this._gesture = e, this._initialCenter = t) }, _gestureChange: function (e) { var t, n, i = this._gesture, o = this._initialCenter, r = this.documentToView(new Z(e.center.x, e.center.y)), a = e.distance / i.distance, s = this._zoom, l = !1; ke.abs(a - 1) >= ut && (this._zoom = s = this._getValidZoom(s * a), this.options.zoom = s, this._gesture = e, l = !0), t = o.times(s), n = r.minus(t), (l || this._pan.distanceTo(n) >= ht) && (this._panTransform(n), this._updateAdorners()), e.preventDefault() }, _doubleTap: function (e) { var t = this, n = this._eventPositions(e), i = t.options, o = i.zoomRate, r = t.zoom() + o, a = this._meta(e), s = { point: n, meta: a, zoom: r }; t.trigger(We, s) || (r = kendo.dataviz.round(Math.max(i.zoomMin, Math.min(i.zoomMax, r)), 2), s.zoom = r, t.zoom(r, s), t.trigger(Ue, s)) }, _gestureEnd: function () { this.options.pannable !== !1 && this.scroller.enable(), this.trigger(Ue, { point: this._initialCenter, zoom: this.zoom() }) }, _resize: function () { var e = this.viewport(); this.canvas && this.canvas.size(e), this.scrollable && this.toolBar && this.scrollable.height(e.height) }, _mouseover: function (e) { var t = e.target._kendoNode; t && t.srcElement._hover && t.srcElement._hover(!0, t.srcElement) }, _mouseout: function (e) { var t = e.target._kendoNode; t && t.srcElement._hover && t.srcElement._hover(!1, t.srcElement) }, _initTheme: function () { var e, t = this, n = ((t.options || {}).theme || "").toLowerCase(), i = I.ui.themes || {}; e = I.SASS_THEMES.indexOf(n) != -1 ? I.autoTheme().diagram : (i[n] || {}).diagram, t.options = L({}, e, t.options), t.options.editable === !0 && L(t.options, { editable: (e || {}).editable }) }, _createOptionElements: function () { var e = this.options, t = e.shapes.length; t && this._createShapes(), e.connections.length && this._createConnections(), t && e.layout && this.layout(e.layout) }, _createShapes: function () { var e, t, n = this, i = n.options, o = i.shapes; for (t = 0; t < o.length; t++)e = o[t], n.addShape(e) }, _createConnections: function () { var e, t, n, i, o = this, r = o.options, a = r.connectionDefaults, s = r.connections; for (i = 0; i < s.length; i++)e = s[i], t = o._findConnectionTarget(e.from), n = o._findConnectionTarget(e.to), o.connect(t, n, L({}, a, e)) }, _findConnectionTarget: function (e) { var t, n, i; return e = e || {}, t = this, n = be(e) ? e : e.shapeId || e.id, n ? (i = t.getShapeById(n), e.connector && (i = i.getConnector(e.connector))) : i = new Z(e.x || 0, e.y || 0), i }, destroy: function () { var e = this; P.fn.destroy.call(e), this._userEvents && this._userEvents.destroy(), kendo.unbindResize(e._resizeHandler), e.clear(), e.element.off(ye), e.scroller.wrapper.off(ye), e.canvas.destroy(!0), e.canvas = t, e._destroyEditor(), e.destroyScroller(), e._destroyGlobalToolBar(), e._destroyToolBar() }, destroyScroller: function () { var e = this.scroller; e && (e.destroy(), e.element.remove(), this.scroller = null) }, save: function () { var e, t, n, i = { shapes: [], connections: [] }; for (e = 0; e < this.shapes.length; e++)n = this.shapes[e], n.options.serializable && i.shapes.push(n.options); for (e = 0; e < this.connections.length; e++)t = this.connections[e], i.connections.push(L({}, t.options, t.toJSON())); return i }, focus: function () { if (!this.element.is(kendo._activeElement())) { var e, t = this.element, n = t[0], i = [], o = [], r = document.documentElement; do n = n.parentNode, n.scrollHeight > n.clientHeight && (i.push(n), o.push(n.scrollTop)); while (n != r); for (t.focus(), e = 0; e < i.length; e++)i[e].scrollTop = o[e]; return !0 } }, load: function (e) { this.clear(), this.setOptions(e), this._createShapes(), this._createConnections() }, setOptions: function (e) { L(this.options, e) }, clear: function () { var e = this; e.select(!1), e.mainLayer.clear(), e._shapesQuadTree.clear(), e._initialize() }, connect: function (e, t, n) { var i, o; return this.connectionsDataSource && this._isEditable ? (o = this.connectionsDataSource.add({}), i = this._connectionsDataMap[o.uid], i.source(e), i.target(t), i.redraw(n), i.updateModel()) : (i = new y(e, t, L({}, this.options.connectionDefaults, n)), this.addConnection(i)), i }, connected: function (e, t) { var n, i; for (n = 0; n < this.connections.length; n++)if (i = this.connections[n], i.from == e && i.to == t) return !0; return !1 }, addConnection: function (e, t) { return t !== !1 && this.undoRedoService.add(new F.AddConnectionUnit(e, this), !1), e.diagram = this, e._setOptionsFromModel(), e.refresh(), this.mainLayer.append(e.visual), this.connections.push(e), this.trigger(Se, { added: [e], removed: [] }), e }, _addConnection: function (e, t) { var n, i = this.connectionsDataSource; if (i && this._isEditable) { if (n = p(i, u(e.dataItem)), e.dataItem = n, e.updateModel(), !this.trigger("add", { connection: e })) return this._connectionsDataMap[n.uid] = e, i.add(n), this.addConnection(e, t), e._updateConnectors(), e } else if (!this.trigger("add", { connection: e })) return this.addConnection(e, t), e._updateConnectors(), e }, addShape: function (e, t) { var n, i = this.options.shapeDefaults; if (e instanceof k) n = e; else { if (e instanceof kendo.Class) return; i = L({}, i, e || {}), n = new k(i, this) } return t !== !1 && this.undoRedoService.add(new F.AddShapeUnit(n, this), !1), this.shapes.push(n), n.diagram !== this && (this._shapesQuadTree.insert(n), n.diagram = this), this.mainLayer.append(n.visual), this.trigger(Se, { added: [n], removed: [] }), n }, _addShape: function (e, t) { var n, i, o = this, r = o.dataSource; if (r && this._isEditable) { if (n = p(r, u(e.dataItem)), e.dataItem = n, e.updateModel(), !this.trigger("add", { shape: e })) return this.dataSource.add(n), i = this._inactiveShapeItems.getByUid(n.uid), i.element = e, i.undoable = t, e } else if (!this.trigger("add", { shape: e })) return this.addShape(e, t) }, remove: function (e, t) { var n, i, o, r; for (e = ve(e) ? e.slice(0) : [e], n = h(e), i = n.shapes, o = n.connections, me(t) || (t = !0), t && this.undoRedoService.begin(), this._suspendModelRefresh(), r = i.length - 1; r >= 0; r--)this._removeItem(i[r], t, o); for (r = o.length - 1; r >= 0; r--)this._removeItem(o[r], t); this._resumeModelRefresh(), t && this.undoRedoService.commit(!1), this.trigger(Se, { added: [], removed: e }) }, _removeShapeDataItem: function (e) { this._isEditable && (this.dataSource.remove(e.dataItem), delete this._dataMap[e.dataItem.id]) }, _removeConnectionDataItem: function (e) { this._isEditable && (this.connectionsDataSource.remove(e.dataItem), delete this._connectionsDataMap[e.dataItem.uid]) }, _triggerRemove: function (e) { var t, n, i, o, r = []; for (o = 0; o < e.length; o++)t = e[o], i = t.options.editable, n = t instanceof k ? { shape: t } : { connection: t }, i && i.remove !== !1 && !this.trigger("remove", n) && r.push(t); return r }, undo: function () { this.undoRedoService.undo() }, redo: function () { this.undoRedoService.redo() }, select: function (e, t) { if (!ge(e)) return this._selectedItems; t = L({ addToSelection: !1 }, t); var n, i, o = t.addToSelection, r = [], a = []; for (o || this.deselect(), this._internalSelection = !0, e instanceof Array ? r = e : e instanceof b && (r = [e]), n = 0; n < r.length; n++)i = r[n], i.select(!0) && a.push(i); this._selectionChanged(a, []), this._internalSelection = !1 }, selectAll: function () { this.select(this.shapes.concat(this.connections)) }, selectArea: function (e) { var t, n, i, o; if (this._internalSelection = !0, o = [], e instanceof $) for (n = this.shapes.concat(this.connections), t = 0; t < n.length; t++)i = n[t], e && !i._hitTest(e) || !i.options.enable || i.select(!0) && o.push(i); this._selectionChanged(o, []), this._internalSelection = !1 }, deselect: function (e) { this._internalSelection = !0; var t, n, i = [], o = []; for (e instanceof Array ? o = e : e instanceof b ? o.push(e) : ge(e) || (o = this._selectedItems.slice(0)), n = 0; n < o.length; n++)t = o[n], t.select(!1) && i.push(t); this._selectionChanged([], i), this._internalSelection = !1 }, toFront: function (e, t) { var n, i, o; e || (e = this._selectedItems.slice()), n = this._getDiagramItems(e), !me(t) || t ? (i = r(this.mainLayer, n.visuals), o = new ue(this, e, i), this.undoRedoService.add(o)) : (this.mainLayer.toFront(n.visuals), this._fixOrdering(n, !0)) }, toBack: function (e, t) { var n, i, o; e || (e = this._selectedItems.slice()), n = this._getDiagramItems(e), !me(t) || t ? (i = r(this.mainLayer, n.visuals), o = new ce(this, e, i), this.undoRedoService.add(o)) : (this.mainLayer.toBack(n.visuals), this._fixOrdering(n, !1)) }, bringIntoView: function (e, t) { var n, i, o, r, a = this.viewport(), s = new F.RectAlign(a); 0 !== a.width && 0 !== a.height && (t = L({ animate: !1, align: "center middle" }, t), "none" == t.align && (t.align = "center middle"), e instanceof b ? i = e.bounds(it) : ve(e) ? i = this.boundingBox(e) : e instanceof $ && (i = e.clone()), o = i.clone(), i.zoom(this._zoom), (i.width > a.width || i.height > a.height) && (this._zoom = this._getValidZoom(ke.min(a.width / o.width, a.height / o.height)), i = o.clone().zoom(this._zoom)), this._zoomMainLayer(), n = i.clone(), s.align(i, t.align), r = i.topLeft().minus(n.topLeft()), this.pan(r.times(-1), t.animate)) }, alignShapes: function (e) { var t, n, i, o, r, a, s; if (fe(e) && (e = "Left"), t = this.select(), 0 !== t.length) { switch (e.toLowerCase()) { case "left": case "top": n = et; break; case "right": case "bottom": n = tt }for (o = 0; o < t.length; o++)if (i = t[o], i instanceof k) switch (e.toLowerCase()) { case "left": n = ke.min(n, i.options.x); break; case "top": n = ke.min(n, i.options.y); break; case "right": n = ke.max(n, i.options.x); break; case "bottom": n = ke.max(n, i.options.y) }for (r = [], a = [], o = 0; o < t.length; o++)if (i = t[o], i instanceof k) switch (a.push(i), r.push(i.bounds()), e.toLowerCase()) { case "left": case "right": i.position(new Z(n, i.options.y)); break; case "top": case "bottom": i.position(new Z(i.options.x, n)) }s = new F.TransformUnit(a, r), this.undoRedoService.add(s, !1) } }, zoom: function (e, t) { var n, i, o, r; return e && (n = t ? t.point : new F.Point(0, 0), e = this._zoom = this._getValidZoom(e), fe(n) || (n = new F.Point(ke.round(n.x), ke.round(n.y)), i = n.times(e), o = this.modelToView(n), r = o.minus(i), this._storePan(new F.Point(ke.round(r.x), ke.round(r.y)))), t && (t.zoom = e), this._panTransform(), this.canvas.surface.hideTooltip(), this._updateAdorners()), this._zoom }, _getPan: function (e) { var t = this.canvas; return t.translate || (e = e.plus(this._pan)), e }, pan: function (e, n) { var i, o; return e instanceof Z ? (i = this, o = i.scroller, e = i._getPan(e), e = e.times(-1), n ? o.animatedScrollTo(e.x, e.y, function () { i._updateAdorners() }) : (o.scrollTo(e.x, e.y), i._updateAdorners()), t) : this._pan.times(-1) }, viewport: function () { var e = this.element, t = e.width(), n = e.height(); return this.toolBar && (n -= N(this.toolBar.element)), new $(0, 0, t, n) }, copy: function () { var e, t; if (this.options.copy.enabled) for (this._clipboard = [], this._copyOffset = 1, e = 0; e < this._selectedItems.length; e++)t = this._selectedItems[e], this._clipboard.push(t) }, cut: function () { var e, t; if (this.options.copy.enabled) { for (this._clipboard = [], this._copyOffset = 0, e = 0; e < this._selectedItems.length; e++)t = this._selectedItems[e], this._clipboard.push(t); this.remove(this._clipboard, !0) } }, paste: function () { var e, t, n, i, o, r, a, s; if (this._clipboard.length > 0) { for (i = {}, o = h(this._clipboard), r = o.connections, a = o.shapes, s = { x: this._copyOffset * this.options.copy.offsetX, y: this._copyOffset * this.options.copy.offsetY }, this.deselect(), n = 0; n < a.length; n++)e = a[n], t = e.clone(), i[e.id] = t, t.position(new Z(e.options.x + s.x, e.options.y + s.y)), t.diagram = this, t = this._addShape(t), t && t.select(); for (n = 0; n < r.length; n++)e = r[n], t = this._addConnection(e.clone()), t && (this._updateCopiedConnection(t, e, "source", i, s), this._updateCopiedConnection(t, e, "target", i, s), t.select(!0), t.updateModel()); this._syncChanges(), this._copyOffset += 1 } }, _updateCopiedConnection: function (e, t, n, i, o) { var r, a, s, l = t[n](), d = this; l instanceof w && i[l.shape.id] ? (s = i[l.shape.id], d.getShapeById(s.id) ? e[n](s.getConnector(l.options.name)) : (a = d._inactiveShapeItems.getByUid(s.dataItem.uid), a && (r = function (t) { s = d._dataMap[t.id], e[n](s.getConnector(l.options.name)), e.updateModel() }, d._deferredConnectionUpdates.push(a.onActivate(r))))) : e[n](new Z(t[n + "Point"]().x + o.x, t[n + "Point"]().y + o.y)) }, boundingBox: function (e, t) { var n, i, o, r = $.empty(), a = ge(e) ? this._getDiagramItems(e) : { shapes: this.shapes }; if (a.shapes.length > 0) for (i = a.shapes[0], r = i.bounds(ot), o = 1; o < a.shapes.length; o++)i = a.shapes[o], n = i.bounds(ot), t === !0 && (n.x -= i._rotationOffset.x, n.y -= i._rotationOffset.y), r = r.union(n); return r }, _containerOffset: function () { var e = this.element.offset(); return this.toolBar && (e.top += N(this.toolBar.element)), e }, documentToView: function (e) { var t = this._containerOffset(); return new Z(e.x - t.left, e.y - t.top) }, viewToDocument: function (e) { var t = this._containerOffset(); return new Z(e.x + t.left, e.y + t.top) }, viewToModel: function (e) { return this._transformWithMatrix(e, this._matrixInvert) }, modelToView: function (e) { return this._transformWithMatrix(e, this._matrix) }, modelToLayer: function (e) { return this._transformWithMatrix(e, this._layerMatrix) }, layerToModel: function (e) { return this._transformWithMatrix(e, this._layerMatrixInvert) }, documentToModel: function (e) { var t = this.documentToView(e); return this.canvas.translate || (t.x = t.x + this.scroller.scrollLeft, t.y = t.y + this.scroller.scrollTop), this.viewToModel(t) }, modelToDocument: function (e) { return this.viewToDocument(this.modelToView(e)) }, _transformWithMatrix: function (e, t) { var n, i, o = e; return e instanceof Z ? t && (o = t.apply(e)) : (n = this._transformWithMatrix(e.topLeft(), t), i = this._transformWithMatrix(e.bottomRight(), t), o = $.fromPoints(n, i)), o }, setDataSource: function (e) { this.options.dataSource = e, this._dataSource(), this.options.autoBind && this.dataSource.fetch() }, setConnectionsDataSource: function (e) { this.options.connectionsDataSource = e, this._connectionDataSource(), this.options.autoBind && this.connectionsDataSource.fetch() }, layout: function (e) { var t, n, i, o, r; switch (this._layouting = !0, fe(e) && (e = this.options.layout), t = fe(e) || fe(e.type) ? "Tree" : e.type, t.toLowerCase()) { case "tree": n = new F.TreeLayout(this); break; case "layered": n = new F.LayeredLayout(this); break; case "forcedirected": case "force": case "spring": case "springembedder": n = new F.SpringLayout(this); break; default: throw "Layout algorithm '" + t + "' is not supported." }i = new F.LayoutState(this), o = n.layout(e), o && (r = new F.LayoutUndoUnit(i, o, e ? e.animate : null), this.undoRedoService.add(r)), this._layouting = !1, this._redrawConnections() }, getShapeById: function (e) { var t; return (t = le.first(this.shapes, function (t) { return t.visual.id === e })) ? t : t = le.first(this.connections, function (t) { return t.visual.id === e }) }, getShapeByModelId: function (e) { var t; return t = this._isEditable ? this._dataMap[e] : le.first(this.shapes, function (t) { return (t.dataItem || {}).id === e }) }, getShapeByModelUid: function (e) { var t; return t = this._isEditable ? le.first(this.shapes, function (t) { return (t.dataItem || {}).uid === e }) : this._dataMap[e] }, getConnectionByModelId: function (e) { var t; return this.connectionsDataSource && (t = le.first(this.connections, function (t) { return (t.dataItem || {}).id === e })), t }, getConnectionByModelUid: function (e) { var t; return this.connectionsDataSource && (t = this._connectionsDataMap[e]), t }, _extendLayoutOptions: function (e) { e.layout && (e.layout = L({}, F.LayoutBase.fn.defaultOptions || {}, e.layout)) }, _selectionChanged: function (e, t) { (e.length || t.length) && this.trigger(Ne, { selected: e, deselected: t }) }, _getValidZoom: function (e) { return ke.min(ke.max(e, this.options.zoomMin), this.options.zoomMax) }, _panTransform: function (e) { var t = this, n = e || t._pan; t.canvas.translate ? (t.scroller.scrollTo(n.x, n.y), t._zoomMainLayer()) : (t._storePan(n), t._transformMainLayer()) }, _finishPan: function () { this.trigger(Ve, { total: this._pan, delta: Number.NaN }) }, _storePan: function (e) { this._pan = e, this._storeViewMatrix() }, _zoomMainLayer: function () { var e = this._zoom, t = new G(0, 0, e, e); t.render(this.mainLayer), this._storeLayerMatrix(t), this._storeViewMatrix() }, _transformMainLayer: function () { var e = this._pan, t = this._zoom, n = new G(e.x, e.y, t, t); n.render(this.mainLayer), this._storeLayerMatrix(n), this._storeViewMatrix() }, _storeLayerMatrix: function (e) { this._layerMatrix = e.toMatrix(), this._layerMatrixInvert = e.invert().toMatrix() }, _storeViewMatrix: function () { var e = this._pan, t = this._zoom, n = new G(e.x, e.y, t, t); this._matrix = n.toMatrix(), this._matrixInvert = n.invert().toMatrix() }, _toIndex: function (e, t) { var n = this._getDiagramItems(e); this.mainLayer.toIndex(n.visuals, t), this._fixOrdering(n, !1) }, _fixOrdering: function (e, t) { var n, i, o = t ? this.shapes.length - 1 : 0, r = t ? this.connections.length - 1 : 0; for (n = 0; n < e.shapes.length; n++)i = e.shapes[n], le.remove(this.shapes, i), le.insert(this.shapes, i, o); for (n = 0; n < e.cons.length; n++)i = e.cons[n], le.remove(this.connections, i), le.insert(this.connections, i, r) }, _getDiagramItems: function (e) { var t, n, i = {}, o = e; for (i.visuals = [], i.shapes = [], i.cons = [], e ? ve(e) || (o = [e]) : o = this._selectedItems.slice(), t = 0; t < o.length; t++)n = o[t], n instanceof k ? (i.shapes.push(n), i.visuals.push(n.visual)) : n instanceof y && (i.cons.push(n), i.visuals.push(n.visual)); return i }, _removeItem: function (e, t, n) { e.select(!1), e instanceof k ? (this._removeShapeDataItem(e), this._removeShape(e, t, n)) : e instanceof y && (this._removeConnectionDataItem(e), this._removeConnection(e, t)), this.mainLayer.remove(e.visual) }, _removeShape: function (e, t, n) { var i, o, r, a, s = [], l = []; for (this.toolService._removeHover(), t && this.undoRedoService.addCompositeItem(new Y(e)), le.remove(this.shapes, e), this._shapesQuadTree.remove(e), i = 0; i < e.connectors.length; i++)for (r = e.connectors[i], a = 0; a < r.connections.length; a++)o = r.connections[a], n && I.inArray(o, n) || (o.sourceConnector == r ? s.push(o) : o.targetConnector == r && l.push(o)); for (i = 0; i < s.length; i++)s[i].source(null, t), s[i].updateModel(); for (i = 0; i < l.length; i++)l[i].target(null, t), l[i].updateModel() }, _removeConnection: function (e, t) { e.sourceConnector && le.remove(e.sourceConnector.connections, e), e.targetConnector && le.remove(e.targetConnector.connections, e), t && this.undoRedoService.addCompositeItem(new Q(e)), le.remove(this.connections, e) }, _removeDataItems: function (e, t) { var n, i, o, r; for (e = ve(e) ? e : [e]; e.length;)if (n = e.shift(), o = this._dataMap[n.uid], o && (this._removeShapeConnections(o), this._removeItem(o, !1), delete this._dataMap[n.uid], t && n.hasChildren && n.loaded())) for (i = n.children.data(), r = 0; r < i.length; r++)e.push(i[r]) }, _removeShapeConnections: function (e) { var t, n = e.connections(); if (n) for (t = 0; t < n.length; t++)this._removeItem(n[t], !1) }, _addDataItem: function (e, t) { var n, i; if (me(e)) return (n = this._dataMap[e.id]) ? n : (i = L({}, this.options.shapeDefaults), i.dataItem = e, n = new k(i, this), this.addShape(n, t !== !1), this._dataMap[e.id] = n, n) }, _addDataItemByUid: function (e) { var t, n; if (me(e)) return (t = this._dataMap[e.uid]) ? t : (n = L({}, this.options.shapeDefaults), n.dataItem = e, t = new k(n, this), this.addShape(t), this._dataMap[e.uid] = t, t) }, _addDataItems: function (e, t) { var n, i, o, r, a; for (i = 0; i < e.length; i++)n = e[i], o = this._addDataItemByUid(n), r = this._addDataItemByUid(t), r && !this.connected(r, o) && (a = this.connect(r, o)) }, _refreshSource: function (e) { var t, n, i = this, o = e.node, r = e.action, a = e.items, s = i.options; if (e.field) for (t = 0; t < a.length; t++)this._dataMap[a[t].uid] && this._dataMap[a[t].uid].redrawVisual(); else { if ("remove" == r) this._removeDataItems(e.items, !0); else for (r && "itemloaded" !== r || this._bindingRoots || (this._bindingRoots = !0, n = !0), r || o || i.clear(), this._addDataItems(a, o), t = 0; t < a.length; t++)a[t].load(); s.layout && (n || "remove" == r || "add" == r) && i.layout(s.layout), n && (this.trigger("dataBound"), this._bindingRoots = !1) } }, _addItem: function (e) { e instanceof k ? this.addShape(e) : e instanceof y && this.addConnection(e) }, _createToolBar: function (e) { var t, n, i, o, r, a, s, l, d, c = this.toolService.diagram; this.singleToolBar || 1 !== c.select().length || (t = c.select()[0], t && t.options.editable !== !1 && (n = t.options.editable, i = n.tools, this._isEditable && 0 === i.length && (t instanceof k ? i = ["edit", "rotateClockwise", "rotateAnticlockwise"] : t instanceof y && (i = ["edit"]), n && n.remove !== !1 && i.push("delete")), i && i.length && (o = 20, this.singleToolBar = new C(c, { tools: i, click: B(this._toolBarClick, this), modal: !0, popupZIndex: parseInt(c.element.closest(".k-window").css("zIndex"), 10) + 10 }), a = H(this.singleToolBar._popup.element), s = N(this.singleToolBar._popup.element), t instanceof k ? (l = this.modelToView(t.bounds(ot)), r = new Z(l.x, l.y).minus(new Z((a - l.width) / 2, s + o))) : t instanceof y && (d = this.modelToView(t.bounds()), r = new Z(d.x, d.y).minus(new Z((a - d.width - 20) / 2, s + o))), r ? (this.canvas.translate || (r = r.minus(new Z(this.scroller.scrollLeft, this.scroller.scrollTop))), r = this.viewToDocument(r), r = new Z(ke.max(r.x, 0), ke.max(r.y, 0)), this.singleToolBar.showAt(r), e && this.singleToolBar._popup.one("close", v)) : this._destroyToolBar()))) }, _toolBarClick: function (e) { this.trigger("toolBarClick", e), this._destroyToolBar() }, _normalizePointZoom: function (e) { return e.times(1 / this.zoom()) }, _initialize: function () { this.shapes = [], this._selectedItems = [], this.connections = [], this._dataMap = {}, this._connectionsDataMap = {}, this._inactiveShapeItems = new c, this._deferredConnectionUpdates = [], this.undoRedoService = new ne({ undone: this._syncHandler, redone: this._syncHandler }), this.id = F.randomId() }, _fetchFreshData: function () { var e = this; e._dataSource(), e._isEditable && e._connectionDataSource(), e.options.autoBind && (e._isEditable ? (this._loadingShapes = !0, this._loadingConnections = !0, e.dataSource.fetch(), e.connectionsDataSource.fetch()) : e.dataSource.fetch()) }, _dataSource: function () { var e, t; me(this.options.connectionsDataSource) ? (this._isEditable = !0, e = this.options.dataSource || {}, t = ve(e) ? { data: e } : e, this.dataSource && this._shapesRefreshHandler ? this.dataSource.unbind("change", this._shapesRefreshHandler).unbind("requestStart", this._shapesRequestStartHandler).unbind("error", this._shapesErrorHandler) : (this._shapesRefreshHandler = B(this._refreshShapes, this), this._shapesRequestStartHandler = B(this._shapesRequestStart, this), this._shapesErrorHandler = B(this._error, this)), this.dataSource = kendo.data.DataSource.create(t).bind("change", this._shapesRefreshHandler).bind("requestStart", this._shapesRequestStartHandler).bind("error", this._shapesErrorHandler)) : (this._treeDataSource(), this._isEditable = !1) }, _connectionDataSource: function () { var e, t = this.options.connectionsDataSource; t && (e = ve(t) ? { data: t } : t, this.connectionsDataSource && this._connectionsRefreshHandler ? this.connectionsDataSource.unbind("change", this._connectionsRefreshHandler).unbind("requestStart", this._connectionsRequestStartHandler).unbind("error", this._connectionsErrorHandler) : (this._connectionsRefreshHandler = B(this._refreshConnections, this), this._connectionsRequestStartHandler = B(this._connectionsRequestStart, this), this._connectionsErrorHandler = B(this._connectionsError, this)), this.connectionsDataSource = kendo.data.DataSource.create(e).bind("change", this._connectionsRefreshHandler).bind("requestStart", this._connectionsRequestStartHandler).bind("error", this._connectionsErrorHandler)) }, _shapesRequestStart: function (e) { "read" == e.type && (this._loadingShapes = !0) }, _connectionsRequestStart: function (e) { "read" == e.type && (this._loadingConnections = !0) }, _error: function () { this._loadingShapes = !1 }, _connectionsError: function () { this._loadingConnections = !1 }, _refreshShapes: function (e) { "remove" === e.action ? this._shouldRefresh() && this._removeShapes(e.items) : "itemchange" === e.action ? this._shouldRefresh() && this._updateShapes(e.items, e.field) : "add" === e.action ? this._inactiveShapeItems.add(e.items) : "sync" === e.action ? this._syncShapes(e.items) : this.refresh() }, _shouldRefresh: function () { return !this._suspended }, _suspendModelRefresh: function () { this._suspended = (this._suspended || 0) + 1 }, _resumeModelRefresh: function () { this._suspended = ke.max((this._suspended || 0) - 1, 0) }, refresh: function () { this._loadingShapes = !1, this._loadingConnections || this._rebindShapesAndConnections() }, _rebindShapesAndConnections: function () { this.clear(), this._addShapes(this.dataSource.view()), this.connectionsDataSource && this._addConnections(this.connectionsDataSource.view(), !1), this.options.layout ? this.layout(this.options.layout) : this._redrawConnections(), this.trigger("dataBound") }, refreshConnections: function () { this._loadingConnections = !1, this._loadingShapes || this._rebindShapesAndConnections() }, _redrawConnections: function () { var e, t = this.connections; for (e = 0; e < t.length; e++)t[e].refresh() }, _removeShapes: function (e) { var t, n, i = this._dataMap; for (n = 0; n < e.length; n++)t = e[n], i[t.id] && (this.remove(i[t.id], !1), i[t.id] = null) }, _syncShapes: function () { var e = this, t = e._inactiveShapeItems; t.forEach(function (n) { var i = n.dataItem, o = n.element; i.isNew() || (o ? (o._setOptionsFromModel(), e.addShape(o, n.undoable), e._dataMap[i.id] = o) : e._addDataItem(i), n.activate(), t.remove(i)) }) }, _updateShapes: function (e, t) { var n, i, o; for (n = 0; n < e.length; n++)i = e[n], o = this._dataMap[i.id], o && o.updateOptionsFromModel(i, t) }, _addShapes: function (e) { for (var t = 0; t < e.length; t++)this._addDataItem(e[t], !1) }, _refreshConnections: function (e) { "remove" === e.action ? this._shouldRefresh() && this._removeConnections(e.items) : "add" === e.action ? this._addConnections(e.items) : "sync" === e.action || ("itemchange" === e.action ? this._shouldRefresh() && this._updateConnections(e.items) : this.refreshConnections()) }, _removeConnections: function (e) { for (var t = 0; t < e.length; t++)this.remove(this._connectionsDataMap[e[t].uid], !1), this._connectionsDataMap[e[t].uid] = null }, _updateConnections: function (e) { var t, n, i; for (t = 0; t < e.length; t++)n = e[t], i = this._connectionsDataMap[n.uid], i.updateOptionsFromModel(n) }, _addConnections: function (e, t) { var n, i, o = e.length; for (n = 0; n < o; n++)i = e[n], this._addConnectionDataItem(i, t) }, _addConnectionDataItem: function (e, t) { var n, i, o, r; this._connectionsDataMap[e.uid] || (n = this._validateConnector(e.from), me(n) && null !== n || (n = new Z(e.fromX, e.fromY)), i = this._validateConnector(e.to), me(i) && null !== i || (i = new Z(e.toX, e.toY)), me(n) && me(i) && (o = L({}, this.options.connectionDefaults), o.dataItem = e, r = new y(n, i, o), this._connectionsDataMap[e.uid] = r, this.addConnection(r, t))) }, _validateConnector: function (e) { var t; return me(e) && null !== e && (t = this._dataMap[e]), t }, _treeDataSource: function () { var e = this, t = e.options, n = t.dataSource; if (n = ve(n) ? { data: n } : n, n instanceof kendo.data.DataSource && !(n instanceof kendo.data.HierarchicalDataSource)) throw Error("Incorrect DataSource type. If a single dataSource instance is set to the diagram then it should be a HierarchicalDataSource. You should set only the options instead of an instance or a HierarchicalDataSource instance or supply connectionsDataSource as well."); n.fields || (n.fields = [{ field: "text" }, { field: "url" }, { field: "spriteCssClass" }, { field: "imageUrl" }]), e.dataSource && e._refreshHandler && e._unbindDataSource(), e._refreshHandler = B(e._refreshSource, e), e._errorHandler = B(e._error, e), e.dataSource = V.create(n).bind(Se, e._refreshHandler).bind(Re, e._errorHandler) }, _unbindDataSource: function () { var e = this; e.dataSource.unbind(Se, e._refreshHandler).unbind(Re, e._errorHandler) }, _adorn: function (e, n) { n !== t && e && (n ? (this._adorners.push(e), this.adornerLayer.append(e.visual)) : (le.remove(this._adorners, e), this.adornerLayer.remove(e.visual))) }, _showConnectors: function (e, t) { t ? this._connectorsAdorner.show(e) : this._connectorsAdorner.destroy() }, _updateAdorners: function () { var e, t, n = this._adorners; for (e = 0; e < n.length; e++)t = n[e], t.refreshBounds && t.refreshBounds(), t.refresh() }, _refresh: function () { for (var e = 0; e < this.connections.length; e++)this.connections[e].refresh() }, _destroyToolBar: function () { this.singleToolBar && (this.singleToolBar.hide(), this.singleToolBar.destroy(), this.singleToolBar = null) }, _destroyGlobalToolBar: function () { this.toolBar && (this.toolBar.hide(), this.toolBar.destroy(), this.toolBar = null) }, exportDOMVisual: function () { var e = this.canvas._viewBox, t = R.transform().translate(-e.x, -e.y), n = new R.Rect([0, 0], [e.width, e.height]), i = M.Path.fromRect(n), o = new M.Group({ transform: t }), r = new M.Group({ clip: i }), a = this.canvas.drawingElement.children[0]; return r.append(o), o.children.push(a), r }, exportVisual: function () { var e = R.transform().scale(1 / this._zoom), t = new M.Group({ transform: e }), n = this.mainLayer.drawingElement; return t.children.push(n), t }, _syncChanges: function () { this._syncShapeChanges(), this._syncConnectionChanges() }, _syncShapeChanges: function () { this.dataSource && this._isEditable && this.dataSource.sync() }, _syncConnectionChanges: function () { var t = this; t.connectionsDataSource && t._isEditable && (e.when.apply(e, t._deferredConnectionUpdates).then(function () { t.connectionsDataSource.sync() }), t.deferredConnectionUpdates = []) }
}), I.ExportMixin.extend(x.fn, !0), kendo.PDFMixin && kendo.PDFMixin.extend(x.fn), C = kendo.Observable.extend({
init: function (e, t) { kendo.Observable.fn.init.call(this), this.diagram = e, this.options = L({}, this.options, t), this._tools = [], this.createToolBar(), this.createTools(), this.appendTools(), this.options.modal && this.createPopup(), this.bind(this.events, t) }, events: ["click"], createPopup: function () { this.container = e("
").append(this.element), this._popup = this.container.kendoPopup({}).getKendoPopup() }, appendTools: function () { var e, t; for (e = 0; e < this._tools.length; e++)t = this._tools[e], (t.buttons && t.buttons.length || !me(t.buttons)) && this._toolBar.add(t) }, createToolBar: function () { this.element = e("
"), this._toolBar = this.element.kendoToolBar({ click: B(this.click, this), resizable: !1 }).getKendoToolBar(), this.element.css("border", "none") }, createTools: function () { for (var e = 0; e < this.options.tools.length; e++)this.createTool(this.options.tools[e]) }, createTool: function (e) { we(e) || (e = { name: e }); var t = e.name + "Tool"; this[t] ? this[t](e) : this._tools.push(L({}, e, { attributes: this._setAttributes({ action: e.name }) })) }, showAt: function (e) { var t = parseInt(this.options.popupZIndex, 10); this._popup && (this._popup.open(e.x, e.y), t && this._popup.wrapper.css("zIndex", t)) }, hide: function () { this._popup && this._popup.close() }, newGroup: function () { return { type: "buttonGroup", buttons: [] } }, editTool: function () { this._tools.push({ icon: "edit", showText: "overflow", type: "button", text: "Edit", attributes: this._setAttributes({ action: "edit" }) }) }, deleteTool: function () { this._tools.push({ icon: "close", showText: "overflow", type: "button", text: "Delete", attributes: this._setAttributes({ action: "delete" }) }) }, rotateAnticlockwiseTool: function (e) { this._appendGroup("rotate"), this._rotateGroup.buttons.push({ icon: "rotate-left", showText: "overflow", text: "RotateAnticlockwise", group: "rotate", attributes: this._setAttributes({ action: "rotateAnticlockwise", step: e.step }) }) }, rotateClockwiseTool: function (e) { this._appendGroup("rotate"), this._rotateGroup.buttons.push({ icon: "rotate-right", attributes: this._setAttributes({ action: "rotateClockwise", step: e.step }), showText: "overflow", text: "RotateClockwise", group: "rotate" }) }, createShapeTool: function () { this._appendGroup("create"), this._createGroup.buttons.push({ icon: "shape", showText: "overflow", text: "CreateShape", group: "create", attributes: this._setAttributes({ action: "createShape" }) }) }, createConnectionTool: function () { this._appendGroup("create"), this._createGroup.buttons.push({ icon: "connector", showText: "overflow", text: "CreateConnection", group: "create", attributes: this._setAttributes({ action: "createConnection" }) }) }, undoTool: function () { this._appendGroup("history"), this._historyGroup.buttons.push({ icon: "undo", showText: "overflow", text: "Undo", group: "history", attributes: this._setAttributes({ action: "undo" }) }) }, redoTool: function () { this._appendGroup("history"), this._historyGroup.buttons.push({ icon: "redo", showText: "overflow", text: "Redo", group: "history", attributes: this._setAttributes({ action: "redo" }) }) }, _appendGroup: function (e) {
var t = "_" + e + "Group"; this[t] || (this[t] = this.newGroup(), this._tools.push(this[t]))
}, _setAttributes: function (e) { var t = {}; return e.action && (t[kendo.attr("action")] = e.action), e.step && (t[kendo.attr("step")] = e.step), t }, _getAttributes: function (e) { var t, n = {}, i = e.attr(kendo.attr("action")); return i && (n.action = i), t = e.attr(kendo.attr("step")), t && (n.step = t), n }, click: function (t) { var n = this._getAttributes(e(t.target)), i = n.action; i && this[i] && this[i](n), this.trigger("click", this.eventData(i, t.target)) }, eventData: function (e, t) { var n, i, o = this.selectedElements(), r = o.length, a = [], s = []; for (i = 0; i < r; i++)n = o[i], n instanceof k ? a.push(n) : s.push(n); return { shapes: a, connections: s, action: e, target: t } }, "delete": function () { var e = this.diagram, t = e._triggerRemove(this.selectedElements()); t.length && (this.diagram.remove(t, !0), this.diagram._syncChanges()) }, edit: function () { var e = this.selectedElements(); 1 === e.length && this.diagram.edit(e[0]) }, rotateClockwise: function (e) { var t = parseFloat(e.step || 90); this._rotate(t) }, rotateAnticlockwise: function (e) { var t = parseFloat(e.step || 90); this._rotate(-t) }, _rotate: function (e) { var t = this.diagram._resizingAdorner; t.angle(t.angle() + e), t.rotate() }, selectedElements: function () { return this.diagram.select() }, createShape: function () { this.diagram.createShape() }, createConnection: function () { this.diagram.createConnection() }, undo: function () { this.diagram.undo() }, redo: function () { this.diagram.redo() }, destroy: function () { this.diagram = null, this.element = null, this.options = null, this._toolBar && this._toolBar.destroy(), this._popup && this._popup.destroy() }
}), S = kendo.Observable.extend({ init: function (e, t) { kendo.Observable.fn.init.call(this), this.options = O(!0, {}, this.options, t), this.element = e, this.model = this.options.model, this.fields = this._getFields(), this._initContainer(), this.createEditable() }, options: { editors: {} }, _initContainer: function () { this.wrapper = this.element }, createEditable: function () { var e = this.options; this.editable = new kendo.ui.Editable(this.wrapper, { fields: this.fields, target: e.target, clearContainer: !1, model: this.model }) }, _isEditable: function (e) { return this.model.editable && this.model.editable(e) }, _getFields: function () { var e, t, n, i = [], o = this.model.fields; for (e in o) t = {}, this._isEditable(e) && (n = this.options.editors[e], n && (t.editor = n), t.field = e, i.push(t)); return i }, end: function () { return this.editable.end() }, destroy: function () { this.editable.destroy(), this.editable.element.find("[" + kendo.attr("container-for") + "]").empty(), this.model = this.wrapper = this.element = this.columns = this.editable = null } }), T = S.extend({ init: function (e, t) { S.fn.init.call(this, e, t), this.bind(this.events, this.options), this.open() }, events: ["update", "cancel"], options: { window: { modal: !0, resizable: !1, draggable: !0, title: "Edit", visible: !1 } }, _initContainer: function () { var t, n = this; this.wrapper = e('').attr(kendo.attr("uid"), this.model.uid), t = "", this.options.template ? (t += this._renderTemplate(), this.fields = []) : t += this._renderFields(), t += this._renderButtons(), this.wrapper.append(e('
').append(t)), this.window = new kendo.ui.Window(this.wrapper.appendTo(this.element), this.options.window), this.window.bind("close", function (e) { e.userTriggered && (e.sender.element.focus(), n._cancelClick(e)) }), this._attachButtonEvents() }, _renderTemplate: function () { var e = this.options.template; return "string" == typeof e && (e = kendo.unescape(e)), e = kendo.template(e)(this.model) }, _renderFields: function () { var e, t, n = ""; for (e = 0; e < this.fields.length; e++)t = this.fields[e], n += '
' + (t.field || "") + "
", this._isEditable(t.field) && (n += "
'); return n }, _renderButtons: function () { var e = '
'; return e += this._createButton("update"), e += this._createButton("cancel"), e += "
" }, _createButton: function (e) { return kendo.template(pt)(_[e]) }, _attachButtonEvents: function () { this._cancelClickHandler = B(this._cancelClick, this), this.window.element.on(Te + ye, "a.k-diagram-cancel", this._cancelClickHandler), this._updateClickHandler = B(this._updateClick, this), this.window.element.on(Te + ye, "a.k-diagram-update", this._updateClickHandler) }, _updateClick: function (e) { e.preventDefault(), this.trigger("update") }, _cancelClick: function (e) { e.preventDefault(), this.trigger("cancel") }, open: function () { this.window.center().open() }, close: function () { this.window.bind("deactivate", B(this.destroy, this)).close() }, destroy: function () { this.window.close().destroy(), this.window.element.off(Te + ye, "a.k-diagram-cancel", this._cancelClickHandler), this.window.element.off(Te + ye, "a.k-diagram-update", this._updateClickHandler), this._cancelClickHandler = null, this._editUpdateClickHandler = null, this.window = null, S.fn.destroy.call(this) } }), d.fn = d.prototype = { onActivate: function (t) { var n = e.Deferred(); return this.callbacks.push({ callback: t, deferred: n }), n }, activate: function () { var e, t, n = this.callbacks; for (t = 0; t < n.length; t++)e = this.callbacks[t], e.callback(this.dataItem), e.deferred.resolve(); this.callbacks = [] } }, c.fn = c.prototype = { add: function (e) { for (var t = 0; t < e.length; t++)this.items[e[t].uid] = new d(e[t]) }, forEach: function (e) { for (var t in this.items) e(this.items[t]) }, getByUid: function (e) { return this.items[e] }, remove: function (e) { delete this.items[e.uid] } }, D = z.extend({ init: function () { this.shapes = [] }, _add: function (e, t) { this.shapes.push({ bounds: t, shape: e }), e._quadNode = this }, insert: function (e, t) { this._add(e, t) }, remove: function (e) { var t, n = this.shapes, i = n.length; for (t = 0; t < i; t++)if (n[t].shape === e) { n.splice(t, 1); break } }, hitTestRect: function (e, t) { var n, i = this.shapes, o = i.length; for (n = 0; n < o; n++)if (this._testRect(i[n].shape, e) && !I.inArray(i[n].shape, t)) return !0 }, _testRect: function (e, t) { var n, i = e.rotate().angle, o = e.bounds(); return n = i ? ee.rects(t, o, -i) : o.overlaps(t) } }), A = D.extend({ init: function (e) { D.fn.init.call(this), this.children = [], this.rect = e }, inBounds: function (e) { var t = this.rect, n = t.bottomRight(), i = e.bottomRight(), o = t.x <= e.x && t.y <= e.y && i.x <= n.x && i.y <= n.y; return o }, overlapsBounds: function (e) { return this.rect.overlaps(e) }, insert: function (e, t) { var n, i = !1, o = this.children, r = o.length; if (this.inBounds(t)) { if (!r && this.shapes.length < 4) this._add(e, t); else { for (r || this._initChildren(), n = 0; n < o.length; n++)if (o[n].insert(e, t)) { i = !0; break } i || this._add(e, t) } i = !0 } return i }, _initChildren: function () { var e, t, n = this.rect, i = this.children, o = this.shapes, r = n.center(), a = n.width / 2, s = n.height / 2; for (i.push(new A(new $(n.x, n.y, a, s)), new A(new $(r.x, n.y, a, s)), new A(new $(n.x, r.y, a, s)), new A(new $(r.x, r.y, a, s))), t = o.length - 1; t >= 0; t--)for (e = 0; e < i.length; e++)if (i[e].insert(o[t].shape, o[t].bounds)) { o.splice(t, 1); break } }, hitTestRect: function (e, t) { var n, i = this.children, o = i.length, r = !1; if (this.overlapsBounds(e)) if (D.fn.hitTestRect.call(this, e, t)) r = !0; else for (n = 0; n < o; n++)if (i[n].hitTestRect(e, t)) { r = !0; break } return r } }), E = z.extend({ ROOT_SIZE: 1e3, init: function (e) { var t = B(this._boundsChange, this); e.bind(Ce, t), e.bind(Oe, t), this.initRoots() }, initRoots: function () { this.rootMap = {}, this.root = new D }, clear: function () { this.initRoots() }, _boundsChange: function (e) { e.item._quadNode && e.item._quadNode.remove(e.item), this.insert(e.item) }, insert: function (e) { var t = e.bounds(ot), n = this.ROOT_SIZE, i = this.getSectors(t), o = i[0][0], r = i[1][0]; this.inRoot(i) ? this.root.insert(e, t) : (this.rootMap[o] || (this.rootMap[o] = {}), this.rootMap[o][r] || (this.rootMap[o][r] = new A(new $(o * n, r * n, n, n))), this.rootMap[o][r].insert(e, t)) }, remove: function (e) { e._quadNode && e._quadNode.remove(e) }, inRoot: function (e) { return e[0].length > 1 || e[1].length > 1 }, getSectors: function (e) { var t, n, i = this.ROOT_SIZE, o = e.bottomRight(), r = ke.floor(o.x / i), a = ke.floor(o.y / i), s = [[], []]; for (t = ke.floor(e.x / i); t <= r; t++)s[0].push(t); for (n = ke.floor(e.y / i); n <= a; n++)s[1].push(n); return s }, hitTestRect: function (e, t) { var n, i, o, r, a, s = this.getSectors(e); if (this.root.hitTestRect(e, t)) return !0; for (n = 0; n < s[0].length; n++)for (o = s[0][n], i = 0; i < s[1].length; i++)if (r = s[1][i], a = (this.rootMap[o] || {})[r], a && a.hitTestRect(e, t)) return !0; return !1 } }), I.ui.plugin(x), L(F, { Shape: k, Connection: y, Connector: w, DiagramToolBar: C, QuadNode: A, QuadRoot: D, ShapesQuadTree: E, PopupEditor: T })
}(window.kendo.jQuery)
}, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.dataviz.diagram.min", ["kendo.data.min", "kendo.draganddrop.min", "kendo.userevents.min", "kendo.mobile.scroller.min", "kendo.drawing.min", "dataviz/diagram/utils.min", "dataviz/diagram/math.min", "dataviz/diagram/svg.min", "dataviz/diagram/services.min", "dataviz/diagram/layout.min", "dataviz/diagram/dom.min"], e) }(function () { return window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.dataviz.treemap.min", ["kendo.data.min", "kendo.userevents.min", "kendo.dataviz.themes.min"], e) }(function () { return function (e, t) { function n(e, t) { if (null === t) return t; var n = C(e, !0); return n(t) } function i(e) { return typeof e !== F } function o(e, t, n) { var i, o, l = s(e), d = s(t), c = u(e) - u(t) < 0, h = []; for (h.push(e), i = 0; i < n; i++)o = { r: r(l.r, d.r, i, n, c), g: r(l.g, d.g, i, n, c), b: r(l.b, d.b, i, n, c) }, h.push(a(o)); return h.push(t), h } function r(e, t, n, i, o) { var r, a = p.min(p.abs(e), p.abs(t)), s = p.max(p.abs(e), p.abs(t)), l = (s - a) / (i + 1), d = l * (n + 1); return r = o ? a + d : s - d } function a(e) { return "#" + l(e.r) + l(e.g) + l(e.b) } function s(e) { e = e.replace("#", ""); var t = d(e); return { r: c(t.r), g: c(t.g), b: c(t.b) } } function l(e) { var t = p.round(e).toString(16).toUpperCase(); return 1 === t.length && (t = "0" + t), t } function d(e) { var t = e.length, n = {}; return 3 === t ? (n.r = e[0], n.g = e[1], n.b = e[2]) : (n.r = e.substring(0, 2), n.g = e.substring(2, 4), n.b = e.substring(4, 6)), n } function c(e) { return parseInt(e.toString(16), 16) } function u(e) { var t = 0; return e && (e = s(e), t = p.sqrt(.241 * e.r * e.r + .691 * e.g * e.g + .068 * e.b * e.b)), t } function h(e) { var t = p.pow(10, 4); return p.round(e * t) / t } var p = Math, f = e.proxy, g = e.isArray, m = window.kendo, v = m._outerHeight, _ = m._outerWidth, b = m.Class, w = m.ui.Widget, k = m.template, y = m.deepExtend, x = m.data.HierarchicalDataSource, C = m.getter, S = m.dataviz, T = ".kendoTreeMap", D = "change", A = "dataBound", E = "itemCreated", I = Number.MAX_VALUE, M = "mouseover" + T, R = "mouseleave" + T, F = "undefined", P = w.extend({ init: function (t, n) { m.destroy(t), e(t).empty(), w.fn.init.call(this, t, n), this.wrapper = this.element, this._initTheme(this.options), this.element.addClass("k-widget k-treemap"), this._setLayout(), this._originalOptions = y({}, this.options), this._initDataSource(), this._attachEvents(), m.notify(this, S.ui) }, options: { name: "TreeMap", theme: "default", autoBind: !0, textField: "text", valueField: "value", colorField: "color" }, events: [A, E], _initTheme: function (e) { var t = this, n = S.ui.themes || {}, i = ((e || {}).theme || "").toLowerCase(), o = (n[i] || {}).treeMap; t.options = y({}, o, e) }, _attachEvents: function () { this.element.on(M, f(this._mouseover, this)).on(R, f(this._mouseleave, this)), this._resizeHandler = f(this.resize, this, !1), m.onResize(this._resizeHandler) }, _setLayout: function () { "horizontal" === this.options.type ? (this._layout = new L((!1)), this._view = new H(this, this.options)) : "vertical" === this.options.type ? (this._layout = new L((!0)), this._view = new H(this, this.options)) : (this._layout = new z, this._view = new B(this, this.options)) }, _initDataSource: function () { var e = this, t = e.options, n = t.dataSource; e._dataChangeHandler = f(e._onDataChange, e), e.dataSource = x.create(n).bind(D, e._dataChangeHandler), n && e.options.autoBind && e.dataSource.fetch() }, setDataSource: function (e) { var t = this; t.dataSource.unbind(D, t._dataChangeHandler), t.dataSource = e.bind(D, t._dataChangeHandler), e && t.options.autoBind && t.dataSource.fetch() }, _onDataChange: function (e) { var t, n, i, o, r = e.node, a = e.items, s = this.options; if (r) { if (a.length) { for (i = this._getByUid(r.uid), i.children = [], a = new m.data.Query(a)._sortForGrouping(s.valueField, "desc"), n = 0; n < a.length; n++)t = a[n], i.children.push(this._wrapItem(t)); o = this._view.htmlSize(i), this._layout.compute(i.children, i.coord, o), this._setColors(i.children), this._view.render(i) } } else this._cleanItems(), this.element.empty(), t = this._wrapItem(a[0]), this._layout.createRoot(t, _(this.element), v(this.element), "vertical" === this.options.type), this._view.createRoot(t), this._root = t, this._colorIdx = 0; for (n = 0; n < a.length; n++)a[n].load(); r && this.trigger(A, { node: r }) }, _cleanItems: function () { var e = this; e.angular("cleanup", function () { return { elements: e.element.find(".k-leaf div,.k-treemap-title,.k-treemap-title-vertical") } }) }, _setColors: function (e) { var t, n, r, a, s = this.options.colors, l = this._colorIdx, d = s[l % s.length]; for (g(d) && (t = o(d[0], d[1], e.length)), r = !1, a = 0; a < e.length; a++)n = e[a], i(n.color) || (n.color = t ? t[a] : d), n.dataItem.hasChildren || (r = !0); r && this._colorIdx++ }, _contentSize: function (e) { this.view.renderHeight(e) }, _wrapItem: function (e) { var t = {}; return i(this.options.valueField) && (t.value = n(this.options.valueField, e)), i(this.options.colorField) && (t.color = n(this.options.colorField, e)), i(this.options.textField) && (t.text = n(this.options.textField, e)), t.level = e.level(), t.dataItem = e, t }, _getByUid: function (e) { for (var t, n = [this._root]; n.length;) { if (t = n.pop(), t.dataItem.uid === e) return t; t.children && (n = n.concat(t.children)) } }, dataItem: function (t) { var n = e(t).attr(m.attr("uid")), i = this.dataSource; return i && i.getByUid(n) }, findByUid: function (e) { return this.element.find(".k-treemap-tile[" + m.attr("uid") + "='" + e + "']") }, _mouseover: function (t) { var n = e(t.target); n.hasClass("k-leaf") && (this._removeActiveState(), n.removeClass("k-state-hover").addClass("k-state-hover")) }, _removeActiveState: function () { this.element.find(".k-state-hover").removeClass("k-state-hover") }, _mouseleave: function () { this._removeActiveState() }, destroy: function () { w.fn.destroy.call(this), this.element.off(T), this.dataSource && this.dataSource.unbind(D, this._dataChangeHandler), this._root = null, m.unbindResize(this._resizeHandler), m.destroy(this.element) }, items: function () { return e() }, getSize: function () { return m.dimensions(this.element) }, _resize: function () { var e, t, n = this._root; n && (e = this.element, t = e.children(), n.coord.width = _(e), n.coord.height = v(e), t.css({ width: n.coord.width, height: n.coord.height }), this._resizeItems(n, t)) }, _resizeItems: function (e, t) { var n, i, o, r; if (e.children && e.children.length) for (n = t.children(".k-treemap-wrap").children(), this._layout.compute(e.children, e.coord, { text: this._view.titleSize(e, t) }), r = 0; r < e.children.length; r++)i = e.children[r], o = n.filter("[" + m.attr("uid") + "='" + i.dataItem.uid + "']"), this._view.setItemSize(i, o), this._resizeItems(i, o) }, setOptions: function (e) { var n = e.dataSource; e.dataSource = t, this._originalOptions = y(this._originalOptions, e), this.options = y({}, this._originalOptions), this._setLayout(), this._initTheme(this.options), w.fn._setEvents.call(this, e), n && this.setDataSource(x.create(n)), this.options.autoBind && this.dataSource.fetch() } }), z = b.extend({ createRoot: function (e, t, n) { e.coord = { width: t, height: n, top: 0, left: 0 } }, leaf: function (e) { return !e.children }, layoutChildren: function (e, t) { var n, i, o, r, a = t.width * t.height, s = 0, l = []; for (n = 0; n < e.length; n++)l[n] = parseFloat(e[n].value), s += l[n]; for (n = 0; n < l.length; n++)e[n].area = a * l[n] / s; i = this.layoutHorizontal() ? t.height : t.width, o = [e[0]], r = e.slice(1), this.squarify(r, o, i, t) }, squarify: function (e, t, n, i) { this.computeDim(e, t, n, i) }, computeDim: function (e, n, i, o) { var r, a, s; return e.length + n.length == 1 ? (r = 1 == e.length ? e : n, this.layoutLast(r, i, o), t) : (e.length >= 2 && 0 === n.length && (n = [e[0]], e = e.slice(1)), 0 === e.length ? (n.length > 0 && this.layoutRow(n, i, o), t) : (a = e[0], this.worstAspectRatio(n, i) >= this.worstAspectRatio([a].concat(n), i) ? this.computeDim(e.slice(1), n.concat([a]), i, o) : (s = this.layoutRow(n, i, o), this.computeDim(e, [], s.dim, s)), t)) }, layoutLast: function (e, t, n) { e[0].coord = n }, layoutRow: function (e, t, n) { return this.layoutHorizontal() ? this.layoutV(e, t, n) : this.layoutH(e, t, n) }, orientation: "h", layoutVertical: function () { return "v" === this.orientation }, layoutHorizontal: function () { return "h" === this.orientation }, layoutChange: function () { this.orientation = this.layoutVertical() ? "h" : "v" }, worstAspectRatio: function (e, t) { var n, i, o, r, a; if (!e || 0 === e.length) return I; for (n = 0, i = 0, o = I, r = 0; r < e.length; r++)a = e[r].area, n += a, o = o < a ? o : a, i = i > a ? i : a; return p.max(t * t * i / (n * n), n * n / (t * t * o)) }, compute: function (e, t, n) { if (t.width >= t.height && this.layoutHorizontal() || this.layoutChange(), e && e.length > 0) { var i = { width: t.width, height: t.height - n.text, top: 0, left: 0 }; this.layoutChildren(e, i) } }, layoutV: function (e, t, n) { var i, o, r, a = this._totalArea(e), s = 0; for (t = h(a / t), i = 0; i < e.length; i++)o = h(e[i].area / t), e[i].coord = { height: o, width: t, top: n.top + s, left: n.left }, s += o; return r = { height: n.height, width: n.width - t, top: n.top, left: n.left + t }, r.dim = p.min(r.width, r.height), r.dim != r.height && this.layoutChange(), r }, layoutH: function (e, t, n) { var i, o, r = this._totalArea(e), a = h(r / t), s = n.top, l = 0; for (i = 0; i < e.length; i++)e[i].coord = { height: a, width: h(e[i].area / a), top: s, left: n.left + l }, l += e[i].coord.width; return o = { height: n.height - a, width: n.width, top: n.top + a, left: n.left }, o.dim = p.min(o.width, o.height), o.dim != o.width && this.layoutChange(), o }, _totalArea: function (e) { var t, n = 0; for (t = 0; t < e.length; t++)n += e[t].area; return n } }), B = b.extend({ init: function (t, n) { this.options = y({}, this.options, n), this.treeMap = t, this.element = e(t.element), this.offset = 0 }, titleSize: function (e, t) { var n = t.children(".k-treemap-title"); return n.height() || 0 }, htmlSize: function (e) { var t, n, i = this._getByUid(e.dataItem.uid), o = { text: 0 }; return e.children && (this._clean(i), t = this._getText(e), t && (n = this._createTitle(e), i.append(n), this._compile(n, e.dataItem), o.text = n.height()), i.append(this._createWrap()), this.offset = (_(i) - i.innerWidth()) / 2), o }, _compile: function (e, t) { this.treeMap.angular("compile", function () { return { elements: e, data: [{ dataItem: t }] } }) }, _getByUid: function (e) { return this.element.find(".k-treemap-tile[" + m.attr("uid") + "='" + e + "']") }, render: function (e) { var t, n, i, o, r = this._getByUid(e.dataItem.uid), a = e.children; if (a) for (t = r.find(".k-treemap-wrap"), n = 0; n < a.length; n++)i = a[n], o = this._createLeaf(i), t.append(o), this._compile(o.children(), i.dataItem), this.treeMap.trigger(E, { element: o }) }, createRoot: function (e) { var t = this._createLeaf(e); this.element.append(t), this._compile(t.children(), e.dataItem), this.treeMap.trigger(E, { element: t }) }, _clean: function (e) { this.treeMap.angular("cleanup", function () { return { elements: e.children(":not(.k-treemap-wrap)") } }), e.css("background-color", ""), e.removeClass("k-leaf"), e.removeClass("k-inverse"), e.empty() }, _createLeaf: function (t) { return this._createTile(t).css("background-color", t.color).addClass("k-leaf").toggleClass("k-inverse", this._tileColorBrightness(t) > 180).toggle(0 !== t.value).append(e("
").html(this._getText(t))) }, _createTile: function (t) { var n = e("
"); return this.setItemSize(t, n), i(t.dataItem) && i(t.dataItem.uid) && n.attr(m.attr("uid"), t.dataItem.uid), n }, _itemCoordinates: function (e) { var t = { width: e.coord.width, height: e.coord.height, left: e.coord.left, top: e.coord.top }; return t.width += t.left && this.offset ? 2 * this.offset : this.offset, t.height += t.top ? 2 * this.offset : this.offset, t }, setItemSize: function (e, t) { var n = this._itemCoordinates(e); t.css({ width: n.width, height: n.height, left: n.left, top: n.top }) }, _getText: function (e) { var t = e.text; return this.options.template && (t = this._renderTemplate(e)), t }, _renderTemplate: function (e) { var t = k(this.options.template); return t({ dataItem: e.dataItem, text: e.text }) }, _createTitle: function (t) { return e("
").append(e("
").html(this._getText(t))) }, _createWrap: function () { return e("
") }, _tileColorBrightness: function (e) { return u(e.color) } }), L = b.extend({ createRoot: function (e, t, n, i) { e.coord = { width: t, height: n, top: 0, left: 0 }, e.vertical = i }, init: function (e) { this.vertical = e, this.quotient = e ? 1 : 0 }, compute: function (e, t, n) { var i, o, r; e.length > 0 && (i = t.width, o = t.height, this.vertical ? o -= n.text : i -= n.text, r = { width: i, height: o, top: 0, left: 0 }, this.layoutChildren(e, r)) }, layoutChildren: function (e, t) { var n, i, o = t.width * t.height, r = 0, a = []; for (n = 0; n < e.length; n++)i = e[n], a[n] = parseFloat(e[n].value), r += a[n], i.vertical = this.vertical; for (n = 0; n < a.length; n++)e[n].area = o * a[n] / r; this.sliceAndDice(e, t) }, sliceAndDice: function (e, t) { var n = this._totalArea(e); e[0].level % 2 === this.quotient ? this.layoutHorizontal(e, t, n) : this.layoutVertical(e, t, n) }, layoutHorizontal: function (e, t, n) { var i, o, r, a = 0; for (i = 0; i < e.length; i++)o = e[i], r = o.area / (n / t.width), o.coord = { height: t.height, width: r, top: t.top, left: t.left + a }, a += r }, layoutVertical: function (e, t, n) { var i, o, r, a = 0; for (i = 0; i < e.length; i++)o = e[i], r = o.area / (n / t.height), o.coord = { height: r, width: t.width, top: t.top + a, left: t.left }, a += r }, _totalArea: function (e) { var t, n = 0; for (t = 0; t < e.length; t++)n += e[t].area; return n } }), H = B.extend({ htmlSize: function (e) { var t, n, i = this._getByUid(e.dataItem.uid), o = { text: 0, offset: 0 }; return e.children && (this._clean(i), t = this._getText(e), t && (n = this._createTitle(e), i.append(n), this._compile(n, e.dataItem), o.text = e.vertical ? n.height() : n.width()), i.append(this._createWrap()), this.offset = (_(i) - i.innerWidth()) / 2), o }, titleSize: function (e, t) { var n; return n = e.vertical ? t.children(".k-treemap-title").height() : t.children(".k-treemap-title-vertical").width(), n || 0 }, _createTitle: function (t) { var n; return n = e(t.vertical ? "
" : "
"), n.append(e("
").html(this._getText(t))) } }); S.ui.plugin(P) }(window.kendo.jQuery), window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.dataviz.min", ["kendo.core.min", "kendo.fx.min", "kendo.router.min", "kendo.view.min", "kendo.data.odata.min", "kendo.data.xml.min", "kendo.data.min", "kendo.data.signalr.min", "kendo.binder.min", "kendo.userevents.min", "kendo.draganddrop.min", "kendo.mobile.scroller.min", "kendo.popup.min", "kendo.tooltip.min", "kendo.drawing.min", "kendo.dataviz.core.min", "kendo.dataviz.themes.min", "kendo.dataviz.chart.min", "kendo.dataviz.gauge.min", "kendo.dataviz.barcode.min", "kendo.dataviz.qrcode.min", "kendo.dataviz.stock.min", "kendo.dataviz.sparkline.min", "kendo.dataviz.map.min", "kendo.dataviz.diagram.min", "kendo.dataviz.treemap.min", "kendo.angular.min"], e) }(function () { "bundle all"; return window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.view.min", ["kendo.core.min", "kendo.fx.min", "kendo.mobile.scroller.min", "kendo.view.min"], e) }(function () { return function (e, t) { function n(e) { var t, n, i = e.find(y("popover")), o = s.roles; for (t = 0, n = i.length; t < n; t++)r.initWidget(i[t], {}, o) } function i(e) { r.triggeredByInput(e) || e.preventDefault() } function o(t) { t.each(function () { r.initWidget(e(this), {}, s.roles) }) } var r = window.kendo, a = r.mobile, s = a.ui, l = r.attr, d = s.Widget, c = r.ViewClone, u = "init", h = '
', p = "beforeShow", f = "show", g = "afterShow", m = "beforeHide", v = "transitionEnd", _ = "transitionStart", b = "hide", w = "destroy", k = r.attrValue, y = r.roleSelector, x = r.directiveSelector, C = r.compileMobileDirective, S = d.extend({ init: function (t, n) { d.fn.init.call(this, t, n), this.params = {}, e.extend(this, n), this.transition = this.transition || this.defaultTransition, this._id(), this.options.$angular ? this._overlay() : (this._layout(), this._overlay(), this._scroller(), this._model()) }, events: [u, p, f, g, m, b, w, _, v], options: { name: "View", title: "", layout: null, getLayout: e.noop, reload: !1, transition: "", defaultTransition: "", useNativeScrolling: !1, stretch: !1, zoom: !1, model: null, modelScope: window, scroller: {}, initWidgets: !0 }, enable: function (e) { t === e && (e = !0), e ? this.overlay.hide() : this.overlay.show() }, destroy: function () { this.layout && this.layout.detach(this), this.trigger(w), d.fn.destroy.call(this), this.scroller && this.scroller.destroy(), this.options.$angular && this.element.scope().$destroy(), r.destroy(this.element) }, purge: function () { this.destroy(), this.element.remove() }, triggerBeforeShow: function () { return !this.trigger(p, { view: this }) }, triggerBeforeHide: function () { return !this.trigger(m, { view: this }) }, showStart: function () { var e = this.element; e.css("display", ""), this.inited ? this._invokeNgController() : (this.inited = !0, this.trigger(u, { view: this })), this.layout && this.layout.attach(this), this._padIfNativeScrolling(), this.trigger(f, { view: this }), r.resize(e) }, showEnd: function () { this.trigger(g, { view: this }), this._padIfNativeScrolling() }, hideEnd: function () { var e = this; e.element.hide(), e.trigger(b, { view: e }), e.layout && e.layout.trigger(b, { view: e, layout: e.layout }) }, beforeTransition: function (e) { this.trigger(_, { type: e }) }, afterTransition: function (e) { this.trigger(v, { type: e }) }, _padIfNativeScrolling: function () { if (a.appLevelNativeScrolling()) { var e = r.support.mobileOS && r.support.mobileOS.android, t = a.application.skin() || "", n = a.application.os.android || t.indexOf("android") > -1, i = "flat" === t || t.indexOf("material") > -1, o = !e && !n || i ? "header" : "footer", s = !e && !n || i ? "footer" : "header"; this.content.css({ paddingTop: this[o].height(), paddingBottom: this[s].height() }) } }, contentElement: function () { var e = this; return e.options.stretch ? e.content : e.scrollerContent }, clone: function () { return new c(this) }, _scroller: function () { var t = this; a.appLevelNativeScrolling() || (t.options.stretch ? t.content.addClass("km-stretched-view") : (t.content.kendoMobileScroller(e.extend(t.options.scroller, { zoom: t.options.zoom, useNative: t.options.useNativeScrolling })), t.scroller = t.content.data("kendoMobileScroller"), t.scrollerContent = t.scroller.scrollElement), r.support.kineticScrollNeeded && (e(t.element).on("touchmove", ".km-header", i), t.options.useNativeScrolling || t.options.stretch || e(t.element).on("touchmove", ".km-content", i))) }, _model: function () { var e = this, t = e.element, i = e.options.model; "string" == typeof i && (i = r.getter(i)(e.options.modelScope)), e.model = i, n(t), e.element.css("display", ""), e.options.initWidgets && (i ? r.bind(t, i, s, r.ui, r.dataviz.ui) : a.init(t.children())), e.element.css("display", "none") }, _id: function () { var e = this.element, t = e.attr("id") || ""; this.id = k(e, "url") || "#" + t, "#" == this.id && (this.id = r.guid(), e.attr("id", this.id)) }, _layout: function () { var e = y("content"), t = this.element; t.addClass("km-view"), this.header = t.children(y("header")).addClass("km-header"), this.footer = t.children(y("footer")).addClass("km-footer"), t.children(e)[0] || t.wrapInner("
'), this.content = t.children(y("content")).addClass("km-content"), this.element.prepend(this.header).append(this.footer), this.layout = this.options.getLayout(this.layout), this.layout && this.layout.setup(this) }, _overlay: function () { this.overlay = e(h).appendTo(this.element) }, _invokeNgController: function () { var t, n, i; this.options.$angular && (t = this.element.controller(), n = this.options.$angular[0], t && (i = e.proxy(this, "_callController", t, n), /^\$(digest|apply)$/.test(n.$$phase) ? i() : n.$apply(i))) }, _callController: function (e, t) { this.element.injector().invoke(e.constructor, e, { $scope: t }) } }), T = d.extend({ init: function (e, t) { d.fn.init.call(this, e, t), e = this.element, this.header = e.children(this._locate("header")).addClass("km-header"), this.footer = e.children(this._locate("footer")).addClass("km-footer"), this.elements = this.header.add(this.footer), n(e), this.options.$angular || r.mobile.init(this.element.children()), this.element.detach(), this.trigger(u, { layout: this }) }, _locate: function (e) { return this.options.$angular ? x(e) : y(e) }, options: { name: "Layout", id: null, platform: null }, events: [u, f, b], setup: function (e) { e.header[0] || (e.header = this.header), e.footer[0] || (e.footer = this.footer) }, detach: function (e) { var t = this; e.header === t.header && t.header[0] && e.element.prepend(t.header.detach()[0].cloneNode(!0)), e.footer === t.footer && t.footer.length && e.element.append(t.footer.detach()[0].cloneNode(!0)) }, attach: function (e) { var t = this, n = t.currentView; n && t.detach(n), e.header === t.header && (t.header.detach(), e.element.children(y("header")).remove(), e.element.prepend(t.header)), e.footer === t.footer && (t.footer.detach(), e.element.children(y("footer")).remove(), e.element.append(t.footer)), t.trigger(f, { layout: t, view: e }), t.currentView = e } }), D = r.Observable, A = /]*>(([\u000a\u000d\u2028\u2029]|.)*)<\/body>/i, E = "loadStart", I = "loadComplete", M = "showStart", R = "sameViewRequested", F = "viewShow", P = "viewTypeDetermined", z = "after", B = D.extend({ init: function (t) { var n, i, a, s, l = this; if (D.fn.init.call(l), e.extend(l, t), l.sandbox = e("
"), a = l.container, n = l._hideViews(a), l.rootView = n.first(), !l.rootView[0] && t.rootNeeded) throw i = a[0] == r.mobile.application.element[0] ? 'Your kendo mobile application element does not contain any direct child elements with data-role="view" attribute set. Make sure that you instantiate the mobile application using the correct container.' : 'Your pane element does not contain any direct child elements with data-role="view" attribute set.', Error(i); l.layouts = {}, l.viewContainer = new r.ViewContainer(l.container), l.viewContainer.bind("accepted", function (e) { e.view.params = l.params }), l.viewContainer.bind("complete", function (e) { l.trigger(F, { view: e.view }) }), l.viewContainer.bind(z, function () { l.trigger(z) }), this.getLayoutProxy = e.proxy(this, "_getLayout"), l._setupLayouts(a), s = a.children(l._locate("modalview drawer")), l.$angular ? (l.$angular[0].viewOptions = { defaultTransition: l.transition, loader: l.loader, container: l.container, getLayout: l.getLayoutProxy }, s.each(function (n, i) { C(e(i), t.$angular[0]) })) : o(s), this.bind(this.events, t) }, events: [M, z, F, E, I, R, P], destroy: function () { r.destroy(this.container); for (var e in this.layouts) this.layouts[e].destroy() }, view: function () { return this.viewContainer.view }, showView: function (e, t, n) { if (e = e.replace(RegExp("^" + this.remoteViewURLPrefix), ""), "" === e && this.remoteViewURLPrefix && (e = "/"), e.replace(/^#/, "") === this.url) return this.trigger(R), !1; this.trigger(M); var i = this, o = function (n) { return i.viewContainer.show(n, t, e) }, a = i._findViewElement(e), s = r.widgetInstance(a); return i.url = e.replace(/^#/, ""), i.params = n, s && s.reload && (s.purge(), a = []), this.trigger(P, { remote: 0 === a.length, url: e }), a[0] ? (s || (s = i._createView(a)), o(s)) : (this.serverNavigation ? location.href = e : i._loadView(e, o), !0) }, append: function (e, t) { var n, i, r, a = this.sandbox, s = (t || "").split("?")[0], d = this.container; return A.test(e) && (e = RegExp.$1), a[0].innerHTML = e, d.append(a.children("script, style")), n = this._hideViews(a), r = n.first(), r.length || (n = r = a.wrapInner("
").children()), s && r.hide().attr(l("url"), s), this._setupLayouts(a), i = a.children(this._locate("modalview drawer")), d.append(a.children(this._locate("layout modalview drawer")).add(n)), o(i), this._createView(r) }, _locate: function (e) { return this.$angular ? x(e) : y(e) }, _findViewElement: function (e) { var t, n = e.split("?")[0]; return n ? (t = this.container.children("[" + l("url") + "='" + n + "']"), t[0] || n.indexOf("/") !== -1 || (t = this.container.children("#" === n.charAt(0) ? n : "#" + n)), t) : this.rootView }, _createView: function (e) { return this.$angular ? C(e, this.$angular[0]) : r.initWidget(e, { defaultTransition: this.transition, loader: this.loader, container: this.container, getLayout: this.getLayoutProxy, modelScope: this.modelScope, reload: k(e, "reload") }, s.roles) }, _getLayout: function (e) { return "" === e ? null : e ? this.layouts[e] : this.layouts[this.layout] }, _loadView: function (t, n) { this._xhr && this._xhr.abort(), this.trigger(E), this._xhr = e.get(r.absoluteURL(t, this.remoteViewURLPrefix), "html").always(e.proxy(this, "_xhrComplete", n, t)) }, _xhrComplete: function (e, t, n) { var i = !0; if ("object" == typeof n && 0 === n.status) { if (!(n.responseText && n.responseText.length > 0)) return; i = !0, n = n.responseText } this.trigger(I), i && e(this.append(n, t)) }, _hideViews: function (e) { return e.children(this._locate("view splitview")).hide() }, _setupLayouts: function (t) { var n, i = this; t.children(i._locate("layout")).each(function () { n = i.$angular ? C(e(this), i.$angular[0]) : r.initWidget(e(this), {}, s.roles); var t = n.options.platform; t && t !== a.application.os.name ? n.destroy() : i.layouts[n.options.id] = n }) } }); r.mobile.ViewEngine = B, s.plugin(S), s.plugin(T) }(window.kendo.jQuery), window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.loader.min", ["kendo.core.min"], e) }(function () {
return function (e, t) {
var n = window.kendo, i = n.mobile.ui, o = i.Widget, r = e.map(n.eventMap, function (e) { return e }).join(" ").split(" "), a = o.extend({
init: function (t, n) { var i = this, r = e('
'); o.fn.init.call(i, r, n), i.container = t, i.captureEvents = !1, i._attachCapture(), r.append(i.options.loading).hide().appendTo(t) }, options: { name: "Loader", loading: "
Loading... ", timeout: 100 }, show: function () {
var e = this; clearTimeout(e._loading), e.options.loading !== !1 && (e.captureEvents = !0,
e._loading = setTimeout(function () { e.element.show() }, e.options.timeout))
}, hide: function () { this.captureEvents = !1, clearTimeout(this._loading), this.element.hide() }, changeMessage: function (e) { this.options.loading = e, this.element.find(">h1").html(e) }, transition: function () { this.captureEvents = !0, this.container.css("pointer-events", "none") }, transitionDone: function () { this.captureEvents = !1, this.container.css("pointer-events", "") }, _attachCapture: function () { function e(e) { n.captureEvents && e.preventDefault() } var t, n = this; for (n.captureEvents = !1, t = 0; t < r.length; t++)n.container[0].addEventListener(r[t], e, !0) }
}); i.plugin(a)
}(window.kendo.jQuery), window.kendo
}, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.pane.min", ["kendo.mobile.view.min", "kendo.mobile.loader.min"], e) }(function () { return function (e, t) { var n = window.kendo, i = n.mobile, o = n.roleSelector, r = i.ui, a = r.Widget, s = i.ViewEngine, l = r.View, d = i.ui.Loader, c = "external", u = "href", h = "#!", p = "navigate", f = "viewShow", g = "sameViewRequested", m = n.support.mobileOS, v = m.ios && !m.appMode && m.flatVersion >= 700, _ = /popover|actionsheet|modalview|drawer/, b = "#:back", w = n.attrValue, k = a.extend({ init: function (e, t) { var i = this; a.fn.init.call(i, e, t), t = i.options, e = i.element, e.addClass("km-pane"), i.options.collapsible && e.addClass("km-collapsible-pane"), this.history = [], this.historyCallback = function (e, t, n) { var o = i.transition; return i.transition = null, v && n && (o = "none"), i.viewEngine.showView(e, o, t) }, this._historyNavigate = function (e) { if (e === b) { if (1 === i.history.length) return; i.history.pop(), e = i.history[i.history.length - 1] } else i.history.push(e); i.historyCallback(e, n.parseQueryStringParams(e)) }, this._historyReplace = function (e) { var t = n.parseQueryStringParams(e); i.history[i.history.length - 1] = e, i.historyCallback(e, t) }, i.loader = new d(e, { loading: i.options.loading }), i.viewEngine = new s({ container: e, transition: t.transition, modelScope: t.modelScope, rootNeeded: !t.initial, serverNavigation: t.serverNavigation, remoteViewURLPrefix: t.root || "", layout: t.layout, $angular: t.$angular, loader: i.loader, showStart: function () { i.loader.transition(), i.closeActiveDialogs() }, after: function () { i.loader.transitionDone() }, viewShow: function (e) { i.trigger(f, e) }, loadStart: function () { i.loader.show() }, loadComplete: function () { i.loader.hide() }, sameViewRequested: function () { i.trigger(g) }, viewTypeDetermined: function (e) { e.remote && i.options.serverNavigation || i.trigger(p, { url: e.url }) } }), this._setPortraitWidth(), n.onResize(function () { i._setPortraitWidth() }), i._setupAppLinks() }, closeActiveDialogs: function () { var t = this.element.find(o("actionsheet popover modalview")).filter(":visible"); t.each(function () { n.widgetInstance(e(this), r).close() }) }, navigateToInitial: function () { var e = this.options.initial; return e && this.navigate(e), e }, options: { name: "Pane", portraitWidth: "", transition: "", layout: "", collapsible: !1, initial: null, modelScope: window, loading: "
Loading... " }, events: [p, f, g], append: function (e) { return this.viewEngine.append(e) }, destroy: function () { a.fn.destroy.call(this), this.viewEngine.destroy(), this.userEvents.destroy() }, navigate: function (e, t) { e instanceof l && (e = e.id), this.transition = t, this._historyNavigate(e) }, replace: function (e, t) { e instanceof l && (e = e.id), this.transition = t, this._historyReplace(e) }, bindToRouter: function (e) { var t = this, i = this.history, o = this.viewEngine; e.bind("init", function (t) { var r, a = t.url, s = e.pushState ? a : "/"; o.rootView.attr(n.attr("url"), s), r = i.length, "/" === a && r && (e.navigate(i[r - 1], !0), t.preventDefault()) }), e.bind("routeMissing", function (e) { t.historyCallback(e.url, e.params, e.backButtonPressed) || e.preventDefault() }), e.bind("same", function () { t.trigger(g) }), t._historyNavigate = function (t) { e.navigate(t) }, t._historyReplace = function (t) { e.replace(t) } }, hideLoading: function () { this.loader.hide() }, showLoading: function () { this.loader.show() }, changeLoadingMessage: function (e) { this.loader.changeMessage(e) }, view: function () { return this.viewEngine.view() }, _setPortraitWidth: function () { var e, t = this.options.portraitWidth; t && (e = n.mobile.application.element.is(".km-vertical") ? t : "auto", this.element.css("width", e)) }, _setupAppLinks: function () { var t = this, i = "tab", r = "[data-" + n.ns + "navigate-on-press]", a = e.map(["button", "backbutton", "detailbutton", "listview-link"], function (e) { return o(e) + ":not(" + r + ")" }).join(","); this.element.handler(this).on("down", o(i) + "," + r, "_mouseup").on("click", o(i) + "," + a + "," + r, "_appLinkClick"), this.userEvents = new n.UserEvents(this.element, { fastTap: !0, filter: a, tap: function (e) { e.event.currentTarget = e.touch.currentTarget, t._mouseup(e.event) } }), this.element.css("-ms-touch-action", "") }, _appLinkClick: function (t) { var n = e(t.currentTarget).attr("href"), i = n && "#" !== n[0] && this.options.serverNavigation; i || w(e(t.currentTarget), "rel") == c || t.preventDefault() }, _mouseup: function (o) { if (!(o.which > 1 || o.isDefaultPrevented())) { var a = this, s = e(o.currentTarget), l = w(s, "transition"), d = w(s, "rel") || "", p = w(s, "target"), f = s.attr(u), g = v && 0 === s[0].offsetHeight, m = f && "#" !== f[0] && this.options.serverNavigation; g || m || d === c || t === f || f === h || (s.attr(u, h), setTimeout(function () { s.attr(u, f) }), d.match(_) ? (n.widgetInstance(e(f), r).openFor(s), "actionsheet" !== d && "drawer" !== d || o.stopPropagation()) : ("_top" === p ? a = i.application.pane : p && (a = e("#" + p).data("kendoMobilePane")), a.navigate(f, l)), o.preventDefault()) } } }); k.wrap = function (e) { e.is(o("view")) || (e = e.wrap("
').parent()); var t = e.wrap('
').parent(), i = new k(t); return i.navigate(""), i }, r.plugin(k) }(window.kendo.jQuery), window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.popover.min", ["kendo.popup.min", "kendo.mobile.pane.min"], e) }(function () { return function (e, t) { var n = window.kendo, i = n.mobile, o = i.ui, r = "hide", a = "open", s = "close", l = '', d = '', c = '', u = "km-up km-down km-left km-right", h = o.Widget, p = { down: { origin: "bottom center", position: "top center" }, up: { origin: "top center", position: "bottom center" }, left: { origin: "center left", position: "center right", collision: "fit flip" }, right: { origin: "center right", position: "center left", collision: "fit flip" } }, f = { animation: { open: { effects: "fade:in", duration: 0 }, close: { effects: "fade:out", duration: 400 } } }, g = { horizontal: { offset: "top", size: "height" }, vertical: { offset: "left", size: "width" } }, m = { up: "down", down: "up", left: "right", right: "left" }, v = h.extend({ init: function (t, i) { var o, a, s = this, u = t.closest(".km-modalview-wrapper"), m = t.closest(".km-root").children(".km-pane").first(), v = u[0] ? u : m; i.viewport ? m = i.viewport : m[0] || (m = window), i.container ? v = i.container : v[0] || (v = document.body), o = { viewport: m, copyAnchorStyles: !1, autosize: !0, open: function () { s.overlay.show() }, activate: e.proxy(s._activate, s), deactivate: function () { s.overlay.hide(), s._apiCall || s.trigger(r), s._apiCall = !1 } }, h.fn.init.call(s, t, i), t = s.element, i = s.options, t.wrap(l).addClass("km-popup").show(), a = s.options.direction.match(/left|right/) ? "horizontal" : "vertical", s.dimensions = g[a], s.wrapper = t.parent().css({ width: i.width, height: i.height }).addClass("km-popup-wrapper km-" + i.direction).hide(), s.arrow = e(d).prependTo(s.wrapper).hide(), s.overlay = e(c).appendTo(v).hide(), o.appendTo = s.overlay, i.className && s.overlay.addClass(i.className), s.popup = new n.ui.Popup(s.wrapper, e.extend(!0, o, f, p[i.direction])) }, options: { name: "Popup", width: 240, height: "", direction: "down", container: null, viewport: null }, events: [r], show: function (t) { this.popup.options.anchor = e(t), this.popup.open() }, hide: function () { this._apiCall = !0, this.popup.close() }, destroy: function () { h.fn.destroy.call(this), this.popup.destroy(), this.overlay.remove() }, target: function () { return this.popup.options.anchor }, _activate: function () { var t = this, n = t.options.direction, i = t.dimensions, o = i.offset, r = t.popup, a = r.options.anchor, s = e(a).offset(), l = e(r.element).offset(), d = r.flipped ? m[n] : n, c = 2 * t.arrow[i.size](), h = t.element[i.size]() - t.arrow[i.size](), p = e(a)[i.size](), f = s[o] - l[o] + p / 2; f < c && (f = c), f > h && (f = h), t.wrapper.removeClass(u).addClass("km-" + d), t.arrow.css(o, f).show() } }), _ = h.extend({ init: function (t, i) { var r, a = this; a.initialOpen = !1, h.fn.init.call(a, t, i), r = e.extend({ className: "km-popover-root", hide: function () { a.trigger(s) } }, this.options.popup), a.popup = new v(a.element, r), a.popup.overlay.on("move", function (e) { e.target == a.popup.overlay[0] && e.preventDefault() }), a.pane = new o.Pane(a.element, e.extend(this.options.pane, { $angular: this.options.$angular })), n.notify(a, o) }, options: { name: "PopOver", popup: {}, pane: {} }, events: [a, s], open: function (e) { this.popup.show(e), this.initialOpen ? this.pane.view()._invokeNgController() : (this.pane.navigateToInitial() || this.pane.navigate(""), this.popup.popup._position(), this.initialOpen = !0) }, openFor: function (e) { this.open(e), this.trigger(a, { target: this.popup.target() }) }, close: function () { this.popup.hide() }, destroy: function () { h.fn.destroy.call(this), this.pane.destroy(), this.popup.destroy(), n.destroy(this.element) } }); o.plugin(v), o.plugin(_) }(window.kendo.jQuery), window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.shim.min", ["kendo.popup.min"], e) }(function () { return function (e, t) { var n = window.kendo, i = n.mobile.ui, o = n.ui.Popup, r = '
', a = "hide", s = i.Widget, l = s.extend({ init: function (t, i) { var l = this, d = n.mobile.application, c = n.support.mobileOS, u = d ? d.os.name : c ? c.name : "ios", h = "ios" === u || "wp" === u || !!d && d.os.skin, p = "blackberry" === u, f = i.align || (h ? "bottom center" : p ? "center right" : "center center"), g = i.position || (h ? "bottom center" : p ? "center right" : "center center"), m = i.effect || (h ? "slideIn:up" : p ? "slideIn:left" : "fade:in"), v = e(r).handler(l).hide(); s.fn.init.call(l, t, i), l.shim = v, t = l.element, i = l.options, i.className && l.shim.addClass(i.className), i.modal || l.shim.on("down", "_hide"), (d ? d.element : e(document.body)).append(v), l.popup = new o(l.element, { anchor: v, modal: !0, appendTo: v, origin: f, position: g, animation: { open: { effects: m, duration: i.duration }, close: { duration: i.duration } }, close: function (e) { var t = !1; l._apiCall || (t = l.trigger(a)), t && e.preventDefault(), l._apiCall = !1 }, deactivate: function () { v.hide() }, open: function () { v.show() } }), n.notify(l) }, events: [a], options: { name: "Shim", modal: !1, align: t, position: t, effect: t, duration: 200 }, show: function () { this.popup.open() }, hide: function () { this._apiCall = !0, this.popup.close() }, destroy: function () { s.fn.destroy.call(this), this.shim.kendoDestroy(), this.popup.destroy(), this.shim.remove() }, _hide: function (t) { t && e.contains(this.shim.children().children(".k-popup")[0], t.target) || this.popup.close() } }); i.plugin(l) }(window.kendo.jQuery), window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.modalview.min", ["kendo.mobile.shim.min", "kendo.mobile.view.min"], e) }(function () { return function (e, t) { var n = window.kendo, i = n.mobile.ui, o = i.Shim, r = i.Widget, a = "beforeOpen", s = "open", l = "close", d = "init", c = '
', u = i.View.extend({ init: function (e, t) { var n = this; r.fn.init.call(n, e, t), n._id(), n._wrap(), n._shim(), this.options.$angular || (n._layout(), n._scroller(), n._model()), n.element.css("display", ""), n.trigger(d) }, events: [d, a, s, l], options: { name: "ModalView", modal: !0, width: null, height: null }, destroy: function () { r.fn.destroy.call(this), this.shim.destroy() }, open: function (t) { var n = this; n.target = e(t), n.shim.show(), n._invokeNgController(), n.trigger("show", { view: n }) }, openFor: function (e) { this.trigger(a, { target: e }) || (this.open(e), this.trigger(s, { target: e })) }, close: function () { this.element.is(":visible") && !this.trigger(l) && this.shim.hide() }, _wrap: function () { var e, t, n = this, i = n.element, o = n.options; e = i[0].style.width || "auto", t = i[0].style.height || "auto", i.addClass("km-modalview").wrap(c), n.wrapper = i.parent().css({ width: o.width || e || 300, height: o.height || t || 300 }).addClass("auto" == t ? " km-auto-height" : ""), i.css({ width: "", height: "" }) }, _shim: function () { var e = this; e.shim = new o(e.wrapper, { modal: e.options.modal, position: "center center", align: "center center", effect: "fade:in", className: "km-modalview-root", hide: function (t) { e.trigger(l) && t.preventDefault() } }) } }); i.plugin(u) }(window.kendo.jQuery), window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.drawer.min", ["kendo.mobile.view.min", "kendo.userevents.min"], e) }(function () { return function (e, t) { var n = window.kendo, i = n.mobile, o = n.support.mobileOS, r = n.effects.Transition, a = n.roleSelector, s = "x", l = i.ui, d = !(o.ios && 7 == o.majorVersion && !o.appMode), c = "beforeShow", u = "init", h = "show", p = "hide", f = "afterHide", g = { enable: e.noop }, m = l.View.extend({ init: function (t, o) { var r, s, l, c, h; if (e(t).parent().prepend(t), i.ui.Widget.fn.init.call(this, t, o), this.options.$angular || (this._layout(), this._scroller()), this._model(), r = this.element.closest(a("pane")).data("kendoMobilePane")) this.pane = r, this.pane.bind("viewShow", function (e) { c._viewShow(e) }), this.pane.bind("sameViewRequested", function () { c.hide() }), s = this.userEvents = new n.UserEvents(r.element, { fastTap: !0, filter: a("view splitview"), allowSelection: !0 }); else { if (this.currentView = g, l = e(this.options.container), !l) throw Error("The drawer needs a container configuration option set."); s = this.userEvents = new n.UserEvents(l, { fastTap: !0, allowSelection: !0 }), this._attachTransition(l) } c = this, h = function (e) { c.visible && (c.hide(), e.preventDefault()) }, this.options.swipeToOpen && d ? (s.bind("press", function () { c.transition.cancel() }), s.bind("start", function (e) { c._start(e) }), s.bind("move", function (e) { c._update(e) }), s.bind("end", function (e) { c._end(e) }), s.bind("tap", h)) : s.bind("press", h), this.leftPositioned = "left" === this.options.position, this.visible = !1, this.element.hide().addClass("km-drawer").addClass(this.leftPositioned ? "km-left-drawer" : "km-right-drawer"), this.trigger(u) }, options: { name: "Drawer", position: "left", views: [], swipeToOpenViews: [], swipeToOpen: !0, title: "", container: null }, events: [c, p, f, u, h], show: function () { this._activate() && this._show() }, hide: function () { this.currentView && (this.currentView.enable(), m.current = null, this._moveViewTo(0), this.trigger(p, { view: this })) }, openFor: function () { this.visible ? this.hide() : this.show() }, destroy: function () { l.View.fn.destroy.call(this), this.userEvents.destroy() }, _activate: function () { if (this.visible) return !0; var e = this._currentViewIncludedIn(this.options.views); return !(!e || this.trigger(c, { view: this })) && (this._setAsCurrent(), this.element.show(), this.trigger(h, { view: this }), this._invokeNgController(), !0) }, _currentViewIncludedIn: function (t) { if (!this.pane || !t.length) return !0; var n = this.pane.view(); return e.inArray(n.id.replace("#", ""), t) > -1 || e.inArray(n.element.attr("id"), t) > -1 }, _show: function () { this.currentView.enable(!1), this.visible = !0; var e = this.element.width(); this.leftPositioned || (e = -e), this._moveViewTo(e) }, _setAsCurrent: function () { m.last !== this && (m.last && m.last.element.hide(), this.element.show()), m.last = this, m.current = this }, _moveViewTo: function (e) { this.userEvents.cancel(), this.transition.moveTo({ location: e, duration: 400, ease: r.easeOutExpo }) }, _viewShow: function (e) { return this.currentView && this.currentView.enable(), this.currentView === e.view ? (this.hide(), t) : (this.currentView = e.view, this._attachTransition(e.view.element), t) }, _attachTransition: function (e) { var t = this, i = this.movable, o = i && i.x; this.transition && (this.transition.cancel(), this.movable.moveAxis("x", 0)), i = this.movable = new n.ui.Movable(e), this.transition = new r({ axis: s, movable: this.movable, onEnd: function () { 0 === i[s] && (e[0].style.cssText = "", t.element.hide(), t.trigger(f), t.visible = !1) } }), o && (e.addClass("k-fx-hidden"), n.animationFrame(function () { e.removeClass("k-fx-hidden"), t.movable.moveAxis(s, o), t.hide() })) }, _start: function (e) { var i, o, r, a, s, l = e.sender; return Math.abs(e.x.velocity) < Math.abs(e.y.velocity) || n.triggeredByInput(e.event) || !this._currentViewIncludedIn(this.options.swipeToOpenViews) ? (l.cancel(), t) : (i = this.leftPositioned, o = this.visible, r = i && o || !i && !m.current, a = !i && o || i && !m.current, s = e.x.velocity < 0, (r && s || a && !s) && this._activate() ? (l.capture(), t) : (l.cancel(), t)) }, _update: function (e) { var t, n = this.movable, i = n.x + e.x.delta; t = this.leftPositioned ? Math.min(Math.max(0, i), this.element.width()) : Math.max(Math.min(0, i), -this.element.width()), this.movable.moveAxis(s, t), e.event.preventDefault(), e.event.stopPropagation() }, _end: function (e) { var t, n = e.x.velocity, i = Math.abs(this.movable.x) > this.element.width() / 2, o = .8; t = this.leftPositioned ? n > -o && (n > o || i) : n < o && (n < -o || i), t ? this._show() : this.hide() } }); l.plugin(m) }(window.kendo.jQuery), window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.splitview.min", ["kendo.mobile.pane.min"], e) }(function () { return function (e, t) { var n = window.kendo, i = n.mobile.ui, o = i.Widget, r = "
", a = i.View, s = a.extend({ init: function (t, a) { var s, l, d = this; o.fn.init.call(d, t, a), t = d.element, e.extend(d, a), d._id(), d.options.$angular ? d._overlay() : (d._layout(), d._overlay()), d._style(), l = t.children(d._locate("modalview")), d.options.$angular ? l.each(function (t, i) { n.compileMobileDirective(e(i), a.$angular[0]) }) : n.mobile.init(l), d.panes = [], d._paramsHistory = [], d.options.$angular ? (d.element.children(n.directiveSelector("pane")).each(function () { s = n.compileMobileDirective(e(this), a.$angular[0]), d.panes.push(s) }), d.element.children(n.directiveSelector("header footer")).each(function () { n.compileMobileDirective(e(this), a.$angular[0]) })) : d.content.children(n.roleSelector("pane")).each(function () { s = n.initWidget(this, {}, i.roles), d.panes.push(s) }), d.expandedPaneShim = e(r).appendTo(d.element), d._shimUserEvents = new n.UserEvents(d.expandedPaneShim, { fastTap: !0, tap: function () { d.collapsePanes() } }) }, _locate: function (e) { return this.options.$angular ? n.directiveSelector(e) : n.roleSelector(e) }, options: { name: "SplitView", style: "horizontal" }, expandPanes: function () { this.element.addClass("km-expanded-splitview") }, collapsePanes: function () { this.element.removeClass("km-expanded-splitview") }, _layout: function () { var e = this, t = e.element; e.transition = n.attrValue(t, "transition"), n.mobile.ui.View.prototype._layout.call(this), n.mobile.init(this.header.add(this.footer)), e.element.addClass("km-splitview"), e.content.addClass("km-split-content") }, _style: function () { var t, n = this.options.style, i = this.element; n && (t = n.split(" "), e.each(t, function () { i.addClass("km-split-" + this) })) }, showStart: function () { var t = this; t.element.css("display", ""), t.inited ? this._invokeNgController() : (t.inited = !0, e.each(t.panes, function () { this.options.initial ? this.navigateToInitial() : this.navigate("") }), t.trigger("init", { view: t })), t.trigger("show", { view: t }) } }); i.plugin(s) }(window.kendo.jQuery), window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.application.min", ["kendo.mobile.pane.min", "kendo.router.min"], e) }(function () { return function (e, t) { function n(e, t) { var n = []; return f && n.push("km-on-" + f.name), n.push(e.skin ? "km-" + e.skin : "ios" == e.name && e.majorVersion > 6 ? "km-ios7" : "km-" + e.name), ("ios" == e.name && e.majorVersion < 7 || "ios" != e.name) && n.push("km-" + e.name + e.majorVersion), n.push("km-" + e.majorVersion), n.push("km-m" + (e.minorVersion ? e.minorVersion[0] : 0)), e.variant && (e.skin && e.skin === e.name || !e.skin || e.setDefaultPlatform === !1) && n.push("km-" + (e.skin ? e.skin : e.name) + "-" + e.variant), e.cordova && n.push("km-cordova"), n.push(e.appMode ? "km-app" : "km-web"), t && t.statusBarStyle && n.push("km-" + t.statusBarStyle + "-status-bar"), n.join(" ") } function i(t) { return "km-wp-" + (t.noVariantSet ? 0 === parseInt(e("
").css("background-color").split(",")[1], 10) ? "dark" : "light" : t.variant + " km-wp-" + t.variant + "-force") } function o(e) { return f.wp ? "-kendo-landscape" == e.css("animation-name") : Math.abs(window.orientation) / 90 == 1 } function r(e) { return o(e) ? k : v } function a(e) { e.parent().addBack().css("min-height", window.innerHeight) } function s() { e("meta[name=viewport]").remove(), z.append(x({ height: ", width=device-width" + (o() ? ", height=" + window.innerHeight + "px" : c.mobileOS.flatVersion >= 600 && c.mobileOS.flatVersion < 700 ? ", height=" + window.innerWidth + "px" : ", height=device-height") })) } var l = window.kendo, d = l.mobile, c = l.support, u = d.ui.Widget, h = d.ui.Pane, p = "ios7", f = c.mobileOS, g = "blackberry" == f.device && f.flatVersion >= 600 && f.flatVersion < 1e3 && f.appMode, m = .93, v = "km-vertical", _ = "chrome" === f.browser, b = f.ios && f.flatVersion >= 700 && f.flatVersion < 800 && (f.appMode || _), w = Math.abs(window.orientation) / 90 == 1, k = "km-horizontal", y = { ios7: { ios: !0, browser: "default", device: "iphone", flatVersion: "700", majorVersion: "7", minorVersion: "0.0", name: "ios", tablet: !1 }, ios: { ios: !0, browser: "default", device: "iphone", flatVersion: "612", majorVersion: "6", minorVersion: "1.2", name: "ios", tablet: !1 }, android: { android: !0, browser: "default", device: "android", flatVersion: "442", majorVersion: "4", minorVersion: "4.2", name: "android", tablet: !1 }, blackberry: { blackberry: !0, browser: "default", device: "blackberry", flatVersion: "710", majorVersion: "7", minorVersion: "1.0", name: "blackberry", tablet: !1 }, meego: { meego: !0, browser: "default", device: "meego", flatVersion: "850", majorVersion: "8", minorVersion: "5.0", name: "meego", tablet: !1 }, wp: { wp: !0, browser: "default", device: "wp", flatVersion: "800", majorVersion: "8", minorVersion: "0.0", name: "wp", tablet: !1 } }, x = l.template('
', { usedWithBlock: !1 }), C = l.template('
', { usedWithBlock: !1 }), S = l.template("", { usedWithBlock: !1 }), T = f.android && "chrome" != f.browser || f.blackberry, D = l.template('
', { usedWithBlock: !1 }), A = ("iphone" == f.device || "ipod" == f.device) && f.majorVersion < 7, E = ("iphone" == f.device || "ipod" == f.device) && f.majorVersion >= 7, I = E ? "none" : null, M = "mobilesafari" == f.browser ? 60 : 0, R = 20, F = e(window), P = window.screen, z = e("head"), B = "init", L = e.proxy, H = u.extend({ init: function (t, n) { d.application = this, e(e.proxy(this, "bootstrap", t, n)) }, bootstrap: function (t, n) { var i, o, r; t = e(t), t[0] || (t = e(document.body)), u.fn.init.call(this, t, n), this.element.removeAttr("data-" + l.ns + "role"), this._setupPlatform(), this._attachMeta(), this._setupElementClass(), this._attachHideBarHandlers(), i = e.extend({}, this.options), delete i.name, o = this, r = function () { o.pane = new h(o.element, i), o.pane.navigateToInitial(), o.options.updateDocumentTitle && o._setupDocumentTitle(), o._startHistory(), o.trigger(B) }, this.options.$angular ? setTimeout(r) : r() }, options: { name: "Application", hideAddressBar: !0, browserHistory: !0, historyTransition: I, modelScope: window, statusBarStyle: "black", transition: "", retina: !1, platform: null, skin: null, updateDocumentTitle: !0, useNativeScrolling: !1 }, events: [B], navigate: function (e, t) { this.pane.navigate(e, t) }, replace: function (e, t) { this.pane.replace(e, t) }, scroller: function () { return this.view().scroller }, hideLoading: function () { if (!this.pane) throw Error("The mobile application instance is not fully instantiated. Please consider activating loading in the application init event handler."); this.pane.hideLoading() }, showLoading: function () { if (!this.pane) throw Error("The mobile application instance is not fully instantiated. Please consider activating loading in the application init event handler."); this.pane.showLoading() }, changeLoadingMessage: function (e) { if (!this.pane) throw Error("The mobile application instance is not fully instantiated. Please consider changing the message in the application init event handler."); this.pane.changeLoadingMessage(e) }, view: function () { return this.pane.view() }, skin: function (e) { var t = this; return arguments.length ? (t.options.skin = e || "", t.element[0].className = "km-pane", t._setupPlatform(), t._setupElementClass(), t.options.skin) : t.options.skin }, destroy: function () { u.fn.destroy.call(this), this.pane.destroy(), this.options.browserHistory && this.router.destroy() }, _setupPlatform: function () { var t = this, o = t.options.platform, r = t.options.skin, a = [], s = f || y[p]; o && (s.setDefaultPlatform = !0, "string" == typeof o ? (a = o.split("-"), s = e.extend({ variant: a[1] }, s, y[a[0]])) : s = o), r && (a = r.split("-"), f || (s.setDefaultPlatform = !1), s = e.extend({}, s, { skin: a[0], variant: a[1] })), s.variant || (s.noVariantSet = !0, s.variant = "dark"), t.os = s, t.osCssClass = n(t.os, t.options), "wp" == s.name && (t.refreshBackgroundColorProxy || (t.refreshBackgroundColorProxy = e.proxy(function () { (t.os.variant && t.os.skin && t.os.skin === t.os.name || !t.os.skin) && t.element.removeClass("km-wp-dark km-wp-light km-wp-dark-force km-wp-light-force").addClass(i(t.os)) }, t)), e(document).off("visibilitychange", t.refreshBackgroundColorProxy), e(document).off("resume", t.refreshBackgroundColorProxy), s.skin || (t.element.parent().css("overflow", "hidden"), e(document).on("visibilitychange", t.refreshBackgroundColorProxy), e(document).on("resume", t.refreshBackgroundColorProxy), t.refreshBackgroundColorProxy())) }, _startHistory: function () { this.options.browserHistory ? (this.router = new l.Router({ pushState: this.options.pushState, root: this.options.root, hashBang: this.options.hashBang }), this.pane.bindToRouter(this.router), this.router.start()) : this.options.initial || this.pane.navigate("") }, _resizeToScreenHeight: function () { var t, n = e("meta[name=apple-mobile-web-app-status-bar-style]").attr("content").match(/black-translucent|hidden/), i = this.element; t = _ ? window.innerHeight : o(i) ? n ? w ? P.availWidth + R : P.availWidth : w ? P.availWidth : P.availWidth - R : n ? w ? P.availHeight : P.availHeight + R : w ? P.availHeight - R : P.availHeight, i.height(t) }, _setupElementClass: function () { var t, n = this, i = n.element; i.parent().addClass("km-root km-" + (n.os.tablet ? "tablet" : "phone")), i.addClass(n.osCssClass + " " + r(i)), this.options.useNativeScrolling && i.parent().addClass("km-native-scrolling"), _ && i.addClass("km-ios-chrome"), c.wpDevicePixelRatio && i.parent().css("font-size", c.wpDevicePixelRatio + "em"), this.options.retina && (i.parent().addClass("km-retina"), i.parent().css("font-size", c.devicePixelRatio * m + "em")), g && s(), n.options.useNativeScrolling ? i.parent().addClass("km-native-scrolling") : T && (t = (screen.availWidth > screen.availHeight ? screen.availWidth : screen.availHeight) + 200, e(S({ width: t, height: t })).appendTo(z)), b && n._resizeToScreenHeight(), l.onResize(function () { i.removeClass("km-horizontal km-vertical").addClass(r(i)), n.options.useNativeScrolling && a(i), b && n._resizeToScreenHeight(), g && s(), l.resize(i) }) }, _clearExistingMeta: function () { z.find("meta").filter("[name|='apple-mobile-web-app'],[name|='msapplication-tap'],[name='viewport']").remove() }, _attachMeta: function () { var e, t = this.options, n = t.icon; if (this._clearExistingMeta(), g || z.prepend(x({ height: "", scale: this.options.retina ? 1 / c.devicePixelRatio : "1.0" })), z.prepend(C(t)), n) { "string" == typeof n && (n = { "": n }); for (e in n) z.prepend(D({ icon: n[e], size: e })) } t.useNativeScrolling && a(this.element) }, _attachHideBarHandlers: function () { var e = this, t = L(e, "_hideBar"); !c.mobileOS.appMode && e.options.hideAddressBar && A && !e.options.useNativeScrolling && (e._initialHeight = {}, F.on("load", t), l.onResize(function () { setTimeout(window.scrollTo, 0, 0, 1) })) }, _setupDocumentTitle: function () { var e = this, n = document.title; e.pane.bind("viewShow", function (e) { var i = e.view.title; document.title = i !== t ? i : n }) }, _hideBar: function () { var t = this, n = t.element; n.height(l.support.transforms.css + "calc(100% + " + M + "px)"), e(window).trigger(l.support.resize) } }); l.mobile.Application = H, l.ui.plugin(H, l.mobile, "Mobile") }(window.kendo.jQuery), window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.actionsheet.min", ["kendo.mobile.popover.min", "kendo.mobile.shim.min"], e) }(function () { return function (e, t) { var n = window.kendo, i = n.support, o = n.mobile.ui, r = o.Shim, a = o.Popup, s = o.Widget, l = "open", d = "close", c = "command", u = "li>a", h = "actionsheetContext", p = '
', f = n.template('
#:cancel# '), g = s.extend({ init: function (t, l) { var d, c, h, g = this, m = i.mobileOS; s.fn.init.call(g, t, l), l = g.options, h = l.type, t = g.element, c = "auto" === h ? m && m.tablet : "tablet" === h, d = c ? a : r, l.cancelTemplate && (f = n.template(l.cancelTemplate)), t.addClass("km-actionsheet").append(f({ cancel: g.options.cancel })).wrap(p).on("up", u, "_click").on("click", u, n.preventDefault), g.view().bind("destroy", function () { g.destroy() }), g.wrapper = t.parent().addClass(h ? " km-actionsheet-" + h : ""), g.shim = new d(g.wrapper, e.extend({ modal: m.ios && m.majorVersion < 7, className: "km-actionsheet-root" }, g.options.popup)), g._closeProxy = e.proxy(g, "_close"), g._shimHideProxy = e.proxy(g, "_shimHide"), g.shim.bind("hide", g._shimHideProxy), c && n.onResize(g._closeProxy), n.notify(g, o) }, events: [l, d, c], options: { name: "ActionSheet", cancel: "Cancel", type: "auto", popup: { height: "auto" } }, open: function (t, n) { var i = this; i.target = e(t), i.context = n, i.shim.show(t) }, close: function () { this.context = this.target = null, this.shim.hide() }, openFor: function (e) { var t = this, n = e.data(h); t.open(e, n), t.trigger(l, { target: e, context: n }) }, destroy: function () { s.fn.destroy.call(this), n.unbindResize(this._closeProxy), this.shim.destroy() }, _click: function (t) { var i, o, r, a; t.isDefaultPrevented() || (i = e(t.currentTarget), o = i.data("action"), o && (r = { target: this.target, context: this.context }, a = this.options.$angular, a ? this.element.injector().get("$parse")(o)(a[0])(r) : n.getter(o)(window)(r)), this.trigger(c, { target: this.target, context: this.context, currentTarget: i }), t.preventDefault(), this._close()) }, _shimHide: function (e) { this.trigger(d) ? e.preventDefault() : this.context = this.target = null }, _close: function (e) { this.trigger(d) ? e.preventDefault() : this.close() } }); o.plugin(g) }(window.kendo.jQuery), window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.button.min", ["kendo.userevents.min"], e) }(function () {
return function (e, t) {
function n(t, n, i) { e(n.target).closest(".km-button,.km-detail").toggleClass("km-state-active", i), c && t.deactivateTimeoutID && (clearTimeout(t.deactivateTimeoutID), t.deactivateTimeoutID = 0) } function i(t) { return e('
' + t + " ") } var o = window.kendo, r = o.mobile, a = r.ui, s = a.Widget, l = o.support, d = l.mobileOS, c = d.android && d.flatVersion >= 300, u = "click", h = "disabled", p = "km-state-disabled", f = s.extend({
init: function (e, t) { var i, r = this; s.fn.init.call(r, e, t), i = "up" === r.options.clickOn, r._wrap(), r._style(), i || r.element.attr("data-navigate-on-press", !0), r.options.enable = r.options.enable && !r.element.attr(h), r.enable(r.options.enable), r._userEvents = new o.UserEvents(r.element, { allowSelection: !i, fastTap: !0, press: function (e) { r._activate(e) }, release: function (e) { n(r, e, !1), i || e.event.stopPropagation() } }), r._userEvents.bind(i ? "tap" : "press", function (e) { r._release(e) }), c && r.element.on("move", function (e) { r._timeoutDeactivate(e) }) }, destroy: function () { s.fn.destroy.call(this), this._userEvents.destroy() }, events: [u], options: { name: "Button", icon: "", style: "", badge: "", clickOn: "up", enable: !0 }, badge: function (e) { var t = this.badgeElement = this.badgeElement || i(e).appendTo(this.element); return e || 0 === e ? (t.html(e), this) : e === !1 ? (t.empty().remove(), this.badgeElement = !1, this) : t.html() }, enable: function (e) { var n = this.element; t === e && (e = !0), this.options.enable = e, e ? n.removeAttr(h) : n.attr(h, h), n.toggleClass(p, !e) }, _timeoutDeactivate: function (e) { this.deactivateTimeoutID || (this.deactivateTimeoutID = setTimeout(n, 500, this, e, !1)) }, _activate: function (e) { var t = document.activeElement, i = t ? t.nodeName : ""; this.options.enable && (n(this, e, !0), "INPUT" != i && "TEXTAREA" != i || t.blur()) }, _release: function (n) { var i = this; if (!(n.which > 1)) return i.options.enable ? (i.trigger(u, { target: e(n.target), button: i.element }) && n.preventDefault(), t) : (n.preventDefault(), t) }, _style: function () { var t, n = this.options.style, i = this.element; n && (t = n.split(" "), e.each(t, function () { i.addClass("km-" + this) })) }, _wrap: function () {
var t = this, n = t.options.icon, o = t.options.badge, r = '
').children("span.km-text")),
!l[0] && n && (s[0] || (r += " km-notext"), t.iconElement = a.prepend(e(r + '" />'))), (o || 0 === o) && (t.badgeElement = i(o).appendTo(a))
}
}), g = f.extend({ options: { name: "BackButton", style: "back" }, init: function (e, n) { var i = this; f.fn.init.call(i, e, n), t === i.element.attr("href") && i.element.attr("href", "#:back") } }), m = f.extend({ options: { name: "DetailButton", style: "" }, init: function (e, t) { f.fn.init.call(this, e, t) }, _style: function () { var t, n = this.options.style + " detail", i = this.element; n && (t = n.split(" "), e.each(t, function () { i.addClass("km-" + this) })) }, _wrap: function () { var t = this, n = t.options.icon, i = '
'))) } }); a.plugin(f), a.plugin(g), a.plugin(m)
}(window.kendo.jQuery), window.kendo
}, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.buttongroup.min", ["kendo.core.min"], e) }(function () { return function (e, t) { function n(e) { return "k-" + e + " km-" + e } function i(t) { return e('
' + t + " ") } var o = window.kendo, r = o.mobile.ui, a = r.Widget, s = "state-active", l = "state-disabled", d = "select", c = "li:not(.km-" + s + ")", u = a.extend({ init: function (e, t) { var i = this; a.fn.init.call(i, e, t), i.element.addClass("km-buttongroup k-widget k-button-group").find("li").each(i._button), i.element.on(i.options.selectOn, c, "_select"), i._enable = !0, i.select(i.options.index), i.options.enable || (i._enable = !1, i.wrapper.addClass(n(l))) }, events: [d], options: { name: "ButtonGroup", selectOn: "down", index: -1, enable: !0 }, current: function () { return this.element.find(".km-" + s) }, select: function (i) { var o = this, r = -1; i !== t && i !== -1 && o._enable && !e(i).is(".km-" + l) && (o.current().removeClass(n(s)), "number" == typeof i ? (r = i, i = e(o.element[0].children[i])) : i.nodeType && (i = e(i), r = i.index()), i.addClass(n(s)), o.selectedIndex = r) }, badge: function (t, n) { var o, r = this.element; return isNaN(t) || (t = r.children().get(t)), t = r.find(t), o = e(t.children(".km-badge")[0] || i(n).appendTo(t)), n || 0 === n ? (o.html(n), this) : n === !1 ? (o.empty().remove(), this) : o.html() }, enable: function (e) { t === e && (e = !0), this.wrapper.toggleClass(n(l), !e), this._enable = this.options.enable = e }, _button: function () { var t = e(this).addClass(n("button")), r = o.attrValue(t, "icon"), a = o.attrValue(t, "badge"), s = t.children("span"), l = t.find("img").addClass(n("image")); s[0] || (s = t.wrapInner("
").children("span")), s.addClass(n("text")), !l[0] && r && t.prepend(e('
')), (a || 0 === a) && i(a).appendTo(t) }, _select: function (e) { e.which > 1 || e.isDefaultPrevented() || !this._enable || (this.select(e.currentTarget), this.trigger(d, { index: this.selectedIndex })) } }); r.plugin(u) }(window.kendo.jQuery), window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.collapsible.min", ["kendo.core.min"], e) }(function () { return function (e, t) { var n = window.kendo, i = n.mobile.ui, o = i.Widget, r = "km-collapsible", a = "km-collapsible-header", s = "km-collapsible-content", l = "km-collapsibleinset", d = "
", c = "
", u = "km-collapsed", h = "km-expanded", p = "km-animated", f = "left", g = "expand", m = "collapse", v = o.extend({ init: function (t, i) { var a = this, s = e(t); o.fn.init.call(a, s, i), s.addClass(r), a._buildHeader(), a.content = s.children().not(a.header).wrapAll(c).parent(), a._userEvents = new n.UserEvents(a.header, { fastTap: !0, tap: function () { a.toggle() } }), s.addClass(a.options.collapsed ? u : h), a.options.inset && s.addClass(l), a.options.animation ? (a.content.addClass(p), a.content.height(0), a.options.collapsed && a.content.hide()) : a.options.collapsed && a.content.hide() }, events: [g, m], options: { name: "Collapsible", collapsed: !0, collapseIcon: "arrow-n", expandIcon: "arrow-s", iconPosition: f, animation: !0, inset: !1 }, destroy: function () { o.fn.destroy.call(this), this._userEvents.destroy() }, expand: function (e) { var t = this.options.collapseIcon, i = this.content, o = n.support.mobileOS.ios; this.trigger(g) || (t && this.header.find(".km-icon").removeClass().addClass("km-icon km-" + t), this.element.removeClass(u).addClass(h), this.options.animation && !e ? (i.off("transitionend"), i.show(), o && i.removeClass(p), i.height(this._getContentHeight()), o && i.addClass(p), n.resize(i)) : i.show()) }, collapse: function (e) { var t = this.options.expandIcon, n = this.content; this.trigger(m) || (t && this.header.find(".km-icon").removeClass().addClass("km-icon km-" + t), this.element.removeClass(h).addClass(u), this.options.animation && !e ? (n.one("transitionend", function () { n.hide() }), n.height(0)) : n.hide()) }, toggle: function (e) { this.isCollapsed() ? this.expand(e) : this.collapse(e) }, isCollapsed: function () { return this.element.hasClass(u) }, resize: function () { !this.isCollapsed() && this.options.animation && this.content.height(this._getContentHeight()) }, _buildHeader: function () { var t = this.element.children(":header").wrapAll(d), n = e('
'), i = this.options.collapsed ? this.options.expandIcon : this.options.collapseIcon, o = this.options.iconPosition; i && (t.prepend(n), n.addClass("km-" + i)), this.header = t.parent(), this.header.addClass("km-icon-" + o) }, _getContentHeight: function () { var e, t = this.content.attr("style"); return this.content.css({ position: "absolute", visibility: "hidden", height: "auto" }), e = this.content.height(), this.content.attr("style", t ? t : ""), e } }); i.plugin(v) }(window.kendo.jQuery), window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.listview.min", ["kendo.data.min", "kendo.userevents.min", "kendo.mobile.button.min"], e) }(function () { return function (e, t) { function n() { return this.nodeType === v.TEXT_NODE && this.nodeValue.match(U) } function i(e, t) { t && !e[0].querySelector(".km-icon") && e.prepend('
') } function o(e) { i(e, D(e, "icon")), i(e, D(e.children(S), "icon")) } function r(e) { var t = e.parent(), o = e.add(t.children(m.roleSelector("detailbutton"))), r = t.contents().not(o).not(n); r.length || (e.addClass("km-listview-link").attr(m.attr("role"), "listview-link"), i(e, D(t, "icon")), i(e, D(e, "icon"))) } function a(e) { if (e[0].querySelector("input[type=checkbox],input[type=radio]")) { var t = e.parent(); t.contents().not(e).not(function () { return 3 == this.nodeType })[0] || (e.addClass("km-listview-label"), e.children("[type=checkbox],[type=radio]").addClass("km-widget km-icon km-check")) } } function s(t, n) { e(t).css("transform", "translate3d(0px, " + n + "px, 0px)") } var l, d, c, u, h, p, f, g, m = window.kendo, v = window.Node, _ = m.mobile, b = _.ui, w = m._outerHeight, k = m.data.DataSource, y = b.DataBoundWidget, x = ".km-list > li, > li:not(.km-group-container)", C = ".km-listview-link, .km-listview-label", S = "[" + m.attr("icon") + "]", T = e.proxy, D = m.attrValue, A = "km-group-title", E = "km-state-active", I = '
', M = m.template('
#= this.headerTemplate(data) #
#= kendo.render(this.template, data.items)# '), R = '
', F = m.template('
'), P = ".kendoMobileListView", z = "styled", B = "dataBound", L = "dataBinding", H = "itemChange", N = "click", O = "change", V = "progress", W = "function", U = /^\s+$/, j = /button/, q = m.Class.extend({ init: function (e) { var t, n, i = e.scroller(); i && (this.options = e.options, this.element = e.element, this.scroller = e.scroller(), this._shouldFixHeaders(), t = this, n = function () { t._cacheHeaders() }, e.bind("resize", n), e.bind(z, n), e.bind(B, n), this._scrollHandler = function (e) { t._fixHeader(e) }, i.bind("scroll", this._scrollHandler)) }, destroy: function () { var e = this; e.scroller && e.scroller.unbind("scroll", e._scrollHandler) }, _fixHeader: function (t) { if (this.fixedHeaders) { var n, i, o, r = 0, a = this.scroller, s = this.headers, l = t.scrollTop; do { if (n = s[r++], !n) { o = e("
"); break } i = n.offset, o = n.header } while (i + 1 > l); this.currentHeader != r && (a.fixedContainer.html(o.clone()), this.currentHeader = r) } }, _shouldFixHeaders: function () { this.fixedHeaders = "group" === this.options.type && this.options.fixedHeaders }, _cacheHeaders: function () { if (this._shouldFixHeaders(), this.fixedHeaders) { var t = [], n = this.scroller.scrollTop; this.element.find("." + A).each(function (i, o) { o = e(o), t.unshift({ offset: o.position().top + n, header: o }) }), this.headers = t, this._fixHeader({ scrollTop: n }) } } }), G = function () { return { page: 1 } }, $ = m.Class.extend({ init: function (e) { var t = this, n = e.options, i = e.scroller(), o = n.pullParameters || G; this.listView = e, this.scroller = i, e.bind("_dataSource", function (e) { t.setDataSource(e.dataSource) }), i.setOptions({ pullToRefresh: !0, pull: function () { t._pulled || (t._pulled = !0, t.dataSource.read(o.call(e, t._first))) }, messages: { pullTemplate: n.messages.pullTemplate, releaseTemplate: n.messages.releaseTemplate, refreshTemplate: n.messages.refreshTemplate } }) }, setDataSource: function (e) { var t = this; this._first = e.view()[0], this.dataSource = e, e.bind("change", function () { t._change() }), e.bind("error", function () { t._change() }) }, _change: function () { var e, t = this.scroller, n = this.dataSource; this._pulled && t.pullHandled(), !this._pulled && this._first || (e = n.view(), e[0] && (this._first = e[0])), this._pulled = !1 } }), K = m.Observable.extend({ init: function (e) { var t = this; m.Observable.fn.init.call(t), t.buffer = e.buffer, t.height = e.height, t.item = e.item, t.items = [], t.footer = e.footer, t.buffer.bind("reset", function () { t.refresh() }) }, refresh: function () { for (var e, t, n, i, o = this.buffer, r = this.items, a = !1; r.length;)r.pop().destroy(); for (this.offset = o.offset, e = this.item, i = 0; i < o.viewSize; i++) { if (i === o.total()) { a = !0; break } n = e(this.content(this.offset + r.length)), n.below(t), t = n, r.push(n) } this.itemCount = r.length, this.trigger("reset"), this._resize(), a && this.trigger("endReached") }, totalHeight: function () { if (!this.items[0]) return 0; var e = this, t = e.items, n = t[0].top, i = t[t.length - 1].bottom, o = (i - n) / e.itemCount, r = e.buffer.length - e.offset - e.itemCount; return (this.footer ? this.footer.height : 0) + i + r * o }, batchUpdate: function (e) { var t, n, i = this.height(), o = this.items, r = this.offset; if (o[0]) { if (this.lastDirection) for (; o[o.length - 1].bottom > e + 2 * i && 0 !== this.offset;)this.offset--, t = o.pop(), t.update(this.content(this.offset)), t.above(o[0]), o.unshift(t); else for (; o[0].top < e - i;) { if (n = this.offset + this.itemCount, n === this.buffer.total()) { this.trigger("endReached"); break } if (n === this.buffer.length) break; t = o.shift(), t.update(this.content(this.offset + this.itemCount)), t.below(o[o.length - 1]), o.push(t), this.offset++ } r !== this.offset && this._resize() } }, update: function (e) { var t, n, i, o, r = this, a = this.items, s = this.height(), l = this.itemCount, d = s / 2, c = (this.lastTop || 0) > e, u = e - d, h = e + s + d; a[0] && (this.lastTop = e, this.lastDirection = c, c ? a[0].top > u && a[a.length - 1].bottom > h + d && this.offset > 0 && (this.offset--, t = a.pop(), n = a[0], t.update(this.content(this.offset)), a.unshift(t), t.above(n), r._resize()) : a[a.length - 1].bottom < h && a[0].top < u - d && (o = this.offset + l, o === this.buffer.total() ? this.trigger("endReached") : o !== this.buffer.length && (t = a.shift(), i = a[a.length - 1], a.push(t), t.update(this.content(this.offset + this.itemCount)), r.offset++, t.below(i), r._resize()))) }, content: function (e) { return this.buffer.at(e) }, destroy: function () { this.unbind() }, _resize: function () { var e = this.items, t = 0, n = 0, i = e[0], o = e[e.length - 1]; i && (t = i.top, n = o.bottom), this.trigger("resize", { top: t, bottom: n }), this.footer && this.footer.below(o) } }); m.mobile.ui.VirtualList = K, l = m.Class.extend({ init: function (t, n) { var i = t.append([n], !0)[0], o = i.offsetHeight; e.extend(this, { top: 0, element: i, listView: t, height: o, bottom: o }) }, update: function (e) { this.element = this.listView.setDataItem(this.element, e) }, above: function (e) { e && (this.height = this.element.offsetHeight, this.top = e.top - this.height, this.bottom = e.top, s(this.element, this.top)) }, below: function (e) { e && (this.height = this.element.offsetHeight, this.top = e.bottom, this.bottom = this.top + this.height, s(this.element, this.top)) }, destroy: function () { m.destroy(this.element), e(this.element).remove() } }), d = '
', c = m.Class.extend({ init: function (t) { this.element = e('
').appendTo(t.element), this._loadIcon = e(d).appendTo(this.element) }, enable: function () { this.element.show(), this.height = w(this.element, !0) }, disable: function () { this.element.hide(), this.height = 0 }, below: function (e) { e && (this.top = e.bottom, this.bottom = this.height + this.top, s(this.element, this.top)) } }), u = c.extend({ init: function (t, n) { this._loadIcon = e(d).hide(), this._loadButton = e('
' + t.options.messages.loadMoreText + " ").hide(), this.element = e('
').append(this._loadIcon).append(this._loadButton).appendTo(t.element); var i = this; this._loadButton.kendoMobileButton().data("kendoMobileButton").bind("click", function () { i._hideShowButton(), n.next() }), n.bind("resize", function () { i._showLoadButton() }), this.height = w(this.element, !0), this.disable() }, _hideShowButton: function () { this._loadButton.hide(), this.element.addClass("km-scroller-refresh"), this._loadIcon.css("display", "block") }, _showLoadButton: function () { this._loadButton.show(), this.element.removeClass("km-scroller-refresh"), this._loadIcon.hide() } }), h = m.Class.extend({ init: function (e) { var t = this; this.chromeHeight = w(e.wrapper.children().not(e.element)), this.listView = e, this.scroller = e.scroller(), this.options = e.options, e.bind("_dataSource", function (e) { t.setDataSource(e.dataSource, e.empty) }), e.bind("resize", function () { t.list.items.length && (t.scroller.reset(), t.buffer.range(0), t.list.refresh()) }), this.scroller.makeVirtual(), this._scroll = function (e) { t.list.update(e.scrollTop) }, this.scroller.bind("scroll", this._scroll), this._scrollEnd = function (e) { t.list.batchUpdate(e.scrollTop) }, this.scroller.bind("scrollEnd", this._scrollEnd) }, destroy: function () { this.list.unbind(), this.buffer.unbind(), this.scroller.unbind("scroll", this._scroll), this.scroller.unbind("scrollEnd", this._scrollEnd) }, setDataSource: function (t, n) { var i, o, r, a, s = this, d = this.options, h = this.listView, p = h.scroller(), f = d.loadMore; if (this.dataSource = t, i = t.pageSize() || d.virtualViewSize, !i && !n) throw Error("the DataSource does not have page size configured. Page Size setting is mandatory for the mobile listview virtual scrolling to work as expected."); this.buffer && this.buffer.destroy(), o = new m.data.Buffer(t, Math.floor(i / 2), f), r = f ? new u(h, o) : new c(h), this.list && this.list.destroy(), a = new K({ buffer: o, footer: r, item: function (e) { return new l(h, e) }, height: function () { return p.height() } }), a.bind("resize", function () { s.updateScrollerSize(), h.updateSize() }), a.bind("reset", function () { s.footer.enable() }), a.bind("endReached", function () { r.disable(), s.updateScrollerSize() }), o.bind("expand", function () { a.lastDirection = !1, a.batchUpdate(p.scrollTop) }), e.extend(this, { buffer: o, scroller: p, list: a, footer: r }) }, updateScrollerSize: function () { this.scroller.virtualSize(0, this.list.totalHeight() + this.chromeHeight) }, refresh: function () { this.list.refresh() }, reset: function () { this.buffer.range(0), this.list.refresh() } }), p = m.Class.extend({ init: function (e) { var t, n = this; this.listView = e, this.options = e.options, t = this, this._refreshHandler = function (e) { t.refresh(e) }, this._progressHandler = function () { e.showLoading() }, e.bind("_dataSource", function (e) { n.setDataSource(e.dataSource) }) }, destroy: function () { this._unbindDataSource() }, reset: function () { }, refresh: function (e) { var n, i, o, r, a, s, l, d = e && e.action, c = e && e.items, u = this.listView, h = this.dataSource, p = this.options.appendOnRefresh, f = h.view(), g = h.group(), m = g && g[0]; return "itemchange" === d ? (u._hasBindingTarget() || (n = u.findByDataItem(c)[0], n && u.setDataItem(n, c[0])), t) : (a = "add" === d && !m || p && !u._filter, s = "remove" === d && !m, a ? i = [] : s && (i = u.findByDataItem(c)), u.trigger(L, { action: d || "rebind", items: c, removedItems: i, index: e && e.index }) ? (this._shouldShowLoading() && u.hideLoading(), t) : ("add" !== d || m ? "remove" !== d || m ? m ? u.replaceGrouped(f) : p && !u._filter ? (o = u.prepend(f), r = f) : u.replace(f) : (o = [], u.remove(c)) : (l = f.indexOf(c[0]), l > -1 && (o = u.insertAt(c, l), r = c)), this._shouldShowLoading() && u.hideLoading(), u.trigger(B, { ns: b, addedItems: o, addedDataItems: r }), t)) }, setDataSource: function (e) { this.dataSource && this._unbindDataSource(), this.dataSource = e, e.bind(O, this._refreshHandler), this._shouldShowLoading() && this.dataSource.bind(V, this._progressHandler) }, _unbindDataSource: function () { this.dataSource.unbind(O, this._refreshHandler).unbind(V, this._progressHandler) }, _shouldShowLoading: function () { var e = this.options; return !e.pullToRefresh && !e.loadMore && !e.endlessScroll } }), f = m.Class.extend({ init: function (t) { var n = this, i = t.options.filterable, o = "change paste", r = this; this.listView = t, this.options = i, t.element.before(F({ placeholder: i.placeholder || "Search..." })), i.autoFilter !== !1 && (o += " keyup"), this.element = t.wrapper.find(".km-search-form"), this.searchInput = t.wrapper.find("input[type=search]").closest("form").on("submit" + P, function (e) { e.preventDefault() }).end().on("focus" + P, function () { n._oldFilter = n.searchInput.val() }).on(o.split(" ").join(P + " ") + P, T(this._filterChange, this)), this.clearButton = t.wrapper.find(".km-filter-reset").on(N, T(this, "_clearFilter")).hide(), this._dataSourceChange = e.proxy(this._refreshInput, this), t.bind("_dataSource", function (e) { e.dataSource.bind("change", r._dataSourceChange) }) }, _refreshInput: function () { var e = this.listView.dataSource.filter(), t = this.listView._filter.searchInput; t.val(e && e.filters[0].field === this.listView.options.filterable.field ? e.filters[0].value : "") }, _search: function (e) { this._filter = !0, this.clearButton[e ? "show" : "hide"](), this.listView.dataSource.filter(e) }, _filterChange: function (e) { var t = this; "paste" == e.type && this.options.autoFilter !== !1 ? setTimeout(function () { t._applyFilter() }, 1) : this._applyFilter() }, _applyFilter: function () { var e = this.options, t = this.searchInput.val(), n = t.length ? { field: e.field, operator: e.operator || "startswith", ignoreCase: e.ignoreCase, value: t } : null; t !== this._oldFilter && (this._oldFilter = t, this._search(n)) }, _clearFilter: function (e) { this.searchInput.val(""), this._search(null), e.preventDefault() } }), g = y.extend({ init: function (t, n) { var i = this; y.fn.init.call(this, t, n), t = this.element, n = this.options, n.scrollTreshold && (n.scrollThreshold = n.scrollTreshold), t.on("down", C, "_highlight").on("move up cancel", C, "_dim"), this._userEvents = new m.UserEvents(t, { fastTap: !0, filter: x, allowSelection: !0, tap: function (e) { i._click(e) } }), t.css("-ms-touch-action", "auto"), t.wrap(R), this.wrapper = this.element.parent(), this._headerFixer = new q(this), this._itemsCache = {}, this._templates(), this.virtual = n.endlessScroll || n.loadMore, this._style(), this.options.$angular && (this.virtual || this.options.pullToRefresh) ? setTimeout(e.proxy(this, "_start")) : this._start() }, _start: function () { var e = this.options; this.options.filterable && (this._filter = new f(this)), this._itemBinder = this.virtual ? new h(this) : new p(this), this.options.pullToRefresh && (this._pullToRefreshHandler = new $(this)), this.setDataSource(e.dataSource), this._enhanceItems(this.items()), m.notify(this, b) }, events: [N, L, B, H], options: { name: "ListView", style: "", type: "flat", autoBind: !0, fixedHeaders: !1, template: "#:data#", headerTemplate: '
#:value# ', appendOnRefresh: !1, loadMore: !1, endlessScroll: !1, scrollThreshold: 30, pullToRefresh: !1, messages: { loadMoreText: "Press to load more", pullTemplate: "Pull to refresh", releaseTemplate: "Release to refresh", refreshTemplate: "Refreshing" }, pullOffset: 140, filterable: !1, virtualViewSize: null }, refresh: function () { this._itemBinder.refresh() }, reset: function () { this._itemBinder.reset() }, setDataSource: function (e) { var t = !e; this.dataSource = k.create(e), this.trigger("_dataSource", { dataSource: this.dataSource, empty: t }), this.options.autoBind && !t && (this.items().remove(), this.dataSource.fetch()) }, destroy: function () { y.fn.destroy.call(this), m.destroy(this.element), this._userEvents.destroy(), this._itemBinder && this._itemBinder.destroy(), this._headerFixer && this._headerFixer.destroy(), this.element.unwrap(), delete this.element, delete this.wrapper, delete this._userEvents }, items: function () { return "group" === this.options.type ? this.element.find(".km-list").children() : this.element.children().not(".km-load-more") }, scroller: function () { return this._scrollerInstance || (this._scrollerInstance = this.element.closest(".km-scroll-wrapper").data("kendoMobileScroller")), this._scrollerInstance }, showLoading: function () { var e = this.view(); e && e.loader && e.loader.show() }, hideLoading: function () { var e = this.view(); e && e.loader && e.loader.hide() }, insertAt: function (e, t, n) { var i = this; return i._renderItems(e, function (o) { if (0 === t ? i.element.prepend(o) : t === -1 ? i.element.append(o) : i.items().eq(t - 1).after(o), n) for (var r = 0; r < o.length; r++)i.trigger(H, { item: o.eq(r), data: e[r], ns: b }) }) }, append: function (e, t) { return this.insertAt(e, -1, t) }, prepend: function (e, t) { return this.insertAt(e, 0, t) }, replace: function (e) { return this.options.type = "flat", this._angularItems("cleanup"), m.destroy(this.element.children()), this.element.empty(), this._userEvents.cancel(), this._style(), this.insertAt(e, 0) }, replaceGrouped: function (t) { this.options.type = "group", this._angularItems("cleanup"), this.element.empty(); var n = e(m.render(this.groupTemplate, t)); this._enhanceItems(n.children("ul").children("li")), this.element.append(n), _.init(n), this._style(), this._angularItems("compile") }, remove: function (e) { var t = this.findByDataItem(e); this.angular("cleanup", function () { return { elements: t } }), m.destroy(t), t.remove() }, findByDataItem: function (e) { var t, n, i = []; for (t = 0, n = e.length; t < n; t++)i[t] = "[data-" + m.ns + "uid=" + e[t].uid + "]"; return this.element.find(i.join(",")) }, setDataItem: function (t, n) { var i = this, o = function (o) { var r = e(o[0]); m.destroy(t), i.angular("cleanup", function () { return { elements: [e(t)] } }), e(t).replaceWith(r), i.trigger(H, { item: r, data: n, ns: b }) }; return this._renderItems([n], o)[0] }, updateSize: function () { this._size = this.getSize() }, _renderItems: function (t, n) { var i = e(m.render(this.template, t)); return n(i), this.angular("compile", function () { return { elements: i, data: t.map(function (e) { return { dataItem: e } }) } }), _.init(i), this._enhanceItems(i), i }, _dim: function (e) { this._toggle(e, !1) }, _highlight: function (e) { this._toggle(e, !0) }, _toggle: function (t, n) { if (!(t.which > 1)) { var i = e(t.currentTarget), o = i.parent(), r = D(i, "role") || "", a = !r.match(j), s = t.isDefaultPrevented(); a && o.toggleClass(E, n && !s) } }, _templates: function () { var e = this.options.template, t = this.options.headerTemplate, n = ' data-uid="#=arguments[0].uid || ""#"', i = {}, o = {}; typeof e === W && (i.template = e, e = "#=this.template(data)#"), this.template = T(m.template("
" + e + " "), i), o.template = this.template, typeof t === W && (o._headerTemplate = t, t = "#=this._headerTemplate(data)#"), o.headerTemplate = m.template(t), this.groupTemplate = T(M, o) }, _click: function (t) { if (!(t.event.which > 1 || t.event.isDefaultPrevented())) { var n, i = t.target, o = e(t.event.target), r = o.closest(m.roleSelector("button", "detailbutton", "backbutton")), a = m.widgetInstance(r, b), s = i.attr(m.attr("uid")); s && (n = this.dataSource.getByUid(s)), this.trigger(N, { target: o, item: i, dataItem: n, button: a }) && t.preventDefault() } }, _styleGroups: function () { var t = this.element.children(); t.children("ul").addClass("km-list"), t.each(function () { var t = e(this), n = t.contents().first(); t.addClass("km-group-container"), n.is("ul") || n.is("div." + A) || n.wrap(I) }) }, _style: function () { var e = this.options, t = "group" === e.type, n = this.element, i = "inset" === e.style; n.addClass("km-listview").toggleClass("km-list", !t).toggleClass("km-virtual-list", this.virtual).toggleClass("km-listinset", !t && i).toggleClass("km-listgroup", t && !i).toggleClass("km-listgroupinset", t && i), n.parents(".km-listview")[0] || n.closest(".km-content").toggleClass("km-insetcontent", i), t && this._styleGroups(), this.trigger(z) }, _enhanceItems: function (t) { t.each(function () { var t, n = e(this), i = !1; n.children().each(function () { t = e(this), t.is("a") ? (r(t), i = !0) : t.is("label") && (a(t), i = !0) }), i || o(n) }) } }), b.plugin(g) }(window.kendo.jQuery), window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.navbar.min", ["kendo.core.min"], e) }(function () { return function (e, t) { function n(t, n) { var i = n.find("[" + o.attr("align") + "=" + t + "]"); if (i[0]) return e('
').append(i).prependTo(n) } function i(e) { var t = e.siblings(), n = !!e.children("ul")[0], i = !!t[0] && "" === o.trim(e.text()), r = !(!o.mobile.application || !o.mobile.application.element.is(".km-android")); e.prevAll().toggleClass("km-absolute", n), e.toggleClass("km-show-title", i), e.toggleClass("km-fill-title", i && !o.trim(e.html())), e.toggleClass("km-no-title", n), e.toggleClass("km-hide-title", r && !t.children().is(":visible")) } var o = window.kendo, r = o.mobile, a = r.ui, s = a.Widget, l = s.extend({ init: function (t, i) { var o = this; s.fn.init.call(o, t, i), t = o.element, o.container().bind("show", e.proxy(this, "refresh")), t.addClass("km-navbar").wrapInner(e('
')), o.leftElement = n("left", t), o.rightElement = n("right", t), o.centerElement = t.find(".km-view-title") }, options: { name: "NavBar" }, title: function (e) { this.element.find(o.roleSelector("view-title")).text(e), i(this.centerElement) }, refresh: function (e) { var t = e.view; this.title(t.options.title) }, destroy: function () { s.fn.destroy.call(this), o.destroy(this.element) } }); a.plugin(l) }(window.kendo.jQuery), window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.scrollview.min", ["kendo.fx.min", "kendo.data.min", "kendo.draganddrop.min"], e) }(function () {
return function (e, t) {
function n(e) { return "k-" + e + " km-" + e } var i, o, r, a, s, l, d, c, u = window.kendo, h = u.mobile, p = h.ui, f = e.proxy, g = u.effects.Transition, m = u.ui.Pane, v = u.ui.PaneDimensions, _ = p.DataBoundWidget, b = u.data.DataSource, w = u.data.Buffer, k = u.data.BatchBuffer, y = Math, x = y.abs, C = y.ceil, S = y.round, T = y.max, D = y.min, A = y.floor, E = "change", I = "changing", M = "refresh", R = "current-page", F = "virtual-page", P = "function", z = "itemChange", B = "cleanup", L = 3, H = -1, N = 0, O = 1, V = -1, W = 0, U = 1, j = u.Class.extend({ init: function (t) { var i = this, o = e("
"); t.element.append(o), this._changeProxy = f(i, "_change"), this._refreshProxy = f(i, "_refresh"), t.bind(E, this._changeProxy), t.bind(M, this._refreshProxy), e.extend(i, { element: o, scrollView: t }) }, items: function () { return this.element.children() }, _refresh: function (e) { var t, i = ""; for (t = 0; t < e.pageCount; t++)i += "
"; this.element.html(i), this.items().eq(e.page).addClass(n(R)) }, _change: function (e) { this.items().removeClass(n(R)).eq(e.page).addClass(n(R)) }, destroy: function () { this.scrollView.unbind(E, this._changeProxy), this.scrollView.unbind(M, this._refreshProxy), this.element.remove() } }); u.mobile.ui.ScrollViewPager = j, i = "transitionEnd", o = "dragStart", r = "dragEnd", a = u.Observable.extend({ init: function (t, n) { var a, s, l, d, c, h, p = this; u.Observable.fn.init.call(this), this.element = t, this.container = t.parent(), a = new u.ui.Movable(p.element), s = new g({ axis: "x", movable: a, onEnd: function () { p.trigger(i) } }), l = new u.UserEvents(t, { fastTap: !0, start: function (e) { 2 * x(e.x.velocity) >= x(e.y.velocity) ? l.capture() : l.cancel(), p.trigger(o, e), s.cancel() }, allowSelection: !0, end: function (e) { p.trigger(r, e) } }), d = new v({ element: p.element, container: p.container }), c = d.x, c.bind(E, function () { p.trigger(E) }), h = new m({ dimensions: d, userEvents: l, movable: a, elastic: !0 }), e.extend(p, { duration: n && n.duration || 1, movable: a, transition: s, userEvents: l, dimensions: d, dimension: c, pane: h }), this.bind([i, o, r, E], n) }, size: function () { return { width: this.dimensions.x.getSize(), height: this.dimensions.y.getSize() } }, total: function () { return this.dimension.getTotal() }, offset: function () { return -this.movable.x }, updateDimension: function () { this.dimension.update(!0) }, refresh: function () { this.dimensions.refresh() }, moveTo: function (e) { this.movable.moveAxis("x", -e) }, transitionTo: function (e, t, n) { n ? this.moveTo(-e) : this.transition.moveTo({ location: e, duration: this.duration, ease: t }) } }), u.mobile.ui.ScrollViewElasticPane = a, s = u.Observable.extend({ init: function (e, t, n) { var i = this; u.Observable.fn.init.call(this), i.element = e, i.pane = t, i._getPages(), this.page = 0, this.pageSize = n.pageSize || 1, this.contentHeight = n.contentHeight, this.enablePager = n.enablePager, this.pagerOverlay = n.pagerOverlay }, scrollTo: function (e, t) { this.page = e, this.pane.transitionTo(-e * this.pane.size().width, g.easeOutExpo, t) }, paneMoved: function (e, t, n, i) { var o, r, a = this, s = a.pane, l = s.size().width * a.pageSize, d = S, c = t ? g.easeOutBack : g.easeOutExpo; e === V ? d = C : e === U && (d = A), r = d(s.offset() / l), o = T(a.minSnap, D(-r * l, a.maxSnap)), r != a.page && n && n({ currentPage: a.page, nextPage: r }) && (o = -a.page * s.size().width), s.transitionTo(o, c, i) }, updatePage: function () { var e = this.pane, t = S(e.offset() / e.size().width); return t != this.page && (this.page = t, !0) }, forcePageUpdate: function () { return this.updatePage() }, resizeTo: function (e) { var t, n, i = this.pane, o = e.width; this.pageElements.width(o), "100%" === this.contentHeight && (t = this.element.parent().height(), this.enablePager === !0 && (n = this.element.parent().find("ol.km-pages"), !this.pagerOverlay && n.length && (t -= u._outerHeight(n, !0))), this.element.css("height", t), this.pageElements.css("height", t)), i.updateDimension(), this._paged || (this.page = A(i.offset() / o)), this.scrollTo(this.page, !0), this.pageCount = C(i.total() / o), this.minSnap = -(this.pageCount - 1) * o, this.maxSnap = 0 }, _getPages: function () { this.pageElements = this.element.find(u.roleSelector("page")), this._paged = this.pageElements.length > 0 } }), u.mobile.ui.ScrollViewContent = s, l = u.Observable.extend({
init: function (e, t, n) { var i = this; u.Observable.fn.init.call(this), i.element = e, i.pane = t, i.options = n, i._templates(), i.page = n.page || 0, i.pages = [], i._initPages(), i.resizeTo(i.pane.size()), i.pane.dimension.forceEnabled() }, setDataSource: function (e) { this.dataSource = b.create(e), this._buffer(), this._pendingPageRefresh = !1, this._pendingWidgetRefresh = !1 }, _viewShow: function () { var e = this; e._pendingWidgetRefresh && (setTimeout(function () { e._resetPages() }, 0), e._pendingWidgetRefresh = !1) }, _buffer: function () { var e = this.options.itemsPerPage; this.buffer && this.buffer.destroy(), this.buffer = e > 1 ? new k(this.dataSource, e) : new w(this.dataSource, 3 * e), this._resizeProxy = f(this, "_onResize"), this._resetProxy = f(this, "_onReset"), this._endReachedProxy = f(this, "_onEndReached"), this.buffer.bind({ resize: this._resizeProxy, reset: this._resetProxy, endreached: this._endReachedProxy }) }, _templates: function () { var e = this.options.template, t = this.options.emptyTemplate, n = {}, i = {}; typeof e === P && (n.template = e, e = "#=this.template(data)#"), this.template = f(u.template(e), n), typeof t === P && (i.emptyTemplate = t, t = "#=this.emptyTemplate(data)#"), this.emptyTemplate = f(u.template(t), i) }, _initPages: function () { var e, t, n = this.pages, i = this.element; for (t = 0; t < L; t++)e = new d(i), n.push(e); this.pane.updateDimension() }, resizeTo: function (e) { var t, n, i, o = this.pages, r = this.pane; for (t = 0; t < o.length; t++)o[t].setWidth(e.width); "auto" === this.options.contentHeight ? this.element.css("height", this.pages[1].element.height()) : "100%" === this.options.contentHeight && (n = this.element.parent().height(), this.options.enablePager === !0 && (i = this.element.parent().find("ol.km-pages"), !this.options.pagerOverlay && i.length && (n -= u._outerHeight(i, !0))), this.element.css("height", n), o[0].element.css("height", n), o[1].element.css("height", n), o[2].element.css("height", n)), r.updateDimension(), this._repositionPages(), this.width = e.width }, scrollTo: function (e) { var t, n = this.buffer; n.syncDataSource(), t = n.at(e), t && (this._updatePagesContent(e), this.page = e) }, paneMoved: function (e, t, n, i) { var o, r = this, a = r.pane, s = a.size().width, l = a.offset(), d = Math.abs(l) >= s / 3, c = t ? u.effects.Transition.easeOutBack : u.effects.Transition.easeOutExpo, h = r.page + 2 > r.buffer.total(), p = 0; e === U ? 0 !== r.page && (p = -1) : e !== V || h ? l > 0 && d && !h ? p = 1 : l < 0 && d && 0 !== r.page && (p = -1) : p = 1, o = r.page, p && (o = p > 0 ? o + 1 : o - 1), n && n({ currentPage: r.page, nextPage: o }) && (p = 0), 0 === p ? r._cancelMove(c, i) : p === -1 ? r._moveBackward(i) : 1 === p && r._moveForward(i) }, updatePage: function () { var e = this.pages; return 0 !== this.pane.offset() && (this.pane.offset() > 0 ? (e.push(this.pages.shift()), this.page++, this.setPageContent(e[2], this.page + 1)) : (e.unshift(this.pages.pop()), this.page--, this.setPageContent(e[0], this.page - 1)), this._repositionPages(), this._resetMovable(), !0) }, forcePageUpdate: function () { var e = this.pane.offset(), t = 3 * this.pane.size().width / 4; return x(e) > t && this.updatePage() }, _resetMovable: function () { this.pane.moveTo(0) }, _moveForward: function (e) {
this.pane.transitionTo(-this.width, u.effects.Transition.easeOutExpo, e)
}, _moveBackward: function (e) { this.pane.transitionTo(this.width, u.effects.Transition.easeOutExpo, e) }, _cancelMove: function (e, t) { this.pane.transitionTo(0, e, t) }, _resetPages: function () { this.page = this.options.page || 0, this._updatePagesContent(this.page), this._repositionPages(), this.trigger("reset") }, _onResize: function () { this.pageCount = C(this.dataSource.total() / this.options.itemsPerPage), this._pendingPageRefresh && (this._updatePagesContent(this.page), this._pendingPageRefresh = !1), this.trigger("resize") }, _onReset: function () { this.pageCount = C(this.dataSource.total() / this.options.itemsPerPage), this._resetPages() }, _onEndReached: function () { this._pendingPageRefresh = !0 }, _repositionPages: function () { var e = this.pages; e[0].position(H), e[1].position(N), e[2].position(O) }, _updatePagesContent: function (e) { var t = this.pages, n = e || 0; this.setPageContent(t[0], n - 1), this.setPageContent(t[1], n), this.setPageContent(t[2], n + 1) }, setPageContent: function (t, n) { var i = this.buffer, o = this.template, r = this.emptyTemplate, a = null; n >= 0 && (a = i.at(n), e.isArray(a) && !a.length && (a = null)), this.trigger(B, { item: t.element }), t.content(null !== a ? o(a) : r({})), u.mobile.init(t.element), this.trigger(z, { item: t.element, data: a, ns: u.mobile.ui }) }
}), u.mobile.ui.VirtualScrollViewContent = l, d = u.Class.extend({ init: function (t) { this.element = e("
"), this.width = t.width(), this.element.width(this.width), t.append(this.element) }, content: function (e) { this.element.html(e) }, position: function (e) { this.element.css("transform", "translate3d(" + this.width * e + "px, 0, 0)") }, setWidth: function (e) { this.width = e, this.element.width(e) } }), u.mobile.ui.VirtualPage = d, c = _.extend({ init: function (e, t) { var i, o, r, d = this; _.fn.init.call(d, e, t), t = d.options, e = d.element, u.stripWhitespace(e[0]), e.wrapInner("
").addClass("k-widget " + n("scrollview")), this.options.enablePager && (this.pager = new j(this), this.options.pagerOverlay && e.addClass(n("scrollview-overlay"))), d.inner = e.children().first(), d.page = 0, d.inner.css("height", t.contentHeight), d.pane = new a(d.inner, { duration: this.options.duration, transitionEnd: f(this, "_transitionEnd"), dragStart: f(this, "_dragStart"), dragEnd: f(this, "_dragEnd"), change: f(this, M) }), d.bind("resize", function () { d.pane.refresh() }), d.page = t.page, i = 0 === this.inner.children().length, o = i ? new l(d.inner, d.pane, t) : new s(d.inner, d.pane, t), o.page = d.page, o.bind("reset", function () { this._pendingPageRefresh = !1, d._syncWithContent(), d.trigger(M, { pageCount: o.pageCount, page: o.page }) }), o.bind("resize", function () { d.trigger(M, { pageCount: o.pageCount, page: o.page }) }), o.bind(z, function (e) { d.trigger(z, e), d.angular("compile", function () { return { elements: e.item, data: [{ dataItem: e.data }] } }) }), o.bind(B, function (e) { d.angular("cleanup", function () { return { elements: e.item } }) }), d._content = o, d.setDataSource(t.dataSource), r = d.container(), r.nullObject ? (d.viewInit(), d.viewShow()) : r.bind("show", f(this, "viewShow")).bind("init", f(this, "viewInit")) }, options: { name: "ScrollView", page: 0, duration: 400, velocityThreshold: .8, contentHeight: "auto", pageSize: 1, itemsPerPage: 1, bounceVelocityThreshold: 1.6, enablePager: !0, pagerOverlay: !1, autoBind: !0, template: "", emptyTemplate: "" }, events: [I, E, M], destroy: function () { _.fn.destroy.call(this), u.destroy(this.element) }, viewInit: function () { this.options.autoBind && this._content.scrollTo(this._content.page, !0) }, viewShow: function () { this.pane.refresh() }, refresh: function () { var e = this._content; e.resizeTo(this.pane.size()), this.page = e.page, this.trigger(M, { pageCount: e.pageCount, page: e.page }) }, content: function (e) { this.element.children().first().html(e), this._content._getPages(), this.pane.refresh() }, value: function (e) { var n = this.dataSource; return e ? (this.scrollTo(n.indexOf(e), !0), t) : n.at(this.page) }, scrollTo: function (e, t) { this._content.scrollTo(e, t), this._syncWithContent() }, prev: function () { var e = this, n = e.page - 1; e._content instanceof l ? e._content.paneMoved(U, t, function (t) { return e.trigger(I, t) }) : n > -1 && e.scrollTo(n) }, next: function () { var e = this, n = e.page + 1; e._content instanceof l ? e._content.paneMoved(V, t, function (t) { return e.trigger(I, t) }) : n < e._content.pageCount && e.scrollTo(n) }, setDataSource: function (e) { if (this._content instanceof l) { var t = !e; this.dataSource = b.create(e), this._content.setDataSource(this.dataSource), this.options.autoBind && !t && this.dataSource.fetch() } }, items: function () { return this.element.find(".km-" + F) }, _syncWithContent: function () { var e, n, i = this._content.pages, o = this._content.buffer; this.page = this._content.page, e = o ? o.at(this.page) : t, e instanceof Array || (e = [e]), n = i ? i[1].element : t, this.trigger(E, { page: this.page, element: n, data: e }) }, _dragStart: function () { this._content.forcePageUpdate() && this._syncWithContent() }, _dragEnd: function (e) { var t = this, n = e.x.velocity, i = this.options.velocityThreshold, o = W, r = x(n) > this.options.bounceVelocityThreshold; n > i ? o = U : n < -i && (o = V), this._content.paneMoved(o, r, function (e) { return t.trigger(I, e) }) }, _transitionEnd: function () { this._content.updatePage() && this._syncWithContent() } }), p.plugin(c)
}(window.kendo.jQuery), window.kendo
}, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.switch.min", ["kendo.fx.min", "kendo.userevents.min"], e) }(function () { return function (e, t) { function n(e) { return "km-" + e } function i(e, t, n) { return Math.max(t, Math.min(n, e)) } var o = window.kendo, r = o.mobile.ui, a = o._outerWidth, s = r.Widget, l = o.support, d = "change", c = "switch-on", u = "switch-off", h = "margin-left", p = "state-active", f = "state-disabled", g = "disabled", m = l.transitions.css === t ? "" : l.transitions.css, v = m + "transform", _ = e.proxy, b = '
{0} {1} ', w = s.extend({ init: function (t, n) { var i, r = this; s.fn.init.call(r, t, n), n = r.options, r.wrapper = e(o.format(b, n.onLabel, n.offLabel)), r.handle = r.wrapper.find(".km-switch-handle"), r.background = r.wrapper.find(".km-switch-background"), r.wrapper.insertBefore(r.element).prepend(r.element), r._drag(), r.origin = parseInt(r.background.css(h), 10), r.constrain = 0, r.snapPoint = 0, t = r.element[0], t.type = "checkbox", r._animateBackground = !0, i = r.options.checked, null === i && (i = t.checked), r.check(i), r.options.enable = r.options.enable && !r.element.attr(g), r.enable(r.options.enable), r.refresh(), o.notify(r, o.mobile.ui) }, refresh: function () { var e = this, t = a(e.handle, !0); e.width = e.wrapper.width(), e.constrain = e.width - t, e.snapPoint = e.constrain / 2, "number" != typeof e.origin && (e.origin = parseInt(e.background.css(h), 10)), e.background.data("origin", e.origin), e.check(e.element[0].checked) }, events: [d], options: { name: "Switch", onLabel: "on", offLabel: "off", checked: null, enable: !0 }, check: function (e) { var i = this, o = i.element[0]; return e === t ? o.checked : (i._position(e ? i.constrain : 0), o.checked = e, i.wrapper.toggleClass(n(c), e).toggleClass(n(u), !e), t) }, value: function () { return this.check.apply(this, arguments) }, destroy: function () { s.fn.destroy.call(this), this.userEvents.destroy() }, toggle: function () { var e = this; e.check(!e.element[0].checked) }, enable: function (e) { var i = this.element, o = this.wrapper; t === e && (e = !0), this.options.enable = e, e ? i.removeAttr(g) : i.attr(g, g), o.toggleClass(n(f), !e) }, _resize: function () { this.refresh() }, _move: function (e) { var t = this; e.preventDefault(), t._position(i(t.position + e.x.delta, 0, t.width - a(t.handle, !0))) }, _position: function (e) { var t = this; t.position = e, t.handle.css(v, "translatex(" + e + "px)"), t._animateBackground && t.background.css(h, t.origin + e) }, _start: function () { this.options.enable ? (this.userEvents.capture(), this.handle.addClass(n(p))) : this.userEvents.cancel() }, _stop: function () { var e = this; e.handle.removeClass(n(p)), e._toggle(e.position > e.snapPoint) }, _toggle: function (e) { var t, i = this, r = i.handle, a = i.element[0], s = a.checked, l = o.mobile.application && o.mobile.application.os.wp ? 100 : 200; i.wrapper.toggleClass(n(c), e).toggleClass(n(u), !e), i.position = t = e * i.constrain, i._animateBackground && i.background.kendoStop(!0, !0).kendoAnimate({ effects: "slideMargin", offset: t, reset: !0, reverse: !e, axis: "left", duration: l }), r.kendoStop(!0, !0).kendoAnimate({ effects: "slideTo", duration: l, offset: t + "px,0", reset: !0, complete: function () { s !== e && (a.checked = e, i.trigger(d, { checked: e })) } }) }, _drag: function () { var e = this; e.userEvents = new o.UserEvents(e.wrapper, { fastTap: !0, tap: function () { e.options.enable && e._toggle(!e.element[0].checked) }, start: _(e._start, e), move: _(e._move, e), end: _(e._stop, e) }) } }); r.plugin(w) }(window.kendo.jQuery), window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.tabstrip.min", ["kendo.core.min"], e) }(function () { return function (e, t) { function n(t) { return e('
' + t + " ") } var i = window.kendo, o = i.mobile.ui, r = o.Widget, a = "km-state-active", s = "select", l = r.extend({ init: function (t, n) { var i = this; r.fn.init.call(i, t, n), i.container().bind("show", e.proxy(this, "refresh")), i.element.addClass("km-tabstrip").find("a").each(i._buildButton).eq(i.options.selectedIndex).addClass(a), i.element.on("down", "a", "_release") }, events: [s], switchTo: function (t) { var n, i, o = this.element.find("a"), r = 0, a = o.length; if (!isNaN(t)) return this._setActiveItem(o.eq(t)), !0; for (; r < a; r++)if (n = o[r], i = n.href.replace(/(\#.+)(\?.+)$/, "$1"), i.indexOf(t, i.length - t.length) !== -1) return this._setActiveItem(e(n)), !0; return !1 }, switchByFullUrl: function (e) { var t; t = this.element.find("a[href$='" + e + "']"), this._setActiveItem(t) }, clear: function () { this.currentItem().removeClass(a) }, currentItem: function () { return this.element.children("." + a) }, badge: function (t, i) { var o, r = this.element; return isNaN(t) || (t = r.children().get(t)), t = r.find(t), o = e(t.find(".km-badge")[0] || n(i).insertAfter(t.children(".km-icon"))), i || 0 === i ? (o.html(i), this) : i === !1 ? (o.empty().remove(), this) : o.html() }, _release: function (t) { if (!(t.which > 1)) { var n = this, i = e(t.currentTarget); i[0] !== n.currentItem()[0] && (n.trigger(s, { item: i }) ? t.preventDefault() : n._setActiveItem(i)) } }, _setActiveItem: function (e) { e[0] && (this.clear(), e.addClass(a)) }, _buildButton: function () { var t = e(this), o = i.attrValue(t, "icon"), r = i.attrValue(t, "badge"), a = t.find("img"), s = e('
'); t.addClass("km-button").attr(i.attr("role"), "tab").contents().not(a).wrapAll('
'), a[0] ? a.addClass("km-image").prependTo(t) : (t.prepend(s), o && (s.addClass("km-" + o), (r || 0 === r) && n(r).insertAfter(s))) }, refresh: function (e) { var t = e.view.id; t && !this.switchTo(e.view.id) && this.switchTo(t) }, options: { name: "TabStrip", selectedIndex: 0, enable: !0 } }); o.plugin(l) }(window.kendo.jQuery), window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.mobile.min", ["kendo.core.min", "kendo.fx.min", "kendo.data.odata.min", "kendo.data.xml.min", "kendo.data.min", "kendo.data.signalr.min", "kendo.binder.min", "kendo.validator.min", "kendo.router.min", "kendo.view.min", "kendo.userevents.min", "kendo.draganddrop.min", "kendo.popup.min", "kendo.touch.min", "kendo.mobile.popover.min", "kendo.mobile.loader.min", "kendo.mobile.scroller.min", "kendo.mobile.shim.min", "kendo.mobile.view.min", "kendo.mobile.modalview.min", "kendo.mobile.drawer.min", "kendo.mobile.splitview.min", "kendo.mobile.pane.min", "kendo.mobile.application.min", "kendo.mobile.actionsheet.min", "kendo.mobile.button.min", "kendo.mobile.buttongroup.min", "kendo.mobile.collapsible.min", "kendo.mobile.listview.min", "kendo.mobile.navbar.min", "kendo.mobile.scrollview.min", "kendo.mobile.switch.min", "kendo.mobile.tabstrip.min", "kendo.angular.min"], e) }(function () { "bundle all"; return window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() }), function (e, define) { define("kendo.all.min", ["kendo.web.min", "kendo.dataviz.min", "kendo.mobile.min", "kendo.drawing.min", "kendo.dom.min"], e) }(function () { "bundle all"; return window.kendo }, "function" == typeof define && define.amd ? define : function (e, t, n) { (n || t)() });
//# sourceMappingURL=kendo.all.min.js.map